@fluentui/react-utilities 0.0.0-nightlya0ab3454ed20211208.1 → 0.0.0-nightlya0aef7969220220228.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 +132 -6
- package/CHANGELOG.md +36 -6
- package/dist/react-utilities.d.ts +200 -78
- package/lib/compose/getSlots.d.ts +7 -8
- package/lib/compose/getSlots.js +3 -4
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.d.ts +0 -1
- package/lib/compose/index.js +0 -1
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/resolveShorthand.d.ts +10 -6
- package/lib/compose/resolveShorthand.js +5 -5
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.d.ts +86 -34
- package/lib/compose/types.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useBoolean.js.map +1 -1
- package/lib/hooks/useConst.js.map +1 -1
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedEventCallbacks.d.ts +18 -0
- package/lib/hooks/useMergedEventCallbacks.js +26 -0
- package/lib/hooks/useMergedEventCallbacks.js.map +1 -0
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useMount.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/hooks/useUnmount.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js.map +1 -1
- package/lib/utils/applyTriggerPropsToChildren.d.ts +1 -1
- package/lib/utils/applyTriggerPropsToChildren.js +23 -3
- package/lib/utils/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.d.ts +4 -4
- package/lib/utils/getNativeElementProps.js +2 -1
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.d.ts +25 -0
- package/lib/utils/getReactCallbackName.js +26 -0
- package/lib/utils/getReactCallbackName.js.map +1 -0
- package/lib/utils/getTriggerChild.d.ts +22 -0
- package/lib/utils/getTriggerChild.js +26 -0
- package/lib/utils/getTriggerChild.js.map +1 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +2 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isFluentTrigger.d.ts +22 -0
- package/lib/utils/isFluentTrigger.js +8 -0
- package/lib/utils/isFluentTrigger.js.map +1 -0
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.d.ts +6 -0
- package/lib/utils/properties.js +48 -20
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/lib-commonjs/compose/getSlots.d.ts +7 -8
- package/lib-commonjs/compose/getSlots.js +3 -5
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.d.ts +0 -1
- package/lib-commonjs/compose/index.js +0 -2
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.d.ts +10 -6
- package/lib-commonjs/compose/resolveShorthand.js +5 -5
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.d.ts +86 -34
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/hooks/index.d.ts +1 -0
- package/lib-commonjs/hooks/index.js +2 -0
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useBoolean.js.map +1 -1
- package/lib-commonjs/hooks/useConst.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +18 -0
- package/lib-commonjs/hooks/useMergedEventCallbacks.js +36 -0
- package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -0
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useMount.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/hooks/useUnmount.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +1 -1
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js +24 -4
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.d.ts +4 -4
- package/lib-commonjs/utils/getNativeElementProps.js +1 -0
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.d.ts +25 -0
- package/lib-commonjs/utils/getReactCallbackName.js +35 -0
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
- package/lib-commonjs/utils/getTriggerChild.d.ts +22 -0
- package/lib-commonjs/utils/getTriggerChild.js +37 -0
- package/lib-commonjs/utils/getTriggerChild.js.map +1 -0
- package/lib-commonjs/utils/index.d.ts +2 -1
- package/lib-commonjs/utils/index.js +4 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isFluentTrigger.d.ts +22 -0
- package/lib-commonjs/utils/isFluentTrigger.js +17 -0
- package/lib-commonjs/utils/isFluentTrigger.js.map +1 -0
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.d.ts +6 -0
- package/lib-commonjs/utils/properties.js +49 -21
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/package.json +3 -7
- package/lib/compose/nullRender.d.ts +0 -4
- package/lib/compose/nullRender.js +0 -5
- package/lib/compose/nullRender.js.map +0 -1
- package/lib/utils/onlyChild.d.ts +0 -5
- package/lib/utils/onlyChild.js +0 -13
- package/lib/utils/onlyChild.js.map +0 -1
- package/lib-commonjs/compose/nullRender.d.ts +0 -4
- package/lib-commonjs/compose/nullRender.js +0 -14
- package/lib-commonjs/compose/nullRender.js.map +0 -1
- package/lib-commonjs/utils/onlyChild.d.ts +0 -5
- package/lib-commonjs/utils/onlyChild.js +0 -23
- package/lib-commonjs/utils/onlyChild.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,17 +2,119 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-utilities_v0.0.0-
|
7
|
-
"version": "0.0.0-
|
5
|
+
"date": "Mon, 28 Feb 2022 04:14:00 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v0.0.0-nightlya0aef7969220220228.1",
|
7
|
+
"version": "0.0.0-nightlya0aef7969220220228.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
11
11
|
"author": "email not defined",
|
12
12
|
"package": "@fluentui/react-utilities",
|
13
|
-
"commit": "
|
13
|
+
"commit": "357dddd59345f57e77408824366096081c934571",
|
14
14
|
"comment": "Release nightly v9"
|
15
15
|
},
|
16
|
+
{
|
17
|
+
"author": "behowell@microsoft.com",
|
18
|
+
"package": "@fluentui/react-utilities",
|
19
|
+
"commit": "ae02eeac8cef2cd5decad088d0e45f296d400ef1",
|
20
|
+
"comment": "Add fieldset to getNativeElementProps"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-utilities",
|
25
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlya0aef7969220220228.1",
|
26
|
+
"commit": "357dddd59345f57e77408824366096081c934571"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"date": "Fri, 18 Feb 2022 13:35:37 GMT",
|
33
|
+
"tag": "@fluentui/react-utilities_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-utilities",
|
40
|
+
"commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
|
41
|
+
"comment": "fix: Source maps contain original source code"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"author": "beachball",
|
45
|
+
"package": "@fluentui/react-utilities",
|
46
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.3",
|
47
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"date": "Thu, 10 Feb 2022 08:50:32 GMT",
|
54
|
+
"tag": "@fluentui/react-utilities_v9.0.0-rc.1",
|
55
|
+
"version": "9.0.0-rc.1",
|
56
|
+
"comments": {
|
57
|
+
"prerelease": [
|
58
|
+
{
|
59
|
+
"author": "behowell@microsoft.com",
|
60
|
+
"package": "@fluentui/react-utilities",
|
61
|
+
"commit": "317209bb5cd57c40f35bc42060acb7e3cce5ec95",
|
62
|
+
"comment": "Rename component hooks add the suffix _unstable, as their API has not been finalized yet"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"author": "behowell@microsoft.com",
|
66
|
+
"package": "@fluentui/react-utilities",
|
67
|
+
"commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
|
68
|
+
"comment": "getSlots: remove slotNames param, and infer from state.components instead"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"author": "olfedias@microsoft.com",
|
72
|
+
"package": "@fluentui/react-utilities",
|
73
|
+
"commit": "d2eb57808a403b70845a732a62b55aa64d66b2a0",
|
74
|
+
"comment": "add useTriggerElement() hook"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"author": "bsunderhus@microsoft.com",
|
78
|
+
"package": "@fluentui/react-utilities",
|
79
|
+
"commit": "c0d4e63ee58e60e2c6674efbacc0783cd520984e",
|
80
|
+
"comment": "Removes nullRender from react-utilities"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"author": "olfedias@microsoft.com",
|
84
|
+
"package": "@fluentui/react-utilities",
|
85
|
+
"commit": "aa6cfd8ac825b5a280206808101de549a91094fc",
|
86
|
+
"comment": "update applyTriggerPropsToChildren() to return React.ReactElement or null"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"author": "behowell@microsoft.com",
|
90
|
+
"package": "@fluentui/react-utilities",
|
91
|
+
"commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
|
92
|
+
"comment": "Refactor component Slot typings"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
96
|
+
"package": "@fluentui/react-utilities",
|
97
|
+
"commit": "0bc161458eae5ae8d387172430496ce9829b1bb1",
|
98
|
+
"comment": "Adding ComponentSlotProps to allow ref to be passed in composite components."
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
102
|
+
"package": "@fluentui/react-utilities",
|
103
|
+
"commit": "e0b8e1fa6980077e7b311fd1c72c28d3e4305db0",
|
104
|
+
"comment": "Renaming most *Shorthand* composition types to *SlotProps* so they better reflect what the types do."
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"author": "lingfangao@hotmail.com",
|
108
|
+
"package": "@fluentui/react-utilities",
|
109
|
+
"commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
|
110
|
+
"comment": "Bump Fluent UI packages to 9.0.0-rc"
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"author": "behowell@microsoft.com",
|
114
|
+
"package": "@fluentui/react-utilities",
|
115
|
+
"commit": "f30e7585a8d2abd9db06c4076f39a779008b0eca",
|
116
|
+
"comment": "Update trigger utilities to handle nested triggers"
|
117
|
+
},
|
16
118
|
{
|
17
119
|
"author": "elcraig@microsoft.com",
|
18
120
|
"package": "@fluentui/react-utilities",
|
@@ -22,16 +124,40 @@
|
|
22
124
|
{
|
23
125
|
"author": "beachball",
|
24
126
|
"package": "@fluentui/react-utilities",
|
25
|
-
"comment": "Bump @fluentui/keyboard-keys to
|
26
|
-
"commit": "
|
127
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0-rc.1",
|
128
|
+
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
|
27
129
|
}
|
28
130
|
],
|
29
131
|
"none": [
|
132
|
+
{
|
133
|
+
"author": "elcraig@microsoft.com",
|
134
|
+
"package": "@fluentui/react-utilities",
|
135
|
+
"commit": "3360b45ec159250b1346c91afad7dce138e6bc20",
|
136
|
+
"comment": "Update API file to version generated by typescript 4.3"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"author": "olfedias@microsoft.com",
|
140
|
+
"package": "@fluentui/react-utilities",
|
141
|
+
"commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
|
142
|
+
"comment": "remove inline-style-expand-shorthand from tsconfigs"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"author": "martinhochel@microsoft.com",
|
146
|
+
"package": "@fluentui/react-utilities",
|
147
|
+
"commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
|
148
|
+
"comment": "chore: use storybook runner for all vNext packages"
|
149
|
+
},
|
30
150
|
{
|
31
151
|
"author": "seanmonahan@microsoft.com",
|
32
152
|
"package": "@fluentui/react-utilities",
|
33
153
|
"commit": "6404bef16cebf1f67b9b80a9f6d5f605f9873df1",
|
34
154
|
"comment": "Update getSlots() docs."
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"author": "lingfangao@hotmail.com",
|
158
|
+
"package": "@fluentui/react-utilities",
|
159
|
+
"commit": "a4e048a0e03ddd676670da516e3a6612b26ea500",
|
160
|
+
"comment": "chore: Remove enzyme from react-utilities tests"
|
35
161
|
}
|
36
162
|
]
|
37
163
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,49 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 28 Feb 2022 04:14:00 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightlya0aef7969220220228.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightlya0aef7969220220228.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-
|
9
|
+
Mon, 28 Feb 2022 04:14:00 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.3..@fluentui/react-utilities_v0.0.0-nightlya0aef7969220220228.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
|
-
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/
|
14
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by email not defined)
|
15
|
+
- Add fieldset to getNativeElementProps ([PR #21835](https://github.com/microsoft/fluentui/pull/21835) by behowell@microsoft.com)
|
16
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightlya0aef7969220220228.1 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by beachball)
|
17
|
+
|
18
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-rc.3)
|
19
|
+
|
20
|
+
Fri, 18 Feb 2022 13:35:37 GMT
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.1..@fluentui/react-utilities_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
|
+
- Bump @fluentui/keyboard-keys to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
27
|
+
|
28
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-rc.1)
|
29
|
+
|
30
|
+
Thu, 10 Feb 2022 08:50:32 GMT
|
31
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.4..@fluentui/react-utilities_v9.0.0-rc.1)
|
32
|
+
|
33
|
+
### Changes
|
34
|
+
|
35
|
+
- Rename component hooks add the suffix _unstable, as their API has not been finalized yet ([PR #21365](https://github.com/microsoft/fluentui/pull/21365) by behowell@microsoft.com)
|
36
|
+
- getSlots: remove slotNames param, and infer from state.components instead ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
|
37
|
+
- add useTriggerElement() hook ([PR #21225](https://github.com/microsoft/fluentui/pull/21225) by olfedias@microsoft.com)
|
38
|
+
- Removes nullRender from react-utilities ([PR #21576](https://github.com/microsoft/fluentui/pull/21576) by bsunderhus@microsoft.com)
|
39
|
+
- update applyTriggerPropsToChildren() to return React.ReactElement or null ([PR #21609](https://github.com/microsoft/fluentui/pull/21609) by olfedias@microsoft.com)
|
40
|
+
- Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
|
41
|
+
- Adding ComponentSlotProps to allow ref to be passed in composite components. ([PR #20890](https://github.com/microsoft/fluentui/pull/20890) by Humberto.Morimoto@microsoft.com)
|
42
|
+
- Renaming most *Shorthand* composition types to *SlotProps* so they better reflect what the types do. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
|
43
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
44
|
+
- Update trigger utilities to handle nested triggers ([PR #21495](https://github.com/microsoft/fluentui/pull/21495) by behowell@microsoft.com)
|
15
45
|
- [breaking] Remove useControllableValue hook (use useControllableState instead) ([PR #20865](https://github.com/microsoft/fluentui/pull/20865) by elcraig@microsoft.com)
|
16
|
-
- Bump @fluentui/keyboard-keys to
|
46
|
+
- Bump @fluentui/keyboard-keys to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
17
47
|
|
18
48
|
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.4)
|
19
49
|
|
@@ -11,7 +11,7 @@ export declare const anchorProperties: Record<string, number>;
|
|
11
11
|
/**
|
12
12
|
* Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
|
13
13
|
*/
|
14
|
-
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string |
|
14
|
+
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null;
|
15
15
|
|
16
16
|
/**
|
17
17
|
* Helper type for inferring the type of the as prop from a Props type.
|
@@ -71,25 +71,22 @@ export declare const colGroupProperties: Record<string, number>;
|
|
71
71
|
|
72
72
|
export declare const colProperties: Record<string, number>;
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
export declare type
|
79
|
-
components?: {
|
80
|
-
[Key in keyof Shorthands]-?: React_2.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
|
81
|
-
};
|
82
|
-
} & Shorthands;
|
74
|
+
/**
|
75
|
+
* Defines the Props type for a component given its slots and the definition of which one is the primary slot,
|
76
|
+
* defaulting to root if one is not provided.
|
77
|
+
*/
|
78
|
+
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
|
83
79
|
|
84
80
|
/**
|
85
|
-
*
|
86
|
-
*
|
87
|
-
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
|
88
|
-
* it shouldn't be used as the type of a slot.
|
81
|
+
* Defines the State object of a component given its slots.
|
89
82
|
*/
|
90
|
-
export declare type
|
91
|
-
|
92
|
-
|
83
|
+
export declare type ComponentState<Slots extends SlotPropsRecord> = {
|
84
|
+
components: {
|
85
|
+
[Key in keyof Slots]-?: React_2.ComponentType<ExtractSlotProps<Slots[Key]>> | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
|
86
|
+
};
|
87
|
+
} & {
|
88
|
+
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
|
89
|
+
};
|
93
90
|
|
94
91
|
/**
|
95
92
|
* Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
|
@@ -105,6 +102,42 @@ export declare const defaultSSRContextValue: SSRContextValue;
|
|
105
102
|
*/
|
106
103
|
export declare const divProperties: Record<string, number>;
|
107
104
|
|
105
|
+
/**
|
106
|
+
* HTML element types that are not allowed to have children.
|
107
|
+
*
|
108
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
|
109
|
+
*/
|
110
|
+
declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.
|
114
|
+
*/
|
115
|
+
export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
|
116
|
+
|
117
|
+
/**
|
118
|
+
* An array of FIELDSET tag properties and events.
|
119
|
+
*
|
120
|
+
* @public
|
121
|
+
*/
|
122
|
+
export declare const fieldsetProperties: Record<string, number>;
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Allows a component to be tagged as a FluentUI trigger component.
|
126
|
+
*
|
127
|
+
* Triggers are special-case components: they attach event listeners and other props on their child,
|
128
|
+
* and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.
|
129
|
+
*
|
130
|
+
* A component can be tagged as a trigger as follows:
|
131
|
+
* ```ts
|
132
|
+
* const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;
|
133
|
+
*
|
134
|
+
* MyComponent.isFluentTriggerComponent = true; // MUST also set this to true
|
135
|
+
* ```
|
136
|
+
*/
|
137
|
+
export declare type FluentTriggerComponent = {
|
138
|
+
isFluentTriggerComponent?: boolean;
|
139
|
+
};
|
140
|
+
|
108
141
|
/**
|
109
142
|
* An array of FORM tag properties and events.
|
110
143
|
*
|
@@ -150,19 +183,19 @@ export declare function getNativeProps<T extends Record<string, any>>(props: Rec
|
|
150
183
|
*
|
151
184
|
* @returns An object containing the native props for the `root` and primary slots.
|
152
185
|
*/
|
153
|
-
export declare const getPartitionedNativeProps: ({ primarySlotTagName, props, excludedPropNames, }: {
|
186
|
+
export declare const getPartitionedNativeProps: <Props extends Pick<React_2.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
|
154
187
|
/** The primary slot's element type (e.g. 'div') */
|
155
188
|
primarySlotTagName: keyof JSX.IntrinsicElements;
|
156
189
|
/** The component's props object */
|
157
|
-
props:
|
190
|
+
props: Props;
|
158
191
|
/** List of native props to exclude from the returned value */
|
159
|
-
excludedPropNames?:
|
192
|
+
excludedPropNames?: ExcludedPropKeys[] | undefined;
|
160
193
|
}) => {
|
161
194
|
root: {
|
162
195
|
style: React_2.CSSProperties | undefined;
|
163
196
|
className: string | undefined;
|
164
197
|
};
|
165
|
-
primary:
|
198
|
+
primary: Omit<Props, ExcludedPropKeys>;
|
166
199
|
};
|
167
200
|
|
168
201
|
/**
|
@@ -185,12 +218,33 @@ export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
|
|
185
218
|
* runtime code filtering props in this function.
|
186
219
|
*
|
187
220
|
* @param state - State including slot definitions
|
188
|
-
* @param slotNames - Name of which props are slots
|
189
221
|
* @returns An object containing the `slots` map and `slotProps` map.
|
190
222
|
*/
|
191
|
-
export declare function getSlots<R extends
|
223
|
+
export declare function getSlots<R extends SlotPropsRecord>(state: ComponentState<R>): {
|
192
224
|
slots: Slots<R>;
|
193
|
-
slotProps:
|
225
|
+
slotProps: ObjectSlotProps<R>;
|
226
|
+
};
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
|
230
|
+
*
|
231
|
+
* In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
|
232
|
+
* it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
|
233
|
+
* This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
|
234
|
+
*
|
235
|
+
* For example, the following returns `<div id="child" />`:
|
236
|
+
* ```jsx
|
237
|
+
* getTriggerChild(
|
238
|
+
* <Tooltip>
|
239
|
+
* <MenuTrigger>
|
240
|
+
* <div id="child" />
|
241
|
+
* </MenuTrigger>
|
242
|
+
* </Tooltip>
|
243
|
+
* );
|
244
|
+
* ```
|
245
|
+
*/
|
246
|
+
export declare const getTriggerChild: (children: React_2.ReactNode) => React_2.ReactElement & {
|
247
|
+
ref?: React_2.Ref<unknown>;
|
194
248
|
};
|
195
249
|
|
196
250
|
/**
|
@@ -227,25 +281,19 @@ export declare const imgProperties: Record<string, number>;
|
|
227
281
|
export declare const inputProperties: Record<string, number>;
|
228
282
|
|
229
283
|
/**
|
230
|
-
*
|
231
|
-
*
|
232
|
-
*
|
233
|
-
* The first param is the slot's default type if no `as` prop is specified.
|
234
|
-
* The second param is an optional union of alternative types that can be specified for the `as` prop.
|
235
|
-
*
|
236
|
-
* ```
|
237
|
-
* IntrinsicShorthandProps<'div'> // Slot is always div
|
238
|
-
* IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
|
239
|
-
* IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
|
240
|
-
* ```
|
284
|
+
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
|
285
|
+
* * Removes legacy string ref.
|
286
|
+
* * Disallows children for empty tags like 'img'.
|
241
287
|
*/
|
242
|
-
|
243
|
-
|
244
|
-
}
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
}
|
288
|
+
declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = React_2.PropsWithRef<JSX.IntrinsicElements[Type]> & (Type extends EmptyIntrisicElements ? {
|
289
|
+
children?: never;
|
290
|
+
} : {});
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
|
294
|
+
* See the {@link FluentTriggerComponent} type for more info.
|
295
|
+
*/
|
296
|
+
export declare const isFluentTrigger: (element: React_2.ReactElement) => boolean | undefined;
|
249
297
|
|
250
298
|
/**
|
251
299
|
* Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.
|
@@ -273,24 +321,10 @@ export declare const labelProperties: Record<string, number>;
|
|
273
321
|
*/
|
274
322
|
export declare const liProperties: Record<string, number>;
|
275
323
|
|
276
|
-
|
277
|
-
|
278
|
-
*/
|
279
|
-
export declare const nullRender: () => null;
|
280
|
-
|
281
|
-
/**
|
282
|
-
* Defines the slot props for a slot that supports a Component type.
|
283
|
-
*
|
284
|
-
* For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
|
285
|
-
*/
|
286
|
-
export declare type ObjectShorthandProps<Props extends {
|
287
|
-
children?: React_2.ReactNode;
|
288
|
-
} = {}> = Props & {
|
289
|
-
children?: Props['children'] | ShorthandRenderFunction<Props>;
|
324
|
+
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
|
325
|
+
[K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? P : never;
|
290
326
|
};
|
291
327
|
|
292
|
-
export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
|
293
|
-
|
294
328
|
/**
|
295
329
|
* This is part of a hack to infer the element type from a native element *props* type.
|
296
330
|
* The only place the original element is found in a native props type (at least that's workable
|
@@ -327,16 +361,11 @@ export declare const olProperties: Record<string, number>;
|
|
327
361
|
*/
|
328
362
|
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
|
329
363
|
|
330
|
-
/**
|
331
|
-
* Similar to React.Children.only, but drills into fragments rather than treating them as a single child
|
332
|
-
*/
|
333
|
-
export declare const onlyChild: <P>(child: string | number | boolean | {} | React_2.ReactNodeArray | React_2.ReactPortal | React_2.ReactElement<P, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | null | undefined) => React_2.ReactElement<P, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)>;
|
334
|
-
|
335
364
|
export declare const optionProperties: Record<string, number>;
|
336
365
|
|
337
366
|
/**
|
338
367
|
* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
|
339
|
-
*
|
368
|
+
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
|
340
369
|
*
|
341
370
|
* The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional
|
342
371
|
* types, to prevent unions from being expanded.
|
@@ -349,6 +378,11 @@ export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unkn
|
|
349
378
|
*/
|
350
379
|
export declare type RefObjectFunction<T> = React_2.RefObject<T> & ((value: T) => void);
|
351
380
|
|
381
|
+
/**
|
382
|
+
* If type T includes `null`, remove it and add `undefined` instead.
|
383
|
+
*/
|
384
|
+
export declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
|
385
|
+
|
352
386
|
/**
|
353
387
|
* Resets generated IDs, should be used only in tests.
|
354
388
|
*
|
@@ -357,14 +391,19 @@ export declare type RefObjectFunction<T> = React_2.RefObject<T> & ((value: T) =>
|
|
357
391
|
export declare function resetIdsForTests(): void;
|
358
392
|
|
359
393
|
/**
|
360
|
-
* Resolves
|
394
|
+
* Resolves shorthands into slot props, to ensure normalization of the signature
|
361
395
|
* being passed down to getSlots method
|
362
|
-
* @param value - the base
|
363
|
-
* @param options - options to resolve
|
396
|
+
* @param value - the base shorthand props
|
397
|
+
* @param options - options to resolve shorthand props
|
364
398
|
*/
|
365
|
-
export declare
|
399
|
+
export declare const resolveShorthand: ResolveShorthandFunction;
|
366
400
|
|
367
|
-
export declare type
|
401
|
+
export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
|
402
|
+
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, true>): ReplaceNullWithUndefined<P>;
|
403
|
+
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>): ReplaceNullWithUndefined<P> | undefined;
|
404
|
+
};
|
405
|
+
|
406
|
+
export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = {
|
368
407
|
required?: Required;
|
369
408
|
defaultProps?: Props;
|
370
409
|
};
|
@@ -376,10 +415,6 @@ export declare type ResolveShorthandOptions<Props extends Record<string, any>, R
|
|
376
415
|
*/
|
377
416
|
export declare const selectProperties: Record<string, number>;
|
378
417
|
|
379
|
-
export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | Props;
|
380
|
-
|
381
|
-
export declare type ShorthandRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React_2.ReactNode;
|
382
|
-
|
383
418
|
/**
|
384
419
|
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
385
420
|
*
|
@@ -387,14 +422,55 @@ export declare type ShorthandRenderFunction<Props> = (Component: React_2.Element
|
|
387
422
|
*/
|
388
423
|
export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React_2.KeyboardEvent): boolean;
|
389
424
|
|
390
|
-
|
391
|
-
|
392
|
-
|
425
|
+
/**
|
426
|
+
* The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
|
427
|
+
* or a component like `typeof Button`.
|
428
|
+
*
|
429
|
+
* If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).
|
430
|
+
*
|
431
|
+
* By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,
|
432
|
+
* wrap with `NonNullable` (see examples below).
|
433
|
+
*
|
434
|
+
* @example
|
435
|
+
* ```
|
436
|
+
* // Intrinsic element examples:
|
437
|
+
* Slot<'div'> // Slot is always div
|
438
|
+
* Slot<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
|
439
|
+
* Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as="div" or as="pre"
|
440
|
+
* NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)
|
441
|
+
*
|
442
|
+
* // Component examples:
|
443
|
+
* Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props
|
444
|
+
* NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
|
445
|
+
* ```
|
446
|
+
*/
|
447
|
+
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.ComponentType | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
|
448
|
+
as?: Type;
|
449
|
+
} & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React_2.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
|
450
|
+
[As in AlternateAs]: {
|
451
|
+
as: As;
|
452
|
+
} & WithSlotRenderFunction<IntrisicElementProps<As>>;
|
453
|
+
}[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
|
454
|
+
|
455
|
+
/**
|
456
|
+
* Matches any component's Slots type (such as ButtonSlots).
|
457
|
+
*
|
458
|
+
* This should ONLY be used in type templates as in `extends SlotPropsRecord`;
|
459
|
+
* it shouldn't be used as a component's Slots type.
|
460
|
+
*/
|
461
|
+
export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
|
462
|
+
|
463
|
+
export declare type SlotRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React_2.ReactNode;
|
393
464
|
|
394
|
-
export declare type Slots<S extends
|
395
|
-
[K in keyof S]
|
465
|
+
export declare type Slots<S extends SlotPropsRecord> = {
|
466
|
+
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<ExtractSlotProps<S[K]>>;
|
396
467
|
};
|
397
468
|
|
469
|
+
/**
|
470
|
+
* The shorthand value of a slot allows specifying its child
|
471
|
+
*/
|
472
|
+
export declare type SlotShorthandValue = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal;
|
473
|
+
|
398
474
|
export declare const SSRContext: React_2.Context<SSRContextValue>;
|
399
475
|
|
400
476
|
/**
|
@@ -455,6 +531,16 @@ export declare const trProperties: Record<string, number>;
|
|
455
531
|
*/
|
456
532
|
export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
|
457
533
|
|
534
|
+
/**
|
535
|
+
* Matches any slot props type.
|
536
|
+
*
|
537
|
+
* This should ONLY be used in type templates as in `extends UnknownSlotProps`;
|
538
|
+
* it shouldn't be used as the type of a slot.
|
539
|
+
*/
|
540
|
+
export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
|
541
|
+
as?: keyof JSX.IntrinsicElements;
|
542
|
+
};
|
543
|
+
|
458
544
|
/**
|
459
545
|
* Hook to store a value and generate callbacks for setting the value to true or false.
|
460
546
|
* The identity of the callbacks will always stay the same.
|
@@ -577,6 +663,25 @@ export declare const useIsomorphicLayoutEffect: typeof React_2.useEffect;
|
|
577
663
|
*/
|
578
664
|
export declare function useIsSSR(): boolean;
|
579
665
|
|
666
|
+
/**
|
667
|
+
* Combine two event callbacks into a single callback function that calls each one in order.
|
668
|
+
*
|
669
|
+
* This is useful to add an event listener to an existing element without overwriting the current listener, if any.
|
670
|
+
*
|
671
|
+
* For example:
|
672
|
+
* ```ts
|
673
|
+
* state.slot.onChange = useMergedCallbacks(state.slot.onChange, ev => {
|
674
|
+
* // Handle onChange
|
675
|
+
* });
|
676
|
+
* ```
|
677
|
+
*
|
678
|
+
* @param callback1 - The first callback to be called
|
679
|
+
* @param callback2 - The second callback to be called
|
680
|
+
*
|
681
|
+
* @returns An event callback that calls the callbacks in order, and is stable between renders
|
682
|
+
*/
|
683
|
+
export declare function useMergedEventCallbacks<Args extends unknown[]>(callback1: ((...args: Args) => void) | undefined, callback2: ((...args: Args) => void) | undefined): (...args: Args) => void;
|
684
|
+
|
580
685
|
/**
|
581
686
|
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
|
582
687
|
* updates all provided refs
|
@@ -657,4 +762,21 @@ export declare const useUnmount: (callback: () => void) => void;
|
|
657
762
|
*/
|
658
763
|
export declare const videoProperties: Record<string, number>;
|
659
764
|
|
765
|
+
/**
|
766
|
+
* Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
|
767
|
+
* to be a render function that takes those props.
|
768
|
+
*/
|
769
|
+
declare type WithSlotRenderFunction<Props extends {
|
770
|
+
children?: unknown;
|
771
|
+
}> = Props & {
|
772
|
+
children?: Props['children'] | SlotRenderFunction<Props>;
|
773
|
+
};
|
774
|
+
|
775
|
+
/**
|
776
|
+
* Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.
|
777
|
+
*/
|
778
|
+
declare type WithSlotShorthandValue<Props extends {
|
779
|
+
children?: unknown;
|
780
|
+
}> = Props | Extract<SlotShorthandValue, Props['children']>;
|
781
|
+
|
660
782
|
export { }
|