@fluentui/react-aria 9.0.0-rc.8 → 9.0.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/CHANGELOG.json +95 -1
- package/CHANGELOG.md +45 -2
- package/dist/index.d.ts +1 -0
- package/lib/hooks/useARIAButton.js.map +1 -1
- package/lib/utils/mergeARIADisabled.js +1 -0
- package/lib/utils/mergeARIADisabled.js.map +1 -1
- package/lib-commonjs/hooks/useARIAButton.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/mergeARIADisabled.js +1 -0
- package/lib-commonjs/utils/mergeARIADisabled.js.map +1 -1
- package/package.json +4 -6
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,101 @@
|
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Thu,
|
|
5
|
+
"date": "Thu, 14 Jul 2022 17:03:35 GMT",
|
|
6
|
+
"tag": "@fluentui/react-aria_v9.0.1",
|
|
7
|
+
"version": "9.0.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-aria",
|
|
13
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.1-0",
|
|
14
|
+
"commit": "fd9308f35ec9b2c7f7fdbfce62f9a94ca00d6536"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 28 Jun 2022 15:14:13 GMT",
|
|
21
|
+
"tag": "@fluentui/react-aria_v9.0.0",
|
|
22
|
+
"version": "9.0.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"prerelease": [
|
|
25
|
+
{
|
|
26
|
+
"author": "lingfangao@hotmail.com",
|
|
27
|
+
"package": "@fluentui/react-aria",
|
|
28
|
+
"commit": "e0aabd850b15adf9c151ebd4e332f7c50ad6cfdf",
|
|
29
|
+
"comment": "Update 9.0.0-rc dependencies to use caret range"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "lingfangao@hotmail.com",
|
|
33
|
+
"package": "@fluentui/react-aria",
|
|
34
|
+
"commit": "2da4428ae7d6e464c538b7ed10e425ce0e531144",
|
|
35
|
+
"comment": "chore: Mark internal APIs with @internal"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"none": [
|
|
39
|
+
{
|
|
40
|
+
"author": "tristan.watanabe@gmail.com",
|
|
41
|
+
"package": "@fluentui/react-aria",
|
|
42
|
+
"commit": "319c07f0ef9ffdda6106b60d9f5f75018445fcf8",
|
|
43
|
+
"comment": "chore: Update Aria storybook config to index.stories.tsx entrypoint."
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"patch": [
|
|
47
|
+
{
|
|
48
|
+
"author": "lingfangao@hotmail.com",
|
|
49
|
+
"package": "@fluentui/react-aria",
|
|
50
|
+
"commit": "c7b1348bdad7aa883c29bfbc96ef2a32e6ebc7dd",
|
|
51
|
+
"comment": "feat: Initial 9.0.0 release"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"author": "beachball",
|
|
55
|
+
"package": "@fluentui/react-aria",
|
|
56
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0",
|
|
57
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"author": "beachball",
|
|
61
|
+
"package": "@fluentui/react-aria",
|
|
62
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0",
|
|
63
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"date": "Tue, 31 May 2022 21:28:50 GMT",
|
|
70
|
+
"tag": "@fluentui/react-aria_v9.0.0-rc.10",
|
|
71
|
+
"version": "9.0.0-rc.10",
|
|
72
|
+
"comments": {
|
|
73
|
+
"prerelease": [
|
|
74
|
+
{
|
|
75
|
+
"author": "beachball",
|
|
76
|
+
"package": "@fluentui/react-aria",
|
|
77
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.10",
|
|
78
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"date": "Mon, 23 May 2022 12:14:24 GMT",
|
|
85
|
+
"tag": "@fluentui/react-aria_v9.0.0-rc.9",
|
|
86
|
+
"version": "9.0.0-rc.9",
|
|
87
|
+
"comments": {
|
|
88
|
+
"prerelease": [
|
|
89
|
+
{
|
|
90
|
+
"author": "beachball",
|
|
91
|
+
"package": "@fluentui/react-aria",
|
|
92
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
|
|
93
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"date": "Thu, 05 May 2022 18:26:28 GMT",
|
|
6
100
|
"tag": "@fluentui/react-aria_v9.0.0-rc.8",
|
|
7
101
|
"version": "9.0.0-rc.8",
|
|
8
102
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-aria
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 14 Jul 2022 17:03:35 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.1)
|
|
8
|
+
|
|
9
|
+
Thu, 14 Jul 2022 17:03:35 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0..@fluentui/react-aria_v9.0.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-utilities to v9.0.1-0 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
|
|
15
|
+
|
|
16
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0)
|
|
17
|
+
|
|
18
|
+
Tue, 28 Jun 2022 15:14:13 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.10..@fluentui/react-aria_v9.0.0)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
|
|
24
|
+
- Bump @fluentui/keyboard-keys to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
|
26
|
+
|
|
27
|
+
### Changes
|
|
28
|
+
|
|
29
|
+
- Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
|
|
30
|
+
- chore: Mark internal APIs with @internal ([PR #23689](https://github.com/microsoft/fluentui/pull/23689) by lingfangao@hotmail.com)
|
|
31
|
+
|
|
32
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.10)
|
|
33
|
+
|
|
34
|
+
Tue, 31 May 2022 21:28:50 GMT
|
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.9..@fluentui/react-aria_v9.0.0-rc.10)
|
|
36
|
+
|
|
37
|
+
### Changes
|
|
38
|
+
|
|
39
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
|
40
|
+
|
|
41
|
+
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.9)
|
|
42
|
+
|
|
43
|
+
Mon, 23 May 2022 12:14:24 GMT
|
|
44
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.8..@fluentui/react-aria_v9.0.0-rc.9)
|
|
45
|
+
|
|
46
|
+
### Changes
|
|
47
|
+
|
|
48
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
|
49
|
+
|
|
7
50
|
## [9.0.0-rc.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.8)
|
|
8
51
|
|
|
9
|
-
Thu, 05 May 2022 18:
|
|
52
|
+
Thu, 05 May 2022 18:26:28 GMT
|
|
10
53
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.7..@fluentui/react-aria_v9.0.0-rc.8)
|
|
11
54
|
|
|
12
55
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/useARIAButton.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AACA,SAAS,gBAAT,EAA2B,gBAA3B,QAAmD,2BAAnD;AAQA;;;;AAIG;;AACH,OAAO,MAAM,aAAa,GAAkD,CAAC,SAAD,EAAY,OAAZ,KAAuB;;;
|
|
1
|
+
{"version":3,"sources":["hooks/useARIAButton.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AACA,SAAS,gBAAT,EAA2B,gBAA3B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B,cAAzB;MACA,cAAc,CAAC,IAAf,GAAsB,CAAA,EAAA,GAAA,cAAc,CAAC,IAAf,MAAmB,IAAnB,IAAmB,EAAA,KAAA,KAAA,CAAnB,GAAmB,EAAnB,GAAuB,QAA7C;MACA,cAAc,CAAC,QAAf,GAA0B,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAAnF;IACD,CA1BiB,CA4BlB;;;IACA,OAAO,cAAc,CAAC,iBAAtB;EACD;;EAED,OAAO,cAAP;AACD,CAhGM","sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { resolveShorthand, useEventCallback } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, ResolveShorthandFunction, Slot } from '@fluentui/react-utilities';\n\nexport type ARIAButtonSlotProps = ExtractSlotProps<Slot<'button', 'a'>> & {\n disabled?: boolean;\n disabledFocusable?: boolean;\n};\n\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 useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps> = (shorthand, options) => {\n const shorthandProps = resolveShorthand(shorthand, options);\n\n const { disabled, disabledFocusable, onClick, onKeyDown, onKeyUp, tabIndex } = (shorthandProps ||\n {}) as ARIAButtonSlotProps;\n\n const onClickHandler: ARIAButtonSlotProps['onClick'] = useEventCallback(ev => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onClick?.(ev);\n }\n });\n\n const onKeyDownHandler: ARIAButtonSlotProps['onKeyDown'] = useEventCallback(ev => {\n onKeyDown?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if ((disabled || disabledFocusable) && (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 onKeyupHandler: ARIAButtonSlotProps['onKeyUp'] = useEventCallback(ev => {\n onKeyUp?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if ((disabled || disabledFocusable) && (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 (shorthandProps) {\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {\n shorthandProps.disabled = disabled && !disabledFocusable;\n shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined;\n\n // Undefine events if disabledFocusable is passed in\n if (disabledFocusable) {\n shorthandProps.onClick = undefined;\n shorthandProps.onKeyDown = undefined;\n shorthandProps.onKeyUp = undefined;\n }\n }\n\n // If an <a> tag is to be rendered we have to remove disabled and type, and set aria-disabled, role and tabIndex.\n else {\n delete shorthandProps.disabled;\n shorthandProps['aria-disabled'] = disabled || disabledFocusable;\n (shorthandProps as JSX.IntrinsicElements['a']).href = disabled\n ? undefined\n : (shorthandProps as JSX.IntrinsicElements['a']).href;\n shorthandProps.onClick = onClickHandler;\n shorthandProps.onKeyDown = onKeyDownHandler;\n shorthandProps.onKeyUp = onKeyupHandler;\n shorthandProps.role = shorthandProps.role ?? 'button';\n shorthandProps.tabIndex = disabled && !disabledFocusable ? undefined : tabIndex ?? 0;\n }\n\n // Remove non-DOM disabledFocusable prop\n delete shorthandProps.disabledFocusable;\n }\n\n return shorthandProps;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":"AAAA;;;AAGG;AACH,OAAM,SAAU,iBAAV,CAA4B,SAA5B,EAAiG;;;EACrG,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;EACA,IAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;IAChC,OAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;EACD;;EACD,OAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD","sourcesContent":["/**\n * @internal\n * Merges disabled declaration with `aria-disabled`\n */\nexport function mergeARIADisabled(shorthand: { 'aria-disabled'?: string | boolean; disabled?: boolean }) {\n const disabled = shorthand.disabled ?? shorthand['aria-disabled'];\n if (typeof disabled === 'string') {\n return disabled === 'false' ? false : true;\n }\n return disabled ?? false;\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/useARIAButton.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAQA;;;;AAIG;;;AACI,MAAM,aAAa,GAAkD,CAAC,SAAD,EAAY,OAAZ,KAAuB;;;
|
|
1
|
+
{"version":3,"sources":["hooks/useARIAButton.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAQA;;;;AAIG;;;AACI,MAAM,aAAa,GAAkD,CAAC,SAAD,EAAY,OAAZ,KAAuB;;;EACjG,MAAM,cAAc,GAAG,iBAAA,CAAA,gBAAA,CAAiB,SAAj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AAc,CAAC,IAAf,GAAsB,CAAA,EAAA,GAAA,cAAc,CAAC,IAAf,MAAmB,IAAnB,IAAmB,EAAA,KAAA,KAAA,CAAnB,GAAmB,EAAnB,GAAuB,QAA7C;MACA,cAAc,CAAC,QAAf,GAA0B,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAAnF;IACD,CA1BiB,CA4BlB;;;IACA,OAAO,cAAc,CAAC,iBAAtB;EACD;;EAED,OAAO,cAAP;AACD,CAhGM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["import { Enter, Space } from '@fluentui/keyboard-keys';\nimport { resolveShorthand, useEventCallback } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, ResolveShorthandFunction, Slot } from '@fluentui/react-utilities';\n\nexport type ARIAButtonSlotProps = ExtractSlotProps<Slot<'button', 'a'>> & {\n disabled?: boolean;\n disabledFocusable?: boolean;\n};\n\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 useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps> = (shorthand, options) => {\n const shorthandProps = resolveShorthand(shorthand, options);\n\n const { disabled, disabledFocusable, onClick, onKeyDown, onKeyUp, tabIndex } = (shorthandProps ||\n {}) as ARIAButtonSlotProps;\n\n const onClickHandler: ARIAButtonSlotProps['onClick'] = useEventCallback(ev => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onClick?.(ev);\n }\n });\n\n const onKeyDownHandler: ARIAButtonSlotProps['onKeyDown'] = useEventCallback(ev => {\n onKeyDown?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if ((disabled || disabledFocusable) && (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 onKeyupHandler: ARIAButtonSlotProps['onKeyUp'] = useEventCallback(ev => {\n onKeyUp?.(ev);\n\n if (ev.isDefaultPrevented()) {\n return;\n }\n\n const key = ev.key;\n\n if ((disabled || disabledFocusable) && (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 (shorthandProps) {\n // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly\n if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {\n shorthandProps.disabled = disabled && !disabledFocusable;\n shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined;\n\n // Undefine events if disabledFocusable is passed in\n if (disabledFocusable) {\n shorthandProps.onClick = undefined;\n shorthandProps.onKeyDown = undefined;\n shorthandProps.onKeyUp = undefined;\n }\n }\n\n // If an <a> tag is to be rendered we have to remove disabled and type, and set aria-disabled, role and tabIndex.\n else {\n delete shorthandProps.disabled;\n shorthandProps['aria-disabled'] = disabled || disabledFocusable;\n (shorthandProps as JSX.IntrinsicElements['a']).href = disabled\n ? undefined\n : (shorthandProps as JSX.IntrinsicElements['a']).href;\n shorthandProps.onClick = onClickHandler;\n shorthandProps.onKeyDown = onKeyDownHandler;\n shorthandProps.onKeyUp = onKeyupHandler;\n shorthandProps.role = shorthandProps.role ?? 'button';\n shorthandProps.tabIndex = disabled && !disabledFocusable ? undefined : tabIndex ?? 0;\n }\n\n // Remove non-DOM disabledFocusable prop\n delete shorthandProps.disabledFocusable;\n }\n\n return shorthandProps;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,eAAA,EAAA;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,eAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,aAAA;EAAa;AAAb,CAAA;;AAET,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA","sourcesContent":["export { useARIAButton } from './hooks/index';\nexport type { ARIAButtonSlotProps } from './hooks/index';\nexport { mergeARIADisabled } from './utils/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":";;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;;AACH,SAAgB,iBAAhB,CAAkC,SAAlC,EAAuG;;;EACrG,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;EACA,IAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;IAChC,OAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;EACD;;EACD,OAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD;;AAND,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourcesContent":["/**\n * @internal\n * Merges disabled declaration with `aria-disabled`\n */\nexport function mergeARIADisabled(shorthand: { 'aria-disabled'?: string | boolean; disabled?: boolean }) {\n const disabled = shorthand.disabled ?? shorthand['aria-disabled'];\n if (typeof disabled === 'string') {\n return disabled === 'false' ? false : true;\n }\n return disabled ?? false;\n}\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.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": "^1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@fluentui/keyboard-keys": "9.0.0
|
|
34
|
-
"@fluentui/react-utilities": "9.0.0
|
|
33
|
+
"@fluentui/keyboard-keys": "^9.0.0",
|
|
34
|
+
"@fluentui/react-utilities": "^9.0.1-0",
|
|
35
35
|
"tslib": "^2.1.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -42,9 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"beachball": {
|
|
44
44
|
"disallowedChangeTypes": [
|
|
45
|
-
"major"
|
|
46
|
-
"minor",
|
|
47
|
-
"patch"
|
|
45
|
+
"major"
|
|
48
46
|
]
|
|
49
47
|
},
|
|
50
48
|
"exports": {
|