@fluentui/react-utilities 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10
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 +355 -9
- package/CHANGELOG.md +185 -70
- package/dist/index.d.ts +517 -0
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/compose/getSlots.js +21 -30
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js +0 -1
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/resolveShorthand.js +13 -12
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -5
- package/lib/compose/types.js.map +1 -1
- package/lib/hooks/index.js +2 -6
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +26 -26
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +6 -12
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -3
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +9 -5
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedEventCallbacks.js +26 -0
- package/lib/hooks/useMergedEventCallbacks.js.map +1 -0
- package/lib/hooks/useMergedRefs.js +5 -13
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +30 -36
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +13 -15
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +3 -3
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useTimeout.js +13 -18
- 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 +9 -15
- 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.js +24 -4
- package/lib/utils/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/utils/clamp.js +1 -3
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +28 -4
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +1 -1
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +26 -0
- package/lib/utils/getReactCallbackName.js.map +1 -0
- package/lib/utils/getTriggerChild.js +26 -0
- package/lib/utils/getTriggerChild.js.map +1 -0
- package/lib/utils/index.js +2 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isFluentTrigger.js +8 -0
- package/lib/utils/isFluentTrigger.js.map +1 -0
- package/lib/utils/omit.js +2 -2
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +72 -49
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/shouldPreventDefaultOnKeyDown.js +8 -4
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +23 -34
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +1 -3
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +14 -14
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +1 -5
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/hooks/index.js +5 -13
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +27 -28
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +8 -14
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +2 -2
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +2 -4
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +11 -7
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedEventCallbacks.js +36 -0
- package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -0
- package/lib-commonjs/hooks/useMergedRefs.js +6 -15
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +32 -38
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +15 -17
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +4 -4
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +14 -20
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +158 -5
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +9 -15
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +1 -1
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js +26 -6
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +1 -3
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +31 -5
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +35 -0
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
- package/lib-commonjs/utils/getTriggerChild.js +37 -0
- package/lib-commonjs/utils/getTriggerChild.js.map +1 -0
- package/lib-commonjs/utils/index.js +5 -3
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isFluentTrigger.js +17 -0
- package/lib-commonjs/utils/isFluentTrigger.js.map +1 -0
- package/lib-commonjs/utils/omit.js +2 -2
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +70 -47
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +9 -5
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/package.json +14 -17
- package/dist/react-utilities.d.ts +0 -648
- package/lib/compose/getSlots.d.ts +0 -29
- package/lib/compose/index.d.ts +0 -4
- package/lib/compose/nullRender.d.ts +0 -4
- package/lib/compose/nullRender.js +0 -7
- package/lib/compose/nullRender.js.map +0 -1
- package/lib/compose/resolveShorthand.d.ts +0 -12
- package/lib/compose/types.d.ts +0 -104
- package/lib/hooks/index.d.ts +0 -16
- package/lib/hooks/useBoolean.d.ts +0 -17
- package/lib/hooks/useBoolean.js +0 -39
- package/lib/hooks/useBoolean.js.map +0 -1
- package/lib/hooks/useConst.d.ts +0 -12
- package/lib/hooks/useConst.js +0 -30
- package/lib/hooks/useConst.js.map +0 -1
- package/lib/hooks/useControllableState.d.ts +0 -21
- package/lib/hooks/useControllableValue.d.ts +0 -20
- package/lib/hooks/useControllableValue.js +0 -62
- package/lib/hooks/useControllableValue.js.map +0 -1
- package/lib/hooks/useEventCallback.d.ts +0 -13
- package/lib/hooks/useFirstMount.d.ts +0 -11
- package/lib/hooks/useForceUpdate.d.ts +0 -4
- package/lib/hooks/useId.d.ts +0 -15
- package/lib/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
- package/lib/hooks/useMergedRefs.d.ts +0 -13
- package/lib/hooks/useMount.d.ts +0 -6
- package/lib/hooks/useMount.js +0 -17
- package/lib/hooks/useMount.js.map +0 -1
- package/lib/hooks/useOnClickOutside.d.ts +0 -29
- package/lib/hooks/useOnScrollOutside.d.ts +0 -5
- package/lib/hooks/usePrevious.d.ts +0 -1
- package/lib/hooks/useTimeout.d.ts +0 -8
- package/lib/hooks/useUnmount.d.ts +0 -6
- package/lib/hooks/useUnmount.js +0 -19
- package/lib/hooks/useUnmount.js.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/ssr/SSRContext.d.ts +0 -33
- package/lib/ssr/canUseDOM.d.ts +0 -4
- package/lib/ssr/index.d.ts +0 -2
- package/lib/utils/applyTriggerPropsToChildren.d.ts +0 -5
- package/lib/utils/clamp.d.ts +0 -8
- package/lib/utils/getNativeElementProps.d.ts +0 -9
- package/lib/utils/getRTLSafeKey.d.ts +0 -4
- package/lib/utils/index.d.ts +0 -8
- package/lib/utils/omit.d.ts +0 -14
- 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/utils/properties.d.ts +0 -148
- package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
- package/lib-commonjs/compose/getSlots.d.ts +0 -29
- package/lib-commonjs/compose/index.d.ts +0 -4
- package/lib-commonjs/compose/nullRender.d.ts +0 -4
- package/lib-commonjs/compose/nullRender.js +0 -16
- package/lib-commonjs/compose/nullRender.js.map +0 -1
- package/lib-commonjs/compose/resolveShorthand.d.ts +0 -12
- package/lib-commonjs/compose/types.d.ts +0 -104
- package/lib-commonjs/hooks/index.d.ts +0 -16
- package/lib-commonjs/hooks/useBoolean.d.ts +0 -17
- package/lib-commonjs/hooks/useBoolean.js +0 -50
- package/lib-commonjs/hooks/useBoolean.js.map +0 -1
- package/lib-commonjs/hooks/useConst.d.ts +0 -12
- package/lib-commonjs/hooks/useConst.js +0 -40
- package/lib-commonjs/hooks/useConst.js.map +0 -1
- package/lib-commonjs/hooks/useControllableState.d.ts +0 -21
- package/lib-commonjs/hooks/useControllableValue.d.ts +0 -20
- package/lib-commonjs/hooks/useControllableValue.js +0 -73
- package/lib-commonjs/hooks/useControllableValue.js.map +0 -1
- package/lib-commonjs/hooks/useEventCallback.d.ts +0 -13
- package/lib-commonjs/hooks/useFirstMount.d.ts +0 -11
- package/lib-commonjs/hooks/useForceUpdate.d.ts +0 -4
- package/lib-commonjs/hooks/useId.d.ts +0 -15
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
- package/lib-commonjs/hooks/useMergedRefs.d.ts +0 -13
- package/lib-commonjs/hooks/useMount.d.ts +0 -6
- package/lib-commonjs/hooks/useMount.js +0 -27
- package/lib-commonjs/hooks/useMount.js.map +0 -1
- package/lib-commonjs/hooks/useOnClickOutside.d.ts +0 -29
- package/lib-commonjs/hooks/useOnScrollOutside.d.ts +0 -5
- package/lib-commonjs/hooks/usePrevious.d.ts +0 -1
- package/lib-commonjs/hooks/useTimeout.d.ts +0 -8
- package/lib-commonjs/hooks/useUnmount.d.ts +0 -6
- package/lib-commonjs/hooks/useUnmount.js +0 -29
- package/lib-commonjs/hooks/useUnmount.js.map +0 -1
- package/lib-commonjs/index.d.ts +0 -4
- package/lib-commonjs/ssr/SSRContext.d.ts +0 -33
- package/lib-commonjs/ssr/canUseDOM.d.ts +0 -4
- package/lib-commonjs/ssr/index.d.ts +0 -2
- package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +0 -5
- package/lib-commonjs/utils/clamp.d.ts +0 -8
- package/lib-commonjs/utils/getNativeElementProps.d.ts +0 -9
- package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
- package/lib-commonjs/utils/index.d.ts +0 -8
- package/lib-commonjs/utils/omit.d.ts +0 -14
- 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/lib-commonjs/utils/properties.d.ts +0 -148
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
@@ -1,648 +0,0 @@
|
|
1
|
-
import { DispatchWithoutAction } from 'react';
|
2
|
-
import * as React_2 from 'react';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* An array of A tag properties and events.
|
6
|
-
*
|
7
|
-
* @public
|
8
|
-
*/
|
9
|
-
export declare const anchorProperties: Record<string, number>;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
|
13
|
-
*/
|
14
|
-
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, 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>)> | ((props: TTriggerProps) => React_2.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactNode;
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Helper type for inferring the type of the as prop from a Props type.
|
18
|
-
*
|
19
|
-
* For example:
|
20
|
-
* ```
|
21
|
-
* type Example<T> = T extends AsIntrinsicElement<infer As> ? As : never;
|
22
|
-
* ```
|
23
|
-
*/
|
24
|
-
export declare type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> = {
|
25
|
-
as?: As;
|
26
|
-
};
|
27
|
-
|
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
|
-
/**
|
57
|
-
* Verifies if an application can use DOM.
|
58
|
-
*/
|
59
|
-
export declare function canUseDOM(): boolean;
|
60
|
-
|
61
|
-
export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React_2.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Clamps `value` to a number between the min and max.
|
65
|
-
*
|
66
|
-
* @param value - the value to be clamped
|
67
|
-
* @param min - the lowest valid value
|
68
|
-
* @param max - the highest valid value
|
69
|
-
*/
|
70
|
-
export declare const clamp: (value: number, min: number, max: number) => number;
|
71
|
-
|
72
|
-
export declare const colGroupProperties: Record<string, number>;
|
73
|
-
|
74
|
-
export declare const colProperties: Record<string, number>;
|
75
|
-
|
76
|
-
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
|
77
|
-
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
|
78
|
-
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
|
79
|
-
|
80
|
-
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
|
81
|
-
components?: {
|
82
|
-
[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);
|
83
|
-
};
|
84
|
-
} & Shorthands;
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Matches any shorthand props type.
|
88
|
-
*
|
89
|
-
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
|
90
|
-
* it shouldn't be used as the type of a slot.
|
91
|
-
*/
|
92
|
-
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
|
93
|
-
children?: React_2.ReactNode;
|
94
|
-
as?: keyof JSX.IntrinsicElements;
|
95
|
-
}>;
|
96
|
-
|
97
|
-
/**
|
98
|
-
* Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
|
99
|
-
*
|
100
|
-
* @internal
|
101
|
-
*/
|
102
|
-
export declare const defaultSSRContextValue: SSRContextValue;
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Default value can be a value or an initializer
|
106
|
-
*/
|
107
|
-
declare type DefaultValue<TValue> = TValue | (() => TValue);
|
108
|
-
|
109
|
-
/**
|
110
|
-
* An array of DIV tag properties and events.
|
111
|
-
*
|
112
|
-
* @public
|
113
|
-
*/
|
114
|
-
export declare const divProperties: Record<string, number>;
|
115
|
-
|
116
|
-
/**
|
117
|
-
* An array of FORM tag properties and events.
|
118
|
-
*
|
119
|
-
* @public
|
120
|
-
*/
|
121
|
-
export declare const formProperties: Record<string, number>;
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Return type for `React.forwardRef`, including inference of the proper typing for the ref.
|
125
|
-
*/
|
126
|
-
export declare type ForwardRefComponent<Props> = ObscureEventName extends keyof Props ? Required<Props>[ObscureEventName] extends React_2.PointerEventHandler<infer Element> ? React_2.ForwardRefExoticComponent<Props & React_2.RefAttributes<Element>> : never : never;
|
127
|
-
|
128
|
-
/**
|
129
|
-
* Given an element tagname and user props, filters the props to only allowed props for the given
|
130
|
-
* element type.
|
131
|
-
* @param tagName - Tag name (e.g. "div")
|
132
|
-
* @param props - Props object
|
133
|
-
* @param excludedPropNames - List of props to disallow
|
134
|
-
*/
|
135
|
-
export declare function getNativeElementProps<TAttributes extends React_2.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Gets native supported props for an html element provided the allowance set. Use one of the property
|
139
|
-
* sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
|
140
|
-
* props set. Note that all data- and aria- prefixed attributes will be allowed.
|
141
|
-
* NOTE: getNativeProps should always be applied first when adding props to a react component. The
|
142
|
-
* non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
|
143
|
-
* For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
|
144
|
-
* the component after an onClick function is added, then the getNativeProps onClick will override it.
|
145
|
-
*
|
146
|
-
* @public
|
147
|
-
* @param props - The unfiltered input props
|
148
|
-
* @param allowedPropsNames - The array or record of allowed prop names.
|
149
|
-
* @returns The filtered props
|
150
|
-
*/
|
151
|
-
export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
|
152
|
-
|
153
|
-
/**
|
154
|
-
* Finds and swaps a provided key for it's right to left format.
|
155
|
-
*/
|
156
|
-
export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
|
157
|
-
|
158
|
-
/**
|
159
|
-
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
160
|
-
* collections.
|
161
|
-
*
|
162
|
-
* The root is derived from a mix of `components` props and `as` prop.
|
163
|
-
*
|
164
|
-
* Slots will render as null if they are rendered as primitives with undefined children.
|
165
|
-
*
|
166
|
-
* The slotProps will always omit the `as` prop within them, and for slots that are string
|
167
|
-
* primitives, the props will be filtered according the the slot type. For example, if the
|
168
|
-
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
|
169
|
-
*
|
170
|
-
* @param state - State including slot definitions
|
171
|
-
* @param slotNames - Name of which props are slots
|
172
|
-
* @returns An object containing the `slots` map and `slotProps` map.
|
173
|
-
*/
|
174
|
-
export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
|
175
|
-
slots: Slots<R>;
|
176
|
-
slotProps: SlotProps<R>;
|
177
|
-
};
|
178
|
-
|
179
|
-
/**
|
180
|
-
* An array of HTML element properties and events.
|
181
|
-
*
|
182
|
-
* @public
|
183
|
-
*/
|
184
|
-
export declare const htmlElementProperties: Record<string, number>;
|
185
|
-
|
186
|
-
/**
|
187
|
-
* An array of IFRAME tag properties and events.
|
188
|
-
*
|
189
|
-
* @public
|
190
|
-
*/
|
191
|
-
export declare const iframeProperties: Record<string, number>;
|
192
|
-
|
193
|
-
/**
|
194
|
-
* @deprecated Use imgProperties for img elements.
|
195
|
-
*/
|
196
|
-
export declare const imageProperties: Record<string, number>;
|
197
|
-
|
198
|
-
/**
|
199
|
-
* An array of IMAGE tag properties and events.
|
200
|
-
*
|
201
|
-
* @public
|
202
|
-
*/
|
203
|
-
export declare const imgProperties: Record<string, number>;
|
204
|
-
|
205
|
-
/**
|
206
|
-
* An array of INPUT tag properties and events.
|
207
|
-
*
|
208
|
-
* @public
|
209
|
-
*/
|
210
|
-
export declare const inputProperties: Record<string, number>;
|
211
|
-
|
212
|
-
/**
|
213
|
-
* Define the slot arguments for a slot that supports one or more intrinsic element types, such as 'div'.
|
214
|
-
* For slots that support custom components, use {@link ObjectShorthandProps} instead.
|
215
|
-
*
|
216
|
-
* The first param is the slot's default type if no `as` prop is specified.
|
217
|
-
* The second param is an optional union of alternative types that can be specified for the `as` prop.
|
218
|
-
*
|
219
|
-
* ```
|
220
|
-
* IntrinsicShorthandProps<'div'> // Slot is always div
|
221
|
-
* IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
|
222
|
-
* IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
|
223
|
-
* ```
|
224
|
-
*/
|
225
|
-
export declare type IntrinsicShorthandProps<DefaultAs extends keyof JSX.IntrinsicElements, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<DefaultAs> extends false ? 'Error: first parameter to IntrinsicShorthandProps must be a single element type, not a union of types' : ({
|
226
|
-
as?: DefaultAs;
|
227
|
-
} & ObjectShorthandProps<React_2.PropsWithRef<JSX.IntrinsicElements[DefaultAs]>>) | {
|
228
|
-
[As in AlternateAs]: {
|
229
|
-
as: As;
|
230
|
-
} & ObjectShorthandProps<React_2.PropsWithRef<JSX.IntrinsicElements[As]>>;
|
231
|
-
}[AlternateAs];
|
232
|
-
|
233
|
-
/**
|
234
|
-
* Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.
|
235
|
-
*
|
236
|
-
* ```
|
237
|
-
* IsSingleton<'a'> // true
|
238
|
-
* IsSingleton<'a' | 'b' | 'c'> // false
|
239
|
-
* ```
|
240
|
-
*/
|
241
|
-
export declare type IsSingleton<T extends string> = {
|
242
|
-
[K in T]: Exclude<T, K> extends never ? true : false;
|
243
|
-
}[T];
|
244
|
-
|
245
|
-
/**
|
246
|
-
* An array of LABEL tag properties and events.
|
247
|
-
*
|
248
|
-
* @public
|
249
|
-
*/
|
250
|
-
export declare const labelProperties: Record<string, number>;
|
251
|
-
|
252
|
-
/**
|
253
|
-
* An array of LI tag properties and events.
|
254
|
-
*
|
255
|
-
* @public
|
256
|
-
*/
|
257
|
-
export declare const liProperties: Record<string, number>;
|
258
|
-
|
259
|
-
/**
|
260
|
-
* Simple constant function for returning null, used to render empty templates in JSX.
|
261
|
-
*/
|
262
|
-
export declare const nullRender: () => null;
|
263
|
-
|
264
|
-
/**
|
265
|
-
* Defines the slot props for a slot that supports a Component type.
|
266
|
-
*
|
267
|
-
* For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
|
268
|
-
*/
|
269
|
-
export declare type ObjectShorthandProps<Props extends {
|
270
|
-
children?: React_2.ReactNode;
|
271
|
-
} = {}> = Props & {
|
272
|
-
children?: Props['children'] | ShorthandRenderFunction<Props>;
|
273
|
-
};
|
274
|
-
|
275
|
-
export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
|
276
|
-
|
277
|
-
/**
|
278
|
-
* This is part of a hack to infer the element type from a native element *props* type.
|
279
|
-
* The only place the original element is found in a native props type (at least that's workable
|
280
|
-
* for inference) is in the event handlers, so some of the helper types use this event handler
|
281
|
-
* name to infer the original element type.
|
282
|
-
*
|
283
|
-
* Notes:
|
284
|
-
* - Using an extremely obscure event handler reduces the likelihood that its signature will be
|
285
|
-
* modified in any component's props.
|
286
|
-
* - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be
|
287
|
-
* less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.
|
288
|
-
*/
|
289
|
-
declare type ObscureEventName = 'onLostPointerCaptureCapture';
|
290
|
-
|
291
|
-
/**
|
292
|
-
* An array of OL tag properties and events.
|
293
|
-
*
|
294
|
-
* @public
|
295
|
-
*/
|
296
|
-
export declare const olProperties: Record<string, number>;
|
297
|
-
|
298
|
-
/**
|
299
|
-
* Tiny helper to do the minimal amount of work in duplicating an object but omitting some
|
300
|
-
* props. This ends up faster than using object ...rest or reduce to filter.
|
301
|
-
*
|
302
|
-
* This behaves very much like filteredAssign, but does not merge many objects together,
|
303
|
-
* uses an exclusion object map, and avoids spreads all for optimal performance.
|
304
|
-
*
|
305
|
-
* See perf test for background:
|
306
|
-
* https://jsperf.com/omit-vs-rest-vs-reduce/1
|
307
|
-
*
|
308
|
-
* @param obj - The object to clone
|
309
|
-
* @param exclusions - The array of keys to exclude
|
310
|
-
*/
|
311
|
-
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
|
312
|
-
|
313
|
-
/**
|
314
|
-
* Similar to React.Children.only, but drills into fragments rather than treating them as a single child
|
315
|
-
*/
|
316
|
-
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>)>;
|
317
|
-
|
318
|
-
export declare const optionProperties: Record<string, number>;
|
319
|
-
|
320
|
-
/**
|
321
|
-
* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
|
322
|
-
* IntrinsicShorthandProps). This allows IntrinsicShorthandProps to be used with React.forwardRef.
|
323
|
-
*
|
324
|
-
* The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional
|
325
|
-
* types, to prevent unions from being expanded.
|
326
|
-
*/
|
327
|
-
export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
|
328
|
-
|
329
|
-
/**
|
330
|
-
* A Ref function which can be treated like a ref object in that it has an attached
|
331
|
-
* current property, which will be updated as the ref is evaluated.
|
332
|
-
*/
|
333
|
-
export declare type RefObjectFunction<T> = React_2.RefObject<T> & ((value: T) => void);
|
334
|
-
|
335
|
-
/**
|
336
|
-
* Resets generated IDs, should be used only in tests.
|
337
|
-
*
|
338
|
-
* @private
|
339
|
-
*/
|
340
|
-
export declare function resetIdsForTests(): void;
|
341
|
-
|
342
|
-
/**
|
343
|
-
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
|
344
|
-
* being passed down to getSlots method
|
345
|
-
* @param value - the base ShorthandProps
|
346
|
-
* @param options - options to resolve ShorthandProps
|
347
|
-
*/
|
348
|
-
export declare function resolveShorthand<Props extends DefaultObjectShorthandProps, Required extends boolean = false>(value: ShorthandProps<Props>, options?: ResolveShorthandOptions<Props, Required>): Required extends false ? Props | undefined : Props;
|
349
|
-
|
350
|
-
export declare type ResolveShorthandOptions<Props extends Record<string, any>, Required extends boolean = false> = {
|
351
|
-
required?: Required;
|
352
|
-
defaultProps?: Props;
|
353
|
-
};
|
354
|
-
|
355
|
-
/**
|
356
|
-
* An array of SELECT tag properties and events.
|
357
|
-
*
|
358
|
-
* @public
|
359
|
-
*/
|
360
|
-
export declare const selectProperties: Record<string, number>;
|
361
|
-
|
362
|
-
export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | Props;
|
363
|
-
|
364
|
-
export declare type ShorthandRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React_2.ReactNode;
|
365
|
-
|
366
|
-
/**
|
367
|
-
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
368
|
-
*
|
369
|
-
* Useful for situations where a keydown needs to be transformed to a click event
|
370
|
-
*/
|
371
|
-
export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React_2.KeyboardEvent): boolean;
|
372
|
-
|
373
|
-
declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
|
374
|
-
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
|
375
|
-
};
|
376
|
-
|
377
|
-
export declare type Slots<S extends ObjectShorthandPropsRecord> = {
|
378
|
-
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<NonNullable<S[K]>>;
|
379
|
-
};
|
380
|
-
|
381
|
-
export declare const SSRContext: React_2.Context<SSRContextValue>;
|
382
|
-
|
383
|
-
/**
|
384
|
-
* To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request
|
385
|
-
* to ensure the client and server are consistent.
|
386
|
-
*
|
387
|
-
* @internal
|
388
|
-
*/
|
389
|
-
export declare type SSRContextValue = {
|
390
|
-
current: number;
|
391
|
-
};
|
392
|
-
|
393
|
-
/**
|
394
|
-
* When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
|
395
|
-
* are consistent between the client and server.
|
396
|
-
*
|
397
|
-
* @public
|
398
|
-
*/
|
399
|
-
export declare const SSRProvider: React_2.FC;
|
400
|
-
|
401
|
-
/**
|
402
|
-
* An array of TABLE tag properties and events.
|
403
|
-
*
|
404
|
-
* @public
|
405
|
-
*/
|
406
|
-
export declare const tableProperties: Record<string, number>;
|
407
|
-
|
408
|
-
/**
|
409
|
-
* An array of TD tag properties and events.
|
410
|
-
*
|
411
|
-
* @public
|
412
|
-
*/
|
413
|
-
export declare const tdProperties: Record<string, number>;
|
414
|
-
|
415
|
-
/**
|
416
|
-
* An array of TEXTAREA tag properties and events.
|
417
|
-
*
|
418
|
-
* @public
|
419
|
-
*/
|
420
|
-
export declare const textAreaProperties: Record<string, number>;
|
421
|
-
|
422
|
-
/**
|
423
|
-
* An array of TH tag properties and events.
|
424
|
-
*
|
425
|
-
* @public
|
426
|
-
*/
|
427
|
-
export declare const thProperties: Record<string, number>;
|
428
|
-
|
429
|
-
/**
|
430
|
-
* An array of TR tag properties and events.
|
431
|
-
*
|
432
|
-
* @public
|
433
|
-
*/
|
434
|
-
export declare const trProperties: Record<string, number>;
|
435
|
-
|
436
|
-
/**
|
437
|
-
* Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)
|
438
|
-
*/
|
439
|
-
export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
|
440
|
-
|
441
|
-
/**
|
442
|
-
* Hook to store a value and generate callbacks for setting the value to true or false.
|
443
|
-
* The identity of the callbacks will always stay the same.
|
444
|
-
*
|
445
|
-
* @param initialState - Initial value
|
446
|
-
* @returns Array with the current value and an object containing the updater callbacks.
|
447
|
-
*/
|
448
|
-
export declare function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks];
|
449
|
-
|
450
|
-
/** Updater callbacks returned by `useBoolean`. */
|
451
|
-
export declare type UseBooleanCallbacks = {
|
452
|
-
/** Set the value to true. Always has the same identity. */
|
453
|
-
setTrue: () => void;
|
454
|
-
/** Set the value to false. Always has the same identity. */
|
455
|
-
setFalse: () => void;
|
456
|
-
/** Toggle the value. Always has the same identity. */
|
457
|
-
toggle: () => void;
|
458
|
-
};
|
459
|
-
|
460
|
-
/**
|
461
|
-
* Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to
|
462
|
-
* always return the same value (and if the initializer is a function, only call it once).
|
463
|
-
* This is similar to setting a private member in a class constructor.
|
464
|
-
*
|
465
|
-
* If the value should ever change based on dependencies, use `React.useMemo` instead.
|
466
|
-
*
|
467
|
-
* @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,
|
468
|
-
* only the value/function passed in the first time this is called is respected.
|
469
|
-
* @returns The value. The identity of this value will always be the same.
|
470
|
-
*/
|
471
|
-
export declare function useConst<T>(initialValue: T | (() => T)): T;
|
472
|
-
|
473
|
-
/**
|
474
|
-
* A useState 'like' hook that allows optional user control
|
475
|
-
* Useful for components which allow uncontrolled and controlled behaviour for users
|
476
|
-
* @returns - https://reactjs.org/docs/hooks-state.html
|
477
|
-
*/
|
478
|
-
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>];
|
479
|
-
|
480
|
-
export declare type UseControllableStateOptions<State> = {
|
481
|
-
/**
|
482
|
-
* User provided default state or factory initializer
|
483
|
-
*/
|
484
|
-
defaultState?: State | (() => State);
|
485
|
-
/**
|
486
|
-
* User provided controllable state, undefined state means internal state will be used
|
487
|
-
*/
|
488
|
-
state: State | undefined;
|
489
|
-
/**
|
490
|
-
* Used to initialize state if all user provided states are undefined
|
491
|
-
*/
|
492
|
-
initialState: State;
|
493
|
-
};
|
494
|
-
|
495
|
-
/**
|
496
|
-
* Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or
|
497
|
-
* text box string.
|
498
|
-
* @param controlledValue - The controlled value passed in the props. This value will always be used if provided,
|
499
|
-
* and the internal state will be updated to reflect it.
|
500
|
-
* @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.
|
501
|
-
* @returns An array of the current value and an updater callback. Like `React.useState`, the updater
|
502
|
-
* callback always has the same identity, and it can take either a new value, or a function which
|
503
|
-
* is passed the previous value and returns the new value.
|
504
|
-
* @see https://reactjs.org/docs/uncontrolled-components.html
|
505
|
-
*/
|
506
|
-
export declare function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React_2.SetStateAction<TValue>) => void]>;
|
507
|
-
|
508
|
-
export declare function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React_2.SyntheticEvent<TElement> | undefined>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>, onChange: ChangeCallback<TElement, TValue, TEvent>): Readonly<[TValue, (update: React_2.SetStateAction<TValue>, ev?: React_2.FormEvent<TElement>) => void]>;
|
509
|
-
|
510
|
-
/**
|
511
|
-
* https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
|
512
|
-
*
|
513
|
-
* Modified `useCallback` that can be used when dependencies change too frequently. Can occur when
|
514
|
-
* e.g. user props are dependencies which could change on every render
|
515
|
-
* e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently
|
516
|
-
*
|
517
|
-
* This should not be used often, but can be a useful re-render optimization since the callback is a ref and
|
518
|
-
* will not be invalidated between re-renders
|
519
|
-
*
|
520
|
-
* @param fn - The callback function that will be used
|
521
|
-
*/
|
522
|
-
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return;
|
523
|
-
|
524
|
-
/**
|
525
|
-
* Checks if components was mounted the first time.
|
526
|
-
* Since concurrent mode will be released in the future this needs to be verified
|
527
|
-
* Currently (React 17) will always render the initial mount once
|
528
|
-
* https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx
|
529
|
-
* https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx
|
530
|
-
*
|
531
|
-
* @example
|
532
|
-
* const isFirstMount = useFirstMount();
|
533
|
-
*/
|
534
|
-
export declare function useFirstMount(): boolean;
|
535
|
-
|
536
|
-
/**
|
537
|
-
* Forces a re-render, similar to `forceUpdate` in class components.
|
538
|
-
*/
|
539
|
-
export declare function useForceUpdate(): DispatchWithoutAction;
|
540
|
-
|
541
|
-
/**
|
542
|
-
* Hook to generate a unique ID.
|
543
|
-
*
|
544
|
-
* @param prefix - Optional prefix for the ID
|
545
|
-
* @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,
|
546
|
-
* without conditioning the hook call
|
547
|
-
* @returns The ID
|
548
|
-
*/
|
549
|
-
export declare function useId(prefix?: string, providedId?: string): string;
|
550
|
-
|
551
|
-
/**
|
552
|
-
* React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
|
553
|
-
* useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
|
554
|
-
* ensure we don't get a render flash for certain operations, but we may also need affected components to render on
|
555
|
-
* the server.
|
556
|
-
*
|
557
|
-
* https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
558
|
-
* https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js
|
559
|
-
*/
|
560
|
-
export declare const useIsomorphicLayoutEffect: typeof React_2.useEffect;
|
561
|
-
|
562
|
-
/**
|
563
|
-
* Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
|
564
|
-
* browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
|
565
|
-
*/
|
566
|
-
export declare function useIsSSR(): boolean;
|
567
|
-
|
568
|
-
/**
|
569
|
-
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
|
570
|
-
* updates all provided refs
|
571
|
-
* @param refs - Refs to collectively update with one ref value.
|
572
|
-
* @returns A function with an attached "current" prop, so that it can be treated like a RefObject.
|
573
|
-
*/
|
574
|
-
export declare function useMergedRefs<T>(...refs: (React_2.Ref<T> | undefined)[]): RefObjectFunction<T>;
|
575
|
-
|
576
|
-
/**
|
577
|
-
* Hook which asynchronously executes a callback once the component has been mounted.
|
578
|
-
*
|
579
|
-
* @param callback - Function to call before mount.
|
580
|
-
*/
|
581
|
-
export declare const useMount: (callback: () => void) => void;
|
582
|
-
|
583
|
-
export declare type UseOnClickOrScrollOutsideOptions = {
|
584
|
-
/**
|
585
|
-
* The element to listen for the click event
|
586
|
-
*/
|
587
|
-
element: Document | undefined;
|
588
|
-
/**
|
589
|
-
* Refs to elements that check if the click is outside
|
590
|
-
*/
|
591
|
-
refs: React_2.MutableRefObject<HTMLElement | undefined | null>[];
|
592
|
-
/**
|
593
|
-
* By default uses element.contains, but custom contain function can be provided
|
594
|
-
* @param parentRef - provided parent ref
|
595
|
-
* @param child - event target element
|
596
|
-
*/
|
597
|
-
contains?(parent: HTMLElement | null, child: HTMLElement): boolean;
|
598
|
-
/**
|
599
|
-
* Disables event listeners
|
600
|
-
*/
|
601
|
-
disabled?: boolean;
|
602
|
-
/**
|
603
|
-
* Called if the click is outside the element refs
|
604
|
-
*/
|
605
|
-
callback: (ev: MouseEvent | TouchEvent) => void;
|
606
|
-
};
|
607
|
-
|
608
|
-
/**
|
609
|
-
* Utility to perform checks where a click/touch event was made outside a component
|
610
|
-
*/
|
611
|
-
export declare const useOnClickOutside: (options: UseOnClickOrScrollOutsideOptions) => void;
|
612
|
-
|
613
|
-
/**
|
614
|
-
* Utility to perform checks where a click/touch event was made outside a component
|
615
|
-
*/
|
616
|
-
export declare const useOnScrollOutside: (options: UseOnClickOrScrollOutsideOptions) => void;
|
617
|
-
|
618
|
-
export declare const usePrevious: <ValueType = unknown>(value: ValueType) => ValueType | null;
|
619
|
-
|
620
|
-
/**
|
621
|
-
* @internal
|
622
|
-
*/
|
623
|
-
export declare function useSSRContext(): SSRContextValue;
|
624
|
-
|
625
|
-
/**
|
626
|
-
* Helper to manage a browser timeout.
|
627
|
-
* Ensures that the timeout isn't set multiple times at once,
|
628
|
-
* and is cleaned up when the component is unloaded.
|
629
|
-
*
|
630
|
-
* @returns A pair of [setTimeout, clearTimeout] that are stable between renders.
|
631
|
-
*/
|
632
|
-
export declare function useTimeout(): readonly [(fn: () => void, delay: number) => void, () => void];
|
633
|
-
|
634
|
-
/**
|
635
|
-
* Hook which synchronously executes a callback when the component is about to unmount.
|
636
|
-
*
|
637
|
-
* @param callback - Function to call during unmount.
|
638
|
-
*/
|
639
|
-
export declare const useUnmount: (callback: () => void) => void;
|
640
|
-
|
641
|
-
/**
|
642
|
-
* An array of VIDEO tag properties and events.
|
643
|
-
*
|
644
|
-
* @public
|
645
|
-
*/
|
646
|
-
export declare const videoProperties: Record<string, number>;
|
647
|
-
|
648
|
-
export { }
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { AsIntrinsicElement, ComponentState, ObjectShorthandPropsRecord, ObjectShorthandProps, UnionToIntersection } from './types';
|
3
|
-
export declare type Slots<S extends ObjectShorthandPropsRecord> = {
|
4
|
-
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<NonNullable<S[K]>>;
|
5
|
-
};
|
6
|
-
declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
|
7
|
-
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
|
8
|
-
};
|
9
|
-
/**
|
10
|
-
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
11
|
-
* collections.
|
12
|
-
*
|
13
|
-
* The root is derived from a mix of `components` props and `as` prop.
|
14
|
-
*
|
15
|
-
* Slots will render as null if they are rendered as primitives with undefined children.
|
16
|
-
*
|
17
|
-
* The slotProps will always omit the `as` prop within them, and for slots that are string
|
18
|
-
* primitives, the props will be filtered according the the slot type. For example, if the
|
19
|
-
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
|
20
|
-
*
|
21
|
-
* @param state - State including slot definitions
|
22
|
-
* @param slotNames - Name of which props are slots
|
23
|
-
* @returns An object containing the `slots` map and `slotProps` map.
|
24
|
-
*/
|
25
|
-
export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
|
26
|
-
slots: Slots<R>;
|
27
|
-
slotProps: SlotProps<R>;
|
28
|
-
};
|
29
|
-
export {};
|
package/lib/compose/index.d.ts
DELETED