@semcore/date-picker 4.56.0-prerelease.2 → 4.56.1-prerelease.2
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/CHANGELOG.md +6 -0
- package/lib/cjs/components/Calendar.js +21 -21
- package/lib/cjs/components/DateRangeComparatorAbstract.js +29 -29
- package/lib/cjs/components/InputTrigger.js +29 -29
- package/lib/cjs/components/PickerAbstract.js +29 -29
- package/lib/cjs/components/RangePickerAbstract.js +29 -29
- package/lib/es6/components/Calendar.js +21 -21
- package/lib/es6/components/DateRangeComparatorAbstract.js +29 -29
- package/lib/es6/components/InputTrigger.js +29 -29
- package/lib/es6/components/PickerAbstract.js +29 -29
- package/lib/es6/components/RangePickerAbstract.js +29 -29
- package/lib/esm/components/Calendar.mjs +134 -134
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +114 -114
- package/lib/esm/components/InputTrigger.mjs +150 -150
- package/lib/esm/components/PickerAbstract.mjs +58 -58
- package/lib/esm/components/RangePickerAbstract.mjs +46 -46
- package/package.json +16 -16
|
@@ -4,72 +4,72 @@ import ne from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
import k from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
5
|
import $ from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import Y from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import Se from "@babel/runtime/helpers/esm/classCallCheck";
|
|
8
|
+
import Pe from "@babel/runtime/helpers/esm/createClass";
|
|
9
|
+
import Ie from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
+
import De from "@babel/runtime/helpers/esm/createSuper";
|
|
11
11
|
import p from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
12
|
import { sstyled as ca } from "@semcore/utils/lib/core/index";
|
|
13
|
-
import
|
|
13
|
+
import be, { sstyled as z, assignProps as O, Component as Re } from "@semcore/core";
|
|
14
14
|
import i from "react";
|
|
15
15
|
import ga from "@semcore/base-trigger";
|
|
16
16
|
import Q from "@semcore/input-mask";
|
|
17
17
|
import Ke from "@semcore/tooltip";
|
|
18
|
-
import { Flex as fa, Box as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { datesIntersects as
|
|
22
|
-
import { includesDate as
|
|
23
|
-
import
|
|
18
|
+
import { Flex as fa, Box as ha } from "@semcore/flex-box";
|
|
19
|
+
import va from "@semcore/icon/Calendar/m";
|
|
20
|
+
import ya from "@semcore/neighbor-location";
|
|
21
|
+
import { datesIntersects as ma } from "../utils/datesIntersects.mjs";
|
|
22
|
+
import { includesDate as ve } from "../utils/includesDate.mjs";
|
|
23
|
+
import ye from "dayjs";
|
|
24
24
|
import Ne from "@semcore/utils/lib/use/useEnhancedEffect";
|
|
25
25
|
import Oe from "@semcore/utils/lib/assignProps";
|
|
26
|
-
var
|
|
26
|
+
var Sa = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Pa = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Ia = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"], Da = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"], ba = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"], Ra = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"], xe = (
|
|
27
27
|
/*__reshadow_css_start__*/
|
|
28
28
|
(ca.insert(
|
|
29
29
|
/*__inner_css_start__*/
|
|
30
|
-
".
|
|
31
|
-
"
|
|
30
|
+
".___SPopper_e0y8u_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_e0y8u_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_e0y8u_gg_:active,.___SPopper_e0y8u_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_e0y8u_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_e0y8u_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_e0y8u_gg_,.___STitle_e0y8u_gg_{display:flex;align-items:center}.___STitle_e0y8u_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_e0y8u_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_e0y8u_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_e0y8u_gg_ .___SInner_e0y8u_gg_{justify-content:flex-start}.___SInputMask_e0y8u_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_e0y8u_gg_.__animationsDisabled_e0y8u_gg_{transition:none}.___SInputMask_e0y8u_gg_ .___SValue_e0y8u_gg_{letter-spacing:0}.___SIndicator_e0y8u_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_e0y8u_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_e0y8u_gg_._range_value_e0y8u_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_e0y8u_gg_._range_compare_e0y8u_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_e0y8u_gg_.__disabled_e0y8u_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_e0y8u_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_e0y8u_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_e0y8u_gg_ .___SMask_e0y8u_gg_,.___SDateRange_e0y8u_gg_ .___SValue_e0y8u_gg_,.___SSingleDateInput_e0y8u_gg_ .___SMask_e0y8u_gg_,.___SSingleDateInput_e0y8u_gg_ .___SValue_e0y8u_gg_{opacity:0}.___SSingleDateInput_e0y8u_gg_:focus-within .___SHumanizedDate_e0y8u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_e0y8u_gg_:focus-within .___SMask_e0y8u_gg_,.___SSingleDateInput_e0y8u_gg_:focus-within .___SValue_e0y8u_gg_{opacity:1}.___SDateRange_e0y8u_gg_:focus-within .___SHumanizedDate_e0y8u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_e0y8u_gg_:focus-within .___SMask_e0y8u_gg_,.___SDateRange_e0y8u_gg_:focus-within .___SValue_e0y8u_gg_{opacity:1}.___SInputMask_e0y8u_gg_.__noHumanizedDate_e0y8u_gg_ .___SMask_e0y8u_gg_,.___SInputMask_e0y8u_gg_.__noHumanizedDate_e0y8u_gg_ .___SValue_e0y8u_gg_{opacity:1}.___SDateRange_e0y8u_gg_ .___SInputMask_e0y8u_gg_:focus-within .___SMask_e0y8u_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_e0y8u_gg_:focus-within .___SRangeSep_e0y8u_gg_,.___SRangeSep_e0y8u_gg_.__fulfilled_e0y8u_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_e0y8u_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_e0y8u_gg_,.___SRangeComparatorHeader_e0y8u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_e0y8u_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_e0y8u_gg_,.___SPeriodsList_e0y8u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_e0y8u_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_e0y8u_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_e0y8u_gg_{transition:none}}",
|
|
31
|
+
"e0y8u_gg_"
|
|
32
32
|
), {
|
|
33
|
-
__SHeader: "
|
|
34
|
-
__STitle: "
|
|
35
|
-
__SToday: "
|
|
36
|
-
__SPeriod: "
|
|
37
|
-
__SButton: "
|
|
38
|
-
__SInner: "
|
|
39
|
-
__SInputMask: "
|
|
40
|
-
_animationsDisabled: "
|
|
41
|
-
__SValue: "
|
|
42
|
-
__SIndicator: "
|
|
43
|
-
__SRangeIndicator: "
|
|
44
|
-
_range_value: "
|
|
45
|
-
_range_compare: "
|
|
46
|
-
_disabled: "
|
|
47
|
-
__SHumanizedDate: "
|
|
48
|
-
__SMask: "
|
|
49
|
-
__SSingleDateInput: "
|
|
50
|
-
__SDateRange: "
|
|
51
|
-
_noHumanizedDate: "
|
|
52
|
-
__SRangeSep: "
|
|
53
|
-
_fulfilled: "
|
|
54
|
-
__SRangeComparatorHeader: "
|
|
55
|
-
__SRangeCalendar: "
|
|
56
|
-
__SFooter: "
|
|
57
|
-
__SPeriodsList: "
|
|
58
|
-
__STooltip: "
|
|
59
|
-
__SCompareToggle: "
|
|
60
|
-
__SPopper: "
|
|
33
|
+
__SHeader: "___SHeader_e0y8u_gg_",
|
|
34
|
+
__STitle: "___STitle_e0y8u_gg_",
|
|
35
|
+
__SToday: "___SToday_e0y8u_gg_",
|
|
36
|
+
__SPeriod: "___SPeriod_e0y8u_gg_",
|
|
37
|
+
__SButton: "___SButton_e0y8u_gg_",
|
|
38
|
+
__SInner: "___SInner_e0y8u_gg_",
|
|
39
|
+
__SInputMask: "___SInputMask_e0y8u_gg_",
|
|
40
|
+
_animationsDisabled: "__animationsDisabled_e0y8u_gg_",
|
|
41
|
+
__SValue: "___SValue_e0y8u_gg_",
|
|
42
|
+
__SIndicator: "___SIndicator_e0y8u_gg_",
|
|
43
|
+
__SRangeIndicator: "___SRangeIndicator_e0y8u_gg_",
|
|
44
|
+
_range_value: "_range_value_e0y8u_gg_",
|
|
45
|
+
_range_compare: "_range_compare_e0y8u_gg_",
|
|
46
|
+
_disabled: "__disabled_e0y8u_gg_",
|
|
47
|
+
__SHumanizedDate: "___SHumanizedDate_e0y8u_gg_",
|
|
48
|
+
__SMask: "___SMask_e0y8u_gg_",
|
|
49
|
+
__SSingleDateInput: "___SSingleDateInput_e0y8u_gg_",
|
|
50
|
+
__SDateRange: "___SDateRange_e0y8u_gg_",
|
|
51
|
+
_noHumanizedDate: "__noHumanizedDate_e0y8u_gg_",
|
|
52
|
+
__SRangeSep: "___SRangeSep_e0y8u_gg_",
|
|
53
|
+
_fulfilled: "__fulfilled_e0y8u_gg_",
|
|
54
|
+
__SRangeComparatorHeader: "___SRangeComparatorHeader_e0y8u_gg_",
|
|
55
|
+
__SRangeCalendar: "___SRangeCalendar_e0y8u_gg_",
|
|
56
|
+
__SFooter: "___SFooter_e0y8u_gg_",
|
|
57
|
+
__SPeriodsList: "___SPeriodsList_e0y8u_gg_",
|
|
58
|
+
__STooltip: "___STooltip_e0y8u_gg_",
|
|
59
|
+
__SCompareToggle: "___SCompareToggle_e0y8u_gg_",
|
|
60
|
+
__SPopper: "___SPopper_e0y8u_gg_"
|
|
61
61
|
})
|
|
62
|
-
),
|
|
62
|
+
), xa = {
|
|
63
63
|
year: !0,
|
|
64
64
|
month: !0,
|
|
65
65
|
day: !0
|
|
66
66
|
}, wa = new Date(2e3, 4, 29), oe = /* @__PURE__ */ function(M) {
|
|
67
|
-
|
|
68
|
-
var _ =
|
|
67
|
+
Ie(g, M);
|
|
68
|
+
var _ = De(g);
|
|
69
69
|
function g() {
|
|
70
|
-
return
|
|
70
|
+
return Se(this, g), _.apply(this, arguments);
|
|
71
71
|
}
|
|
72
|
-
return
|
|
72
|
+
return Pe(g, [{
|
|
73
73
|
key: "getSingleDateInputProps",
|
|
74
74
|
value: function() {
|
|
75
75
|
var a = this.asProps;
|
|
@@ -78,7 +78,7 @@ var ya = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Sa
|
|
|
78
78
|
a.role;
|
|
79
79
|
var o = a["aria-haspopup"];
|
|
80
80
|
a["aria-label"], a.style;
|
|
81
|
-
var r = Y(a,
|
|
81
|
+
var r = Y(a, Sa);
|
|
82
82
|
return $($({}, r), {}, {
|
|
83
83
|
ariaHasPopup: o,
|
|
84
84
|
inputId: s
|
|
@@ -93,7 +93,7 @@ var ya = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Sa
|
|
|
93
93
|
a.role;
|
|
94
94
|
var o = a["aria-haspopup"];
|
|
95
95
|
a["aria-label"], a.style;
|
|
96
|
-
var r = Y(a,
|
|
96
|
+
var r = Y(a, Pa);
|
|
97
97
|
return $($({}, r), {}, {
|
|
98
98
|
ariaHasPopup: o,
|
|
99
99
|
inputId: s
|
|
@@ -102,26 +102,26 @@ var ya = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Sa
|
|
|
102
102
|
}, {
|
|
103
103
|
key: "render",
|
|
104
104
|
value: function() {
|
|
105
|
-
var a = this.asProps, s, o =
|
|
105
|
+
var a = this.asProps, s, o = ha, r = this.asProps, d = r.Children, n = r.style, f = r.getI18nText;
|
|
106
106
|
return s = z(n), /* @__PURE__ */ i.createElement(o, s.cn("SInputTrigger", $({}, O({
|
|
107
107
|
"aria-label": f("input"),
|
|
108
108
|
__excludeProps: ["onChange", "value", "role", "id"]
|
|
109
109
|
}, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
|
|
110
110
|
}
|
|
111
111
|
}]), g;
|
|
112
|
-
}(
|
|
112
|
+
}(Re);
|
|
113
113
|
p(oe, "displayName", "InputTrigger");
|
|
114
|
-
p(oe, "style",
|
|
114
|
+
p(oe, "style", xe);
|
|
115
115
|
p(oe, "defaultProps", {
|
|
116
116
|
duration: 300,
|
|
117
117
|
popoverVisible: !0
|
|
118
118
|
});
|
|
119
119
|
var ie = /* @__PURE__ */ function(M) {
|
|
120
|
-
|
|
121
|
-
var _ =
|
|
120
|
+
Ie(g, M);
|
|
121
|
+
var _ = De(g);
|
|
122
122
|
function g() {
|
|
123
123
|
var e;
|
|
124
|
-
|
|
124
|
+
Se(this, g);
|
|
125
125
|
for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
|
|
126
126
|
s[o] = arguments[o];
|
|
127
127
|
return e = _.call.apply(_, [this].concat(s)), p(k(e), "state", {
|
|
@@ -140,7 +140,7 @@ var ie = /* @__PURE__ */ function(M) {
|
|
|
140
140
|
r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(r);
|
|
141
141
|
}), e;
|
|
142
142
|
}
|
|
143
|
-
return
|
|
143
|
+
return Pe(g, [{
|
|
144
144
|
key: "uncontrolledProps",
|
|
145
145
|
value: function() {
|
|
146
146
|
var a = this;
|
|
@@ -166,7 +166,7 @@ var ie = /* @__PURE__ */ function(M) {
|
|
|
166
166
|
value: function() {
|
|
167
167
|
var a = this.asProps, s = a.value, o = a.onChange, r = a.onDisplayedPeriodChange, d = a.locale;
|
|
168
168
|
a.w, a.ariaHasPopup, a.showError;
|
|
169
|
-
var n = Y(a,
|
|
169
|
+
var n = Y(a, Ia);
|
|
170
170
|
return $({
|
|
171
171
|
date: s,
|
|
172
172
|
onDateChange: o,
|
|
@@ -179,37 +179,37 @@ var ie = /* @__PURE__ */ function(M) {
|
|
|
179
179
|
}, {
|
|
180
180
|
key: "render",
|
|
181
181
|
value: function() {
|
|
182
|
-
var a = this.asProps, s, o = this.asProps, r = o.Children, d = o.forwardRef, n = o.styles, f = o.state,
|
|
182
|
+
var a = this.asProps, s, o = this.asProps, r = o.Children, d = o.forwardRef, n = o.styles, f = o.state, b = o.showError, R = o.popoverVisible, E = this.state, F = E.errorText, P = E.showError, j = E.focused, K = P && b, V = Q;
|
|
183
183
|
return s = z(n), /* @__PURE__ */ i.createElement(V, s.cn("SSingleDateInput", $({}, O({
|
|
184
184
|
tag: Ke,
|
|
185
185
|
placement: "top-start",
|
|
186
186
|
title: F,
|
|
187
187
|
theme: "warning",
|
|
188
|
-
visible: K && (
|
|
188
|
+
visible: K && (R || j),
|
|
189
189
|
state: K ? "invalid" : f,
|
|
190
190
|
ref: d,
|
|
191
191
|
onFocus: this.handleFocus,
|
|
192
192
|
onBlur: this.handleBlur,
|
|
193
193
|
__excludeProps: ["onChange", "style", "aria-expanded"]
|
|
194
|
-
}, a))), /* @__PURE__ */ i.createElement(
|
|
194
|
+
}, a))), /* @__PURE__ */ i.createElement(ya, s.cn("NeighborLocation", {}), /* @__PURE__ */ i.createElement(r, s.cn("Children", {}))));
|
|
195
195
|
}
|
|
196
196
|
}]), g;
|
|
197
|
-
}(
|
|
197
|
+
}(Re);
|
|
198
198
|
p(ie, "displayName", "SingleDateInput");
|
|
199
|
-
p(ie, "style",
|
|
199
|
+
p(ie, "style", xe);
|
|
200
200
|
p(ie, "defaultProps", {
|
|
201
201
|
children: function() {
|
|
202
|
-
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
202
|
+
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(me.Indicator, null), /* @__PURE__ */ i.createElement(me.MaskedInput, null));
|
|
203
203
|
},
|
|
204
204
|
defaultDisabledDateInputAttempt: !1,
|
|
205
205
|
showError: !0
|
|
206
206
|
});
|
|
207
207
|
var se = /* @__PURE__ */ function(M) {
|
|
208
|
-
|
|
209
|
-
var _ =
|
|
208
|
+
Ie(g, M);
|
|
209
|
+
var _ = De(g);
|
|
210
210
|
function g() {
|
|
211
211
|
var e;
|
|
212
|
-
|
|
212
|
+
Se(this, g);
|
|
213
213
|
for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
|
|
214
214
|
s[o] = arguments[o];
|
|
215
215
|
return e = _.call.apply(_, [this].concat(s)), p(k(e), "state", {
|
|
@@ -218,7 +218,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
218
218
|
showError: !1,
|
|
219
219
|
lastChangedInput: "from"
|
|
220
220
|
}), p(k(e), "fromRef", /* @__PURE__ */ i.createRef()), p(k(e), "toRef", /* @__PURE__ */ i.createRef()), p(k(e), "handleFromChange", function(r, d) {
|
|
221
|
-
var n, f,
|
|
221
|
+
var n, f, b, R, E = e.asProps.onChange, F = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (b = (R = e.asProps.value) === null || R === void 0 ? void 0 : R[1]) !== null && b !== void 0 ? b : null];
|
|
222
222
|
if (E([r, F[1]], d), r) {
|
|
223
223
|
if (!e.toRef.current) return;
|
|
224
224
|
e.toRef.current.focus(), setTimeout(function() {
|
|
@@ -226,7 +226,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
226
226
|
}, 0);
|
|
227
227
|
}
|
|
228
228
|
}), p(k(e), "handleToChange", function(r, d) {
|
|
229
|
-
var n, f,
|
|
229
|
+
var n, f, b, R, E = e.asProps.onChange, F = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (b = (R = e.asProps.value) === null || R === void 0 ? void 0 : R[1]) !== null && b !== void 0 ? b : null];
|
|
230
230
|
E([F[0], r], d);
|
|
231
231
|
}), p(k(e), "handleFromKeydown", function(r) {
|
|
232
232
|
e.toRef.current && e.fromRef.current && (e.setState({
|
|
@@ -263,7 +263,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
263
263
|
});
|
|
264
264
|
}), p(k(e), "updateDisabledDateInputAttempt", function(r) {
|
|
265
265
|
var d = e.asProps.disabledDates, n = !1;
|
|
266
|
-
if (r && (r[0] && r[1] ? n = d.some(
|
|
266
|
+
if (r && (r[0] && r[1] ? n = d.some(ma([r[0], r[1]], e.asProps.unit)) : r[0] ? n = d.some(ve(ye(r[0]), e.asProps.unit)) : r[1] && (n = d.some(ve(ye(r[1]), e.asProps.unit)))), n) {
|
|
267
267
|
var f = e.state.lastChangedInput === "to" ? r[1] : r[0];
|
|
268
268
|
setTimeout(function() {
|
|
269
269
|
r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(f);
|
|
@@ -271,7 +271,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
271
271
|
}
|
|
272
272
|
}), e;
|
|
273
273
|
}
|
|
274
|
-
return
|
|
274
|
+
return Pe(g, [{
|
|
275
275
|
key: "uncontrolledProps",
|
|
276
276
|
value: function() {
|
|
277
277
|
var a = this;
|
|
@@ -297,7 +297,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
297
297
|
value: function() {
|
|
298
298
|
var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
|
|
299
299
|
a.showError;
|
|
300
|
-
var n = Y(a,
|
|
300
|
+
var n = Y(a, Da);
|
|
301
301
|
return Oe({
|
|
302
302
|
ref: this.fromRef,
|
|
303
303
|
date: s == null ? void 0 : s[0],
|
|
@@ -316,7 +316,7 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
316
316
|
value: function() {
|
|
317
317
|
var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
|
|
318
318
|
a.inputId, a.showError;
|
|
319
|
-
var n = Y(a,
|
|
319
|
+
var n = Y(a, ba), f = this.asProps.getI18nText("toDate", {
|
|
320
320
|
date: this.asProps.getI18nText("input")
|
|
321
321
|
});
|
|
322
322
|
return Oe({
|
|
@@ -354,15 +354,15 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
354
354
|
}, {
|
|
355
355
|
key: "render",
|
|
356
356
|
value: function() {
|
|
357
|
-
var a = this.asProps, s, o = Q, r = this.asProps, d = r.Children, n = r.styles, f = r.w,
|
|
357
|
+
var a = this.asProps, s, o = Q, r = this.asProps, d = r.Children, n = r.styles, f = r.w, b = r.state, R = r.showError, E = r.popoverVisible, F = this.state, P = F.errorText, j = F.lastChangedInput, K = F.showError, V = F.containerFocused, X = K && R;
|
|
358
358
|
return s = z(n), /* @__PURE__ */ i.createElement(o, s.cn("SDateRange", $({}, O({
|
|
359
359
|
tag: Ke,
|
|
360
360
|
ignorePortalsStacking: !0,
|
|
361
361
|
placement: j === "to" ? "top-end" : "top-start",
|
|
362
|
-
title:
|
|
362
|
+
title: P,
|
|
363
363
|
theme: "warning",
|
|
364
364
|
visible: X && (E || V),
|
|
365
|
-
state: X ? "invalid" :
|
|
365
|
+
state: X ? "invalid" : b,
|
|
366
366
|
__excludeProps: ["onChange", "value", "aria-expanded"],
|
|
367
367
|
w: f,
|
|
368
368
|
onFocus: this.handleFocus,
|
|
@@ -370,9 +370,9 @@ var se = /* @__PURE__ */ function(M) {
|
|
|
370
370
|
}, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
|
|
371
371
|
}
|
|
372
372
|
}]), g;
|
|
373
|
-
}(
|
|
373
|
+
}(Re);
|
|
374
374
|
p(se, "displayName", "DateRange");
|
|
375
|
-
p(se, "style",
|
|
375
|
+
p(se, "style", xe);
|
|
376
376
|
p(se, "defaultProps", {
|
|
377
377
|
children: function() {
|
|
378
378
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(J.Indicator, null), /* @__PURE__ */ i.createElement(J.FromMaskedInput, null), /* @__PURE__ */ i.createElement(J.RangeSep, null), /* @__PURE__ */ i.createElement(J.ToMaskedInput, null));
|
|
@@ -393,7 +393,7 @@ var ka = function(_) {
|
|
|
393
393
|
}, Le = function(_) {
|
|
394
394
|
var g = arguments[0], e, a = Q.Addon;
|
|
395
395
|
return e = z(_.styles), /* @__PURE__ */ i.createElement(a, e.cn("SIndicator", $({}, O({
|
|
396
|
-
tag:
|
|
396
|
+
tag: va,
|
|
397
397
|
"aria-hidden": "true",
|
|
398
398
|
tabIndex: -1
|
|
399
399
|
}, g))));
|
|
@@ -407,15 +407,15 @@ var ka = function(_) {
|
|
|
407
407
|
flex: "0"
|
|
408
408
|
}, g))), "–");
|
|
409
409
|
}, we = function(_) {
|
|
410
|
-
var g, e = _.date, a = _.onDateChange, s = _.onDisplayedPeriodChange, o = _.locale, r = _.styles, d = _.parts, n = d === void 0 ?
|
|
410
|
+
var g, e = _.date, a = _.onDateChange, s = _.onDisplayedPeriodChange, o = _.locale, r = _.styles, d = _.parts, n = d === void 0 ? xa : d, f = _.disabledDates, b = _.forwardRef, R = _.placeholders, E = _.labelPrefix, F = E === void 0 ? "Date" : E, P = _.onMaskPipeBlock, j = _.containerFocused, K = _.animationsDisabled, V = _.getI18nText, X = _.inputId, ke = _.inputRole, We = ke === void 0 ? "combobox" : ke;
|
|
411
411
|
_.__excludeProps, _.Root;
|
|
412
|
-
var U = Y(_,
|
|
413
|
-
return
|
|
412
|
+
var U = Y(_, Ra), le = i.useRef(), Ye = i.useState(void 0), Te = ne(Ye, 2), ue = Te[0], Ue = Te[1], u = i.useMemo(function() {
|
|
413
|
+
return R || {
|
|
414
414
|
year: V("placeholder-years"),
|
|
415
415
|
month: V("placeholder-months"),
|
|
416
416
|
day: V("placeholder-days")
|
|
417
417
|
};
|
|
418
|
-
}, [
|
|
418
|
+
}, [R, V]);
|
|
419
419
|
if (u.year.length !== 1 || u.month.length !== 1 || u.day.length !== 1)
|
|
420
420
|
throw console.error({
|
|
421
421
|
placeholders: u
|
|
@@ -425,20 +425,20 @@ var ka = function(_) {
|
|
|
425
425
|
year: "numeric",
|
|
426
426
|
month: "numeric",
|
|
427
427
|
day: "numeric"
|
|
428
|
-
}, c = new Intl.DateTimeFormat(o, l),
|
|
428
|
+
}, c = new Intl.DateTimeFormat(o, l), S = void 0, h = [], v = c.formatToParts(wa), I = G(v), x;
|
|
429
429
|
try {
|
|
430
|
-
for (
|
|
431
|
-
var
|
|
432
|
-
!
|
|
430
|
+
for (I.s(); !(x = I.n()).done; ) {
|
|
431
|
+
var D = x.value;
|
|
432
|
+
!S && D.type === "literal" && (S = D.value), h.length < 3 && ["day", "month", "year"].includes(D.type) && n[D.type] && h.push(D.type);
|
|
433
433
|
}
|
|
434
434
|
} catch (w) {
|
|
435
|
-
|
|
435
|
+
I.e(w);
|
|
436
436
|
} finally {
|
|
437
|
-
|
|
437
|
+
I.f();
|
|
438
438
|
}
|
|
439
|
-
return
|
|
440
|
-
sep:
|
|
441
|
-
order:
|
|
439
|
+
return S = (t = S) !== null && t !== void 0 ? t : " ", {
|
|
440
|
+
sep: S,
|
|
441
|
+
order: h
|
|
442
442
|
};
|
|
443
443
|
}, [o, n]), H = Ce.sep, C = Ce.order, T = i.useMemo(function() {
|
|
444
444
|
var t = e;
|
|
@@ -451,14 +451,14 @@ var ka = function(_) {
|
|
|
451
451
|
} : null;
|
|
452
452
|
}, [e]), Me = i.useCallback(function(t) {
|
|
453
453
|
if (!t || !t.year && !t.month && !t.day) return null;
|
|
454
|
-
var l = [], c = G(C),
|
|
454
|
+
var l = [], c = G(C), S;
|
|
455
455
|
try {
|
|
456
|
-
for (c.s(); !(
|
|
457
|
-
var
|
|
458
|
-
n[
|
|
456
|
+
for (c.s(); !(S = c.n()).done; ) {
|
|
457
|
+
var h = S.value;
|
|
458
|
+
n[h] && (h === "year" && t.year && l.push(t.year), h === "month" && t.month && l.push(t.month), h === "day" && t.day && l.push(t.day));
|
|
459
459
|
}
|
|
460
|
-
} catch (
|
|
461
|
-
c.e(
|
|
460
|
+
} catch (v) {
|
|
461
|
+
c.e(v);
|
|
462
462
|
} finally {
|
|
463
463
|
c.f();
|
|
464
464
|
}
|
|
@@ -477,13 +477,13 @@ var ka = function(_) {
|
|
|
477
477
|
break;
|
|
478
478
|
}
|
|
479
479
|
if (l)
|
|
480
|
-
return
|
|
481
|
-
var
|
|
480
|
+
return P == null || P(null), "";
|
|
481
|
+
var S = function(_a) {
|
|
482
482
|
var ze = C.slice(0, C.indexOf(_a)), q = 0, re = G(ze), je;
|
|
483
483
|
try {
|
|
484
484
|
for (re.s(); !(je = re.n()).done; ) {
|
|
485
|
-
var
|
|
486
|
-
|
|
485
|
+
var he = je.value;
|
|
486
|
+
he === "year" && n.year && (q += 4), he === "month" && n.month && (q += 2), he === "day" && n.day && (q += 2);
|
|
487
487
|
}
|
|
488
488
|
} catch (da) {
|
|
489
489
|
re.e(da);
|
|
@@ -491,77 +491,77 @@ var ka = function(_) {
|
|
|
491
491
|
re.f();
|
|
492
492
|
}
|
|
493
493
|
return q += ze.length * H.length, q;
|
|
494
|
-
},
|
|
495
|
-
for (var
|
|
496
|
-
|
|
497
|
-
for (var
|
|
498
|
-
|
|
499
|
-
var w =
|
|
500
|
-
if (n.month && (
|
|
494
|
+
}, h = [], v = {}, I = t.split(H);
|
|
495
|
+
for (var x in u)
|
|
496
|
+
v[x] = u[x];
|
|
497
|
+
for (var D = 0; D < C.length; D++)
|
|
498
|
+
v[C[D]] = I[D];
|
|
499
|
+
var w = v.year, m = v.month, y = v.day;
|
|
500
|
+
if (n.month && (m[0] !== "_" && parseInt(m[0], 10) > 1 && (m = "0".concat(m[0]), h.push(S("month"))), m === "00" && (m = "01"), m[0] !== "_" && m[1] !== "_" && parseInt(m, 10) > 12) || n.day && (y[0] !== "_" && parseInt(y[0], 10) > 3 && (y = "0".concat(y[0]), h.push(S("day"))), y === "00" && (y = "01"), y[0] !== "_" && y[1] !== "_" && parseInt(y, 10) > 31))
|
|
501
501
|
return !1;
|
|
502
502
|
w = w.split("").map(function(B) {
|
|
503
503
|
return B === "_" ? u.year : B;
|
|
504
|
-
}).join(""),
|
|
504
|
+
}).join(""), m = m.split("").map(function(B) {
|
|
505
505
|
return B === "_" ? u.month : B;
|
|
506
|
-
}).join(""),
|
|
506
|
+
}).join(""), y = y.split("").map(function(B) {
|
|
507
507
|
return B === "_" ? u.day : B;
|
|
508
508
|
}).join("");
|
|
509
|
-
var ee = !n.year || w && w.length >= 4 && !w.includes(u.year), pe = !n.month ||
|
|
509
|
+
var ee = !n.year || w && w.length >= 4 && !w.includes(u.year), pe = !n.month || m && m.length === 2 && !m.includes(u.month), ce = !n.day || y && y.length === 2 && !y.includes(u.day), ge = ee && pe && ce;
|
|
510
510
|
if (ge) {
|
|
511
|
-
var A = new Date(0, 0, 0, 0, 0, 0, 0), sa = n.year ? parseInt(w, 10) : 0, la = n.month ? parseInt(
|
|
512
|
-
if (A.setFullYear(sa, la, ua), f != null && f.some(
|
|
513
|
-
return
|
|
511
|
+
var A = new Date(0, 0, 0, 0, 0, 0, 0), sa = n.year ? parseInt(w, 10) : 0, la = n.month ? parseInt(m, 10) - 1 : 0, ua = n.day ? parseInt(y, 10) : 1;
|
|
512
|
+
if (A.setFullYear(sa, la, ua), f != null && f.some(ve(ye(A), "date")) || n.day && A.getDate() !== parseInt(y, 10))
|
|
513
|
+
return P == null || P(A), !1;
|
|
514
514
|
}
|
|
515
515
|
var ae = [], te = G(C), Ve;
|
|
516
516
|
try {
|
|
517
517
|
for (te.s(); !(Ve = te.n()).done; ) {
|
|
518
518
|
var fe = Ve.value;
|
|
519
|
-
fe === "year" && ae.push(w), fe === "month" && ae.push(
|
|
519
|
+
fe === "year" && ae.push(w), fe === "month" && ae.push(m), fe === "day" && ae.push(y);
|
|
520
520
|
}
|
|
521
521
|
} catch (B) {
|
|
522
522
|
te.e(B);
|
|
523
523
|
} finally {
|
|
524
524
|
te.f();
|
|
525
525
|
}
|
|
526
|
-
return
|
|
526
|
+
return P == null || P(null), {
|
|
527
527
|
value: ae.join(H),
|
|
528
|
-
indexesOfPipedChars:
|
|
528
|
+
indexesOfPipedChars: h
|
|
529
529
|
};
|
|
530
|
-
}, [u, H, C, n, f,
|
|
530
|
+
}, [u, H, C, n, f, P]), Je = i.useCallback(function(t) {
|
|
531
531
|
var l = {};
|
|
532
532
|
for (var c in u)
|
|
533
533
|
l[c] = u[c];
|
|
534
|
-
for (var
|
|
535
|
-
l[C[
|
|
536
|
-
var
|
|
534
|
+
for (var S = t.split(H), h = 0; h < C.length; h++)
|
|
535
|
+
l[C[h]] = S[h];
|
|
536
|
+
var v = l.year, I = l.month, x = l.day;
|
|
537
537
|
Z({
|
|
538
|
-
year:
|
|
539
|
-
month:
|
|
540
|
-
day:
|
|
538
|
+
year: v,
|
|
539
|
+
month: I,
|
|
540
|
+
day: x
|
|
541
541
|
});
|
|
542
|
-
var
|
|
543
|
-
if (
|
|
544
|
-
var ee = new Date(0, 0, 0, 0, 0, 0, 0), pe = n.year ? parseInt(
|
|
542
|
+
var D = !n.year || v && v.length >= 4 && !v.includes(u.year), w = !n.month || I && I.length === 2 && !I.includes(u.month), m = !n.day || x && x.length === 2 && !x.includes(u.day), y = D && w && m;
|
|
543
|
+
if (y) {
|
|
544
|
+
var ee = new Date(0, 0, 0, 0, 0, 0, 0), pe = n.year ? parseInt(v, 10) : 0, ce = n.month ? parseInt(I, 10) - 1 : 0, ge = n.day ? parseInt(x, 10) : 1;
|
|
545
545
|
ee.setFullYear(pe, ce, ge), a(ee), N.current = {
|
|
546
|
-
year:
|
|
547
|
-
month:
|
|
548
|
-
day:
|
|
546
|
+
year: v,
|
|
547
|
+
month: I,
|
|
548
|
+
day: x
|
|
549
549
|
};
|
|
550
550
|
return;
|
|
551
551
|
}
|
|
552
|
-
if (N.current !== null && (a(null), N.current = null),
|
|
552
|
+
if (N.current !== null && (a(null), N.current = null), D && n.year) {
|
|
553
553
|
var A = new Date(0, 0, 0, 0, 0, 0, 0);
|
|
554
|
-
A.setFullYear(parseInt(
|
|
554
|
+
A.setFullYear(parseInt(v, 10)), w && n.month && A.setMonth(parseInt(I, 10) - 1), s(A);
|
|
555
555
|
}
|
|
556
556
|
}, [a, Z, u, s, C, n]), L = i.useMemo(function() {
|
|
557
557
|
var t = [], l = G(C), c;
|
|
558
558
|
try {
|
|
559
559
|
for (l.s(); !(c = l.n()).done; ) {
|
|
560
|
-
var
|
|
561
|
-
|
|
560
|
+
var S = c.value;
|
|
561
|
+
S === "year" && t.push(u.year + u.year + u.year + u.year), S === "month" && t.push(u.month + u.month), S === "day" && t.push(u.day + u.day);
|
|
562
562
|
}
|
|
563
|
-
} catch (
|
|
564
|
-
l.e(
|
|
563
|
+
} catch (h) {
|
|
564
|
+
l.e(h);
|
|
565
565
|
} finally {
|
|
566
566
|
l.f();
|
|
567
567
|
}
|
|
@@ -584,23 +584,23 @@ var ka = function(_) {
|
|
|
584
584
|
}, [e, o, n]);
|
|
585
585
|
Ne(function() {
|
|
586
586
|
if (le.current) {
|
|
587
|
-
for (var t = W ? [W, L] : [L], l = [], c = document.createElement("span"),
|
|
588
|
-
var
|
|
589
|
-
c.style[
|
|
587
|
+
for (var t = W ? [W, L] : [L], l = [], c = document.createElement("span"), S = window.getComputedStyle(le.current), h = ["height", "font-size", "font-family", "font-weight", "font-style", "line-height", "letter-spacing", "text-transform", "word-spacing"], v = 0, I = h; v < I.length; v++) {
|
|
588
|
+
var x = I[v];
|
|
589
|
+
c.style[x] = S[x];
|
|
590
590
|
}
|
|
591
591
|
c.style.position = "absolute", c.style.visibility = "hidden", document.body.appendChild(c);
|
|
592
|
-
for (var
|
|
593
|
-
var
|
|
594
|
-
c.innerHTML =
|
|
592
|
+
for (var D = 0, w = t; D < w.length; D++) {
|
|
593
|
+
var m = w[D];
|
|
594
|
+
c.innerHTML = m, l.push(c.offsetWidth);
|
|
595
595
|
}
|
|
596
596
|
c.remove();
|
|
597
|
-
var
|
|
598
|
-
Ue(
|
|
597
|
+
var y = Math.max.apply(Math, l);
|
|
598
|
+
Ue(y);
|
|
599
599
|
}
|
|
600
600
|
}, [o, W, n, L]);
|
|
601
601
|
var Ze = "div", ea = i.useCallback(function(t) {
|
|
602
|
-
le.current = t, !(!t || t.tagName !== "INPUT") && (typeof
|
|
603
|
-
}, [
|
|
602
|
+
le.current = t, !(!t || t.tagName !== "INPUT") && (typeof b == "function" ? b(t) : b.current = t);
|
|
603
|
+
}, [b]), aa = i.useState(ue), $e = ne(aa, 2), He = $e[0], ta = $e[1], ra = i.useState(!1), Be = ne(ra, 2), na = Be[0], Ae = Be[1], de = j ?? na, oa = i.useCallback(function(t) {
|
|
604
604
|
var l;
|
|
605
605
|
(l = U.onFocus) === null || l === void 0 || l.call(U, t), Ae(!0);
|
|
606
606
|
}, []), ia = i.useCallback(function(t) {
|
|
@@ -632,17 +632,17 @@ var ka = function(_) {
|
|
|
632
632
|
inputRole: We,
|
|
633
633
|
inputMode: "numeric"
|
|
634
634
|
}), W && /* @__PURE__ */ i.createElement(Ze, g.cn("SHumanizedDate", {}), W));
|
|
635
|
-
},
|
|
635
|
+
}, me = be(ie, {
|
|
636
636
|
Indicator: Le,
|
|
637
637
|
MaskedInput: we
|
|
638
|
-
}), J =
|
|
638
|
+
}), J = be(se, {
|
|
639
639
|
Indicator: Le,
|
|
640
640
|
RangeSep: Ca,
|
|
641
641
|
FromMaskedInput: ka,
|
|
642
642
|
ToMaskedInput: Ta
|
|
643
|
-
}), tt =
|
|
643
|
+
}), tt = be(oe, {
|
|
644
644
|
Addon: ga.Addon,
|
|
645
|
-
SingleDateInput:
|
|
645
|
+
SingleDateInput: me,
|
|
646
646
|
DateRange: J
|
|
647
647
|
});
|
|
648
648
|
export {
|