@fluentui/react-aria 9.3.33 → 9.3.35

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/CHANGELOG.json CHANGED
@@ -2,7 +2,55 @@
2
2
  "name": "@fluentui/react-aria",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 29 Aug 2023 12:53:36 GMT",
5
+ "date": "Tue, 05 Sep 2023 15:35:07 GMT",
6
+ "tag": "@fluentui/react-aria_v9.3.35",
7
+ "version": "9.3.35",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-aria",
13
+ "comment": "Bump @fluentui/react-utilities to v9.13.2",
14
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 05 Sep 2023 13:29:15 GMT",
21
+ "tag": "@fluentui/react-aria_v9.3.34",
22
+ "version": "9.3.34",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "bernardo.sunderhus@gmail.com",
27
+ "package": "@fluentui/react-aria",
28
+ "commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
29
+ "comment": "bumps @swc/helpers version to 0.5.1"
30
+ },
31
+ {
32
+ "author": "bernardo.sunderhus@gmail.com",
33
+ "package": "@fluentui/react-aria",
34
+ "commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
35
+ "comment": "bumps react peer dependencies to v16.14.0"
36
+ },
37
+ {
38
+ "author": "beachball",
39
+ "package": "@fluentui/react-aria",
40
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.4",
41
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "@fluentui/react-aria",
46
+ "comment": "Bump @fluentui/react-utilities to v9.13.1",
47
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "date": "Tue, 29 Aug 2023 12:57:36 GMT",
6
54
  "tag": "@fluentui/react-aria_v9.3.33",
7
55
  "version": "9.3.33",
8
56
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Change Log - @fluentui/react-aria
2
2
 
3
- This log was last generated on Tue, 29 Aug 2023 12:53:36 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 05 Sep 2023 15:35:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.3.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.3.35)
8
+
9
+ Tue, 05 Sep 2023 15:35:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.34..@fluentui/react-aria_v9.3.35)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
15
+
16
+ ## [9.3.34](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.3.34)
17
+
18
+ Tue, 05 Sep 2023 13:29:15 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.33..@fluentui/react-aria_v9.3.34)
20
+
21
+ ### Patches
22
+
23
+ - bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
24
+ - bumps react peer dependencies to v16.14.0 ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
25
+ - Bump @fluentui/keyboard-keys to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
26
+ - Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
27
+
7
28
  ## [9.3.33](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.3.33)
8
29
 
9
- Tue, 29 Aug 2023 12:53:36 GMT
30
+ Tue, 29 Aug 2023 12:57:36 GMT
10
31
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.32..@fluentui/react-aria_v9.3.33)
11
32
 
12
33
  ### Patches
@@ -28,7 +28,7 @@ import * as React from 'react';
28
28
  * )
29
29
  * ```
30
30
  */ export function useARIAButtonProps(type, props) {
31
- const { disabled , disabledFocusable =false , ['aria-disabled']: ariaDisabled , onClick , onKeyDown , onKeyUp , ...rest } = props !== null && props !== void 0 ? props : {};
31
+ const { disabled, disabledFocusable = false, ['aria-disabled']: ariaDisabled, onClick, onKeyDown, onKeyUp, ...rest } = props !== null && props !== void 0 ? props : {};
32
32
  const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;
33
33
  const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;
34
34
  const handleClick = useEventCallback((ev)=>{
@@ -36,11 +36,13 @@ import * as React from 'react';
36
36
  ev.preventDefault();
37
37
  ev.stopPropagation();
38
38
  } else {
39
- onClick === null || onClick === void 0 ? void 0 : onClick(ev);
39
+ var _onClick;
40
+ (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(ev);
40
41
  }
41
42
  });
42
43
  const handleKeyDown = useEventCallback((ev)=>{
43
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
44
+ var _onKeyDown;
45
+ (_onKeyDown = onKeyDown) === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(ev);
44
46
  if (ev.isDefaultPrevented()) {
45
47
  return;
46
48
  }
@@ -59,7 +61,8 @@ import * as React from 'react';
59
61
  }
60
62
  });
61
63
  const handleKeyUp = useEventCallback((ev)=>{
62
- onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
64
+ var _onKeyUp;
65
+ (_onKeyUp = onKeyUp) === null || _onKeyUp === void 0 ? void 0 : _onKeyUp(ev);
63
66
  if (ev.isDefaultPrevented()) {
64
67
  return;
65
68
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useARIAButtonProps.ts"],"sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type { ARIAButtonElementIntersection, ARIAButtonProps, ARIAButtonResultProps, ARIAButtonType } from './types';\n\n/**\n * @internal\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of non native button elements. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n *\n * @param type - the proper scenario to be interpreted by the hook.\n * 1. `button` - Minimal interference from the hook, as semantic button already supports most of the states\n * 2. `a` or `div` - Proper keyboard/mouse handling plus other support to ensure ARIA behavior\n * @param props - the props to be passed down the line to the desired element.\n * This hook will encapsulate proper properties, such as `onClick`, `onKeyDown`, `onKeyUp`, etc,.\n *\n * @example\n * ```tsx\n * const buttonProps = useARIAButtonProps('a', {\n * href: './some-route'\n * onClick: () => console.log('this should run both on click and Space and Enter')\n * })\n *\n * // ...\n *\n * return (\n * <a {...buttonProps}>This anchor will behave as a proper button</a>\n * )\n * ```\n */\nexport function useARIAButtonProps<Type extends ARIAButtonType, Props extends ARIAButtonProps<Type>>(\n type?: Type,\n props?: Props,\n): ARIAButtonResultProps<Type, Props> {\n const {\n disabled,\n disabledFocusable = false,\n ['aria-disabled']: ariaDisabled,\n onClick,\n onKeyDown,\n onKeyUp,\n ...rest\n } = props ?? {};\n\n const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;\n\n const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;\n\n const handleClick = useEventCallback((ev: React.MouseEvent<ARIAButtonElementIntersection>) => {\n if (isDisabled) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onClick?.(ev);\n }\n });\n\n const handleKeyDown = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {\n onKeyDown?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n\n if (key === Space) {\n ev.preventDefault();\n return;\n }\n\n // If enter is pressed, activate the button\n else if (key === Enter) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n\n const handleKeyUp = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {\n onKeyUp?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n\n if (key === Space) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (type === 'button' || type === undefined) {\n return {\n ...rest,\n disabled: disabled && !disabledFocusable,\n 'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,\n // onclick should still use internal handler to ensure prevention if disabled\n // if disabledFocusable then there's no requirement for handlers as those events should not be propagated\n onClick: disabledFocusable ? undefined : handleClick,\n onKeyUp: disabledFocusable ? undefined : onKeyUp,\n onKeyDown: disabledFocusable ? undefined : onKeyDown,\n } as ARIAButtonResultProps<Type, Props>;\n }\n\n // If an <a> or <div> tag is to be rendered we have to remove disabled and type,\n // and set aria-disabled, role and tabIndex.\n else {\n const resultProps = {\n role: 'button',\n tabIndex: disabled && !disabledFocusable ? undefined : 0,\n ...rest,\n // If it's not a <button> than listeners are required even with disabledFocusable\n // Since you cannot assure the default behavior of the element\n // E.g: <a> will redirect on click\n onClick: handleClick,\n onKeyUp: handleKeyUp,\n onKeyDown: handleKeyDown,\n 'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled,\n } as ARIAButtonResultProps<Type, Props>;\n\n if (type === 'a' && isDisabled) {\n (resultProps as ARIAButtonResultProps<'a', Props>).href = undefined;\n }\n\n return resultProps;\n }\n}\n"],"names":["Enter","Space","useEventCallback","React","useARIAButtonProps","type","props","disabled","disabledFocusable","ariaDisabled","onClick","onKeyDown","onKeyUp","rest","normalizedARIADisabled","isDisabled","handleClick","ev","preventDefault","stopPropagation","handleKeyDown","isDefaultPrevented","key","currentTarget","click","handleKeyUp","undefined","resultProps","role","tabIndex","href"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,0BAA0B;AACvD,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,YAAYC,WAAW,QAAQ;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,SAASC,mBACdC,IAAW,EACXC,KAAa,EACuB;IACpC,MAAM,EACJC,SAAQ,EACRC,mBAAoB,KAAK,CAAA,EACzB,CAAC,gBAAgB,EAAEC,aAAY,EAC/BC,QAAO,EACPC,UAAS,EACTC,QAAO,EACP,GAAGC,MACJ,GAAGP,kBAAAA,mBAAAA,QAAS,CAAC,CAAC;IAEf,MAAMQ,yBAAyB,OAAOL,iBAAiB,WAAWA,iBAAiB,SAASA,YAAY;IAExG,MAAMM,aAAaR,YAAYC,qBAAqBM;IAEpD,MAAME,cAAcd,iBAAiB,CAACe,KAAwD;QAC5F,IAAIF,YAAY;YACdE,GAAGC,cAAc;YACjBD,GAAGE,eAAe;QACpB,OAAO;YACLT,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUO;QACZ,CAAC;IACH;IAEA,MAAMG,gBAAgBlB,iBAAiB,CAACe,KAA2D;QACjGN,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAYM;QAEZ,IAAIA,GAAGI,kBAAkB,IAAI;YAC3B;QACF,CAAC;QAED,MAAMC,MAAML,GAAGK,GAAG;QAElB,IAAIP,cAAeO,CAAAA,QAAQtB,SAASsB,QAAQrB,KAAI,GAAI;YAClDgB,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACF,CAAC;QAED,IAAIG,QAAQrB,OAAO;YACjBgB,GAAGC,cAAc;YACjB;QACF,OAGK,IAAII,QAAQtB,OAAO;YACtBiB,GAAGC,cAAc;YACjBD,GAAGM,aAAa,CAACC,KAAK;QACxB,CAAC;IACH;IAEA,MAAMC,cAAcvB,iBAAiB,CAACe,KAA2D;QAC/FL,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUK;QAEV,IAAIA,GAAGI,kBAAkB,IAAI;YAC3B;QACF,CAAC;QAED,MAAMC,MAAML,GAAGK,GAAG;QAElB,IAAIP,cAAeO,CAAAA,QAAQtB,SAASsB,QAAQrB,KAAI,GAAI;YAClDgB,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACF,CAAC;QAED,IAAIG,QAAQrB,OAAO;YACjBgB,GAAGC,cAAc;YACjBD,GAAGM,aAAa,CAACC,KAAK;QACxB,CAAC;IACH;IAEA,+FAA+F;IAC/F,IAAInB,SAAS,YAAYA,SAASqB,WAAW;QAC3C,OAAO;YACL,GAAGb,IAAI;YACPN,UAAUA,YAAY,CAACC;YACvB,iBAAiBA,oBAAoB,IAAI,GAAGM,sBAAsB;YAClE,6EAA6E;YAC7E,yGAAyG;YACzGJ,SAASF,oBAAoBkB,YAAYV,WAAW;YACpDJ,SAASJ,oBAAoBkB,YAAYd,OAAO;YAChDD,WAAWH,oBAAoBkB,YAAYf,SAAS;QACtD;IACF,OAIK;QACH,MAAMgB,cAAc;YAClBC,MAAM;YACNC,UAAUtB,YAAY,CAACC,oBAAoBkB,YAAY,CAAC;YACxD,GAAGb,IAAI;YACP,iFAAiF;YACjF,8DAA8D;YAC9D,kCAAkC;YAClCH,SAASM;YACTJ,SAASa;YACTd,WAAWS;YACX,iBAAiBb,YAAYC,qBAAqBM;QACpD;QAEA,IAAIT,SAAS,OAAOU,YAAY;YAC7BY,YAAkDG,IAAI,GAAGJ;QAC5D,CAAC;QAED,OAAOC;IACT,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["useARIAButtonProps.ts"],"sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type { ARIAButtonElementIntersection, ARIAButtonProps, ARIAButtonResultProps, ARIAButtonType } from './types';\n\n/**\n * @internal\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of non native button elements. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n *\n * @param type - the proper scenario to be interpreted by the hook.\n * 1. `button` - Minimal interference from the hook, as semantic button already supports most of the states\n * 2. `a` or `div` - Proper keyboard/mouse handling plus other support to ensure ARIA behavior\n * @param props - the props to be passed down the line to the desired element.\n * This hook will encapsulate proper properties, such as `onClick`, `onKeyDown`, `onKeyUp`, etc,.\n *\n * @example\n * ```tsx\n * const buttonProps = useARIAButtonProps('a', {\n * href: './some-route'\n * onClick: () => console.log('this should run both on click and Space and Enter')\n * })\n *\n * // ...\n *\n * return (\n * <a {...buttonProps}>This anchor will behave as a proper button</a>\n * )\n * ```\n */\nexport function useARIAButtonProps<Type extends ARIAButtonType, Props extends ARIAButtonProps<Type>>(\n type?: Type,\n props?: Props,\n): ARIAButtonResultProps<Type, Props> {\n const {\n disabled,\n disabledFocusable = false,\n ['aria-disabled']: ariaDisabled,\n onClick,\n onKeyDown,\n onKeyUp,\n ...rest\n } = props ?? {};\n\n const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;\n\n const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;\n\n const handleClick = useEventCallback((ev: React.MouseEvent<ARIAButtonElementIntersection>) => {\n if (isDisabled) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onClick?.(ev);\n }\n });\n\n const handleKeyDown = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {\n onKeyDown?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n\n if (key === Space) {\n ev.preventDefault();\n return;\n }\n\n // If enter is pressed, activate the button\n else if (key === Enter) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n\n const handleKeyUp = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {\n onKeyUp?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n\n if (key === Space) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (type === 'button' || type === undefined) {\n return {\n ...rest,\n disabled: disabled && !disabledFocusable,\n 'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,\n // onclick should still use internal handler to ensure prevention if disabled\n // if disabledFocusable then there's no requirement for handlers as those events should not be propagated\n onClick: disabledFocusable ? undefined : handleClick,\n onKeyUp: disabledFocusable ? undefined : onKeyUp,\n onKeyDown: disabledFocusable ? undefined : onKeyDown,\n } as ARIAButtonResultProps<Type, Props>;\n }\n\n // If an <a> or <div> tag is to be rendered we have to remove disabled and type,\n // and set aria-disabled, role and tabIndex.\n else {\n const resultProps = {\n role: 'button',\n tabIndex: disabled && !disabledFocusable ? undefined : 0,\n ...rest,\n // If it's not a <button> than listeners are required even with disabledFocusable\n // Since you cannot assure the default behavior of the element\n // E.g: <a> will redirect on click\n onClick: handleClick,\n onKeyUp: handleKeyUp,\n onKeyDown: handleKeyDown,\n 'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled,\n } as ARIAButtonResultProps<Type, Props>;\n\n if (type === 'a' && isDisabled) {\n (resultProps as ARIAButtonResultProps<'a', Props>).href = undefined;\n }\n\n return resultProps;\n }\n}\n"],"names":["Enter","Space","useEventCallback","React","useARIAButtonProps","type","props","disabled","disabledFocusable","ariaDisabled","onClick","onKeyDown","onKeyUp","rest","normalizedARIADisabled","isDisabled","handleClick","ev","preventDefault","stopPropagation","handleKeyDown","isDefaultPrevented","key","currentTar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;QACF;QAEA,MAAMC,MAAML,GAAGK,GAAG;QAElB,IAAIP,cAAeO,CAAAA,QAAQtB,SAASsB,QAAQrB,KAAI,GAAI;YAClDgB,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACF;QAEA,IAAIG,QAAQrB,OAAO;YACjBgB,GAAGC,cAAc;YACjBD,GAAGM,aAAa,CAACC,KAAK;QACxB;IACF;IAEA,+FAA+F;IAC/F,IAAInB,SAAS,YAAYA,SAASqB,WAAW;QAC3C,OAAO;YACL,GAAGb,IAAI;YACPN,UAAUA,YAAY,CAACC;YACvB,iBAAiBA,oBAAoB,OAAOM;YAC5C,6EAA6E;YAC7E,yGAAyG;YACzGJ,SAASF,oBAAoBkB,YAAYV;YACzCJ,SAASJ,oBAAoBkB,YAAYd;YACzCD,WAAWH,oBAAoBkB,YAAYf;QAC7C;IACF,OAIK;QACH,MAAMgB,cAAc;YAClBC,MAAM;YACNC,UAAUtB,YAAY,CAACC,oBAAoBkB,YAAY;YACvD,GAAGb,IAAI;YACP,iFAAiF;YACjF,8DAA8D;YAC9D,kCAAkC;YAClCH,SAASM;YACTJ,SAASa;YACTd,WAAWS;YACX,iBAAiBb,YAAYC,qBAAqBM;QACpD;QAEA,IAAIT,SAAS,OAAOU,YAAY;YAC7BY,YAAkDG,IAAI,GAAGJ;QAC5D;QAEA,OAAOC;IACT;AACF"}
@@ -9,8 +9,9 @@ import { useARIAButtonProps } from './useARIAButtonProps';
9
9
  * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases
10
10
  * where no attribute addition is required.
11
11
  */ export const useARIAButtonShorthand = (value, options)=>{
12
+ var _shorthand;
12
13
  const shorthand = resolveShorthand(value, options);
13
14
  var _shorthand_as;
14
- const shorthandARIAButton = useARIAButtonProps((_shorthand_as = shorthand === null || shorthand === void 0 ? void 0 : shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);
15
+ const shorthandARIAButton = useARIAButtonProps((_shorthand_as = (_shorthand = shorthand) === null || _shorthand === void 0 ? void 0 : _shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);
15
16
  return shorthand && shorthandARIAButton;
16
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useARIAButtonShorthand.ts"],"sourcesContent":["import { resolveShorthand } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from './useARIAButtonProps';\nimport type { ResolveShorthandFunction } from '@fluentui/react-utilities';\nimport type { ARIAButtonProps, ARIAButtonSlotProps, ARIAButtonType } from './types';\n\n/**\n * @internal\n *\n * This function expects to receive a slot, if `as` property is not desired use `useARIAButtonProps` instead\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n */\nexport const useARIAButtonShorthand: ResolveShorthandFunction<ARIAButtonSlotProps> = (value, options) => {\n const shorthand = resolveShorthand(value, options);\n const shorthandARIAButton = useARIAButtonProps<ARIAButtonType, ARIAButtonProps>(shorthand?.as ?? 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"names":["resolveShorthand","useARIAButtonProps","useARIAButtonShorthand","value","options","shorthand","shorthandARIAButton","as"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,kBAAkB,QAAQ,uBAAuB;AAI1D;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAwE,CAACC,OAAOC,UAAY;IACvG,MAAMC,YAAYL,iBAAiBG,OAAOC;QACsCC;IAAhF,MAAMC,sBAAsBL,mBAAoDI,CAAAA,gBAAAA,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWE,EAAE,cAAbF,2BAAAA,gBAAiB,QAAQ,EAAEA;IAC3G,OAAOA,aAAaC;AACtB,EAAE"}
1
+ {"version":3,"sources":["useARIAButtonShorthand.ts"],"sourcesContent":["import { resolveShorthand } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from './useARIAButtonProps';\nimport type { ResolveShorthandFunction } from '@fluentui/react-utilities';\nimport type { ARIAButtonProps, ARIAButtonSlotProps, ARIAButtonType } from './types';\n\n/**\n * @internal\n *\n * This function expects to receive a slot, if `as` property is not desired use `useARIAButtonProps` instead\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n */\nexport const useARIAButtonShorthand: ResolveShorthandFunction<ARIAButtonSlotProps> = (value, options) => {\n const shorthand = resolveShorthand(value, options);\n const shorthandARIAButton = useARIAButtonProps<ARIAButtonType, ARIAButtonProps>(shorthand?.as ?? 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"names":["resolveShorthand","useARIAButtonProps","useARIAButtonShorthand","value","options","shorthand","shorthandARIAButton","as"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,kBAAkB,QAAQ,uBAAuB;AAI1D;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAwE,CAACC,OAAOC;QAEXC;IADhF,MAAMA,YAAYL,iBAAiBG,OAAOC;QACsCC;IAAhF,MAAMC,sBAAsBL,mBAAoDI,CAAAA,iBAAAA,aAAAA,uBAAAA,iCAAAA,WAAWE,EAAE,cAAbF,2BAAAA,gBAAiB,UAAUA;IAC3G,OAAOA,aAAaC;AACtB,EAAE"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./useARIAButtonProps"), exports);
7
- _exportStar(require("./useARIAButtonShorthand"), exports);
8
- _exportStar(require("./types"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./useARIAButtonProps"), exports);
7
+ _export_star._(require("./useARIAButtonShorthand"), exports);
8
+ _export_star._(require("./types"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './useARIAButtonProps';\nexport * from './useARIAButtonShorthand';\nexport * from './types';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './useARIAButtonProps';\nexport * from './useARIAButtonShorthand';\nexport * from './types';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -1 +1 @@
1
- {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -4,55 +4,60 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useARIAButtonProps", {
6
6
  enumerable: true,
7
- get: ()=>useARIAButtonProps
7
+ get: function() {
8
+ return useARIAButtonProps;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _keyboardKeys = require("@fluentui/keyboard-keys");
11
- const _reactUtilities = require("@fluentui/react-utilities");
12
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _keyboardkeys = require("@fluentui/keyboard-keys");
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
15
  function useARIAButtonProps(type, props) {
14
- const { disabled , disabledFocusable =false , ['aria-disabled']: ariaDisabled , onClick , onKeyDown , onKeyUp , ...rest } = props !== null && props !== void 0 ? props : {};
16
+ const { disabled, disabledFocusable = false, ['aria-disabled']: ariaDisabled, onClick, onKeyDown, onKeyUp, ...rest } = props !== null && props !== void 0 ? props : {};
15
17
  const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;
16
18
  const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;
17
- const handleClick = (0, _reactUtilities.useEventCallback)((ev)=>{
19
+ const handleClick = (0, _reactutilities.useEventCallback)((ev)=>{
18
20
  if (isDisabled) {
19
21
  ev.preventDefault();
20
22
  ev.stopPropagation();
21
23
  } else {
22
- onClick === null || onClick === void 0 ? void 0 : onClick(ev);
24
+ var _onClick;
25
+ (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(ev);
23
26
  }
24
27
  });
25
- const handleKeyDown = (0, _reactUtilities.useEventCallback)((ev)=>{
26
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
28
+ const handleKeyDown = (0, _reactutilities.useEventCallback)((ev)=>{
29
+ var _onKeyDown;
30
+ (_onKeyDown = onKeyDown) === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(ev);
27
31
  if (ev.isDefaultPrevented()) {
28
32
  return;
29
33
  }
30
34
  const key = ev.key;
31
- if (isDisabled && (key === _keyboardKeys.Enter || key === _keyboardKeys.Space)) {
35
+ if (isDisabled && (key === _keyboardkeys.Enter || key === _keyboardkeys.Space)) {
32
36
  ev.preventDefault();
33
37
  ev.stopPropagation();
34
38
  return;
35
39
  }
36
- if (key === _keyboardKeys.Space) {
40
+ if (key === _keyboardkeys.Space) {
37
41
  ev.preventDefault();
38
42
  return;
39
- } else if (key === _keyboardKeys.Enter) {
43
+ } else if (key === _keyboardkeys.Enter) {
40
44
  ev.preventDefault();
41
45
  ev.currentTarget.click();
42
46
  }
43
47
  });
44
- const handleKeyUp = (0, _reactUtilities.useEventCallback)((ev)=>{
45
- onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
48
+ const handleKeyUp = (0, _reactutilities.useEventCallback)((ev)=>{
49
+ var _onKeyUp;
50
+ (_onKeyUp = onKeyUp) === null || _onKeyUp === void 0 ? void 0 : _onKeyUp(ev);
46
51
  if (ev.isDefaultPrevented()) {
47
52
  return;
48
53
  }
49
54
  const key = ev.key;
50
- if (isDisabled && (key === _keyboardKeys.Enter || key === _keyboardKeys.Space)) {
55
+ if (isDisabled && (key === _keyboardkeys.Enter || key === _keyboardkeys.Space)) {
51
56
  ev.preventDefault();
52
57
  ev.stopPropagation();
53
58
  return;
54
59
  }
55
- if (key === _keyboardKeys.Space) {
60
+ if (key === _keyboardkeys.Space) {
56
61
  ev.preventDefault();
57
62
  ev.currentTarget.click();
58
63
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useARIAButtonProps.js"],"sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport * as React from 'react';\n/**\n * @internal\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of non native button elements. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n *\n * @param type - the proper scenario to be interpreted by the hook.\n * 1. `button` - Minimal interference from the hook, as semantic button already supports most of the states\n * 2. `a` or `div` - Proper keyboard/mouse handling plus other support to ensure ARIA behavior\n * @param props - the props to be passed down the line to the desired element.\n * This hook will encapsulate proper properties, such as `onClick`, `onKeyDown`, `onKeyUp`, etc,.\n *\n * @example\n * ```tsx\n * const buttonProps = useARIAButtonProps('a', {\n * href: './some-route'\n * onClick: () => console.log('this should run both on click and Space and Enter')\n * })\n *\n * // ...\n *\n * return (\n * <a {...buttonProps}>This anchor will behave as a proper button</a>\n * )\n * ```\n */ export function useARIAButtonProps(type, props) {\n const { disabled , disabledFocusable =false , ['aria-disabled']: ariaDisabled , onClick , onKeyDown , onKeyUp , ...rest } = props !== null && props !== void 0 ? props : {};\n const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;\n const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;\n const handleClick = useEventCallback((ev)=>{\n if (isDisabled) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onClick === null || onClick === void 0 ? void 0 : onClick(ev);\n }\n });\n const handleKeyDown = useEventCallback((ev)=>{\n onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);\n if (ev.isDefaultPrevented()) {\n return;\n }\n const key = ev.key;\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n if (key === Space) {\n ev.preventDefault();\n return;\n } else if (key === Enter) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n const handleKeyUp = useEventCallback((ev)=>{\n onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);\n if (ev.isDefaultPrevented()) {\n return;\n }\n const key = ev.key;\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n if (key === Space) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (type === 'button' || type === undefined) {\n return {\n ...rest,\n disabled: disabled && !disabledFocusable,\n 'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,\n // onclick should still use internal handler to ensure prevention if disabled\n // if disabledFocusable then there's no requirement for handlers as those events should not be propagated\n onClick: disabledFocusable ? undefined : handleClick,\n onKeyUp: disabledFocusable ? undefined : onKeyUp,\n onKeyDown: disabledFocusable ? undefined : onKeyDown\n };\n } else {\n const resultProps = {\n role: 'button',\n tabIndex: disabled && !disabledFocusable ? undefined : 0,\n ...rest,\n // If it's not a <button> than listeners are required even with disabledFocusable\n // Since you cannot assure the default behavior of the element\n // E.g: <a> will redirect on click\n onClick: handleClick,\n onKeyUp: handleKeyUp,\n onKeyDown: handleKeyDown,\n 'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled\n };\n if (type === 'a' && isDisabled) {\n resultProps.href = undefined;\n }\n return resultProps;\n }\n}\n"],"names":["useARIAButtonProps","type","props","disabled","disabledFocusable","ariaDisabled","onClick","onKeyDown","onKeyUp","rest","normalizedARIADisabled","isDisabled","handleClick","useEventCallback","ev","preventDefault","stopPropagation","handleKeyDown","isDefaultPrevented","key","Enter","Space","currentTarget","click","handleKeyUp","undefined","resultProps","role","tabIndex","href"],"mappings":";;;;+BA6BoBA;;aAAAA;;;8BA7BS;gCACI;6DACV;AA2BZ,SAASA,mBAAmBC,IAAI,EAAEC,KAAK,EAAE;IAChD,MAAM,EAAEC,SAAQ,EAAGC,mBAAmB,KAAK,CAAA,EAAG,CAAC,gBAAgB,EAAEC,aAAY,EAAGC,QAAO,EAAGC,UAAS,EAAGC,QAAO,EAAG,GAAGC,MAAM,GAAGP,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAIA,QAAQ,CAAC,CAAC;IAC3K,MAAMQ,yBAAyB,OAAOL,iBAAiB,WAAWA,iBAAiB,SAASA,YAAY;IACxG,MAAMM,aAAaR,YAAYC,qBAAqBM;IACpD,MAAME,cAAcC,IAAAA,gCAAgB,EAAC,CAACC,KAAK;QACvC,IAAIH,YAAY;YACZG,GAAGC,cAAc;YACjBD,GAAGE,eAAe;QACtB,OAAO;YACHV,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQQ,GAAG;QACjE,CAAC;IACL;IACA,MAAMG,gBAAgBJ,IAAAA,gCAAgB,EAAC,CAACC,KAAK;QACzCP,cAAc,IAAI,IAAIA,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUO,GAAG;QACnE,IAAIA,GAAGI,kBAAkB,IAAI;YACzB;QACJ,CAAC;QACD,MAAMC,MAAML,GAAGK,GAAG;QAClB,IAAIR,cAAeQ,CAAAA,QAAQC,mBAAK,IAAID,QAAQE,mBAAK,AAAD,GAAI;YAChDP,GAAGC,cAAc;YACjBD,G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be,YAAYG,IAAI,GAAGJ;QACvB,CAAC;QACD,OAAOC;IACX,CAAC;AACL"}
1
+ {"version":3,"sources":["useARIAButtonProps.js"],"sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport * as React from 'react';\n/**\n * @internal\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of non native button elements. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n *\n * @param type - the proper scenario to be interpreted by the hook.\n * 1. `button` - Minimal interference from the hook, as semantic button already supports most of the states\n * 2. `a` or `div` - Proper keyboard/mouse handling plus other support to ensure ARIA behavior\n * @param props - the props to be passed down the line to the desired element.\n * This hook will encapsulate proper properties, such as `onClick`, `onKeyDown`, `onKeyUp`, etc,.\n *\n * @example\n * ```tsx\n * const buttonProps = useARIAButtonProps('a', {\n * href: './some-route'\n * onClick: () => console.log('this should run both on click and Space and Enter')\n * })\n *\n * // ...\n *\n * return (\n * <a {...buttonProps}>This anchor will behave as a proper button</a>\n * )\n * ```\n */ export function useARIAButtonProps(type, props) {\n const { disabled, disabledFocusable = false, ['aria-disabled']: ariaDisabled, onClick, onKeyDown, onKeyUp, ...rest } = props !== null && props !== void 0 ? props : {};\n const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;\n const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;\n const handleClick = useEventCallback((ev)=>{\n if (isDisabled) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n var _onClick;\n (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(ev);\n }\n });\n const handleKeyDown = useEventCallback((ev)=>{\n var _onKeyDown;\n (_onKeyDown = onKeyDown) === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(ev);\n if (ev.isDefaultPrevented()) {\n return;\n }\n const key = ev.key;\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n if (key === Space) {\n ev.preventDefault();\n return;\n } else if (key === Enter) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n const handleKeyUp = useEventCallback((ev)=>{\n var _onKeyUp;\n (_onKeyUp = onKeyUp) === null || _onKeyUp === void 0 ? void 0 : _onKeyUp(ev);\n if (ev.isDefaultPrevented()) {\n return;\n }\n const key = ev.key;\n if (isDisabled && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n return;\n }\n if (key === Space) {\n ev.preventDefault();\n ev.currentTarget.click();\n }\n });\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (type === 'button' || type === undefined) {\n return {\n ...rest,\n disabled: disabled && !disabledFocusable,\n 'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,\n // onclick should still use internal handler to ensure prevention if disabled\n // if disabledFocusable then there's no requirement for handlers as those events should not be propagated\n onClick: disabledFocusable ? undefined : handleClick,\n onKeyUp: disabledFocusable ? undefined : onKeyUp,\n onKeyDown: disabledFocusable ? undefined : onKeyDown\n };\n } else {\n const resultProps = {\n role: 'button',\n tabIndex: disabled && !disabledFocusable ? undefined : 0,\n ...rest,\n // If it's not a <button> than listeners are required even with disabledFocusable\n // Since you cannot assure the default behavior of the element\n // E.g: <a> will redirect on click\n onClick: handleClick,\n onKeyUp: handleKeyUp,\n onKeyDown: handleKeyDown,\n 'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled\n };\n if (type === 'a' && isDisabled) {\n resultProps.href = undefined;\n }\n return resultProps;\n }\n}\n"],"names":["useARIAButtonProps","type","props","disabled","disabledFocusable","ariaDisabled","onClick","onKeyDown","onKeyUp","rest","normalizedARIADisabled","isDisabled","handleClick","useEventCallback","ev","preventDefault","stopPropagation","_onClick","handleKeyDown","_onKeyDown","isDefaultPrevented","key","Enter","Space","currentTarget","click","handleKeyUp","_onKeyUp","undefined","resultProps","role","tabIndex","href"],"mappings":";;;;+BA6BoBA;;;eAAAA;;;;8BA7BS;gCAC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GAAGM,kBAAkB,IAAI;YACzB;QACJ;QACA,MAAMC,MAAMP,GAAGO,GAAG;QAClB,IAAIV,cAAeU,CAAAA,QAAQC,mBAAK,IAAID,QAAQE,mBAAK,AAAD,GAAI;YAChDT,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACJ;QACA,IAAIK,QAAQE,mBAAK,EAAE;YACfT,GAAGC,cAAc;YACjBD,GAAGU,aAAa,CAACC,KAAK;QAC1B;IACJ;IACA,+FAA+F;IAC/F,IAAIxB,SAAS,YAAYA,SAAS2B,WAAW;QACzC,OAAO;YACH,GAAGnB,IAAI;YACPN,UAAUA,YAAY,CAACC;YACvB,iBAAiBA,oBAAoB,OAAOM;YAC5C,6EAA6E;YAC7E,yGAAyG;YACzGJ,SAASF,oBAAoBwB,YAAYhB;YACzCJ,SAASJ,oBAAoBwB,YAAYpB;YACzCD,WAAWH,oBAAoBwB,YAAYrB;QAC/C;IACJ,OAAO;QACH,MAAMsB,cAAc;YAChBC,MAAM;YACNC,UAAU5B,YAAY,CAACC,oBAAoBwB,YAAY;YACvD,GAAGnB,IAAI;YACP,iFAAiF;YACjF,8DAA8D;YAC9D,kCAAkC;YAClCH,SAASM;YACTJ,SAASkB;YACTnB,WAAWW;YACX,iBAAiBf,YAAYC,qBAAqBM;QACtD;QACA,IAAIT,SAAS,OAAOU,YAAY;YAC5BkB,YAAYG,IAAI,GAAGJ;QACvB;QACA,OAAOC;IACX;AACJ"}
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useARIAButtonShorthand", {
6
6
  enumerable: true,
7
- get: ()=>useARIAButtonShorthand
7
+ get: function() {
8
+ return useARIAButtonShorthand;
9
+ }
8
10
  });
9
- const _reactUtilities = require("@fluentui/react-utilities");
11
+ const _reactutilities = require("@fluentui/react-utilities");
10
12
  const _useARIAButtonProps = require("./useARIAButtonProps");
11
13
  const useARIAButtonShorthand = (value, options)=>{
12
- const shorthand = (0, _reactUtilities.resolveShorthand)(value, options);
14
+ var _shorthand;
15
+ const shorthand = (0, _reactutilities.resolveShorthand)(value, options);
13
16
  var _shorthand_as;
14
- const shorthandARIAButton = (0, _useARIAButtonProps.useARIAButtonProps)((_shorthand_as = shorthand === null || shorthand === void 0 ? void 0 : shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);
17
+ const shorthandARIAButton = (0, _useARIAButtonProps.useARIAButtonProps)((_shorthand_as = (_shorthand = shorthand) === null || _shorthand === void 0 ? void 0 : _shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);
15
18
  return shorthand && shorthandARIAButton;
16
19
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useARIAButtonShorthand.js"],"sourcesContent":["import { resolveShorthand } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from './useARIAButtonProps';\n/**\n * @internal\n *\n * This function expects to receive a slot, if `as` property is not desired use `useARIAButtonProps` instead\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n */ export const useARIAButtonShorthand = (value, options)=>{\n const shorthand = resolveShorthand(value, options);\n var _shorthand_as;\n const shorthandARIAButton = useARIAButtonProps((_shorthand_as = shorthand === null || shorthand === void 0 ? void 0 : shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"names":["useARIAButtonShorthand","value","options","shorthand","resolveShorthand","_shorthand_as","shorthandARIAButton","useARIAButtonProps","as"],"mappings":";;;;+BAUiBA;;aAAAA;;gCAVgB;oCACE;AASxB,MAAMA,yBAAyB,CAACC,OAAOC,UAAU;IACxD,MAAMC,YAAYC,IAAAA,gCAAgB,EAACH,OAAOC;IAC1C,IAAIG;IACJ,MAAMC,sBAAsBC,IAAAA,sCAAkB,EAAC,AAACF,CAAAA,gBAAgBF,cAAc,IAAI,IAAIA,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUK,EAAE,AAAD,MAAO,IAAI,IAAIH,kBAAkB,KAAK,IAAIA,gBAAgB,QAAQ,EAAEF;IACrM,OAAOA,aAAaG;AACxB"}
1
+ {"version":3,"sources":["useARIAButtonShorthand.js"],"sourcesContent":["import { resolveShorthand } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from './useARIAButtonProps';\n/**\n * @internal\n *\n * This function expects to receive a slot, if `as` property is not desired use `useARIAButtonProps` instead\n *\n * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec\n * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases\n * where no attribute addition is required.\n */ export const useARIAButtonShorthand = (value, options)=>{\n var _shorthand;\n const shorthand = resolveShorthand(value, options);\n var _shorthand_as;\n const shorthandARIAButton = useARIAButtonProps((_shorthand_as = (_shorthand = shorthand) === null || _shorthand === void 0 ? void 0 : _shorthand.as) !== null && _shorthand_as !== void 0 ? _shorthand_as : 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"names":["useARIAButtonShorthand","value","options","_shorthand","shorthand","resolveShorthand","_shorthand_as","shorthandARIAButton","useARIAButtonProps","as"],"mappings":";;;;+BAUiBA;;;eAAAA;;;gCAVgB;oCACE;AASxB,MAAMA,yBAAyB,CAACC,OAAOC;IAC9C,IAAIC;IACJ,MAAMC,YAAYC,IAAAA,gCAAgB,EAACJ,OAAOC;IAC1C,IAAII;IACJ,MAAMC,sBAAsBC,IAAAA,sCAAkB,EAAC,AAACF,CAAAA,gBAAgB,AAACH,CAAAA,aAAaC,SAAQ,MAAO,QAAQD,eAAe,KAAK,IAAI,KAAK,IAAIA,WAAWM,EAAE,AAAD,MAAO,QAAQH,kBAAkB,KAAK,IAAIA,gBAAgB,UAAUF;IACtN,OAAOA,aAAaG;AACxB"}
@@ -9,7 +9,11 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- useARIAButtonShorthand: ()=>_index.useARIAButtonShorthand,
13
- useARIAButtonProps: ()=>_index.useARIAButtonProps
12
+ useARIAButtonShorthand: function() {
13
+ return _index.useARIAButtonShorthand;
14
+ },
15
+ useARIAButtonProps: function() {
16
+ return _index.useARIAButtonProps;
17
+ }
14
18
  });
15
19
  const _index = require("./button/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { useARIAButtonShorthand, useARIAButtonProps } from './button/index';\n"],"names":["useARIAButtonShorthand","useARIAButtonProps"],"mappings":";;;;;;;;;;;IAASA,sBAAsB,MAAtBA,6BAAsB;IAAEC,kBAAkB,MAAlBA,yBAAkB;;uBAAQ"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { useARIAButtonShorthand, useARIAButtonProps } from './button/index';\n"],"names":["useARIAButtonShorthand","useARIAButtonProps"],"mappings":";;;;;;;;;;;IAASA,sBAAsB;eAAtBA,6BAAsB;;IAAEC,kBAAkB;eAAlBA,yBAAkB;;;uBAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-aria",
3
- "version": "9.3.33",
3
+ "version": "9.3.35",
4
4
  "description": "React helper to ensure ARIA",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -31,15 +31,15 @@
31
31
  "@fluentui/scripts-tasks": "*"
32
32
  },
33
33
  "dependencies": {
34
- "@fluentui/keyboard-keys": "^9.0.3",
35
- "@fluentui/react-utilities": "^9.13.0",
36
- "@swc/helpers": "^0.4.14"
34
+ "@fluentui/keyboard-keys": "^9.0.4",
35
+ "@fluentui/react-utilities": "^9.13.2",
36
+ "@swc/helpers": "^0.5.1"
37
37
  },
38
38
  "peerDependencies": {
39
- "@types/react": ">=16.8.0 <19.0.0",
40
- "@types/react-dom": ">=16.8.0 <19.0.0",
41
- "react": ">=16.8.0 <19.0.0",
42
- "react-dom": ">=16.8.0 <19.0.0"
39
+ "@types/react": ">=16.14.0 <19.0.0",
40
+ "@types/react-dom": ">=16.14.0 <19.0.0",
41
+ "react": ">=16.14.0 <19.0.0",
42
+ "react-dom": ">=16.14.0 <19.0.0"
43
43
  },
44
44
  "beachball": {
45
45
  "disallowedChangeTypes": [