@fluentui/react-utilities 9.0.0-rc.9 → 9.0.0
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 +84 -1
- package/CHANGELOG.md +29 -2
- package/dist/index.d.ts +31 -278
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +3 -2
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +1 -0
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -0
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -0
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +0 -2
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedEventCallbacks.js +1 -0
- package/lib/hooks/useMergedEventCallbacks.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +1 -0
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +2 -1
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +1 -0
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +4 -0
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useTimeout.js +2 -2
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +4 -4
- 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/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -0
- package/lib/{utils → trigger}/getTriggerChild.js +2 -0
- package/lib/trigger/getTriggerChild.js.map +1 -0
- package/lib/trigger/index.js +5 -0
- package/lib/trigger/index.js.map +1 -0
- package/lib/{utils → trigger}/isFluentTrigger.js +0 -0
- package/lib/trigger/isFluentTrigger.js.map +1 -0
- package/lib/trigger/types.js +2 -0
- package/lib/trigger/types.js.map +1 -0
- package/lib/utils/clamp.js +1 -0
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +1 -0
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +0 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +2 -6
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/shouldPreventDefaultOnKeyDown.js +1 -0
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/hooks/index.js +0 -8
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +3 -3
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +1 -0
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +1 -0
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +1 -0
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +0 -2
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedEventCallbacks.js +1 -0
- package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +1 -0
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +2 -1
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +1 -0
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +4 -0
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +2 -3
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +8 -223
- 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/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -0
- package/lib-commonjs/{utils → trigger}/getTriggerChild.js +2 -0
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -0
- package/lib-commonjs/trigger/index.js +16 -0
- package/lib-commonjs/trigger/index.js.map +1 -0
- package/lib-commonjs/{utils → trigger}/isFluentTrigger.js +0 -0
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -0
- package/lib-commonjs/trigger/types.js +6 -0
- package/lib-commonjs/trigger/types.js.map +1 -0
- package/lib-commonjs/utils/clamp.js +1 -0
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +1 -0
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -6
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +3 -7
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +1 -0
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/package.json +3 -5
- package/lib/hooks/useBoolean.js +0 -28
- package/lib/hooks/useBoolean.js.map +0 -1
- package/lib/hooks/useConst.js +0 -30
- package/lib/hooks/useConst.js.map +0 -1
- package/lib/hooks/useMount.js +0 -17
- package/lib/hooks/useMount.js.map +0 -1
- package/lib/hooks/useUnmount.js +0 -17
- package/lib/hooks/useUnmount.js.map +0 -1
- package/lib/utils/applyTriggerPropsToChildren.js.map +0 -1
- package/lib/utils/getTriggerChild.js.map +0 -1
- package/lib/utils/isFluentTrigger.js.map +0 -1
- package/lib-commonjs/hooks/useBoolean.js +0 -39
- package/lib-commonjs/hooks/useBoolean.js.map +0 -1
- package/lib-commonjs/hooks/useConst.js +0 -40
- package/lib-commonjs/hooks/useConst.js.map +0 -1
- package/lib-commonjs/hooks/useMount.js +0 -27
- package/lib-commonjs/hooks/useMount.js.map +0 -1
- package/lib-commonjs/hooks/useUnmount.js +0 -27
- package/lib-commonjs/hooks/useUnmount.js.map +0 -1
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +0 -1
- package/lib-commonjs/utils/getTriggerChild.js.map +0 -1
- package/lib-commonjs/utils/isFluentTrigger.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,90 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 28 Jun 2022 15:08:36 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v9.0.0",
|
7
|
+
"version": "9.0.0",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "lingfangao@hotmail.com",
|
12
|
+
"package": "@fluentui/react-utilities",
|
13
|
+
"commit": "e0aabd850b15adf9c151ebd4e332f7c50ad6cfdf",
|
14
|
+
"comment": "Update 9.0.0-rc dependencies to use caret range"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "jukapsia@microsoft.com",
|
18
|
+
"package": "@fluentui/react-utilities",
|
19
|
+
"commit": "710a1cbae145b770a486946cc54eba494aef812c",
|
20
|
+
"comment": "fix: useOnClickOutside should trigger for webviews"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "39736248+andrefcdias@users.noreply.github.com",
|
24
|
+
"package": "@fluentui/react-utilities",
|
25
|
+
"commit": "12e5d1ab44f2500ef4363435689b3374368a23d5",
|
26
|
+
"comment": "feat: add void function component support to slots"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "lingfangao@hotmail.com",
|
30
|
+
"package": "@fluentui/react-utilities",
|
31
|
+
"commit": "2da4428ae7d6e464c538b7ed10e425ce0e531144",
|
32
|
+
"comment": "chore: Mark teams-prg owned APIs with @internal"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "bernardo.sunderhus@gmail.com",
|
36
|
+
"package": "@fluentui/react-utilities",
|
37
|
+
"commit": "ab7380ea15a9a8f0b33b2d31454044d3bb255a63",
|
38
|
+
"comment": "chore: moves trigger methods to separate folder"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"patch": [
|
42
|
+
{
|
43
|
+
"author": "lingfangao@hotmail.com",
|
44
|
+
"package": "@fluentui/react-utilities",
|
45
|
+
"commit": "c7b1348bdad7aa883c29bfbc96ef2a32e6ebc7dd",
|
46
|
+
"comment": "feat: Initial 9.0.0 release"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"author": "beachball",
|
50
|
+
"package": "@fluentui/react-utilities",
|
51
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.0",
|
52
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"date": "Tue, 31 May 2022 21:28:50 GMT",
|
59
|
+
"tag": "@fluentui/react-utilities_v9.0.0-rc.10",
|
60
|
+
"version": "9.0.0-rc.10",
|
61
|
+
"comments": {
|
62
|
+
"prerelease": [
|
63
|
+
{
|
64
|
+
"author": "olfedias@microsoft.com",
|
65
|
+
"package": "@fluentui/react-utilities",
|
66
|
+
"commit": "8da715ea657e5124f56450426b8052ef49a20180",
|
67
|
+
"comment": "remove exports for internals APIs & unused hooks"
|
68
|
+
}
|
69
|
+
]
|
70
|
+
}
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"date": "Thu, 26 May 2022 21:01:31 GMT",
|
74
|
+
"tag": "@fluentui/react-utilities_v9.0.0-rc.9",
|
75
|
+
"version": "9.0.0-rc.9",
|
76
|
+
"comments": {
|
77
|
+
"none": [
|
78
|
+
{
|
79
|
+
"author": "lingfangao@hotmail.com",
|
80
|
+
"package": "@fluentui/react-utilities",
|
81
|
+
"commit": "fff6a012b8a3b165b364ef2c412b9edee0bc05a9",
|
82
|
+
"comment": "Add eslint-ignore"
|
83
|
+
}
|
84
|
+
]
|
85
|
+
}
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"date": "Mon, 23 May 2022 12:13:58 GMT",
|
6
89
|
"tag": "@fluentui/react-utilities_v9.0.0-rc.9",
|
7
90
|
"version": "9.0.0-rc.9",
|
8
91
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,39 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 28 Jun 2022 15:08:36 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0)
|
8
|
+
|
9
|
+
Tue, 28 Jun 2022 15:08:36 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.10..@fluentui/react-utilities_v9.0.0)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
|
15
|
+
- Bump @fluentui/keyboard-keys to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
16
|
+
|
17
|
+
### Changes
|
18
|
+
|
19
|
+
- Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
|
20
|
+
- fix: useOnClickOutside should trigger for webviews ([PR #23535](https://github.com/microsoft/fluentui/pull/23535) by jukapsia@microsoft.com)
|
21
|
+
- feat: add void function component support to slots ([PR #23408](https://github.com/microsoft/fluentui/pull/23408) by 39736248+andrefcdias@users.noreply.github.com)
|
22
|
+
- chore: Mark teams-prg owned APIs with @internal ([PR #23689](https://github.com/microsoft/fluentui/pull/23689) by lingfangao@hotmail.com)
|
23
|
+
- chore: moves trigger methods to separate folder ([PR #23574](https://github.com/microsoft/fluentui/pull/23574) by bernardo.sunderhus@gmail.com)
|
24
|
+
|
25
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-rc.10)
|
26
|
+
|
27
|
+
Tue, 31 May 2022 21:28:50 GMT
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.9..@fluentui/react-utilities_v9.0.0-rc.10)
|
29
|
+
|
30
|
+
### Changes
|
31
|
+
|
32
|
+
- remove exports for internals APIs & unused hooks ([PR #23319](https://github.com/microsoft/fluentui/pull/23319) by olfedias@microsoft.com)
|
33
|
+
|
7
34
|
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-rc.9)
|
8
35
|
|
9
|
-
Mon, 23 May 2022 12:
|
36
|
+
Mon, 23 May 2022 12:13:58 GMT
|
10
37
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.8..@fluentui/react-utilities_v9.0.0-rc.9)
|
11
38
|
|
12
39
|
### Changes
|
package/dist/index.d.ts
CHANGED
@@ -2,13 +2,7 @@ import { DispatchWithoutAction } from 'react';
|
|
2
2
|
import * as React_2 from 'react';
|
3
3
|
|
4
4
|
/**
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* @public
|
8
|
-
*/
|
9
|
-
export declare const anchorProperties: Record<string, number>;
|
10
|
-
|
11
|
-
/**
|
5
|
+
* @internal
|
12
6
|
* Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
|
13
7
|
*/
|
14
8
|
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;
|
@@ -21,44 +15,17 @@ export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: Reac
|
|
21
15
|
* type Example<T> = T extends AsIntrinsicElement<infer As> ? As : never;
|
22
16
|
* ```
|
23
17
|
*/
|
24
|
-
|
18
|
+
declare type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> = {
|
25
19
|
as?: As;
|
26
20
|
};
|
27
21
|
|
28
|
-
/**
|
29
|
-
* An array of AUDIO tag properties and events.
|
30
|
-
|
31
|
-
* @public
|
32
|
-
*/
|
33
|
-
export declare const audioProperties: Record<string, number>;
|
34
|
-
|
35
|
-
/**
|
36
|
-
* An array of events that are allowed on every html element type.
|
37
|
-
*
|
38
|
-
* @public
|
39
|
-
*/
|
40
|
-
export declare const baseElementEvents: Record<string, number>;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* An array of element attributes which are allowed on every html element type.
|
44
|
-
*
|
45
|
-
* @public
|
46
|
-
*/
|
47
|
-
export declare const baseElementProperties: Record<string, number>;
|
48
|
-
|
49
|
-
/**
|
50
|
-
* An array of BUTTON tag properties and events.
|
51
|
-
*
|
52
|
-
* @public
|
53
|
-
*/
|
54
|
-
export declare const buttonProperties: Record<string, number>;
|
55
|
-
|
56
22
|
/**
|
57
23
|
* Verifies if an application can use DOM.
|
58
24
|
*/
|
59
25
|
export declare function canUseDOM(): boolean;
|
60
26
|
|
61
27
|
/**
|
28
|
+
* @internal
|
62
29
|
* Clamps `value` to a number between the min and max.
|
63
30
|
*
|
64
31
|
* @param value - the value to be clamped
|
@@ -67,10 +34,6 @@ export declare function canUseDOM(): boolean;
|
|
67
34
|
*/
|
68
35
|
export declare const clamp: (value: number, min: number, max: number) => number;
|
69
36
|
|
70
|
-
export declare const colGroupProperties: Record<string, number>;
|
71
|
-
|
72
|
-
export declare const colProperties: Record<string, number>;
|
73
|
-
|
74
37
|
/**
|
75
38
|
* Defines the Props type for a component given its slots and the definition of which one is the primary slot,
|
76
39
|
* defaulting to root if one is not provided.
|
@@ -88,20 +51,6 @@ export declare type ComponentState<Slots extends SlotPropsRecord> = {
|
|
88
51
|
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
|
89
52
|
};
|
90
53
|
|
91
|
-
/**
|
92
|
-
* Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
|
93
|
-
*
|
94
|
-
* @internal
|
95
|
-
*/
|
96
|
-
export declare const defaultSSRContextValue: SSRContextValue;
|
97
|
-
|
98
|
-
/**
|
99
|
-
* An array of DIV tag properties and events.
|
100
|
-
*
|
101
|
-
* @public
|
102
|
-
*/
|
103
|
-
export declare const divProperties: Record<string, number>;
|
104
|
-
|
105
54
|
/**
|
106
55
|
* HTML element types that are not allowed to have children.
|
107
56
|
*
|
@@ -115,13 +64,7 @@ declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' |
|
|
115
64
|
export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
|
116
65
|
|
117
66
|
/**
|
118
|
-
*
|
119
|
-
*
|
120
|
-
* @public
|
121
|
-
*/
|
122
|
-
export declare const fieldsetProperties: Record<string, number>;
|
123
|
-
|
124
|
-
/**
|
67
|
+
* @internal
|
125
68
|
* Allows a component to be tagged as a FluentUI trigger component.
|
126
69
|
*
|
127
70
|
* Triggers are special-case components: they attach event listeners and other props on their child,
|
@@ -138,13 +81,6 @@ export declare type FluentTriggerComponent = {
|
|
138
81
|
isFluentTriggerComponent?: boolean;
|
139
82
|
};
|
140
83
|
|
141
|
-
/**
|
142
|
-
* An array of FORM tag properties and events.
|
143
|
-
*
|
144
|
-
* @public
|
145
|
-
*/
|
146
|
-
export declare const formProperties: Record<string, number>;
|
147
|
-
|
148
84
|
/**
|
149
85
|
* Return type for `React.forwardRef`, including inference of the proper typing for the ref.
|
150
86
|
*/
|
@@ -159,22 +95,6 @@ export declare type ForwardRefComponent<Props> = ObscureEventName extends keyof
|
|
159
95
|
*/
|
160
96
|
export declare function getNativeElementProps<TAttributes extends React_2.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
|
161
97
|
|
162
|
-
/**
|
163
|
-
* Gets native supported props for an html element provided the allowance set. Use one of the property
|
164
|
-
* sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
|
165
|
-
* props set. Note that all data- and aria- prefixed attributes will be allowed.
|
166
|
-
* NOTE: getNativeProps should always be applied first when adding props to a react component. The
|
167
|
-
* non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
|
168
|
-
* For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
|
169
|
-
* the component after an onClick function is added, then the getNativeProps onClick will override it.
|
170
|
-
*
|
171
|
-
* @public
|
172
|
-
* @param props - The unfiltered input props
|
173
|
-
* @param allowedPropsNames - The array or record of allowed prop names.
|
174
|
-
* @returns The filtered props
|
175
|
-
*/
|
176
|
-
export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
|
177
|
-
|
178
98
|
/**
|
179
99
|
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
180
100
|
*
|
@@ -199,6 +119,7 @@ export declare const getPartitionedNativeProps: <Props extends Pick<React_2.HTML
|
|
199
119
|
};
|
200
120
|
|
201
121
|
/**
|
122
|
+
* @internal
|
202
123
|
* Finds and swaps a provided key for it's right to left format.
|
203
124
|
*/
|
204
125
|
export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
|
@@ -226,6 +147,7 @@ export declare function getSlots<R extends SlotPropsRecord>(state: ComponentStat
|
|
226
147
|
};
|
227
148
|
|
228
149
|
/**
|
150
|
+
* @internal
|
229
151
|
* Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
|
230
152
|
*
|
231
153
|
* In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
|
@@ -243,43 +165,10 @@ export declare function getSlots<R extends SlotPropsRecord>(state: ComponentStat
|
|
243
165
|
* );
|
244
166
|
* ```
|
245
167
|
*/
|
246
|
-
export declare const getTriggerChild: (children: React_2.ReactNode) => React_2.ReactElement & {
|
247
|
-
ref?: React_2.Ref<unknown
|
168
|
+
export declare const getTriggerChild: <P = any>(children: React_2.ReactNode) => React_2.ReactElement<P, string | React_2.JSXElementConstructor<any>> & {
|
169
|
+
ref?: React_2.Ref<unknown> | undefined;
|
248
170
|
};
|
249
171
|
|
250
|
-
/**
|
251
|
-
* An array of HTML element properties and events.
|
252
|
-
*
|
253
|
-
* @public
|
254
|
-
*/
|
255
|
-
export declare const htmlElementProperties: Record<string, number>;
|
256
|
-
|
257
|
-
/**
|
258
|
-
* An array of IFRAME tag properties and events.
|
259
|
-
*
|
260
|
-
* @public
|
261
|
-
*/
|
262
|
-
export declare const iframeProperties: Record<string, number>;
|
263
|
-
|
264
|
-
/**
|
265
|
-
* @deprecated Use imgProperties for img elements.
|
266
|
-
*/
|
267
|
-
export declare const imageProperties: Record<string, number>;
|
268
|
-
|
269
|
-
/**
|
270
|
-
* An array of IMAGE tag properties and events.
|
271
|
-
*
|
272
|
-
* @public
|
273
|
-
*/
|
274
|
-
export declare const imgProperties: Record<string, number>;
|
275
|
-
|
276
|
-
/**
|
277
|
-
* An array of INPUT tag properties and events.
|
278
|
-
*
|
279
|
-
* @public
|
280
|
-
*/
|
281
|
-
export declare const inputProperties: Record<string, number>;
|
282
|
-
|
283
172
|
/**
|
284
173
|
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
|
285
174
|
* * Removes legacy string ref.
|
@@ -289,12 +178,6 @@ declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = Re
|
|
289
178
|
children?: never;
|
290
179
|
} : {});
|
291
180
|
|
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;
|
297
|
-
|
298
181
|
/**
|
299
182
|
* Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.
|
300
183
|
*
|
@@ -303,24 +186,10 @@ export declare const isFluentTrigger: (element: React_2.ReactElement) => boolean
|
|
303
186
|
* IsSingleton<'a' | 'b' | 'c'> // false
|
304
187
|
* ```
|
305
188
|
*/
|
306
|
-
|
189
|
+
declare type IsSingleton<T extends string> = {
|
307
190
|
[K in T]: Exclude<T, K> extends never ? true : false;
|
308
191
|
}[T];
|
309
192
|
|
310
|
-
/**
|
311
|
-
* An array of LABEL tag properties and events.
|
312
|
-
*
|
313
|
-
* @public
|
314
|
-
*/
|
315
|
-
export declare const labelProperties: Record<string, number>;
|
316
|
-
|
317
|
-
/**
|
318
|
-
* An array of LI tag properties and events.
|
319
|
-
*
|
320
|
-
* @public
|
321
|
-
*/
|
322
|
-
export declare const liProperties: Record<string, number>;
|
323
|
-
|
324
193
|
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
|
325
194
|
[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;
|
326
195
|
};
|
@@ -339,30 +208,6 @@ declare type ObjectSlotProps<S extends SlotPropsRecord> = {
|
|
339
208
|
*/
|
340
209
|
declare type ObscureEventName = 'onLostPointerCaptureCapture';
|
341
210
|
|
342
|
-
/**
|
343
|
-
* An array of OL tag properties and events.
|
344
|
-
*
|
345
|
-
* @public
|
346
|
-
*/
|
347
|
-
export declare const olProperties: Record<string, number>;
|
348
|
-
|
349
|
-
/**
|
350
|
-
* Tiny helper to do the minimal amount of work in duplicating an object but omitting some
|
351
|
-
* props. This ends up faster than using object ...rest or reduce to filter.
|
352
|
-
*
|
353
|
-
* This behaves very much like filteredAssign, but does not merge many objects together,
|
354
|
-
* uses an exclusion object map, and avoids spreads all for optimal performance.
|
355
|
-
*
|
356
|
-
* See perf test for background:
|
357
|
-
* https://jsperf.com/omit-vs-rest-vs-reduce/1
|
358
|
-
*
|
359
|
-
* @param obj - The object to clone
|
360
|
-
* @param exclusions - The array of keys to exclude
|
361
|
-
*/
|
362
|
-
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
|
363
|
-
|
364
|
-
export declare const optionProperties: Record<string, number>;
|
365
|
-
|
366
211
|
/**
|
367
212
|
* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
|
368
213
|
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
|
@@ -370,9 +215,10 @@ export declare const optionProperties: Record<string, number>;
|
|
370
215
|
* The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional
|
371
216
|
* types, to prevent unions from being expanded.
|
372
217
|
*/
|
373
|
-
|
218
|
+
declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
|
374
219
|
|
375
220
|
/**
|
221
|
+
* @internal
|
376
222
|
* A Ref function which can be treated like a ref object in that it has an attached
|
377
223
|
* current property, which will be updated as the ref is evaluated.
|
378
224
|
*/
|
@@ -381,12 +227,10 @@ export declare type RefObjectFunction<T> = React_2.RefObject<T> & ((value: T) =>
|
|
381
227
|
/**
|
382
228
|
* If type T includes `null`, remove it and add `undefined` instead.
|
383
229
|
*/
|
384
|
-
|
230
|
+
declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
|
385
231
|
|
386
232
|
/**
|
387
233
|
* Resets generated IDs, should be used only in tests.
|
388
|
-
*
|
389
|
-
* @private
|
390
234
|
*/
|
391
235
|
export declare function resetIdsForTests(): void;
|
392
236
|
|
@@ -409,13 +253,7 @@ export declare type ResolveShorthandOptions<Props, Required extends boolean = fa
|
|
409
253
|
};
|
410
254
|
|
411
255
|
/**
|
412
|
-
*
|
413
|
-
*
|
414
|
-
* @public
|
415
|
-
*/
|
416
|
-
export declare const selectProperties: Record<string, number>;
|
417
|
-
|
418
|
-
/**
|
256
|
+
* @internal
|
419
257
|
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
420
258
|
*
|
421
259
|
* Useful for situations where a keydown needs to be transformed to a click event
|
@@ -444,7 +282,7 @@ export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React_2
|
|
444
282
|
* NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
|
445
283
|
* ```
|
446
284
|
*/
|
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 ? {
|
285
|
+
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.ComponentType | React_2.VoidFunctionComponent | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
|
448
286
|
as?: Type;
|
449
287
|
} & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React_2.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
|
450
288
|
[As in AlternateAs]: {
|
@@ -478,18 +316,6 @@ export declare type Slots<S extends SlotPropsRecord> = {
|
|
478
316
|
*/
|
479
317
|
export declare type SlotShorthandValue = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal;
|
480
318
|
|
481
|
-
export declare const SSRContext: React_2.Context<SSRContextValue>;
|
482
|
-
|
483
|
-
/**
|
484
|
-
* To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request
|
485
|
-
* to ensure the client and server are consistent.
|
486
|
-
*
|
487
|
-
* @internal
|
488
|
-
*/
|
489
|
-
export declare type SSRContextValue = {
|
490
|
-
current: number;
|
491
|
-
};
|
492
|
-
|
493
319
|
/**
|
494
320
|
* When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
|
495
321
|
* are consistent between the client and server.
|
@@ -498,45 +324,10 @@ export declare type SSRContextValue = {
|
|
498
324
|
*/
|
499
325
|
export declare const SSRProvider: React_2.FC;
|
500
326
|
|
501
|
-
/**
|
502
|
-
* An array of TABLE tag properties and events.
|
503
|
-
*
|
504
|
-
* @public
|
505
|
-
*/
|
506
|
-
export declare const tableProperties: Record<string, number>;
|
507
|
-
|
508
|
-
/**
|
509
|
-
* An array of TD tag properties and events.
|
510
|
-
*
|
511
|
-
* @public
|
512
|
-
*/
|
513
|
-
export declare const tdProperties: Record<string, number>;
|
514
|
-
|
515
|
-
/**
|
516
|
-
* An array of TEXTAREA tag properties and events.
|
517
|
-
*
|
518
|
-
* @public
|
519
|
-
*/
|
520
|
-
export declare const textAreaProperties: Record<string, number>;
|
521
|
-
|
522
|
-
/**
|
523
|
-
* An array of TH tag properties and events.
|
524
|
-
*
|
525
|
-
* @public
|
526
|
-
*/
|
527
|
-
export declare const thProperties: Record<string, number>;
|
528
|
-
|
529
|
-
/**
|
530
|
-
* An array of TR tag properties and events.
|
531
|
-
*
|
532
|
-
* @public
|
533
|
-
*/
|
534
|
-
export declare const trProperties: Record<string, number>;
|
535
|
-
|
536
327
|
/**
|
537
328
|
* Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)
|
538
329
|
*/
|
539
|
-
|
330
|
+
declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
|
540
331
|
|
541
332
|
/**
|
542
333
|
* Matches any slot props type.
|
@@ -544,43 +335,13 @@ export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U :
|
|
544
335
|
* This should ONLY be used in type templates as in `extends UnknownSlotProps`;
|
545
336
|
* it shouldn't be used as the type of a slot.
|
546
337
|
*/
|
547
|
-
|
338
|
+
declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
|
548
339
|
as?: keyof JSX.IntrinsicElements;
|
549
340
|
};
|
550
341
|
|
551
342
|
/**
|
552
|
-
*
|
553
|
-
* The identity of the callbacks will always stay the same.
|
554
|
-
*
|
555
|
-
* @param initialState - Initial value
|
556
|
-
* @returns Array with the current value and an object containing the updater callbacks.
|
557
|
-
*/
|
558
|
-
export declare function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks];
|
559
|
-
|
560
|
-
/** Updater callbacks returned by `useBoolean`. */
|
561
|
-
export declare type UseBooleanCallbacks = {
|
562
|
-
/** Set the value to true. Always has the same identity. */
|
563
|
-
setTrue: () => void;
|
564
|
-
/** Set the value to false. Always has the same identity. */
|
565
|
-
setFalse: () => void;
|
566
|
-
/** Toggle the value. Always has the same identity. */
|
567
|
-
toggle: () => void;
|
568
|
-
};
|
569
|
-
|
570
|
-
/**
|
571
|
-
* Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to
|
572
|
-
* always return the same value (and if the initializer is a function, only call it once).
|
573
|
-
* This is similar to setting a private member in a class constructor.
|
574
|
-
*
|
575
|
-
* If the value should ever change based on dependencies, use `React.useMemo` instead.
|
343
|
+
* @internal
|
576
344
|
*
|
577
|
-
* @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,
|
578
|
-
* only the value/function passed in the first time this is called is respected.
|
579
|
-
* @returns The value. The identity of this value will always be the same.
|
580
|
-
*/
|
581
|
-
export declare function useConst<T>(initialValue: T | (() => T)): T;
|
582
|
-
|
583
|
-
/**
|
584
345
|
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
|
585
346
|
* such as a checked state or text input string.
|
586
347
|
*
|
@@ -596,6 +357,9 @@ export declare function useConst<T>(initialValue: T | (() => T)): T;
|
|
596
357
|
*/
|
597
358
|
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>];
|
598
359
|
|
360
|
+
/**
|
361
|
+
* @internal
|
362
|
+
*/
|
599
363
|
export declare type UseControllableStateOptions<State> = {
|
600
364
|
/**
|
601
365
|
* User-provided default state or initializer, for uncontrolled usage.
|
@@ -613,6 +377,7 @@ export declare type UseControllableStateOptions<State> = {
|
|
613
377
|
};
|
614
378
|
|
615
379
|
/**
|
380
|
+
* @internal
|
616
381
|
* https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
|
617
382
|
*
|
618
383
|
* Modified `useCallback` that can be used when dependencies change too frequently. Can occur when
|
@@ -627,6 +392,7 @@ export declare type UseControllableStateOptions<State> = {
|
|
627
392
|
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return;
|
628
393
|
|
629
394
|
/**
|
395
|
+
* @internal
|
630
396
|
* Checks if components was mounted the first time.
|
631
397
|
* Since concurrent mode will be released in the future this needs to be verified
|
632
398
|
* Currently (React 17) will always render the initial mount once
|
@@ -639,6 +405,7 @@ export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...
|
|
639
405
|
export declare function useFirstMount(): boolean;
|
640
406
|
|
641
407
|
/**
|
408
|
+
* @internal
|
642
409
|
* Forces a re-render, similar to `forceUpdate` in class components.
|
643
410
|
*/
|
644
411
|
export declare function useForceUpdate(): DispatchWithoutAction;
|
@@ -654,6 +421,7 @@ export declare function useForceUpdate(): DispatchWithoutAction;
|
|
654
421
|
export declare function useId(prefix?: string, providedId?: string): string;
|
655
422
|
|
656
423
|
/**
|
424
|
+
* @internal
|
657
425
|
* React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
|
658
426
|
* useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
|
659
427
|
* ensure we don't get a render flash for certain operations, but we may also need affected components to render on
|
@@ -671,6 +439,7 @@ export declare const useIsomorphicLayoutEffect: typeof React_2.useEffect;
|
|
671
439
|
export declare function useIsSSR(): boolean;
|
672
440
|
|
673
441
|
/**
|
442
|
+
* @internal
|
674
443
|
* Combine two event callbacks into a single callback function that calls each one in order.
|
675
444
|
*
|
676
445
|
* This is useful to add an event listener to an existing element without overwriting the current listener, if any.
|
@@ -690,6 +459,7 @@ export declare function useIsSSR(): boolean;
|
|
690
459
|
export declare function useMergedEventCallbacks<Args extends unknown[]>(callback1: ((...args: Args) => void) | undefined, callback2: ((...args: Args) => void) | undefined): (...args: Args) => void;
|
691
460
|
|
692
461
|
/**
|
462
|
+
* @internal
|
693
463
|
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
|
694
464
|
* updates all provided refs
|
695
465
|
* @param refs - Refs to collectively update with one ref value.
|
@@ -698,12 +468,8 @@ export declare function useMergedEventCallbacks<Args extends unknown[]>(callback
|
|
698
468
|
export declare function useMergedRefs<T>(...refs: (React_2.Ref<T> | undefined)[]): RefObjectFunction<T>;
|
699
469
|
|
700
470
|
/**
|
701
|
-
*
|
702
|
-
*
|
703
|
-
* @param callback - Function to call before mount.
|
471
|
+
* @internal
|
704
472
|
*/
|
705
|
-
export declare const useMount: (callback: () => void) => void;
|
706
|
-
|
707
473
|
export declare type UseOnClickOrScrollOutsideOptions = {
|
708
474
|
/**
|
709
475
|
* The element to listen for the click event
|
@@ -730,23 +496,24 @@ export declare type UseOnClickOrScrollOutsideOptions = {
|
|
730
496
|
};
|
731
497
|
|
732
498
|
/**
|
499
|
+
* @internal
|
733
500
|
* Utility to perform checks where a click/touch event was made outside a component
|
734
501
|
*/
|
735
502
|
export declare const useOnClickOutside: (options: UseOnClickOrScrollOutsideOptions) => void;
|
736
503
|
|
737
504
|
/**
|
505
|
+
* @internal
|
738
506
|
* Utility to perform checks where a click/touch event was made outside a component
|
739
507
|
*/
|
740
508
|
export declare const useOnScrollOutside: (options: UseOnClickOrScrollOutsideOptions) => void;
|
741
509
|
|
742
|
-
export declare const usePrevious: <ValueType = unknown>(value: ValueType) => ValueType | null;
|
743
|
-
|
744
510
|
/**
|
745
511
|
* @internal
|
746
512
|
*/
|
747
|
-
export declare
|
513
|
+
export declare const usePrevious: <ValueType = unknown>(value: ValueType) => ValueType | null;
|
748
514
|
|
749
515
|
/**
|
516
|
+
* @internal
|
750
517
|
* Helper to manage a browser timeout.
|
751
518
|
* Ensures that the timeout isn't set multiple times at once,
|
752
519
|
* and is cleaned up when the component is unloaded.
|
@@ -755,20 +522,6 @@ export declare function useSSRContext(): SSRContextValue;
|
|
755
522
|
*/
|
756
523
|
export declare function useTimeout(): readonly [(fn: () => void, delay: number) => void, () => void];
|
757
524
|
|
758
|
-
/**
|
759
|
-
* Hook which synchronously executes a callback when the component is about to unmount.
|
760
|
-
*
|
761
|
-
* @param callback - Function to call during unmount.
|
762
|
-
*/
|
763
|
-
export declare const useUnmount: (callback: () => void) => void;
|
764
|
-
|
765
|
-
/**
|
766
|
-
* An array of VIDEO tag properties and events.
|
767
|
-
*
|
768
|
-
* @public
|
769
|
-
*/
|
770
|
-
export declare const videoProperties: Record<string, number>;
|
771
|
-
|
772
525
|
/**
|
773
526
|
* Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
|
774
527
|
* to be a render function that takes those props.
|