@fluentui/react-utilities 9.0.0-alpha.55 → 9.0.0-alpha.56

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 CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 01 Oct 2021 14:11:48 GMT",
5
+ "date": "Tue, 05 Oct 2021 09:26:55 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.0.0-alpha.56",
7
+ "version": "9.0.0-alpha.56",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "comment": "Add and use ForwardRefComponent helper type",
14
+ "commit": "3b16677a03035dcf03c1297268b85c6d4bd3f839"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Fri, 01 Oct 2021 14:13:08 GMT",
6
21
  "tag": "@fluentui/react-utilities_v9.0.0-alpha.55",
7
22
  "version": "9.0.0-alpha.55",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Fri, 01 Oct 2021 14:11:48 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 05 Oct 2021 09:26:55 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.56](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.56)
8
+
9
+ Tue, 05 Oct 2021 09:26:55 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-alpha.55..@fluentui/react-utilities_v9.0.0-alpha.56)
11
+
12
+ ### Changes
13
+
14
+ - Add and use ForwardRefComponent helper type ([PR #20081](https://github.com/microsoft/fluentui/pull/20081) by elcraig@microsoft.com)
15
+
7
16
  ## [9.0.0-alpha.55](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.55)
8
17
 
9
- Fri, 01 Oct 2021 14:11:48 GMT
18
+ Fri, 01 Oct 2021 14:13:08 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-alpha.53..@fluentui/react-utilities_v9.0.0-alpha.55)
11
20
 
12
21
  ### Changes
@@ -141,6 +141,11 @@ export declare const divProperties: Record<string, number>;
141
141
  */
142
142
  export declare const formProperties: Record<string, number>;
143
143
 
144
+ /**
145
+ * Return type for `React.forwardRef`, including inference of the proper typing for the ref.
146
+ */
147
+ 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;
148
+
144
149
  declare type GenericDictionary = Record<string, any>;
145
150
 
146
151
  declare type GenericDictionary_2 = Record<string, any>;
@@ -343,6 +348,20 @@ export declare type ObjectShorthandPropsCompat<TProps extends ComponentPropsComp
343
348
 
344
349
  export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
345
350
 
351
+ /**
352
+ * This is part of a hack to infer the element type from a native element *props* type.
353
+ * The only place the original element is found in a native props type (at least that's workable
354
+ * for inference) is in the event handlers, so some of the helper types use this event handler
355
+ * name to infer the original element type.
356
+ *
357
+ * Notes:
358
+ * - Using an extremely obscure event handler reduces the likelihood that its signature will be
359
+ * modified in any component's props.
360
+ * - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be
361
+ * less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.
362
+ */
363
+ declare type ObscureEventName = 'onLostPointerCaptureCapture';
364
+
346
365
  /**
347
366
  * An array of OL tag properties and events.
348
367
  *
@@ -84,6 +84,23 @@ export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord
84
84
  [Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
85
85
  };
86
86
  } & Shorthands;
87
+ /**
88
+ * This is part of a hack to infer the element type from a native element *props* type.
89
+ * The only place the original element is found in a native props type (at least that's workable
90
+ * for inference) is in the event handlers, so some of the helper types use this event handler
91
+ * name to infer the original element type.
92
+ *
93
+ * Notes:
94
+ * - Using an extremely obscure event handler reduces the likelihood that its signature will be
95
+ * modified in any component's props.
96
+ * - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be
97
+ * less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.
98
+ */
99
+ declare type ObscureEventName = 'onLostPointerCaptureCapture';
100
+ /**
101
+ * Return type for `React.forwardRef`, including inference of the proper typing for the ref.
102
+ */
103
+ export declare type ForwardRefComponent<Props> = ObscureEventName extends keyof Props ? Required<Props>[ObscureEventName] extends React.PointerEventHandler<infer Element> ? React.ForwardRefExoticComponent<Props & React.RefAttributes<Element>> : never : never;
87
104
  export declare type ComponentPropsCompat = {
88
105
  as?: React.ElementType;
89
106
  className?: string;
@@ -125,3 +142,4 @@ export declare type RequiredPropsCompat<T, K extends keyof T> = Omit<T, K> & {
125
142
  * @template DefaultedPropNames - The keys of Props that will always have a default value provided
126
143
  */
127
144
  export declare type ComponentStateCompat<Props, ShorthandPropNames extends keyof Props = never, DefaultedPropNames extends keyof ResolvedShorthandPropsCompat<Props, ShorthandPropNames> = never> = RequiredPropsCompat<ResolvedShorthandPropsCompat<Props, ShorthandPropNames>, DefaultedPropNames>;
145
+ export {};
@@ -84,6 +84,23 @@ export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord
84
84
  [Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
85
85
  };
86
86
  } & Shorthands;
87
+ /**
88
+ * This is part of a hack to infer the element type from a native element *props* type.
89
+ * The only place the original element is found in a native props type (at least that's workable
90
+ * for inference) is in the event handlers, so some of the helper types use this event handler
91
+ * name to infer the original element type.
92
+ *
93
+ * Notes:
94
+ * - Using an extremely obscure event handler reduces the likelihood that its signature will be
95
+ * modified in any component's props.
96
+ * - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be
97
+ * less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.
98
+ */
99
+ declare type ObscureEventName = 'onLostPointerCaptureCapture';
100
+ /**
101
+ * Return type for `React.forwardRef`, including inference of the proper typing for the ref.
102
+ */
103
+ export declare type ForwardRefComponent<Props> = ObscureEventName extends keyof Props ? Required<Props>[ObscureEventName] extends React.PointerEventHandler<infer Element> ? React.ForwardRefExoticComponent<Props & React.RefAttributes<Element>> : never : never;
87
104
  export declare type ComponentPropsCompat = {
88
105
  as?: React.ElementType;
89
106
  className?: string;
@@ -125,3 +142,4 @@ export declare type RequiredPropsCompat<T, K extends keyof T> = Omit<T, K> & {
125
142
  * @template DefaultedPropNames - The keys of Props that will always have a default value provided
126
143
  */
127
144
  export declare type ComponentStateCompat<Props, ShorthandPropNames extends keyof Props = never, DefaultedPropNames extends keyof ResolvedShorthandPropsCompat<Props, ShorthandPropNames> = never> = RequiredPropsCompat<ResolvedShorthandPropsCompat<Props, ShorthandPropNames>, DefaultedPropNames>;
145
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.0.0-alpha.55",
3
+ "version": "9.0.0-alpha.56",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",