@react-aria/datepicker 3.1.1 → 3.2.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/module.js CHANGED
@@ -2,8 +2,8 @@ import {createFocusManager as $cIPI0$createFocusManager, getFocusableTreeWalker
2
2
  import {useId as $cIPI0$useId, useDescription as $cIPI0$useDescription, filterDOMProps as $cIPI0$filterDOMProps, mergeProps as $cIPI0$mergeProps, isMac as $cIPI0$isMac, scrollIntoView as $cIPI0$scrollIntoView, getScrollParent as $cIPI0$getScrollParent, useEvent as $cIPI0$useEvent, useLayoutEffect as $cIPI0$useLayoutEffect, isIOS as $cIPI0$isIOS, useLabels as $cIPI0$useLabels} from "@react-aria/utils";
3
3
  import $cIPI0$react, {useMemo as $cIPI0$useMemo, useRef as $cIPI0$useRef, useEffect as $cIPI0$useEffect} from "react";
4
4
  import {useField as $cIPI0$useField} from "@react-aria/label";
5
- import {useLocalizedStringFormatter as $cIPI0$useLocalizedStringFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter} from "@react-aria/i18n";
6
5
  import {useFocusWithin as $cIPI0$useFocusWithin, usePress as $cIPI0$usePress} from "@react-aria/interactions";
6
+ import {useLocalizedStringFormatter as $cIPI0$useLocalizedStringFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter} from "@react-aria/i18n";
7
7
  import {toCalendar as $cIPI0$toCalendar, CalendarDate as $cIPI0$CalendarDate} from "@internationalized/date";
8
8
  import {NumberParser as $cIPI0$NumberParser} from "@internationalized/number";
9
9
  import {useSpinButton as $cIPI0$useSpinButton} from "@react-aria/spinbutton";
@@ -963,9 +963,13 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
963
963
  labelElementType: 'span'
964
964
  });
965
965
  let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
966
- onBlurWithin () {
966
+ ...props,
967
+ onBlurWithin: (e)=>{
967
968
  state.confirmPlaceholder();
968
- }
969
+ if (props.onBlur) props.onBlur(e);
970
+ },
971
+ onFocusWithin: props.onFocus,
972
+ onFocusWithinChange: props.onFocusChange
969
973
  });
970
974
  let stringFormatter = $cIPI0$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
971
975
  let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
@@ -1027,7 +1031,14 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
1027
1031
  focusManager.focusFirst();
1028
1032
  }
1029
1033
  },
1030
- fieldProps: $cIPI0$mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps),
1034
+ fieldProps: $cIPI0$mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {
1035
+ onKeyDown (e) {
1036
+ if (props.onKeyDown) props.onKeyDown(e);
1037
+ },
1038
+ onKeyUp (e) {
1039
+ if (props.onKeyUp) props.onKeyUp(e);
1040
+ }
1041
+ }),
1031
1042
  descriptionProps: descriptionProps,
1032
1043
  errorMessageProps: errorMessageProps
1033
1044
  };
@@ -1040,6 +1051,7 @@ function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
1040
1051
 
1041
1052
 
1042
1053
 
1054
+
1043
1055
  function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
1044
1056
  let buttonId = $cIPI0$useId();
1045
1057
  let dialogId = $cIPI0$useId();
@@ -1067,12 +1079,27 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
1067
1079
  , [
1068
1080
  ref
1069
1081
  ]);
1082
+ let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
1083
+ ...props,
1084
+ isDisabled: state.isOpen,
1085
+ onBlurWithin: props.onBlur,
1086
+ onFocusWithin: props.onFocus,
1087
+ onFocusWithinChange: props.onFocusChange
1088
+ });
1070
1089
  return {
1071
- groupProps: $cIPI0$mergeProps(domProps, groupProps, fieldProps, descProps, {
1090
+ groupProps: $cIPI0$mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
1072
1091
  role: 'group',
1073
1092
  'aria-disabled': props.isDisabled || null,
1074
1093
  'aria-labelledby': labelledBy,
1075
- 'aria-describedby': ariaDescribedBy
1094
+ 'aria-describedby': ariaDescribedBy,
1095
+ onKeyDown (e) {
1096
+ if (state.isOpen) return;
1097
+ if (props.onKeyDown) props.onKeyDown(e);
1098
+ },
1099
+ onKeyUp (e) {
1100
+ if (state.isOpen) return;
1101
+ if (props.onKeyUp) props.onKeyUp(e);
1102
+ }
1076
1103
  }),
1077
1104
  labelProps: {
1078
1105
  ...labelProps,
@@ -1512,6 +1539,7 @@ function $32489daedd52963e$var$commonPrefixLength(strings) {
1512
1539
 
1513
1540
 
1514
1541
 
1542
+
1515
1543
  function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
1516
1544
  var ref1, ref2;
1517
1545
  let stringFormatter = $cIPI0$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
@@ -1568,11 +1596,26 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
1568
1596
  validationState: state.validationState
1569
1597
  };
1570
1598
  let domProps = $cIPI0$filterDOMProps(props);
1599
+ let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
1600
+ ...props,
1601
+ isDisabled: state.isOpen,
1602
+ onBlurWithin: props.onBlur,
1603
+ onFocusWithin: props.onFocus,
1604
+ onFocusWithinChange: props.onFocusChange
1605
+ });
1571
1606
  return {
1572
- groupProps: $cIPI0$mergeProps(domProps, groupProps, fieldProps, descProps, {
1607
+ groupProps: $cIPI0$mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
1573
1608
  role: 'group',
1574
1609
  'aria-disabled': props.isDisabled || null,
1575
- 'aria-describedby': ariaDescribedBy
1610
+ 'aria-describedby': ariaDescribedBy,
1611
+ onKeyDown (e) {
1612
+ if (state.isOpen) return;
1613
+ if (props.onKeyDown) props.onKeyDown(e);
1614
+ },
1615
+ onKeyUp (e) {
1616
+ if (state.isOpen) return;
1617
+ if (props.onKeyUp) props.onKeyUp(e);
1618
+ }
1576
1619
  }),
1577
1620
  labelProps: {
1578
1621
  ...labelProps,