@fluentui/react-utilities 0.0.0-nightlyff78d1e27a20220217.1 → 0.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.
Files changed (215) hide show
  1. package/CHANGELOG.json +232 -7
  2. package/CHANGELOG.md +159 -73
  3. package/dist/{react-utilities.d.ts → index.d.ts} +39 -272
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/resolveShorthand.js.map +1 -1
  7. package/lib/compose/types.js +1 -5
  8. package/lib/compose/types.js.map +1 -1
  9. package/lib/hooks/index.js +1 -5
  10. package/lib/hooks/index.js.map +1 -1
  11. package/lib/hooks/useControllableState.js +3 -2
  12. package/lib/hooks/useControllableState.js.map +1 -1
  13. package/lib/hooks/useEventCallback.js +1 -0
  14. package/lib/hooks/useEventCallback.js.map +1 -1
  15. package/lib/hooks/useFirstMount.js +1 -0
  16. package/lib/hooks/useFirstMount.js.map +1 -1
  17. package/lib/hooks/useForceUpdate.js +1 -0
  18. package/lib/hooks/useForceUpdate.js.map +1 -1
  19. package/lib/hooks/useId.js +9 -5
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -0
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedEventCallbacks.js +1 -0
  24. package/lib/hooks/useMergedEventCallbacks.js.map +1 -1
  25. package/lib/hooks/useMergedRefs.js +1 -0
  26. package/lib/hooks/useMergedRefs.js.map +1 -1
  27. package/lib/hooks/useOnClickOutside.js +2 -1
  28. package/lib/hooks/useOnClickOutside.js.map +1 -1
  29. package/lib/hooks/useOnScrollOutside.js +1 -0
  30. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  31. package/lib/hooks/usePrevious.js +4 -0
  32. package/lib/hooks/usePrevious.js.map +1 -1
  33. package/lib/hooks/useTimeout.js +2 -2
  34. package/lib/hooks/useTimeout.js.map +1 -1
  35. package/lib/index.js +5 -4
  36. package/lib/index.js.map +1 -1
  37. package/lib/ssr/SSRContext.js.map +1 -1
  38. package/lib/ssr/canUseDOM.js.map +1 -1
  39. package/lib/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  40. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -0
  41. package/lib/{utils → trigger}/getTriggerChild.js +2 -0
  42. package/lib/trigger/getTriggerChild.js.map +1 -0
  43. package/lib/trigger/index.js +5 -0
  44. package/lib/trigger/index.js.map +1 -0
  45. package/lib/{utils → trigger}/isFluentTrigger.js +0 -0
  46. package/lib/trigger/isFluentTrigger.js.map +1 -0
  47. package/lib/trigger/types.js +2 -0
  48. package/lib/trigger/types.js.map +1 -0
  49. package/lib/utils/clamp.js +1 -0
  50. package/lib/utils/clamp.js.map +1 -1
  51. package/lib/utils/getNativeElementProps.js +4 -2
  52. package/lib/utils/getNativeElementProps.js.map +1 -1
  53. package/lib/utils/getRTLSafeKey.js +1 -0
  54. package/lib/utils/getRTLSafeKey.js.map +1 -1
  55. package/lib/utils/getReactCallbackName.js.map +1 -1
  56. package/lib/utils/index.js +0 -3
  57. package/lib/utils/index.js.map +1 -1
  58. package/lib/utils/omit.js.map +1 -1
  59. package/lib/utils/properties.js +18 -6
  60. package/lib/utils/properties.js.map +1 -1
  61. package/lib/utils/shouldPreventDefaultOnKeyDown.js +5 -0
  62. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  65. package/lib-commonjs/compose/types.js +1 -5
  66. package/lib-commonjs/compose/types.js.map +1 -1
  67. package/lib-commonjs/hooks/index.js +2 -10
  68. package/lib-commonjs/hooks/index.js.map +1 -1
  69. package/lib-commonjs/hooks/useControllableState.js +3 -3
  70. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  71. package/lib-commonjs/hooks/useEventCallback.js +1 -0
  72. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  73. package/lib-commonjs/hooks/useFirstMount.js +1 -0
  74. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  75. package/lib-commonjs/hooks/useForceUpdate.js +1 -0
  76. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  77. package/lib-commonjs/hooks/useId.js +9 -5
  78. package/lib-commonjs/hooks/useId.js.map +1 -1
  79. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -0
  80. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  81. package/lib-commonjs/hooks/useMergedEventCallbacks.js +1 -0
  82. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -1
  83. package/lib-commonjs/hooks/useMergedRefs.js +1 -0
  84. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  85. package/lib-commonjs/hooks/useOnClickOutside.js +2 -1
  86. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  87. package/lib-commonjs/hooks/useOnScrollOutside.js +1 -0
  88. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  89. package/lib-commonjs/hooks/usePrevious.js +4 -0
  90. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  91. package/lib-commonjs/hooks/useTimeout.js +2 -3
  92. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  93. package/lib-commonjs/index.js +161 -5
  94. package/lib-commonjs/index.js.map +1 -1
  95. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  96. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  97. package/lib-commonjs/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  98. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -0
  99. package/lib-commonjs/{utils → trigger}/getTriggerChild.js +2 -0
  100. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -0
  101. package/lib-commonjs/trigger/index.js +16 -0
  102. package/lib-commonjs/trigger/index.js.map +1 -0
  103. package/lib-commonjs/{utils → trigger}/isFluentTrigger.js +0 -0
  104. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -0
  105. package/lib-commonjs/trigger/types.js +6 -0
  106. package/lib-commonjs/trigger/types.js.map +1 -0
  107. package/lib-commonjs/utils/clamp.js +1 -0
  108. package/lib-commonjs/utils/clamp.js.map +1 -1
  109. package/lib-commonjs/utils/getNativeElementProps.js +3 -1
  110. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  111. package/lib-commonjs/utils/getRTLSafeKey.js +1 -0
  112. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  113. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  114. package/lib-commonjs/utils/index.js +0 -6
  115. package/lib-commonjs/utils/index.js.map +1 -1
  116. package/lib-commonjs/utils/omit.js.map +1 -1
  117. package/lib-commonjs/utils/properties.js +19 -7
  118. package/lib-commonjs/utils/properties.js.map +1 -1
  119. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +5 -0
  120. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  121. package/package.json +13 -13
  122. package/lib/compose/getSlots.d.ts +0 -30
  123. package/lib/compose/index.d.ts +0 -3
  124. package/lib/compose/resolveShorthand.d.ts +0 -16
  125. package/lib/compose/types.d.ts +0 -155
  126. package/lib/hooks/index.d.ts +0 -16
  127. package/lib/hooks/useBoolean.d.ts +0 -17
  128. package/lib/hooks/useBoolean.js +0 -28
  129. package/lib/hooks/useBoolean.js.map +0 -1
  130. package/lib/hooks/useConst.d.ts +0 -12
  131. package/lib/hooks/useConst.js +0 -30
  132. package/lib/hooks/useConst.js.map +0 -1
  133. package/lib/hooks/useControllableState.d.ts +0 -31
  134. package/lib/hooks/useEventCallback.d.ts +0 -13
  135. package/lib/hooks/useFirstMount.d.ts +0 -11
  136. package/lib/hooks/useForceUpdate.d.ts +0 -4
  137. package/lib/hooks/useId.d.ts +0 -15
  138. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  139. package/lib/hooks/useMergedEventCallbacks.d.ts +0 -18
  140. package/lib/hooks/useMergedRefs.d.ts +0 -13
  141. package/lib/hooks/useMount.d.ts +0 -6
  142. package/lib/hooks/useMount.js +0 -17
  143. package/lib/hooks/useMount.js.map +0 -1
  144. package/lib/hooks/useOnClickOutside.d.ts +0 -29
  145. package/lib/hooks/useOnScrollOutside.d.ts +0 -5
  146. package/lib/hooks/usePrevious.d.ts +0 -1
  147. package/lib/hooks/useTimeout.d.ts +0 -8
  148. package/lib/hooks/useUnmount.d.ts +0 -6
  149. package/lib/hooks/useUnmount.js +0 -17
  150. package/lib/hooks/useUnmount.js.map +0 -1
  151. package/lib/index.d.ts +0 -4
  152. package/lib/ssr/SSRContext.d.ts +0 -33
  153. package/lib/ssr/canUseDOM.d.ts +0 -4
  154. package/lib/ssr/index.d.ts +0 -2
  155. package/lib/utils/applyTriggerPropsToChildren.d.ts +0 -5
  156. package/lib/utils/applyTriggerPropsToChildren.js.map +0 -1
  157. package/lib/utils/clamp.d.ts +0 -8
  158. package/lib/utils/getNativeElementProps.d.ts +0 -31
  159. package/lib/utils/getRTLSafeKey.d.ts +0 -4
  160. package/lib/utils/getReactCallbackName.d.ts +0 -25
  161. package/lib/utils/getTriggerChild.d.ts +0 -22
  162. package/lib/utils/getTriggerChild.js.map +0 -1
  163. package/lib/utils/index.d.ts +0 -9
  164. package/lib/utils/isFluentTrigger.d.ts +0 -22
  165. package/lib/utils/isFluentTrigger.js.map +0 -1
  166. package/lib/utils/omit.d.ts +0 -14
  167. package/lib/utils/properties.d.ts +0 -148
  168. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
  169. package/lib-commonjs/compose/getSlots.d.ts +0 -30
  170. package/lib-commonjs/compose/index.d.ts +0 -3
  171. package/lib-commonjs/compose/resolveShorthand.d.ts +0 -16
  172. package/lib-commonjs/compose/types.d.ts +0 -155
  173. package/lib-commonjs/hooks/index.d.ts +0 -16
  174. package/lib-commonjs/hooks/useBoolean.d.ts +0 -17
  175. package/lib-commonjs/hooks/useBoolean.js +0 -39
  176. package/lib-commonjs/hooks/useBoolean.js.map +0 -1
  177. package/lib-commonjs/hooks/useConst.d.ts +0 -12
  178. package/lib-commonjs/hooks/useConst.js +0 -40
  179. package/lib-commonjs/hooks/useConst.js.map +0 -1
  180. package/lib-commonjs/hooks/useControllableState.d.ts +0 -31
  181. package/lib-commonjs/hooks/useEventCallback.d.ts +0 -13
  182. package/lib-commonjs/hooks/useFirstMount.d.ts +0 -11
  183. package/lib-commonjs/hooks/useForceUpdate.d.ts +0 -4
  184. package/lib-commonjs/hooks/useId.d.ts +0 -15
  185. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  186. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +0 -18
  187. package/lib-commonjs/hooks/useMergedRefs.d.ts +0 -13
  188. package/lib-commonjs/hooks/useMount.d.ts +0 -6
  189. package/lib-commonjs/hooks/useMount.js +0 -27
  190. package/lib-commonjs/hooks/useMount.js.map +0 -1
  191. package/lib-commonjs/hooks/useOnClickOutside.d.ts +0 -29
  192. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +0 -5
  193. package/lib-commonjs/hooks/usePrevious.d.ts +0 -1
  194. package/lib-commonjs/hooks/useTimeout.d.ts +0 -8
  195. package/lib-commonjs/hooks/useUnmount.d.ts +0 -6
  196. package/lib-commonjs/hooks/useUnmount.js +0 -27
  197. package/lib-commonjs/hooks/useUnmount.js.map +0 -1
  198. package/lib-commonjs/index.d.ts +0 -4
  199. package/lib-commonjs/ssr/SSRContext.d.ts +0 -33
  200. package/lib-commonjs/ssr/canUseDOM.d.ts +0 -4
  201. package/lib-commonjs/ssr/index.d.ts +0 -2
  202. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +0 -5
  203. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +0 -1
  204. package/lib-commonjs/utils/clamp.d.ts +0 -8
  205. package/lib-commonjs/utils/getNativeElementProps.d.ts +0 -31
  206. package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
  207. package/lib-commonjs/utils/getReactCallbackName.d.ts +0 -25
  208. package/lib-commonjs/utils/getTriggerChild.d.ts +0 -22
  209. package/lib-commonjs/utils/getTriggerChild.js.map +0 -1
  210. package/lib-commonjs/utils/index.d.ts +0 -9
  211. package/lib-commonjs/utils/isFluentTrigger.d.ts +0 -22
  212. package/lib-commonjs/utils/isFluentTrigger.js.map +0 -1
  213. package/lib-commonjs/utils/omit.d.ts +0 -14
  214. package/lib-commonjs/utils/properties.d.ts +0 -148
  215. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
@@ -1,31 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * Given an element tagname and user props, filters the props to only allowed props for the given
4
- * element type.
5
- * @param tagName - Tag name (e.g. "div")
6
- * @param props - Props object
7
- * @param excludedPropNames - List of props to disallow
8
- */
9
- export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
10
- /**
11
- * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
12
- *
13
- * This function is only for use with components that have a primary slot other than `root`.
14
- * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
15
- *
16
- * @returns An object containing the native props for the `root` and primary slots.
17
- */
18
- export declare const getPartitionedNativeProps: <Props extends Pick<React.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
19
- /** The primary slot's element type (e.g. 'div') */
20
- primarySlotTagName: keyof JSX.IntrinsicElements;
21
- /** The component's props object */
22
- props: Props;
23
- /** List of native props to exclude from the returned value */
24
- excludedPropNames?: ExcludedPropKeys[] | undefined;
25
- }) => {
26
- root: {
27
- style: React.CSSProperties | undefined;
28
- className: string | undefined;
29
- };
30
- primary: Omit<Props, ExcludedPropKeys>;
31
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * Finds and swaps a provided key for it's right to left format.
3
- */
4
- export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
@@ -1,25 +0,0 @@
1
- import * as React from 'react';
2
- interface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {
3
- _reactName?: string;
4
- dispatchConfig?: {
5
- registrationName: string;
6
- phasedRegistrationNames: {
7
- bubbled: string;
8
- captured: string;
9
- };
10
- };
11
- }
12
- declare type NonUndefined<A> = A extends undefined ? never : A;
13
- declare type FunctionKeys<T extends object> = {
14
- [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;
15
- }[keyof T];
16
- export declare type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;
17
- /**
18
- * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
19
- *
20
- * Ideally, it should also distinguish regular and "capture" callbacks, but it's possible only with React 17 as
21
- * ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
22
- * are handled in bubble phase.
23
- */
24
- export declare function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined;
25
- export {};
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
4
- *
5
- * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
6
- * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
7
- * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
8
- *
9
- * For example, the following returns `<div id="child" />`:
10
- * ```jsx
11
- * getTriggerChild(
12
- * <Tooltip>
13
- * <MenuTrigger>
14
- * <div id="child" />
15
- * </MenuTrigger>
16
- * </Tooltip>
17
- * );
18
- * ```
19
- */
20
- export declare const getTriggerChild: (children: React.ReactNode) => React.ReactElement & {
21
- ref?: React.Ref<unknown>;
22
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/getTriggerChild.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;;;;;;;;;;;;;AAiBG;;;AACI,MAAM,eAAe,GAAI,QAAD,IAAiF;AAC9G,QAAM,KAAK,GAAG,KAAK,CAAC,QAAN,CAAe,IAAf,CAAoB,QAApB,CAAd;AACA,SAAO,iBAAA,CAAA,eAAA,CAAgB,KAAhB,IAAyB,OAAA,CAAA,eAAA,CAAgB,KAAK,CAAC,KAAN,CAAY,QAA5B,CAAzB,GAAiE,KAAxE;AACD,CAHM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n */\nexport const getTriggerChild = (children: React.ReactNode): React.ReactElement & { ref?: React.Ref<unknown> } => {\n const child = React.Children.only(children) as React.ReactElement;\n return isFluentTrigger(child) ? getTriggerChild(child.props.children) : child;\n};\n"],"sourceRoot":"../src/"}
@@ -1,9 +0,0 @@
1
- export * from './applyTriggerPropsToChildren';
2
- export * from './clamp';
3
- export * from './getNativeElementProps';
4
- export * from './getRTLSafeKey';
5
- export * from './getTriggerChild';
6
- export * from './isFluentTrigger';
7
- export * from './omit';
8
- export * from './properties';
9
- export * from './shouldPreventDefaultOnKeyDown';
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * Allows a component to be tagged as a FluentUI trigger component.
4
- *
5
- * Triggers are special-case components: they attach event listeners and other props on their child,
6
- * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.
7
- *
8
- * A component can be tagged as a trigger as follows:
9
- * ```ts
10
- * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;
11
- *
12
- * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true
13
- * ```
14
- */
15
- export declare type FluentTriggerComponent = {
16
- isFluentTriggerComponent?: boolean;
17
- };
18
- /**
19
- * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
20
- * See the {@link FluentTriggerComponent} type for more info.
21
- */
22
- export declare const isFluentTrigger: (element: React.ReactElement) => boolean | undefined;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/isFluentTrigger.ts"],"names":[],"mappings":";;;;;;AAmBA;;;AAGG;;AACI,MAAM,eAAe,GAAI,OAAD,IAAgC;AAC7D,SAAQ,OAAO,CAAC,IAAR,CAAwC,wBAAhD;AACD,CAFM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\n\n/**\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n\n/**\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport const isFluentTrigger = (element: React.ReactElement) => {\n return (element.type as FluentTriggerComponent).isFluentTriggerComponent;\n};\n"],"sourceRoot":"../src/"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Tiny helper to do the minimal amount of work in duplicating an object but omitting some
3
- * props. This ends up faster than using object ...rest or reduce to filter.
4
- *
5
- * This behaves very much like filteredAssign, but does not merge many objects together,
6
- * uses an exclusion object map, and avoids spreads all for optimal performance.
7
- *
8
- * See perf test for background:
9
- * https://jsperf.com/omit-vs-rest-vs-reduce/1
10
- *
11
- * @param obj - The object to clone
12
- * @param exclusions - The array of keys to exclude
13
- */
14
- export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
@@ -1,148 +0,0 @@
1
- /**
2
- * An array of events that are allowed on every html element type.
3
- *
4
- * @public
5
- */
6
- export declare const baseElementEvents: Record<string, number>;
7
- /**
8
- * An array of element attributes which are allowed on every html element type.
9
- *
10
- * @public
11
- */
12
- export declare const baseElementProperties: Record<string, number>;
13
- /**
14
- * An array of HTML element properties and events.
15
- *
16
- * @public
17
- */
18
- export declare const htmlElementProperties: Record<string, number>;
19
- /**
20
- * An array of LABEL tag properties and events.
21
- *
22
- * @public
23
- */
24
- export declare const labelProperties: Record<string, number>;
25
- /**
26
- * An array of AUDIO tag properties and events.
27
-
28
- * @public
29
- */
30
- export declare const audioProperties: Record<string, number>;
31
- /**
32
- * An array of VIDEO tag properties and events.
33
- *
34
- * @public
35
- */
36
- export declare const videoProperties: Record<string, number>;
37
- /**
38
- * An array of OL tag properties and events.
39
- *
40
- * @public
41
- */
42
- export declare const olProperties: Record<string, number>;
43
- /**
44
- * An array of LI tag properties and events.
45
- *
46
- * @public
47
- */
48
- export declare const liProperties: Record<string, number>;
49
- /**
50
- * An array of A tag properties and events.
51
- *
52
- * @public
53
- */
54
- export declare const anchorProperties: Record<string, number>;
55
- /**
56
- * An array of BUTTON tag properties and events.
57
- *
58
- * @public
59
- */
60
- export declare const buttonProperties: Record<string, number>;
61
- /**
62
- * An array of INPUT tag properties and events.
63
- *
64
- * @public
65
- */
66
- export declare const inputProperties: Record<string, number>;
67
- /**
68
- * An array of TEXTAREA tag properties and events.
69
- *
70
- * @public
71
- */
72
- export declare const textAreaProperties: Record<string, number>;
73
- /**
74
- * An array of SELECT tag properties and events.
75
- *
76
- * @public
77
- */
78
- export declare const selectProperties: Record<string, number>;
79
- export declare const optionProperties: Record<string, number>;
80
- /**
81
- * An array of TABLE tag properties and events.
82
- *
83
- * @public
84
- */
85
- export declare const tableProperties: Record<string, number>;
86
- /**
87
- * An array of TR tag properties and events.
88
- *
89
- * @public
90
- */
91
- export declare const trProperties: Record<string, number>;
92
- /**
93
- * An array of TH tag properties and events.
94
- *
95
- * @public
96
- */
97
- export declare const thProperties: Record<string, number>;
98
- /**
99
- * An array of TD tag properties and events.
100
- *
101
- * @public
102
- */
103
- export declare const tdProperties: Record<string, number>;
104
- export declare const colGroupProperties: Record<string, number>;
105
- export declare const colProperties: Record<string, number>;
106
- /**
107
- * An array of FORM tag properties and events.
108
- *
109
- * @public
110
- */
111
- export declare const formProperties: Record<string, number>;
112
- /**
113
- * An array of IFRAME tag properties and events.
114
- *
115
- * @public
116
- */
117
- export declare const iframeProperties: Record<string, number>;
118
- /**
119
- * An array of IMAGE tag properties and events.
120
- *
121
- * @public
122
- */
123
- export declare const imgProperties: Record<string, number>;
124
- /**
125
- * @deprecated Use imgProperties for img elements.
126
- */
127
- export declare const imageProperties: Record<string, number>;
128
- /**
129
- * An array of DIV tag properties and events.
130
- *
131
- * @public
132
- */
133
- export declare const divProperties: Record<string, number>;
134
- /**
135
- * Gets native supported props for an html element provided the allowance set. Use one of the property
136
- * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
137
- * props set. Note that all data- and aria- prefixed attributes will be allowed.
138
- * NOTE: getNativeProps should always be applied first when adding props to a react component. The
139
- * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
140
- * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
141
- * the component after an onClick function is added, then the getNativeProps onClick will override it.
142
- *
143
- * @public
144
- * @param props - The unfiltered input props
145
- * @param allowedPropsNames - The array or record of allowed prop names.
146
- * @returns The filtered props
147
- */
148
- export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
4
- *
5
- * Useful for situations where a keydown needs to be transformed to a click event
6
- */
7
- export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent): boolean;