@react-aria/actiongroup 3.7.24 → 3.8.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.
package/dist/import.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import {useActionGroup as $304ac34015d4535d$export$f4bf8d43c16de704} from "./useActionGroup.mjs";
2
- import {useActionGroupItem as $f0ac0fb73c3ec062$export$9597202bd3099a29} from "./useActionGroupItem.mjs";
1
+ import {useActionGroup as $50e75ba24adb9c4c$re_export$useActionGroup} from "react-aria/private/actiongroup/useActionGroup";
2
+ import {useActionGroupItem as $50e75ba24adb9c4c$re_export$useActionGroupItem} from "react-aria/private/actiongroup/useActionGroupItem";
3
3
 
4
4
  /*
5
5
  * Copyright 2020 Adobe. All rights reserved.
6
6
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License. You may obtain a copy
8
8
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
  * Unless required by applicable law or agreed to in writing, software distributed under
11
11
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
12
  * OF ANY KIND, either express or implied. See the License for the specific language
@@ -15,5 +15,5 @@ import {useActionGroupItem as $f0ac0fb73c3ec062$export$9597202bd3099a29} from ".
15
15
 
16
16
 
17
17
 
18
- export {$304ac34015d4535d$export$f4bf8d43c16de704 as useActionGroup, $f0ac0fb73c3ec062$export$9597202bd3099a29 as useActionGroupItem};
18
+ export {$50e75ba24adb9c4c$re_export$useActionGroup as useActionGroup, $50e75ba24adb9c4c$re_export$useActionGroupItem as useActionGroupItem};
19
19
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,19 +1,19 @@
1
- var $ceb684449a137553$exports = require("./useActionGroup.main.js");
2
- var $44b92e5de834b44e$exports = require("./useActionGroupItem.main.js");
1
+ var $hICJ1$reactariaprivateactiongroupuseActionGroup = require("react-aria/private/actiongroup/useActionGroup");
2
+ var $hICJ1$reactariaprivateactiongroupuseActionGroupItem = require("react-aria/private/actiongroup/useActionGroupItem");
3
3
 
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
6
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
7
  }
8
8
 
9
- $parcel$export(module.exports, "useActionGroup", () => $ceb684449a137553$exports.useActionGroup);
10
- $parcel$export(module.exports, "useActionGroupItem", () => $44b92e5de834b44e$exports.useActionGroupItem);
9
+ $parcel$export(module.exports, "useActionGroup", function () { return $hICJ1$reactariaprivateactiongroupuseActionGroup.useActionGroup; });
10
+ $parcel$export(module.exports, "useActionGroupItem", function () { return $hICJ1$reactariaprivateactiongroupuseActionGroupItem.useActionGroupItem; });
11
11
  /*
12
12
  * Copyright 2020 Adobe. All rights reserved.
13
13
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
14
  * you may not use this file except in compliance with the License. You may obtain a copy
15
15
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
16
+ *
17
17
  * Unless required by applicable law or agreed to in writing, software distributed under
18
18
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
19
  * OF ANY KIND, either express or implied. See the License for the specific language
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/actiongroup/src/index.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 */\nexport type {ActionGroupAria} from './useActionGroup';\nexport {useActionGroup} from './useActionGroup';\nexport {useActionGroupItem} from './useActionGroupItem';\nexport type {AriaActionGroupProps} from '@react-types/actiongroup';\nexport type {ActionGroupItemAria, AriaActionGroupItemProps} from './useActionGroupItem';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/actiongroup/src/index.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 */\nexport {useActionGroup} from 'react-aria/private/actiongroup/useActionGroup';\n\nexport {useActionGroupItem} from 'react-aria/private/actiongroup/useActionGroupItem';\nexport type {\n ActionGroupProps,\n AriaActionGroupProps,\n ActionGroupAria\n} from 'react-aria/private/actiongroup/useActionGroup';\nexport type {\n ActionGroupItemAria,\n AriaActionGroupItemProps\n} from 'react-aria/private/actiongroup/useActionGroupItem';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,12 +1,12 @@
1
- import {useActionGroup as $304ac34015d4535d$export$f4bf8d43c16de704} from "./useActionGroup.module.js";
2
- import {useActionGroupItem as $f0ac0fb73c3ec062$export$9597202bd3099a29} from "./useActionGroupItem.module.js";
1
+ import {useActionGroup as $50e75ba24adb9c4c$re_export$useActionGroup} from "react-aria/private/actiongroup/useActionGroup";
2
+ import {useActionGroupItem as $50e75ba24adb9c4c$re_export$useActionGroupItem} from "react-aria/private/actiongroup/useActionGroupItem";
3
3
 
4
4
  /*
5
5
  * Copyright 2020 Adobe. All rights reserved.
6
6
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License. You may obtain a copy
8
8
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
  * Unless required by applicable law or agreed to in writing, software distributed under
11
11
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
12
  * OF ANY KIND, either express or implied. See the License for the specific language
@@ -15,5 +15,5 @@ import {useActionGroupItem as $f0ac0fb73c3ec062$export$9597202bd3099a29} from ".
15
15
 
16
16
 
17
17
 
18
- export {$304ac34015d4535d$export$f4bf8d43c16de704 as useActionGroup, $f0ac0fb73c3ec062$export$9597202bd3099a29 as useActionGroupItem};
18
+ export {$50e75ba24adb9c4c$re_export$useActionGroup as useActionGroup, $50e75ba24adb9c4c$re_export$useActionGroupItem as useActionGroupItem};
19
19
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/actiongroup/src/index.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 */\nexport type {ActionGroupAria} from './useActionGroup';\nexport {useActionGroup} from './useActionGroup';\nexport {useActionGroupItem} from './useActionGroupItem';\nexport type {AriaActionGroupProps} from '@react-types/actiongroup';\nexport type {ActionGroupItemAria, AriaActionGroupItemProps} from './useActionGroupItem';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/actiongroup/src/index.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 */\nexport {useActionGroup} from 'react-aria/private/actiongroup/useActionGroup';\n\nexport {useActionGroupItem} from 'react-aria/private/actiongroup/useActionGroupItem';\nexport type {\n ActionGroupProps,\n AriaActionGroupProps,\n ActionGroupAria\n} from 'react-aria/private/actiongroup/useActionGroup';\nexport type {\n ActionGroupItemAria,\n AriaActionGroupItemProps\n} from 'react-aria/private/actiongroup/useActionGroupItem';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,4 @@
1
+ export { useActionGroup } from 'react-aria/private/actiongroup/useActionGroup';
2
+ export { useActionGroupItem } from 'react-aria/private/actiongroup/useActionGroupItem';
3
+ export type { ActionGroupProps, AriaActionGroupProps, ActionGroupAria } from 'react-aria/private/actiongroup/useActionGroup';
4
+ export type { ActionGroupItemAria, AriaActionGroupItemProps } from 'react-aria/private/actiongroup/useActionGroupItem';
package/package.json CHANGED
@@ -1,46 +1,47 @@
1
1
  {
2
2
  "name": "@react-aria/actiongroup",
3
- "version": "3.7.24",
3
+ "version": "3.8.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
- "main": "dist/main.js",
7
- "module": "dist/module.js",
8
- "exports": {
9
- "source": "./src/index.ts",
10
- "types": [
11
- "./dist/types.d.ts",
12
- "./src/index.ts"
13
- ],
14
- "import": "./dist/import.mjs",
15
- "require": "./dist/main.js"
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/adobe/react-spectrum"
16
9
  },
17
- "types": "dist/types.d.ts",
18
10
  "source": "src/index.ts",
19
11
  "files": [
20
12
  "dist",
21
13
  "src"
22
14
  ],
23
15
  "sideEffects": false,
24
- "repository": {
25
- "type": "git",
26
- "url": "https://github.com/adobe/react-spectrum"
16
+ "main": "dist/main.js",
17
+ "module": "dist/module.js",
18
+ "types": "dist/types/src/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "source": "./src/index.ts",
22
+ "types": "./dist/types/src/index.d.ts",
23
+ "import": "./dist/import.mjs",
24
+ "require": "./dist/main.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
27
30
  },
28
31
  "dependencies": {
29
- "@react-aria/focus": "^3.21.5",
30
- "@react-aria/i18n": "^3.12.16",
31
- "@react-aria/interactions": "^3.27.1",
32
- "@react-aria/utils": "^3.33.1",
33
- "@react-stately/list": "^3.13.4",
34
- "@react-types/actiongroup": "^3.4.23",
35
- "@react-types/shared": "^3.33.1",
36
- "@swc/helpers": "^0.5.0"
32
+ "@swc/helpers": "^0.5.0",
33
+ "react-aria": "^3.48.0"
34
+ },
35
+ "devDependencies": {
36
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
37
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
37
38
  },
38
39
  "peerDependencies": {
39
40
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
40
41
  "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
41
42
  },
42
- "publishConfig": {
43
- "access": "public"
43
+ "targets": {
44
+ "types": false
44
45
  },
45
- "gitHead": "8df187370053aa35f553cb388ad670f65e1ab371"
46
+ "gitHead": "3577a20859b9585a000010c720f6ee39c1c588cc"
46
47
  }
package/src/index.ts CHANGED
@@ -3,14 +3,21 @@
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
6
+ *
7
7
  * Unless required by applicable law or agreed to in writing, software distributed under
8
8
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- export type {ActionGroupAria} from './useActionGroup';
13
- export {useActionGroup} from './useActionGroup';
14
- export {useActionGroupItem} from './useActionGroupItem';
15
- export type {AriaActionGroupProps} from '@react-types/actiongroup';
16
- export type {ActionGroupItemAria, AriaActionGroupItemProps} from './useActionGroupItem';
12
+ export {useActionGroup} from 'react-aria/private/actiongroup/useActionGroup';
13
+
14
+ export {useActionGroupItem} from 'react-aria/private/actiongroup/useActionGroupItem';
15
+ export type {
16
+ ActionGroupProps,
17
+ AriaActionGroupProps,
18
+ ActionGroupAria
19
+ } from 'react-aria/private/actiongroup/useActionGroup';
20
+ export type {
21
+ ActionGroupItemAria,
22
+ AriaActionGroupItemProps
23
+ } from 'react-aria/private/actiongroup/useActionGroupItem';
package/dist/types.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { AriaActionGroupProps } from "@react-types/actiongroup";
2
- import { DOMAttributes, FocusableElement, RefObject, Key } from "@react-types/shared";
3
- import { ListState } from "@react-stately/list";
4
- import { PressProps } from "@react-aria/interactions";
5
- export interface ActionGroupAria {
6
- actionGroupProps: DOMAttributes;
7
- }
8
- export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria;
9
- export interface AriaActionGroupItemProps {
10
- key: Key;
11
- }
12
- export interface ActionGroupItemAria {
13
- buttonProps: DOMAttributes & PressProps;
14
- }
15
- export function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria;
16
- export type { AriaActionGroupProps } from '@react-types/actiongroup';
17
-
18
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;AA0BA;IACE,gBAAgB,EAAE,aAAa,CAAA;CAChC;AAED,+BAA+B,CAAC,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,eAAe,CA6D/I;ACzED;IACE,GAAG,EAAE,GAAG,CAAA;CACT;AAED;IACE,WAAW,EAAE,aAAa,GAAG,UAAU,CAAA;CACxC;AASD,mCAAmC,CAAC,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,mBAAmB,CAoCzJ;ACvDD,YAAY,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC","sources":["packages/@react-aria/actiongroup/src/packages/@react-aria/actiongroup/src/useActionGroup.ts","packages/@react-aria/actiongroup/src/packages/@react-aria/actiongroup/src/useActionGroupItem.ts","packages/@react-aria/actiongroup/src/packages/@react-aria/actiongroup/src/index.ts","packages/@react-aria/actiongroup/src/index.ts"],"sourcesContent":[null,null,null,"/*\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 */\nexport type {ActionGroupAria} from './useActionGroup';\nexport {useActionGroup} from './useActionGroup';\nexport {useActionGroupItem} from './useActionGroupItem';\nexport type {AriaActionGroupProps} from '@react-types/actiongroup';\nexport type {ActionGroupItemAria, AriaActionGroupItemProps} from './useActionGroupItem';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1,90 +0,0 @@
1
- var $aCPyD$reactariafocus = require("@react-aria/focus");
2
- var $aCPyD$reactariautils = require("@react-aria/utils");
3
- var $aCPyD$react = require("react");
4
- var $aCPyD$reactariai18n = require("@react-aria/i18n");
5
-
6
-
7
- function $parcel$export(e, n, v, s) {
8
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
- }
10
-
11
- $parcel$export(module.exports, "useActionGroup", () => $ceb684449a137553$export$f4bf8d43c16de704);
12
- /*
13
- * Copyright 2020 Adobe. All rights reserved.
14
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License. You may obtain a copy
16
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software distributed under
19
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
- * OF ANY KIND, either express or implied. See the License for the specific language
21
- * governing permissions and limitations under the License.
22
- */
23
-
24
-
25
-
26
- const $ceb684449a137553$var$BUTTON_GROUP_ROLES = {
27
- 'none': 'toolbar',
28
- 'single': 'radiogroup',
29
- 'multiple': 'toolbar'
30
- };
31
- function $ceb684449a137553$export$f4bf8d43c16de704(props, state, ref) {
32
- let { isDisabled: isDisabled, orientation: orientation = 'horizontal' } = props;
33
- let [isInToolbar, setInToolbar] = (0, $aCPyD$react.useState)(false);
34
- (0, $aCPyD$reactariautils.useLayoutEffect)(()=>{
35
- var _ref_current_parentElement;
36
- setInToolbar(!!(ref.current && ((_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.closest('[role="toolbar"]'))));
37
- }, [
38
- ref
39
- ]);
40
- let allKeys = [
41
- ...state.collection.getKeys()
42
- ];
43
- if (!allKeys.some((key)=>!state.disabledKeys.has(key))) isDisabled = true;
44
- let { direction: direction } = (0, $aCPyD$reactariai18n.useLocale)();
45
- let focusManager = (0, $aCPyD$reactariafocus.createFocusManager)(ref);
46
- let flipDirection = direction === 'rtl' && orientation === 'horizontal';
47
- let onKeyDown = (e)=>{
48
- if (!(0, $aCPyD$reactariautils.nodeContains)(e.currentTarget, (0, $aCPyD$reactariautils.getEventTarget)(e))) return;
49
- switch(e.key){
50
- case 'ArrowRight':
51
- case 'ArrowDown':
52
- e.preventDefault();
53
- e.stopPropagation();
54
- if (e.key === 'ArrowRight' && flipDirection) focusManager.focusPrevious({
55
- wrap: true
56
- });
57
- else focusManager.focusNext({
58
- wrap: true
59
- });
60
- break;
61
- case 'ArrowLeft':
62
- case 'ArrowUp':
63
- e.preventDefault();
64
- e.stopPropagation();
65
- if (e.key === 'ArrowLeft' && flipDirection) focusManager.focusNext({
66
- wrap: true
67
- });
68
- else focusManager.focusPrevious({
69
- wrap: true
70
- });
71
- break;
72
- }
73
- };
74
- let role = $ceb684449a137553$var$BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];
75
- if (isInToolbar && role === 'toolbar') role = 'group';
76
- return {
77
- actionGroupProps: {
78
- ...(0, $aCPyD$reactariautils.filterDOMProps)(props, {
79
- labelable: true
80
- }),
81
- role: role,
82
- 'aria-orientation': role === 'toolbar' ? orientation : undefined,
83
- 'aria-disabled': isDisabled,
84
- onKeyDown: onKeyDown
85
- }
86
- };
87
- }
88
-
89
-
90
- //# sourceMappingURL=useActionGroup.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAUD,MAAM,2CAAqB;IACzB,QAAQ;IACR,UAAU;IACV,YAAY;AACd;AAMO,SAAS,0CAAkB,KAA8B,EAAE,KAAmB,EAAE,GAAuC;IAC5H,IAAI,cACF,UAAU,eACV,cAAc,cACf,GAAG;IAEJ,IAAI,CAAC,aAAa,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC3C,CAAA,GAAA,qCAAc,EAAE;YACiB;QAA/B,aAAa,CAAC,CAAE,CAAA,IAAI,OAAO,MAAI,6BAAA,IAAI,OAAO,CAAC,aAAa,cAAzB,iDAAA,2BAA2B,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,8BAAQ;IAC1B,IAAI,eAAe,CAAA,GAAA,wCAAiB,EAAE;IACtC,IAAI,gBAAgB,cAAc,SAAS,gBAAgB;IAC3D,IAAI,YAAkC,CAAC;QACrC,IAAI,CAAC,CAAA,GAAA,kCAAW,EAAE,EAAE,aAAa,EAAE,CAAA,GAAA,oCAAa,EAAE,KAChD;QAGF,OAAQ,EAAE,GAAG;YACX,KAAK;YACL,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,EAAE,GAAG,KAAK,gBAAgB,eAC5B,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;qBAEtC,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;gBAEpC;YACF,KAAK;YACL,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,EAAE,GAAG,KAAK,eAAe,eAC3B,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;qBAElC,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;gBAExC;QACJ;IACF;IAEA,IAAI,OAA2B,wCAAkB,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvF,IAAI,eAAe,SAAS,WAC1B,OAAO;IAET,OAAO;QACL,kBAAkB;YAChB,GAAG,CAAA,GAAA,oCAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,oBAAoB,SAAS,YAAY,cAAc;YACvD,iBAAiB;uBACjB;QACF;IACF;AACF","sources":["packages/@react-aria/actiongroup/src/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 {AriaActionGroupProps} from '@react-types/actiongroup';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DOMAttributes, FocusableElement, Orientation, RefObject} from '@react-types/shared';\nimport {filterDOMProps, getEventTarget, nodeContains, useLayoutEffect} from '@react-aria/utils';\nimport {KeyboardEventHandler, useState} from 'react';\nimport {ListState} from '@react-stately/list';\nimport {useLocale} from '@react-aria/i18n';\n\nconst BUTTON_GROUP_ROLES = {\n 'none': 'toolbar',\n 'single': 'radiogroup',\n 'multiple': 'toolbar'\n};\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes\n}\n\nexport function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria {\n let {\n isDisabled,\n orientation = 'horizontal' as Orientation\n } = 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 let focusManager = createFocusManager(ref);\n let flipDirection = direction === 'rtl' && orientation === 'horizontal';\n let onKeyDown: KeyboardEventHandler = (e) => {\n if (!nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n if (e.key === 'ArrowRight' && flipDirection) {\n focusManager.focusPrevious({wrap: true});\n } else {\n focusManager.focusNext({wrap: true});\n }\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n if (e.key === 'ArrowLeft' && flipDirection) {\n focusManager.focusNext({wrap: true});\n } else {\n focusManager.focusPrevious({wrap: true});\n }\n break;\n }\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 onKeyDown\n }\n };\n}\n"],"names":[],"version":3,"file":"useActionGroup.main.js.map"}
@@ -1,85 +0,0 @@
1
- import {createFocusManager as $6SCDv$createFocusManager} from "@react-aria/focus";
2
- import {useLayoutEffect as $6SCDv$useLayoutEffect, nodeContains as $6SCDv$nodeContains, getEventTarget as $6SCDv$getEventTarget, filterDOMProps as $6SCDv$filterDOMProps} from "@react-aria/utils";
3
- import {useState as $6SCDv$useState} from "react";
4
- import {useLocale as $6SCDv$useLocale} from "@react-aria/i18n";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- const $304ac34015d4535d$var$BUTTON_GROUP_ROLES = {
21
- 'none': 'toolbar',
22
- 'single': 'radiogroup',
23
- 'multiple': 'toolbar'
24
- };
25
- function $304ac34015d4535d$export$f4bf8d43c16de704(props, state, ref) {
26
- let { isDisabled: isDisabled, orientation: orientation = 'horizontal' } = props;
27
- let [isInToolbar, setInToolbar] = (0, $6SCDv$useState)(false);
28
- (0, $6SCDv$useLayoutEffect)(()=>{
29
- var _ref_current_parentElement;
30
- setInToolbar(!!(ref.current && ((_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.closest('[role="toolbar"]'))));
31
- }, [
32
- ref
33
- ]);
34
- let allKeys = [
35
- ...state.collection.getKeys()
36
- ];
37
- if (!allKeys.some((key)=>!state.disabledKeys.has(key))) isDisabled = true;
38
- let { direction: direction } = (0, $6SCDv$useLocale)();
39
- let focusManager = (0, $6SCDv$createFocusManager)(ref);
40
- let flipDirection = direction === 'rtl' && orientation === 'horizontal';
41
- let onKeyDown = (e)=>{
42
- if (!(0, $6SCDv$nodeContains)(e.currentTarget, (0, $6SCDv$getEventTarget)(e))) return;
43
- switch(e.key){
44
- case 'ArrowRight':
45
- case 'ArrowDown':
46
- e.preventDefault();
47
- e.stopPropagation();
48
- if (e.key === 'ArrowRight' && flipDirection) focusManager.focusPrevious({
49
- wrap: true
50
- });
51
- else focusManager.focusNext({
52
- wrap: true
53
- });
54
- break;
55
- case 'ArrowLeft':
56
- case 'ArrowUp':
57
- e.preventDefault();
58
- e.stopPropagation();
59
- if (e.key === 'ArrowLeft' && flipDirection) focusManager.focusNext({
60
- wrap: true
61
- });
62
- else focusManager.focusPrevious({
63
- wrap: true
64
- });
65
- break;
66
- }
67
- };
68
- let role = $304ac34015d4535d$var$BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];
69
- if (isInToolbar && role === 'toolbar') role = 'group';
70
- return {
71
- actionGroupProps: {
72
- ...(0, $6SCDv$filterDOMProps)(props, {
73
- labelable: true
74
- }),
75
- role: role,
76
- 'aria-orientation': role === 'toolbar' ? orientation : undefined,
77
- 'aria-disabled': isDisabled,
78
- onKeyDown: onKeyDown
79
- }
80
- };
81
- }
82
-
83
-
84
- export {$304ac34015d4535d$export$f4bf8d43c16de704 as useActionGroup};
85
- //# sourceMappingURL=useActionGroup.module.js.map
@@ -1,85 +0,0 @@
1
- import {createFocusManager as $6SCDv$createFocusManager} from "@react-aria/focus";
2
- import {useLayoutEffect as $6SCDv$useLayoutEffect, nodeContains as $6SCDv$nodeContains, getEventTarget as $6SCDv$getEventTarget, filterDOMProps as $6SCDv$filterDOMProps} from "@react-aria/utils";
3
- import {useState as $6SCDv$useState} from "react";
4
- import {useLocale as $6SCDv$useLocale} from "@react-aria/i18n";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- const $304ac34015d4535d$var$BUTTON_GROUP_ROLES = {
21
- 'none': 'toolbar',
22
- 'single': 'radiogroup',
23
- 'multiple': 'toolbar'
24
- };
25
- function $304ac34015d4535d$export$f4bf8d43c16de704(props, state, ref) {
26
- let { isDisabled: isDisabled, orientation: orientation = 'horizontal' } = props;
27
- let [isInToolbar, setInToolbar] = (0, $6SCDv$useState)(false);
28
- (0, $6SCDv$useLayoutEffect)(()=>{
29
- var _ref_current_parentElement;
30
- setInToolbar(!!(ref.current && ((_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.closest('[role="toolbar"]'))));
31
- }, [
32
- ref
33
- ]);
34
- let allKeys = [
35
- ...state.collection.getKeys()
36
- ];
37
- if (!allKeys.some((key)=>!state.disabledKeys.has(key))) isDisabled = true;
38
- let { direction: direction } = (0, $6SCDv$useLocale)();
39
- let focusManager = (0, $6SCDv$createFocusManager)(ref);
40
- let flipDirection = direction === 'rtl' && orientation === 'horizontal';
41
- let onKeyDown = (e)=>{
42
- if (!(0, $6SCDv$nodeContains)(e.currentTarget, (0, $6SCDv$getEventTarget)(e))) return;
43
- switch(e.key){
44
- case 'ArrowRight':
45
- case 'ArrowDown':
46
- e.preventDefault();
47
- e.stopPropagation();
48
- if (e.key === 'ArrowRight' && flipDirection) focusManager.focusPrevious({
49
- wrap: true
50
- });
51
- else focusManager.focusNext({
52
- wrap: true
53
- });
54
- break;
55
- case 'ArrowLeft':
56
- case 'ArrowUp':
57
- e.preventDefault();
58
- e.stopPropagation();
59
- if (e.key === 'ArrowLeft' && flipDirection) focusManager.focusNext({
60
- wrap: true
61
- });
62
- else focusManager.focusPrevious({
63
- wrap: true
64
- });
65
- break;
66
- }
67
- };
68
- let role = $304ac34015d4535d$var$BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];
69
- if (isInToolbar && role === 'toolbar') role = 'group';
70
- return {
71
- actionGroupProps: {
72
- ...(0, $6SCDv$filterDOMProps)(props, {
73
- labelable: true
74
- }),
75
- role: role,
76
- 'aria-orientation': role === 'toolbar' ? orientation : undefined,
77
- 'aria-disabled': isDisabled,
78
- onKeyDown: onKeyDown
79
- }
80
- };
81
- }
82
-
83
-
84
- export {$304ac34015d4535d$export$f4bf8d43c16de704 as useActionGroup};
85
- //# sourceMappingURL=useActionGroup.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAUD,MAAM,2CAAqB;IACzB,QAAQ;IACR,UAAU;IACV,YAAY;AACd;AAMO,SAAS,0CAAkB,KAA8B,EAAE,KAAmB,EAAE,GAAuC;IAC5H,IAAI,cACF,UAAU,eACV,cAAc,cACf,GAAG;IAEJ,IAAI,CAAC,aAAa,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IAC3C,CAAA,GAAA,sBAAc,EAAE;YACiB;QAA/B,aAAa,CAAC,CAAE,CAAA,IAAI,OAAO,MAAI,6BAAA,IAAI,OAAO,CAAC,aAAa,cAAzB,iDAAA,2BAA2B,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,gBAAQ;IAC1B,IAAI,eAAe,CAAA,GAAA,yBAAiB,EAAE;IACtC,IAAI,gBAAgB,cAAc,SAAS,gBAAgB;IAC3D,IAAI,YAAkC,CAAC;QACrC,IAAI,CAAC,CAAA,GAAA,mBAAW,EAAE,EAAE,aAAa,EAAE,CAAA,GAAA,qBAAa,EAAE,KAChD;QAGF,OAAQ,EAAE,GAAG;YACX,KAAK;YACL,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,EAAE,GAAG,KAAK,gBAAgB,eAC5B,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;qBAEtC,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;gBAEpC;YACF,KAAK;YACL,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,EAAE,GAAG,KAAK,eAAe,eAC3B,aAAa,SAAS,CAAC;oBAAC,MAAM;gBAAI;qBAElC,aAAa,aAAa,CAAC;oBAAC,MAAM;gBAAI;gBAExC;QACJ;IACF;IAEA,IAAI,OAA2B,wCAAkB,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvF,IAAI,eAAe,SAAS,WAC1B,OAAO;IAET,OAAO;QACL,kBAAkB;YAChB,GAAG,CAAA,GAAA,qBAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,oBAAoB,SAAS,YAAY,cAAc;YACvD,iBAAiB;uBACjB;QACF;IACF;AACF","sources":["packages/@react-aria/actiongroup/src/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 {AriaActionGroupProps} from '@react-types/actiongroup';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DOMAttributes, FocusableElement, Orientation, RefObject} from '@react-types/shared';\nimport {filterDOMProps, getEventTarget, nodeContains, useLayoutEffect} from '@react-aria/utils';\nimport {KeyboardEventHandler, useState} from 'react';\nimport {ListState} from '@react-stately/list';\nimport {useLocale} from '@react-aria/i18n';\n\nconst BUTTON_GROUP_ROLES = {\n 'none': 'toolbar',\n 'single': 'radiogroup',\n 'multiple': 'toolbar'\n};\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes\n}\n\nexport function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria {\n let {\n isDisabled,\n orientation = 'horizontal' as Orientation\n } = 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 let focusManager = createFocusManager(ref);\n let flipDirection = direction === 'rtl' && orientation === 'horizontal';\n let onKeyDown: KeyboardEventHandler = (e) => {\n if (!nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n if (e.key === 'ArrowRight' && flipDirection) {\n focusManager.focusPrevious({wrap: true});\n } else {\n focusManager.focusNext({wrap: true});\n }\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n if (e.key === 'ArrowLeft' && flipDirection) {\n focusManager.focusNext({wrap: true});\n } else {\n focusManager.focusPrevious({wrap: true});\n }\n break;\n }\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 onKeyDown\n }\n };\n}\n"],"names":[],"version":3,"file":"useActionGroup.module.js.map"}
@@ -1,60 +0,0 @@
1
- var $7WRxK$reactariautils = require("@react-aria/utils");
2
- var $7WRxK$react = require("react");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "useActionGroupItem", () => $44b92e5de834b44e$export$9597202bd3099a29);
10
- /*
11
- * Copyright 2020 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
-
22
- const $44b92e5de834b44e$var$BUTTON_ROLES = {
23
- 'none': undefined,
24
- 'single': 'radio',
25
- 'multiple': 'checkbox'
26
- };
27
- function $44b92e5de834b44e$export$9597202bd3099a29(props, state, ref) {
28
- let selectionMode = state.selectionManager.selectionMode;
29
- let buttonProps = {
30
- role: $44b92e5de834b44e$var$BUTTON_ROLES[selectionMode]
31
- };
32
- if (selectionMode !== 'none') {
33
- let isSelected = state.selectionManager.isSelected(props.key);
34
- buttonProps['aria-checked'] = isSelected;
35
- }
36
- let isFocused = props.key === state.selectionManager.focusedKey;
37
- let onRemovedWithFocus = (0, $7WRxK$reactariautils.useEffectEvent)(()=>{
38
- if (isFocused) state.selectionManager.setFocusedKey(null);
39
- });
40
- // If the focused item is removed from the DOM, reset the focused key to null.
41
- (0, $7WRxK$react.useEffect)(()=>{
42
- return ()=>{
43
- onRemovedWithFocus();
44
- };
45
- }, []);
46
- return {
47
- buttonProps: (0, $7WRxK$reactariautils.mergeProps)(buttonProps, {
48
- tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
49
- onFocus () {
50
- state.selectionManager.setFocusedKey(props.key);
51
- },
52
- onPress () {
53
- state.selectionManager.select(props.key);
54
- }
55
- })
56
- };
57
- }
58
-
59
-
60
- //# sourceMappingURL=useActionGroupItem.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAgBD,MAAM,qCAAe;IACnB,QAAQ;IACR,UAAU;IACV,YAAY;AACd;AAGO,SAAS,0CAAsB,KAA+B,EAAE,KAAmB,EAAE,GAAwC;IAClI,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,aAAa;IACxD,IAAI,cAAc;QAChB,MAAM,kCAAY,CAAC,cAAc;IACnC;IAEA,IAAI,kBAAkB,QAAQ;QAC5B,IAAI,aAAa,MAAM,gBAAgB,CAAC,UAAU,CAAC,MAAM,GAAG;QAC5D,WAAW,CAAC,eAAe,GAAG;IAChC;IAEA,IAAI,YAAY,MAAM,GAAG,KAAK,MAAM,gBAAgB,CAAC,UAAU;IAC/D,IAAI,qBAAqB,CAAA,GAAA,oCAAa,EAAE;QACtC,IAAI,WACF,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC;IAEA,8EAA8E;IAC9E,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;YACL;QACF;IACF,GAAG,EAAE;IAEL,OAAO;QACL,aAAa,CAAA,GAAA,gCAAS,EAAE,aAAa;YACnC,UAAU,aAAa,MAAM,gBAAgB,CAAC,UAAU,IAAI,OAAO,IAAI;YACvE;gBACE,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,GAAG;YAChD;YACA;gBACE,MAAM,gBAAgB,CAAC,MAAM,CAAC,MAAM,GAAG;YACzC;QACF;IACF;AACF","sources":["packages/@react-aria/actiongroup/src/useActionGroupItem.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 {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps, useEffectEvent} from '@react-aria/utils';\nimport {PressProps} from '@react-aria/interactions';\nimport {useEffect} from 'react';\n\nexport interface AriaActionGroupItemProps {\n key: Key\n}\n\nexport interface ActionGroupItemAria {\n buttonProps: DOMAttributes & PressProps\n}\n\nconst BUTTON_ROLES = {\n 'none': undefined,\n 'single': 'radio',\n 'multiple': 'checkbox'\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria {\n let selectionMode = state.selectionManager.selectionMode;\n let buttonProps = {\n role: BUTTON_ROLES[selectionMode]\n };\n\n if (selectionMode !== 'none') {\n let isSelected = state.selectionManager.isSelected(props.key);\n buttonProps['aria-checked'] = isSelected;\n }\n\n let isFocused = props.key === state.selectionManager.focusedKey;\n let onRemovedWithFocus = useEffectEvent(() => {\n if (isFocused) {\n state.selectionManager.setFocusedKey(null);\n }\n });\n\n // If the focused item is removed from the DOM, reset the focused key to null.\n useEffect(() => {\n return () => {\n onRemovedWithFocus();\n };\n }, []);\n\n return {\n buttonProps: mergeProps(buttonProps, {\n tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,\n onFocus() {\n state.selectionManager.setFocusedKey(props.key);\n },\n onPress() {\n state.selectionManager.select(props.key);\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useActionGroupItem.main.js.map"}
@@ -1,55 +0,0 @@
1
- import {useEffectEvent as $jllmK$useEffectEvent, mergeProps as $jllmK$mergeProps} from "@react-aria/utils";
2
- import {useEffect as $jllmK$useEffect} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- const $f0ac0fb73c3ec062$var$BUTTON_ROLES = {
17
- 'none': undefined,
18
- 'single': 'radio',
19
- 'multiple': 'checkbox'
20
- };
21
- function $f0ac0fb73c3ec062$export$9597202bd3099a29(props, state, ref) {
22
- let selectionMode = state.selectionManager.selectionMode;
23
- let buttonProps = {
24
- role: $f0ac0fb73c3ec062$var$BUTTON_ROLES[selectionMode]
25
- };
26
- if (selectionMode !== 'none') {
27
- let isSelected = state.selectionManager.isSelected(props.key);
28
- buttonProps['aria-checked'] = isSelected;
29
- }
30
- let isFocused = props.key === state.selectionManager.focusedKey;
31
- let onRemovedWithFocus = (0, $jllmK$useEffectEvent)(()=>{
32
- if (isFocused) state.selectionManager.setFocusedKey(null);
33
- });
34
- // If the focused item is removed from the DOM, reset the focused key to null.
35
- (0, $jllmK$useEffect)(()=>{
36
- return ()=>{
37
- onRemovedWithFocus();
38
- };
39
- }, []);
40
- return {
41
- buttonProps: (0, $jllmK$mergeProps)(buttonProps, {
42
- tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
43
- onFocus () {
44
- state.selectionManager.setFocusedKey(props.key);
45
- },
46
- onPress () {
47
- state.selectionManager.select(props.key);
48
- }
49
- })
50
- };
51
- }
52
-
53
-
54
- export {$f0ac0fb73c3ec062$export$9597202bd3099a29 as useActionGroupItem};
55
- //# sourceMappingURL=useActionGroupItem.module.js.map
@@ -1,55 +0,0 @@
1
- import {useEffectEvent as $jllmK$useEffectEvent, mergeProps as $jllmK$mergeProps} from "@react-aria/utils";
2
- import {useEffect as $jllmK$useEffect} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- const $f0ac0fb73c3ec062$var$BUTTON_ROLES = {
17
- 'none': undefined,
18
- 'single': 'radio',
19
- 'multiple': 'checkbox'
20
- };
21
- function $f0ac0fb73c3ec062$export$9597202bd3099a29(props, state, ref) {
22
- let selectionMode = state.selectionManager.selectionMode;
23
- let buttonProps = {
24
- role: $f0ac0fb73c3ec062$var$BUTTON_ROLES[selectionMode]
25
- };
26
- if (selectionMode !== 'none') {
27
- let isSelected = state.selectionManager.isSelected(props.key);
28
- buttonProps['aria-checked'] = isSelected;
29
- }
30
- let isFocused = props.key === state.selectionManager.focusedKey;
31
- let onRemovedWithFocus = (0, $jllmK$useEffectEvent)(()=>{
32
- if (isFocused) state.selectionManager.setFocusedKey(null);
33
- });
34
- // If the focused item is removed from the DOM, reset the focused key to null.
35
- (0, $jllmK$useEffect)(()=>{
36
- return ()=>{
37
- onRemovedWithFocus();
38
- };
39
- }, []);
40
- return {
41
- buttonProps: (0, $jllmK$mergeProps)(buttonProps, {
42
- tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
43
- onFocus () {
44
- state.selectionManager.setFocusedKey(props.key);
45
- },
46
- onPress () {
47
- state.selectionManager.select(props.key);
48
- }
49
- })
50
- };
51
- }
52
-
53
-
54
- export {$f0ac0fb73c3ec062$export$9597202bd3099a29 as useActionGroupItem};
55
- //# sourceMappingURL=useActionGroupItem.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAgBD,MAAM,qCAAe;IACnB,QAAQ;IACR,UAAU;IACV,YAAY;AACd;AAGO,SAAS,0CAAsB,KAA+B,EAAE,KAAmB,EAAE,GAAwC;IAClI,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,aAAa;IACxD,IAAI,cAAc;QAChB,MAAM,kCAAY,CAAC,cAAc;IACnC;IAEA,IAAI,kBAAkB,QAAQ;QAC5B,IAAI,aAAa,MAAM,gBAAgB,CAAC,UAAU,CAAC,MAAM,GAAG;QAC5D,WAAW,CAAC,eAAe,GAAG;IAChC;IAEA,IAAI,YAAY,MAAM,GAAG,KAAK,MAAM,gBAAgB,CAAC,UAAU;IAC/D,IAAI,qBAAqB,CAAA,GAAA,qBAAa,EAAE;QACtC,IAAI,WACF,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC;IAEA,8EAA8E;IAC9E,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL;QACF;IACF,GAAG,EAAE;IAEL,OAAO;QACL,aAAa,CAAA,GAAA,iBAAS,EAAE,aAAa;YACnC,UAAU,aAAa,MAAM,gBAAgB,CAAC,UAAU,IAAI,OAAO,IAAI;YACvE;gBACE,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,GAAG;YAChD;YACA;gBACE,MAAM,gBAAgB,CAAC,MAAM,CAAC,MAAM,GAAG;YACzC;QACF;IACF;AACF","sources":["packages/@react-aria/actiongroup/src/useActionGroupItem.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 {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps, useEffectEvent} from '@react-aria/utils';\nimport {PressProps} from '@react-aria/interactions';\nimport {useEffect} from 'react';\n\nexport interface AriaActionGroupItemProps {\n key: Key\n}\n\nexport interface ActionGroupItemAria {\n buttonProps: DOMAttributes & PressProps\n}\n\nconst BUTTON_ROLES = {\n 'none': undefined,\n 'single': 'radio',\n 'multiple': 'checkbox'\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria {\n let selectionMode = state.selectionManager.selectionMode;\n let buttonProps = {\n role: BUTTON_ROLES[selectionMode]\n };\n\n if (selectionMode !== 'none') {\n let isSelected = state.selectionManager.isSelected(props.key);\n buttonProps['aria-checked'] = isSelected;\n }\n\n let isFocused = props.key === state.selectionManager.focusedKey;\n let onRemovedWithFocus = useEffectEvent(() => {\n if (isFocused) {\n state.selectionManager.setFocusedKey(null);\n }\n });\n\n // If the focused item is removed from the DOM, reset the focused key to null.\n useEffect(() => {\n return () => {\n onRemovedWithFocus();\n };\n }, []);\n\n return {\n buttonProps: mergeProps(buttonProps, {\n tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,\n onFocus() {\n state.selectionManager.setFocusedKey(props.key);\n },\n onPress() {\n state.selectionManager.select(props.key);\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useActionGroupItem.module.js.map"}
@@ -1,92 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {AriaActionGroupProps} from '@react-types/actiongroup';
14
- import {createFocusManager} from '@react-aria/focus';
15
- import {DOMAttributes, FocusableElement, Orientation, RefObject} from '@react-types/shared';
16
- import {filterDOMProps, getEventTarget, nodeContains, useLayoutEffect} from '@react-aria/utils';
17
- import {KeyboardEventHandler, useState} from 'react';
18
- import {ListState} from '@react-stately/list';
19
- import {useLocale} from '@react-aria/i18n';
20
-
21
- const BUTTON_GROUP_ROLES = {
22
- 'none': 'toolbar',
23
- 'single': 'radiogroup',
24
- 'multiple': 'toolbar'
25
- };
26
-
27
- export interface ActionGroupAria {
28
- actionGroupProps: DOMAttributes
29
- }
30
-
31
- export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria {
32
- let {
33
- isDisabled,
34
- orientation = 'horizontal' as Orientation
35
- } = props;
36
-
37
- let [isInToolbar, setInToolbar] = useState(false);
38
- useLayoutEffect(() => {
39
- setInToolbar(!!(ref.current && ref.current.parentElement?.closest('[role="toolbar"]')));
40
- }, [ref]);
41
-
42
- let allKeys = [...state.collection.getKeys()];
43
- if (!allKeys.some(key => !state.disabledKeys.has(key))) {
44
- isDisabled = true;
45
- }
46
-
47
- let {direction} = useLocale();
48
- let focusManager = createFocusManager(ref);
49
- let flipDirection = direction === 'rtl' && orientation === 'horizontal';
50
- let onKeyDown: KeyboardEventHandler = (e) => {
51
- if (!nodeContains(e.currentTarget, getEventTarget(e))) {
52
- return;
53
- }
54
-
55
- switch (e.key) {
56
- case 'ArrowRight':
57
- case 'ArrowDown':
58
- e.preventDefault();
59
- e.stopPropagation();
60
- if (e.key === 'ArrowRight' && flipDirection) {
61
- focusManager.focusPrevious({wrap: true});
62
- } else {
63
- focusManager.focusNext({wrap: true});
64
- }
65
- break;
66
- case 'ArrowLeft':
67
- case 'ArrowUp':
68
- e.preventDefault();
69
- e.stopPropagation();
70
- if (e.key === 'ArrowLeft' && flipDirection) {
71
- focusManager.focusNext({wrap: true});
72
- } else {
73
- focusManager.focusPrevious({wrap: true});
74
- }
75
- break;
76
- }
77
- };
78
-
79
- let role: string | undefined = BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];
80
- if (isInToolbar && role === 'toolbar') {
81
- role = 'group';
82
- }
83
- return {
84
- actionGroupProps: {
85
- ...filterDOMProps(props, {labelable: true}),
86
- role,
87
- 'aria-orientation': role === 'toolbar' ? orientation : undefined,
88
- 'aria-disabled': isDisabled,
89
- onKeyDown
90
- }
91
- };
92
- }
@@ -1,70 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';
14
- import {ListState} from '@react-stately/list';
15
- import {mergeProps, useEffectEvent} from '@react-aria/utils';
16
- import {PressProps} from '@react-aria/interactions';
17
- import {useEffect} from 'react';
18
-
19
- export interface AriaActionGroupItemProps {
20
- key: Key
21
- }
22
-
23
- export interface ActionGroupItemAria {
24
- buttonProps: DOMAttributes & PressProps
25
- }
26
-
27
- const BUTTON_ROLES = {
28
- 'none': undefined,
29
- 'single': 'radio',
30
- 'multiple': 'checkbox'
31
- };
32
-
33
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
- export function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria {
35
- let selectionMode = state.selectionManager.selectionMode;
36
- let buttonProps = {
37
- role: BUTTON_ROLES[selectionMode]
38
- };
39
-
40
- if (selectionMode !== 'none') {
41
- let isSelected = state.selectionManager.isSelected(props.key);
42
- buttonProps['aria-checked'] = isSelected;
43
- }
44
-
45
- let isFocused = props.key === state.selectionManager.focusedKey;
46
- let onRemovedWithFocus = useEffectEvent(() => {
47
- if (isFocused) {
48
- state.selectionManager.setFocusedKey(null);
49
- }
50
- });
51
-
52
- // If the focused item is removed from the DOM, reset the focused key to null.
53
- useEffect(() => {
54
- return () => {
55
- onRemovedWithFocus();
56
- };
57
- }, []);
58
-
59
- return {
60
- buttonProps: mergeProps(buttonProps, {
61
- tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
62
- onFocus() {
63
- state.selectionManager.setFocusedKey(props.key);
64
- },
65
- onPress() {
66
- state.selectionManager.select(props.key);
67
- }
68
- })
69
- };
70
- }