@react-stately/calendar 3.5.0 → 3.5.1

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.
@@ -32,7 +32,7 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
32
32
  ]);
33
33
  let { locale: locale, createCalendar: createCalendar, visibleDuration: visibleDuration = {
34
34
  months: 1
35
- }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = "visible" } = props;
35
+ }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible' } = props;
36
36
  let calendar = (0, $cpRwL$react.useMemo)(()=>createCalendar(resolvedOptions.calendar), [
37
37
  createCalendar,
38
38
  resolvedOptions.calendar
@@ -42,7 +42,7 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
42
42
  value,
43
43
  calendar
44
44
  ]);
45
- let timeZone = (0, $cpRwL$react.useMemo)(()=>value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
45
+ let timeZone = (0, $cpRwL$react.useMemo)(()=>value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [
46
46
  value,
47
47
  resolvedOptions.timeZone
48
48
  ]);
@@ -63,11 +63,11 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
63
63
  let [focusedDate, setFocusedDate] = (0, $cpRwL$reactstatelyutils.useControlledState)(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
64
64
  let [startDate, setStartDate] = (0, $cpRwL$react.useState)(()=>{
65
65
  switch(selectionAlignment){
66
- case "start":
66
+ case 'start':
67
67
  return (0, $4301262d71f567b9$exports.alignStart)(focusedDate, visibleDuration, locale, minValue, maxValue);
68
- case "end":
68
+ case 'end':
69
69
  return (0, $4301262d71f567b9$exports.alignEnd)(focusedDate, visibleDuration, locale, minValue, maxValue);
70
- case "center":
70
+ case 'center':
71
71
  default:
72
72
  return (0, $4301262d71f567b9$exports.alignCenter)(focusedDate, visibleDuration, locale, minValue, maxValue);
73
73
  }
@@ -114,7 +114,7 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
114
114
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
115
115
  newValue = (0, $cpRwL$internationalizeddate.toCalendar)(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new (0, $cpRwL$internationalizeddate.GregorianCalendar)());
116
116
  // Preserve time if the input value had one.
117
- if (value && "hour" in value) setControlledValue(value.set(newValue));
117
+ if (value && 'hour' in value) setControlledValue(value.set(newValue));
118
118
  else setControlledValue(newValue);
119
119
  }
120
120
  }
@@ -128,10 +128,10 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
128
128
  minValue,
129
129
  maxValue
130
130
  ]);
131
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
132
- let validationState = isValueInvalid ? "invalid" : null;
131
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isUnavailable;
132
+ let validationState = isValueInvalid ? 'invalid' : null;
133
133
  let pageDuration = (0, $cpRwL$react.useMemo)(()=>{
134
- if (pageBehavior === "visible") return visibleDuration;
134
+ if (pageBehavior === 'visible') return visibleDuration;
135
135
  return $6adad0c8536fc209$var$unitDuration(visibleDuration);
136
136
  }, [
137
137
  pageBehavior,
@@ -26,7 +26,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
26
26
  ]);
27
27
  let { locale: locale, createCalendar: createCalendar, visibleDuration: visibleDuration = {
28
28
  months: 1
29
- }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = "visible" } = props;
29
+ }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible' } = props;
30
30
  let calendar = (0, $7G4ZY$useMemo)(()=>createCalendar(resolvedOptions.calendar), [
31
31
  createCalendar,
32
32
  resolvedOptions.calendar
@@ -36,7 +36,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
36
36
  value,
37
37
  calendar
38
38
  ]);
39
- let timeZone = (0, $7G4ZY$useMemo)(()=>value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
39
+ let timeZone = (0, $7G4ZY$useMemo)(()=>value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [
40
40
  value,
41
41
  resolvedOptions.timeZone
42
42
  ]);
@@ -57,11 +57,11 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
57
57
  let [focusedDate, setFocusedDate] = (0, $7G4ZY$useControlledState)(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
58
58
  let [startDate, setStartDate] = (0, $7G4ZY$useState)(()=>{
59
59
  switch(selectionAlignment){
60
- case "start":
60
+ case 'start':
61
61
  return (0, $f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue);
62
- case "end":
62
+ case 'end':
63
63
  return (0, $f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue);
64
- case "center":
64
+ case 'center':
65
65
  default:
66
66
  return (0, $f62d864046160412$export$f4a51ff076cc9a09)(focusedDate, visibleDuration, locale, minValue, maxValue);
67
67
  }
@@ -108,7 +108,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
108
108
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
109
109
  newValue = (0, $7G4ZY$toCalendar)(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new (0, $7G4ZY$GregorianCalendar)());
110
110
  // Preserve time if the input value had one.
111
- if (value && "hour" in value) setControlledValue(value.set(newValue));
111
+ if (value && 'hour' in value) setControlledValue(value.set(newValue));
112
112
  else setControlledValue(newValue);
113
113
  }
114
114
  }
@@ -122,10 +122,10 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
122
122
  minValue,
123
123
  maxValue
124
124
  ]);
125
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
126
- let validationState = isValueInvalid ? "invalid" : null;
125
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isUnavailable;
126
+ let validationState = isValueInvalid ? 'invalid' : null;
127
127
  let pageDuration = (0, $7G4ZY$useMemo)(()=>{
128
- if (pageBehavior === "visible") return visibleDuration;
128
+ if (pageBehavior === 'visible') return visibleDuration;
129
129
  return $131cf43a05231e1e$var$unitDuration(visibleDuration);
130
130
  }, [
131
131
  pageBehavior,
@@ -290,4 +290,4 @@ function $131cf43a05231e1e$var$unitDuration(duration) {
290
290
 
291
291
 
292
292
  export {$131cf43a05231e1e$export$6d095e787d2b5e1f as useCalendarState};
293
- //# sourceMappingURL=useCalendarState.mjs.map
293
+ //# sourceMappingURL=useCalendarState.module.js.map
@@ -26,7 +26,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
26
26
  ]);
27
27
  let { locale: locale, createCalendar: createCalendar, visibleDuration: visibleDuration = {
28
28
  months: 1
29
- }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = "visible" } = props;
29
+ }, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible' } = props;
30
30
  let calendar = (0, $7G4ZY$useMemo)(()=>createCalendar(resolvedOptions.calendar), [
31
31
  createCalendar,
32
32
  resolvedOptions.calendar
@@ -36,7 +36,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
36
36
  value,
37
37
  calendar
38
38
  ]);
39
- let timeZone = (0, $7G4ZY$useMemo)(()=>value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
39
+ let timeZone = (0, $7G4ZY$useMemo)(()=>value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [
40
40
  value,
41
41
  resolvedOptions.timeZone
42
42
  ]);
@@ -57,11 +57,11 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
57
57
  let [focusedDate, setFocusedDate] = (0, $7G4ZY$useControlledState)(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
58
58
  let [startDate, setStartDate] = (0, $7G4ZY$useState)(()=>{
59
59
  switch(selectionAlignment){
60
- case "start":
60
+ case 'start':
61
61
  return (0, $f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue);
62
- case "end":
62
+ case 'end':
63
63
  return (0, $f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue);
64
- case "center":
64
+ case 'center':
65
65
  default:
66
66
  return (0, $f62d864046160412$export$f4a51ff076cc9a09)(focusedDate, visibleDuration, locale, minValue, maxValue);
67
67
  }
@@ -108,7 +108,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
108
108
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
109
109
  newValue = (0, $7G4ZY$toCalendar)(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new (0, $7G4ZY$GregorianCalendar)());
110
110
  // Preserve time if the input value had one.
111
- if (value && "hour" in value) setControlledValue(value.set(newValue));
111
+ if (value && 'hour' in value) setControlledValue(value.set(newValue));
112
112
  else setControlledValue(newValue);
113
113
  }
114
114
  }
@@ -122,10 +122,10 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
122
122
  minValue,
123
123
  maxValue
124
124
  ]);
125
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
126
- let validationState = isValueInvalid ? "invalid" : null;
125
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isUnavailable;
126
+ let validationState = isValueInvalid ? 'invalid' : null;
127
127
  let pageDuration = (0, $7G4ZY$useMemo)(()=>{
128
- if (pageBehavior === "visible") return visibleDuration;
128
+ if (pageBehavior === 'visible') return visibleDuration;
129
129
  return $131cf43a05231e1e$var$unitDuration(visibleDuration);
130
130
  }, [
131
131
  pageBehavior,
@@ -31,13 +31,13 @@ function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
31
31
  }, minValue: minValue, maxValue: maxValue, ...calendarProps } = props;
32
32
  let [value, setValue] = (0, $e7F0I$reactstatelyutils.useControlledState)(valueProp, defaultValue || null, onChange);
33
33
  let [anchorDate, setAnchorDateState] = (0, $e7F0I$react.useState)(null);
34
- let alignment = "center";
34
+ let alignment = 'center';
35
35
  if (value && value.start && value.end) {
36
36
  let start = (0, $4301262d71f567b9$exports.alignCenter)((0, $e7F0I$internationalizeddate.toCalendarDate)(value.start), visibleDuration, locale, minValue, maxValue);
37
37
  let end = start.add(visibleDuration).subtract({
38
38
  days: 1
39
39
  });
40
- if (value.end.compare(end) > 0) alignment = "start";
40
+ if (value.end.compare(end) > 0) alignment = 'start';
41
41
  }
42
42
  // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.
43
43
  let availableRangeRef = (0, $e7F0I$react.useRef)(null);
@@ -116,8 +116,8 @@ function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
116
116
  minValue,
117
117
  maxValue
118
118
  ]);
119
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isInvalidSelection;
120
- let validationState = isValueInvalid ? "invalid" : null;
119
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isInvalidSelection;
120
+ let validationState = isValueInvalid ? 'invalid' : null;
121
121
  return {
122
122
  ...calendar,
123
123
  value: value,
@@ -161,7 +161,7 @@ function $e49f7b861e5e8049$var$convertValue(newValue, oldValue) {
161
161
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
162
162
  newValue = (0, $e7F0I$internationalizeddate.toCalendar)(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new (0, $e7F0I$internationalizeddate.GregorianCalendar)());
163
163
  // Preserve time if the input value had one.
164
- if (oldValue && "hour" in oldValue) return oldValue.set(newValue);
164
+ if (oldValue && 'hour' in oldValue) return oldValue.set(newValue);
165
165
  return newValue;
166
166
  }
167
167
  function $e49f7b861e5e8049$var$nextUnavailableDate(anchorDate, state, dir) {
@@ -25,13 +25,13 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
25
25
  }, minValue: minValue, maxValue: maxValue, ...calendarProps } = props;
26
26
  let [value, setValue] = (0, $d0gbl$useControlledState)(valueProp, defaultValue || null, onChange);
27
27
  let [anchorDate, setAnchorDateState] = (0, $d0gbl$useState)(null);
28
- let alignment = "center";
28
+ let alignment = 'center';
29
29
  if (value && value.start && value.end) {
30
30
  let start = (0, $f62d864046160412$export$f4a51ff076cc9a09)((0, $d0gbl$toCalendarDate)(value.start), visibleDuration, locale, minValue, maxValue);
31
31
  let end = start.add(visibleDuration).subtract({
32
32
  days: 1
33
33
  });
34
- if (value.end.compare(end) > 0) alignment = "start";
34
+ if (value.end.compare(end) > 0) alignment = 'start';
35
35
  }
36
36
  // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.
37
37
  let availableRangeRef = (0, $d0gbl$useRef)(null);
@@ -110,8 +110,8 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
110
110
  minValue,
111
111
  maxValue
112
112
  ]);
113
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isInvalidSelection;
114
- let validationState = isValueInvalid ? "invalid" : null;
113
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isInvalidSelection;
114
+ let validationState = isValueInvalid ? 'invalid' : null;
115
115
  return {
116
116
  ...calendar,
117
117
  value: value,
@@ -155,7 +155,7 @@ function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
155
155
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
156
156
  newValue = (0, $d0gbl$toCalendar)(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new (0, $d0gbl$GregorianCalendar)());
157
157
  // Preserve time if the input value had one.
158
- if (oldValue && "hour" in oldValue) return oldValue.set(newValue);
158
+ if (oldValue && 'hour' in oldValue) return oldValue.set(newValue);
159
159
  return newValue;
160
160
  }
161
161
  function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state, dir) {
@@ -173,4 +173,4 @@ function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state, dir) {
173
173
 
174
174
 
175
175
  export {$9a36b6ba2fb1a7c5$export$9a987164d97ecc90 as useRangeCalendarState};
176
- //# sourceMappingURL=useRangeCalendarState.mjs.map
176
+ //# sourceMappingURL=useRangeCalendarState.module.js.map
@@ -25,13 +25,13 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
25
25
  }, minValue: minValue, maxValue: maxValue, ...calendarProps } = props;
26
26
  let [value, setValue] = (0, $d0gbl$useControlledState)(valueProp, defaultValue || null, onChange);
27
27
  let [anchorDate, setAnchorDateState] = (0, $d0gbl$useState)(null);
28
- let alignment = "center";
28
+ let alignment = 'center';
29
29
  if (value && value.start && value.end) {
30
30
  let start = (0, $f62d864046160412$export$f4a51ff076cc9a09)((0, $d0gbl$toCalendarDate)(value.start), visibleDuration, locale, minValue, maxValue);
31
31
  let end = start.add(visibleDuration).subtract({
32
32
  days: 1
33
33
  });
34
- if (value.end.compare(end) > 0) alignment = "start";
34
+ if (value.end.compare(end) > 0) alignment = 'start';
35
35
  }
36
36
  // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.
37
37
  let availableRangeRef = (0, $d0gbl$useRef)(null);
@@ -110,8 +110,8 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
110
110
  minValue,
111
111
  maxValue
112
112
  ]);
113
- let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isInvalidSelection;
114
- let validationState = isValueInvalid ? "invalid" : null;
113
+ let isValueInvalid = props.isInvalid || props.validationState === 'invalid' || isInvalidSelection;
114
+ let validationState = isValueInvalid ? 'invalid' : null;
115
115
  return {
116
116
  ...calendar,
117
117
  value: value,
@@ -155,7 +155,7 @@ function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
155
155
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
156
156
  newValue = (0, $d0gbl$toCalendar)(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new (0, $d0gbl$GregorianCalendar)());
157
157
  // Preserve time if the input value had one.
158
- if (oldValue && "hour" in oldValue) return oldValue.set(newValue);
158
+ if (oldValue && 'hour' in oldValue) return oldValue.set(newValue);
159
159
  return newValue;
160
160
  }
161
161
  function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state, dir) {
package/dist/utils.mjs CHANGED
@@ -63,4 +63,4 @@ function $f62d864046160412$export$a1d3911297b952d7(date, minValue, isDateUnavail
63
63
 
64
64
 
65
65
  export {$f62d864046160412$export$eac50920cf2fd59a as isInvalid, $f62d864046160412$export$f4a51ff076cc9a09 as alignCenter, $f62d864046160412$export$144a00ba6044eb9 as alignStart, $f62d864046160412$export$5bb865b12696a77d as constrainStart, $f62d864046160412$export$530edbfc915b2b04 as alignEnd, $f62d864046160412$export$4f5203c0d889109e as constrainValue, $f62d864046160412$export$a1d3911297b952d7 as previousAvailableDate};
66
- //# sourceMappingURL=utils.mjs.map
66
+ //# sourceMappingURL=utils.module.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/calendar",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,10 +22,10 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@internationalized/date": "^3.5.3",
26
- "@react-stately/utils": "^3.10.0",
27
- "@react-types/calendar": "^3.4.5",
28
- "@react-types/shared": "^3.23.0",
25
+ "@internationalized/date": "^3.5.4",
26
+ "@react-stately/utils": "^3.10.1",
27
+ "@react-types/calendar": "^3.4.6",
28
+ "@react-types/shared": "^3.23.1",
29
29
  "@swc/helpers": "^0.5.0"
30
30
  },
31
31
  "peerDependencies": {
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
37
+ "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
38
38
  }