@fluentui/react-aria 9.0.0-nightly.b5b7401007.0 → 9.0.0-rc.3
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 +191 -17
- package/CHANGELOG.md +60 -10
- package/dist/react-aria.d.ts +7 -10
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useARIAButton.d.ts +3 -3
- package/lib/hooks/useARIAButton.js +25 -20
- package/lib/hooks/useARIAButton.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeARIADisabled.d.ts +2 -5
- package/lib/utils/mergeARIADisabled.js +1 -1
- package/lib/utils/mergeARIADisabled.js.map +1 -1
- package/lib-commonjs/hooks/index.js +1 -1
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useARIAButton.d.ts +3 -3
- package/lib-commonjs/hooks/useARIAButton.js +27 -22
- package/lib-commonjs/hooks/useARIAButton.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeARIADisabled.d.ts +2 -5
- package/lib-commonjs/utils/mergeARIADisabled.js +1 -1
- package/lib-commonjs/utils/mergeARIADisabled.js.map +1 -1
- package/package.json +7 -9
package/CHANGELOG.json
CHANGED
|
@@ -2,46 +2,220 @@
|
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui/react-aria_v9.0.0-
|
|
7
|
-
"version": "9.0.0-
|
|
5
|
+
"date": "Fri, 18 Feb 2022 13:33:53 GMT",
|
|
6
|
+
"tag": "@fluentui/react-aria_v9.0.0-rc.3",
|
|
7
|
+
"version": "9.0.0-rc.3",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
11
|
-
"author": "
|
|
11
|
+
"author": "lingfangao@hotmail.com",
|
|
12
12
|
"package": "@fluentui/react-aria",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
|
|
14
|
+
"comment": "fix: Source maps contain original source code"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
"author": "
|
|
17
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
18
|
+
"package": "@fluentui/react-aria",
|
|
19
|
+
"commit": "ca590a438b12b85d32fdf8b592ada3b0e7b2314c",
|
|
20
|
+
"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."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-aria",
|
|
25
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.3",
|
|
26
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-aria",
|
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
|
|
32
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Thu, 10 Feb 2022 08:52:17 GMT",
|
|
39
|
+
"tag": "@fluentui/react-aria_v9.0.0-rc.1",
|
|
40
|
+
"version": "9.0.0-rc.1",
|
|
41
|
+
"comments": {
|
|
42
|
+
"none": [
|
|
43
|
+
{
|
|
44
|
+
"author": "olfedias@microsoft.com",
|
|
45
|
+
"package": "@fluentui/react-aria",
|
|
46
|
+
"commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
|
|
47
|
+
"comment": "remove inline-style-expand-shorthand from tsconfigs"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "martinhochel@microsoft.com",
|
|
51
|
+
"package": "@fluentui/react-aria",
|
|
52
|
+
"commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
|
|
53
|
+
"comment": "chore: use storybook runner for all vNext packages"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"prerelease": [
|
|
57
|
+
{
|
|
58
|
+
"author": "olfedias@microsoft.com",
|
|
59
|
+
"package": "@fluentui/react-aria",
|
|
60
|
+
"commit": "f4eafee2c3b8d85b3a267d6b155f0f5585a435fd",
|
|
61
|
+
"comment": "remove Griffel packages"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"author": "lingfangao@hotmail.com",
|
|
65
|
+
"package": "@fluentui/react-aria",
|
|
66
|
+
"commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
|
|
67
|
+
"comment": "Bump Fluent UI packages to 9.0.0-rc"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
71
|
+
"package": "@fluentui/react-aria",
|
|
72
|
+
"commit": "e0b8e1fa6980077e7b311fd1c72c28d3e4305db0",
|
|
73
|
+
"comment": "Updating based on changes to composition types."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"author": "behowell@microsoft.com",
|
|
77
|
+
"package": "@fluentui/react-aria",
|
|
78
|
+
"commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
|
|
79
|
+
"comment": "Refactor component Slot typings"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"author": "behowell@microsoft.com",
|
|
83
|
+
"package": "@fluentui/react-aria",
|
|
84
|
+
"commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
|
|
85
|
+
"comment": "Remove component's shorthandProps array"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"author": "beachball",
|
|
89
|
+
"package": "@fluentui/react-aria",
|
|
90
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.1",
|
|
91
|
+
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"author": "beachball",
|
|
95
|
+
"package": "@fluentui/react-aria",
|
|
96
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
|
|
97
|
+
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"date": "Thu, 25 Nov 2021 08:34:10 GMT",
|
|
104
|
+
"tag": "@fluentui/react-aria_v9.0.0-beta.4",
|
|
105
|
+
"version": "9.0.0-beta.4",
|
|
106
|
+
"comments": {
|
|
107
|
+
"none": [
|
|
108
|
+
{
|
|
109
|
+
"author": "olfedias@microsoft.com",
|
|
110
|
+
"package": "@fluentui/react-aria",
|
|
111
|
+
"commit": "8a820339f7f4084d8c46e97f06eebbeb18111397",
|
|
112
|
+
"comment": "update tooling config"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"prerelease": [
|
|
116
|
+
{
|
|
117
|
+
"author": "beachball",
|
|
118
|
+
"package": "@fluentui/react-aria",
|
|
119
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.4",
|
|
120
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"author": "beachball",
|
|
124
|
+
"package": "@fluentui/react-aria",
|
|
125
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.4",
|
|
126
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"author": "beachball",
|
|
130
|
+
"package": "@fluentui/react-aria",
|
|
131
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4",
|
|
132
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"author": "beachball",
|
|
136
|
+
"package": "@fluentui/react-aria",
|
|
137
|
+
"comment": "Bump @fluentui/babel-make-styles to v9.0.0-beta.4",
|
|
138
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"date": "Fri, 12 Nov 2021 13:25:13 GMT",
|
|
145
|
+
"tag": "@fluentui/react-aria_v9.0.0-beta.3",
|
|
146
|
+
"version": "9.0.0-beta.3",
|
|
147
|
+
"comments": {
|
|
148
|
+
"prerelease": [
|
|
149
|
+
{
|
|
150
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
151
|
+
"package": "@fluentui/react-aria",
|
|
152
|
+
"commit": "a4ea9b6227d2f634f85b40fe4cec10e4c391244b",
|
|
153
|
+
"comment": "Fixing events being fired when button is disabledFocusable"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"author": "gcox@microsoft.com",
|
|
18
157
|
"package": "@fluentui/react-aria",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
158
|
+
"commit": "c9bd5b5a02ae94a8239ce1b56cac2f0d0dbd3586",
|
|
159
|
+
"comment": "Updated beta and RC components to ES2019"
|
|
21
160
|
},
|
|
22
161
|
{
|
|
23
162
|
"author": "beachball",
|
|
24
163
|
"package": "@fluentui/react-aria",
|
|
25
|
-
"comment": "Bump @fluentui/
|
|
26
|
-
"commit": "
|
|
164
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.3",
|
|
165
|
+
"commit": "742342e52c65066f779232e4e1302fedf0dd460d"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"author": "beachball",
|
|
169
|
+
"package": "@fluentui/react-aria",
|
|
170
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.3",
|
|
171
|
+
"commit": "742342e52c65066f779232e4e1302fedf0dd460d"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"author": "beachball",
|
|
175
|
+
"package": "@fluentui/react-aria",
|
|
176
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.3",
|
|
177
|
+
"commit": "742342e52c65066f779232e4e1302fedf0dd460d"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"none": [
|
|
181
|
+
{
|
|
182
|
+
"author": "lingfangao@hotmail.com",
|
|
183
|
+
"package": "@fluentui/react-aria",
|
|
184
|
+
"commit": "00f70581480b536e723fb69edf0ae617beac4807",
|
|
185
|
+
"comment": "Remove beta release tag"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"date": "Wed, 27 Oct 2021 12:14:13 GMT",
|
|
192
|
+
"tag": "@fluentui/react-aria_v9.0.0-beta.2",
|
|
193
|
+
"version": "9.0.0-beta.2",
|
|
194
|
+
"comments": {
|
|
195
|
+
"prerelease": [
|
|
196
|
+
{
|
|
197
|
+
"author": "peter@draxler.ml",
|
|
198
|
+
"package": "@fluentui/react-aria",
|
|
199
|
+
"commit": "f6db7c8d6b7db0902775e7857b62b745be35b59a",
|
|
200
|
+
"comment": "added styling of documentation"
|
|
27
201
|
},
|
|
28
202
|
{
|
|
29
203
|
"author": "beachball",
|
|
30
204
|
"package": "@fluentui/react-aria",
|
|
31
|
-
"comment": "Bump @fluentui/react-make-styles to v9.0.0-
|
|
32
|
-
"commit": "
|
|
205
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.2",
|
|
206
|
+
"commit": "0f8f1ae7c2d908e51e29dd342d79e041f86fac08"
|
|
33
207
|
},
|
|
34
208
|
{
|
|
35
209
|
"author": "beachball",
|
|
36
210
|
"package": "@fluentui/react-aria",
|
|
37
|
-
"comment": "Bump @fluentui/react-utilities to v9.0.0-
|
|
38
|
-
"commit": "
|
|
211
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.2",
|
|
212
|
+
"commit": "0f8f1ae7c2d908e51e29dd342d79e041f86fac08"
|
|
39
213
|
},
|
|
40
214
|
{
|
|
41
215
|
"author": "beachball",
|
|
42
216
|
"package": "@fluentui/react-aria",
|
|
43
|
-
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-
|
|
44
|
-
"commit": "
|
|
217
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.2",
|
|
218
|
+
"commit": "0f8f1ae7c2d908e51e29dd342d79e041f86fac08"
|
|
45
219
|
}
|
|
46
220
|
]
|
|
47
221
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,72 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-aria
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 18 Feb 2022 13:33:53 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.0.0-
|
|
7
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.3)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-
|
|
9
|
+
Fri, 18 Feb 2022 13:33:53 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-rc.1..@fluentui/react-aria_v9.0.0-rc.3)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- Bump @fluentui/keyboard-keys to v9.0.0-
|
|
17
|
-
- Bump @fluentui/react-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
|
15
|
+
- 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)
|
|
16
|
+
- Bump @fluentui/keyboard-keys to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
18
|
+
|
|
19
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-rc.1)
|
|
20
|
+
|
|
21
|
+
Thu, 10 Feb 2022 08:52:17 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.4..@fluentui/react-aria_v9.0.0-rc.1)
|
|
23
|
+
|
|
24
|
+
### Changes
|
|
25
|
+
|
|
26
|
+
- remove Griffel packages ([PR #21440](https://github.com/microsoft/fluentui/pull/21440) by olfedias@microsoft.com)
|
|
27
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
|
28
|
+
- Updating based on changes to composition types. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
|
|
29
|
+
- Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
|
|
30
|
+
- Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
|
|
31
|
+
- Bump @fluentui/keyboard-keys to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
|
32
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
|
33
|
+
|
|
34
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-beta.4)
|
|
35
|
+
|
|
36
|
+
Thu, 25 Nov 2021 08:34:10 GMT
|
|
37
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.3..@fluentui/react-aria_v9.0.0-beta.4)
|
|
38
|
+
|
|
39
|
+
### Changes
|
|
40
|
+
|
|
41
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
|
42
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
|
43
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
|
44
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
|
45
|
+
|
|
46
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-beta.3)
|
|
47
|
+
|
|
48
|
+
Fri, 12 Nov 2021 13:25:13 GMT
|
|
49
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.2..@fluentui/react-aria_v9.0.0-beta.3)
|
|
50
|
+
|
|
51
|
+
### Changes
|
|
52
|
+
|
|
53
|
+
- Fixing events being fired when button is disabledFocusable ([PR #20342](https://github.com/microsoft/fluentui/pull/20342) by Humberto.Morimoto@microsoft.com)
|
|
54
|
+
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
|
55
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
|
56
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
|
57
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
|
58
|
+
|
|
59
|
+
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-beta.2)
|
|
60
|
+
|
|
61
|
+
Wed, 27 Oct 2021 12:14:13 GMT
|
|
62
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-beta.1..@fluentui/react-aria_v9.0.0-beta.2)
|
|
63
|
+
|
|
64
|
+
### Changes
|
|
65
|
+
|
|
66
|
+
- added styling of documentation ([PR #20193](https://github.com/microsoft/fluentui/pull/20193) by peter@draxler.ml)
|
|
67
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
|
68
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
|
69
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
|
20
70
|
|
|
21
71
|
## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-beta.1)
|
|
22
72
|
|
package/dist/react-aria.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
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
|
|
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:
|
|
13
|
+
export declare function mergeARIADisabled(shorthand: {
|
|
16
14
|
'aria-disabled'?: string | boolean;
|
|
17
|
-
children?: React_2.ReactNode;
|
|
18
15
|
disabled?: boolean;
|
|
19
|
-
}
|
|
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
|
|
23
|
+
export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
|
|
27
24
|
|
|
28
25
|
export { }
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
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 {
|
|
2
|
-
export declare type
|
|
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
|
|
11
|
+
export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
|
|
@@ -6,20 +6,19 @@ import { resolveShorthand, useEventCallback } from '@fluentui/react-utilities';
|
|
|
6
6
|
* where no attribute addition is required.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const useARIAButton = (shorthand, options) => {
|
|
10
10
|
var _a;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var onClickHandler = useEventCallback(function (ev) {
|
|
12
|
+
const shorthandProps = resolveShorthand(shorthand, options);
|
|
13
|
+
const {
|
|
14
|
+
disabled,
|
|
15
|
+
disabledFocusable,
|
|
16
|
+
onClick,
|
|
17
|
+
onKeyDown,
|
|
18
|
+
onKeyUp,
|
|
19
|
+
tabIndex
|
|
20
|
+
} = shorthandProps || {};
|
|
21
|
+
const onClickHandler = useEventCallback(ev => {
|
|
23
22
|
if (disabled || disabledFocusable) {
|
|
24
23
|
ev.preventDefault();
|
|
25
24
|
ev.stopPropagation();
|
|
@@ -27,14 +26,14 @@ export function useARIAButton(shorthand, options) {
|
|
|
27
26
|
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
|
|
29
|
+
const onKeyDownHandler = useEventCallback(ev => {
|
|
31
30
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
|
|
32
31
|
|
|
33
32
|
if (ev.isDefaultPrevented()) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
const key = ev.key;
|
|
38
37
|
|
|
39
38
|
if ((disabled || disabledFocusable) && (key === Enter || key === Space)) {
|
|
40
39
|
ev.preventDefault();
|
|
@@ -51,14 +50,14 @@ export function useARIAButton(shorthand, options) {
|
|
|
51
50
|
ev.currentTarget.click();
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
|
-
|
|
53
|
+
const onKeyupHandler = useEventCallback(ev => {
|
|
55
54
|
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
|
|
56
55
|
|
|
57
56
|
if (ev.isDefaultPrevented()) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
const key = ev.key;
|
|
62
61
|
|
|
63
62
|
if ((disabled || disabledFocusable) && (key === Enter || key === Space)) {
|
|
64
63
|
ev.preventDefault();
|
|
@@ -76,12 +75,18 @@ export function useARIAButton(shorthand, options) {
|
|
|
76
75
|
// If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
|
|
77
76
|
if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {
|
|
78
77
|
shorthandProps.disabled = disabled && !disabledFocusable;
|
|
79
|
-
shorthandProps['aria-disabled'] = disabledFocusable;
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined; // Undefine events if disabledFocusable is passed in
|
|
79
|
+
|
|
80
|
+
if (disabledFocusable) {
|
|
81
|
+
shorthandProps.onClick = undefined;
|
|
82
|
+
shorthandProps.onKeyDown = undefined;
|
|
83
|
+
shorthandProps.onKeyUp = undefined;
|
|
84
|
+
}
|
|
85
|
+
} // If an <a> tag is to be rendered we have to remove disabled and type, and set aria-disabled, role and tabIndex.
|
|
82
86
|
else {
|
|
83
87
|
delete shorthandProps.disabled;
|
|
84
88
|
shorthandProps['aria-disabled'] = disabled || disabledFocusable;
|
|
89
|
+
shorthandProps.href = disabled ? undefined : shorthandProps.href;
|
|
85
90
|
shorthandProps.onClick = onClickHandler;
|
|
86
91
|
shorthandProps.onKeyDown = onKeyDownHandler;
|
|
87
92
|
shorthandProps.onKeyUp = onKeyupHandler;
|
|
@@ -94,5 +99,5 @@ export function useARIAButton(shorthand, options) {
|
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
return shorthandProps;
|
|
97
|
-
}
|
|
102
|
+
};
|
|
98
103
|
//# sourceMappingURL=useARIAButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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;;;AACjG,QAAM,cAAc,GAAG,gBAAgB,CAAC,SAAD,EAAY,OAAZ,CAAvC;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,GAAmC,gBAAgB,CAAC,EAAE,IAAG;AAC3E,QAAI,QAAQ,IAAI,iBAAhB,EAAmC;AACjC,MAAA,EAAE,CAAC,cAAH;AACA,MAAA,EAAE,CAAC,eAAH;AACD,KAHD,MAGO;AACL,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;AACD;AACF,GAPsE,CAAvE;AASA,QAAM,gBAAgB,GAAqC,gBAAgB,CAAC,EAAE,IAAG;A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AAI,cAAc,CAAC,EAAf,KAAsB,QAAtB,IAAkC,cAAc,CAAC,EAAf,KAAsB,SAA5D,EAAuE;AACrE,MAAA,cAAc,CAAC,QAAf,GAA0B,QAAQ,IAAI,CAAC,iBAAvC;AACA,MAAA,cAAc,CAAC,eAAD,CAAd,GAAkC,iBAAiB,GAAG,IAAH,GAAU,SAA7D,CAFqE,CAIrE;;AACA,UAAI,iBAAJ,EAAuB;AACrB,QAAA,cAAc,CAAC,OAAf,GAAyB,SAAzB;AACA,QAAA,cAAc,CAAC,SAAf,GAA2B,SAA3B;AACA,QAAA,cAAc,CAAC,OAAf,GAAyB,SAAzB;AACD;AACF,KAVD,CAYA;AAZA,SAaK;AACH,aAAO,cAAc,CAAC,QAAtB;AACA,MAAA,cAAc,CAAC,eAAD,CAAd,GAAkC,QAAQ,IAAI,iBAA9C;AACC,MAAA,cAA6C,CAAC,IAA9C,GAAqD,QAAQ,GAC1D,SAD0D,GAEzD,cAA6C,CAAC,IAFlD;AAGD,MAAA,cAAc,CAAC,OAAf,GAAyB,cAAzB;AACA,MAAA,cAAc,CAAC,SAAf,GAA2B,gBAA3B;AACA,MAAA,cAAc,CAAC,OAAf,GAAyB,cAAzB;AACA,MAAA,cAAc,CAAC,IAAf,GAAsB,CAAA,EAAA,GAAA,cAAc,CAAC,IAAf,MAAmB,IAAnB,IAAmB,EAAA,KAAA,KAAA,CAAnB,GAAmB,EAAnB,GAAuB,QAA7C;AACA,MAAA,cAAc,CAAC,QAAf,GAA0B,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAAnF;AACD,KA1BiB,CA4BlB;;;AACA,WAAO,cAAc,CAAC,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":["
|
|
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"]}
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
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:
|
|
4
|
+
export declare function mergeARIADisabled(shorthand: {
|
|
7
5
|
'aria-disabled'?: string | boolean;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
6
|
disabled?: boolean;
|
|
10
|
-
}
|
|
7
|
+
}): boolean;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export function mergeARIADisabled(shorthand) {
|
|
5
5
|
var _a;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const disabled = (_a = shorthand.disabled) !== null && _a !== void 0 ? _a : shorthand['aria-disabled'];
|
|
8
8
|
|
|
9
9
|
if (typeof disabled === 'string') {
|
|
10
10
|
return disabled === 'false' ? false : true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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":["
|
|
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 {
|
|
2
|
-
export declare type
|
|
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
|
|
11
|
+
export declare const useARIAButton: ResolveShorthandFunction<ARIAButtonSlotProps>;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useARIAButton = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
11
|
/**
|
|
12
12
|
* Button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec
|
|
13
13
|
* for multiple scenarios of shorthand properties. Ensuring 1st rule of ARIA for cases
|
|
@@ -15,20 +15,19 @@ var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const useARIAButton = (shorthand, options) => {
|
|
19
19
|
var _a;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var onClickHandler = react_utilities_1.useEventCallback(function (ev) {
|
|
21
|
+
const shorthandProps = react_utilities_1.resolveShorthand(shorthand, options);
|
|
22
|
+
const {
|
|
23
|
+
disabled,
|
|
24
|
+
disabledFocusable,
|
|
25
|
+
onClick,
|
|
26
|
+
onKeyDown,
|
|
27
|
+
onKeyUp,
|
|
28
|
+
tabIndex
|
|
29
|
+
} = shorthandProps || {};
|
|
30
|
+
const onClickHandler = react_utilities_1.useEventCallback(ev => {
|
|
32
31
|
if (disabled || disabledFocusable) {
|
|
33
32
|
ev.preventDefault();
|
|
34
33
|
ev.stopPropagation();
|
|
@@ -36,14 +35,14 @@ function useARIAButton(shorthand, options) {
|
|
|
36
35
|
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
|
-
|
|
38
|
+
const onKeyDownHandler = react_utilities_1.useEventCallback(ev => {
|
|
40
39
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(ev);
|
|
41
40
|
|
|
42
41
|
if (ev.isDefaultPrevented()) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
const key = ev.key;
|
|
47
46
|
|
|
48
47
|
if ((disabled || disabledFocusable) && (key === keyboard_keys_1.Enter || key === keyboard_keys_1.Space)) {
|
|
49
48
|
ev.preventDefault();
|
|
@@ -60,14 +59,14 @@ function useARIAButton(shorthand, options) {
|
|
|
60
59
|
ev.currentTarget.click();
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
|
|
62
|
+
const onKeyupHandler = react_utilities_1.useEventCallback(ev => {
|
|
64
63
|
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(ev);
|
|
65
64
|
|
|
66
65
|
if (ev.isDefaultPrevented()) {
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
|
|
69
|
+
const key = ev.key;
|
|
71
70
|
|
|
72
71
|
if ((disabled || disabledFocusable) && (key === keyboard_keys_1.Enter || key === keyboard_keys_1.Space)) {
|
|
73
72
|
ev.preventDefault();
|
|
@@ -85,12 +84,18 @@ function useARIAButton(shorthand, options) {
|
|
|
85
84
|
// If a <button> tag is to be rendered we just need to set disabled and aria-disabled correctly
|
|
86
85
|
if (shorthandProps.as === 'button' || shorthandProps.as === undefined) {
|
|
87
86
|
shorthandProps.disabled = disabled && !disabledFocusable;
|
|
88
|
-
shorthandProps['aria-disabled'] = disabledFocusable;
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
shorthandProps['aria-disabled'] = disabledFocusable ? true : undefined; // Undefine events if disabledFocusable is passed in
|
|
88
|
+
|
|
89
|
+
if (disabledFocusable) {
|
|
90
|
+
shorthandProps.onClick = undefined;
|
|
91
|
+
shorthandProps.onKeyDown = undefined;
|
|
92
|
+
shorthandProps.onKeyUp = undefined;
|
|
93
|
+
}
|
|
94
|
+
} // If an <a> tag is to be rendered we have to remove disabled and type, and set aria-disabled, role and tabIndex.
|
|
91
95
|
else {
|
|
92
96
|
delete shorthandProps.disabled;
|
|
93
97
|
shorthandProps['aria-disabled'] = disabled || disabledFocusable;
|
|
98
|
+
shorthandProps.href = disabled ? undefined : shorthandProps.href;
|
|
94
99
|
shorthandProps.onClick = onClickHandler;
|
|
95
100
|
shorthandProps.onKeyDown = onKeyDownHandler;
|
|
96
101
|
shorthandProps.onKeyUp = onKeyupHandler;
|
|
@@ -103,7 +108,7 @@ function useARIAButton(shorthand, options) {
|
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
return shorthandProps;
|
|
106
|
-
}
|
|
111
|
+
};
|
|
107
112
|
|
|
108
113
|
exports.useARIAButton = useARIAButton;
|
|
109
114
|
//# sourceMappingUR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AH,GAAU,SAA7D,CAFqE,CAIrE;;AACA,UAAI,iBAAJ,EAAuB;AACrB,QAAA,cAAc,CAAC,OAAf,GAAyB,SAAzB;AACA,QAAA,cAAc,CAAC,SAAf,GAA2B,SAA3B;AACA,QAAA,cAAc,CAAC,OAAf,GAAyB,SAAzB;AACD;AACF,KAVD,CAYA;AAZA,SAaK;AACH,aAAO,cAAc,CAAC,QAAtB;AACA,MAAA,cAAc,CAAC,eAAD,CAAd,GAAkC,QAAQ,IAAI,iBAA9C;AACC,MAAA,cAA6C,CAAC,IAA9C,GAAqD,QAAQ,GAC1D,SAD0D,GAEzD,cAA6C,CAAC,IAFlD;AAGD,MAAA,cAAc,CAAC,OAAf,GAAyB,cAAzB;AACA,MAAA,cAAc,CAAC,SAAf,GAA2B,gBAA3B;AACA,MAAA,cAAc,CAAC,OAAf,GAAyB,cAAzB;AACA,MAAA,cAAc,CAAC,IAAf,GAAsB,CAAA,EAAA,GAAA,cAAc,CAAC,IAAf,MAAmB,IAAnB,IAAmB,EAAA,KAAA,KAAA,CAAnB,GAAmB,EAAnB,GAAuB,QAA7C;AACA,MAAA,cAAc,CAAC,QAAf,GAA0B,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAAnF;AACD,KA1BiB,CA4BlB;;;AACA,WAAO,cAAc,CAAC,iBAAtB;AACD;;AAED,SAAO,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/"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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/"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
8
|
|
|
9
9
|
tslib_1.__exportStar(require("./mergeARIADisabled"), exports);
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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:
|
|
4
|
+
export declare function mergeARIADisabled(shorthand: {
|
|
7
5
|
'aria-disabled'?: string | boolean;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
6
|
disabled?: boolean;
|
|
10
|
-
}
|
|
7
|
+
}): boolean;
|
|
@@ -11,7 +11,7 @@ exports.mergeARIADisabled = void 0;
|
|
|
11
11
|
function mergeARIADisabled(shorthand) {
|
|
12
12
|
var _a;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const disabled = (_a = shorthand.disabled) !== null && _a !== void 0 ? _a : shorthand['aria-disabled'];
|
|
15
15
|
|
|
16
16
|
if (typeof disabled === 'string') {
|
|
17
17
|
return disabled === 'false' ? false : true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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": "9.0.0-
|
|
3
|
+
"version": "9.0.0-rc.3",
|
|
4
4
|
"description": "React helper to ensure ARIA",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -18,14 +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
|
-
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-aria/src && yarn docs",
|
|
24
|
-
"storybook": "
|
|
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": "node ../../scripts/storybook/runner",
|
|
25
|
+
"type-check": "tsc -b tsconfig.json"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@fluentui/eslint-plugin": "*",
|
|
28
|
-
"@fluentui/jest-serializer-make-styles": "9.0.0-nightly.b5b7401007.0",
|
|
29
29
|
"@fluentui/react-conformance": "*",
|
|
30
30
|
"@fluentui/scripts": "^1.0.0",
|
|
31
31
|
"@types/enzyme": "3.10.3",
|
|
@@ -40,9 +40,8 @@
|
|
|
40
40
|
"react-test-renderer": "^16.3.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@fluentui/keyboard-keys": "9.0.0-
|
|
44
|
-
"@fluentui/react-
|
|
45
|
-
"@fluentui/react-utilities": "9.0.0-nightly.b5b7401007.0",
|
|
43
|
+
"@fluentui/keyboard-keys": "9.0.0-rc.3",
|
|
44
|
+
"@fluentui/react-utilities": "9.0.0-rc.3",
|
|
46
45
|
"tslib": "^2.1.0"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
@@ -52,7 +51,6 @@
|
|
|
52
51
|
"react-dom": ">=16.8.0 <18.0.0"
|
|
53
52
|
},
|
|
54
53
|
"beachball": {
|
|
55
|
-
"tag": "beta",
|
|
56
54
|
"disallowedChangeTypes": [
|
|
57
55
|
"major",
|
|
58
56
|
"minor",
|