@react-aria/button 3.10.1 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/import.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import {useButton as $701a24aa0da5b062$export$ea18c227d4417cc3} from "./useButton.mjs";
2
2
  import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./useToggleButton.mjs";
3
+ import {useToggleButtonGroup as $4547d1bf40011fdf$export$dd5580ae642f110f, useToggleButtonGroupItem as $4547d1bf40011fdf$export$bc53712daae3d6e6} from "./useToggleButtonGroup.mjs";
3
4
 
4
5
  /*
5
6
  * Copyright 2020 Adobe. All rights reserved.
@@ -15,5 +16,6 @@ import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./us
15
16
 
16
17
 
17
18
 
18
- export {$701a24aa0da5b062$export$ea18c227d4417cc3 as useButton, $55f54f7887471b58$export$51e84d46ca0bc451 as useToggleButton};
19
+
20
+ export {$701a24aa0da5b062$export$ea18c227d4417cc3 as useButton, $55f54f7887471b58$export$51e84d46ca0bc451 as useToggleButton, $4547d1bf40011fdf$export$dd5580ae642f110f as useToggleButtonGroup, $4547d1bf40011fdf$export$bc53712daae3d6e6 as useToggleButtonGroupItem};
19
21
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  var $988353faa005faf8$exports = require("./useButton.main.js");
2
2
  var $c49208f7d2aac50b$exports = require("./useToggleButton.main.js");
3
+ var $7d1e6c2af0d638cd$exports = require("./useToggleButtonGroup.main.js");
3
4
 
4
5
 
5
6
  function $parcel$export(e, n, v, s) {
@@ -8,6 +9,8 @@ function $parcel$export(e, n, v, s) {
8
9
 
9
10
  $parcel$export(module.exports, "useButton", () => $988353faa005faf8$exports.useButton);
10
11
  $parcel$export(module.exports, "useToggleButton", () => $c49208f7d2aac50b$exports.useToggleButton);
12
+ $parcel$export(module.exports, "useToggleButtonGroup", () => $7d1e6c2af0d638cd$exports.useToggleButtonGroup);
13
+ $parcel$export(module.exports, "useToggleButtonGroupItem", () => $7d1e6c2af0d638cd$exports.useToggleButtonGroupItem);
11
14
  /*
12
15
  * Copyright 2020 Adobe. All rights reserved.
13
16
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -22,4 +25,5 @@ $parcel$export(module.exports, "useToggleButton", () => $c49208f7d2aac50b$export
22
25
 
23
26
 
24
27
 
28
+
25
29
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/button/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport type {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/button/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport {useToggleButtonGroup, useToggleButtonGroupItem} from './useToggleButtonGroup';\nexport type {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\nexport type {AriaToggleButtonGroupProps, ToggleButtonGroupAria, AriaToggleButtonGroupItemProps} from './useToggleButtonGroup';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {useButton as $701a24aa0da5b062$export$ea18c227d4417cc3} from "./useButton.module.js";
2
2
  import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./useToggleButton.module.js";
3
+ import {useToggleButtonGroup as $4547d1bf40011fdf$export$dd5580ae642f110f, useToggleButtonGroupItem as $4547d1bf40011fdf$export$bc53712daae3d6e6} from "./useToggleButtonGroup.module.js";
3
4
 
4
5
  /*
5
6
  * Copyright 2020 Adobe. All rights reserved.
@@ -15,5 +16,6 @@ import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./us
15
16
 
16
17
 
17
18
 
18
- export {$701a24aa0da5b062$export$ea18c227d4417cc3 as useButton, $55f54f7887471b58$export$51e84d46ca0bc451 as useToggleButton};
19
+
20
+ export {$701a24aa0da5b062$export$ea18c227d4417cc3 as useButton, $55f54f7887471b58$export$51e84d46ca0bc451 as useToggleButton, $4547d1bf40011fdf$export$dd5580ae642f110f as useToggleButtonGroup, $4547d1bf40011fdf$export$bc53712daae3d6e6 as useToggleButtonGroupItem};
19
21
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/button/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport type {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/button/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useButton} from './useButton';\nexport {useToggleButton} from './useToggleButton';\nexport {useToggleButtonGroup, useToggleButtonGroupItem} from './useToggleButtonGroup';\nexport type {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\nexport type {AriaToggleButtonGroupProps, ToggleButtonGroupAria, AriaToggleButtonGroupItemProps} from './useToggleButtonGroup';\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, HTMLAttributes, InputHTMLAttributes, RefObject } from "react";
2
- import { AriaButtonProps, AriaToggleButtonProps } from "@react-types/button";
3
- import { DOMAttributes } from "@react-types/shared";
4
- import { ToggleState } from "@react-stately/toggle";
2
+ import { AriaButtonProps, AriaToggleButtonProps, AriaToggleButtonGroupItemProps } from "@react-types/button";
3
+ import { DOMAttributes, AriaLabelingProps, Orientation, RefObject as _RefObject1 } from "@react-types/shared";
4
+ import { ToggleState, ToggleGroupProps, ToggleGroupState } from "@react-stately/toggle";
5
5
  export interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {
6
6
  }
7
7
  export interface ButtonAria<T> {
@@ -18,12 +18,41 @@ export function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLS
18
18
  export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): ButtonAria<DOMAttributes>;
19
19
  interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {
20
20
  }
21
- export function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
22
- export function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
23
- export function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
24
- export function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
25
- export function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
26
- export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ButtonAria<DOMAttributes>;
21
+ interface ToggleButtonAria<T> extends ButtonAria<T> {
22
+ /** Whether the button is selected. */
23
+ isSelected: boolean;
24
+ /** Whether the button is disabled. */
25
+ isDisabled: boolean;
26
+ }
27
+ export function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
28
+ export function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
29
+ export function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;
30
+ export function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;
31
+ export function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;
32
+ export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ToggleButtonAria<DOMAttributes>;
33
+ export interface AriaToggleButtonGroupProps extends ToggleGroupProps, AriaLabelingProps {
34
+ /**
35
+ * The orientation of the the toggle button group.
36
+ * @default 'horizontal'
37
+ */
38
+ orientation?: Orientation;
39
+ }
40
+ export interface ToggleButtonGroupAria {
41
+ /**
42
+ * Props for the toggle button group container.
43
+ */
44
+ groupProps: DOMAttributes;
45
+ }
46
+ export function useToggleButtonGroup(props: AriaToggleButtonGroupProps, state: ToggleGroupState, ref: _RefObject1<HTMLElement | null>): ToggleButtonGroupAria;
47
+ export { AriaToggleButtonGroupItemProps };
48
+ interface AriaToggleButtonGroupItemOptions<E extends ElementType> extends Omit<AriaToggleButtonGroupItemProps<E>, 'children'> {
49
+ }
50
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'button'>, state: ToggleGroupState, ref: _RefObject1<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
51
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'a'>, state: ToggleGroupState, ref: _RefObject1<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
52
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'div'>, state: ToggleGroupState, ref: _RefObject1<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;
53
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'input'>, state: ToggleGroupState, ref: _RefObject1<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;
54
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'span'>, state: ToggleGroupState, ref: _RefObject1<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;
55
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: _RefObject1<Element | null>): ToggleButtonAria<DOMAttributes>;
27
56
  export type { AriaButtonProps, AriaToggleButtonProps } from '@react-types/button';
28
57
 
29
58
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;;;AA0BA,mCAAmC,CAAC,SAAS,WAAW,CAAE,SAAQ,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC;CAAG;AAEzG,4BAA4B,CAAC;IAC3B,oCAAoC;IACpC,WAAW,EAAE,CAAC,CAAC;IACf,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;CACnB;AAGD,0BAA0B,KAAK,EAAE,kBAAkB,QAAQ,CAAC,EAAE,GAAG,EAAE,UAAU,iBAAiB,GAAG,IAAI,CAAC,GAAG,WAAW,qBAAqB,iBAAiB,CAAC,CAAC,CAAC;AAC7J,0BAA0B,KAAK,EAAE,kBAAkB,GAAG,CAAC,EAAE,GAAG,EAAE,UAAU,iBAAiB,GAAG,IAAI,CAAC,GAAG,WAAW,qBAAqB,iBAAiB,CAAC,CAAC,CAAC;AACxJ,0BAA0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AAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,WAAW,oBAAoB,gBAAgB,CAAC,CAAC,CAAC;AACzL,gCAAgC,KAAK,EAAE,wBAAwB,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,eAAe,GAAG,IAAI,CAAC,GAAG,WAAW,eAAe,eAAe,CAAC,CAAC,CAAC;AACjL,gCAAgC,KAAK,EAAE,wBAAwB,WAAW,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,GAAG,WAAW,aAAa,CAAC,CAAC;ACpB5J,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 {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AA0BA,mCAAmC,CAAC,SAAS,WAAW,CAAE,SAAQ,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC;CAAG;AAEzG,4BAA4B,CAAC;IAC3B,oCAAoC;IACpC,WAAW,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Button.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/useToggleButton.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/useToggleButtonGroup.ts","packages/@react-aria/button/src/packages/@react-aria/button/src/index.ts","packages/@react-aria/button/src/index.ts"],"sourcesContent":[null,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 {useToggleButtonGroup, useToggleButtonGroupItem} from './useToggleButtonGroup';\nexport type {AriaButtonOptions, ButtonAria} from './useButton';\nexport type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';\nexport type {AriaToggleButtonGroupProps, ToggleButtonGroupAria, AriaToggleButtonGroupItemProps} from './useToggleButtonGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -33,7 +33,7 @@ function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) {
33
33
  else additionalProps = {
34
34
  role: 'button',
35
35
  tabIndex: isDisabled ? undefined : 0,
36
- href: elementType === 'a' && isDisabled ? undefined : href,
36
+ href: elementType === 'a' && !isDisabled ? href : undefined,
37
37
  target: elementType === 'a' ? target : undefined,
38
38
  type: elementType === 'input' ? type : undefined,
39
39
  disabled: elementType === 'input' ? isDisabled : undefined,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAsCM,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,UAAU,aAAa,YAAY;QACnC,MAAM,gBAAgB,OAAO,aAAa,YAAY;QACtD,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;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,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,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} from '@react-aria/focus';\nimport {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 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 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 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.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;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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} from '@react-aria/focus';\nimport {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 tabIndex: isDisabled ? undefined : 0,\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 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.main.js.map"}
@@ -27,7 +27,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
27
27
  else additionalProps = {
28
28
  role: 'button',
29
29
  tabIndex: isDisabled ? undefined : 0,
30
- href: elementType === 'a' && isDisabled ? undefined : href,
30
+ href: elementType === 'a' && !isDisabled ? href : undefined,
31
31
  target: elementType === 'a' ? target : undefined,
32
32
  type: elementType === 'input' ? type : undefined,
33
33
  disabled: elementType === 'input' ? isDisabled : undefined,
@@ -27,7 +27,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
27
27
  else additionalProps = {
28
28
  role: 'button',
29
29
  tabIndex: isDisabled ? undefined : 0,
30
- href: elementType === 'a' && isDisabled ? undefined : href,
30
+ href: elementType === 'a' && !isDisabled ? href : undefined,
31
31
  target: elementType === 'a' ? target : undefined,
32
32
  type: elementType === 'input' ? type : undefined,
33
33
  disabled: elementType === 'input' ? isDisabled : undefined,
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAsCM,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,UAAU,aAAa,YAAY;QACnC,MAAM,gBAAgB,OAAO,aAAa,YAAY;QACtD,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,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} from '@react-aria/focus';\nimport {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 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 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 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;;;AAsCM,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,UAAU,aAAa,YAAY;QACnC,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,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} from '@react-aria/focus';\nimport {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 tabIndex: isDisabled ? undefined : 0,\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 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"}
@@ -27,6 +27,8 @@ function $c49208f7d2aac50b$export$51e84d46ca0bc451(props, state, ref) {
27
27
  }, ref);
28
28
  return {
29
29
  isPressed: isPressed,
30
+ isSelected: isSelected,
31
+ isDisabled: props.isDisabled || false,
30
32
  buttonProps: (0, $4M9F2$reactariautils.mergeProps)(buttonProps, {
31
33
  'aria-pressed': isSelected
32
34
  })
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA6BM,SAAS,0CAAgB,KAA2C,EAAE,KAAkB,EAAE,GAAmB;IAClH,MAAM,cAAC,UAAU,EAAC,GAAG;IACrB,MAAM,aAAC,SAAS,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE;QACzC,GAAG,KAAK;QACR,SAAS,CAAA,GAAA,2BAAI,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO;IAC5C,GAAG;IAEH,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,gCAAS,EAAE,aAAa;YACnC,gBAAgB;QAClB;IACF;AACF","sources":["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\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, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): 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: AriaToggleButtonOptions<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":"useToggleButton.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoCM,SAAS,0CAAgB,KAA2C,EAAE,KAAkB,EAAE,GAAmB;IAClH,MAAM,cAAC,UAAU,EAAC,GAAG;IACrB,MAAM,aAAC,SAAS,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE;QACzC,GAAG,KAAK;QACR,SAAS,CAAA,GAAA,2BAAI,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO;IAC5C,GAAG;IAEH,OAAO;mBACL;oBACA;QACA,YAAY,MAAM,UAAU,IAAI;QAChC,aAAa,CAAA,GAAA,gCAAS,EAAE,aAAa;YACnC,gBAAgB;QAClB;IACF;AACF","sources":["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\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, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {}\n\nexport interface ToggleButtonAria<T> extends ButtonAria<T> {\n /** Whether the button is selected. */\n isSelected: boolean,\n /** Whether the button is disabled. */\n isDisabled: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ToggleButtonAria<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: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<any>): ToggleButtonAria<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 isSelected,\n isDisabled: props.isDisabled || false,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n };\n}\n"],"names":[],"version":3,"file":"useToggleButton.main.js.map"}
@@ -21,6 +21,8 @@ function $55f54f7887471b58$export$51e84d46ca0bc451(props, state, ref) {
21
21
  }, ref);
22
22
  return {
23
23
  isPressed: isPressed,
24
+ isSelected: isSelected,
25
+ isDisabled: props.isDisabled || false,
24
26
  buttonProps: (0, $h7Tql$mergeProps)(buttonProps, {
25
27
  'aria-pressed': isSelected
26
28
  })
@@ -21,6 +21,8 @@ function $55f54f7887471b58$export$51e84d46ca0bc451(props, state, ref) {
21
21
  }, ref);
22
22
  return {
23
23
  isPressed: isPressed,
24
+ isSelected: isSelected,
25
+ isDisabled: props.isDisabled || false,
24
26
  buttonProps: (0, $h7Tql$mergeProps)(buttonProps, {
25
27
  'aria-pressed': isSelected
26
28
  })
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA6BM,SAAS,0CAAgB,KAA2C,EAAE,KAAkB,EAAE,GAAmB;IAClH,MAAM,cAAC,UAAU,EAAC,GAAG;IACrB,MAAM,aAAC,SAAS,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,yCAAQ,EAAE;QACzC,GAAG,KAAK;QACR,SAAS,CAAA,GAAA,YAAI,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO;IAC5C,GAAG;IAEH,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,iBAAS,EAAE,aAAa;YACnC,gBAAgB;QAClB;IACF;AACF","sources":["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\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, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): 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: AriaToggleButtonOptions<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":"useToggleButton.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAoCM,SAAS,0CAAgB,KAA2C,EAAE,KAAkB,EAAE,GAAmB;IAClH,MAAM,cAAC,UAAU,EAAC,GAAG;IACrB,MAAM,aAAC,SAAS,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,yCAAQ,EAAE;QACzC,GAAG,KAAK;QACR,SAAS,CAAA,GAAA,YAAI,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO;IAC5C,GAAG;IAEH,OAAO;mBACL;oBACA;QACA,YAAY,MAAM,UAAU,IAAI;QAChC,aAAa,CAAA,GAAA,iBAAS,EAAE,aAAa;YACnC,gBAAgB;QAClB;IACF;AACF","sources":["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\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, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\n\nexport interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {}\n\nexport interface ToggleButtonAria<T> extends ButtonAria<T> {\n /** Whether the button is selected. */\n isSelected: boolean,\n /** Whether the button is disabled. */\n isDisabled: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ToggleButtonAria<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: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<any>): ToggleButtonAria<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 isSelected,\n isDisabled: props.isDisabled || false,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected\n })\n };\n}\n"],"names":[],"version":3,"file":"useToggleButton.module.js.map"}
@@ -0,0 +1,63 @@
1
+ var $c49208f7d2aac50b$exports = require("./useToggleButton.main.js");
2
+ var $eYVcO$reactariatoolbar = require("@react-aria/toolbar");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useToggleButtonGroup", () => $7d1e6c2af0d638cd$export$dd5580ae642f110f);
10
+ $parcel$export(module.exports, "useToggleButtonGroupItem", () => $7d1e6c2af0d638cd$export$bc53712daae3d6e6);
11
+ /*
12
+ * Copyright 2024 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+ function $7d1e6c2af0d638cd$export$dd5580ae642f110f(props, state, ref) {
24
+ let { isDisabled: isDisabled } = props;
25
+ let { toolbarProps: toolbarProps } = (0, $eYVcO$reactariatoolbar.useToolbar)(props, ref);
26
+ return {
27
+ groupProps: {
28
+ ...toolbarProps,
29
+ role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,
30
+ 'aria-disabled': isDisabled
31
+ }
32
+ };
33
+ }
34
+ function $7d1e6c2af0d638cd$export$bc53712daae3d6e6(props, state, ref) {
35
+ let toggleState = {
36
+ isSelected: state.selectedKeys.has(props.id),
37
+ setSelected (isSelected) {
38
+ state.setSelected(props.id, isSelected);
39
+ },
40
+ toggle () {
41
+ state.toggleKey(props.id);
42
+ }
43
+ };
44
+ let { isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, buttonProps: buttonProps } = (0, $c49208f7d2aac50b$exports.useToggleButton)({
45
+ ...props,
46
+ id: undefined,
47
+ isDisabled: props.isDisabled || state.isDisabled
48
+ }, toggleState, ref);
49
+ if (state.selectionMode === 'single') {
50
+ buttonProps.role = 'radio';
51
+ buttonProps['aria-checked'] = toggleState.isSelected;
52
+ delete buttonProps['aria-pressed'];
53
+ }
54
+ return {
55
+ isPressed: isPressed,
56
+ isSelected: isSelected,
57
+ isDisabled: isDisabled,
58
+ buttonProps: buttonProps
59
+ };
60
+ }
61
+
62
+
63
+ //# sourceMappingURL=useToggleButtonGroup.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAqB,KAAiC,EAAE,KAAuB,EAAE,GAAkC;IACjI,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,kCAAS,EAAE,OAAO;IAEvC,OAAO;QACL,YAAY;YACV,GAAG,YAAY;YACf,MAAM,MAAM,aAAa,KAAK,WAAW,eAAe,aAAa,IAAI;YACzE,iBAAiB;QACnB;IACF;AACF;AAgBO,SAAS,0CAAyB,KAAoD,EAAE,KAAuB,EAAE,GAAmB;IACzI,IAAI,cAA2B;QAC7B,YAAY,MAAM,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE;QAC3C,aAAY,UAAU;YACpB,MAAM,WAAW,CAAC,MAAM,EAAE,EAAE;QAC9B;QACA;YACE,MAAM,SAAS,CAAC,MAAM,EAAE;QAC1B;IACF;IAEA,IAAI,aAAC,SAAS,cAAE,UAAU,cAAE,UAAU,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,yCAAc,EAAE;QACrE,GAAG,KAAK;QACR,IAAI;QACJ,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;IAClD,GAAG,aAAa;IAChB,IAAI,MAAM,aAAa,KAAK,UAAU;QACpC,YAAY,IAAI,GAAG;QACnB,WAAW,CAAC,eAAe,GAAG,YAAY,UAAU;QACpD,OAAO,WAAW,CAAC,eAAe;IACpC;IAEA,OAAO;mBACL;oBACA;oBACA;qBACA;IACF;AACF","sources":["packages/@react-aria/button/src/useToggleButtonGroup.ts"],"sourcesContent":["/*\n * Copyright 2024 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} from 'react';\nimport {AriaLabelingProps, DOMAttributes, Orientation, RefObject} from '@react-types/shared';\nimport {AriaToggleButtonGroupItemProps} from '@react-types/button';\nimport {ToggleButtonAria, useToggleButton} from './useToggleButton';\nimport {ToggleGroupProps, ToggleGroupState, ToggleState} from '@react-stately/toggle';\nimport {useToolbar} from '@react-aria/toolbar';\n\nexport interface AriaToggleButtonGroupProps extends ToggleGroupProps, AriaLabelingProps {\n /**\n * The orientation of the the toggle button group.\n * @default 'horizontal'\n */\n orientation?: Orientation\n}\n\nexport interface ToggleButtonGroupAria {\n /**\n * Props for the toggle button group container.\n */\n groupProps: DOMAttributes\n}\n\nexport function useToggleButtonGroup(props: AriaToggleButtonGroupProps, state: ToggleGroupState, ref: RefObject<HTMLElement | null>): ToggleButtonGroupAria {\n let {isDisabled} = props;\n let {toolbarProps} = useToolbar(props, ref);\n\n return {\n groupProps: {\n ...toolbarProps,\n role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,\n 'aria-disabled': isDisabled\n }\n };\n}\n\nexport type {AriaToggleButtonGroupItemProps};\nexport interface AriaToggleButtonGroupItemOptions<E extends ElementType> extends Omit<AriaToggleButtonGroupItemProps<E>, 'children'> {}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'button'>, state: ToggleGroupState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'a'>, state: ToggleGroupState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'div'>, state: ToggleGroupState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'input'>, state: ToggleGroupState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'span'>, state: ToggleGroupState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<Element | null>): ToggleButtonAria<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 useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<any>): ToggleButtonAria<HTMLAttributes<any>> {\n let toggleState: ToggleState = {\n isSelected: state.selectedKeys.has(props.id),\n setSelected(isSelected) {\n state.setSelected(props.id, isSelected);\n },\n toggle() {\n state.toggleKey(props.id);\n }\n };\n\n let {isPressed, isSelected, isDisabled, buttonProps} = useToggleButton({\n ...props,\n id: undefined,\n isDisabled: props.isDisabled || state.isDisabled\n }, toggleState, ref);\n if (state.selectionMode === 'single') {\n buttonProps.role = 'radio';\n buttonProps['aria-checked'] = toggleState.isSelected;\n delete buttonProps['aria-pressed'];\n }\n\n return {\n isPressed,\n isSelected,\n isDisabled,\n buttonProps\n };\n}\n"],"names":[],"version":3,"file":"useToggleButtonGroup.main.js.map"}
@@ -0,0 +1,57 @@
1
+ import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./useToggleButton.mjs";
2
+ import {useToolbar as $9iEyV$useToolbar} from "@react-aria/toolbar";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $4547d1bf40011fdf$export$dd5580ae642f110f(props, state, ref) {
17
+ let { isDisabled: isDisabled } = props;
18
+ let { toolbarProps: toolbarProps } = (0, $9iEyV$useToolbar)(props, ref);
19
+ return {
20
+ groupProps: {
21
+ ...toolbarProps,
22
+ role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,
23
+ 'aria-disabled': isDisabled
24
+ }
25
+ };
26
+ }
27
+ function $4547d1bf40011fdf$export$bc53712daae3d6e6(props, state, ref) {
28
+ let toggleState = {
29
+ isSelected: state.selectedKeys.has(props.id),
30
+ setSelected (isSelected) {
31
+ state.setSelected(props.id, isSelected);
32
+ },
33
+ toggle () {
34
+ state.toggleKey(props.id);
35
+ }
36
+ };
37
+ let { isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, buttonProps: buttonProps } = (0, $55f54f7887471b58$export$51e84d46ca0bc451)({
38
+ ...props,
39
+ id: undefined,
40
+ isDisabled: props.isDisabled || state.isDisabled
41
+ }, toggleState, ref);
42
+ if (state.selectionMode === 'single') {
43
+ buttonProps.role = 'radio';
44
+ buttonProps['aria-checked'] = toggleState.isSelected;
45
+ delete buttonProps['aria-pressed'];
46
+ }
47
+ return {
48
+ isPressed: isPressed,
49
+ isSelected: isSelected,
50
+ isDisabled: isDisabled,
51
+ buttonProps: buttonProps
52
+ };
53
+ }
54
+
55
+
56
+ export {$4547d1bf40011fdf$export$dd5580ae642f110f as useToggleButtonGroup, $4547d1bf40011fdf$export$bc53712daae3d6e6 as useToggleButtonGroupItem};
57
+ //# sourceMappingURL=useToggleButtonGroup.module.js.map
@@ -0,0 +1,57 @@
1
+ import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./useToggleButton.module.js";
2
+ import {useToolbar as $9iEyV$useToolbar} from "@react-aria/toolbar";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $4547d1bf40011fdf$export$dd5580ae642f110f(props, state, ref) {
17
+ let { isDisabled: isDisabled } = props;
18
+ let { toolbarProps: toolbarProps } = (0, $9iEyV$useToolbar)(props, ref);
19
+ return {
20
+ groupProps: {
21
+ ...toolbarProps,
22
+ role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,
23
+ 'aria-disabled': isDisabled
24
+ }
25
+ };
26
+ }
27
+ function $4547d1bf40011fdf$export$bc53712daae3d6e6(props, state, ref) {
28
+ let toggleState = {
29
+ isSelected: state.selectedKeys.has(props.id),
30
+ setSelected (isSelected) {
31
+ state.setSelected(props.id, isSelected);
32
+ },
33
+ toggle () {
34
+ state.toggleKey(props.id);
35
+ }
36
+ };
37
+ let { isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, buttonProps: buttonProps } = (0, $55f54f7887471b58$export$51e84d46ca0bc451)({
38
+ ...props,
39
+ id: undefined,
40
+ isDisabled: props.isDisabled || state.isDisabled
41
+ }, toggleState, ref);
42
+ if (state.selectionMode === 'single') {
43
+ buttonProps.role = 'radio';
44
+ buttonProps['aria-checked'] = toggleState.isSelected;
45
+ delete buttonProps['aria-pressed'];
46
+ }
47
+ return {
48
+ isPressed: isPressed,
49
+ isSelected: isSelected,
50
+ isDisabled: isDisabled,
51
+ buttonProps: buttonProps
52
+ };
53
+ }
54
+
55
+
56
+ export {$4547d1bf40011fdf$export$dd5580ae642f110f as useToggleButtonGroup, $4547d1bf40011fdf$export$bc53712daae3d6e6 as useToggleButtonGroupItem};
57
+ //# sourceMappingURL=useToggleButtonGroup.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAqB,KAAiC,EAAE,KAAuB,EAAE,GAAkC;IACjI,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,OAAO;IAEvC,OAAO;QACL,YAAY;YACV,GAAG,YAAY;YACf,MAAM,MAAM,aAAa,KAAK,WAAW,eAAe,aAAa,IAAI;YACzE,iBAAiB;QACnB;IACF;AACF;AAgBO,SAAS,0CAAyB,KAAoD,EAAE,KAAuB,EAAE,GAAmB;IACzI,IAAI,cAA2B;QAC7B,YAAY,MAAM,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE;QAC3C,aAAY,UAAU;YACpB,MAAM,WAAW,CAAC,MAAM,EAAE,EAAE;QAC9B;QACA;YACE,MAAM,SAAS,CAAC,MAAM,EAAE;QAC1B;IACF;IAEA,IAAI,aAAC,SAAS,cAAE,UAAU,cAAE,UAAU,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,yCAAc,EAAE;QACrE,GAAG,KAAK;QACR,IAAI;QACJ,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;IAClD,GAAG,aAAa;IAChB,IAAI,MAAM,aAAa,KAAK,UAAU;QACpC,YAAY,IAAI,GAAG;QACnB,WAAW,CAAC,eAAe,GAAG,YAAY,UAAU;QACpD,OAAO,WAAW,CAAC,eAAe;IACpC;IAEA,OAAO;mBACL;oBACA;oBACA;qBACA;IACF;AACF","sources":["packages/@react-aria/button/src/useToggleButtonGroup.ts"],"sourcesContent":["/*\n * Copyright 2024 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} from 'react';\nimport {AriaLabelingProps, DOMAttributes, Orientation, RefObject} from '@react-types/shared';\nimport {AriaToggleButtonGroupItemProps} from '@react-types/button';\nimport {ToggleButtonAria, useToggleButton} from './useToggleButton';\nimport {ToggleGroupProps, ToggleGroupState, ToggleState} from '@react-stately/toggle';\nimport {useToolbar} from '@react-aria/toolbar';\n\nexport interface AriaToggleButtonGroupProps extends ToggleGroupProps, AriaLabelingProps {\n /**\n * The orientation of the the toggle button group.\n * @default 'horizontal'\n */\n orientation?: Orientation\n}\n\nexport interface ToggleButtonGroupAria {\n /**\n * Props for the toggle button group container.\n */\n groupProps: DOMAttributes\n}\n\nexport function useToggleButtonGroup(props: AriaToggleButtonGroupProps, state: ToggleGroupState, ref: RefObject<HTMLElement | null>): ToggleButtonGroupAria {\n let {isDisabled} = props;\n let {toolbarProps} = useToolbar(props, ref);\n\n return {\n groupProps: {\n ...toolbarProps,\n role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,\n 'aria-disabled': isDisabled\n }\n };\n}\n\nexport type {AriaToggleButtonGroupItemProps};\nexport interface AriaToggleButtonGroupItemOptions<E extends ElementType> extends Omit<AriaToggleButtonGroupItemProps<E>, 'children'> {}\n\n// Order with overrides is important: 'button' should be default\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'button'>, state: ToggleGroupState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'a'>, state: ToggleGroupState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'div'>, state: ToggleGroupState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'input'>, state: ToggleGroupState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'span'>, state: ToggleGroupState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<Element | null>): ToggleButtonAria<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 useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<any>): ToggleButtonAria<HTMLAttributes<any>> {\n let toggleState: ToggleState = {\n isSelected: state.selectedKeys.has(props.id),\n setSelected(isSelected) {\n state.setSelected(props.id, isSelected);\n },\n toggle() {\n state.toggleKey(props.id);\n }\n };\n\n let {isPressed, isSelected, isDisabled, buttonProps} = useToggleButton({\n ...props,\n id: undefined,\n isDisabled: props.isDisabled || state.isDisabled\n }, toggleState, ref);\n if (state.selectionMode === 'single') {\n buttonProps.role = 'radio';\n buttonProps['aria-checked'] = toggleState.isSelected;\n delete buttonProps['aria-pressed'];\n }\n\n return {\n isPressed,\n isSelected,\n isDisabled,\n buttonProps\n };\n}\n"],"names":[],"version":3,"file":"useToggleButtonGroup.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/button",
3
- "version": "3.10.1",
3
+ "version": "3.11.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,19 +22,20 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.18.4",
26
- "@react-aria/interactions": "^3.22.4",
27
- "@react-aria/utils": "^3.25.3",
28
- "@react-stately/toggle": "^3.7.8",
29
- "@react-types/button": "^3.10.0",
30
- "@react-types/shared": "^3.25.0",
25
+ "@react-aria/focus": "^3.19.0",
26
+ "@react-aria/interactions": "^3.22.5",
27
+ "@react-aria/toolbar": "3.0.0-beta.11",
28
+ "@react-aria/utils": "^3.26.0",
29
+ "@react-stately/toggle": "^3.8.0",
30
+ "@react-types/button": "^3.10.1",
31
+ "@react-types/shared": "^3.26.0",
31
32
  "@swc/helpers": "^0.5.0"
32
33
  },
33
34
  "peerDependencies": {
34
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
35
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
35
36
  },
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "8e0a28d188cdbdbd2b32296fa034b1b02ddde229"
40
+ "gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
40
41
  }
package/src/index.ts CHANGED
@@ -11,5 +11,7 @@
11
11
  */
12
12
  export {useButton} from './useButton';
13
13
  export {useToggleButton} from './useToggleButton';
14
+ export {useToggleButtonGroup, useToggleButtonGroupItem} from './useToggleButtonGroup';
14
15
  export type {AriaButtonOptions, ButtonAria} from './useButton';
15
16
  export type {AriaButtonProps, AriaToggleButtonProps} from '@react-types/button';
17
+ export type {AriaToggleButtonGroupProps, ToggleButtonGroupAria, AriaToggleButtonGroupItemProps} from './useToggleButtonGroup';
package/src/useButton.ts CHANGED
@@ -75,7 +75,7 @@ export function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<
75
75
  additionalProps = {
76
76
  role: 'button',
77
77
  tabIndex: isDisabled ? undefined : 0,
78
- href: elementType === 'a' && isDisabled ? undefined : href,
78
+ href: elementType === 'a' && !isDisabled ? href : undefined,
79
79
  target: elementType === 'a' ? target : undefined,
80
80
  type: elementType === 'input' ? type : undefined,
81
81
  disabled: elementType === 'input' ? isDisabled : undefined,
@@ -26,18 +26,25 @@ import {ToggleState} from '@react-stately/toggle';
26
26
 
27
27
  export interface AriaToggleButtonOptions<E extends ElementType> extends Omit<AriaToggleButtonProps<E>, 'children'> {}
28
28
 
29
+ export interface ToggleButtonAria<T> extends ButtonAria<T> {
30
+ /** Whether the button is selected. */
31
+ isSelected: boolean,
32
+ /** Whether the button is disabled. */
33
+ isDisabled: boolean
34
+ }
35
+
29
36
  // Order with overrides is important: 'button' should be default
30
- export function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
31
- export function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
32
- export function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
33
- export function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
34
- export function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;
35
- export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ButtonAria<DOMAttributes>;
37
+ export function useToggleButton(props: AriaToggleButtonOptions<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
38
+ export function useToggleButton(props: AriaToggleButtonOptions<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
39
+ export function useToggleButton(props: AriaToggleButtonOptions<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;
40
+ export function useToggleButton(props: AriaToggleButtonOptions<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;
41
+ export function useToggleButton(props: AriaToggleButtonOptions<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;
42
+ export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<Element | null>): ToggleButtonAria<DOMAttributes>;
36
43
  /**
37
44
  * Provides the behavior and accessibility implementation for a toggle button component.
38
45
  * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.
39
46
  */
40
- export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {
47
+ export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, state: ToggleState, ref: RefObject<any>): ToggleButtonAria<HTMLAttributes<any>> {
41
48
  const {isSelected} = state;
42
49
  const {isPressed, buttonProps} = useButton({
43
50
  ...props,
@@ -46,6 +53,8 @@ export function useToggleButton(props: AriaToggleButtonOptions<ElementType>, sta
46
53
 
47
54
  return {
48
55
  isPressed,
56
+ isSelected,
57
+ isDisabled: props.isDisabled || false,
49
58
  buttonProps: mergeProps(buttonProps, {
50
59
  'aria-pressed': isSelected
51
60
  })
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {
14
+ AnchorHTMLAttributes,
15
+ ButtonHTMLAttributes,
16
+ ElementType,
17
+ HTMLAttributes,
18
+ InputHTMLAttributes
19
+ } from 'react';
20
+ import {AriaLabelingProps, DOMAttributes, Orientation, RefObject} from '@react-types/shared';
21
+ import {AriaToggleButtonGroupItemProps} from '@react-types/button';
22
+ import {ToggleButtonAria, useToggleButton} from './useToggleButton';
23
+ import {ToggleGroupProps, ToggleGroupState, ToggleState} from '@react-stately/toggle';
24
+ import {useToolbar} from '@react-aria/toolbar';
25
+
26
+ export interface AriaToggleButtonGroupProps extends ToggleGroupProps, AriaLabelingProps {
27
+ /**
28
+ * The orientation of the the toggle button group.
29
+ * @default 'horizontal'
30
+ */
31
+ orientation?: Orientation
32
+ }
33
+
34
+ export interface ToggleButtonGroupAria {
35
+ /**
36
+ * Props for the toggle button group container.
37
+ */
38
+ groupProps: DOMAttributes
39
+ }
40
+
41
+ export function useToggleButtonGroup(props: AriaToggleButtonGroupProps, state: ToggleGroupState, ref: RefObject<HTMLElement | null>): ToggleButtonGroupAria {
42
+ let {isDisabled} = props;
43
+ let {toolbarProps} = useToolbar(props, ref);
44
+
45
+ return {
46
+ groupProps: {
47
+ ...toolbarProps,
48
+ role: state.selectionMode === 'single' ? 'radiogroup' : toolbarProps.role,
49
+ 'aria-disabled': isDisabled
50
+ }
51
+ };
52
+ }
53
+
54
+ export type {AriaToggleButtonGroupItemProps};
55
+ export interface AriaToggleButtonGroupItemOptions<E extends ElementType> extends Omit<AriaToggleButtonGroupItemProps<E>, 'children'> {}
56
+
57
+ // Order with overrides is important: 'button' should be default
58
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'button'>, state: ToggleGroupState, ref: RefObject<HTMLButtonElement | null>): ToggleButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
59
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'a'>, state: ToggleGroupState, ref: RefObject<HTMLAnchorElement | null>): ToggleButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
60
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'div'>, state: ToggleGroupState, ref: RefObject<HTMLDivElement | null>): ToggleButtonAria<HTMLAttributes<HTMLDivElement>>;
61
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'input'>, state: ToggleGroupState, ref: RefObject<HTMLInputElement | null>): ToggleButtonAria<InputHTMLAttributes<HTMLInputElement>>;
62
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<'span'>, state: ToggleGroupState, ref: RefObject<HTMLSpanElement | null>): ToggleButtonAria<HTMLAttributes<HTMLSpanElement>>;
63
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<Element | null>): ToggleButtonAria<DOMAttributes>;
64
+ /**
65
+ * Provides the behavior and accessibility implementation for a toggle button component.
66
+ * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.
67
+ */
68
+ export function useToggleButtonGroupItem(props: AriaToggleButtonGroupItemOptions<ElementType>, state: ToggleGroupState, ref: RefObject<any>): ToggleButtonAria<HTMLAttributes<any>> {
69
+ let toggleState: ToggleState = {
70
+ isSelected: state.selectedKeys.has(props.id),
71
+ setSelected(isSelected) {
72
+ state.setSelected(props.id, isSelected);
73
+ },
74
+ toggle() {
75
+ state.toggleKey(props.id);
76
+ }
77
+ };
78
+
79
+ let {isPressed, isSelected, isDisabled, buttonProps} = useToggleButton({
80
+ ...props,
81
+ id: undefined,
82
+ isDisabled: props.isDisabled || state.isDisabled
83
+ }, toggleState, ref);
84
+ if (state.selectionMode === 'single') {
85
+ buttonProps.role = 'radio';
86
+ buttonProps['aria-checked'] = toggleState.isSelected;
87
+ delete buttonProps['aria-pressed'];
88
+ }
89
+
90
+ return {
91
+ isPressed,
92
+ isSelected,
93
+ isDisabled,
94
+ buttonProps
95
+ };
96
+ }