@react-aria/button 3.14.0 → 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,8 @@ function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
67
67
  'aria-expanded': props['aria-expanded'],
68
68
  'aria-controls': props['aria-controls'],
69
69
  'aria-pressed': props['aria-pressed'],
70
- 'aria-current': props['aria-current']
70
+ 'aria-current': props['aria-current'],
71
+ 'aria-disabled': props['aria-disabled']
71
72
  })
72
73
  };
73
74
  }
@@ -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,WACtB,OAAO,QACP,IAAI,UACJ,MAAM,OACN,GAAG,QACH,OAAO,UACR,GAAG;IACJ,IAAI;IACJ,IAAI,gBAAgB,UAClB,kBAAkB;cAChB;QACA,UAAU;QACV,MAAM,MAAM,IAAI;QAChB,YAAY,MAAM,UAAU;QAC5B,aAAa,MAAM,WAAW;QAC9B,YAAY,MAAM,UAAU;QAC5B,gBAAgB,MAAM,cAAc;QACpC,YAAY,MAAM,UAAU;QAC5B,MAAM,MAAM,IAAI;QAChB,OAAO,MAAM,KAAK;IACpB;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,qCAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;iBACA;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,wBACF,eAAe,QAAQ,GAAG,aAAa,KAAK,eAAe,QAAQ;IAErE,IAAI,cAAc,CAAA,GAAA,gCAAS,EAAE,gBAAgB,YAAY,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAE/F,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,gCAAS,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 form: props.form,\n formAction: props.formAction,\n formEncType: props.formEncType,\n formMethod: props.formMethod,\n formNoValidate: props.formNoValidate,\n formTarget: props.formTarget,\n name: props.name,\n value: props.value\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"}
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;QACV,MAAM,MAAM,IAAI;QAChB,YAAY,MAAM,UAAU;QAC5B,aAAa,MAAM,WAAW;QAC9B,YAAY,MAAM,UAAU;QAC5B,gBAAgB,MAAM,cAAc;QACpC,YAAY,MAAM,UAAU;QAC5B,MAAM,MAAM,IAAI;QAChB,OAAO,MAAM,KAAK;IACpB;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,qCAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;iBACA;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,wBACF,eAAe,QAAQ,GAAG,aAAa,KAAK,eAAe,QAAQ;IAErE,IAAI,cAAc,CAAA,GAAA,gCAAS,EAAE,gBAAgB,YAAY,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAE/F,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,gCAAS,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,iBAAiB,KAAK,CAAC,gBAAgB;QACzC;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 form: props.form,\n formAction: props.formAction,\n formEncType: props.formEncType,\n formMethod: props.formMethod,\n formNoValidate: props.formNoValidate,\n formTarget: props.formTarget,\n name: props.name,\n value: props.value\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 'aria-disabled': props['aria-disabled']\n })\n };\n}\n"],"names":[],"version":3,"file":"useButton.main.js.map"}
@@ -61,7 +61,8 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
61
61
  'aria-expanded': props['aria-expanded'],
62
62
  'aria-controls': props['aria-controls'],
63
63
  'aria-pressed': props['aria-pressed'],
64
- 'aria-current': props['aria-current']
64
+ 'aria-current': props['aria-current'],
65
+ 'aria-disabled': props['aria-disabled']
65
66
  })
66
67
  };
67
68
  }
@@ -61,7 +61,8 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
61
61
  'aria-expanded': props['aria-expanded'],
62
62
  'aria-controls': props['aria-controls'],
63
63
  'aria-pressed': props['aria-pressed'],
64
- 'aria-current': props['aria-current']
64
+ 'aria-current': props['aria-current'],
65
+ 'aria-disabled': props['aria-disabled']
65
66
  })
66
67
  };
67
68
  }
@@ -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,WACtB,OAAO,QACP,IAAI,UACJ,MAAM,OACN,GAAG,QACH,OAAO,UACR,GAAG;IACJ,IAAI;IACJ,IAAI,gBAAgB,UAClB,kBAAkB;cAChB;QACA,UAAU;QACV,MAAM,MAAM,IAAI;QAChB,YAAY,MAAM,UAAU;QAC5B,aAAa,MAAM,WAAW;QAC9B,YAAY,MAAM,UAAU;QAC5B,gBAAgB,MAAM,cAAc;QACpC,YAAY,MAAM,UAAU;QAC5B,MAAM,MAAM,IAAI;QAChB,OAAO,MAAM,KAAK;IACpB;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 form: props.form,\n formAction: props.formAction,\n formEncType: props.formEncType,\n formMethod: props.formMethod,\n formNoValidate: props.formNoValidate,\n formTarget: props.formTarget,\n name: props.name,\n value: props.value\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"}
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;QACV,MAAM,MAAM,IAAI;QAChB,YAAY,MAAM,UAAU;QAC5B,aAAa,MAAM,WAAW;QAC9B,YAAY,MAAM,UAAU;QAC5B,gBAAgB,MAAM,cAAc;QACpC,YAAY,MAAM,UAAU;QAC5B,MAAM,MAAM,IAAI;QAChB,OAAO,MAAM,KAAK;IACpB;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;YACrC,iBAAiB,KAAK,CAAC,gBAAgB;QACzC;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 form: props.form,\n formAction: props.formAction,\n formEncType: props.formEncType,\n formMethod: props.formMethod,\n formNoValidate: props.formNoValidate,\n formTarget: props.formTarget,\n name: props.name,\n value: props.value\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 'aria-disabled': props['aria-disabled']\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.14.0",
3
+ "version": "3.14.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -26,12 +26,12 @@
26
26
  "url": "https://github.com/adobe/react-spectrum"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/interactions": "^3.25.4",
30
- "@react-aria/toolbar": "3.0.0-beta.19",
31
- "@react-aria/utils": "^3.30.0",
32
- "@react-stately/toggle": "^3.9.0",
33
- "@react-types/button": "^3.13.0",
34
- "@react-types/shared": "^3.31.0",
29
+ "@react-aria/interactions": "^3.25.5",
30
+ "@react-aria/toolbar": "3.0.0-beta.20",
31
+ "@react-aria/utils": "^3.30.1",
32
+ "@react-stately/toggle": "^3.9.1",
33
+ "@react-types/button": "^3.14.0",
34
+ "@react-types/shared": "^3.32.0",
35
35
  "@swc/helpers": "^0.5.0"
36
36
  },
37
37
  "peerDependencies": {
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "8b9348ff255e018b2dd9b27e2a45507cadfa1d35"
44
+ "gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
45
45
  }
package/src/useButton.ts CHANGED
@@ -114,7 +114,8 @@ export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<
114
114
  'aria-expanded': props['aria-expanded'],
115
115
  'aria-controls': props['aria-controls'],
116
116
  'aria-pressed': props['aria-pressed'],
117
- 'aria-current': props['aria-current']
117
+ 'aria-current': props['aria-current'],
118
+ 'aria-disabled': props['aria-disabled']
118
119
  })
119
120
  };
120
121
  }