@react-spectrum/datepicker 3.14.10 → 3.15.0
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/import.mjs +5 -5
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -5
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +8 -0
- package/package.json +12 -44
- package/src/index.ts +9 -5
- package/dist/DateField.main.js +0 -108
- package/dist/DateField.main.js.map +0 -1
- package/dist/DateField.mjs +0 -103
- package/dist/DateField.module.js +0 -103
- package/dist/DateField.module.js.map +0 -1
- package/dist/DatePicker.main.js +0 -197
- package/dist/DatePicker.main.js.map +0 -1
- package/dist/DatePicker.mjs +0 -192
- package/dist/DatePicker.module.js +0 -192
- package/dist/DatePicker.module.js.map +0 -1
- package/dist/DatePickerField.main.js +0 -72
- package/dist/DatePickerField.main.js.map +0 -1
- package/dist/DatePickerField.mjs +0 -67
- package/dist/DatePickerField.module.js +0 -67
- package/dist/DatePickerField.module.js.map +0 -1
- package/dist/DatePickerSegment.main.js +0 -73
- package/dist/DatePickerSegment.main.js.map +0 -1
- package/dist/DatePickerSegment.mjs +0 -68
- package/dist/DatePickerSegment.module.js +0 -68
- package/dist/DatePickerSegment.module.js.map +0 -1
- package/dist/DateRangePicker.main.js +0 -229
- package/dist/DateRangePicker.main.js.map +0 -1
- package/dist/DateRangePicker.mjs +0 -224
- package/dist/DateRangePicker.module.js +0 -224
- package/dist/DateRangePicker.module.js.map +0 -1
- package/dist/Input.main.js +0 -128
- package/dist/Input.main.js.map +0 -1
- package/dist/Input.mjs +0 -123
- package/dist/Input.module.js +0 -123
- package/dist/Input.module.js.map +0 -1
- package/dist/TimeField.main.js +0 -100
- package/dist/TimeField.main.js.map +0 -1
- package/dist/TimeField.mjs +0 -95
- package/dist/TimeField.module.js +0 -95
- package/dist/TimeField.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -8
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -10
- package/dist/ar-AE.module.js +0 -10
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -8
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -10
- package/dist/bg-BG.module.js +0 -10
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -8
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -10
- package/dist/cs-CZ.module.js +0 -10
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -8
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -10
- package/dist/da-DK.module.js +0 -10
- package/dist/da-DK.module.js.map +0 -1
- package/dist/datepicker.4d1286b0.css +0 -649
- package/dist/datepicker.4d1286b0.css.map +0 -1
- package/dist/datepicker.776a7787.css +0 -550
- package/dist/datepicker.776a7787.css.map +0 -1
- package/dist/datepicker.e85992d8.css +0 -204
- package/dist/datepicker.e85992d8.css.map +0 -1
- package/dist/de-DE.main.js +0 -8
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -10
- package/dist/de-DE.module.js +0 -10
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -8
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -10
- package/dist/el-GR.module.js +0 -10
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -8
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -10
- package/dist/en-US.module.js +0 -10
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -8
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -10
- package/dist/es-ES.module.js +0 -10
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -8
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -10
- package/dist/et-EE.module.js +0 -10
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -8
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -10
- package/dist/fi-FI.module.js +0 -10
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -8
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -10
- package/dist/fr-FR.module.js +0 -10
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -8
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -10
- package/dist/he-IL.module.js +0 -10
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -8
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -10
- package/dist/hr-HR.module.js +0 -10
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -8
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -10
- package/dist/hu-HU.module.js +0 -10
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/inputgroup_vars_css.main.js +0 -86
- package/dist/inputgroup_vars_css.main.js.map +0 -1
- package/dist/inputgroup_vars_css.mjs +0 -88
- package/dist/inputgroup_vars_css.module.js +0 -88
- package/dist/inputgroup_vars_css.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -8
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -10
- package/dist/it-IT.module.js +0 -10
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -8
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -10
- package/dist/ja-JP.module.js +0 -10
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -8
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -10
- package/dist/ko-KR.module.js +0 -10
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -8
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -10
- package/dist/lt-LT.module.js +0 -10
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -8
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -10
- package/dist/lv-LV.module.js +0 -10
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -8
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -10
- package/dist/nb-NO.module.js +0 -10
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -8
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -10
- package/dist/nl-NL.module.js +0 -10
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -8
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -10
- package/dist/pl-PL.module.js +0 -10
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -8
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -10
- package/dist/pt-BR.module.js +0 -10
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -8
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -10
- package/dist/pt-PT.module.js +0 -10
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -8
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -10
- package/dist/ro-RO.module.js +0 -10
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -8
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -10
- package/dist/ru-RU.module.js +0 -10
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -8
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -10
- package/dist/sk-SK.module.js +0 -10
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -8
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -10
- package/dist/sl-SI.module.js +0 -10
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -8
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -10
- package/dist/sr-SP.module.js +0 -10
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/styles_css.main.js +0 -77
- package/dist/styles_css.main.js.map +0 -1
- package/dist/styles_css.mjs +0 -79
- package/dist/styles_css.module.js +0 -79
- package/dist/styles_css.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -8
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -10
- package/dist/sv-SE.module.js +0 -10
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/textfield_vars_css.main.js +0 -74
- package/dist/textfield_vars_css.main.js.map +0 -1
- package/dist/textfield_vars_css.mjs +0 -76
- package/dist/textfield_vars_css.module.js +0 -76
- package/dist/textfield_vars_css.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -8
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -10
- package/dist/tr-TR.module.js +0 -10
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -33
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -8
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -10
- package/dist/uk-UA.module.js +0 -10
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/utils.main.js +0 -117
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -105
- package/dist/utils.module.js +0 -105
- package/dist/utils.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -8
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -10
- package/dist/zh-CN.module.js +0 -10
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -8
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -10
- package/dist/zh-TW.module.js +0 -10
- package/dist/zh-TW.module.js.map +0 -1
- package/src/DateField.tsx +0 -106
- package/src/DatePicker.tsx +0 -196
- package/src/DatePickerField.tsx +0 -61
- package/src/DatePickerSegment.tsx +0 -69
- package/src/DateRangePicker.tsx +0 -234
- package/src/Input.tsx +0 -142
- package/src/TimeField.tsx +0 -96
- package/src/styles.css +0 -203
- package/src/utils.tsx +0 -96
package/dist/tr-TR.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,iBAAW,CAAC;IAC1C,aAAa,CAAC,8BAAe,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC;AAChB","sources":["packages/@react-spectrum/datepicker/intl/tr-TR.json"],"sourcesContent":["{\n \"endTime\": \"Bitiş saati\",\n \"startTime\": \"Başlangıç saati\",\n \"time\": \"Saat\"\n}\n"],"names":[],"version":3,"file":"tr-TR.module.js.map"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { FocusableRef } from "@react-types/shared";
|
|
2
|
-
import { ReactElement } from "react";
|
|
3
|
-
import { SpectrumTimeFieldProps, TimeValue, DateValue, SpectrumDatePickerProps, SpectrumDateRangePickerProps, SpectrumDateFieldProps } from "@react-types/datepicker";
|
|
4
|
-
/**
|
|
5
|
-
* TimeFields allow users to enter and edit time values using a keyboard.
|
|
6
|
-
* Each part of the time is displayed in an individually editable segment.
|
|
7
|
-
*/
|
|
8
|
-
export const TimeField: <T extends TimeValue>(props: SpectrumTimeFieldProps<T> & {
|
|
9
|
-
ref?: FocusableRef<HTMLElement>;
|
|
10
|
-
}) => ReactElement;
|
|
11
|
-
/**
|
|
12
|
-
* DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
|
|
13
|
-
*/
|
|
14
|
-
export const DatePicker: <T extends DateValue>(props: SpectrumDatePickerProps<T> & {
|
|
15
|
-
ref?: FocusableRef<HTMLElement>;
|
|
16
|
-
}) => ReactElement;
|
|
17
|
-
/**
|
|
18
|
-
* DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
|
|
19
|
-
* to enter or select a date and time range.
|
|
20
|
-
*/
|
|
21
|
-
export const DateRangePicker: <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {
|
|
22
|
-
ref?: FocusableRef<HTMLElement>;
|
|
23
|
-
}) => ReactElement;
|
|
24
|
-
/**
|
|
25
|
-
* DateFields allow users to enter and edit date and time values using a keyboard.
|
|
26
|
-
* Each part of a date value is displayed in an individually editable segment.
|
|
27
|
-
*/
|
|
28
|
-
export const DateField: <T extends DateValue>(props: SpectrumDateFieldProps<T> & {
|
|
29
|
-
ref?: FocusableRef<HTMLElement>;
|
|
30
|
-
}) => ReactElement;
|
|
31
|
-
export type { SpectrumDateFieldProps, SpectrumDatePickerProps, SpectrumDateRangePickerProps, SpectrumTimeFieldProps } from '@react-types/datepicker';
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AI2BA;;;GAGG;AACH,OAAO,MAAM,WAgEP,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvDlH;;GAEG;AACH,OAAO,MAAM,YAwJP,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC3JnH;;;GAGG;AACH,OAAO,MAAM,iBAoLP,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACpMxH;;;GAGG;AACH,OAAO,MAAM,WAyEP,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,WAAW,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvFlH,YAAY,EAAC,sBAAsB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,sBAAsB,EAAC,MAAM,yBAAyB,CAAC","sources":["packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePickerField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/Input.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/utils.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/TimeField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DatePicker.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DateRangePicker.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/DateField.tsx","packages/@react-spectrum/datepicker/src/packages/@react-spectrum/datepicker/src/index.ts","packages/@react-spectrum/datepicker/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\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\n/// <reference types=\"css-module-types\" />\n\nexport {DatePicker} from './DatePicker';\nexport {DateRangePicker} from './DateRangePicker';\nexport {TimeField} from './TimeField';\nexport {DateField} from './DateField';\nexport type {SpectrumDateFieldProps, SpectrumDatePickerProps, SpectrumDateRangePickerProps, SpectrumTimeFieldProps} from '@react-types/datepicker';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/uk-UA.main.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"endTime": `\u{427}\u{430}\u{441} \u{437}\u{430}\u{432}\u{435}\u{440}\u{448}\u{435}\u{43D}\u{43D}\u{44F}`,
|
|
3
|
-
"startTime": `\u{427}\u{430}\u{441} \u{43F}\u{43E}\u{447}\u{430}\u{442}\u{43A}\u{443}`,
|
|
4
|
-
"time": `\u{427}\u{430}\u{441}`
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=uk-UA.main.js.map
|
package/dist/uk-UA.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,4FAAc,CAAC;IAC7C,aAAa,CAAC,uEAAW,CAAC;IAC1B,QAAQ,CAAC,qBAAG,CAAC;AACf","sources":["packages/@react-spectrum/datepicker/intl/uk-UA.json"],"sourcesContent":["{\n \"endTime\": \"Час завершення\",\n \"startTime\": \"Час початку\",\n \"time\": \"Час\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
|
package/dist/uk-UA.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $64c0344455eff457$exports = {};
|
|
2
|
-
$64c0344455eff457$exports = {
|
|
3
|
-
"endTime": `\u{427}\u{430}\u{441} \u{437}\u{430}\u{432}\u{435}\u{440}\u{448}\u{435}\u{43D}\u{43D}\u{44F}`,
|
|
4
|
-
"startTime": `\u{427}\u{430}\u{441} \u{43F}\u{43E}\u{447}\u{430}\u{442}\u{43A}\u{443}`,
|
|
5
|
-
"time": `\u{427}\u{430}\u{441}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$64c0344455eff457$exports as default};
|
|
10
|
-
//# sourceMappingURL=uk-UA.module.js.map
|
package/dist/uk-UA.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $64c0344455eff457$exports = {};
|
|
2
|
-
$64c0344455eff457$exports = {
|
|
3
|
-
"endTime": `\u{427}\u{430}\u{441} \u{437}\u{430}\u{432}\u{435}\u{440}\u{448}\u{435}\u{43D}\u{43D}\u{44F}`,
|
|
4
|
-
"startTime": `\u{427}\u{430}\u{441} \u{43F}\u{43E}\u{447}\u{430}\u{442}\u{43A}\u{443}`,
|
|
5
|
-
"time": `\u{427}\u{430}\u{441}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$64c0344455eff457$exports as default};
|
|
10
|
-
//# sourceMappingURL=uk-UA.module.js.map
|
package/dist/uk-UA.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,4FAAc,CAAC;IAC7C,aAAa,CAAC,uEAAW,CAAC;IAC1B,QAAQ,CAAC,qBAAG,CAAC;AACf","sources":["packages/@react-spectrum/datepicker/intl/uk-UA.json"],"sourcesContent":["{\n \"endTime\": \"Час завершення\",\n \"startTime\": \"Час початку\",\n \"time\": \"Час\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
|
package/dist/utils.main.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
var $6Arg9$reactspectrumutils = require("@react-spectrum/utils");
|
|
2
|
-
var $6Arg9$reactariafocus = require("@react-aria/focus");
|
|
3
|
-
var $6Arg9$reactariai18n = require("@react-aria/i18n");
|
|
4
|
-
var $6Arg9$react = require("react");
|
|
5
|
-
var $6Arg9$reactariadatepicker = require("@react-aria/datepicker");
|
|
6
|
-
var $6Arg9$reactariautils = require("@react-aria/utils");
|
|
7
|
-
var $6Arg9$reactspectrumprovider = require("@react-spectrum/provider");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function $parcel$interopDefault(a) {
|
|
11
|
-
return a && a.__esModule ? a.default : a;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function $parcel$export(e, n, v, s) {
|
|
15
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
$parcel$export(module.exports, "useFormatHelpText", () => $9d3b96715dbbb2b7$export$322f4580ccd8dde6);
|
|
19
|
-
$parcel$export(module.exports, "useVisibleMonths", () => $9d3b96715dbbb2b7$export$12ce2869ce471b1f);
|
|
20
|
-
$parcel$export(module.exports, "useFocusManagerRef", () => $9d3b96715dbbb2b7$export$71a23a36270e4bf0);
|
|
21
|
-
$parcel$export(module.exports, "useFormattedDateWidth", () => $9d3b96715dbbb2b7$export$31e22e3c931fc056);
|
|
22
|
-
/*
|
|
23
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
-
* governing permissions and limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function $9d3b96715dbbb2b7$export$322f4580ccd8dde6(props) {
|
|
40
|
-
let formatter = (0, $6Arg9$reactariai18n.useDateFormatter)({
|
|
41
|
-
dateStyle: 'short'
|
|
42
|
-
});
|
|
43
|
-
let displayNames = (0, $6Arg9$reactariadatepicker.useDisplayNames)();
|
|
44
|
-
return (0, $6Arg9$react.useMemo)(()=>{
|
|
45
|
-
if (props.description) return props.description;
|
|
46
|
-
if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
|
|
47
|
-
if (s.type === 'literal' || s.type === 'unknown' || s.type === 'yearName') return /*#__PURE__*/ (0, ($parcel$interopDefault($6Arg9$react))).createElement("span", {
|
|
48
|
-
key: i
|
|
49
|
-
}, ` ${s.value} `);
|
|
50
|
-
let type = s.type === 'relatedYear' ? 'year' : s.type;
|
|
51
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Arg9$react))).createElement("span", {
|
|
52
|
-
key: i,
|
|
53
|
-
style: {
|
|
54
|
-
unicodeBidi: 'embed',
|
|
55
|
-
direction: 'ltr'
|
|
56
|
-
}
|
|
57
|
-
}, displayNames.of(type));
|
|
58
|
-
});
|
|
59
|
-
return '';
|
|
60
|
-
}, [
|
|
61
|
-
props.description,
|
|
62
|
-
props.showFormatHelpText,
|
|
63
|
-
formatter,
|
|
64
|
-
displayNames
|
|
65
|
-
]);
|
|
66
|
-
}
|
|
67
|
-
function $9d3b96715dbbb2b7$export$12ce2869ce471b1f(maxVisibleMonths) {
|
|
68
|
-
let { scale: scale } = (0, $6Arg9$reactspectrumprovider.useProvider)();
|
|
69
|
-
let [visibleMonths, setVisibleMonths] = (0, $6Arg9$react.useState)($9d3b96715dbbb2b7$var$getVisibleMonths(scale));
|
|
70
|
-
(0, $6Arg9$reactariautils.useLayoutEffect)(()=>{
|
|
71
|
-
let onResize = ()=>setVisibleMonths($9d3b96715dbbb2b7$var$getVisibleMonths(scale));
|
|
72
|
-
onResize();
|
|
73
|
-
window.addEventListener('resize', onResize);
|
|
74
|
-
return ()=>{
|
|
75
|
-
window.removeEventListener('resize', onResize);
|
|
76
|
-
};
|
|
77
|
-
}, [
|
|
78
|
-
scale
|
|
79
|
-
]);
|
|
80
|
-
return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
|
|
81
|
-
}
|
|
82
|
-
function $9d3b96715dbbb2b7$var$getVisibleMonths(scale) {
|
|
83
|
-
if (typeof window === 'undefined') return 1;
|
|
84
|
-
let monthWidth = scale === 'large' ? 336 : 280;
|
|
85
|
-
let gap = scale === 'large' ? 30 : 24;
|
|
86
|
-
let popoverPadding = scale === 'large' ? 32 : 48;
|
|
87
|
-
return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
|
|
88
|
-
}
|
|
89
|
-
function $9d3b96715dbbb2b7$export$71a23a36270e4bf0(ref) {
|
|
90
|
-
let domRef = (0, $6Arg9$react.useRef)(null);
|
|
91
|
-
(0, $6Arg9$react.useImperativeHandle)(ref, ()=>({
|
|
92
|
-
...(0, $6Arg9$reactspectrumutils.createDOMRef)(domRef),
|
|
93
|
-
focus () {
|
|
94
|
-
(0, $6Arg9$reactariafocus.createFocusManager)(domRef).focusFirst({
|
|
95
|
-
tabbable: true
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
return domRef;
|
|
100
|
-
}
|
|
101
|
-
function $9d3b96715dbbb2b7$export$31e22e3c931fc056(state) {
|
|
102
|
-
var _useLocale;
|
|
103
|
-
let locale = (_useLocale = (0, $6Arg9$reactariai18n.useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
|
|
104
|
-
let currentDate = new Date();
|
|
105
|
-
let formatedDate = state.getDateFormatter(locale, {
|
|
106
|
-
shouldForceLeadingZeros: true
|
|
107
|
-
}).format(currentDate);
|
|
108
|
-
let totalCharacters = formatedDate.length;
|
|
109
|
-
// The max of two is for times with only hours.
|
|
110
|
-
// As the length of a date grows we need to proportionally increase the width.
|
|
111
|
-
// We use the character count with 'ch' units and add extra padding to accomate for
|
|
112
|
-
// dates with months and time dashes, which are wider characters.
|
|
113
|
-
return totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//# sourceMappingURL=utils.main.js.map
|
package/dist/utils.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAYM,SAAS,0CAAkB,KAA8E;IAC9G,IAAI,YAAY,CAAA,GAAA,qCAAe,EAAE;QAAC,WAAW;IAAO;IACpD,IAAI,eAAe,CAAA,GAAA,0CAAc;IACjC,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,IAAI,MAAM,WAAW,EACnB,OAAO,MAAM,WAAW;QAG1B,IAAI,MAAM,kBAAkB,EAC1B,OACE,UAAU,aAAa,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,GAAG;YAC1C,IAAI,EAAE,IAAI,KAAK,aAAa,EAAE,IAAI,KAAK,aAAa,AAAC,EAAE,IAAI,KAAgB,YACzE,qBAAO,0DAAC;gBAAK,KAAK;eAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YAGtC,IAAI,OAAO,EAAE,IAAI,KAAe,gBAAgB,SAAS,EAAE,IAAI;YAC/D,qBAAO,0DAAC;gBAAK,KAAK;gBAAG,OAAO;oBAAC,aAAa;oBAAS,WAAW;gBAAK;eAAI,aAAa,EAAE,CAAC;QACzF;QAIJ,OAAO;IACT,GAAG;QAAC,MAAM,WAAW;QAAE,MAAM,kBAAkB;QAAE;QAAW;KAAa;AAC3E;AAEO,SAAS,0CAAiB,gBAAwB;IACvD,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,wCAAU;IACxB,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAE,uCAAiB;IAClE,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,WAAW,IAAM,iBAAiB,uCAAiB;QACvD;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,GAAG;QAAC;KAAM;IAEV,OAAO,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,kBAAkB;AAC/D;AAEA,SAAS,uCAAiB,KAAK;IAC7B,IAAI,OAAO,WAAW,aACpB,OAAO;IAET,IAAI,aAAa,UAAU,UAAU,MAAM;IAC3C,IAAI,MAAM,UAAU,UAAU,KAAK;IACnC,IAAI,iBAAiB,UAAU,UAAU,KAAK;IAC9C,OAAO,KAAK,KAAK,CAAC,AAAC,CAAA,OAAO,UAAU,GAAG,iBAAiB,CAAA,IAAM,CAAA,aAAa,GAAE;AAC/E;AAEO,SAAS,0CAAmB,GAA8B;IAC/D,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAsB;IACxC,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAO,CAAA;YAC9B,GAAG,CAAA,GAAA,sCAAW,EAAE,OAAO;YACvB;gBACE,CAAA,GAAA,wCAAiB,EAAE,QAAQ,UAAU,CAAC;oBAAC,UAAU;gBAAI;YACvD;QACF,CAAA;IACA,OAAO;AACT;AAEO,SAAS,0CAAsB,KAA6F;QACpH;IAAb,IAAI,UAAS,aAAA,CAAA,GAAA,8BAAQ,iBAAR,iCAAA,WAAa,MAAM;IAChC,IAAI,cAAc,IAAI;IACtB,IAAI,eAAe,MAAM,gBAAgB,CAAC,QAAQ;QAAC,yBAAyB;IAAI,GAAG,MAAM,CAAC;IAC1F,IAAI,kBAAmB,aAAa,MAAM;IAE1C,+CAA+C;IAC/C,8EAA8E;IAC9E,mFAAmF;IACnF,iEAAiE;IACjE,OAAQ,kBAAkB,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,kBAAkB,IAAI;AACtE","sources":["packages/@react-spectrum/datepicker/src/utils.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 */\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateFormatter, useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {FocusableRef} from '@react-types/shared';\nimport {FormatterOptions} from '@react-stately/datepicker';\nimport React, {ReactNode, useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDisplayNames} from '@react-aria/datepicker';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider} from '@react-spectrum/provider';\n\nexport function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {\n let formatter = useDateFormatter({dateStyle: 'short'});\n let displayNames = useDisplayNames();\n return useMemo(() => {\n if (props.description) {\n return props.description;\n }\n\n if (props.showFormatHelpText) {\n return (\n formatter.formatToParts(new Date()).map((s, i) => {\n if (s.type === 'literal' || s.type === 'unknown' || (s.type as string) === 'yearName') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n let type = s.type as string === 'relatedYear' ? 'year' : s.type;\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(type)}</span>;\n })\n );\n }\n\n return '';\n }, [props.description, props.showFormatHelpText, formatter, displayNames]);\n}\n\nexport function useVisibleMonths(maxVisibleMonths: number): number {\n let {scale} = useProvider()!;\n let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));\n useLayoutEffect(() => {\n let onResize = () => setVisibleMonths(getVisibleMonths(scale));\n onResize();\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [scale]);\n\n return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));\n}\n\nfunction getVisibleMonths(scale) {\n if (typeof window === 'undefined') {\n return 1;\n }\n let monthWidth = scale === 'large' ? 336 : 280;\n let gap = scale === 'large' ? 30 : 24;\n let popoverPadding = scale === 'large' ? 32 : 48;\n return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));\n}\n\nexport function useFocusManagerRef(ref: FocusableRef<HTMLElement>): React.RefObject<HTMLElement | null> {\n let domRef = useRef<HTMLElement | null>(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n createFocusManager(domRef).focusFirst({tabbable: true});\n }\n }));\n return domRef;\n}\n\nexport function useFormattedDateWidth(state: {getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter}): number {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate);\n let totalCharacters = formatedDate.length;\n\n // The max of two is for times with only hours.\n // As the length of a date grows we need to proportionally increase the width.\n // We use the character count with 'ch' units and add extra padding to accomate for\n // dates with months and time dashes, which are wider characters.\n return (totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2));\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
|
|
2
|
-
import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
|
|
3
|
-
import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
|
|
4
|
-
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
5
|
-
import {useDisplayNames as $kDnTZ$useDisplayNames} from "@react-aria/datepicker";
|
|
6
|
-
import {useLayoutEffect as $kDnTZ$useLayoutEffect} from "@react-aria/utils";
|
|
7
|
-
import {useProvider as $kDnTZ$useProvider} from "@react-spectrum/provider";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function $ea94a5cfe92db3c2$export$322f4580ccd8dde6(props) {
|
|
27
|
-
let formatter = (0, $kDnTZ$useDateFormatter)({
|
|
28
|
-
dateStyle: 'short'
|
|
29
|
-
});
|
|
30
|
-
let displayNames = (0, $kDnTZ$useDisplayNames)();
|
|
31
|
-
return (0, $kDnTZ$useMemo)(()=>{
|
|
32
|
-
if (props.description) return props.description;
|
|
33
|
-
if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
|
|
34
|
-
if (s.type === 'literal' || s.type === 'unknown' || s.type === 'yearName') return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
|
|
35
|
-
key: i
|
|
36
|
-
}, ` ${s.value} `);
|
|
37
|
-
let type = s.type === 'relatedYear' ? 'year' : s.type;
|
|
38
|
-
return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
|
|
39
|
-
key: i,
|
|
40
|
-
style: {
|
|
41
|
-
unicodeBidi: 'embed',
|
|
42
|
-
direction: 'ltr'
|
|
43
|
-
}
|
|
44
|
-
}, displayNames.of(type));
|
|
45
|
-
});
|
|
46
|
-
return '';
|
|
47
|
-
}, [
|
|
48
|
-
props.description,
|
|
49
|
-
props.showFormatHelpText,
|
|
50
|
-
formatter,
|
|
51
|
-
displayNames
|
|
52
|
-
]);
|
|
53
|
-
}
|
|
54
|
-
function $ea94a5cfe92db3c2$export$12ce2869ce471b1f(maxVisibleMonths) {
|
|
55
|
-
let { scale: scale } = (0, $kDnTZ$useProvider)();
|
|
56
|
-
let [visibleMonths, setVisibleMonths] = (0, $kDnTZ$useState)($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
|
|
57
|
-
(0, $kDnTZ$useLayoutEffect)(()=>{
|
|
58
|
-
let onResize = ()=>setVisibleMonths($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
|
|
59
|
-
onResize();
|
|
60
|
-
window.addEventListener('resize', onResize);
|
|
61
|
-
return ()=>{
|
|
62
|
-
window.removeEventListener('resize', onResize);
|
|
63
|
-
};
|
|
64
|
-
}, [
|
|
65
|
-
scale
|
|
66
|
-
]);
|
|
67
|
-
return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
|
|
68
|
-
}
|
|
69
|
-
function $ea94a5cfe92db3c2$var$getVisibleMonths(scale) {
|
|
70
|
-
if (typeof window === 'undefined') return 1;
|
|
71
|
-
let monthWidth = scale === 'large' ? 336 : 280;
|
|
72
|
-
let gap = scale === 'large' ? 30 : 24;
|
|
73
|
-
let popoverPadding = scale === 'large' ? 32 : 48;
|
|
74
|
-
return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
|
|
75
|
-
}
|
|
76
|
-
function $ea94a5cfe92db3c2$export$71a23a36270e4bf0(ref) {
|
|
77
|
-
let domRef = (0, $kDnTZ$useRef)(null);
|
|
78
|
-
(0, $kDnTZ$useImperativeHandle)(ref, ()=>({
|
|
79
|
-
...(0, $kDnTZ$createDOMRef)(domRef),
|
|
80
|
-
focus () {
|
|
81
|
-
(0, $kDnTZ$createFocusManager)(domRef).focusFirst({
|
|
82
|
-
tabbable: true
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
return domRef;
|
|
87
|
-
}
|
|
88
|
-
function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
|
|
89
|
-
var _useLocale;
|
|
90
|
-
let locale = (_useLocale = (0, $kDnTZ$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
|
|
91
|
-
let currentDate = new Date();
|
|
92
|
-
let formatedDate = state.getDateFormatter(locale, {
|
|
93
|
-
shouldForceLeadingZeros: true
|
|
94
|
-
}).format(currentDate);
|
|
95
|
-
let totalCharacters = formatedDate.length;
|
|
96
|
-
// The max of two is for times with only hours.
|
|
97
|
-
// As the length of a date grows we need to proportionally increase the width.
|
|
98
|
-
// We use the character count with 'ch' units and add extra padding to accomate for
|
|
99
|
-
// dates with months and time dashes, which are wider characters.
|
|
100
|
-
return totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
export {$ea94a5cfe92db3c2$export$322f4580ccd8dde6 as useFormatHelpText, $ea94a5cfe92db3c2$export$12ce2869ce471b1f as useVisibleMonths, $ea94a5cfe92db3c2$export$71a23a36270e4bf0 as useFocusManagerRef, $ea94a5cfe92db3c2$export$31e22e3c931fc056 as useFormattedDateWidth};
|
|
105
|
-
//# sourceMappingURL=utils.module.js.map
|
package/dist/utils.module.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
|
|
2
|
-
import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
|
|
3
|
-
import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
|
|
4
|
-
import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
|
|
5
|
-
import {useDisplayNames as $kDnTZ$useDisplayNames} from "@react-aria/datepicker";
|
|
6
|
-
import {useLayoutEffect as $kDnTZ$useLayoutEffect} from "@react-aria/utils";
|
|
7
|
-
import {useProvider as $kDnTZ$useProvider} from "@react-spectrum/provider";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function $ea94a5cfe92db3c2$export$322f4580ccd8dde6(props) {
|
|
27
|
-
let formatter = (0, $kDnTZ$useDateFormatter)({
|
|
28
|
-
dateStyle: 'short'
|
|
29
|
-
});
|
|
30
|
-
let displayNames = (0, $kDnTZ$useDisplayNames)();
|
|
31
|
-
return (0, $kDnTZ$useMemo)(()=>{
|
|
32
|
-
if (props.description) return props.description;
|
|
33
|
-
if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
|
|
34
|
-
if (s.type === 'literal' || s.type === 'unknown' || s.type === 'yearName') return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
|
|
35
|
-
key: i
|
|
36
|
-
}, ` ${s.value} `);
|
|
37
|
-
let type = s.type === 'relatedYear' ? 'year' : s.type;
|
|
38
|
-
return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
|
|
39
|
-
key: i,
|
|
40
|
-
style: {
|
|
41
|
-
unicodeBidi: 'embed',
|
|
42
|
-
direction: 'ltr'
|
|
43
|
-
}
|
|
44
|
-
}, displayNames.of(type));
|
|
45
|
-
});
|
|
46
|
-
return '';
|
|
47
|
-
}, [
|
|
48
|
-
props.description,
|
|
49
|
-
props.showFormatHelpText,
|
|
50
|
-
formatter,
|
|
51
|
-
displayNames
|
|
52
|
-
]);
|
|
53
|
-
}
|
|
54
|
-
function $ea94a5cfe92db3c2$export$12ce2869ce471b1f(maxVisibleMonths) {
|
|
55
|
-
let { scale: scale } = (0, $kDnTZ$useProvider)();
|
|
56
|
-
let [visibleMonths, setVisibleMonths] = (0, $kDnTZ$useState)($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
|
|
57
|
-
(0, $kDnTZ$useLayoutEffect)(()=>{
|
|
58
|
-
let onResize = ()=>setVisibleMonths($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
|
|
59
|
-
onResize();
|
|
60
|
-
window.addEventListener('resize', onResize);
|
|
61
|
-
return ()=>{
|
|
62
|
-
window.removeEventListener('resize', onResize);
|
|
63
|
-
};
|
|
64
|
-
}, [
|
|
65
|
-
scale
|
|
66
|
-
]);
|
|
67
|
-
return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
|
|
68
|
-
}
|
|
69
|
-
function $ea94a5cfe92db3c2$var$getVisibleMonths(scale) {
|
|
70
|
-
if (typeof window === 'undefined') return 1;
|
|
71
|
-
let monthWidth = scale === 'large' ? 336 : 280;
|
|
72
|
-
let gap = scale === 'large' ? 30 : 24;
|
|
73
|
-
let popoverPadding = scale === 'large' ? 32 : 48;
|
|
74
|
-
return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
|
|
75
|
-
}
|
|
76
|
-
function $ea94a5cfe92db3c2$export$71a23a36270e4bf0(ref) {
|
|
77
|
-
let domRef = (0, $kDnTZ$useRef)(null);
|
|
78
|
-
(0, $kDnTZ$useImperativeHandle)(ref, ()=>({
|
|
79
|
-
...(0, $kDnTZ$createDOMRef)(domRef),
|
|
80
|
-
focus () {
|
|
81
|
-
(0, $kDnTZ$createFocusManager)(domRef).focusFirst({
|
|
82
|
-
tabbable: true
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
return domRef;
|
|
87
|
-
}
|
|
88
|
-
function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
|
|
89
|
-
var _useLocale;
|
|
90
|
-
let locale = (_useLocale = (0, $kDnTZ$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
|
|
91
|
-
let currentDate = new Date();
|
|
92
|
-
let formatedDate = state.getDateFormatter(locale, {
|
|
93
|
-
shouldForceLeadingZeros: true
|
|
94
|
-
}).format(currentDate);
|
|
95
|
-
let totalCharacters = formatedDate.length;
|
|
96
|
-
// The max of two is for times with only hours.
|
|
97
|
-
// As the length of a date grows we need to proportionally increase the width.
|
|
98
|
-
// We use the character count with 'ch' units and add extra padding to accomate for
|
|
99
|
-
// dates with months and time dashes, which are wider characters.
|
|
100
|
-
return totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
export {$ea94a5cfe92db3c2$export$322f4580ccd8dde6 as useFormatHelpText, $ea94a5cfe92db3c2$export$12ce2869ce471b1f as useVisibleMonths, $ea94a5cfe92db3c2$export$71a23a36270e4bf0 as useFocusManagerRef, $ea94a5cfe92db3c2$export$31e22e3c931fc056 as useFormattedDateWidth};
|
|
105
|
-
//# sourceMappingURL=utils.module.js.map
|
package/dist/utils.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAYM,SAAS,0CAAkB,KAA8E;IAC9G,IAAI,YAAY,CAAA,GAAA,uBAAe,EAAE;QAAC,WAAW;IAAO;IACpD,IAAI,eAAe,CAAA,GAAA,sBAAc;IACjC,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI,MAAM,WAAW,EACnB,OAAO,MAAM,WAAW;QAG1B,IAAI,MAAM,kBAAkB,EAC1B,OACE,UAAU,aAAa,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,GAAG;YAC1C,IAAI,EAAE,IAAI,KAAK,aAAa,EAAE,IAAI,KAAK,aAAa,AAAC,EAAE,IAAI,KAAgB,YACzE,qBAAO,gCAAC;gBAAK,KAAK;eAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YAGtC,IAAI,OAAO,EAAE,IAAI,KAAe,gBAAgB,SAAS,EAAE,IAAI;YAC/D,qBAAO,gCAAC;gBAAK,KAAK;gBAAG,OAAO;oBAAC,aAAa;oBAAS,WAAW;gBAAK;eAAI,aAAa,EAAE,CAAC;QACzF;QAIJ,OAAO;IACT,GAAG;QAAC,MAAM,WAAW;QAAE,MAAM,kBAAkB;QAAE;QAAW;KAAa;AAC3E;AAEO,SAAS,0CAAiB,gBAAwB;IACvD,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,kBAAU;IACxB,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAE,uCAAiB;IAClE,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,WAAW,IAAM,iBAAiB,uCAAiB;QACvD;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,GAAG;QAAC;KAAM;IAEV,OAAO,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,kBAAkB;AAC/D;AAEA,SAAS,uCAAiB,KAAK;IAC7B,IAAI,OAAO,WAAW,aACpB,OAAO;IAET,IAAI,aAAa,UAAU,UAAU,MAAM;IAC3C,IAAI,MAAM,UAAU,UAAU,KAAK;IACnC,IAAI,iBAAiB,UAAU,UAAU,KAAK;IAC9C,OAAO,KAAK,KAAK,CAAC,AAAC,CAAA,OAAO,UAAU,GAAG,iBAAiB,CAAA,IAAM,CAAA,aAAa,GAAE;AAC/E;AAEO,SAAS,0CAAmB,GAA8B;IAC/D,IAAI,SAAS,CAAA,GAAA,aAAK,EAAsB;IACxC,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAO,CAAA;YAC9B,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;YACvB;gBACE,CAAA,GAAA,yBAAiB,EAAE,QAAQ,UAAU,CAAC;oBAAC,UAAU;gBAAI;YACvD;QACF,CAAA;IACA,OAAO;AACT;AAEO,SAAS,0CAAsB,KAA6F;QACpH;IAAb,IAAI,UAAS,aAAA,CAAA,GAAA,gBAAQ,iBAAR,iCAAA,WAAa,MAAM;IAChC,IAAI,cAAc,IAAI;IACtB,IAAI,eAAe,MAAM,gBAAgB,CAAC,QAAQ;QAAC,yBAAyB;IAAI,GAAG,MAAM,CAAC;IAC1F,IAAI,kBAAmB,aAAa,MAAM;IAE1C,+CAA+C;IAC/C,8EAA8E;IAC9E,mFAAmF;IACnF,iEAAiE;IACjE,OAAQ,kBAAkB,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,kBAAkB,IAAI;AACtE","sources":["packages/@react-spectrum/datepicker/src/utils.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 */\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateFormatter, useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {FocusableRef} from '@react-types/shared';\nimport {FormatterOptions} from '@react-stately/datepicker';\nimport React, {ReactNode, useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDisplayNames} from '@react-aria/datepicker';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider} from '@react-spectrum/provider';\n\nexport function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {\n let formatter = useDateFormatter({dateStyle: 'short'});\n let displayNames = useDisplayNames();\n return useMemo(() => {\n if (props.description) {\n return props.description;\n }\n\n if (props.showFormatHelpText) {\n return (\n formatter.formatToParts(new Date()).map((s, i) => {\n if (s.type === 'literal' || s.type === 'unknown' || (s.type as string) === 'yearName') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n let type = s.type as string === 'relatedYear' ? 'year' : s.type;\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(type)}</span>;\n })\n );\n }\n\n return '';\n }, [props.description, props.showFormatHelpText, formatter, displayNames]);\n}\n\nexport function useVisibleMonths(maxVisibleMonths: number): number {\n let {scale} = useProvider()!;\n let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));\n useLayoutEffect(() => {\n let onResize = () => setVisibleMonths(getVisibleMonths(scale));\n onResize();\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [scale]);\n\n return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));\n}\n\nfunction getVisibleMonths(scale) {\n if (typeof window === 'undefined') {\n return 1;\n }\n let monthWidth = scale === 'large' ? 336 : 280;\n let gap = scale === 'large' ? 30 : 24;\n let popoverPadding = scale === 'large' ? 32 : 48;\n return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));\n}\n\nexport function useFocusManagerRef(ref: FocusableRef<HTMLElement>): React.RefObject<HTMLElement | null> {\n let domRef = useRef<HTMLElement | null>(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n createFocusManager(domRef).focusFirst({tabbable: true});\n }\n }));\n return domRef;\n}\n\nexport function useFormattedDateWidth(state: {getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter}): number {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate);\n let totalCharacters = formatedDate.length;\n\n // The max of two is for times with only hours.\n // As the length of a date grows we need to proportionally increase the width.\n // We use the character count with 'ch' units and add extra padding to accomate for\n // dates with months and time dashes, which are wider characters.\n return (totalCharacters + Math.max(Math.floor(totalCharacters / 5), 2));\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/dist/zh-CN.main.js
DELETED
package/dist/zh-CN.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,gCAAI,CAAC;IACnC,aAAa,CAAC,gCAAI,CAAC;IACnB,QAAQ,CAAC,gBAAE,CAAC;AACd","sources":["packages/@react-spectrum/datepicker/intl/zh-CN.json"],"sourcesContent":["{\n \"endTime\": \"结束时间\",\n \"startTime\": \"开始时间\",\n \"time\": \"时间\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|
package/dist/zh-CN.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $08d7bccfda7015e7$exports = {};
|
|
2
|
-
$08d7bccfda7015e7$exports = {
|
|
3
|
-
"endTime": `\u{7ED3}\u{675F}\u{65F6}\u{95F4}`,
|
|
4
|
-
"startTime": `\u{5F00}\u{59CB}\u{65F6}\u{95F4}`,
|
|
5
|
-
"time": `\u{65F6}\u{95F4}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$08d7bccfda7015e7$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-CN.module.js.map
|
package/dist/zh-CN.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $08d7bccfda7015e7$exports = {};
|
|
2
|
-
$08d7bccfda7015e7$exports = {
|
|
3
|
-
"endTime": `\u{7ED3}\u{675F}\u{65F6}\u{95F4}`,
|
|
4
|
-
"startTime": `\u{5F00}\u{59CB}\u{65F6}\u{95F4}`,
|
|
5
|
-
"time": `\u{65F6}\u{95F4}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$08d7bccfda7015e7$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-CN.module.js.map
|
package/dist/zh-CN.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,gCAAI,CAAC;IACnC,aAAa,CAAC,gCAAI,CAAC;IACnB,QAAQ,CAAC,gBAAE,CAAC;AACd","sources":["packages/@react-spectrum/datepicker/intl/zh-CN.json"],"sourcesContent":["{\n \"endTime\": \"结束时间\",\n \"startTime\": \"开始时间\",\n \"time\": \"时间\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
|
package/dist/zh-TW.main.js
DELETED
package/dist/zh-TW.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,gCAAI,CAAC;IACnC,aAAa,CAAC,gCAAI,CAAC;IACnB,QAAQ,CAAC,gBAAE,CAAC;AACd","sources":["packages/@react-spectrum/datepicker/intl/zh-TW.json"],"sourcesContent":["{\n \"endTime\": \"結束時間\",\n \"startTime\": \"開始時間\",\n \"time\": \"時間\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
|
package/dist/zh-TW.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $c7c7bc6cc4226b9e$exports = {};
|
|
2
|
-
$c7c7bc6cc4226b9e$exports = {
|
|
3
|
-
"endTime": `\u{7D50}\u{675F}\u{6642}\u{9593}`,
|
|
4
|
-
"startTime": `\u{958B}\u{59CB}\u{6642}\u{9593}`,
|
|
5
|
-
"time": `\u{6642}\u{9593}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$c7c7bc6cc4226b9e$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-TW.module.js.map
|
package/dist/zh-TW.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $c7c7bc6cc4226b9e$exports = {};
|
|
2
|
-
$c7c7bc6cc4226b9e$exports = {
|
|
3
|
-
"endTime": `\u{7D50}\u{675F}\u{6642}\u{9593}`,
|
|
4
|
-
"startTime": `\u{958B}\u{59CB}\u{6642}\u{9593}`,
|
|
5
|
-
"time": `\u{6642}\u{9593}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$c7c7bc6cc4226b9e$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-TW.module.js.map
|
package/dist/zh-TW.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,gCAAI,CAAC;IACnC,aAAa,CAAC,gCAAI,CAAC;IACnB,QAAQ,CAAC,gBAAE,CAAC;AACd","sources":["packages/@react-spectrum/datepicker/intl/zh-TW.json"],"sourcesContent":["{\n \"endTime\": \"結束時間\",\n \"startTime\": \"開始時間\",\n \"time\": \"時間\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
|
package/src/DateField.tsx
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {classNames} from '@react-spectrum/utils';
|
|
14
|
-
import {createCalendar} from '@internationalized/date';
|
|
15
|
-
import {DatePickerSegment} from './DatePickerSegment';
|
|
16
|
-
import datepickerStyles from './styles.css';
|
|
17
|
-
import {DateValue, SpectrumDateFieldProps} from '@react-types/datepicker';
|
|
18
|
-
import {Field} from '@react-spectrum/label';
|
|
19
|
-
import {FocusableRef} from '@react-types/shared';
|
|
20
|
-
import {Input} from './Input';
|
|
21
|
-
import React, {ReactElement, useRef} from 'react';
|
|
22
|
-
import {useDateField} from '@react-aria/datepicker';
|
|
23
|
-
import {useDateFieldState} from '@react-stately/datepicker';
|
|
24
|
-
import {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth} from './utils';
|
|
25
|
-
import {useFormProps} from '@react-spectrum/form';
|
|
26
|
-
import {useLocale} from '@react-aria/i18n';
|
|
27
|
-
import {useProviderProps} from '@react-spectrum/provider';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* DateFields allow users to enter and edit date and time values using a keyboard.
|
|
31
|
-
* Each part of a date value is displayed in an individually editable segment.
|
|
32
|
-
*/
|
|
33
|
-
export const DateField = React.forwardRef(function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {
|
|
34
|
-
props = useProviderProps(props);
|
|
35
|
-
props = useFormProps(props);
|
|
36
|
-
let {
|
|
37
|
-
autoFocus,
|
|
38
|
-
isDisabled,
|
|
39
|
-
isReadOnly,
|
|
40
|
-
isRequired,
|
|
41
|
-
isQuiet
|
|
42
|
-
} = props;
|
|
43
|
-
|
|
44
|
-
let domRef = useFocusManagerRef(ref);
|
|
45
|
-
let {locale} = useLocale();
|
|
46
|
-
let state = useDateFieldState({
|
|
47
|
-
...props,
|
|
48
|
-
locale,
|
|
49
|
-
createCalendar
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
let fieldRef = useRef<HTMLElement | null>(null);
|
|
53
|
-
let inputRef = useRef<HTMLInputElement | null>(null);
|
|
54
|
-
let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({
|
|
55
|
-
...props,
|
|
56
|
-
inputRef
|
|
57
|
-
}, state, fieldRef);
|
|
58
|
-
|
|
59
|
-
// Note: this description is intentionally not passed to useDatePicker.
|
|
60
|
-
// The format help text is unnecessary for screen reader users because each segment already has a label.
|
|
61
|
-
let description = useFormatHelpText(props);
|
|
62
|
-
if (description && !props.description) {
|
|
63
|
-
descriptionProps.id = undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let validationState = state.validationState || (isInvalid ? 'invalid' : null);
|
|
67
|
-
|
|
68
|
-
let approximateWidth = useFormattedDateWidth(state) + 'ch';
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<Field
|
|
72
|
-
{...props}
|
|
73
|
-
ref={domRef}
|
|
74
|
-
elementType="span"
|
|
75
|
-
description={description}
|
|
76
|
-
labelProps={labelProps}
|
|
77
|
-
descriptionProps={descriptionProps}
|
|
78
|
-
errorMessageProps={errorMessageProps}
|
|
79
|
-
validationState={validationState ?? undefined}
|
|
80
|
-
isInvalid={isInvalid}
|
|
81
|
-
validationErrors={validationErrors}
|
|
82
|
-
validationDetails={validationDetails}
|
|
83
|
-
wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>
|
|
84
|
-
<Input
|
|
85
|
-
ref={fieldRef}
|
|
86
|
-
fieldProps={fieldProps}
|
|
87
|
-
isDisabled={isDisabled}
|
|
88
|
-
isQuiet={isQuiet}
|
|
89
|
-
autoFocus={autoFocus}
|
|
90
|
-
validationState={validationState}
|
|
91
|
-
minWidth={approximateWidth}
|
|
92
|
-
className={classNames(datepickerStyles, 'react-spectrum-DateField')}>
|
|
93
|
-
{state.segments.map((segment, i) =>
|
|
94
|
-
(<DatePickerSegment
|
|
95
|
-
key={i}
|
|
96
|
-
segment={segment}
|
|
97
|
-
state={state}
|
|
98
|
-
isDisabled={isDisabled}
|
|
99
|
-
isReadOnly={isReadOnly}
|
|
100
|
-
isRequired={isRequired} />)
|
|
101
|
-
)}
|
|
102
|
-
<input {...inputProps} ref={inputRef} />
|
|
103
|
-
</Input>
|
|
104
|
-
</Field>
|
|
105
|
-
);
|
|
106
|
-
}) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
|