@react-spectrum/datepicker 3.11.0 → 3.13.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.
Files changed (66) hide show
  1. package/dist/DateField.main.js +7 -11
  2. package/dist/DateField.main.js.map +1 -1
  3. package/dist/DateField.mjs +7 -11
  4. package/dist/DateField.module.js +7 -11
  5. package/dist/DateField.module.js.map +1 -1
  6. package/dist/DatePicker.main.js +12 -14
  7. package/dist/DatePicker.main.js.map +1 -1
  8. package/dist/DatePicker.mjs +12 -14
  9. package/dist/DatePicker.module.js +12 -14
  10. package/dist/DatePicker.module.js.map +1 -1
  11. package/dist/DatePickerField.main.js +2 -2
  12. package/dist/DatePickerField.main.js.map +1 -1
  13. package/dist/DatePickerField.mjs +2 -2
  14. package/dist/DatePickerField.module.js +2 -2
  15. package/dist/DatePickerField.module.js.map +1 -1
  16. package/dist/DatePickerSegment.main.js +2 -2
  17. package/dist/DatePickerSegment.main.js.map +1 -1
  18. package/dist/DatePickerSegment.mjs +2 -2
  19. package/dist/DatePickerSegment.module.js +2 -2
  20. package/dist/DatePickerSegment.module.js.map +1 -1
  21. package/dist/DateRangePicker.main.js +18 -16
  22. package/dist/DateRangePicker.main.js.map +1 -1
  23. package/dist/DateRangePicker.mjs +18 -16
  24. package/dist/DateRangePicker.module.js +18 -16
  25. package/dist/DateRangePicker.module.js.map +1 -1
  26. package/dist/Input.main.js +4 -5
  27. package/dist/Input.main.js.map +1 -1
  28. package/dist/Input.mjs +4 -5
  29. package/dist/Input.module.js +4 -5
  30. package/dist/Input.module.js.map +1 -1
  31. package/dist/TimeField.main.js +6 -10
  32. package/dist/TimeField.main.js.map +1 -1
  33. package/dist/TimeField.mjs +6 -10
  34. package/dist/TimeField.module.js +6 -10
  35. package/dist/TimeField.module.js.map +1 -1
  36. package/dist/inputgroup_vars_css.main.js +26 -26
  37. package/dist/inputgroup_vars_css.mjs +26 -26
  38. package/dist/inputgroup_vars_css.module.js +26 -26
  39. package/dist/{styles.4bf108e6.css → styles.cec10db3.css} +47 -48
  40. package/dist/styles.cec10db3.css.map +1 -0
  41. package/dist/styles_css.main.js +23 -23
  42. package/dist/styles_css.main.js.map +1 -1
  43. package/dist/styles_css.mjs +23 -23
  44. package/dist/styles_css.module.js +23 -23
  45. package/dist/styles_css.module.js.map +1 -1
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/utils.main.js +44 -32
  48. package/dist/utils.main.js.map +1 -1
  49. package/dist/utils.mjs +37 -29
  50. package/dist/utils.module.js +37 -29
  51. package/dist/utils.module.js.map +1 -1
  52. package/dist/{vars.61240e3b.css → vars.ba84240a.css} +3 -3
  53. package/dist/{vars.61240e3b.css.map → vars.ba84240a.css.map} +1 -1
  54. package/dist/{vars.6aae6db6.css → vars.fb8d1a6e.css} +133 -133
  55. package/dist/{vars.6aae6db6.css.map → vars.fb8d1a6e.css.map} +1 -1
  56. package/package.json +21 -21
  57. package/src/DateField.tsx +6 -9
  58. package/src/DatePicker.tsx +8 -9
  59. package/src/DatePickerField.tsx +2 -2
  60. package/src/DatePickerSegment.tsx +2 -2
  61. package/src/DateRangePicker.tsx +39 -38
  62. package/src/Input.tsx +2 -5
  63. package/src/TimeField.tsx +6 -9
  64. package/src/styles.css +3 -4
  65. package/src/{utils.ts → utils.tsx} +9 -7
  66. package/dist/styles.4bf108e6.css.map +0 -1
@@ -1,20 +1,24 @@
1
- var $61dVa$reactspectrumutils = require("@react-spectrum/utils");
2
- var $61dVa$reactariafocus = require("@react-aria/focus");
3
- var $61dVa$reactariai18n = require("@react-aria/i18n");
4
- var $61dVa$reactariadatepicker = require("@react-aria/datepicker");
5
- var $61dVa$react = require("react");
6
- var $61dVa$reactariautils = require("@react-aria/utils");
7
- var $61dVa$reactspectrumprovider = require("@react-spectrum/provider");
1
+ var $6Arg9$reactspectrumutils = require("@react-spectrum/utils");
2
+ var $6Arg9$reactariafocus = require("@react-aria/focus");
3
+ var $6Arg9$react = require("react");
4
+ var $6Arg9$reactariai18n = require("@react-aria/i18n");
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
8
 
9
9
 
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+
10
14
  function $parcel$export(e, n, v, s) {
11
15
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
16
  }
13
17
 
14
- $parcel$export(module.exports, "useFormatHelpText", () => $4d2e419f522adb48$export$322f4580ccd8dde6);
15
- $parcel$export(module.exports, "useVisibleMonths", () => $4d2e419f522adb48$export$12ce2869ce471b1f);
16
- $parcel$export(module.exports, "useFocusManagerRef", () => $4d2e419f522adb48$export$71a23a36270e4bf0);
17
- $parcel$export(module.exports, "useFormattedDateWidth", () => $4d2e419f522adb48$export$31e22e3c931fc056);
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);
18
22
  /*
19
23
  * Copyright 2020 Adobe. All rights reserved.
20
24
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -32,17 +36,25 @@ $parcel$export(module.exports, "useFormattedDateWidth", () => $4d2e419f522adb48$
32
36
 
33
37
 
34
38
 
35
- function $4d2e419f522adb48$export$322f4580ccd8dde6(props) {
36
- let formatter = (0, $61dVa$reactariai18n.useDateFormatter)({
39
+ function $9d3b96715dbbb2b7$export$322f4580ccd8dde6(props) {
40
+ let formatter = (0, $6Arg9$reactariai18n.useDateFormatter)({
37
41
  dateStyle: 'short'
38
42
  });
39
- let displayNames = (0, $61dVa$reactariadatepicker.useDisplayNames)();
40
- return (0, $61dVa$react.useMemo)(()=>{
43
+ let displayNames = (0, $6Arg9$reactariadatepicker.useDisplayNames)();
44
+ return (0, $6Arg9$react.useMemo)(()=>{
41
45
  if (props.description) return props.description;
42
- if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s)=>{
43
- if (s.type === 'literal') return s.value;
44
- return displayNames.of(s.type);
45
- }).join(' ');
46
+ if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
47
+ if (s.type === 'literal') return /*#__PURE__*/ (0, ($parcel$interopDefault($6Arg9$react))).createElement("span", {
48
+ key: i
49
+ }, ` ${s.value} `);
50
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Arg9$react))).createElement("span", {
51
+ key: i,
52
+ style: {
53
+ unicodeBidi: 'embed',
54
+ direction: 'ltr'
55
+ }
56
+ }, displayNames.of(s.type));
57
+ });
46
58
  return '';
47
59
  }, [
48
60
  props.description,
@@ -51,11 +63,11 @@ function $4d2e419f522adb48$export$322f4580ccd8dde6(props) {
51
63
  displayNames
52
64
  ]);
53
65
  }
54
- function $4d2e419f522adb48$export$12ce2869ce471b1f(maxVisibleMonths) {
55
- let { scale: scale } = (0, $61dVa$reactspectrumprovider.useProvider)();
56
- let [visibleMonths, setVisibleMonths] = (0, $61dVa$react.useState)($4d2e419f522adb48$var$getVisibleMonths(scale));
57
- (0, $61dVa$reactariautils.useLayoutEffect)(()=>{
58
- let onResize = ()=>setVisibleMonths($4d2e419f522adb48$var$getVisibleMonths(scale));
66
+ function $9d3b96715dbbb2b7$export$12ce2869ce471b1f(maxVisibleMonths) {
67
+ let { scale: scale } = (0, $6Arg9$reactspectrumprovider.useProvider)();
68
+ let [visibleMonths, setVisibleMonths] = (0, $6Arg9$react.useState)($9d3b96715dbbb2b7$var$getVisibleMonths(scale));
69
+ (0, $6Arg9$reactariautils.useLayoutEffect)(()=>{
70
+ let onResize = ()=>setVisibleMonths($9d3b96715dbbb2b7$var$getVisibleMonths(scale));
59
71
  onResize();
60
72
  window.addEventListener('resize', onResize);
61
73
  return ()=>{
@@ -66,28 +78,28 @@ function $4d2e419f522adb48$export$12ce2869ce471b1f(maxVisibleMonths) {
66
78
  ]);
67
79
  return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
68
80
  }
69
- function $4d2e419f522adb48$var$getVisibleMonths(scale) {
81
+ function $9d3b96715dbbb2b7$var$getVisibleMonths(scale) {
70
82
  if (typeof window === 'undefined') return 1;
71
83
  let monthWidth = scale === 'large' ? 336 : 280;
72
84
  let gap = scale === 'large' ? 30 : 24;
73
85
  let popoverPadding = scale === 'large' ? 32 : 48;
74
86
  return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
75
87
  }
76
- function $4d2e419f522adb48$export$71a23a36270e4bf0(ref) {
77
- let domRef = (0, $61dVa$react.useRef)(null);
78
- (0, $61dVa$react.useImperativeHandle)(ref, ()=>({
79
- ...(0, $61dVa$reactspectrumutils.createDOMRef)(domRef),
88
+ function $9d3b96715dbbb2b7$export$71a23a36270e4bf0(ref) {
89
+ let domRef = (0, $6Arg9$react.useRef)(null);
90
+ (0, $6Arg9$react.useImperativeHandle)(ref, ()=>({
91
+ ...(0, $6Arg9$reactspectrumutils.createDOMRef)(domRef),
80
92
  focus () {
81
- (0, $61dVa$reactariafocus.createFocusManager)(domRef).focusFirst({
93
+ (0, $6Arg9$reactariafocus.createFocusManager)(domRef).focusFirst({
82
94
  tabbable: true
83
95
  });
84
96
  }
85
97
  }));
86
98
  return domRef;
87
99
  }
88
- function $4d2e419f522adb48$export$31e22e3c931fc056(state) {
100
+ function $9d3b96715dbbb2b7$export$31e22e3c931fc056(state) {
89
101
  var _useLocale;
90
- let locale = (_useLocale = (0, $61dVa$reactariai18n.useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
102
+ let locale = (_useLocale = (0, $6Arg9$reactariai18n.useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
91
103
  let currentDate = new Date();
92
104
  let formatedDate = state.getDateFormatter(locale, {
93
105
  shouldForceLeadingZeros: true
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWM,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,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,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,KAAK;QAC5B;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,aAAa;IACvG,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.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, useLocale} 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<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) {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate, locale);\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"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWM,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,WACb,qBAAO,0DAAC;gBAAK,KAAK;eAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YAGtC,qBAAO,0DAAC;gBAAK,KAAK;gBAAG,OAAO;oBAAC,aAAa;oBAAS,WAAW;gBAAK;eAAI,aAAa,EAAE,CAAC,EAAE,IAAI;QAC/F;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,KAAK;QAC5B;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,aAAa;IACvG,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 {FocusableRef} from '@react-types/shared';\nimport React, {useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\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'>) {\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') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(s.type)}</span>;\n })\n );\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<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) {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate, locale);\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 CHANGED
@@ -1,10 +1,10 @@
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, useLocale as $d7JPl$useLocale} 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";
1
+ import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
2
+ import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
3
+ import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
4
+ import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
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
8
 
9
9
  /*
10
10
  * Copyright 2020 Adobe. All rights reserved.
@@ -23,17 +23,25 @@ import {useProvider as $d7JPl$useProvider} from "@react-spectrum/provider";
23
23
 
24
24
 
25
25
 
26
- function $04e96200274b03de$export$322f4580ccd8dde6(props) {
27
- let formatter = (0, $d7JPl$useDateFormatter)({
26
+ function $ea94a5cfe92db3c2$export$322f4580ccd8dde6(props) {
27
+ let formatter = (0, $kDnTZ$useDateFormatter)({
28
28
  dateStyle: 'short'
29
29
  });
30
- let displayNames = (0, $d7JPl$useDisplayNames)();
31
- return (0, $d7JPl$useMemo)(()=>{
30
+ let displayNames = (0, $kDnTZ$useDisplayNames)();
31
+ return (0, $kDnTZ$useMemo)(()=>{
32
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(' ');
33
+ if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
34
+ if (s.type === 'literal') return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
35
+ key: i
36
+ }, ` ${s.value} `);
37
+ return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
38
+ key: i,
39
+ style: {
40
+ unicodeBidi: 'embed',
41
+ direction: 'ltr'
42
+ }
43
+ }, displayNames.of(s.type));
44
+ });
37
45
  return '';
38
46
  }, [
39
47
  props.description,
@@ -42,11 +50,11 @@ function $04e96200274b03de$export$322f4580ccd8dde6(props) {
42
50
  displayNames
43
51
  ]);
44
52
  }
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));
53
+ function $ea94a5cfe92db3c2$export$12ce2869ce471b1f(maxVisibleMonths) {
54
+ let { scale: scale } = (0, $kDnTZ$useProvider)();
55
+ let [visibleMonths, setVisibleMonths] = (0, $kDnTZ$useState)($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
56
+ (0, $kDnTZ$useLayoutEffect)(()=>{
57
+ let onResize = ()=>setVisibleMonths($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
50
58
  onResize();
51
59
  window.addEventListener('resize', onResize);
52
60
  return ()=>{
@@ -57,28 +65,28 @@ function $04e96200274b03de$export$12ce2869ce471b1f(maxVisibleMonths) {
57
65
  ]);
58
66
  return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
59
67
  }
60
- function $04e96200274b03de$var$getVisibleMonths(scale) {
68
+ function $ea94a5cfe92db3c2$var$getVisibleMonths(scale) {
61
69
  if (typeof window === 'undefined') return 1;
62
70
  let monthWidth = scale === 'large' ? 336 : 280;
63
71
  let gap = scale === 'large' ? 30 : 24;
64
72
  let popoverPadding = scale === 'large' ? 32 : 48;
65
73
  return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
66
74
  }
67
- function $04e96200274b03de$export$71a23a36270e4bf0(ref) {
68
- let domRef = (0, $d7JPl$useRef)(null);
69
- (0, $d7JPl$useImperativeHandle)(ref, ()=>({
70
- ...(0, $d7JPl$createDOMRef)(domRef),
75
+ function $ea94a5cfe92db3c2$export$71a23a36270e4bf0(ref) {
76
+ let domRef = (0, $kDnTZ$useRef)(null);
77
+ (0, $kDnTZ$useImperativeHandle)(ref, ()=>({
78
+ ...(0, $kDnTZ$createDOMRef)(domRef),
71
79
  focus () {
72
- (0, $d7JPl$createFocusManager)(domRef).focusFirst({
80
+ (0, $kDnTZ$createFocusManager)(domRef).focusFirst({
73
81
  tabbable: true
74
82
  });
75
83
  }
76
84
  }));
77
85
  return domRef;
78
86
  }
79
- function $04e96200274b03de$export$31e22e3c931fc056(state) {
87
+ function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
80
88
  var _useLocale;
81
- let locale = (_useLocale = (0, $d7JPl$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
89
+ let locale = (_useLocale = (0, $kDnTZ$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
82
90
  let currentDate = new Date();
83
91
  let formatedDate = state.getDateFormatter(locale, {
84
92
  shouldForceLeadingZeros: true
@@ -92,5 +100,5 @@ function $04e96200274b03de$export$31e22e3c931fc056(state) {
92
100
  }
93
101
 
94
102
 
95
- export {$04e96200274b03de$export$322f4580ccd8dde6 as useFormatHelpText, $04e96200274b03de$export$12ce2869ce471b1f as useVisibleMonths, $04e96200274b03de$export$71a23a36270e4bf0 as useFocusManagerRef, $04e96200274b03de$export$31e22e3c931fc056 as useFormattedDateWidth};
103
+ export {$ea94a5cfe92db3c2$export$322f4580ccd8dde6 as useFormatHelpText, $ea94a5cfe92db3c2$export$12ce2869ce471b1f as useVisibleMonths, $ea94a5cfe92db3c2$export$71a23a36270e4bf0 as useFocusManagerRef, $ea94a5cfe92db3c2$export$31e22e3c931fc056 as useFormattedDateWidth};
96
104
  //# sourceMappingURL=utils.module.js.map
@@ -1,10 +1,10 @@
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, useLocale as $d7JPl$useLocale} 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";
1
+ import {createDOMRef as $kDnTZ$createDOMRef} from "@react-spectrum/utils";
2
+ import {createFocusManager as $kDnTZ$createFocusManager} from "@react-aria/focus";
3
+ import $kDnTZ$react, {useMemo as $kDnTZ$useMemo, useState as $kDnTZ$useState, useRef as $kDnTZ$useRef, useImperativeHandle as $kDnTZ$useImperativeHandle} from "react";
4
+ import {useDateFormatter as $kDnTZ$useDateFormatter, useLocale as $kDnTZ$useLocale} from "@react-aria/i18n";
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
8
 
9
9
  /*
10
10
  * Copyright 2020 Adobe. All rights reserved.
@@ -23,17 +23,25 @@ import {useProvider as $d7JPl$useProvider} from "@react-spectrum/provider";
23
23
 
24
24
 
25
25
 
26
- function $04e96200274b03de$export$322f4580ccd8dde6(props) {
27
- let formatter = (0, $d7JPl$useDateFormatter)({
26
+ function $ea94a5cfe92db3c2$export$322f4580ccd8dde6(props) {
27
+ let formatter = (0, $kDnTZ$useDateFormatter)({
28
28
  dateStyle: 'short'
29
29
  });
30
- let displayNames = (0, $d7JPl$useDisplayNames)();
31
- return (0, $d7JPl$useMemo)(()=>{
30
+ let displayNames = (0, $kDnTZ$useDisplayNames)();
31
+ return (0, $kDnTZ$useMemo)(()=>{
32
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(' ');
33
+ if (props.showFormatHelpText) return formatter.formatToParts(new Date()).map((s, i)=>{
34
+ if (s.type === 'literal') return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
35
+ key: i
36
+ }, ` ${s.value} `);
37
+ return /*#__PURE__*/ (0, $kDnTZ$react).createElement("span", {
38
+ key: i,
39
+ style: {
40
+ unicodeBidi: 'embed',
41
+ direction: 'ltr'
42
+ }
43
+ }, displayNames.of(s.type));
44
+ });
37
45
  return '';
38
46
  }, [
39
47
  props.description,
@@ -42,11 +50,11 @@ function $04e96200274b03de$export$322f4580ccd8dde6(props) {
42
50
  displayNames
43
51
  ]);
44
52
  }
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));
53
+ function $ea94a5cfe92db3c2$export$12ce2869ce471b1f(maxVisibleMonths) {
54
+ let { scale: scale } = (0, $kDnTZ$useProvider)();
55
+ let [visibleMonths, setVisibleMonths] = (0, $kDnTZ$useState)($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
56
+ (0, $kDnTZ$useLayoutEffect)(()=>{
57
+ let onResize = ()=>setVisibleMonths($ea94a5cfe92db3c2$var$getVisibleMonths(scale));
50
58
  onResize();
51
59
  window.addEventListener('resize', onResize);
52
60
  return ()=>{
@@ -57,28 +65,28 @@ function $04e96200274b03de$export$12ce2869ce471b1f(maxVisibleMonths) {
57
65
  ]);
58
66
  return Math.max(1, Math.min(visibleMonths, maxVisibleMonths, 3));
59
67
  }
60
- function $04e96200274b03de$var$getVisibleMonths(scale) {
68
+ function $ea94a5cfe92db3c2$var$getVisibleMonths(scale) {
61
69
  if (typeof window === 'undefined') return 1;
62
70
  let monthWidth = scale === 'large' ? 336 : 280;
63
71
  let gap = scale === 'large' ? 30 : 24;
64
72
  let popoverPadding = scale === 'large' ? 32 : 48;
65
73
  return Math.floor((window.innerWidth - popoverPadding * 2) / (monthWidth + gap));
66
74
  }
67
- function $04e96200274b03de$export$71a23a36270e4bf0(ref) {
68
- let domRef = (0, $d7JPl$useRef)(null);
69
- (0, $d7JPl$useImperativeHandle)(ref, ()=>({
70
- ...(0, $d7JPl$createDOMRef)(domRef),
75
+ function $ea94a5cfe92db3c2$export$71a23a36270e4bf0(ref) {
76
+ let domRef = (0, $kDnTZ$useRef)(null);
77
+ (0, $kDnTZ$useImperativeHandle)(ref, ()=>({
78
+ ...(0, $kDnTZ$createDOMRef)(domRef),
71
79
  focus () {
72
- (0, $d7JPl$createFocusManager)(domRef).focusFirst({
80
+ (0, $kDnTZ$createFocusManager)(domRef).focusFirst({
73
81
  tabbable: true
74
82
  });
75
83
  }
76
84
  }));
77
85
  return domRef;
78
86
  }
79
- function $04e96200274b03de$export$31e22e3c931fc056(state) {
87
+ function $ea94a5cfe92db3c2$export$31e22e3c931fc056(state) {
80
88
  var _useLocale;
81
- let locale = (_useLocale = (0, $d7JPl$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
89
+ let locale = (_useLocale = (0, $kDnTZ$useLocale)()) === null || _useLocale === void 0 ? void 0 : _useLocale.locale;
82
90
  let currentDate = new Date();
83
91
  let formatedDate = state.getDateFormatter(locale, {
84
92
  shouldForceLeadingZeros: true
@@ -92,5 +100,5 @@ function $04e96200274b03de$export$31e22e3c931fc056(state) {
92
100
  }
93
101
 
94
102
 
95
- export {$04e96200274b03de$export$322f4580ccd8dde6 as useFormatHelpText, $04e96200274b03de$export$12ce2869ce471b1f as useVisibleMonths, $04e96200274b03de$export$71a23a36270e4bf0 as useFocusManagerRef, $04e96200274b03de$export$31e22e3c931fc056 as useFormattedDateWidth};
103
+ export {$ea94a5cfe92db3c2$export$322f4580ccd8dde6 as useFormatHelpText, $ea94a5cfe92db3c2$export$12ce2869ce471b1f as useVisibleMonths, $ea94a5cfe92db3c2$export$71a23a36270e4bf0 as useFocusManagerRef, $ea94a5cfe92db3c2$export$31e22e3c931fc056 as useFormattedDateWidth};
96
104
  //# sourceMappingURL=utils.module.js.map
@@ -1 +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,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,KAAK;QAC5B;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,aAAa;IACvG,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.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, useLocale} 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<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) {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate, locale);\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"}
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,OACE,UAAU,aAAa,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,GAAG;YAC1C,IAAI,EAAE,IAAI,KAAK,WACb,qBAAO,gCAAC;gBAAK,KAAK;eAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YAGtC,qBAAO,gCAAC;gBAAK,KAAK;gBAAG,OAAO;oBAAC,aAAa;oBAAS,WAAW;gBAAK;eAAI,aAAa,EAAE,CAAC,EAAE,IAAI;QAC/F;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,KAAK;QAC5B;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,aAAa;IACvG,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 {FocusableRef} from '@react-types/shared';\nimport React, {useImperativeHandle, useMemo, useRef, useState} from 'react';\nimport {SpectrumDatePickerBase} from '@react-types/datepicker';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\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'>) {\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') {\n return <span key={i}>{` ${s.value} `}</span>;\n }\n\n return <span key={i} style={{unicodeBidi: 'embed', direction: 'ltr'}}>{displayNames.of(s.type)}</span>;\n })\n );\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<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) {\n let locale = useLocale()?.locale;\n let currentDate = new Date();\n let formatedDate = state.getDateFormatter(locale, {shouldForceLeadingZeros: true}).format(currentDate, locale);\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"}
@@ -97,6 +97,7 @@
97
97
  border-radius: var(--spectrum-textfield-border-radius, var(--spectrum-alias-border-radius-regular));
98
98
  padding: 3px var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150)) 5px calc(var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150)) - 1px);
99
99
  text-indent: 0;
100
+ inline-size: 100%;
100
101
  height: var(--spectrum-textfield-height, var(--spectrum-alias-single-line-height));
101
102
  vertical-align: top;
102
103
  font-size: var(--spectrum-textfield-text-size, var(--spectrum-alias-font-size-default));
@@ -106,7 +107,6 @@
106
107
  -webkit-appearance: none;
107
108
  -moz-appearance: textfield;
108
109
  outline: none;
109
- inline-size: 100%;
110
110
  margin: 0;
111
111
  overflow: visible;
112
112
  }
@@ -199,10 +199,10 @@
199
199
  }
200
200
 
201
201
  .zo2IKa_spectrum-Textfield--multiline .zo2IKa_spectrum-Textfield-input {
202
+ height: auto;
202
203
  min-height: var(--spectrum-global-dimension-size-700);
203
204
  padding: 3px var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150)) 5px calc(var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150)) - 1px);
204
205
  resize: none;
205
- height: auto;
206
206
  overflow: auto;
207
207
  }
208
208
 
@@ -547,4 +547,4 @@
547
547
  border-color: var(--spectrum-textfield-quiet-border-color-key-focus, var(--spectrum-alias-border-color-focus));
548
548
  }
549
549
  }
550
- /*# sourceMappingURL=vars.61240e3b.css.map */
550
+ /*# sourceMappingURL=vars.ba84240a.css.map */
@@ -1 +1 @@
1
- {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;;AAUE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.61240e3b.css.map"}
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;;AAUE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.ba84240a.css.map"}