@react-aria/button 3.4.4 → 3.6.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/main.js CHANGED
@@ -2,28 +2,12 @@ var $eeQ2i$reactariautils = require("@react-aria/utils");
2
2
  var $eeQ2i$reactariafocus = require("@react-aria/focus");
3
3
  var $eeQ2i$reactariainteractions = require("@react-aria/interactions");
4
4
 
5
- function $parcel$exportWildcard(dest, source) {
6
- Object.keys(source).forEach(function(key) {
7
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
8
- return;
9
- }
10
-
11
- Object.defineProperty(dest, key, {
12
- enumerable: true,
13
- get: function get() {
14
- return source[key];
15
- }
16
- });
17
- });
18
-
19
- return dest;
20
- }
21
5
  function $parcel$export(e, n, v, s) {
22
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
23
7
  }
24
- var $988353faa005faf8$exports = {};
25
8
 
26
- $parcel$export($988353faa005faf8$exports, "useButton", () => $988353faa005faf8$export$ea18c227d4417cc3);
9
+ $parcel$export(module.exports, "useButton", () => $988353faa005faf8$export$ea18c227d4417cc3);
10
+ $parcel$export(module.exports, "useToggleButton", () => $c49208f7d2aac50b$export$51e84d46ca0bc451);
27
11
 
28
12
 
29
13
 
@@ -80,9 +64,6 @@ function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
80
64
  }
81
65
 
82
66
 
83
- var $c49208f7d2aac50b$exports = {};
84
-
85
- $parcel$export($c49208f7d2aac50b$exports, "useToggleButton", () => $c49208f7d2aac50b$export$51e84d46ca0bc451);
86
67
 
87
68
 
88
69
 
@@ -101,8 +82,6 @@ function $c49208f7d2aac50b$export$51e84d46ca0bc451(props, state, ref) {
101
82
  }
102
83
 
103
84
 
104
- $parcel$exportWildcard(module.exports, $988353faa005faf8$exports);
105
- $parcel$exportWildcard(module.exports, $c49208f7d2aac50b$exports);
106
85
 
107
86
 
108
87
  //# sourceMappingURL=main.js.map
package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E,CAAC;YACpC,CAAc,eAAE,UAAU;QAC5B,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/button/src/index.ts","packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/useToggleButton.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 * from './useButton';\nexport * from './useToggleButton';\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaButtonProps} from '@react-types/button';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T,\n /** Whether the button is currently pressed. */\n isPressed: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(props: AriaButtonProps<'button'>, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n // @ts-ignore - undocumented\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button'\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && isDisabled ? undefined : href,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n preventFocusOnPress,\n ref\n });\n\n let {focusableProps} = useFocusable(props, ref);\n if (allowFocusWhenDisabled) {\n focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;\n }\n let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, {labelable: true}));\n\n return {\n isPressed, // Used to indicate press state for visual\n buttonProps: mergeProps(additionalProps, buttonProps, {\n 'aria-haspopup': props['aria-haspopup'],\n 'aria-expanded': props['aria-expanded'],\n 'aria-controls': props['aria-controls'],\n 'aria-pressed': props['aria-pressed'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaToggleButtonProps} from '@react-types/button';\nimport {ButtonAria, useButton} from './useButton';\nimport {chain} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n const {isSelected} = state;\n const {isPressed, buttonProps} = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress)\n }, ref);\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;SCgDgB,yCAAS,CAAC,KAAmC,EAAE,GAAmB,EAAmC,CAAC;IACpH,GAAG,CAAC,CAAC,cACH,WAAW,GAAG,CAAQ,sBACtB,UAAU,YACV,OAAO,iBACP,YAAY,eACZ,UAAU,kBACV,aAAa,wBACb,EAA4B,AAA5B,0BAA4B;IAC5B,mBAAmB,2BACnB,EAA4B,AAA5B,0BAA4B;IAC5B,sBAAsB,GACtB,EAAa,AAAb,WAAa;IACb,OAAO,EAAE,iBAAiB,SAC1B,IAAI,WACJ,MAAM,QACN,GAAG,SACH,IAAI,GAAG,CAAQ,SACjB,CAAC,GAAG,KAAK;IACT,GAAG,CAAC,eAAe;IACnB,EAAE,EAAE,WAAW,KAAK,CAAQ,SAC1B,eAAe,GAAG,CAAC;cACjB,IAAI;QACJ,QAAQ,EAAE,UAAU;IACtB,CAAC;SAED,eAAe,GAAG,CAAC;QACjB,IAAI,EAAE,CAAQ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AAK,CAAC;gBACf,EAAE,EAAE,iBAAiB,EAAE,CAAC;oBACtB,iBAAiB,CAAC,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC,CAA2C;gBAC1D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;;;;;;SChFe,yCAAe,CAAC,KAAyC,EAAE,KAAkB,EAAE,GAAmB,EAAmC,CAAC;IACpJ,KAAK,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,KAAK;IAC1B,KAAK,CAAC,CAAC,YAAA,SAAS,gBAAE,WAAW,EAAA,CAAC,GAAG,yCAAS,CAAC,CAAC;WACvC,KAAK;QACR,OAAO,EAAE,2BAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO;IAC5C,CAAC,EAAE,GAAG;IAEN,MAAM,CAAC,CAAC;mBACN,SAAS;QACT,WAAW,EAAE,gCAAU,CAAC,WAAW,EAAE,CAAC;YACpC,CAAc,eAAE,UAAU;QAC5B,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/button/src/index.ts","packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/useToggleButton.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 {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport type {ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T,\n /** Whether the button is currently pressed. */\n isPressed: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(props: AriaButtonProps<'button'>, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<Element>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n // @ts-ignore - undocumented\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button'\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && isDisabled ? undefined : href,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n preventFocusOnPress,\n ref\n });\n\n let {focusableProps} = useFocusable(props, ref);\n if (allowFocusWhenDisabled) {\n focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;\n }\n let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, {labelable: true}));\n\n return {\n isPressed, // Used to indicate press state for visual\n buttonProps: mergeProps(additionalProps, buttonProps, {\n 'aria-haspopup': props['aria-haspopup'],\n 'aria-expanded': props['aria-expanded'],\n 'aria-controls': props['aria-controls'],\n 'aria-pressed': props['aria-pressed'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaToggleButtonProps} from '@react-types/button';\nimport {ButtonAria, useButton} from './useButton';\nimport {chain} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<Element>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n const {isSelected} = state;\n const {isPressed, buttonProps} = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress)\n }, ref);\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -2,12 +2,6 @@ import {mergeProps as $cE0pI$mergeProps, filterDOMProps as $cE0pI$filterDOMProps
2
2
  import {useFocusable as $cE0pI$useFocusable} from "@react-aria/focus";
3
3
  import {usePress as $cE0pI$usePress} from "@react-aria/interactions";
4
4
 
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
- var $701a24aa0da5b062$exports = {};
9
-
10
- $parcel$export($701a24aa0da5b062$exports, "useButton", () => $701a24aa0da5b062$export$ea18c227d4417cc3);
11
5
 
12
6
 
13
7
 
@@ -64,9 +58,6 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
64
58
  }
65
59
 
66
60
 
67
- var $55f54f7887471b58$exports = {};
68
-
69
- $parcel$export($55f54f7887471b58$exports, "useToggleButton", () => $55f54f7887471b58$export$51e84d46ca0bc451);
70
61
 
71
62
 
72
63
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;SC+CgB,yCAAS,CAAC,KAAmC,EAAE,GAAmB,EAAmC,CAAC;IACpH,GAAG,CAAC,CAAC,cACH,WAAW,GAAG,CAAQ,sBACtB,UAAU,YACV,OAAO,iBACP,YAAY,eACZ,UAAU,kBACV,aAAa,wBACb,EAA4B,AAA5B,0BAA4B;IAC5B,mBAAmB,2BACnB,EAA4B,AAA5B,0BAA4B;IAC5B,sBAAsB,GACtB,EAAa,AAAb,WAAa;IACb,OAAO,EAAE,iBAAiB,SAC1B,IAAI,WACJ,MAAM,QACN,GAAG,SACH,IAAI,GAAG,CAAQ,SACjB,CAAC,GAAG,KAAK;IACT,GAAG,CAAC,eAAe;IACnB,EAAE,EAAE,WAAW,KAAK,CAAQ,SAC1B,eAAe,GAAG,CAAC;cACjB,IAAI;QACJ,QAAQ,EAAE,UAAU;IACtB,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c,eAAE,KAAK,CAAC,CAAc;YACpC,OAAO,GAAG,CAAC,GAAK,CAAC;gBACf,EAAE,EAAE,iBAAiB,EAAE,CAAC;oBACtB,iBAAiB,CAAC,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC,CAA2C;gBAC1D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;;;;;;;;;SChFe,yCAAe,CAAC,KAAyC,EAAE,KAAkB,EAAE,GAAmB,EAAmC,CAAC;IACpJ,KAAK,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,KAAK;IAC1B,KAAK,CAAC,CAAC,YAAA,SAAS,gBAAE,WAAW,EAAA,CAAC,GAAG,yCAAS,CAAC,CAAC;WACvC,KAAK;QACR,OAAO,EAAE,YAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO;IAC5C,CAAC,EAAE,GAAG;IAEN,MAAM,CAAC,CAAC;mBACN,SAAS;QACT,WAAW,EAAE,iBAAU,CAAC,WAAW,EAAE,CAAC;YACpC,CAAc,eAAE,UAAU;QAC5B,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/button/src/index.ts","packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/useToggleButton.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 * from './useButton';\nexport * from './useToggleButton';\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaButtonProps} from '@react-types/button';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T,\n /** Whether the button is currently pressed. */\n isPressed: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(props: AriaButtonProps<'button'>, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n // @ts-ignore - undocumented\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button'\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && isDisabled ? undefined : href,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n preventFocusOnPress,\n ref\n });\n\n let {focusableProps} = useFocusable(props, ref);\n if (allowFocusWhenDisabled) {\n focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;\n }\n let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, {labelable: true}));\n\n return {\n isPressed, // Used to indicate press state for visual\n buttonProps: mergeProps(additionalProps, buttonProps, {\n 'aria-haspopup': props['aria-haspopup'],\n 'aria-expanded': props['aria-expanded'],\n 'aria-controls': props['aria-controls'],\n 'aria-pressed': props['aria-pressed'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaToggleButtonProps} from '@react-types/button';\nimport {ButtonAria, useButton} from './useButton';\nimport {chain} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n const {isSelected} = state;\n const {isPressed, buttonProps} = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress)\n }, ref);\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n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AAU;QAC5B,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/button/src/index.ts","packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/useToggleButton.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 {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport type {ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T,\n /** Whether the button is currently pressed. */\n isPressed: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(props: AriaButtonProps<'button'>, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<Element>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n // @ts-ignore - undocumented\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button'\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && isDisabled ? undefined : href,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n preventFocusOnPress,\n ref\n });\n\n let {focusableProps} = useFocusable(props, ref);\n if (allowFocusWhenDisabled) {\n focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;\n }\n let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, {labelable: true}));\n\n return {\n isPressed, // Used to indicate press state for visual\n buttonProps: mergeProps(additionalProps, buttonProps, {\n 'aria-haspopup': props['aria-haspopup'],\n 'aria-expanded': props['aria-expanded'],\n 'aria-controls': props['aria-controls'],\n 'aria-pressed': props['aria-pressed'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n","/*\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 AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaToggleButtonProps} from '@react-types/button';\nimport {ButtonAria, useButton} from './useButton';\nimport {chain} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<Element>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n const {isSelected} = state;\n const {isPressed, buttonProps} = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress)\n }, ref);\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, HTMLAttributes, InputHTMLAttributes, RefObject } from "react";
2
2
  import { AriaButtonProps, AriaToggleButtonProps } from "@react-types/button";
3
+ import { DOMAttributes } from "@react-types/shared";
3
4
  import { ToggleState } from "@react-stately/toggle";
4
5
  export interface ButtonAria<T> {
5
6
  /** Props for the button element. */
@@ -12,12 +13,13 @@ export function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchor
12
13
  export function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
13
14
  export function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
14
15
  export function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
15
- export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;
16
+ export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<Element>): ButtonAria<DOMAttributes>;
16
17
  export function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
17
18
  export function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
18
19
  export function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
19
20
  export function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
20
21
  export function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
21
- export function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;
22
+ export function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<Element>): ButtonAria<DOMAttributes>;
23
+ export type { AriaButtonProps, AriaToggleButtonProps } from '@react-types/button';
22
24
 
23
25
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;;AA2BA,4BAA4B,CAAC;IAC3B,oCAAoC;IACpC,WAAW,EAAE,CAAC,CAAC;IACf,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;CACnB;AAGD,0BAA0B,KAAK,EAAE,gBAAgB,QAAQ,CA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,OAAO,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,gBAAgB,CAAC,GAAG,WAAW,oBAAoB,gBAAgB,CAAC,CAAC,CAAC;AAChL,gCAAgC,KAAK,EAAE,sBAAsB,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,eAAe,CAAC,GAAG,WAAW,eAAe,eAAe,CAAC,CAAC,CAAC;AACxK,gCAAgC,KAAK,EAAE,sBAAsB,WAAW,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,WAAW,eAAe,WAAW,CAAC,CAAC,CAAC","sources":["packages/@react-aria/button/src/packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/useToggleButton.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/index.ts","packages/@react-aria/button/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 */\n\nexport * from './useButton';\nexport * from './useToggleButton';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AA4BA,4BAA4B,CAAC;IAC3B,oCAAoC;IACpC,WAAW,EAAE,CAAC,CAAC;IACf,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;CACnB;AAGD,0BAA0B,KAAK,EAAE,gBAAgB,QAAQ,CAAC,EAAE,GAAG,EAAE,UAAU,iBAAiB,CAAC,GAAG,WAAW,qBAAqB,iBAAiB,CAAC,CAAC,CAAC;AACpJ,0BAA0B,KAAK,EAA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L,gCAAgC,KAAK,EAAE,sBAAsB,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,eAAe,CAAC,GAAG,WAAW,eAAe,eAAe,CAAC,CAAC,CAAC;AACxK,gCAAgC,KAAK,EAAE,sBAAsB,WAAW,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,OAAO,CAAC,GAAG,WAAW,aAAa,CAAC,CAAC;AClBnJ,YAAY,EAAC,eAAe,EAAE,qBAAqB,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/button/src/packages/@react-aria/button/src/useButton.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/useToggleButton.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/index.ts","packages/@react-aria/button/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 {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport type {ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/button",
3
- "version": "3.4.4",
3
+ "version": "3.6.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,17 +18,18 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/focus": "^3.5.5",
22
- "@react-aria/interactions": "^3.8.4",
23
- "@react-aria/utils": "^3.12.0",
24
- "@react-stately/toggle": "^3.2.7",
25
- "@react-types/button": "^3.4.5"
21
+ "@react-aria/focus": "^3.7.0",
22
+ "@react-aria/interactions": "^3.10.0",
23
+ "@react-aria/utils": "^3.13.2",
24
+ "@react-stately/toggle": "^3.4.0",
25
+ "@react-types/button": "^3.6.0",
26
+ "@react-types/shared": "^3.14.0"
26
27
  },
27
28
  "peerDependencies": {
28
- "react": "^16.8.0 || ^17.0.0-rc.1"
29
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
32
33
  },
33
- "gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
34
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
34
35
  }
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@
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
-
13
- export * from './useButton';
14
- export * from './useToggleButton';
12
+ export {useButton} from './useButton';
13
+ export {useToggleButton} from './useToggleButton';
14
+ export type {ButtonAria} from './useButton';
15
+ export type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';
package/src/useButton.ts CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  RefObject
20
20
  } from 'react';
21
21
  import {AriaButtonProps} from '@react-types/button';
22
+ import {DOMAttributes} from '@react-types/shared';
22
23
  import {filterDOMProps} from '@react-aria/utils';
23
24
  import {mergeProps} from '@react-aria/utils';
24
25
  import {useFocusable} from '@react-aria/focus';
@@ -38,7 +39,7 @@ export function useButton(props: AriaButtonProps<'a'>, ref: RefObject<HTMLAnchor
38
39
  export function useButton(props: AriaButtonProps<'div'>, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
39
40
  export function useButton(props: AriaButtonProps<'input'>, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
40
41
  export function useButton(props: AriaButtonProps<'span'>, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
41
- export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;
42
+ export function useButton(props: AriaButtonProps<ElementType>, ref: RefObject<Element>): ButtonAria<DOMAttributes>;
42
43
  /**
43
44
  * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,
44
45
  * focus behavior, and ARIA props for both native button elements and custom element types.
@@ -21,6 +21,7 @@ import {
21
21
  import {AriaToggleButtonProps} from '@react-types/button';
22
22
  import {ButtonAria, useButton} from './useButton';
23
23
  import {chain} from '@react-aria/utils';
24
+ import {DOMAttributes} from '@react-types/shared';
24
25
  import {mergeProps} from '@react-aria/utils';
25
26
  import {ToggleState} from '@react-stately/toggle';
26
27
 
@@ -29,7 +30,7 @@ export function useToggleButton(props: AriaToggleButtonProps<'button'>, state: T
29
30
  export function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
30
31
  export function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
31
32
  export function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
32
- export function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<HTMLElement>): ButtonAria<HTMLAttributes<HTMLElement>>;
33
+ export function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState, ref: RefObject<Element>): ButtonAria<DOMAttributes>;
33
34
  /**
34
35
  * Provides the behavior and accessibility implementation for a toggle button component.
35
36
  * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.