@fluentui/react-aria 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swcrc +2 -11
- package/CHANGELOG.json +40 -7
- package/CHANGELOG.md +18 -6
- package/lib/button/index.js +3 -3
- package/lib/button/types.js +1 -1
- package/lib/button/useARIAButtonProps.js +14 -14
- package/lib/button/useARIAButtonProps.js.map +1 -1
- package/lib/button/useARIAButtonShorthand.js +4 -3
- package/lib/button/useARIAButtonShorthand.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib-commonjs/button/index.js.map +1 -1
- package/lib-commonjs/button/types.js.map +1 -1
- package/lib-commonjs/button/useARIAButtonProps.js +10 -10
- package/lib-commonjs/button/useARIAButtonProps.js.map +1 -1
- package/lib-commonjs/button/useARIAButtonShorthand.js +2 -1
- package/lib-commonjs/button/useARIAButtonShorthand.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +4 -3
package/.swcrc
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/swcrc",
|
|
3
|
-
"env": {
|
|
4
|
-
"targets": {
|
|
5
|
-
"chrome": "84",
|
|
6
|
-
"edge": "84",
|
|
7
|
-
"firefox": "75",
|
|
8
|
-
"opera": "73",
|
|
9
|
-
"safari": "14.1"
|
|
10
|
-
},
|
|
11
|
-
"bugfixes": true
|
|
12
|
-
},
|
|
13
3
|
"exclude": [
|
|
14
4
|
"/testing",
|
|
15
5
|
"/**/*.cy.ts",
|
|
@@ -32,7 +22,8 @@
|
|
|
32
22
|
"runtime": "classic",
|
|
33
23
|
"useSpread": true
|
|
34
24
|
}
|
|
35
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"target": "es2019"
|
|
36
27
|
},
|
|
37
28
|
"minify": false,
|
|
38
29
|
"sourceMaps": true
|
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui/react-aria_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Wed, 22 Mar 2023 04:46:39 GMT",
|
|
6
|
+
"tag": "@fluentui/react-aria_v0.0.0-nightly-20230322-0439.1",
|
|
7
|
+
"version": "0.0.0-nightly-20230322-0439.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,14 +16,47 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui/react-aria",
|
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1",
|
|
20
|
+
"commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui/react-aria",
|
|
25
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230322-0439.1",
|
|
26
|
+
"commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Tue, 21 Mar 2023 21:23:22 GMT",
|
|
33
|
+
"tag": "@fluentui/react-aria_v9.3.15",
|
|
34
|
+
"version": "9.3.15",
|
|
35
|
+
"comments": {
|
|
36
|
+
"patch": [
|
|
37
|
+
{
|
|
38
|
+
"author": "tristan.watanabe@gmail.com",
|
|
39
|
+
"package": "@fluentui/react-aria",
|
|
40
|
+
"commit": "2fac1a139149bd13b76b1306207bc988dca9c72c",
|
|
41
|
+
"comment": "chore: migrate to swc transpilation approach."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "tristan.watanabe@gmail.com",
|
|
45
|
+
"package": "@fluentui/react-aria",
|
|
46
|
+
"commit": "ead1c6d4c2ac3f3596b62b8cbc07b0a03041f11f",
|
|
47
|
+
"comment": "fix: add node field to package.json exports map."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-aria",
|
|
52
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.2",
|
|
53
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-aria",
|
|
58
|
+
"comment": "Bump @fluentui/react-utilities to v9.7.2",
|
|
59
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
27
60
|
}
|
|
28
61
|
]
|
|
29
62
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-aria
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 22 Mar 2023 04:46:39 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20230322-0439.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v0.0.0-nightly-20230322-0439.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.
|
|
9
|
+
Wed, 22 Mar 2023 04:46:39 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.15..@fluentui/react-aria_v0.0.0-nightly-20230322-0439.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
|
|
16
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
|
|
17
|
+
|
|
18
|
+
## [9.3.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.3.15)
|
|
19
|
+
|
|
20
|
+
Tue, 21 Mar 2023 21:23:22 GMT
|
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.3.14..@fluentui/react-aria_v9.3.15)
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
|
|
26
|
+
- fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
|
|
27
|
+
- Bump @fluentui/keyboard-keys to v9.0.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
28
|
+
- Bump @fluentui/react-utilities to v9.7.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
17
29
|
|
|
18
30
|
## [9.3.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.3.14)
|
|
19
31
|
|
package/lib/button/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './useARIAButtonProps';
|
|
2
|
+
export * from './useARIAButtonShorthand';
|
|
3
|
+
export * from './types';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/lib/button/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Enter, Space } from
|
|
2
|
-
import { useEventCallback } from
|
|
3
|
-
import * as React from
|
|
1
|
+
import { Enter, Space } from '@fluentui/keyboard-keys';
|
|
2
|
+
import { useEventCallback } from '@fluentui/react-utilities';
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*
|
|
@@ -32,24 +32,24 @@ export function useARIAButtonProps(type, props) {
|
|
|
32
32
|
const {
|
|
33
33
|
disabled,
|
|
34
34
|
disabledFocusable = false,
|
|
35
|
-
[
|
|
35
|
+
['aria-disabled']: ariaDisabled,
|
|
36
36
|
onClick,
|
|
37
37
|
onKeyDown,
|
|
38
38
|
onKeyUp,
|
|
39
39
|
...rest
|
|
40
|
-
} = props
|
|
41
|
-
const normalizedARIADisabled = typeof ariaDisabled ===
|
|
40
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
41
|
+
const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;
|
|
42
42
|
const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;
|
|
43
43
|
const handleClick = useEventCallback(ev => {
|
|
44
44
|
if (isDisabled) {
|
|
45
45
|
ev.preventDefault();
|
|
46
46
|
ev.stopPropagation();
|
|
47
47
|
} else {
|
|
48
|
-
onClick
|
|
48
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
const handleKeyDown = useEventCallback(ev => {
|
|
52
|
-
onKeyDown
|
|
52
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
|
|
53
53
|
if (ev.isDefaultPrevented()) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -68,7 +68,7 @@ export function useARIAButtonProps(type, props) {
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
const handleKeyUp = useEventCallback(ev => {
|
|
71
|
-
onKeyUp
|
|
71
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
|
|
72
72
|
if (ev.isDefaultPrevented()) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -84,11 +84,11 @@ export function useARIAButtonProps(type, props) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
// If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
|
|
87
|
-
if (type ===
|
|
87
|
+
if (type === 'button' || type === undefined) {
|
|
88
88
|
return {
|
|
89
89
|
...rest,
|
|
90
90
|
disabled: disabled && !disabledFocusable,
|
|
91
|
-
|
|
91
|
+
'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,
|
|
92
92
|
// onclick should still use internal handler to ensure prevention if disabled
|
|
93
93
|
// if disabledFocusable then there's no requirement for handlers as those events should not be propagated
|
|
94
94
|
onClick: disabledFocusable ? undefined : handleClick,
|
|
@@ -97,7 +97,7 @@ export function useARIAButtonProps(type, props) {
|
|
|
97
97
|
};
|
|
98
98
|
} else {
|
|
99
99
|
const resultProps = {
|
|
100
|
-
role:
|
|
100
|
+
role: 'button',
|
|
101
101
|
tabIndex: disabled && !disabledFocusable ? undefined : 0,
|
|
102
102
|
...rest,
|
|
103
103
|
// If it's not a <button> than listeners are required even with disabledFocusable
|
|
@@ -106,9 +106,9 @@ export function useARIAButtonProps(type, props) {
|
|
|
106
106
|
onClick: handleClick,
|
|
107
107
|
onKeyUp: handleKeyUp,
|
|
108
108
|
onKeyDown: handleKeyDown,
|
|
109
|
-
|
|
109
|
+
'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled
|
|
110
110
|
};
|
|
111
|
-
if (type ===
|
|
111
|
+
if (type === 'a' && isDisabled) {
|
|
112
112
|
resultProps.href = undefined;
|
|
113
113
|
}
|
|
114
114
|
return resultProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"sources":["../../src/button/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"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ;AAC7B,SAASC,gBAAgB,QAAQ;AACjC,YAAYC,KAAA,MAAW;AAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,SAASC,mBACdC,IAAW,EACXC,KAAa,EACuB;EACpC,MAAM;IACJC,QAAA;IACAC,iBAAA,GAAoB,KAAK;IACzB,CAAC,kBAAkBC,YAAA;IACnBC,OAAA;IACAC,SAAA;IACAC,OAAA;IACA,GAAGC;EAAA,CACJ,GAAGP,KAAA,
|
|
1
|
+
{"version":3,"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"],"sources":["../../src/button/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"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveShorthand } from
|
|
2
|
-
import { useARIAButtonProps } from
|
|
1
|
+
import { resolveShorthand } from '@fluentui/react-utilities';
|
|
2
|
+
import { useARIAButtonProps } from './useARIAButtonProps';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*
|
|
@@ -11,7 +11,8 @@ import { useARIAButtonProps } from "./useARIAButtonProps";
|
|
|
11
11
|
*/
|
|
12
12
|
export const useARIAButtonShorthand = (slot, options) => {
|
|
13
13
|
const shorthand = resolveShorthand(slot, options);
|
|
14
|
-
|
|
14
|
+
var _shorthand_as;
|
|
15
|
+
const shorthandARIAButton = useARIAButtonProps((_shorthand_as = 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
|
};
|
|
17
18
|
//# sourceMappingURL=useARIAButtonShorthand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["resolveShorthand","useARIAButtonProps","useARIAButtonShorthand","slot","options","shorthand","shorthandARIAButton","as"],"sources":["../../src/button/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> = (slot, options) => {\n const shorthand = resolveShorthand(slot, options);\n const shorthandARIAButton = useARIAButtonProps<ARIAButtonType, ARIAButtonProps>(shorthand?.as ?? 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAInC;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAwEA,CAACC,IAAA,EAAMC,OAAA,KAAY;EACtG,MAAMC,SAAA,GAAYL,gBAAA,CAAiBG,IAAA,EAAMC,OAAA;
|
|
1
|
+
{"version":3,"names":["resolveShorthand","useARIAButtonProps","useARIAButtonShorthand","slot","options","shorthand","_shorthand_as","shorthandARIAButton","as"],"sources":["../../src/button/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> = (slot, options) => {\n const shorthand = resolveShorthand(slot, options);\n const shorthandARIAButton = useARIAButtonProps<ARIAButtonType, ARIAButtonProps>(shorthand?.as ?? 'button', shorthand);\n return shorthand && shorthandARIAButton;\n};\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAInC;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAwEA,CAACC,IAAA,EAAMC,OAAA,KAAY;EACtG,MAAMC,SAAA,GAAYL,gBAAA,CAAiBG,IAAA,EAAMC,OAAA;MACuCE,aAAA;EAAhF,MAAMC,mBAAA,GAAsBN,kBAAA,CAAoD,CAAAK,aAAA,GAAAD,SAAA,aAAAA,SAAA,uBAAAA,SAAA,CAAWG,EAAE,cAAbF,aAAA,cAAAA,aAAA,GAAiB,QAAQ,EAAED,SAAA;EAC3G,OAAOA,SAAA,IAAaE,mBAAA;AACtB"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useARIAButtonShorthand, useARIAButtonProps } from
|
|
1
|
+
export { useARIAButtonShorthand, useARIAButtonProps } from './button/index';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/button/index.js"],"sourcesContent":["export * from
|
|
1
|
+
{"version":3,"sources":["../../lib/button/index.js"],"sourcesContent":["export * from './useARIAButtonProps';\nexport * from './useARIAButtonShorthand';\nexport * from './types';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;CACd,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/button/types.js"],"sourcesContent":["import * as React from
|
|
1
|
+
{"version":3,"sources":["../../lib/button/types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
|
|
@@ -11,19 +11,19 @@ const _keyboardKeys = require("@fluentui/keyboard-keys");
|
|
|
11
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
12
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
13
13
|
function useARIAButtonProps(type, props) {
|
|
14
|
-
const { disabled , disabledFocusable =false , [
|
|
15
|
-
const normalizedARIADisabled = typeof ariaDisabled ===
|
|
14
|
+
const { disabled , disabledFocusable =false , ['aria-disabled']: ariaDisabled , onClick , onKeyDown , onKeyUp , ...rest } = props !== null && props !== void 0 ? props : {};
|
|
15
|
+
const normalizedARIADisabled = typeof ariaDisabled === 'string' ? ariaDisabled === 'true' : ariaDisabled;
|
|
16
16
|
const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;
|
|
17
17
|
const handleClick = (0, _reactUtilities.useEventCallback)((ev)=>{
|
|
18
18
|
if (isDisabled) {
|
|
19
19
|
ev.preventDefault();
|
|
20
20
|
ev.stopPropagation();
|
|
21
21
|
} else {
|
|
22
|
-
onClick
|
|
22
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const handleKeyDown = (0, _reactUtilities.useEventCallback)((ev)=>{
|
|
26
|
-
onKeyDown
|
|
26
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
|
|
27
27
|
if (ev.isDefaultPrevented()) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -42,7 +42,7 @@ function useARIAButtonProps(type, props) {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
const handleKeyUp = (0, _reactUtilities.useEventCallback)((ev)=>{
|
|
45
|
-
onKeyUp
|
|
45
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
|
|
46
46
|
if (ev.isDefaultPrevented()) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
@@ -58,11 +58,11 @@ function useARIAButtonProps(type, props) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
// If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
|
|
61
|
-
if (type ===
|
|
61
|
+
if (type === 'button' || type === undefined) {
|
|
62
62
|
return {
|
|
63
63
|
...rest,
|
|
64
64
|
disabled: disabled && !disabledFocusable,
|
|
65
|
-
|
|
65
|
+
'aria-disabled': disabledFocusable ? true : normalizedARIADisabled,
|
|
66
66
|
// onclick should still use internal handler to ensure prevention if disabled
|
|
67
67
|
// if disabledFocusable then there's no requirement for handlers as those events should not be propagated
|
|
68
68
|
onClick: disabledFocusable ? undefined : handleClick,
|
|
@@ -71,7 +71,7 @@ function useARIAButtonProps(type, props) {
|
|
|
71
71
|
};
|
|
72
72
|
} else {
|
|
73
73
|
const resultProps = {
|
|
74
|
-
role:
|
|
74
|
+
role: 'button',
|
|
75
75
|
tabIndex: disabled && !disabledFocusable ? undefined : 0,
|
|
76
76
|
...rest,
|
|
77
77
|
// If it's not a <button> than listeners are required even with disabledFocusable
|
|
@@ -80,9 +80,9 @@ function useARIAButtonProps(type, props) {
|
|
|
80
80
|
onClick: handleClick,
|
|
81
81
|
onKeyUp: handleKeyUp,
|
|
82
82
|
onKeyDown: handleKeyDown,
|
|
83
|
-
|
|
83
|
+
'aria-disabled': disabled || disabledFocusable || normalizedARIADisabled
|
|
84
84
|
};
|
|
85
|
-
if (type ===
|
|
85
|
+
if (type === 'a' && isDisabled) {
|
|
86
86
|
resultProps.href = undefined;
|
|
87
87
|
}
|
|
88
88
|
return resultProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/button/useARIAButtonProps.js"],"sourcesContent":["import { Enter, Space } from
|
|
1
|
+
{"version":3,"sources":["../../lib/button/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 */\nexport function useARIAButtonProps(type, props) {\n const {\n disabled,\n disabledFocusable = false,\n ['aria-disabled']: ariaDisabled,\n onClick,\n onKeyDown,\n onKeyUp,\n ...rest\n } = 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//# sourceMappingURL=useARIAButtonProps.js.map"],"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":";;;;+BA8BgBA;;aAAAA;;;8BA9Ba;gCACI;6DACV;AA4BhB,SAASA,mBAAmBC,IAAI,EAAEC,KAAK,EAAE;IAC9C,MAAM,EACJC,SAAQ,EACRC,mBAAoB,KAAK,CAAA,EACzB,CAAC,gBAAgB,EAAEC,aAAY,EAC/BC,QAAO,EACPC,UAAS,EACTC,QAAO,EACP,GAAGC,MACJ,GAAGP,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAIA,QAAQ,CAAC,CAAC;IACnD,MAAMQ,yBAAyB,OAAOL,iBAAiB,WAAWA,iBAAiB,SAASA,YAAY;IACxG,MAAMM,aAAaR,YAAYC,qBAAqBM;IACpD,MAAME,cAAcC,IAAAA,gCAAgB,EAACC,CAAAA,KAAM;QACzC,IAAIH,YAAY;YACdG,GAAGC,cAAc;YACjBD,GAAGE,eAAe;QACpB,OAAO;YACLV,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQQ,GAAG;QAC/D,CAAC;IACH;IACA,MAAMG,gBAAgBJ,IAAAA,gCAAgB,EAACC,CAAAA,KAAM;QAC3CP,cAAc,IAAI,IAAIA,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUO,GAAG;QACnE,IAAIA,GAAGI,kBAAkB,IAAI;YAC3B;QACF,CAAC;QACD,MAAMC,MAAML,GAAGK,GAAG;QAClB,IAAIR,cAAeQ,CAAAA,QAAQC,mBAAK,IAAID,QAAQE,mBAAK,AAAD,GAAI;YAClDP,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACF,CAAC;QACD,IAAIG,QAAQE,mBAAK,EAAE;YACjBP,GAAGC,cAAc;YACjB;QACF,OAAO,IAAII,QAAQC,mBAAK,EAAE;YACxBN,GAAGC,cAAc;YACjBD,GAAGQ,aAAa,CAACC,KAAK;QACxB,CAAC;IACH;IACA,MAAMC,cAAcX,IAAAA,gCAAgB,EAACC,CAAAA,KAAM;QACzCN,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQM,GAAG;QAC7D,IAAIA,GAAGI,kBAAkB,IAAI;YAC3B;QACF,CAAC;QACD,MAAMC,MAAML,GAAGK,GAAG;QAClB,IAAIR,cAAeQ,CAAAA,QAAQC,mBAAK,IAAID,QAAQE,mBAAK,AAAD,GAAI;YAClDP,GAAGC,cAAc;YACjBD,GAAGE,eAAe;YAClB;QACF,CAAC;QACD,IAAIG,QAAQE,mBAAK,EAAE;YACjBP,GAAGC,cAAc;YACjBD,GAAGQ,aAAa,CAACC,KAAK;QACxB,CAAC;IACH;IACA,+FAA+F;IAC/F,IAAItB,SAAS,YAAYA,SAASwB,WAAW;QAC3C,OAAO;YACL,GAAGhB,IAAI;YACPN,UAAUA,YAAY,CAACC;YACvB,iBAAiBA,oBAAoB,IAAI,GAAGM,sBAAsB;YAClE,6EAA6E;YAC7E,yGAAyG;YACzGJ,SAASF,oBAAoBqB,YAAYb,WAAW;YACpDJ,SAASJ,oBAAoBqB,YAAYjB,OAAO;YAChDD,WAAWH,oBAAoBqB,YAAYlB,SAAS;QACtD;IACF,OAAO;QACL,MAAMmB,cAAc;YAClBC,MAAM;YACNC,UAAUzB,YAAY,CAACC,oBAAoBqB,YAAY,CAAC;YACxD,GAAGhB,IAAI;YACP,iFAAiF;YACjF,8DAA8D;YAC9D,kCAAkC;YAClCH,SAASM;YACTJ,SAASgB;YACTjB,WAAWU;YACX,iBAAiBd,YAAYC,qBAAqBM;QACpD;QACA,IAAIT,SAAS,OAAOU,YAAY;YAC9Be,YAAYG,IAAI,GAAGJ;QACrB,CAAC;QACD,OAAOC;IACT,CAAC;AACH,EACA,8CAA8C"}
|
|
@@ -10,7 +10,8 @@ const _reactUtilities = require("@fluentui/react-utilities");
|
|
|
10
10
|
const _useARIAButtonProps = require("./useARIAButtonProps");
|
|
11
11
|
const useARIAButtonShorthand = (slot, options)=>{
|
|
12
12
|
const shorthand = (0, _reactUtilities.resolveShorthand)(slot, options);
|
|
13
|
-
|
|
13
|
+
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);
|
|
14
15
|
return shorthand && shorthandARIAButton;
|
|
15
16
|
}; //# sourceMappingURL=useARIAButtonShorthand.js.map
|
|
16
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/button/useARIAButtonShorthand.js"],"sourcesContent":["import { resolveShorthand } from
|
|
1
|
+
{"version":3,"sources":["../../lib/button/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 */\nexport const useARIAButtonShorthand = (slot, options) => {\n const shorthand = resolveShorthand(slot, 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//# sourceMappingURL=useARIAButtonShorthand.js.map"],"names":["useARIAButtonShorthand","slot","options","shorthand","resolveShorthand","_shorthand_as","shorthandARIAButton","useARIAButtonProps","as"],"mappings":";;;;+BAWaA;;aAAAA;;gCAXoB;oCACE;AAU5B,MAAMA,yBAAyB,CAACC,MAAMC,UAAY;IACvD,MAAMC,YAAYC,IAAAA,gCAAgB,EAACH,MAAMC;IACzC,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;AACtB,GACA,kDAAkD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { useARIAButtonShorthand, useARIAButtonProps } from
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { useARIAButtonShorthand, useARIAButtonProps } from './button/index';\n//# sourceMappingURL=index.js.map"],"names":["useARIAButtonShorthand","useARIAButtonProps"],"mappings":";;;;;;;;;;;IAASA,sBAAsB,MAAtBA,6BAAsB;IAAEC,kBAAkB,MAAlBA,yBAAkB;;uBAAQ;CAC3D,iCAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20230322-0439.1",
|
|
4
4
|
"description": "React helper to ensure ARIA",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@fluentui/scripts-tasks": "*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-
|
|
34
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
|
33
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20230322-0439.1",
|
|
34
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230322-0439.1",
|
|
35
35
|
"@swc/helpers": "^0.4.14"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"exports": {
|
|
45
45
|
".": {
|
|
46
46
|
"types": "./dist/index.d.ts",
|
|
47
|
+
"node": "./lib-commonjs/index.js",
|
|
47
48
|
"import": "./lib/index.js",
|
|
48
49
|
"require": "./lib-commonjs/index.js"
|
|
49
50
|
},
|