@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.
Files changed (108) hide show
  1. package/dist/DateField.main.js +110 -0
  2. package/dist/DateField.main.js.map +1 -0
  3. package/dist/DateField.mjs +105 -0
  4. package/dist/DateField.module.js +105 -0
  5. package/dist/DateField.module.js.map +1 -0
  6. package/dist/DatePicker.main.js +198 -0
  7. package/dist/DatePicker.main.js.map +1 -0
  8. package/dist/DatePicker.mjs +193 -0
  9. package/dist/DatePicker.module.js +193 -0
  10. package/dist/DatePicker.module.js.map +1 -0
  11. package/dist/DatePickerField.main.js +72 -0
  12. package/dist/DatePickerField.main.js.map +1 -0
  13. package/dist/DatePickerField.mjs +67 -0
  14. package/dist/DatePickerField.module.js +67 -0
  15. package/dist/DatePickerField.module.js.map +1 -0
  16. package/dist/DatePickerSegment.main.js +76 -0
  17. package/dist/DatePickerSegment.main.js.map +1 -0
  18. package/dist/DatePickerSegment.mjs +71 -0
  19. package/dist/DatePickerSegment.module.js +71 -0
  20. package/dist/DatePickerSegment.module.js.map +1 -0
  21. package/dist/DateRangePicker.main.js +225 -0
  22. package/dist/DateRangePicker.main.js.map +1 -0
  23. package/dist/DateRangePicker.mjs +220 -0
  24. package/dist/DateRangePicker.module.js +220 -0
  25. package/dist/DateRangePicker.module.js.map +1 -0
  26. package/dist/Input.main.js +123 -0
  27. package/dist/Input.main.js.map +1 -0
  28. package/dist/Input.mjs +118 -0
  29. package/dist/Input.module.js +118 -0
  30. package/dist/Input.module.js.map +1 -0
  31. package/dist/TimeField.main.js +102 -0
  32. package/dist/TimeField.main.js.map +1 -0
  33. package/dist/TimeField.mjs +97 -0
  34. package/dist/TimeField.module.js +97 -0
  35. package/dist/TimeField.module.js.map +1 -0
  36. package/dist/ar-AE.mjs +1 -1
  37. package/dist/bg-BG.mjs +1 -1
  38. package/dist/cs-CZ.mjs +1 -1
  39. package/dist/da-DK.mjs +1 -1
  40. package/dist/de-DE.mjs +1 -1
  41. package/dist/el-GR.mjs +1 -1
  42. package/dist/en-US.mjs +1 -1
  43. package/dist/es-ES.mjs +1 -1
  44. package/dist/et-EE.mjs +1 -1
  45. package/dist/fi-FI.mjs +1 -1
  46. package/dist/fr-FR.mjs +1 -1
  47. package/dist/he-IL.mjs +1 -1
  48. package/dist/hr-HR.mjs +1 -1
  49. package/dist/hu-HU.mjs +1 -1
  50. package/dist/import.mjs +4 -1136
  51. package/dist/inputgroup_vars_css.main.js +86 -0
  52. package/dist/inputgroup_vars_css.main.js.map +1 -0
  53. package/dist/inputgroup_vars_css.mjs +88 -0
  54. package/dist/inputgroup_vars_css.module.js +88 -0
  55. package/dist/inputgroup_vars_css.module.js.map +1 -0
  56. package/dist/intlStrings.main.js +108 -0
  57. package/dist/intlStrings.main.js.map +1 -0
  58. package/dist/intlStrings.mjs +110 -0
  59. package/dist/intlStrings.module.js +110 -0
  60. package/dist/intlStrings.module.js.map +1 -0
  61. package/dist/it-IT.mjs +1 -1
  62. package/dist/ja-JP.mjs +1 -1
  63. package/dist/ko-KR.mjs +1 -1
  64. package/dist/lt-LT.mjs +1 -1
  65. package/dist/lv-LV.mjs +1 -1
  66. package/dist/main.js +8 -1136
  67. package/dist/main.js.map +1 -1
  68. package/dist/module.js +4 -1136
  69. package/dist/module.js.map +1 -1
  70. package/dist/nb-NO.mjs +1 -1
  71. package/dist/nl-NL.mjs +1 -1
  72. package/dist/pl-PL.mjs +1 -1
  73. package/dist/pt-BR.mjs +1 -1
  74. package/dist/pt-PT.mjs +1 -1
  75. package/dist/ro-RO.mjs +1 -1
  76. package/dist/ru-RU.mjs +1 -1
  77. package/dist/sk-SK.mjs +1 -1
  78. package/dist/sl-SI.mjs +1 -1
  79. package/dist/sr-SP.mjs +1 -1
  80. package/dist/styles.36ea4632.css +209 -0
  81. package/dist/styles.36ea4632.css.map +1 -0
  82. package/dist/styles_css.main.js +74 -0
  83. package/dist/styles_css.main.js.map +1 -0
  84. package/dist/styles_css.mjs +76 -0
  85. package/dist/styles_css.module.js +76 -0
  86. package/dist/styles_css.module.js.map +1 -0
  87. package/dist/sv-SE.mjs +1 -1
  88. package/dist/textfield_vars_css.main.js +74 -0
  89. package/dist/textfield_vars_css.main.js.map +1 -0
  90. package/dist/textfield_vars_css.mjs +76 -0
  91. package/dist/textfield_vars_css.module.js +76 -0
  92. package/dist/textfield_vars_css.module.js.map +1 -0
  93. package/dist/tr-TR.mjs +1 -1
  94. package/dist/uk-UA.mjs +1 -1
  95. package/dist/utils.main.js +89 -0
  96. package/dist/utils.main.js.map +1 -0
  97. package/dist/utils.mjs +82 -0
  98. package/dist/utils.module.js +82 -0
  99. package/dist/utils.module.js.map +1 -0
  100. package/dist/vars.3692148b.css +549 -0
  101. package/dist/vars.3692148b.css.map +1 -0
  102. package/dist/vars.ccbd2e3f.css +649 -0
  103. package/dist/vars.ccbd2e3f.css.map +1 -0
  104. package/dist/zh-CN.mjs +1 -1
  105. package/dist/zh-TW.mjs +1 -1
  106. package/package.json +22 -22
  107. package/dist/main.css +0 -1626
  108. package/dist/main.css.map +0 -1
package/dist/utils.mjs ADDED
@@ -0,0 +1,82 @@
1
+ import {createDOMRef as $d7JPl$createDOMRef} from "@react-spectrum/utils";
2
+ import {createFocusManager as $d7JPl$createFocusManager} from "@react-aria/focus";
3
+ import {useDateFormatter as $d7JPl$useDateFormatter} from "@react-aria/i18n";
4
+ import {useDisplayNames as $d7JPl$useDisplayNames} from "@react-aria/datepicker";
5
+ import {useMemo as $d7JPl$useMemo, useState as $d7JPl$useState, useRef as $d7JPl$useRef, useImperativeHandle as $d7JPl$useImperativeHandle} from "react";
6
+ import {useLayoutEffect as $d7JPl$useLayoutEffect} from "@react-aria/utils";
7
+ import {useProvider as $d7JPl$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 $04e96200274b03de$export$322f4580ccd8dde6(props) {
27
+ let formatter = (0, $d7JPl$useDateFormatter)({
28
+ dateStyle: "short"
29
+ });
30
+ let displayNames = (0, $d7JPl$useDisplayNames)();
31
+ return (0, $d7JPl$useMemo)(()=>{
32
+ if (props.description) return props.description;
33
+ if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s)=>{
34
+ if (s.type === "literal") return s.value;
35
+ return displayNames.of(s.type);
36
+ }).join(" ");
37
+ return "";
38
+ }, [
39
+ props.description,
40
+ props.showFormatHelpText,
41
+ formatter,
42
+ displayNames
43
+ ]);
44
+ }
45
+ function $04e96200274b03de$export$12ce2869ce471b1f(maxVisibleMonths) {
46
+ let { scale: scale } = (0, $d7JPl$useProvider)();
47
+ let [visibleMonths, setVisibleMonths] = (0, $d7JPl$useState)($04e96200274b03de$var$getVisibleMonths(scale));
48
+ (0, $d7JPl$useLayoutEffect)(()=>{
49
+ let onResize = ()=>setVisibleMonths($04e96200274b03de$var$getVisibleMonths(scale));
50
+ onResize();
51
+ window.addEventListener("resize", onResize);
52
+ return ()=>{
53
+ window.removeEventListener("resize", onResize);
54
+ };
55
+ }, [
56
+ scale
57
+ ]);
58
+ return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
59
+ }
60
+ function $04e96200274b03de$var$getVisibleMonths(scale) {
61
+ if (typeof window === "undefined") return 1;
62
+ let monthWidth = scale === "large" ? 336 : 280;
63
+ let gap = scale === "large" ? 30 : 24;
64
+ let popoverPadding = scale === "large" ? 32 : 48;
65
+ return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
66
+ }
67
+ function $04e96200274b03de$export$71a23a36270e4bf0(ref) {
68
+ let domRef = (0, $d7JPl$useRef)();
69
+ (0, $d7JPl$useImperativeHandle)(ref, ()=>({
70
+ ...(0, $d7JPl$createDOMRef)(domRef),
71
+ focus () {
72
+ (0, $d7JPl$createFocusManager)(domRef).focusFirst({
73
+ tabbable: true
74
+ });
75
+ }
76
+ }));
77
+ return domRef;
78
+ }
79
+
80
+
81
+ export {$04e96200274b03de$export$322f4580ccd8dde6 as useFormatHelpText, $04e96200274b03de$export$12ce2869ce471b1f as useVisibleMonths, $04e96200274b03de$export$71a23a36270e4bf0 as useFocusManagerRef};
82
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1,82 @@
1
+ import {createDOMRef as $d7JPl$createDOMRef} from "@react-spectrum/utils";
2
+ import {createFocusManager as $d7JPl$createFocusManager} from "@react-aria/focus";
3
+ import {useDateFormatter as $d7JPl$useDateFormatter} from "@react-aria/i18n";
4
+ import {useDisplayNames as $d7JPl$useDisplayNames} from "@react-aria/datepicker";
5
+ import {useMemo as $d7JPl$useMemo, useState as $d7JPl$useState, useRef as $d7JPl$useRef, useImperativeHandle as $d7JPl$useImperativeHandle} from "react";
6
+ import {useLayoutEffect as $d7JPl$useLayoutEffect} from "@react-aria/utils";
7
+ import {useProvider as $d7JPl$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 $04e96200274b03de$export$322f4580ccd8dde6(props) {
27
+ let formatter = (0, $d7JPl$useDateFormatter)({
28
+ dateStyle: "short"
29
+ });
30
+ let displayNames = (0, $d7JPl$useDisplayNames)();
31
+ return (0, $d7JPl$useMemo)(()=>{
32
+ if (props.description) return props.description;
33
+ if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s)=>{
34
+ if (s.type === "literal") return s.value;
35
+ return displayNames.of(s.type);
36
+ }).join(" ");
37
+ return "";
38
+ }, [
39
+ props.description,
40
+ props.showFormatHelpText,
41
+ formatter,
42
+ displayNames
43
+ ]);
44
+ }
45
+ function $04e96200274b03de$export$12ce2869ce471b1f(maxVisibleMonths) {
46
+ let { scale: scale } = (0, $d7JPl$useProvider)();
47
+ let [visibleMonths, setVisibleMonths] = (0, $d7JPl$useState)($04e96200274b03de$var$getVisibleMonths(scale));
48
+ (0, $d7JPl$useLayoutEffect)(()=>{
49
+ let onResize = ()=>setVisibleMonths($04e96200274b03de$var$getVisibleMonths(scale));
50
+ onResize();
51
+ window.addEventListener("resize", onResize);
52
+ return ()=>{
53
+ window.removeEventListener("resize", onResize);
54
+ };
55
+ }, [
56
+ scale
57
+ ]);
58
+ return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
59
+ }
60
+ function $04e96200274b03de$var$getVisibleMonths(scale) {
61
+ if (typeof window === "undefined") return 1;
62
+ let monthWidth = scale === "large" ? 336 : 280;
63
+ let gap = scale === "large" ? 30 : 24;
64
+ let popoverPadding = scale === "large" ? 32 : 48;
65
+ return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
66
+ }
67
+ function $04e96200274b03de$export$71a23a36270e4bf0(ref) {
68
+ let domRef = (0, $d7JPl$useRef)();
69
+ (0, $d7JPl$useImperativeHandle)(ref, ()=>({
70
+ ...(0, $d7JPl$createDOMRef)(domRef),
71
+ focus () {
72
+ (0, $d7JPl$createFocusManager)(domRef).focusFirst({
73
+ tabbable: true
74
+ });
75
+ }
76
+ }));
77
+ return domRef;
78
+ }
79
+
80
+
81
+ export {$04e96200274b03de$export$322f4580ccd8dde6 as useFormatHelpText, $04e96200274b03de$export$12ce2869ce471b1f as useVisibleMonths, $04e96200274b03de$export$71a23a36270e4bf0 as useFocusManagerRef};
82
+ //# sourceMappingURL=utils.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWM,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,OAAO,UAAU,aAAa,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAA;YAC7C,IAAI,EAAE,IAAI,KAAK,WACb,OAAO,EAAE,KAAK;YAGhB,OAAO,aAAa,EAAE,CAAC,EAAE,IAAI;QAC/B,GAAG,IAAI,CAAC;QAGV,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;IAClB,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","sources":["packages/@react-spectrum/datepicker/src/utils.ts"],"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 {FocusableRef} from '@react-types/shared';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDateFormatter} from '@react-aria/i18n';\nimport {useDisplayNames} from '@react-aria/datepicker';\nimport {useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider} from '@react-spectrum/provider';\n\nexport function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>) {\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 formatter.formatToParts(new Date()).map(s => {\n if (s.type === 'literal') {\n return s.value;\n }\n\n return displayNames.of(s.type);\n }).join(' ');\n }\n\n return '';\n }, [props.description, props.showFormatHelpText, formatter, displayNames]);\n}\n\nexport function useVisibleMonths(maxVisibleMonths: 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>) {\n let domRef = useRef();\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n createFocusManager(domRef).focusFirst({tabbable: true});\n }\n }));\n return domRef;\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}