@react-spectrum/datepicker 3.9.4 → 3.9.5
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/dist/DateField.main.js +110 -0
- package/dist/DateField.main.js.map +1 -0
- package/dist/DateField.mjs +105 -0
- package/dist/DateField.module.js +105 -0
- package/dist/DateField.module.js.map +1 -0
- package/dist/DatePicker.main.js +198 -0
- package/dist/DatePicker.main.js.map +1 -0
- package/dist/DatePicker.mjs +193 -0
- package/dist/DatePicker.module.js +193 -0
- package/dist/DatePicker.module.js.map +1 -0
- package/dist/DatePickerField.main.js +72 -0
- package/dist/DatePickerField.main.js.map +1 -0
- package/dist/DatePickerField.mjs +67 -0
- package/dist/DatePickerField.module.js +67 -0
- package/dist/DatePickerField.module.js.map +1 -0
- package/dist/DatePickerSegment.main.js +76 -0
- package/dist/DatePickerSegment.main.js.map +1 -0
- package/dist/DatePickerSegment.mjs +71 -0
- package/dist/DatePickerSegment.module.js +71 -0
- package/dist/DatePickerSegment.module.js.map +1 -0
- package/dist/DateRangePicker.main.js +225 -0
- package/dist/DateRangePicker.main.js.map +1 -0
- package/dist/DateRangePicker.mjs +220 -0
- package/dist/DateRangePicker.module.js +220 -0
- package/dist/DateRangePicker.module.js.map +1 -0
- package/dist/Input.main.js +123 -0
- package/dist/Input.main.js.map +1 -0
- package/dist/Input.mjs +118 -0
- package/dist/Input.module.js +118 -0
- package/dist/Input.module.js.map +1 -0
- package/dist/TimeField.main.js +102 -0
- package/dist/TimeField.main.js.map +1 -0
- package/dist/TimeField.mjs +97 -0
- package/dist/TimeField.module.js +97 -0
- package/dist/TimeField.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +4 -1136
- package/dist/inputgroup_vars_css.main.js +86 -0
- package/dist/inputgroup_vars_css.main.js.map +1 -0
- package/dist/inputgroup_vars_css.mjs +88 -0
- package/dist/inputgroup_vars_css.module.js +88 -0
- package/dist/inputgroup_vars_css.module.js.map +1 -0
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +8 -1136
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -1136
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/styles.36ea4632.css +209 -0
- package/dist/styles.36ea4632.css.map +1 -0
- package/dist/styles_css.main.js +74 -0
- package/dist/styles_css.main.js.map +1 -0
- package/dist/styles_css.mjs +76 -0
- package/dist/styles_css.module.js +76 -0
- package/dist/styles_css.module.js.map +1 -0
- package/dist/sv-SE.mjs +1 -1
- package/dist/textfield_vars_css.main.js +74 -0
- package/dist/textfield_vars_css.main.js.map +1 -0
- package/dist/textfield_vars_css.mjs +76 -0
- package/dist/textfield_vars_css.module.js +76 -0
- package/dist/textfield_vars_css.module.js.map +1 -0
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/utils.main.js +89 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +82 -0
- package/dist/utils.module.js +82 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/vars.3692148b.css +549 -0
- package/dist/vars.3692148b.css.map +1 -0
- package/dist/vars.ccbd2e3f.css +649 -0
- package/dist/vars.ccbd2e3f.css.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +22 -22
- package/dist/main.css +0 -1626
- package/dist/main.css.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require("./styles.36ea4632.css");
|
|
2
|
+
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
3
|
+
var $9PhAi$reactspectrumutils = require("@react-spectrum/utils");
|
|
4
|
+
var $9PhAi$react = require("react");
|
|
5
|
+
var $9PhAi$reactariadatepicker = require("@react-aria/datepicker");
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function $parcel$export(e, n, v, s) {
|
|
13
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$parcel$export(module.exports, "DatePickerSegment", () => $edac158d20ebe4a9$export$6388987c5223b54e);
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $edac158d20ebe4a9$export$6388987c5223b54e({ segment: segment, state: state, ...otherProps }) {
|
|
32
|
+
switch(segment.type){
|
|
33
|
+
// A separator, e.g. punctuation
|
|
34
|
+
case "literal":
|
|
35
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($9PhAi$react))).createElement($edac158d20ebe4a9$var$LiteralSegment, {
|
|
36
|
+
segment: segment
|
|
37
|
+
});
|
|
38
|
+
// Editable segment
|
|
39
|
+
default:
|
|
40
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($9PhAi$react))).createElement($edac158d20ebe4a9$var$EditableSegment, {
|
|
41
|
+
segment: segment,
|
|
42
|
+
state: state,
|
|
43
|
+
...otherProps
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function $edac158d20ebe4a9$var$LiteralSegment({ segment: segment }) {
|
|
48
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($9PhAi$react))).createElement("span", {
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
className: (0, $9PhAi$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-literal"),
|
|
51
|
+
"data-testid": segment.type === "literal" ? undefined : segment.type
|
|
52
|
+
}, segment.text);
|
|
53
|
+
}
|
|
54
|
+
function $edac158d20ebe4a9$var$EditableSegment({ segment: segment, state: state }) {
|
|
55
|
+
let ref = (0, $9PhAi$react.useRef)();
|
|
56
|
+
let { segmentProps: segmentProps } = (0, $9PhAi$reactariadatepicker.useDateSegment)(segment, state, ref);
|
|
57
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($9PhAi$react))).createElement("div", {
|
|
58
|
+
...segmentProps,
|
|
59
|
+
ref: ref,
|
|
60
|
+
className: (0, $9PhAi$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-DatePicker-cell", {
|
|
61
|
+
"is-placeholder": segment.isPlaceholder,
|
|
62
|
+
"is-read-only": !segment.isEditable
|
|
63
|
+
}),
|
|
64
|
+
style: {
|
|
65
|
+
...segmentProps.style,
|
|
66
|
+
minWidth: segment.maxValue != null ? String(segment.maxValue).length + "ch" : null
|
|
67
|
+
},
|
|
68
|
+
"data-testid": segment.type
|
|
69
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($9PhAi$react))).createElement("span", {
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
className: (0, $9PhAi$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-DatePicker-placeholder")
|
|
72
|
+
}, segment.placeholder), segment.isPlaceholder ? "" : segment.text);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=DatePickerSegment.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,0DAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,0DAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,0DAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,mBAAK;IACf,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE,SAAS,OAAO;IACpD,qBACE,0DAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO;YACL,GAAG,aAAa,KAAK;YACrB,UAAU,QAAQ,QAAQ,IAAI,OAAO,OAAO,QAAQ,QAAQ,EAAE,MAAM,GAAG,OAAO;QAChF;QACA,eAAa,QAAQ,IAAI;qBACzB,0DAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,GACpH,QAAQ,aAAa,GAAG,KAAK,QAAQ,IAAI;AAGhD","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps) {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef();\n let {segmentProps} = useDateSegment(segment, state, ref);\n return (\n <div\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={{\n ...segmentProps.style,\n minWidth: segment.maxValue != null ? String(segment.maxValue).length + 'ch' : null\n }}\n data-testid={segment.type}>\n <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span>\n {segment.isPlaceholder ? '' : segment.text}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.main.js.map"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import "./styles.36ea4632.css";
|
|
2
|
+
import $jOVo7$styles_cssmodulejs from "./styles_css.mjs";
|
|
3
|
+
import {classNames as $jOVo7$classNames} from "@react-spectrum/utils";
|
|
4
|
+
import $jOVo7$react, {useRef as $jOVo7$useRef} from "react";
|
|
5
|
+
import {useDateSegment as $jOVo7$useDateSegment} from "@react-aria/datepicker";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function $cfa347761f172638$export$6388987c5223b54e({ segment: segment, state: state, ...otherProps }) {
|
|
26
|
+
switch(segment.type){
|
|
27
|
+
// A separator, e.g. punctuation
|
|
28
|
+
case "literal":
|
|
29
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement($cfa347761f172638$var$LiteralSegment, {
|
|
30
|
+
segment: segment
|
|
31
|
+
});
|
|
32
|
+
// Editable segment
|
|
33
|
+
default:
|
|
34
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement($cfa347761f172638$var$EditableSegment, {
|
|
35
|
+
segment: segment,
|
|
36
|
+
state: state,
|
|
37
|
+
...otherProps
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function $cfa347761f172638$var$LiteralSegment({ segment: segment }) {
|
|
42
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement("span", {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-Datepicker-literal"),
|
|
45
|
+
"data-testid": segment.type === "literal" ? undefined : segment.type
|
|
46
|
+
}, segment.text);
|
|
47
|
+
}
|
|
48
|
+
function $cfa347761f172638$var$EditableSegment({ segment: segment, state: state }) {
|
|
49
|
+
let ref = (0, $jOVo7$useRef)();
|
|
50
|
+
let { segmentProps: segmentProps } = (0, $jOVo7$useDateSegment)(segment, state, ref);
|
|
51
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement("div", {
|
|
52
|
+
...segmentProps,
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-DatePicker-cell", {
|
|
55
|
+
"is-placeholder": segment.isPlaceholder,
|
|
56
|
+
"is-read-only": !segment.isEditable
|
|
57
|
+
}),
|
|
58
|
+
style: {
|
|
59
|
+
...segmentProps.style,
|
|
60
|
+
minWidth: segment.maxValue != null ? String(segment.maxValue).length + "ch" : null
|
|
61
|
+
},
|
|
62
|
+
"data-testid": segment.type
|
|
63
|
+
}, /*#__PURE__*/ (0, $jOVo7$react).createElement("span", {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-DatePicker-placeholder")
|
|
66
|
+
}, segment.placeholder), segment.isPlaceholder ? "" : segment.text);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export {$cfa347761f172638$export$6388987c5223b54e as DatePickerSegment};
|
|
71
|
+
//# sourceMappingURL=DatePickerSegment.mjs.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import "./styles.36ea4632.css";
|
|
2
|
+
import $jOVo7$styles_cssmodulejs from "./styles_css.module.js";
|
|
3
|
+
import {classNames as $jOVo7$classNames} from "@react-spectrum/utils";
|
|
4
|
+
import $jOVo7$react, {useRef as $jOVo7$useRef} from "react";
|
|
5
|
+
import {useDateSegment as $jOVo7$useDateSegment} from "@react-aria/datepicker";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function $cfa347761f172638$export$6388987c5223b54e({ segment: segment, state: state, ...otherProps }) {
|
|
26
|
+
switch(segment.type){
|
|
27
|
+
// A separator, e.g. punctuation
|
|
28
|
+
case "literal":
|
|
29
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement($cfa347761f172638$var$LiteralSegment, {
|
|
30
|
+
segment: segment
|
|
31
|
+
});
|
|
32
|
+
// Editable segment
|
|
33
|
+
default:
|
|
34
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement($cfa347761f172638$var$EditableSegment, {
|
|
35
|
+
segment: segment,
|
|
36
|
+
state: state,
|
|
37
|
+
...otherProps
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function $cfa347761f172638$var$LiteralSegment({ segment: segment }) {
|
|
42
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement("span", {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-Datepicker-literal"),
|
|
45
|
+
"data-testid": segment.type === "literal" ? undefined : segment.type
|
|
46
|
+
}, segment.text);
|
|
47
|
+
}
|
|
48
|
+
function $cfa347761f172638$var$EditableSegment({ segment: segment, state: state }) {
|
|
49
|
+
let ref = (0, $jOVo7$useRef)();
|
|
50
|
+
let { segmentProps: segmentProps } = (0, $jOVo7$useDateSegment)(segment, state, ref);
|
|
51
|
+
return /*#__PURE__*/ (0, $jOVo7$react).createElement("div", {
|
|
52
|
+
...segmentProps,
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-DatePicker-cell", {
|
|
55
|
+
"is-placeholder": segment.isPlaceholder,
|
|
56
|
+
"is-read-only": !segment.isEditable
|
|
57
|
+
}),
|
|
58
|
+
style: {
|
|
59
|
+
...segmentProps.style,
|
|
60
|
+
minWidth: segment.maxValue != null ? String(segment.maxValue).length + "ch" : null
|
|
61
|
+
},
|
|
62
|
+
"data-testid": segment.type
|
|
63
|
+
}, /*#__PURE__*/ (0, $jOVo7$react).createElement("span", {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: (0, $jOVo7$classNames)((0, ($parcel$interopDefault($jOVo7$styles_cssmodulejs))), "react-spectrum-DatePicker-placeholder")
|
|
66
|
+
}, segment.placeholder), segment.isPlaceholder ? "" : segment.text);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export {$cfa347761f172638$export$6388987c5223b54e as DatePickerSegment};
|
|
71
|
+
//# sourceMappingURL=DatePickerSegment.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkBM,SAAS,0CAAkB,WAAC,OAAO,SAAE,KAAK,EAAE,GAAG,YAAmC;IACvF,OAAQ,QAAQ,IAAI;QAClB,gCAAgC;QAChC,KAAK;YACH,qBAAO,gCAAC;gBAAe,SAAS;;QAElC,mBAAmB;QACnB;YACE,qBAAO,gCAAC;gBAAgB,SAAS;gBAAS,OAAO;gBAAQ,GAAG,UAAU;;IAC1E;AACF;AAEA,SAAS,qCAAe,WAAC,OAAO,EAAsB;IACpD,qBACE,gCAAC;QACC,eAAY;QACZ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,eAAa,QAAQ,IAAI,KAAK,YAAY,YAAY,QAAQ,IAAI;OACjE,QAAQ,IAAI;AAGnB;AAEA,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,EAAyB;IAC/D,IAAI,MAAM,CAAA,GAAA,aAAK;IACf,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE,SAAS,OAAO;IACpD,qBACE,gCAAC;QACE,GAAG,YAAY;QAChB,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,kCAAkC;YAC9D,kBAAkB,QAAQ,aAAa;YACvC,gBAAgB,CAAC,QAAQ,UAAU;QACrC;QACA,OAAO;YACL,GAAG,aAAa,KAAK;YACrB,UAAU,QAAQ,QAAQ,IAAI,OAAO,OAAO,QAAQ,QAAQ,EAAE,MAAM,GAAG,OAAO;QAChF;QACA,eAAa,QAAQ,IAAI;qBACzB,gCAAC;QAAK,eAAY;QAAO,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAA2C,QAAQ,WAAW,GACpH,QAAQ,aAAa,GAAG,KAAK,QAAQ,IAAI;AAGhD","sources":["packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {DateFieldState, DateSegment} from '@react-stately/datepicker';\nimport {DatePickerBase, DateValue} from '@react-types/datepicker';\nimport React, {useRef} from 'react';\nimport styles from './styles.css';\nimport {useDateSegment} from '@react-aria/datepicker';\n\ninterface DatePickerSegmentProps extends DatePickerBase<DateValue> {\n segment: DateSegment,\n state: DateFieldState\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment\n}\n\nexport function DatePickerSegment({segment, state, ...otherProps}: DatePickerSegmentProps) {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return <EditableSegment segment={segment} state={state} {...otherProps} />;\n }\n}\n\nfunction LiteralSegment({segment}: LiteralSegmentProps) {\n return (\n <span\n aria-hidden=\"true\"\n className={classNames(styles, 'react-spectrum-Datepicker-literal')}\n data-testid={segment.type === 'literal' ? undefined : segment.type}>\n {segment.text}\n </span>\n );\n}\n\nfunction EditableSegment({segment, state}: DatePickerSegmentProps) {\n let ref = useRef();\n let {segmentProps} = useDateSegment(segment, state, ref);\n return (\n <div\n {...segmentProps}\n ref={ref}\n className={classNames(styles, 'react-spectrum-DatePicker-cell', {\n 'is-placeholder': segment.isPlaceholder,\n 'is-read-only': !segment.isEditable\n })}\n style={{\n ...segmentProps.style,\n minWidth: segment.maxValue != null ? String(segment.maxValue).length + 'ch' : null\n }}\n data-testid={segment.type}>\n <span aria-hidden=\"true\" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span>\n {segment.isPlaceholder ? '' : segment.text}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"DatePickerSegment.module.js.map"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
var $bd22dc8dad9522bc$exports = require("./DatePickerField.main.js");
|
|
2
|
+
require("./styles.36ea4632.css");
|
|
3
|
+
var $91c3db8c6a21ca71$exports = require("./styles_css.main.js");
|
|
4
|
+
var $c3ebc4931d9b9977$exports = require("./Input.main.js");
|
|
5
|
+
var $0045b32a117743a7$exports = require("./intlStrings.main.js");
|
|
6
|
+
require("./vars.ccbd2e3f.css");
|
|
7
|
+
var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
|
|
8
|
+
var $740ff83729a8f317$exports = require("./TimeField.main.js");
|
|
9
|
+
var $4d2e419f522adb48$exports = require("./utils.main.js");
|
|
10
|
+
var $56Vum$spectrumiconsworkflowCalendar = require("@spectrum-icons/workflow/Calendar");
|
|
11
|
+
var $56Vum$reactspectrumutils = require("@react-spectrum/utils");
|
|
12
|
+
var $56Vum$reactspectrumview = require("@react-spectrum/view");
|
|
13
|
+
var $56Vum$reactspectrumdialog = require("@react-spectrum/dialog");
|
|
14
|
+
var $56Vum$reactspectrumlabel = require("@react-spectrum/label");
|
|
15
|
+
var $56Vum$reactspectrumbutton = require("@react-spectrum/button");
|
|
16
|
+
var $56Vum$reactspectrumlayout = require("@react-spectrum/layout");
|
|
17
|
+
var $56Vum$reactariautils = require("@react-aria/utils");
|
|
18
|
+
var $56Vum$reactspectrumcalendar = require("@react-spectrum/calendar");
|
|
19
|
+
var $56Vum$react = require("react");
|
|
20
|
+
var $56Vum$reactariadatepicker = require("@react-aria/datepicker");
|
|
21
|
+
var $56Vum$reactstatelydatepicker = require("@react-stately/datepicker");
|
|
22
|
+
var $56Vum$reactariafocus = require("@react-aria/focus");
|
|
23
|
+
var $56Vum$reactspectrumform = require("@react-spectrum/form");
|
|
24
|
+
var $56Vum$reactariainteractions = require("@react-aria/interactions");
|
|
25
|
+
var $56Vum$reactariai18n = require("@react-aria/i18n");
|
|
26
|
+
var $56Vum$reactspectrumprovider = require("@react-spectrum/provider");
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function $parcel$interopDefault(a) {
|
|
30
|
+
return a && a.__esModule ? a.default : a;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function $parcel$export(e, n, v, s) {
|
|
34
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
$parcel$export(module.exports, "DateRangePicker", () => $16cafb71dac155a4$export$17334619f3ac2224);
|
|
38
|
+
/*
|
|
39
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
40
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
41
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
42
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
43
|
+
*
|
|
44
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
45
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
46
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
47
|
+
* governing permissions and limitations under the License.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function $16cafb71dac155a4$var$DateRangePicker(props, ref) {
|
|
73
|
+
var _state_timeRange, _state_timeRange1;
|
|
74
|
+
props = (0, $56Vum$reactspectrumprovider.useProviderProps)(props);
|
|
75
|
+
props = (0, $56Vum$reactspectrumform.useFormProps)(props);
|
|
76
|
+
let { isQuiet: isQuiet, isDisabled: isDisabled, autoFocus: autoFocus, placeholderValue: placeholderValue, maxVisibleMonths: maxVisibleMonths = 1, pageBehavior: pageBehavior } = props;
|
|
77
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $56Vum$reactariainteractions.useHover)({
|
|
78
|
+
isDisabled: isDisabled
|
|
79
|
+
});
|
|
80
|
+
let targetRef = (0, $56Vum$react.useRef)();
|
|
81
|
+
let state = (0, $56Vum$reactstatelydatepicker.useDateRangePickerState)({
|
|
82
|
+
...props,
|
|
83
|
+
shouldCloseOnSelect: ()=>!state.hasTime
|
|
84
|
+
});
|
|
85
|
+
let { labelProps: labelProps, groupProps: groupProps, buttonProps: buttonProps, dialogProps: dialogProps, startFieldProps: startFieldProps, endFieldProps: endFieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, calendarProps: calendarProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $56Vum$reactariadatepicker.useDateRangePicker)(props, state, targetRef);
|
|
86
|
+
let { isOpen: isOpen, setOpen: setOpen } = state;
|
|
87
|
+
let { direction: direction } = (0, $56Vum$reactariai18n.useLocale)();
|
|
88
|
+
let domRef = (0, $4d2e419f522adb48$exports.useFocusManagerRef)(ref);
|
|
89
|
+
let stringFormatter = (0, $56Vum$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($0045b32a117743a7$exports))), "@react-spectrum/datepicker");
|
|
90
|
+
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $56Vum$reactariafocus.useFocusRing)({
|
|
91
|
+
within: true,
|
|
92
|
+
isTextInput: true,
|
|
93
|
+
autoFocus: autoFocus
|
|
94
|
+
});
|
|
95
|
+
let { isFocused: isFocusedButton, focusProps: focusPropsButton } = (0, $56Vum$reactariafocus.useFocusRing)({
|
|
96
|
+
within: false,
|
|
97
|
+
isTextInput: false,
|
|
98
|
+
autoFocus: autoFocus
|
|
99
|
+
});
|
|
100
|
+
let className = (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), "spectrum-InputGroup", {
|
|
101
|
+
"spectrum-InputGroup--quiet": isQuiet,
|
|
102
|
+
"spectrum-InputGroup--invalid": isInvalid && !isDisabled,
|
|
103
|
+
"is-disabled": isDisabled,
|
|
104
|
+
"is-hovered": isHovered,
|
|
105
|
+
"is-focused": isFocused,
|
|
106
|
+
"focus-ring": isFocusVisible && !isFocusedButton
|
|
107
|
+
});
|
|
108
|
+
let fieldClassName = (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), "spectrum-InputGroup-input", {
|
|
109
|
+
"is-disabled": isDisabled,
|
|
110
|
+
"is-invalid": isInvalid && !isDisabled
|
|
111
|
+
});
|
|
112
|
+
// Note: this description is intentionally not passed to useDatePicker.
|
|
113
|
+
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
114
|
+
let description = (0, $4d2e419f522adb48$exports.useFormatHelpText)(props);
|
|
115
|
+
if (description && !props.description) descriptionProps.id = null;
|
|
116
|
+
let placeholder = placeholderValue;
|
|
117
|
+
let timePlaceholder = placeholder && "hour" in placeholder ? placeholder : null;
|
|
118
|
+
let timeMinValue = props.minValue && "hour" in props.minValue ? props.minValue : null;
|
|
119
|
+
let timeMaxValue = props.maxValue && "hour" in props.maxValue ? props.maxValue : null;
|
|
120
|
+
let timeGranularity = state.granularity === "hour" || state.granularity === "minute" || state.granularity === "second" ? state.granularity : null;
|
|
121
|
+
let showTimeField = !!timeGranularity;
|
|
122
|
+
let visibleMonths = (0, $4d2e419f522adb48$exports.useVisibleMonths)(maxVisibleMonths);
|
|
123
|
+
let validationState = state.validationState || (isInvalid ? "invalid" : null);
|
|
124
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumlabel.Field), {
|
|
125
|
+
...props,
|
|
126
|
+
ref: domRef,
|
|
127
|
+
elementType: "span",
|
|
128
|
+
description: description,
|
|
129
|
+
labelProps: labelProps,
|
|
130
|
+
descriptionProps: descriptionProps,
|
|
131
|
+
errorMessageProps: errorMessageProps,
|
|
132
|
+
validationState: validationState,
|
|
133
|
+
isInvalid: isInvalid,
|
|
134
|
+
validationErrors: validationErrors,
|
|
135
|
+
validationDetails: validationDetails,
|
|
136
|
+
wrapperClassName: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-fieldWrapper")
|
|
137
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement("div", {
|
|
138
|
+
...(0, $56Vum$reactariautils.mergeProps)(groupProps, hoverProps, focusProps),
|
|
139
|
+
className: className,
|
|
140
|
+
ref: targetRef
|
|
141
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $c3ebc4931d9b9977$exports.Input), {
|
|
142
|
+
isDisabled: isDisabled,
|
|
143
|
+
isQuiet: isQuiet,
|
|
144
|
+
validationState: validationState,
|
|
145
|
+
className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), "spectrum-InputGroup-field"),
|
|
146
|
+
inputClassName: fieldClassName,
|
|
147
|
+
disableFocusRing: true
|
|
148
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $bd22dc8dad9522bc$exports.DatePickerField), {
|
|
149
|
+
...startFieldProps,
|
|
150
|
+
"data-testid": "start-date",
|
|
151
|
+
isQuiet: props.isQuiet,
|
|
152
|
+
inputClassName: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-startField")
|
|
153
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement($16cafb71dac155a4$var$DateRangeDash, null), /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $bd22dc8dad9522bc$exports.DatePickerField), {
|
|
154
|
+
...endFieldProps,
|
|
155
|
+
"data-testid": "end-date",
|
|
156
|
+
isQuiet: props.isQuiet,
|
|
157
|
+
inputClassName: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), "spectrum-Datepicker-endField", (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-endField"))
|
|
158
|
+
})), /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumdialog.DialogTrigger), {
|
|
159
|
+
type: "popover",
|
|
160
|
+
mobileType: "tray",
|
|
161
|
+
placement: direction === "rtl" ? "bottom right" : "bottom left",
|
|
162
|
+
targetRef: targetRef,
|
|
163
|
+
hideArrow: true,
|
|
164
|
+
isOpen: isOpen,
|
|
165
|
+
onOpenChange: setOpen,
|
|
166
|
+
shouldFlip: props.shouldFlip
|
|
167
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumbutton.FieldButton), {
|
|
168
|
+
...(0, $56Vum$reactariautils.mergeProps)(buttonProps, focusPropsButton),
|
|
169
|
+
UNSAFE_className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), "spectrum-FieldButton"),
|
|
170
|
+
isQuiet: isQuiet,
|
|
171
|
+
validationState: validationState
|
|
172
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, ($parcel$interopDefault($56Vum$spectrumiconsworkflowCalendar))), null)), /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumdialog.Dialog), {
|
|
173
|
+
UNSAFE_className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-dialog"),
|
|
174
|
+
...dialogProps
|
|
175
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumview.Content), null, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement("div", {
|
|
176
|
+
className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-dialogContent")
|
|
177
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumcalendar.RangeCalendar), {
|
|
178
|
+
...calendarProps,
|
|
179
|
+
visibleMonths: visibleMonths,
|
|
180
|
+
pageBehavior: pageBehavior,
|
|
181
|
+
UNSAFE_className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-calendar", {
|
|
182
|
+
"is-invalid": validationState === "invalid"
|
|
183
|
+
})
|
|
184
|
+
}), showTimeField && /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $56Vum$reactspectrumlayout.Flex), {
|
|
185
|
+
gap: "size-100",
|
|
186
|
+
marginTop: "size-100",
|
|
187
|
+
UNSAFE_className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-timeFields")
|
|
188
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $740ff83729a8f317$exports.TimeField), {
|
|
189
|
+
label: stringFormatter.format("startTime"),
|
|
190
|
+
value: ((_state_timeRange = state.timeRange) === null || _state_timeRange === void 0 ? void 0 : _state_timeRange.start) || null,
|
|
191
|
+
onChange: (v)=>state.setTime("start", v),
|
|
192
|
+
placeholderValue: timePlaceholder,
|
|
193
|
+
granularity: timeGranularity,
|
|
194
|
+
minValue: timeMinValue,
|
|
195
|
+
maxValue: timeMaxValue,
|
|
196
|
+
hourCycle: props.hourCycle,
|
|
197
|
+
hideTimeZone: props.hideTimeZone,
|
|
198
|
+
flex: true
|
|
199
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement((0, $740ff83729a8f317$exports.TimeField), {
|
|
200
|
+
label: stringFormatter.format("endTime"),
|
|
201
|
+
value: ((_state_timeRange1 = state.timeRange) === null || _state_timeRange1 === void 0 ? void 0 : _state_timeRange1.end) || null,
|
|
202
|
+
onChange: (v)=>state.setTime("end", v),
|
|
203
|
+
placeholderValue: timePlaceholder,
|
|
204
|
+
granularity: timeGranularity,
|
|
205
|
+
minValue: timeMinValue,
|
|
206
|
+
maxValue: timeMaxValue,
|
|
207
|
+
hourCycle: props.hourCycle,
|
|
208
|
+
hideTimeZone: props.hideTimeZone,
|
|
209
|
+
flex: true
|
|
210
|
+
}))))))));
|
|
211
|
+
}
|
|
212
|
+
function $16cafb71dac155a4$var$DateRangeDash() {
|
|
213
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).createElement("div", {
|
|
214
|
+
"aria-hidden": "true",
|
|
215
|
+
"data-testid": "date-range-dash",
|
|
216
|
+
className: (0, $56Vum$reactspectrumutils.classNames)((0, ($parcel$interopDefault($91c3db8c6a21ca71$exports))), "react-spectrum-Datepicker-rangeDash")
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
|
|
221
|
+
* to enter or select a date and time range.
|
|
222
|
+
*/ const $16cafb71dac155a4$export$17334619f3ac2224 = /*#__PURE__*/ (0, ($parcel$interopDefault($56Vum$react))).forwardRef($16cafb71dac155a4$var$DateRangePicker);
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
//# sourceMappingURL=DateRangePicker.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;AA8BD,SAAS,sCAAqC,KAAsC,EAAE,GAA8B;QAkJvF,kBAWA;IA5J3B,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,WACF,OAAO,cACP,UAAU,aACV,SAAS,oBACT,gBAAgB,oBAChB,mBAAmB,iBACnB,YAAY,EACb,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,YAAY,CAAA,GAAA,mBAAK;IACrB,IAAI,QAAQ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QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBACF,0DAAC,CAAA,GAAA,mCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,EAAA,oBAAA,MAAM,SAAS,cAAf,wCAAA,kBAAiB,GAAG,KAAI;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAUtB;AAEA,SAAS;IACP,qBACE,0DAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAe,GAAG;;AAE9C;AAEA;;;CAGC,GACD,MAAM,0DAAmB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/datepicker/src/DateRangePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {DateValue, SpectrumDateRangePickerProps} from '@react-types/datepicker';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {Flex} from '@react-spectrum/layout';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {RangeCalendar} from '@react-spectrum/calendar';\nimport React, {ReactElement, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePicker} from '@react-aria/datepicker';\nimport {useDateRangePickerState} from '@react-stately/datepicker';\nimport {useFocusManagerRef, useFormatHelpText, useVisibleMonths} from './utils';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isQuiet,\n isDisabled,\n autoFocus,\n placeholderValue,\n maxVisibleMonths = 1,\n pageBehavior\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let targetRef = useRef<HTMLDivElement>();\n let state = useDateRangePickerState({\n ...props,\n shouldCloseOnSelect: () => !state.hasTime\n });\n let {labelProps, groupProps, buttonProps, dialogProps, startFieldProps, endFieldProps, descriptionProps, errorMessageProps, calendarProps, isInvalid, validationErrors, validationDetails} = useDateRangePicker(props, state, targetRef);\n let {isOpen, setOpen} = state;\n let {direction} = useLocale();\n let domRef = useFocusManagerRef(ref);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n within: true,\n isTextInput: true,\n autoFocus\n });\n\n let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n within: false,\n isTextInput: false,\n autoFocus\n });\n\n let className = classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'focus-ring': isFocusVisible && !isFocusedButton\n }\n );\n\n let fieldClassName = classNames(\n styles,\n 'spectrum-InputGroup-input',\n {\n 'is-disabled': isDisabled,\n 'is-invalid': isInvalid && !isDisabled\n }\n );\n\n // Note: this description is intentionally not passed to useDatePicker.\n // The format help text is unnecessary for screen reader users because each segment already has a label.\n let description = useFormatHelpText(props);\n if (description && !props.description) {\n descriptionProps.id = null;\n }\n\n let placeholder: DateValue = placeholderValue;\n let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : null;\n let showTimeField = !!timeGranularity;\n\n let visibleMonths = useVisibleMonths(maxVisibleMonths);\n let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n return (\n <Field\n {...props}\n ref={domRef}\n elementType=\"span\"\n description={description}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n <div\n {...mergeProps(groupProps, hoverProps, focusProps)}\n className={className}\n ref={targetRef}>\n <Input\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n className={classNames(styles, 'spectrum-InputGroup-field')}\n inputClassName={fieldClassName}\n disableFocusRing>\n <DatePickerField\n {...startFieldProps}\n data-testid=\"start-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')} />\n <DateRangeDash />\n <DatePickerField\n {...endFieldProps}\n data-testid=\"end-date\"\n isQuiet={props.isQuiet}\n inputClassName={classNames(\n styles,\n 'spectrum-Datepicker-endField',\n classNames(\n datepickerStyles,\n 'react-spectrum-Datepicker-endField'\n )\n )} />\n </Input>\n <DialogTrigger\n type=\"popover\"\n mobileType=\"tray\"\n placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n targetRef={targetRef}\n hideArrow\n isOpen={isOpen}\n onOpenChange={setOpen}\n shouldFlip={props.shouldFlip}>\n <FieldButton\n {...mergeProps(buttonProps, focusPropsButton)}\n UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n isQuiet={isQuiet}\n validationState={validationState}>\n <CalendarIcon />\n </FieldButton>\n <Dialog UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n <Content>\n <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n <RangeCalendar\n {...calendarProps}\n visibleMonths={visibleMonths}\n pageBehavior={pageBehavior}\n UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />\n {showTimeField &&\n <Flex gap=\"size-100\" marginTop=\"size-100\" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\n <TimeField\n label={stringFormatter.format('startTime')}\n value={state.timeRange?.start || null}\n onChange={v => state.setTime('start', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n <TimeField\n label={stringFormatter.format('endTime')}\n value={state.timeRange?.end || null}\n onChange={v => state.setTime('end', v)}\n placeholderValue={timePlaceholder}\n granularity={timeGranularity}\n minValue={timeMinValue}\n maxValue={timeMaxValue}\n hourCycle={props.hourCycle}\n hideTimeZone={props.hideTimeZone}\n flex />\n </Flex>\n }\n </div>\n </Content>\n </Dialog>\n </DialogTrigger>\n </div>\n </Field>\n );\n}\n\nfunction DateRangeDash() {\n return (\n <div\n aria-hidden=\"true\"\n data-testid=\"date-range-dash\"\n className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />\n );\n}\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nconst _DateRangePicker = React.forwardRef(DateRangePicker) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_DateRangePicker as DateRangePicker};\n"],"names":[],"version":3,"file":"DateRangePicker.main.js.map"}
|