@react-aria/link 3.8.8 → 3.9.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/import.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {useLink as $298d61e98472621b$export$dcf14c9974fe2767} from "./useLink.mjs";
1
+ import {useLink as $239e946e552a9cc4$re_export$useLink} from "react-aria/useLink";
2
2
 
3
3
  /*
4
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -13,5 +13,5 @@ import {useLink as $298d61e98472621b$export$dcf14c9974fe2767} from "./useLink.mj
13
13
  */
14
14
 
15
15
 
16
- export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
16
+ export {$239e946e552a9cc4$re_export$useLink as useLink};
17
17
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,11 +1,11 @@
1
- var $fbe6b19572273b2f$exports = require("./useLink.main.js");
1
+ var $5l886$reactariauseLink = require("react-aria/useLink");
2
2
 
3
3
 
4
4
  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, "useLink", () => $fbe6b19572273b2f$exports.useLink);
8
+ $parcel$export(module.exports, "useLink", function () { return $5l886$reactariauseLink.useLink; });
9
9
  /*
10
10
  * Copyright 2020 Adobe. All rights reserved.
11
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/link/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 {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/link/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 {useLink} from 'react-aria/useLink';\n\nexport type {LinkProps, AriaLinkProps, AriaLinkOptions, LinkAria} from 'react-aria/useLink';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import {useLink as $298d61e98472621b$export$dcf14c9974fe2767} from "./useLink.module.js";
1
+ import {useLink as $239e946e552a9cc4$re_export$useLink} from "react-aria/useLink";
2
2
 
3
3
  /*
4
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -13,5 +13,5 @@ import {useLink as $298d61e98472621b$export$dcf14c9974fe2767} from "./useLink.mo
13
13
  */
14
14
 
15
15
 
16
- export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
16
+ export {$239e946e552a9cc4$re_export$useLink as useLink};
17
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/link/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 {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/link/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 {useLink} from 'react-aria/useLink';\n\nexport type {LinkProps, AriaLinkProps, AriaLinkOptions, LinkAria} from 'react-aria/useLink';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,2 @@
1
+ export { useLink } from 'react-aria/useLink';
2
+ export type { LinkProps, AriaLinkProps, AriaLinkOptions, LinkAria } from 'react-aria/useLink';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@react-aria/link",
3
- "version": "3.8.8",
3
+ "version": "3.9.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
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"
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "types": "./dist/types/src/index.d.ts",
12
+ "import": "./dist/import.mjs",
13
+ "require": "./dist/main.js"
14
+ },
15
+ "./package.json": "./package.json"
16
16
  },
17
- "types": "dist/types.d.ts",
17
+ "types": "dist/types/src/index.d.ts",
18
18
  "source": "src/index.ts",
19
19
  "files": [
20
20
  "dist",
@@ -26,11 +26,8 @@
26
26
  "url": "https://github.com/adobe/react-spectrum"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/interactions": "^3.27.0",
30
- "@react-aria/utils": "^3.33.0",
31
- "@react-types/link": "^3.6.6",
32
- "@react-types/shared": "^3.33.0",
33
- "@swc/helpers": "^0.5.0"
29
+ "@swc/helpers": "^0.5.0",
30
+ "react-aria": "3.48.0"
34
31
  },
35
32
  "peerDependencies": {
36
33
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
@@ -39,5 +36,8 @@
39
36
  "publishConfig": {
40
37
  "access": "public"
41
38
  },
42
- "gitHead": "66e51757606b43a89ed02c574ca24517323a2ab9"
39
+ "targets": {
40
+ "types": false
41
+ },
42
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
43
43
  }
package/src/index.ts CHANGED
@@ -9,5 +9,6 @@
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 {AriaLinkOptions, LinkAria} from './useLink';
13
- export {useLink} from './useLink';
12
+ export {useLink} from 'react-aria/useLink';
13
+
14
+ export type {LinkProps, AriaLinkProps, AriaLinkOptions, LinkAria} from 'react-aria/useLink';
package/dist/types.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import { AriaLinkProps } from "@react-types/link";
2
- import { DOMAttributes, FocusableElement, RefObject } from "@react-types/shared";
3
- export interface AriaLinkOptions extends AriaLinkProps {
4
- /** Whether the link is disabled. */
5
- isDisabled?: boolean;
6
- /**
7
- * The HTML element used to render the link, e.g. 'a', or 'span'.
8
- * @default 'a'
9
- */
10
- elementType?: string;
11
- }
12
- export interface LinkAria {
13
- /** Props for the link element. */
14
- linkProps: DOMAttributes;
15
- /** Whether the link is currently pressed. */
16
- isPressed: boolean;
17
- }
18
- /**
19
- * Provides the behavior and accessibility implementation for a link component.
20
- * A link allows a user to navigate to another page or resource within a web page
21
- * or application.
22
- */
23
- export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria;
24
-
25
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAkBA,gCAAiC,SAAQ,aAAa;IACpD,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;IACE,kCAAkC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAwB,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,QAAQ,CAsCjG","sources":["packages/@react-aria/link/src/packages/@react-aria/link/src/useLink.ts","packages/@react-aria/link/src/packages/@react-aria/link/src/index.ts","packages/@react-aria/link/src/index.ts"],"sourcesContent":[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 {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1,61 +0,0 @@
1
- var $8TwZf$reactariautils = require("@react-aria/utils");
2
- var $8TwZf$reactariainteractions = require("@react-aria/interactions");
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, "useLink", () => $fbe6b19572273b2f$export$dcf14c9974fe2767);
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
- function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
23
- let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props;
24
- let linkProps = {};
25
- if (elementType !== 'a') linkProps = {
26
- role: 'link',
27
- tabIndex: !isDisabled ? 0 : undefined
28
- };
29
- let { focusableProps: focusableProps } = (0, $8TwZf$reactariainteractions.useFocusable)(props, ref);
30
- let { pressProps: pressProps, isPressed: isPressed } = (0, $8TwZf$reactariainteractions.usePress)({
31
- onPress: onPress,
32
- onPressStart: onPressStart,
33
- onPressEnd: onPressEnd,
34
- onClick: onClick,
35
- isDisabled: isDisabled,
36
- ref: ref
37
- });
38
- let domProps = (0, $8TwZf$reactariautils.filterDOMProps)(otherProps, {
39
- labelable: true
40
- });
41
- let interactionHandlers = (0, $8TwZf$reactariautils.mergeProps)(focusableProps, pressProps);
42
- let router = (0, $8TwZf$reactariautils.useRouter)();
43
- let routerLinkProps = (0, $8TwZf$reactariautils.useLinkProps)(props);
44
- return {
45
- isPressed: isPressed,
46
- linkProps: (0, $8TwZf$reactariautils.mergeProps)(domProps, routerLinkProps, {
47
- ...interactionHandlers,
48
- ...linkProps,
49
- 'aria-disabled': isDisabled || undefined,
50
- 'aria-current': props['aria-current'],
51
- onClick: (e)=>{
52
- var _pressProps_onClick;
53
- (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
54
- (0, $8TwZf$reactariautils.handleLinkClick)(e, router, props.href, props.routerOptions);
55
- }
56
- })
57
- };
58
- }
59
-
60
-
61
- //# sourceMappingURL=useLink.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,WACV,OAAO,cACP,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;iBAAC;sBAAS;oBAAc;iBAAY;oBAAS;aAAY;IAAG;IACnG,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,gCAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,+BAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,kCAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,gCAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,CAAA,GAAA,qCAAc,EAAE,GAAG,QAAQ,MAAM,IAAI,EAAE,MAAM,aAAa;YAC5D;QACF;IACF;AACF","sources":["packages/@react-aria/link/src/useLink.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 {AriaLinkProps} from '@react-types/link';\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, handleLinkClick, mergeProps, useLinkProps, useRouter} from '@react-aria/utils';\nimport React from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaLinkOptions extends AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean,\n /**\n * The HTML element used to render the link, e.g. 'a', or 'span'.\n * @default 'a'\n */\n elementType?: string\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: DOMAttributes,\n /** Whether the link is currently pressed. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria {\n let {\n elementType = 'a',\n onPress,\n onPressStart,\n onPressEnd,\n onClick,\n isDisabled,\n ...otherProps\n } = props;\n\n let linkProps: DOMAttributes = {};\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n let {focusableProps} = useFocusable(props, ref);\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, onClick, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n let interactionHandlers = mergeProps(focusableProps, pressProps);\n let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n handleLinkClick(e, router, props.href, props.routerOptions);\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.main.js.map"}
package/dist/useLink.mjs DELETED
@@ -1,56 +0,0 @@
1
- import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, handleLinkClick as $5Ot33$handleLinkClick} from "@react-aria/utils";
2
- import {useFocusable as $5Ot33$useFocusable, usePress as $5Ot33$usePress} from "@react-aria/interactions";
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
- function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
17
- let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props;
18
- let linkProps = {};
19
- if (elementType !== 'a') linkProps = {
20
- role: 'link',
21
- tabIndex: !isDisabled ? 0 : undefined
22
- };
23
- let { focusableProps: focusableProps } = (0, $5Ot33$useFocusable)(props, ref);
24
- let { pressProps: pressProps, isPressed: isPressed } = (0, $5Ot33$usePress)({
25
- onPress: onPress,
26
- onPressStart: onPressStart,
27
- onPressEnd: onPressEnd,
28
- onClick: onClick,
29
- isDisabled: isDisabled,
30
- ref: ref
31
- });
32
- let domProps = (0, $5Ot33$filterDOMProps)(otherProps, {
33
- labelable: true
34
- });
35
- let interactionHandlers = (0, $5Ot33$mergeProps)(focusableProps, pressProps);
36
- let router = (0, $5Ot33$useRouter)();
37
- let routerLinkProps = (0, $5Ot33$useLinkProps)(props);
38
- return {
39
- isPressed: isPressed,
40
- linkProps: (0, $5Ot33$mergeProps)(domProps, routerLinkProps, {
41
- ...interactionHandlers,
42
- ...linkProps,
43
- 'aria-disabled': isDisabled || undefined,
44
- 'aria-current': props['aria-current'],
45
- onClick: (e)=>{
46
- var _pressProps_onClick;
47
- (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
48
- (0, $5Ot33$handleLinkClick)(e, router, props.href, props.routerOptions);
49
- }
50
- })
51
- };
52
- }
53
-
54
-
55
- export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
56
- //# sourceMappingURL=useLink.module.js.map
@@ -1,56 +0,0 @@
1
- import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, handleLinkClick as $5Ot33$handleLinkClick} from "@react-aria/utils";
2
- import {useFocusable as $5Ot33$useFocusable, usePress as $5Ot33$usePress} from "@react-aria/interactions";
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
- function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
17
- let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props;
18
- let linkProps = {};
19
- if (elementType !== 'a') linkProps = {
20
- role: 'link',
21
- tabIndex: !isDisabled ? 0 : undefined
22
- };
23
- let { focusableProps: focusableProps } = (0, $5Ot33$useFocusable)(props, ref);
24
- let { pressProps: pressProps, isPressed: isPressed } = (0, $5Ot33$usePress)({
25
- onPress: onPress,
26
- onPressStart: onPressStart,
27
- onPressEnd: onPressEnd,
28
- onClick: onClick,
29
- isDisabled: isDisabled,
30
- ref: ref
31
- });
32
- let domProps = (0, $5Ot33$filterDOMProps)(otherProps, {
33
- labelable: true
34
- });
35
- let interactionHandlers = (0, $5Ot33$mergeProps)(focusableProps, pressProps);
36
- let router = (0, $5Ot33$useRouter)();
37
- let routerLinkProps = (0, $5Ot33$useLinkProps)(props);
38
- return {
39
- isPressed: isPressed,
40
- linkProps: (0, $5Ot33$mergeProps)(domProps, routerLinkProps, {
41
- ...interactionHandlers,
42
- ...linkProps,
43
- 'aria-disabled': isDisabled || undefined,
44
- 'aria-current': props['aria-current'],
45
- onClick: (e)=>{
46
- var _pressProps_onClick;
47
- (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
48
- (0, $5Ot33$handleLinkClick)(e, router, props.href, props.routerOptions);
49
- }
50
- })
51
- };
52
- }
53
-
54
-
55
- export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
56
- //# sourceMappingURL=useLink.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,WACV,OAAO,cACP,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;iBAAC;sBAAS;oBAAc;iBAAY;oBAAS;aAAY;IAAG;IACnG,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,iBAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,gBAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,mBAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,iBAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,CAAA,GAAA,sBAAc,EAAE,GAAG,QAAQ,MAAM,IAAI,EAAE,MAAM,aAAa;YAC5D;QACF;IACF;AACF","sources":["packages/@react-aria/link/src/useLink.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 {AriaLinkProps} from '@react-types/link';\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, handleLinkClick, mergeProps, useLinkProps, useRouter} from '@react-aria/utils';\nimport React from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaLinkOptions extends AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean,\n /**\n * The HTML element used to render the link, e.g. 'a', or 'span'.\n * @default 'a'\n */\n elementType?: string\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: DOMAttributes,\n /** Whether the link is currently pressed. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria {\n let {\n elementType = 'a',\n onPress,\n onPressStart,\n onPressEnd,\n onClick,\n isDisabled,\n ...otherProps\n } = props;\n\n let linkProps: DOMAttributes = {};\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n let {focusableProps} = useFocusable(props, ref);\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, onClick, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n let interactionHandlers = mergeProps(focusableProps, pressProps);\n let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n handleLinkClick(e, router, props.href, props.routerOptions);\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.module.js.map"}
package/src/useLink.ts DELETED
@@ -1,79 +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 {AriaLinkProps} from '@react-types/link';
14
- import {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';
15
- import {filterDOMProps, handleLinkClick, mergeProps, useLinkProps, useRouter} from '@react-aria/utils';
16
- import React from 'react';
17
- import {useFocusable, usePress} from '@react-aria/interactions';
18
-
19
- export interface AriaLinkOptions extends AriaLinkProps {
20
- /** Whether the link is disabled. */
21
- isDisabled?: boolean,
22
- /**
23
- * The HTML element used to render the link, e.g. 'a', or 'span'.
24
- * @default 'a'
25
- */
26
- elementType?: string
27
- }
28
-
29
- export interface LinkAria {
30
- /** Props for the link element. */
31
- linkProps: DOMAttributes,
32
- /** Whether the link is currently pressed. */
33
- isPressed: boolean
34
- }
35
-
36
- /**
37
- * Provides the behavior and accessibility implementation for a link component.
38
- * A link allows a user to navigate to another page or resource within a web page
39
- * or application.
40
- */
41
- export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria {
42
- let {
43
- elementType = 'a',
44
- onPress,
45
- onPressStart,
46
- onPressEnd,
47
- onClick,
48
- isDisabled,
49
- ...otherProps
50
- } = props;
51
-
52
- let linkProps: DOMAttributes = {};
53
- if (elementType !== 'a') {
54
- linkProps = {
55
- role: 'link',
56
- tabIndex: !isDisabled ? 0 : undefined
57
- };
58
- }
59
- let {focusableProps} = useFocusable(props, ref);
60
- let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, onClick, isDisabled, ref});
61
- let domProps = filterDOMProps(otherProps, {labelable: true});
62
- let interactionHandlers = mergeProps(focusableProps, pressProps);
63
- let router = useRouter();
64
- let routerLinkProps = useLinkProps(props);
65
-
66
- return {
67
- isPressed, // Used to indicate press state for visual
68
- linkProps: mergeProps(domProps, routerLinkProps, {
69
- ...interactionHandlers,
70
- ...linkProps,
71
- 'aria-disabled': isDisabled || undefined,
72
- 'aria-current': props['aria-current'],
73
- onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {
74
- pressProps.onClick?.(e);
75
- handleLinkClick(e, router, props.href, props.routerOptions);
76
- }
77
- })
78
- };
79
- }