@react-aria/button 3.12.0 → 3.13.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.
@@ -21,8 +21,7 @@ $parcel$export(module.exports, "useButton", () => $988353faa005faf8$export$ea18c
21
21
 
22
22
  function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
23
23
  let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented
24
- allowFocusWhenDisabled, // @ts-ignore
25
- onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
24
+ allowFocusWhenDisabled, onClick: onClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
26
25
  let additionalProps;
27
26
  if (elementType === 'button') additionalProps = {
28
27
  type: type,
@@ -43,6 +42,7 @@ function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
43
42
  onPressChange: onPressChange,
44
43
  onPress: onPress,
45
44
  onPressUp: onPressUp,
45
+ onClick: onClick,
46
46
  isDisabled: isDisabled,
47
47
  preventFocusOnPress: preventFocusOnPress,
48
48
  ref: ref
@@ -59,13 +59,7 @@ function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
59
59
  'aria-expanded': props['aria-expanded'],
60
60
  'aria-controls': props['aria-controls'],
61
61
  'aria-pressed': props['aria-pressed'],
62
- 'aria-current': props['aria-current'],
63
- onClick: (e)=>{
64
- if (deprecatedOnClick) {
65
- deprecatedOnClick(e);
66
- console.warn('onClick is deprecated, please use onPress');
67
- }
68
- }
62
+ 'aria-current': props['aria-current']
69
63
  })
70
64
  };
71
65
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAqCM,SAAS,0CAAU,KAAqC,EAAE,GAAmB;IAClF,IAAI,eACF,cAAc,sBACd,UAA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":["packages/@react-aria/button/src/useButton.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n 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, mergeProps} from '@react-aria/utils';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\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: AriaButtonOptions<'button'>, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonOptions<'a'>, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonOptions<'div'>, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonOptions<'input'>, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): 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: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\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 href: elementType === 'a' && !isDisabled ? href : undefined,\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 onPressUp,\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 'aria-current': props['aria-current'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n"],"names":[],"version":3,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AK,CAAC,eAAe;QACvC;IACF;AACF","sources":["packages/@react-aria/button/src/useButton.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n 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, mergeProps} from '@react-aria/utils';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\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: AriaButtonOptions<'button'>, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonOptions<'a'>, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonOptions<'div'>, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonOptions<'input'>, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): 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: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n onClick,\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 href: elementType === 'a' && !isDisabled ? href : undefined,\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 onPressUp,\n onClick,\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 'aria-current': props['aria-current']\n })\n };\n}\n"],"names":[],"version":3,"file":"useButton.main.js.map"}
@@ -15,8 +15,7 @@ import {usePress as $bwqiF$usePress, useFocusable as $bwqiF$useFocusable} from "
15
15
 
16
16
  function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
17
17
  let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented
18
- allowFocusWhenDisabled, // @ts-ignore
19
- onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
18
+ allowFocusWhenDisabled, onClick: onClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
20
19
  let additionalProps;
21
20
  if (elementType === 'button') additionalProps = {
22
21
  type: type,
@@ -37,6 +36,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
37
36
  onPressChange: onPressChange,
38
37
  onPress: onPress,
39
38
  onPressUp: onPressUp,
39
+ onClick: onClick,
40
40
  isDisabled: isDisabled,
41
41
  preventFocusOnPress: preventFocusOnPress,
42
42
  ref: ref
@@ -53,13 +53,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
53
53
  'aria-expanded': props['aria-expanded'],
54
54
  'aria-controls': props['aria-controls'],
55
55
  'aria-pressed': props['aria-pressed'],
56
- 'aria-current': props['aria-current'],
57
- onClick: (e)=>{
58
- if (deprecatedOnClick) {
59
- deprecatedOnClick(e);
60
- console.warn('onClick is deprecated, please use onPress');
61
- }
62
- }
56
+ 'aria-current': props['aria-current']
63
57
  })
64
58
  };
65
59
  }
@@ -15,8 +15,7 @@ import {usePress as $bwqiF$usePress, useFocusable as $bwqiF$useFocusable} from "
15
15
 
16
16
  function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
17
17
  let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented
18
- allowFocusWhenDisabled, // @ts-ignore
19
- onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
18
+ allowFocusWhenDisabled, onClick: onClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
20
19
  let additionalProps;
21
20
  if (elementType === 'button') additionalProps = {
22
21
  type: type,
@@ -37,6 +36,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
37
36
  onPressChange: onPressChange,
38
37
  onPress: onPress,
39
38
  onPressUp: onPressUp,
39
+ onClick: onClick,
40
40
  isDisabled: isDisabled,
41
41
  preventFocusOnPress: preventFocusOnPress,
42
42
  ref: ref
@@ -53,13 +53,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
53
53
  'aria-expanded': props['aria-expanded'],
54
54
  'aria-controls': props['aria-controls'],
55
55
  'aria-pressed': props['aria-pressed'],
56
- 'aria-current': props['aria-current'],
57
- onClick: (e)=>{
58
- if (deprecatedOnClick) {
59
- deprecatedOnClick(e);
60
- console.warn('onClick is deprecated, please use onPress');
61
- }
62
- }
56
+ 'aria-current': props['aria-current']
63
57
  })
64
58
  };
65
59
  }
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAqCM,SAAS,0CAAU,KAAqC,EAAE,GAAmB;IAClF,IAAI,eACF,cAAc,sBACd,UAAU,WACV,OAAO,gBACP,YAAY,cACZ,UAAU,aACV,SAAS,iBACT,aAAa,uBACb,mBAAmB,0BACnB,4BAA4B;IAC5B,sBAAsB,EACtB,aAAa;IACb,SAAS,iBAAiB,QAC1B,IAAI,UACJ,MAAM,OACN,GAAG,QACH,OAAO,UACR,GAAG;IACJ,IAAI;IACJ,IAAI,gBAAgB,UAClB,kBAAkB;cAChB;QACA,UAAU;IACZ;SAEA,kBAAkB;QAChB,MAAM;QACN,MAAM,gBAAgB,OAAO,CAAC,aAAa,OAAO;QAClD,QAAQ,gBAAgB,MAAM,SAAS;QACvC,MAAM,gBAAgB,UAAU,OAAO;QACvC,UAAU,gBAAgB,UAAU,aAAa;QACjD,iBAAiB,CAAC,cAAc,gBAAgB,UAAU,YAAY;QACtE,KAAK,gBAAgB,MAAM,MAAM;IACnC;IAGF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,wBACF,eAAe,QAAQ,GAAG,aAAa,KAAK,eAAe,QAAQ;IAErE,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,gBAAgB,YAAY,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAE/F,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,iBAAS,EAAE,iBAAiB,aAAa;YACpD,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,gBAAgB,KAAK,CAAC,eAAe;YACrC,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;gBACR,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;YACF;QACF;IACF;AACF","sources":["packages/@react-aria/button/src/useButton.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n 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, mergeProps} from '@react-aria/utils';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\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: AriaButtonOptions<'button'>, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonOptions<'a'>, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonOptions<'div'>, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonOptions<'input'>, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): 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: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\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 href: elementType === 'a' && !isDisabled ? href : undefined,\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 onPressUp,\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 'aria-current': props['aria-current'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useButton.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAqCM,SAAS,0CAAU,KAAqC,EAAE,GAAmB;IAClF,IAAI,eACF,cAAc,sBACd,UAAU,WACV,OAAO,gBACP,YAAY,cACZ,UAAU,aACV,SAAS,iBACT,aAAa,uBACb,mBAAmB,0BACnB,4BAA4B;IAC5B,sBAAsB,WACtB,OAAO,QACP,IAAI,UACJ,MAAM,OACN,GAAG,QACH,OAAO,UACR,GAAG;IACJ,IAAI;IACJ,IAAI,gBAAgB,UAClB,kBAAkB;cAChB;QACA,UAAU;IACZ;SAEA,kBAAkB;QAChB,MAAM;QACN,MAAM,gBAAgB,OAAO,CAAC,aAAa,OAAO;QAClD,QAAQ,gBAAgB,MAAM,SAAS;QACvC,MAAM,gBAAgB,UAAU,OAAO;QACvC,UAAU,gBAAgB,UAAU,aAAa;QACjD,iBAAiB,CAAC,cAAc,gBAAgB,UAAU,YAAY;QACtE,KAAK,gBAAgB,MAAM,MAAM;IACnC;IAGF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;iBACA;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,wBACF,eAAe,QAAQ,GAAG,aAAa,KAAK,eAAe,QAAQ;IAErE,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,gBAAgB,YAAY,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAE/F,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,iBAAS,EAAE,iBAAiB,aAAa;YACpD,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,gBAAgB,KAAK,CAAC,eAAe;YACrC,gBAAgB,KAAK,CAAC,eAAe;QACvC;IACF;AACF","sources":["packages/@react-aria/button/src/useButton.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n 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, mergeProps} from '@react-aria/utils';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\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: AriaButtonOptions<'button'>, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonOptions<'a'>, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonOptions<'div'>, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonOptions<'input'>, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): 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: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n onClick,\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 href: elementType === 'a' && !isDisabled ? href : undefined,\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 onPressUp,\n onClick,\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 'aria-current': props['aria-current']\n })\n };\n}\n"],"names":[],"version":3,"file":"useButton.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/button",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,12 +22,12 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/interactions": "^3.24.0",
26
- "@react-aria/toolbar": "3.0.0-beta.13",
27
- "@react-aria/utils": "^3.28.0",
28
- "@react-stately/toggle": "^3.8.2",
29
- "@react-types/button": "^3.11.0",
30
- "@react-types/shared": "^3.28.0",
25
+ "@react-aria/interactions": "^3.25.0",
26
+ "@react-aria/toolbar": "3.0.0-beta.15",
27
+ "@react-aria/utils": "^3.28.2",
28
+ "@react-stately/toggle": "^3.8.3",
29
+ "@react-types/button": "^3.12.0",
30
+ "@react-types/shared": "^3.29.0",
31
31
  "@swc/helpers": "^0.5.0"
32
32
  },
33
33
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
40
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
41
41
  }
package/src/useButton.ts CHANGED
@@ -57,8 +57,7 @@ export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<
57
57
  preventFocusOnPress,
58
58
  // @ts-ignore - undocumented
59
59
  allowFocusWhenDisabled,
60
- // @ts-ignore
61
- onClick: deprecatedOnClick,
60
+ onClick,
62
61
  href,
63
62
  target,
64
63
  rel,
@@ -88,6 +87,7 @@ export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<
88
87
  onPressChange,
89
88
  onPress,
90
89
  onPressUp,
90
+ onClick,
91
91
  isDisabled,
92
92
  preventFocusOnPress,
93
93
  ref
@@ -106,13 +106,7 @@ export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<
106
106
  'aria-expanded': props['aria-expanded'],
107
107
  'aria-controls': props['aria-controls'],
108
108
  'aria-pressed': props['aria-pressed'],
109
- 'aria-current': props['aria-current'],
110
- onClick: (e) => {
111
- if (deprecatedOnClick) {
112
- deprecatedOnClick(e);
113
- console.warn('onClick is deprecated, please use onPress');
114
- }
115
- }
109
+ 'aria-current': props['aria-current']
116
110
  })
117
111
  };
118
112
  }