@fluentui/react-aria 0.0.0-nightlyf1be0a972820211214.1 → 0.0.0-nightlyf3017f159620220222.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 CHANGED
@@ -2,46 +2,126 @@
2
2
  "name": "@fluentui/react-aria",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 14 Dec 2021 04:16:14 GMT",
6
- "tag": "@fluentui/react-aria_v0.0.0-nightlyf1be0a972820211214.1",
7
- "version": "0.0.0-nightlyf1be0a972820211214.1",
5
+ "date": "Tue, 22 Feb 2022 04:13:21 GMT",
6
+ "tag": "@fluentui/react-aria_v0.0.0-nightlyf3017f159620220222.1",
7
+ "version": "0.0.0-nightlyf3017f159620220222.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
11
11
  "author": "email not defined",
12
12
  "package": "@fluentui/react-aria",
13
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca",
13
+ "commit": "abd89ece026acc4dc588f4a78edfb26dc1b57921",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-aria",
19
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlyf1be0a972820211214.1",
20
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca"
19
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlyf3017f159620220222.1",
20
+ "commit": "abd89ece026acc4dc588f4a78edfb26dc1b57921"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-aria",
25
- "comment": "Bump @fluentui/react-make-styles to v0.0.0-nightlyf1be0a972820211214.1",
26
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca"
25
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightlyf3017f159620220222.1",
26
+ "commit": "abd89ece026acc4dc588f4a78edfb26dc1b57921"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Fri, 18 Feb 2022 13:35:38 GMT",
33
+ "tag": "@fluentui/react-aria_v9.0.0-rc.3",
34
+ "version": "9.0.0-rc.3",
35
+ "comments": {
36
+ "prerelease": [
37
+ {
38
+ "author": "lingfangao@hotmail.com",
39
+ "package": "@fluentui/react-aria",
40
+ "commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
41
+ "comment": "fix: Source maps contain original source code"
42
+ },
43
+ {
44
+ "author": "Humberto.Morimoto@microsoft.com",
45
+ "package": "@fluentui/react-aria",
46
+ "commit": "ca590a438b12b85d32fdf8b592ada3b0e7b2314c",
47
+ "comment": "Fixing issue in useAriaButton where passing disabledFocusable=false caused aria-disabled to be set to false and appear in DOM instead of just be undefined for that element."
27
48
  },
28
49
  {
29
50
  "author": "beachball",
30
51
  "package": "@fluentui/react-aria",
31
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightlyf1be0a972820211214.1",
32
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca"
52
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.3",
53
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
54
+ },
55
+ {
56
+ "author": "beachball",
57
+ "package": "@fluentui/react-aria",
58
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
59
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Thu, 10 Feb 2022 08:52:17 GMT",
66
+ "tag": "@fluentui/react-aria_v9.0.0-rc.1",
67
+ "version": "9.0.0-rc.1",
68
+ "comments": {
69
+ "none": [
70
+ {
71
+ "author": "olfedias@microsoft.com",
72
+ "package": "@fluentui/react-aria",
73
+ "commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
74
+ "comment": "remove inline-style-expand-shorthand from tsconfigs"
75
+ },
76
+ {
77
+ "author": "martinhochel@microsoft.com",
78
+ "package": "@fluentui/react-aria",
79
+ "commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
80
+ "comment": "chore: use storybook runner for all vNext packages"
81
+ }
82
+ ],
83
+ "prerelease": [
84
+ {
85
+ "author": "olfedias@microsoft.com",
86
+ "package": "@fluentui/react-aria",
87
+ "commit": "f4eafee2c3b8d85b3a267d6b155f0f5585a435fd",
88
+ "comment": "remove Griffel packages"
89
+ },
90
+ {
91
+ "author": "lingfangao@hotmail.com",
92
+ "package": "@fluentui/react-aria",
93
+ "commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
94
+ "comment": "Bump Fluent UI packages to 9.0.0-rc"
95
+ },
96
+ {
97
+ "author": "Humberto.Morimoto@microsoft.com",
98
+ "package": "@fluentui/react-aria",
99
+ "commit": "e0b8e1fa6980077e7b311fd1c72c28d3e4305db0",
100
+ "comment": "Updating based on changes to composition types."
101
+ },
102
+ {
103
+ "author": "behowell@microsoft.com",
104
+ "package": "@fluentui/react-aria",
105
+ "commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
106
+ "comment": "Refactor component Slot typings"
107
+ },
108
+ {
109
+ "author": "behowell@microsoft.com",
110
+ "package": "@fluentui/react-aria",
111
+ "commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
112
+ "comment": "Remove component's shorthandProps array"
33
113
  },
34
114
  {
35
115
  "author": "beachball",
36
116
  "package": "@fluentui/react-aria",
37
- "comment": "Bump @fluentui/jest-serializer-make-styles to v0.0.0-nightlyf1be0a972820211214.1",
38
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca"
117
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.1",
118
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
39
119
  },
40
120
  {
41
121
  "author": "beachball",
42
122
  "package": "@fluentui/react-aria",
43
- "comment": "Bump @fluentui/babel-make-styles to v0.0.0-nightlyf1be0a972820211214.1",
44
- "commit": "3bda806f2deef1997fc6c070450a4a7aacb036ca"
123
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
124
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
45
125
  }
46
126
  ]
47
127
  }
package/CHANGELOG.md CHANGED
@@ -1,22 +1,46 @@
1
1
  # Change Log - @fluentui/react-aria
2
2
 
3
- This log was last generated on Tue, 14 Dec 2021 04:16:14 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 22 Feb 2022 04:13:21 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightlyf1be0a972820211214.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v0.0.0-nightlyf1be0a972820211214.1)
7
+ ## [0.0.0-nightlyf3017f159620220222.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v0.0.0-nightlyf3017f159620220222.1)
8
8
 
9
- Tue, 14 Dec 2021 04:16:14 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.4..@fluentui/react-aria_v0.0.0-nightlyf1be0a972820211214.1)
9
+ Tue, 22 Feb 2022 04:13:21 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.3..@fluentui/react-aria_v0.0.0-nightlyf3017f159620220222.1)
11
11
 
12
12
  ### Changes
13
13
 
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by email not defined)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightlyf1be0a972820211214.1 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by beachball)
16
- - Bump @fluentui/react-make-styles to v0.0.0-nightlyf1be0a972820211214.1 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by beachball)
17
- - Bump @fluentui/react-utilities to v0.0.0-nightlyf1be0a972820211214.1 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by beachball)
18
- - Bump @fluentui/jest-serializer-make-styles to v0.0.0-nightlyf1be0a972820211214.1 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by beachball)
19
- - Bump @fluentui/babel-make-styles to v0.0.0-nightlyf1be0a972820211214.1 ([commit](https://github.com/microsoft/fluentui/commit/3bda806f2deef1997fc6c070450a4a7aacb036ca) by beachball)
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/abd89ece026acc4dc588f4a78edfb26dc1b57921) by email not defined)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightlyf3017f159620220222.1 ([commit](https://github.com/microsoft/fluentui/commit/abd89ece026acc4dc588f4a78edfb26dc1b57921) by beachball)
16
+ - Bump @fluentui/react-utilities to v0.0.0-nightlyf3017f159620220222.1 ([commit](https://github.com/microsoft/fluentui/commit/abd89ece026acc4dc588f4a78edfb26dc1b57921) by beachball)
17
+
18
+ ## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.3)
19
+
20
+ Fri, 18 Feb 2022 13:35:38 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.1..@fluentui/react-aria_v9.0.0-rc.3)
22
+
23
+ ### Changes
24
+
25
+ - fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
26
+ - Fixing issue in useAriaButton where passing disabledFocusable=false caused aria-disabled to be set to false and appear in DOM instead of just be undefined for that element. ([PR #21703](https://github.com/microsoft/fluentui/pull/21703) by Humberto.Morimoto@microsoft.com)
27
+ - Bump @fluentui/keyboard-keys to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
28
+ - Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
29
+
30
+ ## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.1)
31
+
32
+ Thu, 10 Feb 2022 08:52:17 GMT
33
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.4..@fluentui/react-aria_v9.0.0-rc.1)
34
+
35
+ ### Changes
36
+
37
+ - remove Griffel packages ([PR #21440](https://github.com/microsoft/fluentui/pull/21440) by olfedias@microsoft.com)
38
+ - Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
39
+ - Updating based on changes to composition types. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
40
+ - Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
41
+ - Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
42
+ - Bump @fluentui/keyboard-keys to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
43
+ - Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
20
44
 
21
45
  ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-beta.4)
22
46
 
@@ -1,10 +1,8 @@
1
- import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
2
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
3
- import * as React_2 from 'react';
4
- import type { ResolveShorthandOptions } from '@fluentui/react-utilities';
5
- import type { ShorthandProps } from '@fluentui/react-utilities';
1
+ import type { ExtractSlotProps } from '@fluentui/react-utilities';
2
+ import type { ResolveShorthandFunction } from '@fluentui/react-utilities';
3
+ import type { Slot } from '@fluentui/react-utilities';
6
4
 
7
- export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button', 'a'> & {
5
+ export declare type ARIAButtonSlotProps = ExtractSlotProps<Slot<'button', 'a'>> & {
8
6
  disabled?: boolean;
9
7
  disabledFocusable?: boolean;
10
8
  };
@@ -12,17 +10,16 @@ export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button',
12
10
  /**
13
11
  * Merges disabled declaration with `aria-disabled`
14
12
  */
15
- export declare function mergeARIADisabled(shorthand: ObjectShorthandProps<{
13
+ export declare function mergeARIADisabled(shorthand: {
16
14
  'aria-disabled'?: string | boolean;
17
- children?: React_2.ReactNode;
18
15
  disabled?: boolean;
19
- }>): boolean;
16
+ }): boolean;
20
17
 
21
18
  /**
22
19
  * Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec
23
20
  * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases
24
21
  * where no attribute addition is required.
25
22
  */
26
- export declare function useARIAButton<Required extends boolean = false>(shorthand: ShorthandProps<ARIAButtonShorthandProps>, options?: ResolveShorthandOptions<ARIAButtonShorthandProps, Required>): Required extends false ? ARIAButtonShorthandProps | undefined : ARIAButtonShorthandProps;
23
+ export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
27
24
 
28
25
  export { }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './useARIAButton';\n"]}
@@ -1,5 +1,5 @@
1
- import type { IntrinsicShorthandProps, ResolveShorthandOptions, ShorthandProps } from '@fluentui/react-utilities';
2
- export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button', 'a'> & {
1
+ import type { ExtractSlotProps, ResolveShorthandFunction, Slot } from '@fluentui/react-utilities';
2
+ export declare type ARIAButtonSlotProps = ExtractSlotProps<Slot<'button', 'a'>> & {
3
3
  disabled?: boolean;
4
4
  disabledFocusable?: boolean;
5
5
  };
@@ -8,4 +8,4 @@ export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button',
8
8
  * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases
9
9
  * where no attribute addition is required.
10
10
  */
11
- export declare function useARIAButton<Required extends boolean = false>(shorthand: ShorthandProps<ARIAButtonShorthandProps>, options?: ResolveShorthandOptions<ARIAButtonShorthandProps, Required>): Required extends false ? ARIAButtonShorthandProps | undefined : ARIAButtonShorthandProps;
11
+ export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
@@ -6,7 +6,7 @@ import { resolveShorthand, useEventCallback } from '@fluentui/react-utilities';
6
6
  * where no attribute addition is required.
7
7
  */
8
8
 
9
- export function useARIAButton(shorthand, options) {
9
+ export const useARIAButton = (shorthand, options) => {
10
10
  var _a;
11
11
 
12
12
  const shorthandProps = resolveShorthand(shorthand, options);
@@ -75,7 +75,7 @@ export function useARIAButton(shorthand, options) {
75
75
  // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
76
76
  if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {
77
77
  shorthandProps.disabled = disabled && !disabledFocusable;
78
- shorthandProps['aria-disabled'] = disabledFocusable; // Undefine events if disabledFocusable is passed in
78
+ shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined; // Undefine events if disabledFocusable is passed in
79
79
 
80
80
  if (disabledFocusable) {
81
81
  shorthandProps.onClick = undefined;
@@ -99,5 +99,5 @@ export function useARIAButton(shorthand, options) {
99
99
  }
100
100
 
101
101
  return shorthandProps;
102
- }
102
+ };
103
103
  //# sourceMappingURL=useARIAButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useARIAButton.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AACA,SAAS,gBAAT,EAA2B,gBAA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,iBAAtB;AACD;;AAED,SAAO,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/"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC","sourcesContent":["export * from './hooks/index';\nexport * from './utils/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './mergeARIADisabled';\n"]}
@@ -1,10 +1,7 @@
1
- import * as React from 'react';
2
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
3
1
  /**
4
2
  * Merges disabled declaration with `aria-disabled`
5
3
  */
6
- export declare function mergeARIADisabled(shorthand: ObjectShorthandProps<{
4
+ export declare function mergeARIADisabled(shorthand: {
7
5
  'aria-disabled'?: string | boolean;
8
- children?: React.ReactNode;
9
6
  disabled?: boolean;
10
- }>): boolean;
7
+ }): boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mergeARIADisabled.ts"],"names":[],"mappings":"AAGA;;AAEG;AACH,OAAM,SAAU,iBAAV,CACJ,SADI,EAKF;;;AAEF,QAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;AACA,MAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;AAChC,WAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;AACD;;AACD,SAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD","sourceRoot":""}
1
+ {"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAM,SAAU,iBAAV,CAA4B,SAA5B,EAAiG;;;AACrG,QAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;AACA,MAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;AAChC,WAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;AACD;;AACD,SAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD","sourcesContent":["/**\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":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useARIAButton';\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,5 @@
1
- import type { IntrinsicShorthandProps, ResolveShorthandOptions, ShorthandProps } from '@fluentui/react-utilities';
2
- export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button', 'a'> & {
1
+ import type { ExtractSlotProps, ResolveShorthandFunction, Slot } from '@fluentui/react-utilities';
2
+ export declare type ARIAButtonSlotProps = ExtractSlotProps<Slot<'button', 'a'>> & {
3
3
  disabled?: boolean;
4
4
  disabledFocusable?: boolean;
5
5
  };
@@ -8,4 +8,4 @@ export declare type ARIAButtonShorthandProps = IntrinsicShorthandProps<'button',
8
8
  * for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases
9
9
  * where no attribute addition is required.
10
10
  */
11
- export declare function useARIAButton<Required extends boolean = false>(shorthand: ShorthandProps<ARIAButtonShorthandProps>, options?: ResolveShorthandOptions<ARIAButtonShorthandProps, Required>): Required extends false ? ARIAButtonShorthandProps | undefined : ARIAButtonShorthandProps;
11
+ export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
@@ -15,7 +15,7 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
15
15
  */
16
16
 
17
17
 
18
- function useARIAButton(shorthand, options) {
18
+ const useARIAButton = (shorthand, options) => {
19
19
  var _a;
20
20
 
21
21
  const shorthandProps = react_utilities_1.resolveShorthand(shorthand, options);
@@ -84,7 +84,7 @@ function useARIAButton(shorthand, options) {
84
84
  // If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
85
85
  if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {
86
86
  shorthandProps.disabled = disabled && !disabledFocusable;
87
- shorthandProps['aria-disabled'] = disabledFocusable; // Undefine events if disabledFocusable is passed in
87
+ shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined; // Undefine events if disabledFocusable is passed in
88
88
 
89
89
  if (disabledFocusable) {
90
90
  shorthandProps.onClick = undefined;
@@ -108,7 +108,7 @@ function useARIAButton(shorthand, options) {
108
108
  }
109
109
 
110
110
  return shorthandProps;
111
- }
111
+ };
112
112
 
113
113
  exports.useARIAButton = useARIAButton;
114
114
  //# sourceMappingURL=useARIAButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useARIAButton.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAQA;;;;AAIG;;;AACH,SAAgB,aAAhB,CACE,SADF,EAEE,OAFF,EAEuE;;;AAErE,QAAM,cAAc,GAAG,iBAAA,CAAA,gBAAA,CAAiB,SAAjB,EAA4B,OAA5B,CAAvB;AAEA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,iBAAZ;AAA+B,IAAA,OAA/B;AAAwC,IAAA,SAAxC;AAAmD,IAAA,OAAnD;AAA4D,IAAA;AAA5D,MAA0E,cAAc,IAC5F,EADF;AAGA,QAAM,cAAc,GAAwC,iBAAA,CAAA,g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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":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './hooks/index';\nexport * from './utils/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './mergeARIADisabled';\n"],"sourceRoot":"../src/"}
@@ -1,10 +1,7 @@
1
- import * as React from 'react';
2
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
3
1
  /**
4
2
  * Merges disabled declaration with `aria-disabled`
5
3
  */
6
- export declare function mergeARIADisabled(shorthand: ObjectShorthandProps<{
4
+ export declare function mergeARIADisabled(shorthand: {
7
5
  'aria-disabled'?: string | boolean;
8
- children?: React.ReactNode;
9
6
  disabled?: boolean;
10
- }>): boolean;
7
+ }): boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mergeARIADisabled.ts"],"names":[],"mappings":";;;;;;AAGA;;AAEG;;AACH,SAAgB,iBAAhB,CACE,SADF,EAKI;;;AAEF,QAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;AACA,MAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;AAChC,WAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;AACD;;AACD,SAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD;;AAZD,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourceRoot":""}
1
+ {"version":3,"sources":["utils/mergeARIADisabled.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,iBAAhB,CAAkC,SAAlC,EAAuG;;;AACrG,QAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,SAAS,CAAC,QAAV,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,SAAS,CAAC,eAAD,CAAhD;;AACA,MAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;AAChC,WAAO,QAAQ,KAAK,OAAb,GAAuB,KAAvB,GAA+B,IAAtC;AACD;;AACD,SAAO,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,KAAnB;AACD;;AAND,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourcesContent":["/**\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": "0.0.0-nightlyf1be0a972820211214.1",
3
+ "version": "0.0.0-nightlyf3017f159620220222.1",
4
4
  "description": "React helper to ensure ARIA",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -18,15 +18,14 @@
18
18
  "just": "just-scripts",
19
19
  "lint": "just-scripts lint",
20
20
  "start": "yarn storybook",
21
- "test": "jest",
21
+ "test": "jest --passWithNoTests",
22
22
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
23
23
  "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-aria/src && yarn docs",
24
- "storybook": "start-storybook",
24
+ "storybook": "node ../../scripts/storybook/runner",
25
25
  "type-check": "tsc -b tsconfig.json"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
- "@fluentui/jest-serializer-make-styles": "0.0.0-nightlyf1be0a972820211214.1",
30
29
  "@fluentui/react-conformance": "*",
31
30
  "@fluentui/scripts": "^1.0.0",
32
31
  "@types/enzyme": "3.10.3",
@@ -38,13 +37,11 @@
38
37
  "enzyme-adapter-react-16": "^1.15.0",
39
38
  "react": "16.8.6",
40
39
  "react-dom": "16.8.6",
41
- "react-test-renderer": "^16.3.0",
42
- "@fluentui/babel-make-styles": "0.0.0-nightlyf1be0a972820211214.1"
40
+ "react-test-renderer": "^16.3.0"
43
41
  },
44
42
  "dependencies": {
45
- "@fluentui/keyboard-keys": "0.0.0-nightlyf1be0a972820211214.1",
46
- "@fluentui/react-make-styles": "0.0.0-nightlyf1be0a972820211214.1",
47
- "@fluentui/react-utilities": "0.0.0-nightlyf1be0a972820211214.1",
43
+ "@fluentui/keyboard-keys": "0.0.0-nightlyf3017f159620220222.1",
44
+ "@fluentui/react-utilities": "0.0.0-nightlyf3017f159620220222.1",
48
45
  "tslib": "^2.1.0"
49
46
  },
50
47
  "peerDependencies": {