react-aria 3.51.0 → 3.52.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/exports/index.cjs +1 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +2 -2
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +2 -2
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/private/utils/domHelpers.cjs +1 -0
- package/dist/exports/private/utils/domHelpers.cjs.map +1 -1
- package/dist/exports/private/utils/domHelpers.js +2 -2
- package/dist/exports/private/utils/domHelpers.js.map +1 -1
- package/dist/exports/private/utils/domHelpers.mjs +2 -2
- package/dist/exports/private/utils/domHelpers.mjs.map +1 -1
- package/dist/exports/useFocusVisible.cjs +1 -0
- package/dist/exports/useFocusVisible.cjs.map +1 -1
- package/dist/exports/useFocusVisible.js +2 -2
- package/dist/exports/useFocusVisible.js.map +1 -1
- package/dist/exports/useFocusVisible.mjs +2 -2
- package/dist/exports/useFocusVisible.mjs.map +1 -1
- package/dist/private/actiongroup/useActionGroup.cjs +3 -1
- package/dist/private/actiongroup/useActionGroup.cjs.map +1 -1
- package/dist/private/actiongroup/useActionGroup.js +3 -1
- package/dist/private/actiongroup/useActionGroup.js.map +1 -1
- package/dist/private/actiongroup/useActionGroup.mjs +3 -1
- package/dist/private/actiongroup/useActionGroup.mjs.map +1 -1
- package/dist/private/calendar/useRangeCalendar.cjs +1 -1
- package/dist/private/calendar/useRangeCalendar.cjs.map +1 -1
- package/dist/private/calendar/useRangeCalendar.js +2 -2
- package/dist/private/calendar/useRangeCalendar.js.map +1 -1
- package/dist/private/calendar/useRangeCalendar.mjs +2 -2
- package/dist/private/calendar/useRangeCalendar.mjs.map +1 -1
- package/dist/private/color/useColorField.cjs +26 -4
- package/dist/private/color/useColorField.cjs.map +1 -1
- package/dist/private/color/useColorField.js +26 -4
- package/dist/private/color/useColorField.js.map +1 -1
- package/dist/private/color/useColorField.mjs +26 -4
- package/dist/private/color/useColorField.mjs.map +1 -1
- package/dist/private/combobox/useComboBox.cjs +1 -1
- package/dist/private/combobox/useComboBox.cjs.map +1 -1
- package/dist/private/combobox/useComboBox.js +1 -1
- package/dist/private/combobox/useComboBox.js.map +1 -1
- package/dist/private/combobox/useComboBox.mjs +1 -1
- package/dist/private/combobox/useComboBox.mjs.map +1 -1
- package/dist/private/focus/FocusScope.cjs +7 -2
- package/dist/private/focus/FocusScope.cjs.map +1 -1
- package/dist/private/focus/FocusScope.js +7 -2
- package/dist/private/focus/FocusScope.js.map +1 -1
- package/dist/private/focus/FocusScope.mjs +7 -2
- package/dist/private/focus/FocusScope.mjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.cjs +15 -3
- package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.js +15 -3
- package/dist/private/interactions/useFocusVisible.js.map +1 -1
- package/dist/private/interactions/useFocusVisible.mjs +15 -3
- package/dist/private/interactions/useFocusVisible.mjs.map +1 -1
- package/dist/private/interactions/utils.cjs +23 -13
- package/dist/private/interactions/utils.cjs.map +1 -1
- package/dist/private/interactions/utils.js +25 -15
- package/dist/private/interactions/utils.js.map +1 -1
- package/dist/private/interactions/utils.mjs +25 -15
- package/dist/private/interactions/utils.mjs.map +1 -1
- package/dist/private/overlays/calculatePosition.cjs +3 -2
- package/dist/private/overlays/calculatePosition.cjs.map +1 -1
- package/dist/private/overlays/calculatePosition.js +5 -2
- package/dist/private/overlays/calculatePosition.js.map +1 -1
- package/dist/private/overlays/calculatePosition.mjs +3 -2
- package/dist/private/overlays/calculatePosition.mjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.cjs +5 -0
- package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.js +6 -1
- package/dist/private/overlays/useOverlayPosition.js.map +1 -1
- package/dist/private/overlays/useOverlayPosition.mjs +6 -1
- package/dist/private/overlays/useOverlayPosition.mjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.cjs +27 -35
- package/dist/private/overlays/usePreventScroll.cjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.js +27 -35
- package/dist/private/overlays/usePreventScroll.js.map +1 -1
- package/dist/private/overlays/usePreventScroll.mjs +27 -35
- package/dist/private/overlays/usePreventScroll.mjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.cjs +1 -0
- package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.js +1 -0
- package/dist/private/selection/useSelectableCollection.js.map +1 -1
- package/dist/private/selection/useSelectableCollection.mjs +1 -0
- package/dist/private/selection/useSelectableCollection.mjs.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.cjs +3 -1
- package/dist/private/tabs/TabsKeyboardDelegate.cjs.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.js +3 -1
- package/dist/private/tabs/TabsKeyboardDelegate.js.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.mjs +3 -1
- package/dist/private/tabs/TabsKeyboardDelegate.mjs.map +1 -1
- package/dist/private/tokenfield/useToken.cjs +19 -4
- package/dist/private/tokenfield/useToken.cjs.map +1 -1
- package/dist/private/tokenfield/useToken.js +20 -4
- package/dist/private/tokenfield/useToken.js.map +1 -1
- package/dist/private/tokenfield/useToken.mjs +19 -4
- package/dist/private/tokenfield/useToken.mjs.map +1 -1
- package/dist/private/tokenfield/useTokenField.cjs +118 -42
- package/dist/private/tokenfield/useTokenField.cjs.map +1 -1
- package/dist/private/tokenfield/useTokenField.js +121 -44
- package/dist/private/tokenfield/useTokenField.js.map +1 -1
- package/dist/private/tokenfield/useTokenField.mjs +119 -43
- package/dist/private/tokenfield/useTokenField.mjs.map +1 -1
- package/dist/private/utils/domHelpers.cjs +21 -0
- package/dist/private/utils/domHelpers.cjs.map +1 -1
- package/dist/private/utils/domHelpers.js +20 -1
- package/dist/private/utils/domHelpers.js.map +1 -1
- package/dist/private/utils/domHelpers.mjs +20 -1
- package/dist/private/utils/domHelpers.mjs.map +1 -1
- package/dist/private/utils/getMetaValue.cjs +36 -0
- package/dist/private/utils/getMetaValue.cjs.map +1 -0
- package/dist/private/utils/getMetaValue.js +31 -0
- package/dist/private/utils/getMetaValue.js.map +1 -0
- package/dist/private/utils/getMetaValue.mjs +31 -0
- package/dist/private/utils/getMetaValue.mjs.map +1 -0
- package/dist/private/utils/getNonce.cjs +6 -10
- package/dist/private/utils/getNonce.cjs.map +1 -1
- package/dist/private/utils/getNonce.js +7 -11
- package/dist/private/utils/getNonce.js.map +1 -1
- package/dist/private/utils/getNonce.mjs +7 -11
- package/dist/private/utils/getNonce.mjs.map +1 -1
- package/dist/private/utils/useEvent.cjs +7 -9
- package/dist/private/utils/useEvent.cjs.map +1 -1
- package/dist/private/utils/useEvent.js +7 -9
- package/dist/private/utils/useEvent.js.map +1 -1
- package/dist/private/utils/useEvent.mjs +7 -9
- package/dist/private/utils/useEvent.mjs.map +1 -1
- package/dist/types/exports/index.d.ts +2 -2
- package/dist/types/exports/private/utils/domHelpers.d.ts +1 -1
- package/dist/types/exports/useFocusVisible.d.ts +2 -1
- package/dist/types/src/tokenfield/useTokenField.d.ts +3 -2
- package/dist/types/src/utils/domHelpers.d.ts +6 -2
- package/dist/types/src/utils/getMetaValue.d.ts +7 -0
- package/dist/types/src/utils/useEvent.d.ts +2 -2
- package/dist/types/src/virtualizer/Virtualizer.d.ts +3 -3
- package/package.json +6 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {addEvent as $d447af545b77c9f1$export$f531f92e2a15358f, getOwnerDocument as $d447af545b77c9f1$export$b204af158042fbac, getOwnerWindow as $d447af545b77c9f1$export$f21a1ffae260145a, isShadowRoot as $d447af545b77c9f1$export$af51f0f06c0f328a} from "../../../private/utils/domHelpers.mjs";
|
|
1
|
+
import {addEvent as $d447af545b77c9f1$export$f531f92e2a15358f, getOwnerDocument as $d447af545b77c9f1$export$b204af158042fbac, getOwnerWindow as $d447af545b77c9f1$export$f21a1ffae260145a, isDocument as $d447af545b77c9f1$export$62858bae88b53fd0, isShadowRoot as $d447af545b77c9f1$export$af51f0f06c0f328a} from "../../../private/utils/domHelpers.mjs";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
export {$d447af545b77c9f1$export$f531f92e2a15358f as addEvent, $d447af545b77c9f1$export$b204af158042fbac as getOwnerDocument, $d447af545b77c9f1$export$f21a1ffae260145a as getOwnerWindow, $d447af545b77c9f1$export$af51f0f06c0f328a as isShadowRoot};
|
|
6
|
+
export {$d447af545b77c9f1$export$f531f92e2a15358f as addEvent, $d447af545b77c9f1$export$b204af158042fbac as getOwnerDocument, $d447af545b77c9f1$export$f21a1ffae260145a as getOwnerWindow, $d447af545b77c9f1$export$62858bae88b53fd0 as isDocument, $d447af545b77c9f1$export$af51f0f06c0f328a as isShadowRoot};
|
|
7
7
|
//# sourceMappingURL=domHelpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/react-aria/exports/private/utils/domHelpers.ts"],"sourcesContent":["export {\n addEvent,\n getOwnerDocument,\n getOwnerWindow,\n isShadowRoot\n} from '../../../src/utils/domHelpers';\n"],"names":[],"version":3,"file":"domHelpers.mjs.map"}
|
|
1
|
+
{"mappings":"","sources":["packages/react-aria/exports/private/utils/domHelpers.ts"],"sourcesContent":["export {\n addEvent,\n getOwnerDocument,\n getOwnerWindow,\n isDocument,\n isShadowRoot\n} from '../../../src/utils/domHelpers';\n"],"names":[],"version":3,"file":"domHelpers.mjs.map"}
|
|
@@ -5,6 +5,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
$parcel$export(module.exports, "setInteractionModality", function () { return $d0df89f3abe2c2ca$exports.setInteractionModality; });
|
|
8
9
|
$parcel$export(module.exports, "useFocusVisible", function () { return $d0df89f3abe2c2ca$exports.useFocusVisible; });
|
|
9
10
|
/*
|
|
10
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/react-aria/exports/useFocusVisible.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 */\n\nexport {setInteractionModality, useFocusVisible} from '../src/interactions/useFocusVisible';\nexport type {FocusVisibleProps, FocusVisibleResult} from '../src/interactions/useFocusVisible';\nexport type {FocusEvents} from '@react-types/shared';\nexport type {Modality} from '../src/interactions/useFocusVisible';\n"],"names":[],"version":3,"file":"useFocusVisible.cjs.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useFocusVisible as $b50b1cc8a843ace7$export$ffd9e5021c1fb2d6} from "../private/interactions/useFocusVisible.js";
|
|
1
|
+
import {setInteractionModality as $b50b1cc8a843ace7$export$8397ddfc504fdb9a, useFocusVisible as $b50b1cc8a843ace7$export$ffd9e5021c1fb2d6} from "../private/interactions/useFocusVisible.js";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useFocusVisible as $b50b1cc8a843ace7$export$ffd9e5021c1fb2d6} from "../p
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$b50b1cc8a843ace7$export$ffd9e5021c1fb2d6 as useFocusVisible};
|
|
16
|
+
export {$b50b1cc8a843ace7$export$8397ddfc504fdb9a as setInteractionModality, $b50b1cc8a843ace7$export$ffd9e5021c1fb2d6 as useFocusVisible};
|
|
17
17
|
//# sourceMappingURL=useFocusVisible.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/react-aria/exports/useFocusVisible.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 */\n\nexport {useFocusVisible} from '../src/interactions/useFocusVisible';\nexport type {FocusVisibleProps, FocusVisibleResult} from '../src/interactions/useFocusVisible';\nexport type {FocusEvents} from '@react-types/shared';\n"],"names":[],"version":3,"file":"useFocusVisible.js.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/react-aria/exports/useFocusVisible.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 */\n\nexport {setInteractionModality, useFocusVisible} from '../src/interactions/useFocusVisible';\nexport type {FocusVisibleProps, FocusVisibleResult} from '../src/interactions/useFocusVisible';\nexport type {FocusEvents} from '@react-types/shared';\nexport type {Modality} from '../src/interactions/useFocusVisible';\n"],"names":[],"version":3,"file":"useFocusVisible.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useFocusVisible as $8f5a2122b0992be3$export$ffd9e5021c1fb2d6} from "../private/interactions/useFocusVisible.mjs";
|
|
1
|
+
import {setInteractionModality as $8f5a2122b0992be3$export$8397ddfc504fdb9a, useFocusVisible as $8f5a2122b0992be3$export$ffd9e5021c1fb2d6} from "../private/interactions/useFocusVisible.mjs";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useFocusVisible as $8f5a2122b0992be3$export$ffd9e5021c1fb2d6} from "../p
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$8f5a2122b0992be3$export$ffd9e5021c1fb2d6 as useFocusVisible};
|
|
16
|
+
export {$8f5a2122b0992be3$export$8397ddfc504fdb9a as setInteractionModality, $8f5a2122b0992be3$export$ffd9e5021c1fb2d6 as useFocusVisible};
|
|
17
17
|
//# sourceMappingURL=useFocusVisible.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/react-aria/exports/useFocusVisible.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 */\n\nexport {useFocusVisible} from '../src/interactions/useFocusVisible';\nexport type {FocusVisibleProps, FocusVisibleResult} from '../src/interactions/useFocusVisible';\nexport type {FocusEvents} from '@react-types/shared';\n"],"names":[],"version":3,"file":"useFocusVisible.mjs.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/react-aria/exports/useFocusVisible.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 */\n\nexport {setInteractionModality, useFocusVisible} from '../src/interactions/useFocusVisible';\nexport type {FocusVisibleProps, FocusVisibleResult} from '../src/interactions/useFocusVisible';\nexport type {FocusEvents} from '@react-types/shared';\nexport type {Modality} from '../src/interactions/useFocusVisible';\n"],"names":[],"version":3,"file":"useFocusVisible.mjs.map"}
|
|
@@ -47,7 +47,9 @@ function $89f42f05fc2fa6f0$export$f4bf8d43c16de704(props, state, ref) {
|
|
|
47
47
|
let { direction: direction } = (0, $2522e612fa919664$exports.useLocale)();
|
|
48
48
|
// oxlint-disable-next-line react/react-compiler
|
|
49
49
|
let focusManager = (0, $9fb4ac1cc58342cc$exports.createFocusManager)(ref);
|
|
50
|
-
|
|
50
|
+
// ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so
|
|
51
|
+
// ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.
|
|
52
|
+
let flipDirection = direction === 'rtl';
|
|
51
53
|
let { keyboardProps: keyboardProps } = (0, $6d2f10bb8b359da5$exports.useKeyboard)({
|
|
52
54
|
shortcuts: {
|
|
53
55
|
ArrowRight: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAsBD,MAAM,2CAAqB;IACzB,MAAM;IACN,QAAQ;IACR,UAAU;AACZ;AAqCO,SAAS,0CACd,KAA8B,EAC9B,KAAmB,EACnB,GAAuC;IAEvC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eAAe,CAAA,GAAA,4CAAiB,EAAE;IACtC,wFAAwF;IACxF,uFAAuF;IACvF,IAAI,gBAAgB,cAAc;IAClC,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,qCAAU,EAAE;QAChC,WAAW;YACT,YAAY;gBACV,IAAI,eACF,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;qBAEtC,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;YAEtC;YACA,WAAW;gBACT,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;YACpC;YACA,WAAW;gBACT,IAAI,eACF,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;qBAElC,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;YAE1C;YACA,SAAS;gBACP,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;YACxC;QACF;QACA,cAAc;IAChB;IAEA,IAAI,OAA2B,wCAAkB,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvF,IAAI,eAAe,SAAS,WAC1B,OAAO;IAET,OAAO;QACL,kBAAkB;YAChB,GAAG,CAAA,GAAA,wCAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,oBAAoB,SAAS,YAAY,cAAc;YACvD,iBAAiB;YACjB,GAAG,aAAa;QAClB;IACF;AACF","sources":["packages/react-aria/src/actiongroup/useActionGroup.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 */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n FocusableElement,\n ItemElement,\n ItemRenderer,\n Key,\n MultipleSelection,\n Orientation,\n RefObject\n} from '@react-types/shared';\nimport {createFocusManager} from '../focus/FocusScope';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {ListState} from 'react-stately/useListState';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useState} from 'react';\n\nconst BUTTON_GROUP_ROLES = {\n none: 'toolbar',\n single: 'radiogroup',\n multiple: 'toolbar'\n};\n\n// Not extending CollectionBase to avoid async loading props\nexport interface ActionGroupProps<T> extends MultipleSelection {\n /**\n * The axis the ActionGroup should align with.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * An list of `Item` elements or a function. If the latter, a list of items must be provided using\n * the `items` prop.\n */\n children: ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;\n /** A list of items to display as children. Must be used with a function as the sole child. */\n items?: Iterable<T>;\n /** A list of keys to disable. */\n disabledKeys?: Iterable<Key>;\n /**\n * Whether the ActionGroup is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean;\n /**\n * Invoked when an action is taken on a child. Especially useful when `selectionMode` is none.\n * The sole argument `key` is the key for the item.\n */\n onAction?: (key: Key) => void;\n}\n\nexport interface AriaActionGroupProps<T> extends ActionGroupProps<T>, DOMProps, AriaLabelingProps {}\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes;\n}\n\nexport function useActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n ref: RefObject<FocusableElement | null>\n): ActionGroupAria {\n let {isDisabled, orientation = 'horizontal' as Orientation} = props;\n\n let [isInToolbar, setInToolbar] = useState(false);\n useLayoutEffect(() => {\n setInToolbar(!!(ref.current && ref.current.parentElement?.closest('[role=\"toolbar\"]')));\n }, [ref]);\n\n let allKeys = [...state.collection.getKeys()];\n if (!allKeys.some(key => !state.disabledKeys.has(key))) {\n isDisabled = true;\n }\n\n let {direction} = useLocale();\n // oxlint-disable-next-line react/react-compiler\n let focusManager = createFocusManager(ref);\n // ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so\n // ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.\n let flipDirection = direction === 'rtl';\n let {keyboardProps} = useKeyboard({\n shortcuts: {\n ArrowRight: () => {\n if (flipDirection) {\n focusManager.focusPrevious({wrap: true});\n } else {\n focusManager.focusNext({wrap: true});\n }\n },\n ArrowDown: () => {\n focusManager.focusNext({wrap: true});\n },\n ArrowLeft: () => {\n if (flipDirection) {\n focusManager.focusNext({wrap: true});\n } else {\n focusManager.focusPrevious({wrap: true});\n }\n },\n ArrowUp: () => {\n focusManager.focusPrevious({wrap: true});\n }\n },\n allowRepeats: true\n });\n\n let role: string | undefined = BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];\n if (isInToolbar && role === 'toolbar') {\n role = 'group';\n }\n return {\n actionGroupProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n 'aria-orientation': role === 'toolbar' ? orientation : undefined,\n 'aria-disabled': isDisabled,\n ...keyboardProps\n }\n };\n}\n"],"names":[],"version":3,"file":"useActionGroup.cjs.map"}
|
|
@@ -42,7 +42,9 @@ function $e5974f34cf218762$export$f4bf8d43c16de704(props, state, ref) {
|
|
|
42
42
|
let { direction: direction } = (0, $4defb058003b3e05$export$43bb16f9c6d9e3f7)();
|
|
43
43
|
// oxlint-disable-next-line react/react-compiler
|
|
44
44
|
let focusManager = (0, $903814aeb7d53b38$export$c5251b9e124bf29)(ref);
|
|
45
|
-
|
|
45
|
+
// ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so
|
|
46
|
+
// ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.
|
|
47
|
+
let flipDirection = direction === 'rtl';
|
|
46
48
|
let { keyboardProps: keyboardProps } = (0, $bf74df7506f65576$export$8f71654801c2f7cd)({
|
|
47
49
|
shortcuts: {
|
|
48
50
|
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OAAO,CAAC,oBAAkB;IACtF,GAAG;QAAC;KAAI;IAER,IAAI,UAAU;WAAI,MAAM,UAAU,CAAC,OAAO;KAAG;IAC7C,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA,MAAO,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,OAC/C,aAAa;IAGf,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAQ;IAC1B,gDAAgD;IAChD,IAAI,eAAe,CAAA,GAAA,wCAAiB,EAAE;IACtC,wFAAwF;IACxF,uFAAuF;IACvF,IAAI,gBAAgB,cAAc;IAClC,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,yCAAU,EAAE;QAChC,WAAW;YACT,YAAY;gBACV,IAAI,eACF,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;qBAEtC,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;YAEtC;YACA,WAAW;gBACT,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;YACpC;YACA,WAAW;gBACT,IAAI,eACF,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;qBAElC,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;YAE1C;YACA,SAAS;gBACP,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;YACxC;QACF;QACA,cAAc;IAChB;IAEA,IAAI,OAA2B,wCAAkB,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvF,IAAI,eAAe,SAAS,WAC1B,OAAO;IAET,OAAO;QACL,kBAAkB;YAChB,GAAG,CAAA,GAAA,yCAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,oBAAoB,SAAS,YAAY,cAAc;YACvD,iBAAiB;YACjB,GAAG,aAAa;QAClB;IACF;AACF","sources":["packages/react-aria/src/actiongroup/useActionGroup.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 */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n FocusableElement,\n ItemElement,\n ItemRenderer,\n Key,\n MultipleSelection,\n Orientation,\n RefObject\n} from '@react-types/shared';\nimport {createFocusManager} from '../focus/FocusScope';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {ListState} from 'react-stately/useListState';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useState} from 'react';\n\nconst BUTTON_GROUP_ROLES = {\n none: 'toolbar',\n single: 'radiogroup',\n multiple: 'toolbar'\n};\n\n// Not extending CollectionBase to avoid async loading props\nexport interface ActionGroupProps<T> extends MultipleSelection {\n /**\n * The axis the ActionGroup should align with.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * An list of `Item` elements or a function. If the latter, a list of items must be provided using\n * the `items` prop.\n */\n children: ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;\n /** A list of items to display as children. Must be used with a function as the sole child. */\n items?: Iterable<T>;\n /** A list of keys to disable. */\n disabledKeys?: Iterable<Key>;\n /**\n * Whether the ActionGroup is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean;\n /**\n * Invoked when an action is taken on a child. Especially useful when `selectionMode` is none.\n * The sole argument `key` is the key for the item.\n */\n onAction?: (key: Key) => void;\n}\n\nexport interface AriaActionGroupProps<T> extends ActionGroupProps<T>, DOMProps, AriaLabelingProps {}\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes;\n}\n\nexport function useActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n ref: RefObject<FocusableElement | null>\n): ActionGroupAria {\n let {isDisabled, orientation = 'horizontal' as Orientation} = props;\n\n let [isInToolbar, setInToolbar] = useState(false);\n useLayoutEffect(() => {\n setInToolbar(!!(ref.current && ref.current.parentElement?.closest('[role=\"toolbar\"]')));\n }, [ref]);\n\n let allKeys = [...state.collection.getKeys()];\n if (!allKeys.some(key => !state.disabledKeys.has(key))) {\n isDisabled = true;\n }\n\n let {direction} = useLocale();\n // oxlint-disable-next-line react/react-compiler\n let focusManager = createFocusManager(ref);\n // ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so\n // ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.\n let flipDirection = direction === 'rtl';\n let {keyboardProps} = useKeyboard({\n shortcuts: {\n ArrowRight: () => {\n if (flipDirection) {\n focusManager.focusPrevious({wrap: true});\n } else {\n focusManager.focusNext({wrap: true});\n }\n },\n ArrowDown: () => {\n focusManager.focusNext({wrap: true});\n },\n ArrowLeft: () => {\n if (flipDirection) {\n focusManager.focusNext({wrap: true});\n } else {\n focusManager.focusPrevious({wrap: true});\n }\n },\n ArrowUp: () => {\n focusManager.focusPrevious({wrap: true});\n }\n },\n allowRepeats: true\n });\n\n let role: string | undefined = BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];\n if (isInToolbar && role === 'toolbar') {\n role = 'group';\n }\n return {\n actionGroupProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n 'aria-orientation': role === 'toolbar' ? orientation : undefined,\n 'aria-disabled': isDisabled,\n ...keyboardProps\n }\n };\n}\n"],"names":[],"version":3,"file":"useActionGroup.js.map"}
|
|
@@ -41,7 +41,9 @@ function $db60a6d462053998$export$f4bf8d43c16de704(props, state, ref) {
|
|
|
41
41
|
let { direction: direction } = (0, $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7)();
|
|
42
42
|
// oxlint-disable-next-line react/react-compiler
|
|
43
43
|
let focusManager = (0, $535772f9d2c1f38d$export$c5251b9e124bf29)(ref);
|
|
44
|
-
|
|
44
|
+
// ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so
|
|
45
|
+
// ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.
|
|
46
|
+
let flipDirection = direction === 'rtl';
|
|
45
47
|
let { keyboardProps: keyboardProps } = (0, $8296dad1a4c5e0dc$export$8f71654801c2f7cd)({
|
|
46
48
|
shortcuts: {
|
|
47
49
|
ArrowRight: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAsBD,MAAM,2CAAqB;IACzB,MAAM;IACN,QAAQ;IACR,UAAU;AACZ;AAqCO,SAAS,0CACd,KAA8B,EAC9B,KAAmB,EACnB,GAAuC;IAEvC,IAAI,cAAC,UAAU,eAAE,cAAc,cAA4B,GAAG;IAE9D,IAAI,CAAC,aAAa,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IAC3C,CAAA,GAAA,yCAAc,EAAE;QACd,aAAa,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,QAAQ,mBAAkB;IACtF,GAAG;QAAC;KAAI;IAER,IAAI,UAAU;WAAI,MAAM,UAAU,CAAC,OAAO;KAAG;IAC7C,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA,MAAO,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,OAC/C,aAAa;IAGf,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAQ;IAC1B,gDAAgD;IAChD,IAAI,eAAe,CAAA,GAAA,wCAAiB,EAAE;IACtC,IAAI,gBAAgB,cAAc
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAsBD,MAAM,2CAAqB;IACzB,MAAM;IACN,QAAQ;IACR,UAAU;AACZ;AAqCO,SAAS,0CACd,KAA8B,EAC9B,KAAmB,EACnB,GAAuC;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I,EAAE;kBAC3C;YACA,oBAAoB,SAAS,YAAY,cAAc;YACvD,iBAAiB;YACjB,GAAG,aAAa;QAClB;IACF;AACF","sources":["packages/react-aria/src/actiongroup/useActionGroup.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 */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n FocusableElement,\n ItemElement,\n ItemRenderer,\n Key,\n MultipleSelection,\n Orientation,\n RefObject\n} from '@react-types/shared';\nimport {createFocusManager} from '../focus/FocusScope';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {ListState} from 'react-stately/useListState';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useState} from 'react';\n\nconst BUTTON_GROUP_ROLES = {\n none: 'toolbar',\n single: 'radiogroup',\n multiple: 'toolbar'\n};\n\n// Not extending CollectionBase to avoid async loading props\nexport interface ActionGroupProps<T> extends MultipleSelection {\n /**\n * The axis the ActionGroup should align with.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * An list of `Item` elements or a function. If the latter, a list of items must be provided using\n * the `items` prop.\n */\n children: ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;\n /** A list of items to display as children. Must be used with a function as the sole child. */\n items?: Iterable<T>;\n /** A list of keys to disable. */\n disabledKeys?: Iterable<Key>;\n /**\n * Whether the ActionGroup is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean;\n /**\n * Invoked when an action is taken on a child. Especially useful when `selectionMode` is none.\n * The sole argument `key` is the key for the item.\n */\n onAction?: (key: Key) => void;\n}\n\nexport interface AriaActionGroupProps<T> extends ActionGroupProps<T>, DOMProps, AriaLabelingProps {}\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes;\n}\n\nexport function useActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n ref: RefObject<FocusableElement | null>\n): ActionGroupAria {\n let {isDisabled, orientation = 'horizontal' as Orientation} = props;\n\n let [isInToolbar, setInToolbar] = useState(false);\n useLayoutEffect(() => {\n setInToolbar(!!(ref.current && ref.current.parentElement?.closest('[role=\"toolbar\"]')));\n }, [ref]);\n\n let allKeys = [...state.collection.getKeys()];\n if (!allKeys.some(key => !state.disabledKeys.has(key))) {\n isDisabled = true;\n }\n\n let {direction} = useLocale();\n // oxlint-disable-next-line react/react-compiler\n let focusManager = createFocusManager(ref);\n // ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so\n // ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.\n let flipDirection = direction === 'rtl';\n let {keyboardProps} = useKeyboard({\n shortcuts: {\n ArrowRight: () => {\n if (flipDirection) {\n focusManager.focusPrevious({wrap: true});\n } else {\n focusManager.focusNext({wrap: true});\n }\n },\n ArrowDown: () => {\n focusManager.focusNext({wrap: true});\n },\n ArrowLeft: () => {\n if (flipDirection) {\n focusManager.focusNext({wrap: true});\n } else {\n focusManager.focusPrevious({wrap: true});\n }\n },\n ArrowUp: () => {\n focusManager.focusPrevious({wrap: true});\n }\n },\n allowRepeats: true\n });\n\n let role: string | undefined = BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];\n if (isInToolbar && role === 'toolbar') {\n role = 'group';\n }\n return {\n actionGroupProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n 'aria-orientation': role === 'toolbar' ? orientation : undefined,\n 'aria-disabled': isDisabled,\n ...keyboardProps\n }\n };\n}\n"],"names":[],"version":3,"file":"useActionGroup.mjs.map"}
|
|
@@ -51,7 +51,7 @@ function $c552d0e45aac5890$export$87e0539f600c24e5(props, state, ref) {
|
|
|
51
51
|
}
|
|
52
52
|
state.setDragging(false);
|
|
53
53
|
if (!state.anchorDate) return;
|
|
54
|
-
let target = e
|
|
54
|
+
let target = (0, $da02ee888921bc9e$exports.getEventTarget)(e);
|
|
55
55
|
if (ref.current && (0, $da02ee888921bc9e$exports.isFocusWithin)(ref.current) && (!(0, $da02ee888921bc9e$exports.nodeContains)(ref.current, target) || !target.closest('button, [role="button"]'))) commitBehaviorMapping[commitBehavior]();
|
|
56
56
|
};
|
|
57
57
|
(0, $6e76e65001bbcda2$exports.useEvent)(windowRef, 'pointerup', endDragging);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA6BM,SAAS,0CACd,KAAgC,EAChC,KAAyB,EACzB,GAAuC;IAEvC,IAAI,kBAAC,iBAAiB,UAAU,GAAG,YAAW,GAAG;IACjD,IAAI,MAAM,CAAA,GAAA,yCAAc,EAAE,YAAY;IAEtC,6EAA6E;IAC7E,iDAAiD;IACjD,iDAAiD;IACjD,iFAAiF;IACjF,gFAAgF;IAChF,iEAAiE;IACjE,IAAI,iBAAiB,CAAA,GAAA,mBAAK,EAAE;IAC5B,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE,OAAO,WAAW,cAAc,SAAS;IAChE,CAAA,GAAA,kCAAO,EAAE,WAAW,eAAe,CAAA;QACjC,eAAe,OAAO,GAAG,EAAE,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK;IACzD;IAEA,MAAM,wBAAwB;QAC5B,OAAO,IAAM,MAAM,cAAc;QACjC,OAAO,IAAM,MAAM,aAAa,CAAC;QACjC,QAAQ,IAAM,MAAM,eAAe;IACrC;IAEA,mHAAmH;IACnH,sEAAsE;IACtE,IAAI,cAAc,CAAC;QACjB,IAAI,eAAe,OAAO,EAAE;YAC1B,eAAe,OAAO,GA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EjC,iEAAiE;IACjE,uCAAuC;IACvC,gDAAgD;IAChD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAA;QACzB,IAAI,CAAC,IAAI,OAAO,EACd;QAGF,IAAI,AAAC,CAAA,CAAC,EAAE,aAAa,IAAI,CAAC,CAAA,GAAA,sCAAW,EAAE,IAAI,OAAO,EAAE,EAAE,aAAa,CAAA,KAAM,MAAM,UAAU,EACvF,qBAAqB,CAAC,eAAe;IAEzC;IAEA,yCAAyC;IACzC,CAAA,GAAA,kCAAO,EACL,KACA,aACA,CAAA;QACE,IAAI,MAAM,UAAU,EAClB,EAAE,cAAc;IAEpB,GACA;QAAC,SAAS;QAAO,SAAS;IAAI;IAGhC,OAAO;AACT","sources":["packages/react-aria/src/calendar/useRangeCalendar.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 */\n\nimport {AriaLabelingProps, DOMProps, FocusableElement, RefObject} from '@react-types/shared';\nimport {CalendarAria, useCalendarBase} from './useCalendarBase';\nimport {DateValue, RangeCalendarState} from 'react-stately/useRangeCalendarState';\nimport {getEventTarget, isFocusWithin, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {RangeCalendarProps} from 'react-stately/useRangeCalendarState';\nimport {useEvent} from '../utils/useEvent';\nimport {useRef} from 'react';\n\nexport interface AriaRangeCalendarProps<T extends DateValue>\n extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {\n /**\n * Controls the behavior when a pointer is released outside the calendar or a blur occurs mid\n * selection:\n *\n * - `clear`: clear the currently selected range of dates.\n * - `reset`: reset the selection to the previously selected range of dates.\n * - `select`: select the currently hovered range of dates.\n *\n * @default 'select'\n */\n commitBehavior?: 'clear' | 'reset' | 'select';\n}\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar component. A range\n * calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendar<T extends DateValue>(\n props: AriaRangeCalendarProps<T>,\n state: RangeCalendarState,\n ref: RefObject<FocusableElement | null>\n): CalendarAria {\n let {commitBehavior = 'select', ...otherProps} = props;\n let res = useCalendarBase(otherProps, state);\n\n // We need to ignore virtual pointer events from VoiceOver due to these bugs.\n // https://bugs.webkit.org/show_bug.cgi?id=222627\n // https://bugs.webkit.org/show_bug.cgi?id=223202\n // usePress also does this and waits for the following click event before firing.\n // We need to match that here otherwise this will fire before the press event in\n // useCalendarCell, causing range selection to not work properly.\n let isVirtualClick = useRef(false);\n let windowRef = useRef(typeof window !== 'undefined' ? window : null);\n useEvent(windowRef, 'pointerdown', e => {\n isVirtualClick.current = e.width === 0 && e.height === 0;\n });\n\n const commitBehaviorMapping = {\n clear: () => state.clearSelection(),\n reset: () => state.setAnchorDate(null),\n select: () => state.commitSelection()\n };\n\n // Execute method corresponding to `commitBehavior` when pressing or releasing a pointer outside the calendar body,\n // except when pressing the next or previous buttons to switch months.\n let endDragging = (e: PointerEvent) => {\n if (isVirtualClick.current) {\n isVirtualClick.current = false;\n return;\n }\n\n state.setDragging(false);\n if (!state.anchorDate) {\n return;\n }\n\n let target = getEventTarget(e) as Element;\n if (\n ref.current &&\n isFocusWithin(ref.current) &&\n (!nodeContains(ref.current, target) || !target.closest('button, [role=\"button\"]'))\n ) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n useEvent(windowRef, 'pointerup', endDragging);\n\n // Also execute method corresponding to `commitBehavior` on blur,\n // e.g. tabbing away from the calendar.\n // oxlint-disable-next-line react/react-compiler\n res.calendarProps.onBlur = e => {\n if (!ref.current) {\n return;\n }\n\n if ((!e.relatedTarget || !nodeContains(ref.current, e.relatedTarget)) && state.anchorDate) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n // Prevent touch scrolling while dragging\n useEvent(\n ref,\n 'touchmove',\n e => {\n if (state.isDragging) {\n e.preventDefault();\n }\n },\n {passive: false, capture: true}\n );\n\n return res;\n}\n"],"names":[],"version":3,"file":"useRangeCalendar.cjs.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useCalendarBase as $f9fc7ddb24f737a3$export$d652b3ea2d672d5b} from "./useCalendarBase.js";
|
|
2
|
-
import {isFocusWithin as $d8ac7ed472840322$export$b4f377a2b6254582, nodeContains as $d8ac7ed472840322$export$4282f70798064fe0} from "../utils/shadowdom/DOMFunctions.js";
|
|
2
|
+
import {getEventTarget as $d8ac7ed472840322$export$e58f029f0fbfdb29, isFocusWithin as $d8ac7ed472840322$export$b4f377a2b6254582, nodeContains as $d8ac7ed472840322$export$4282f70798064fe0} from "../utils/shadowdom/DOMFunctions.js";
|
|
3
3
|
import {useEvent as $c3cab330536504ec$export$90fc3a17d93f704c} from "../utils/useEvent.js";
|
|
4
4
|
import {useRef as $3QF1w$useRef} from "react";
|
|
5
5
|
|
|
@@ -45,7 +45,7 @@ function $6be926a37aeba1bf$export$87e0539f600c24e5(props, state, ref) {
|
|
|
45
45
|
}
|
|
46
46
|
state.setDragging(false);
|
|
47
47
|
if (!state.anchorDate) return;
|
|
48
|
-
let target = e
|
|
48
|
+
let target = (0, $d8ac7ed472840322$export$e58f029f0fbfdb29)(e);
|
|
49
49
|
if (ref.current && (0, $d8ac7ed472840322$export$b4f377a2b6254582)(ref.current) && (!(0, $d8ac7ed472840322$export$4282f70798064fe0)(ref.current, target) || !target.closest('button, [role="button"]'))) commitBehaviorMapping[commitBehavior]();
|
|
50
50
|
};
|
|
51
51
|
(0, $c3cab330536504ec$export$90fc3a17d93f704c)(windowRef, 'pointerup', endDragging);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA6BM,S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AAE,WAAW,eAAe,CAAA;QACjC,eAAe,OAAO,GAAG,EAAE,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK;IACzD;IAEA,MAAM,wBAAwB;QAC5B,OAAO,IAAM,MAAM,cAAc;QACjC,OAAO,IAAM,MAAM,aAAa,CAAC;QACjC,QAAQ,IAAM,MAAM,eAAe;IACrC;IAEA,mHAAmH;IACnH,sEAAsE;IACtE,IAAI,cAAc,CAAC;QACjB,IAAI,eAAe,OAAO,EAAE;YAC1B,eAAe,OAAO,GAAG;YACzB;QACF;QAEA,MAAM,WAAW,CAAC;QAClB,IAAI,CAAC,MAAM,UAAU,EACnB;QAGF,IAAI,SAAS,CAAA,GAAA,yCAAa,EAAE;QAC5B,IACE,IAAI,OAAO,IACX,CAAA,GAAA,yCAAY,EAAE,IAAI,OAAO,KACxB,CAAA,CAAC,CAAA,GAAA,yCAAW,EAAE,IAAI,OAAO,EAAE,WAAW,CAAC,OAAO,OAAO,CAAC,0BAAyB,GAEhF,qBAAqB,CAAC,eAAe;IAEzC;IAEA,CAAA,GAAA,yCAAO,EAAE,WAAW,aAAa;IAEjC,iEAAiE;IACjE,uCAAuC;IACvC,gDAAgD;IAChD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAA;QACzB,IAAI,CAAC,IAAI,OAAO,EACd;QAGF,IAAI,AAAC,CAAA,CAAC,EAAE,aAAa,IAAI,CAAC,CAAA,GAAA,yCAAW,EAAE,IAAI,OAAO,EAAE,EAAE,aAAa,CAAA,KAAM,MAAM,UAAU,EACvF,qBAAqB,CAAC,eAAe;IAEzC;IAEA,yCAAyC;IACzC,CAAA,GAAA,yCAAO,EACL,KACA,aACA,CAAA;QACE,IAAI,MAAM,UAAU,EAClB,EAAE,cAAc;IAEpB,GACA;QAAC,SAAS;QAAO,SAAS;IAAI;IAGhC,OAAO;AACT","sources":["packages/react-aria/src/calendar/useRangeCalendar.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 */\n\nimport {AriaLabelingProps, DOMProps, FocusableElement, RefObject} from '@react-types/shared';\nimport {CalendarAria, useCalendarBase} from './useCalendarBase';\nimport {DateValue, RangeCalendarState} from 'react-stately/useRangeCalendarState';\nimport {getEventTarget, isFocusWithin, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {RangeCalendarProps} from 'react-stately/useRangeCalendarState';\nimport {useEvent} from '../utils/useEvent';\nimport {useRef} from 'react';\n\nexport interface AriaRangeCalendarProps<T extends DateValue>\n extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {\n /**\n * Controls the behavior when a pointer is released outside the calendar or a blur occurs mid\n * selection:\n *\n * - `clear`: clear the currently selected range of dates.\n * - `reset`: reset the selection to the previously selected range of dates.\n * - `select`: select the currently hovered range of dates.\n *\n * @default 'select'\n */\n commitBehavior?: 'clear' | 'reset' | 'select';\n}\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar component. A range\n * calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendar<T extends DateValue>(\n props: AriaRangeCalendarProps<T>,\n state: RangeCalendarState,\n ref: RefObject<FocusableElement | null>\n): CalendarAria {\n let {commitBehavior = 'select', ...otherProps} = props;\n let res = useCalendarBase(otherProps, state);\n\n // We need to ignore virtual pointer events from VoiceOver due to these bugs.\n // https://bugs.webkit.org/show_bug.cgi?id=222627\n // https://bugs.webkit.org/show_bug.cgi?id=223202\n // usePress also does this and waits for the following click event before firing.\n // We need to match that here otherwise this will fire before the press event in\n // useCalendarCell, causing range selection to not work properly.\n let isVirtualClick = useRef(false);\n let windowRef = useRef(typeof window !== 'undefined' ? window : null);\n useEvent(windowRef, 'pointerdown', e => {\n isVirtualClick.current = e.width === 0 && e.height === 0;\n });\n\n const commitBehaviorMapping = {\n clear: () => state.clearSelection(),\n reset: () => state.setAnchorDate(null),\n select: () => state.commitSelection()\n };\n\n // Execute method corresponding to `commitBehavior` when pressing or releasing a pointer outside the calendar body,\n // except when pressing the next or previous buttons to switch months.\n let endDragging = (e: PointerEvent) => {\n if (isVirtualClick.current) {\n isVirtualClick.current = false;\n return;\n }\n\n state.setDragging(false);\n if (!state.anchorDate) {\n return;\n }\n\n let target = getEventTarget(e) as Element;\n if (\n ref.current &&\n isFocusWithin(ref.current) &&\n (!nodeContains(ref.current, target) || !target.closest('button, [role=\"button\"]'))\n ) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n useEvent(windowRef, 'pointerup', endDragging);\n\n // Also execute method corresponding to `commitBehavior` on blur,\n // e.g. tabbing away from the calendar.\n // oxlint-disable-next-line react/react-compiler\n res.calendarProps.onBlur = e => {\n if (!ref.current) {\n return;\n }\n\n if ((!e.relatedTarget || !nodeContains(ref.current, e.relatedTarget)) && state.anchorDate) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n // Prevent touch scrolling while dragging\n useEvent(\n ref,\n 'touchmove',\n e => {\n if (state.isDragging) {\n e.preventDefault();\n }\n },\n {passive: false, capture: true}\n );\n\n return res;\n}\n"],"names":[],"version":3,"file":"useRangeCalendar.js.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useCalendarBase as $4ca33167bdccdd26$export$d652b3ea2d672d5b} from "./useCalendarBase.mjs";
|
|
2
|
-
import {isFocusWithin as $23f2114a1b82827e$export$b4f377a2b6254582, nodeContains as $23f2114a1b82827e$export$4282f70798064fe0} from "../utils/shadowdom/DOMFunctions.mjs";
|
|
2
|
+
import {getEventTarget as $23f2114a1b82827e$export$e58f029f0fbfdb29, isFocusWithin as $23f2114a1b82827e$export$b4f377a2b6254582, nodeContains as $23f2114a1b82827e$export$4282f70798064fe0} from "../utils/shadowdom/DOMFunctions.mjs";
|
|
3
3
|
import {useEvent as $600b3cf69ae46262$export$90fc3a17d93f704c} from "../utils/useEvent.mjs";
|
|
4
4
|
import {useRef as $k0Wxw$useRef} from "react";
|
|
5
5
|
|
|
@@ -45,7 +45,7 @@ function $be0fc2ab732b9d1a$export$87e0539f600c24e5(props, state, ref) {
|
|
|
45
45
|
}
|
|
46
46
|
state.setDragging(false);
|
|
47
47
|
if (!state.anchorDate) return;
|
|
48
|
-
let target = e
|
|
48
|
+
let target = (0, $23f2114a1b82827e$export$e58f029f0fbfdb29)(e);
|
|
49
49
|
if (ref.current && (0, $23f2114a1b82827e$export$b4f377a2b6254582)(ref.current) && (!(0, $23f2114a1b82827e$export$4282f70798064fe0)(ref.current, target) || !target.closest('button, [role="button"]'))) commitBehaviorMapping[commitBehavior]();
|
|
50
50
|
};
|
|
51
51
|
(0, $600b3cf69ae46262$export$90fc3a17d93f704c)(windowRef, 'pointerup', endDragging);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA6BM,SAAS,0CACd,KAAgC,EAChC,KAAyB,EACzB,GAAuC;IAEvC,IAAI,kBAAC,iBAAiB,UAAU,GAAG,YAAW,GAAG;IACjD,IAAI,MAAM,CAAA,GAAA,yCAAc,EAAE,YAAY;IAEtC,6EAA6E;IAC7E,iDAAiD;IACjD,iDAAiD;IACjD,iFAAiF;IACjF,gFAAgF;IAChF,iEAAiE;IACjE,IAAI,iBAAiB,CAAA,GAAA,aAAK,EAAE;IAC5B,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE,OAAO,WAAW,cAAc,SAAS;IAChE,CAAA,GAAA,yCAAO,EAAE,WAAW,eAAe,CAAA;QACjC,eAAe,OAAO,GAAG,EAAE,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK;IACzD;IAEA,MAAM,wBAAwB;QAC5B,OAAO,IAAM,MAAM,cAAc;QACjC,OAAO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,GAAA,yCAAW,EAAE,IAAI,OAAO,EAAE,WAAW,CAAC,OAAO,OAAO,CAAC,0BAAyB,GAEhF,qBAAqB,CAAC,eAAe;IAEzC;IAEA,CAAA,GAAA,yCAAO,EAAE,WAAW,aAAa;IAEjC,iEAAiE;IACjE,uCAAuC;IACvC,gDAAgD;IAChD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAA;QACzB,IAAI,CAAC,IAAI,OAAO,EACd;QAGF,IAAI,AAAC,CAAA,CAAC,EAAE,aAAa,IAAI,CAAC,CAAA,GAAA,yCAAW,EAAE,IAAI,OAAO,EAAE,EAAE,aAAa,CAAA,KAAM,MAAM,UAAU,EACvF,qBAAqB,CAAC,eAAe;IAEzC;IAEA,yCAAyC;IACzC,CAAA,GAAA,yCAAO,EACL,KACA,aACA,CAAA;QACE,IAAI,MAAM,UAAU,EAClB,EAAE,cAAc;IAEpB,GACA;QAAC,SAAS;QAAO,SAAS;IAAI;IAGhC,OAAO;AACT","sources":["packages/react-aria/src/calendar/useRangeCalendar.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 */\n\nimport {AriaLabelingProps, DOMProps, FocusableElement, RefObject} from '@react-types/shared';\nimport {CalendarAria, useCalendarBase} from './useCalendarBase';\nimport {DateValue, RangeCalendarState} from 'react-stately/useRangeCalendarState';\nimport {getEventTarget, isFocusWithin, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {RangeCalendarProps} from 'react-stately/useRangeCalendarState';\nimport {useEvent} from '../utils/useEvent';\nimport {useRef} from 'react';\n\nexport interface AriaRangeCalendarProps<T extends DateValue>\n extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {\n /**\n * Controls the behavior when a pointer is released outside the calendar or a blur occurs mid\n * selection:\n *\n * - `clear`: clear the currently selected range of dates.\n * - `reset`: reset the selection to the previously selected range of dates.\n * - `select`: select the currently hovered range of dates.\n *\n * @default 'select'\n */\n commitBehavior?: 'clear' | 'reset' | 'select';\n}\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar component. A range\n * calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendar<T extends DateValue>(\n props: AriaRangeCalendarProps<T>,\n state: RangeCalendarState,\n ref: RefObject<FocusableElement | null>\n): CalendarAria {\n let {commitBehavior = 'select', ...otherProps} = props;\n let res = useCalendarBase(otherProps, state);\n\n // We need to ignore virtual pointer events from VoiceOver due to these bugs.\n // https://bugs.webkit.org/show_bug.cgi?id=222627\n // https://bugs.webkit.org/show_bug.cgi?id=223202\n // usePress also does this and waits for the following click event before firing.\n // We need to match that here otherwise this will fire before the press event in\n // useCalendarCell, causing range selection to not work properly.\n let isVirtualClick = useRef(false);\n let windowRef = useRef(typeof window !== 'undefined' ? window : null);\n useEvent(windowRef, 'pointerdown', e => {\n isVirtualClick.current = e.width === 0 && e.height === 0;\n });\n\n const commitBehaviorMapping = {\n clear: () => state.clearSelection(),\n reset: () => state.setAnchorDate(null),\n select: () => state.commitSelection()\n };\n\n // Execute method corresponding to `commitBehavior` when pressing or releasing a pointer outside the calendar body,\n // except when pressing the next or previous buttons to switch months.\n let endDragging = (e: PointerEvent) => {\n if (isVirtualClick.current) {\n isVirtualClick.current = false;\n return;\n }\n\n state.setDragging(false);\n if (!state.anchorDate) {\n return;\n }\n\n let target = getEventTarget(e) as Element;\n if (\n ref.current &&\n isFocusWithin(ref.current) &&\n (!nodeContains(ref.current, target) || !target.closest('button, [role=\"button\"]'))\n ) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n useEvent(windowRef, 'pointerup', endDragging);\n\n // Also execute method corresponding to `commitBehavior` on blur,\n // e.g. tabbing away from the calendar.\n // oxlint-disable-next-line react/react-compiler\n res.calendarProps.onBlur = e => {\n if (!ref.current) {\n return;\n }\n\n if ((!e.relatedTarget || !nodeContains(ref.current, e.relatedTarget)) && state.anchorDate) {\n commitBehaviorMapping[commitBehavior]();\n }\n };\n\n // Prevent touch scrolling while dragging\n useEvent(\n ref,\n 'touchmove',\n e => {\n if (state.isDragging) {\n e.preventDefault();\n }\n },\n {passive: false, capture: true}\n );\n\n return res;\n}\n"],"names":[],"version":3,"file":"useRangeCalendar.mjs.map"}
|
|
@@ -3,8 +3,10 @@ var $b4f85e31b7b8044c$exports = require("../interactions/useFocusWithin.cjs");
|
|
|
3
3
|
var $7619b0bd43420560$exports = require("../textfield/useFormattedTextField.cjs");
|
|
4
4
|
var $bbab3903416f8d01$exports = require("../utils/useFormReset.cjs");
|
|
5
5
|
var $7ac82d1fee77eb8a$exports = require("../utils/useId.cjs");
|
|
6
|
+
var $6d2f10bb8b359da5$exports = require("../interactions/useKeyboard.cjs");
|
|
6
7
|
var $c162bca8afbf554a$exports = require("../interactions/useScrollWheel.cjs");
|
|
7
8
|
var $fcf004be7e8533a5$exports = require("../spinbutton/useSpinButton.cjs");
|
|
9
|
+
var $iXcTC$reactdom = require("react-dom");
|
|
8
10
|
var $iXcTC$react = require("react");
|
|
9
11
|
var $iXcTC$reactstatelyprivateformuseFormValidationState = require("react-stately/private/form/useFormValidationState");
|
|
10
12
|
|
|
@@ -33,9 +35,11 @@ $parcel$export(module.exports, "useColorField", function () { return $00801e87d3
|
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
|
|
38
|
+
|
|
39
|
+
|
|
36
40
|
function $00801e87d3dfcae5$export$77e32ca575a28fdf(props, state, ref) {
|
|
37
|
-
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria' } = props;
|
|
38
|
-
let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit } = state;
|
|
41
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria', onKeyDown: onKeyDown, onKeyUp: onKeyUp } = props;
|
|
42
|
+
let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit, commitValidation: commitValidation } = state;
|
|
39
43
|
let inputId = (0, $7ac82d1fee77eb8a$exports.useId)();
|
|
40
44
|
let { spinButtonProps: spinButtonProps } = (0, $fcf004be7e8533a5$exports.useSpinButton)({
|
|
41
45
|
isDisabled: isDisabled,
|
|
@@ -69,6 +73,22 @@ function $00801e87d3dfcae5$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
69
73
|
onScroll: onWheel,
|
|
70
74
|
isDisabled: scrollingDisabled
|
|
71
75
|
}, ref);
|
|
76
|
+
let { keyboardProps: keyboardProps } = (0, $6d2f10bb8b359da5$exports.useKeyboard)({
|
|
77
|
+
isDisabled: isDisabled || isReadOnly,
|
|
78
|
+
shortcuts: {
|
|
79
|
+
Enter: ()=>{
|
|
80
|
+
(0, $iXcTC$reactdom.flushSync)(()=>{
|
|
81
|
+
commit();
|
|
82
|
+
});
|
|
83
|
+
commitValidation();
|
|
84
|
+
return {
|
|
85
|
+
shouldPreventDefault: false
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
onKeyDown: onKeyDown,
|
|
90
|
+
onKeyUp: onKeyUp
|
|
91
|
+
});
|
|
72
92
|
let onChange = (value)=>{
|
|
73
93
|
if (state.validate(value)) state.setInputValue(value);
|
|
74
94
|
};
|
|
@@ -83,10 +103,12 @@ function $00801e87d3dfcae5$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
83
103
|
[(0, $iXcTC$reactstatelyprivateformuseFormValidationState.privateValidationStateProp)]: state,
|
|
84
104
|
type: 'text',
|
|
85
105
|
autoComplete: 'off',
|
|
86
|
-
onChange: onChange
|
|
106
|
+
onChange: onChange,
|
|
107
|
+
onKeyDown: undefined,
|
|
108
|
+
onKeyUp: undefined
|
|
87
109
|
}, state, ref);
|
|
88
110
|
(0, $bbab3903416f8d01$exports.useFormReset)(ref, state.defaultColorValue, state.setColorValue);
|
|
89
|
-
inputProps = (0, $89b39774f3b79dbb$exports.mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
|
|
111
|
+
inputProps = (0, $89b39774f3b79dbb$exports.mergeProps)(keyboardProps, inputProps, spinButtonProps, focusWithinProps, {
|
|
90
112
|
role: 'textbox',
|
|
91
113
|
'aria-valuemax': null,
|
|
92
114
|
'aria-valuemin': null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AA2DM,SAAS,0CACd,KAA0B,EAC1B,KAAsB,EACtB,GAAuC;IAEvC,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,mBACV,eAAe,sBACf,qBAAqB,mBACrB,SAAS,WACT,OAAO,EACR,GAAG;IAEJ,IAAI,cACF,UAAU,cACV,UAAU,aACV,SAAS,aACT,SAAS,kBACT,cAAc,kBACd,cAAc,UACd,MAAM,oBACN,gBAAgB,EACjB,GAAG;IAEJ,IAAI,UAAU,CAAA,GAAA,+BAAI;IAClB,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;oBACpC;oBACA;oBACA;QACA,UAAU;QACV,UAAU;QACV,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,kBAAkB;QAClB,OAAO,aAAa,WAAW,QAAQ,KAAK;QAC5C,WAAW,aAAa,WAAW,QAAQ,CAAC,SAAS;IACvD;IAEA,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC7C,IAAI,oBAAC,g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b,YAAY;QACZ,QAAQ;IACV;IAEA,IAAI,uBAAuB,UACzB,UAAU,CAAC,gBAAgB,GAAG;IAGhC,OAAO;oBACL;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/react-aria/src/color/useColorField.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 */\n\nimport {\n AriaLabelingProps,\n AriaValidationProps,\n DOMAttributes,\n FocusableDOMProps,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {ColorFieldProps, ColorFieldState} from 'react-stately/useColorFieldState';\nimport {flushSync} from 'react-dom';\nimport {InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useState} from 'react';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaColorFieldProps\n extends\n ColorFieldProps,\n AriaLabelingProps,\n FocusableDOMProps,\n Omit<\n TextInputDOMProps,\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'type'\n | 'inputMode'\n | 'autoComplete'\n | 'autoCorrect'\n | 'spellCheck'\n >,\n AriaValidationProps {\n /** Enables or disables changing the value with scroll. */\n isWheelDisabled?: boolean;\n}\n\nexport interface ColorFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the text field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the text field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement | null>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n isWheelDisabled,\n validationBehavior = 'aria',\n onKeyDown,\n onKeyUp\n } = props;\n\n let {\n colorValue,\n inputValue,\n increment,\n decrement,\n incrementToMax,\n decrementToMin,\n commit,\n commitValidation\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xffffff,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let {keyboardProps} = useKeyboard({\n isDisabled: isDisabled || isReadOnly,\n shortcuts: {\n Enter: () => {\n flushSync(() => {\n commit();\n });\n commitValidation();\n return {shouldPreventDefault: false};\n }\n },\n onKeyDown,\n onKeyUp\n });\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let {inputProps, ...otherProps} = useFormattedTextField(\n {\n ...props,\n id: inputId,\n value: inputValue,\n // Intentionally invalid value that will be ignored by onChange during form reset\n // This is handled separately below.\n defaultValue: '!',\n validate: undefined,\n [privateValidationStateProp]: state,\n type: 'text',\n autoComplete: 'off',\n onChange,\n onKeyDown: undefined,\n onKeyUp: undefined\n },\n state,\n ref\n );\n\n useFormReset(ref, state.defaultColorValue, state.setColorValue);\n\n inputProps = mergeProps(keyboardProps, inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n });\n\n if (validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n return {\n inputProps,\n ...otherProps\n };\n}\n"],"names":[],"version":3,"file":"useColorField.cjs.map"}
|
|
@@ -3,8 +3,10 @@ import {useFocusWithin as $b842b95ed9b5d4d5$export$420e68273165f4ec} from "../in
|
|
|
3
3
|
import {useFormattedTextField as $a97100a6dd40f368$export$4f384c9210e583c3} from "../textfield/useFormattedTextField.js";
|
|
4
4
|
import {useFormReset as $5dfd40f1661a7fc3$export$5add1d006293d136} from "../utils/useFormReset.js";
|
|
5
5
|
import {useId as $0292efe68908de6b$export$f680877a34711e37} from "../utils/useId.js";
|
|
6
|
+
import {useKeyboard as $bf74df7506f65576$export$8f71654801c2f7cd} from "../interactions/useKeyboard.js";
|
|
6
7
|
import {useScrollWheel as $387080635b69cb2d$export$2123ff2b87c81ca} from "../interactions/useScrollWheel.js";
|
|
7
8
|
import {useSpinButton as $b36f0efc8d77b16f$export$e908e06f4b8e3402} from "../spinbutton/useSpinButton.js";
|
|
9
|
+
import {flushSync as $j4wZN$flushSync} from "react-dom";
|
|
8
10
|
import {useState as $j4wZN$useState, useCallback as $j4wZN$useCallback} from "react";
|
|
9
11
|
import {privateValidationStateProp as $j4wZN$privateValidationStateProp} from "react-stately/private/form/useFormValidationState";
|
|
10
12
|
|
|
@@ -27,9 +29,11 @@ import {privateValidationStateProp as $j4wZN$privateValidationStateProp} from "r
|
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
|
|
32
|
+
|
|
33
|
+
|
|
30
34
|
function $23951a0914b6cb31$export$77e32ca575a28fdf(props, state, ref) {
|
|
31
|
-
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria' } = props;
|
|
32
|
-
let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit } = state;
|
|
35
|
+
let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria', onKeyDown: onKeyDown, onKeyUp: onKeyUp } = props;
|
|
36
|
+
let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit, commitValidation: commitValidation } = state;
|
|
33
37
|
let inputId = (0, $0292efe68908de6b$export$f680877a34711e37)();
|
|
34
38
|
let { spinButtonProps: spinButtonProps } = (0, $b36f0efc8d77b16f$export$e908e06f4b8e3402)({
|
|
35
39
|
isDisabled: isDisabled,
|
|
@@ -63,6 +67,22 @@ function $23951a0914b6cb31$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
63
67
|
onScroll: onWheel,
|
|
64
68
|
isDisabled: scrollingDisabled
|
|
65
69
|
}, ref);
|
|
70
|
+
let { keyboardProps: keyboardProps } = (0, $bf74df7506f65576$export$8f71654801c2f7cd)({
|
|
71
|
+
isDisabled: isDisabled || isReadOnly,
|
|
72
|
+
shortcuts: {
|
|
73
|
+
Enter: ()=>{
|
|
74
|
+
(0, $j4wZN$flushSync)(()=>{
|
|
75
|
+
commit();
|
|
76
|
+
});
|
|
77
|
+
commitValidation();
|
|
78
|
+
return {
|
|
79
|
+
shouldPreventDefault: false
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
onKeyDown: onKeyDown,
|
|
84
|
+
onKeyUp: onKeyUp
|
|
85
|
+
});
|
|
66
86
|
let onChange = (value)=>{
|
|
67
87
|
if (state.validate(value)) state.setInputValue(value);
|
|
68
88
|
};
|
|
@@ -77,10 +97,12 @@ function $23951a0914b6cb31$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
77
97
|
[(0, $j4wZN$privateValidationStateProp)]: state,
|
|
78
98
|
type: 'text',
|
|
79
99
|
autoComplete: 'off',
|
|
80
|
-
onChange: onChange
|
|
100
|
+
onChange: onChange,
|
|
101
|
+
onKeyDown: undefined,
|
|
102
|
+
onKeyUp: undefined
|
|
81
103
|
}, state, ref);
|
|
82
104
|
(0, $5dfd40f1661a7fc3$export$5add1d006293d136)(ref, state.defaultColorValue, state.setColorValue);
|
|
83
|
-
inputProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(inputProps, spinButtonProps, focusWithinProps, {
|
|
105
|
+
inputProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(keyboardProps, inputProps, spinButtonProps, focusWithinProps, {
|
|
84
106
|
role: 'textbox',
|
|
85
107
|
'aria-valuemax': null,
|
|
86
108
|
'aria-valuemin': null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AA2DM,SAAS,0CACd,KAA0B,EAC1B,KAAsB,EACtB,GAAuC;IAEvC,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,mBACV,eAAe,sBACf,qBAAqB,mBACrB,SAAS,WACT,OAAO,EACR,GAAG;IAEJ,IAAI,cACF,UAAU,cACV,UAAU,aACV,SAAS,aACT,SAAS,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D;QACE,GAAG,KAAK;QACR,IAAI;QACJ,OAAO;QACP,iFAAiF;QACjF,oCAAoC;QACpC,cAAc;QACd,UAAU;QACV,CAAC,CAAA,GAAA,iCAAyB,EAAE,EAAE;QAC9B,MAAM;QACN,cAAc;kBACd;QACA,WAAW;QACX,SAAS;IACX,GACA,OACA;IAGF,CAAA,GAAA,yCAAW,EAAE,KAAK,MAAM,iBAAiB,EAAE,MAAM,aAAa;IAE9D,aAAa,CAAA,GAAA,yCAAS,EAAE,eAAe,YAAY,iBAAiB,kBAAkB;QACpF,MAAM;QACN,iBAAiB;QACjB,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,aAAa;QACb,YAAY;QACZ,QAAQ;IACV;IAEA,IAAI,uBAAuB,UACzB,UAAU,CAAC,gBAAgB,GAAG;IAGhC,OAAO;oBACL;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/react-aria/src/color/useColorField.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 */\n\nimport {\n AriaLabelingProps,\n AriaValidationProps,\n DOMAttributes,\n FocusableDOMProps,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {ColorFieldProps, ColorFieldState} from 'react-stately/useColorFieldState';\nimport {flushSync} from 'react-dom';\nimport {InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useState} from 'react';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaColorFieldProps\n extends\n ColorFieldProps,\n AriaLabelingProps,\n FocusableDOMProps,\n Omit<\n TextInputDOMProps,\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'type'\n | 'inputMode'\n | 'autoComplete'\n | 'autoCorrect'\n | 'spellCheck'\n >,\n AriaValidationProps {\n /** Enables or disables changing the value with scroll. */\n isWheelDisabled?: boolean;\n}\n\nexport interface ColorFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the text field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the text field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement | null>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n isWheelDisabled,\n validationBehavior = 'aria',\n onKeyDown,\n onKeyUp\n } = props;\n\n let {\n colorValue,\n inputValue,\n increment,\n decrement,\n incrementToMax,\n decrementToMin,\n commit,\n commitValidation\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xffffff,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let {keyboardProps} = useKeyboard({\n isDisabled: isDisabled || isReadOnly,\n shortcuts: {\n Enter: () => {\n flushSync(() => {\n commit();\n });\n commitValidation();\n return {shouldPreventDefault: false};\n }\n },\n onKeyDown,\n onKeyUp\n });\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let {inputProps, ...otherProps} = useFormattedTextField(\n {\n ...props,\n id: inputId,\n value: inputValue,\n // Intentionally invalid value that will be ignored by onChange during form reset\n // This is handled separately below.\n defaultValue: '!',\n validate: undefined,\n [privateValidationStateProp]: state,\n type: 'text',\n autoComplete: 'off',\n onChange,\n onKeyDown: undefined,\n onKeyUp: undefined\n },\n state,\n ref\n );\n\n useFormReset(ref, state.defaultColorValue, state.setColorValue);\n\n inputProps = mergeProps(keyboardProps, inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n });\n\n if (validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n return {\n inputProps,\n ...otherProps\n };\n}\n"],"names":[],"version":3,"file":"useColorField.js.map"}
|