@fluentui/react-utilities 0.0.0-nightly627ad67f1120211109.1 → 0.0.0-nightly63afcc343820220120.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.json +99 -9
  2. package/CHANGELOG.md +26 -6
  3. package/dist/react-utilities.d.ts +68 -38
  4. package/lib/compose/getSlots.d.ts +5 -4
  5. package/lib/compose/getSlots.js +6 -4
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/types.d.ts +3 -4
  8. package/lib/compose/types.js.map +1 -1
  9. package/lib/hooks/index.d.ts +1 -1
  10. package/lib/hooks/index.js +1 -1
  11. package/lib/hooks/index.js.map +1 -1
  12. package/lib/hooks/useControllableState.d.ts +16 -6
  13. package/lib/hooks/useControllableState.js +13 -8
  14. package/lib/hooks/useControllableState.js.map +1 -1
  15. package/lib/hooks/useOnClickOutside.js.map +1 -1
  16. package/lib/hooks/useTriggerElement.d.ts +18 -0
  17. package/lib/hooks/useTriggerElement.js +90 -0
  18. package/lib/hooks/useTriggerElement.js.map +1 -0
  19. package/lib/utils/applyTriggerPropsToChildren.d.ts +1 -1
  20. package/lib/utils/getNativeElementProps.d.ts +22 -0
  21. package/lib/utils/getNativeElementProps.js +22 -0
  22. package/lib/utils/getNativeElementProps.js.map +1 -1
  23. package/lib/utils/getReactCallbackName.d.ts +25 -0
  24. package/lib/utils/getReactCallbackName.js +26 -0
  25. package/lib/utils/getReactCallbackName.js.map +1 -0
  26. package/lib/utils/onlyChild.d.ts +1 -1
  27. package/lib/utils/properties.js +40 -20
  28. package/lib/utils/properties.js.map +1 -1
  29. package/lib-commonjs/compose/getSlots.d.ts +5 -4
  30. package/lib-commonjs/compose/getSlots.js +6 -4
  31. package/lib-commonjs/compose/getSlots.js.map +1 -1
  32. package/lib-commonjs/compose/types.d.ts +3 -4
  33. package/lib-commonjs/compose/types.js.map +1 -1
  34. package/lib-commonjs/hooks/index.d.ts +1 -1
  35. package/lib-commonjs/hooks/index.js +2 -2
  36. package/lib-commonjs/hooks/index.js.map +1 -1
  37. package/lib-commonjs/hooks/useControllableState.d.ts +16 -6
  38. package/lib-commonjs/hooks/useControllableState.js +13 -8
  39. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  40. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  41. package/lib-commonjs/hooks/useTriggerElement.d.ts +18 -0
  42. package/lib-commonjs/hooks/useTriggerElement.js +105 -0
  43. package/lib-commonjs/hooks/useTriggerElement.js.map +1 -0
  44. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +1 -1
  45. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  46. package/lib-commonjs/utils/getNativeElementProps.js +25 -1
  47. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  48. package/lib-commonjs/utils/getReactCallbackName.d.ts +25 -0
  49. package/lib-commonjs/utils/getReactCallbackName.js +35 -0
  50. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
  51. package/lib-commonjs/utils/onlyChild.d.ts +1 -1
  52. package/lib-commonjs/utils/properties.js +40 -20
  53. package/lib-commonjs/utils/properties.js.map +1 -1
  54. package/package.json +6 -11
  55. package/lib/hooks/useControllableValue.d.ts +0 -20
  56. package/lib/hooks/useControllableValue.js +0 -57
  57. package/lib/hooks/useControllableValue.js.map +0 -1
  58. package/lib-commonjs/hooks/useControllableValue.d.ts +0 -20
  59. package/lib-commonjs/hooks/useControllableValue.js +0 -68
  60. package/lib-commonjs/hooks/useControllableValue.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,28 +2,118 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 09 Nov 2021 04:20:27 GMT",
6
- "tag": "@fluentui/react-utilities_v0.0.0-nightly627ad67f1120211109.1",
7
- "version": "0.0.0-nightly627ad67f1120211109.1",
5
+ "date": "Thu, 20 Jan 2022 04:17:46 GMT",
6
+ "tag": "@fluentui/react-utilities_v0.0.0-nightly63afcc343820220120.1",
7
+ "version": "0.0.0-nightly63afcc343820220120.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
11
11
  "author": "email not defined",
12
12
  "package": "@fluentui/react-utilities",
13
- "commit": "5e2f04f4741a9e3b98463480f9c1926ea2006337",
13
+ "commit": "1f354b562240b78c25d35df7989491f6eca92ef8",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
16
  {
17
- "author": "gcox@microsoft.com",
17
+ "author": "behowell@microsoft.com",
18
18
  "package": "@fluentui/react-utilities",
19
- "commit": "c9bd5b5a02ae94a8239ce1b56cac2f0d0dbd3586",
20
- "comment": "Updated beta and RC components to ES2019"
19
+ "commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
20
+ "comment": "getSlots: remove slotNames param, and infer from state.components instead"
21
+ },
22
+ {
23
+ "author": "olfedias@microsoft.com",
24
+ "package": "@fluentui/react-utilities",
25
+ "commit": "d2eb57808a403b70845a732a62b55aa64d66b2a0",
26
+ "comment": "add useTriggerElement() hook"
27
+ },
28
+ {
29
+ "author": "elcraig@microsoft.com",
30
+ "package": "@fluentui/react-utilities",
31
+ "commit": "39ce3cbcf15ce2619649e1eddccf932736ceac07",
32
+ "comment": "[breaking] Remove useControllableValue hook (use useControllableState instead)"
21
33
  },
22
34
  {
23
35
  "author": "beachball",
24
36
  "package": "@fluentui/react-utilities",
25
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly627ad67f1120211109.1",
26
- "commit": "5e2f04f4741a9e3b98463480f9c1926ea2006337"
37
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly63afcc343820220120.1",
38
+ "commit": "1f354b562240b78c25d35df7989491f6eca92ef8"
39
+ }
40
+ ],
41
+ "none": [
42
+ {
43
+ "author": "elcraig@microsoft.com",
44
+ "package": "@fluentui/react-utilities",
45
+ "commit": "3360b45ec159250b1346c91afad7dce138e6bc20",
46
+ "comment": "Update API file to version generated by typescript 4.3"
47
+ },
48
+ {
49
+ "author": "olfedias@microsoft.com",
50
+ "package": "@fluentui/react-utilities",
51
+ "commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
52
+ "comment": "remove inline-style-expand-shorthand from tsconfigs"
53
+ },
54
+ {
55
+ "author": "martinhochel@microsoft.com",
56
+ "package": "@fluentui/react-utilities",
57
+ "commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
58
+ "comment": "chore: use storybook runner for all vNext packages"
59
+ },
60
+ {
61
+ "author": "seanmonahan@microsoft.com",
62
+ "package": "@fluentui/react-utilities",
63
+ "commit": "6404bef16cebf1f67b9b80a9f6d5f605f9873df1",
64
+ "comment": "Update getSlots() docs."
65
+ },
66
+ {
67
+ "author": "lingfangao@hotmail.com",
68
+ "package": "@fluentui/react-utilities",
69
+ "commit": "a4e048a0e03ddd676670da516e3a6612b26ea500",
70
+ "comment": "chore: Remove enzyme from react-utilities tests"
71
+ }
72
+ ]
73
+ }
74
+ },
75
+ {
76
+ "date": "Thu, 25 Nov 2021 08:34:09 GMT",
77
+ "tag": "@fluentui/react-utilities_v9.0.0-beta.4",
78
+ "version": "9.0.0-beta.4",
79
+ "comments": {
80
+ "none": [
81
+ {
82
+ "author": "lingfangao@hotmail.com",
83
+ "package": "@fluentui/react-utilities",
84
+ "commit": "718e63006d8d07d24efab9c32942041963d78dc7",
85
+ "comment": "Migrate package to use solution style ts-configs"
86
+ }
87
+ ],
88
+ "prerelease": [
89
+ {
90
+ "author": "behowell@microsoft.com",
91
+ "package": "@fluentui/react-utilities",
92
+ "commit": "99adff5a9aab9086e8bc4737040654ab23f0febe",
93
+ "comment": "Update utility types to support specifying a primary slot other than root"
94
+ }
95
+ ]
96
+ }
97
+ },
98
+ {
99
+ "date": "Fri, 12 Nov 2021 13:25:10 GMT",
100
+ "tag": "@fluentui/react-utilities_v9.0.0-beta.3",
101
+ "version": "9.0.0-beta.3",
102
+ "comments": {
103
+ "none": [
104
+ {
105
+ "author": "lingfangao@hotmail.com",
106
+ "package": "@fluentui/react-utilities",
107
+ "commit": "00f70581480b536e723fb69edf0ae617beac4807",
108
+ "comment": "Remove beta release tag"
109
+ }
110
+ ],
111
+ "prerelease": [
112
+ {
113
+ "author": "gcox@microsoft.com",
114
+ "package": "@fluentui/react-utilities",
115
+ "commit": "c9bd5b5a02ae94a8239ce1b56cac2f0d0dbd3586",
116
+ "comment": "Updated beta and RC components to ES2019"
27
117
  }
28
118
  ]
29
119
  }
package/CHANGELOG.md CHANGED
@@ -1,19 +1,39 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Tue, 09 Nov 2021 04:20:27 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 20 Jan 2022 04:17:46 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly627ad67f1120211109.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly627ad67f1120211109.1)
7
+ ## [0.0.0-nightly63afcc343820220120.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly63afcc343820220120.1)
8
8
 
9
- Tue, 09 Nov 2021 04:20:27 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.2..@fluentui/react-utilities_v0.0.0-nightly627ad67f1120211109.1)
9
+ Thu, 20 Jan 2022 04:17:46 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.4..@fluentui/react-utilities_v0.0.0-nightly63afcc343820220120.1)
11
+
12
+ ### Changes
13
+
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/1f354b562240b78c25d35df7989491f6eca92ef8) by email not defined)
15
+ - getSlots: remove slotNames param, and infer from state.components instead ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
16
+ - add useTriggerElement() hook ([PR #21225](https://github.com/microsoft/fluentui/pull/21225) by olfedias@microsoft.com)
17
+ - [breaking] Remove useControllableValue hook (use useControllableState instead) ([PR #20865](https://github.com/microsoft/fluentui/pull/20865) by elcraig@microsoft.com)
18
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly63afcc343820220120.1 ([commit](https://github.com/microsoft/fluentui/commit/1f354b562240b78c25d35df7989491f6eca92ef8) by beachball)
19
+
20
+ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.4)
21
+
22
+ Thu, 25 Nov 2021 08:34:09 GMT
23
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.3..@fluentui/react-utilities_v9.0.0-beta.4)
24
+
25
+ ### Changes
26
+
27
+ - Update utility types to support specifying a primary slot other than root ([PR #20617](https://github.com/microsoft/fluentui/pull/20617) by behowell@microsoft.com)
28
+
29
+ ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.3)
30
+
31
+ Fri, 12 Nov 2021 13:25:10 GMT
32
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.2..@fluentui/react-utilities_v9.0.0-beta.3)
11
33
 
12
34
  ### Changes
13
35
 
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/5e2f04f4741a9e3b98463480f9c1926ea2006337) by email not defined)
15
36
  - Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
16
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly627ad67f1120211109.1 ([commit](https://github.com/microsoft/fluentui/commit/5e2f04f4741a9e3b98463480f9c1926ea2006337) by beachball)
17
37
 
18
38
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.2)
19
39
 
@@ -11,7 +11,7 @@ export declare const anchorProperties: Record<string, number>;
11
11
  /**
12
12
  * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
13
13
  */
14
- export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string | ((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;
14
+ export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | ((props: TTriggerProps) => React_2.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactNode;
15
15
 
16
16
  /**
17
17
  * Helper type for inferring the type of the as prop from a Props type.
@@ -58,8 +58,6 @@ export declare const buttonProperties: Record<string, number>;
58
58
  */
59
59
  export declare function canUseDOM(): boolean;
60
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
61
  /**
64
62
  * Clamps `value` to a number between the min and max.
65
63
  *
@@ -75,10 +73,10 @@ export declare const colProperties: Record<string, number>;
75
73
 
76
74
  export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
77
75
  [Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
78
- }, Primary> & PropsWithoutRef<Shorthands[Primary]>;
76
+ }, Primary & 'root'> & PropsWithoutRef<Shorthands[Primary]>;
79
77
 
80
78
  export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
81
- components?: {
79
+ components: {
82
80
  [Key in keyof Shorthands]-?: React_2.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
83
81
  };
84
82
  } & Shorthands;
@@ -89,8 +87,7 @@ export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord
89
87
  * This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
90
88
  * it shouldn't be used as the type of a slot.
91
89
  */
92
- export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
93
- children?: React_2.ReactNode;
90
+ export declare type DefaultObjectShorthandProps = ObjectShorthandProps<Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
94
91
  as?: keyof JSX.IntrinsicElements;
95
92
  }>;
96
93
 
@@ -101,11 +98,6 @@ export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
101
98
  */
102
99
  export declare const defaultSSRContextValue: SSRContextValue;
103
100
 
104
- /**
105
- * Default value can be a value or an initializer
106
- */
107
- declare type DefaultValue<TValue> = TValue | (() => TValue);
108
-
109
101
  /**
110
102
  * An array of DIV tag properties and events.
111
103
  *
@@ -150,6 +142,29 @@ export declare function getNativeElementProps<TAttributes extends React_2.HTMLAt
150
142
  */
151
143
  export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
152
144
 
145
+ /**
146
+ * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
147
+ *
148
+ * This function is only for use with components that have a primary slot other than `root`.
149
+ * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
150
+ *
151
+ * @returns An object containing the native props for the `root` and primary slots.
152
+ */
153
+ export declare const getPartitionedNativeProps: ({ primarySlotTagName, props, excludedPropNames, }: {
154
+ /** The primary slot's element type (e.g. 'div') */
155
+ primarySlotTagName: keyof JSX.IntrinsicElements;
156
+ /** The component's props object */
157
+ props: Pick<React_2.HTMLAttributes<HTMLElement>, 'style' | 'className'>;
158
+ /** List of native props to exclude from the returned value */
159
+ excludedPropNames?: string[] | undefined;
160
+ }) => {
161
+ root: {
162
+ style: React_2.CSSProperties | undefined;
163
+ className: string | undefined;
164
+ };
165
+ primary: React_2.HTMLAttributes<any>;
166
+ };
167
+
153
168
  /**
154
169
  * Finds and swaps a provided key for it's right to left format.
155
170
  */
@@ -164,14 +179,15 @@ export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
164
179
  * Slots will render as null if they are rendered as primitives with undefined children.
165
180
  *
166
181
  * 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.
182
+ * primitives, the props will be filtered according to the slot type by the type system.
183
+ * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
184
+ * anchor props. Note that this is only enforced at build time by Typescript -- there is no
185
+ * runtime code filtering props in this function.
169
186
  *
170
187
  * @param state - State including slot definitions
171
- * @param slotNames - Name of which props are slots
172
188
  * @returns An object containing the `slots` map and `slotProps` map.
173
189
  */
174
- export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
190
+ export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>): {
175
191
  slots: Slots<R>;
176
192
  slotProps: SlotProps<R>;
177
193
  };
@@ -313,7 +329,7 @@ export declare function omit<TObj extends Record<string, any>, Exclusions extend
313
329
  /**
314
330
  * Similar to React.Children.only, but drills into fragments rather than treating them as a single child
315
331
  */
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>)>;
332
+ export declare const onlyChild: <P>(child: boolean | React_2.ReactText | React_2.ReactFragment | React_2.ReactPortal | React_2.ReactElement<P, string | React_2.JSXElementConstructor<any>> | null | undefined) => React_2.ReactElement<P, string | React_2.JSXElementConstructor<any>>;
317
333
 
318
334
  export declare const optionProperties: Record<string, number>;
319
335
 
@@ -471,42 +487,37 @@ export declare type UseBooleanCallbacks = {
471
487
  export declare function useConst<T>(initialValue: T | (() => T)): T;
472
488
 
473
489
  /**
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
490
+ * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
491
+ * such as a checked state or text input string.
492
+ *
493
+ * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a
494
+ * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.
495
+ *
496
+ * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
497
+ * of the current value and an updater (dispatch) function. The updater function is referentially
498
+ * stable (won't change during the component's lifecycle). It can take either a new value, or a
499
+ * function which is passed the previous value and returns the new value. Unlike `setState`, calls
500
+ * to the updater function will only be respected if the component is uncontrolled.
501
+ * @see https://reactjs.org/docs/uncontrolled-components.html
477
502
  */
478
503
  export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>];
479
504
 
480
505
  export declare type UseControllableStateOptions<State> = {
481
506
  /**
482
- * User provided default state or factory initializer
507
+ * User-provided default state or initializer, for uncontrolled usage.
483
508
  */
484
509
  defaultState?: State | (() => State);
485
510
  /**
486
- * User provided controllable state, undefined state means internal state will be used
511
+ * User-provided controlled state. `undefined` means internal state will be used.
487
512
  */
488
513
  state: State | undefined;
489
514
  /**
490
- * Used to initialize state if all user provided states are undefined
515
+ * Used as the initial state if `state` and `defaultState` are both `undefined`.
516
+ * If `undefined` is the correct initial state, pass that here.
491
517
  */
492
518
  initialState: State;
493
519
  };
494
520
 
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
521
  /**
511
522
  * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
512
523
  *
@@ -631,6 +642,25 @@ export declare function useSSRContext(): SSRContextValue;
631
642
  */
632
643
  export declare function useTimeout(): readonly [(fn: () => void, delay: number) => void, () => void];
633
644
 
645
+ /**
646
+ * A hook that handles "trigger" pattern.
647
+ *
648
+ * Clones a passed element or calls render props. Merges props including refs and callbacks, callbacks are kept stable
649
+ * by reference.
650
+ */
651
+ export declare function useTriggerElement<TriggerProps extends React_2.HTMLProps<unknown>>(options: UseTriggerElementOptions<TriggerProps>): React_2.ReactNode;
652
+
653
+ export declare type UseTriggerElementOptions<TriggerProps> = {
654
+ /** An actual trigger element or render props function. */
655
+ children: React_2.ReactElement | ((props: TriggerProps) => React_2.ReactNode) | null | undefined;
656
+ /** A ref to trigger element. */
657
+ ref: React_2.Ref<unknown> | undefined;
658
+ /** Props that are passed to a parent component and should be forwarded down. */
659
+ outerProps: React_2.HTMLProps<unknown>;
660
+ /** Custom props including callbacks. */
661
+ overrideProps: TriggerProps;
662
+ };
663
+
634
664
  /**
635
665
  * Hook which synchronously executes a callback when the component is about to unmount.
636
666
  *
@@ -15,14 +15,15 @@ declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
15
15
  * Slots will render as null if they are rendered as primitives with undefined children.
16
16
  *
17
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.
18
+ * primitives, the props will be filtered according to the slot type by the type system.
19
+ * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
20
+ * anchor props. Note that this is only enforced at build time by Typescript -- there is no
21
+ * runtime code filtering props in this function.
20
22
  *
21
23
  * @param state - State including slot definitions
22
- * @param slotNames - Name of which props are slots
23
24
  * @returns An object containing the `slots` map and `slotProps` map.
24
25
  */
25
- export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
26
+ export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>): {
26
27
  slots: Slots<R>;
27
28
  slotProps: SlotProps<R>;
28
29
  };
@@ -10,17 +10,19 @@ import { omit } from '../utils/omit';
10
10
  * Slots will render as null if they are rendered as primitives with undefined children.
11
11
  *
12
12
  * The slotProps will always omit the `as` prop within them, and for slots that are string
13
- * primitives, the props will be filtered according the the slot type. For example, if the
14
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
13
+ * primitives, the props will be filtered according to the slot type by the type system.
14
+ * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
15
+ * anchor props. Note that this is only enforced at build time by Typescript -- there is no
16
+ * runtime code filtering props in this function.
15
17
  *
16
18
  * @param state - State including slot definitions
17
- * @param slotNames - Name of which props are slots
18
19
  * @returns An object containing the `slots` map and `slotProps` map.
19
20
  */
20
21
 
21
- export function getSlots(state, slotNames = ['root']) {
22
+ export function getSlots(state) {
22
23
  const slots = {};
23
24
  const slotProps = {};
25
+ const slotNames = Object.keys(state.components);
24
26
 
25
27
  for (const slotName of slotNames) {
26
28
  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,EAAA,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAe,EAAA,CAAE,EAA7C,CAAzB;AACA,QAAM,SAAS,GAAI,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAD,CAAN,EAAmB,CAAC,IAAD,CAAnB,CAAP,GAAoC,KAAK,CAAC,QAAD,CAA5E;AAEA,SAAO,CAAC,IAAD,EAAO,SAAP,CAAP;AACD","sourceRoot":""}
@@ -8,8 +8,7 @@ export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> =
8
8
  * This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
9
9
  * it shouldn't be used as the type of a slot.
10
10
  */
11
- export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
12
- children?: React.ReactNode;
11
+ export declare type DefaultObjectShorthandProps = ObjectShorthandProps<Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
13
12
  as?: keyof JSX.IntrinsicElements;
14
13
  }>;
15
14
  /**
@@ -78,9 +77,9 @@ export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U :
78
77
  export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
79
78
  export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
80
79
  [Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
81
- }, Primary> & PropsWithoutRef<Shorthands[Primary]>;
80
+ }, Primary & 'root'> & PropsWithoutRef<Shorthands[Primary]>;
82
81
  export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
83
- components?: {
82
+ components: {
84
83
  [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
84
  };
86
85
  } & Shorthands;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":"WA2IA;AACA;AACA;AACA;AACA","sourceRoot":""}
1
+ {"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":"WAgJA;AACA;AACA;AACA;AACA","sourceRoot":""}
@@ -1,7 +1,6 @@
1
1
  export * from './useControllableState';
2
2
  export * from './useBoolean';
3
3
  export * from './useConst';
4
- export * from './useControllableValue';
5
4
  export * from './useEventCallback';
6
5
  export * from './useFirstMount';
7
6
  export * from './useId';
@@ -12,5 +11,6 @@ export * from './useOnClickOutside';
12
11
  export * from './useOnScrollOutside';
13
12
  export * from './usePrevious';
14
13
  export * from './useTimeout';
14
+ export * from './useTriggerElement';
15
15
  export * from './useUnmount';
16
16
  export * from './useForceUpdate';
@@ -1,7 +1,6 @@
1
1
  export * from './useControllableState';
2
2
  export * from './useBoolean';
3
3
  export * from './useConst';
4
- export * from './useControllableValue';
5
4
  export * from './useEventCallback';
6
5
  export * from './useFirstMount';
7
6
  export * from './useId';
@@ -12,6 +11,7 @@ export * from './useOnClickOutside';
12
11
  export * from './useOnScrollOutside';
13
12
  export * from './usePrevious';
14
13
  export * from './useTimeout';
14
+ export * from './useTriggerElement';
15
15
  export * from './useUnmount';
16
16
  export * from './useForceUpdate';
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
@@ -1,21 +1,31 @@
1
1
  import * as React from 'react';
2
2
  export declare type UseControllableStateOptions<State> = {
3
3
  /**
4
- * User provided default state or factory initializer
4
+ * User-provided default state or initializer, for uncontrolled usage.
5
5
  */
6
6
  defaultState?: State | (() => State);
7
7
  /**
8
- * User provided controllable state, undefined state means internal state will be used
8
+ * User-provided controlled state. `undefined` means internal state will be used.
9
9
  */
10
10
  state: State | undefined;
11
11
  /**
12
- * Used to initialize state if all user provided states are undefined
12
+ * Used as the initial state if `state` and `defaultState` are both `undefined`.
13
+ * If `undefined` is the correct initial state, pass that here.
13
14
  */
14
15
  initialState: State;
15
16
  };
16
17
  /**
17
- * A useState 'like' hook that allows optional user control
18
- * Useful for components which allow uncontrolled and controlled behaviour for users
19
- * @returns - https://reactjs.org/docs/hooks-state.html
18
+ * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
19
+ * such as a checked state or text input string.
20
+ *
21
+ * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a
22
+ * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.
23
+ *
24
+ * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
25
+ * of the current value and an updater (dispatch) function. The updater function is referentially
26
+ * stable (won't change during the component's lifecycle). It can take either a new value, or a
27
+ * function which is passed the previous value and returns the new value. Unlike `setState`, calls
28
+ * to the updater function will only be respected if the component is uncontrolled.
29
+ * @see https://reactjs.org/docs/uncontrolled-components.html
20
30
  */
21
31
  export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React.Dispatch<React.SetStateAction<State>>];
@@ -1,23 +1,28 @@
1
1
  import * as React from 'react';
2
2
  import { useConst } from './useConst';
3
3
 
4
- function isUndefined(state) {
5
- return typeof state === 'undefined';
6
- }
7
-
8
4
  function isFactoryDispatch(newState) {
9
5
  return typeof newState === 'function';
10
6
  }
11
7
  /**
12
- * A useState 'like' hook that allows optional user control
13
- * Useful for components which allow uncontrolled and controlled behaviour for users
14
- * @returns - https://reactjs.org/docs/hooks-state.html
8
+ * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
9
+ * such as a checked state or text input string.
10
+ *
11
+ * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a
12
+ * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.
13
+ *
14
+ * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
15
+ * of the current value and an updater (dispatch) function. The updater function is referentially
16
+ * stable (won't change during the component's lifecycle). It can take either a new value, or a
17
+ * function which is passed the previous value and returns the new value. Unlike `setState`, calls
18
+ * to the updater function will only be respected if the component is uncontrolled.
19
+ * @see https://reactjs.org/docs/uncontrolled-components.html
15
20
  */
16
21
 
17
22
 
18
23
  export const useControllableState = options => {
19
24
  const isControlled = useIsControlled(options.state);
20
- const initialState = isUndefined(options.defaultState) ? options.initialState : options.defaultState;
25
+ const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;
21
26
  const [internalState, setInternalState] = React.useState(initialState);
22
27
  const state = isControlled ? options.state : internalState;
23
28
  const st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AAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAAtC;;AACA,YAAI,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,QAA/B,EAAyC;AACvC,gBAAM,KAAK,GAAG,IAAI,WAAJ,CAAgB,eAAhB,EAAiC;AAAE,YAAA,OAAO,EAAE;AAAX,WAAjC,CAAd;AACA,UAAA,aAAa,CAAC,aAAd,CAA4B,KAA5B;AACD;AACF,OAN+C,EAM7C,YAN6C,CAAhD;AAOD;;AACD,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,UAAU,CAAC,OAA1B,CAA3B;AACD,KAFD;AAGD,GAbD,EAaG,CAAC,cAAD,EAAiB,wBAAjB,EAA2C,YAA3C,CAbH;AAcD,CAvCD","sourceRoot":""}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ export declare type UseTriggerElementOptions<TriggerProps> = {
3
+ /** An actual trigger element or render props function. */
4
+ children: React.ReactElement | ((props: TriggerProps) => React.ReactNode) | null | undefined;
5
+ /** A ref to trigger element. */
6
+ ref: React.Ref<unknown> | undefined;
7
+ /** Props that are passed to a parent component and should be forwarded down. */
8
+ outerProps: React.HTMLProps<unknown>;
9
+ /** Custom props including callbacks. */
10
+ overrideProps: TriggerProps;
11
+ };
12
+ /**
13
+ * A hook that handles "trigger" pattern.
14
+ *
15
+ * Clones a passed element or calls render props. Merges props including refs and callbacks, callbacks are kept stable
16
+ * by reference.
17
+ */
18
+ export declare function useTriggerElement<TriggerProps extends React.HTMLProps<unknown>>(options: UseTriggerElementOptions<TriggerProps>): React.ReactNode;