@fluentui/react-utilities 0.0.0-nightlyf3ce1fbe1d20211110.1 → 0.0.0-nightlyfc5cfdc52420220215.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 (104) hide show
  1. package/CHANGELOG.json +162 -9
  2. package/CHANGELOG.md +43 -6
  3. package/dist/react-utilities.d.ts +232 -105
  4. package/lib/compose/getSlots.d.ts +11 -10
  5. package/lib/compose/getSlots.js +7 -6
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.d.ts +0 -1
  8. package/lib/compose/index.js +0 -1
  9. package/lib/compose/index.js.map +1 -1
  10. package/lib/compose/resolveShorthand.d.ts +10 -6
  11. package/lib/compose/resolveShorthand.js +5 -5
  12. package/lib/compose/resolveShorthand.js.map +1 -1
  13. package/lib/compose/types.d.ts +86 -35
  14. package/lib/compose/types.js.map +1 -1
  15. package/lib/hooks/index.d.ts +1 -1
  16. package/lib/hooks/index.js +1 -1
  17. package/lib/hooks/index.js.map +1 -1
  18. package/lib/hooks/useControllableState.d.ts +16 -6
  19. package/lib/hooks/useControllableState.js +13 -8
  20. package/lib/hooks/useControllableState.js.map +1 -1
  21. package/lib/hooks/useMergedEventCallbacks.d.ts +18 -0
  22. package/lib/hooks/useMergedEventCallbacks.js +26 -0
  23. package/lib/hooks/useMergedEventCallbacks.js.map +1 -0
  24. package/lib/hooks/useOnClickOutside.js.map +1 -1
  25. package/lib/utils/applyTriggerPropsToChildren.d.ts +1 -1
  26. package/lib/utils/applyTriggerPropsToChildren.js +23 -3
  27. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -1
  28. package/lib/utils/getNativeElementProps.d.ts +22 -0
  29. package/lib/utils/getNativeElementProps.js +22 -0
  30. package/lib/utils/getNativeElementProps.js.map +1 -1
  31. package/lib/utils/getReactCallbackName.d.ts +25 -0
  32. package/lib/utils/getReactCallbackName.js +26 -0
  33. package/lib/utils/getReactCallbackName.js.map +1 -0
  34. package/lib/utils/getTriggerChild.d.ts +22 -0
  35. package/lib/utils/getTriggerChild.js +26 -0
  36. package/lib/utils/getTriggerChild.js.map +1 -0
  37. package/lib/utils/index.d.ts +2 -1
  38. package/lib/utils/index.js +2 -1
  39. package/lib/utils/index.js.map +1 -1
  40. package/lib/utils/isFluentTrigger.d.ts +22 -0
  41. package/lib/utils/isFluentTrigger.js +8 -0
  42. package/lib/utils/isFluentTrigger.js.map +1 -0
  43. package/lib/utils/properties.js +40 -20
  44. package/lib/utils/properties.js.map +1 -1
  45. package/lib-commonjs/compose/getSlots.d.ts +11 -10
  46. package/lib-commonjs/compose/getSlots.js +7 -7
  47. package/lib-commonjs/compose/getSlots.js.map +1 -1
  48. package/lib-commonjs/compose/index.d.ts +0 -1
  49. package/lib-commonjs/compose/index.js +0 -2
  50. package/lib-commonjs/compose/index.js.map +1 -1
  51. package/lib-commonjs/compose/resolveShorthand.d.ts +10 -6
  52. package/lib-commonjs/compose/resolveShorthand.js +5 -5
  53. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  54. package/lib-commonjs/compose/types.d.ts +86 -35
  55. package/lib-commonjs/compose/types.js.map +1 -1
  56. package/lib-commonjs/hooks/index.d.ts +1 -1
  57. package/lib-commonjs/hooks/index.js +2 -2
  58. package/lib-commonjs/hooks/index.js.map +1 -1
  59. package/lib-commonjs/hooks/useControllableState.d.ts +16 -6
  60. package/lib-commonjs/hooks/useControllableState.js +13 -8
  61. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  62. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +18 -0
  63. package/lib-commonjs/hooks/useMergedEventCallbacks.js +36 -0
  64. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -0
  65. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  66. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +1 -1
  67. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +24 -4
  68. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -1
  69. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  70. package/lib-commonjs/utils/getNativeElementProps.js +25 -1
  71. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  72. package/lib-commonjs/utils/getReactCallbackName.d.ts +25 -0
  73. package/lib-commonjs/utils/getReactCallbackName.js +35 -0
  74. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
  75. package/lib-commonjs/utils/getTriggerChild.d.ts +22 -0
  76. package/lib-commonjs/utils/getTriggerChild.js +37 -0
  77. package/lib-commonjs/utils/getTriggerChild.js.map +1 -0
  78. package/lib-commonjs/utils/index.d.ts +2 -1
  79. package/lib-commonjs/utils/index.js +4 -2
  80. package/lib-commonjs/utils/index.js.map +1 -1
  81. package/lib-commonjs/utils/isFluentTrigger.d.ts +22 -0
  82. package/lib-commonjs/utils/isFluentTrigger.js +17 -0
  83. package/lib-commonjs/utils/isFluentTrigger.js.map +1 -0
  84. package/lib-commonjs/utils/properties.js +40 -20
  85. package/lib-commonjs/utils/properties.js.map +1 -1
  86. package/package.json +6 -11
  87. package/lib/compose/nullRender.d.ts +0 -4
  88. package/lib/compose/nullRender.js +0 -5
  89. package/lib/compose/nullRender.js.map +0 -1
  90. package/lib/hooks/useControllableValue.d.ts +0 -20
  91. package/lib/hooks/useControllableValue.js +0 -57
  92. package/lib/hooks/useControllableValue.js.map +0 -1
  93. package/lib/utils/onlyChild.d.ts +0 -5
  94. package/lib/utils/onlyChild.js +0 -13
  95. package/lib/utils/onlyChild.js.map +0 -1
  96. package/lib-commonjs/compose/nullRender.d.ts +0 -4
  97. package/lib-commonjs/compose/nullRender.js +0 -14
  98. package/lib-commonjs/compose/nullRender.js.map +0 -1
  99. package/lib-commonjs/hooks/useControllableValue.d.ts +0 -20
  100. package/lib-commonjs/hooks/useControllableValue.js +0 -68
  101. package/lib-commonjs/hooks/useControllableValue.js.map +0 -1
  102. package/lib-commonjs/utils/onlyChild.d.ts +0 -5
  103. package/lib-commonjs/utils/onlyChild.js +0 -23
  104. package/lib-commonjs/utils/onlyChild.js.map +0 -1
@@ -2,7 +2,8 @@ export * from './applyTriggerPropsToChildren';
2
2
  export * from './clamp';
3
3
  export * from './getNativeElementProps';
4
4
  export * from './getRTLSafeKey';
5
+ export * from './getTriggerChild';
6
+ export * from './isFluentTrigger';
5
7
  export * from './omit';
6
- export * from './onlyChild';
7
8
  export * from './properties';
8
9
  export * from './shouldPreventDefaultOnKeyDown';
@@ -2,8 +2,9 @@ export * from './applyTriggerPropsToChildren';
2
2
  export * from './clamp';
3
3
  export * from './getNativeElementProps';
4
4
  export * from './getRTLSafeKey';
5
+ export * from './getTriggerChild';
6
+ export * from './isFluentTrigger';
5
7
  export * from './omit';
6
- export * from './onlyChild';
7
8
  export * from './properties';
8
9
  export * from './shouldPreventDefaultOnKeyDown';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,22 @@
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;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
3
+ * See the {@link FluentTriggerComponent} type for more info.
4
+ */
5
+ export const isFluentTrigger = element => {
6
+ return element.type.isFluentTriggerComponent;
7
+ };
8
+ //# sourceMappingURL=isFluentTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/isFluentTrigger.ts"],"names":[],"mappings":"AAmBA;;;AAGG;AACH,OAAO,MAAM,eAAe,GAAI,OAAD,IAAgC;AAC7D,SAAQ,OAAO,CAAC,IAAR,CAAwC,wBAAhD;AACD,CAFM","sourceRoot":""}
@@ -25,7 +25,8 @@ export const baseElementEvents = /*#__PURE__*/toObjectMap(['onAuxClick', 'onCopy
25
25
  * @public
26
26
  */
27
27
 
28
- export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
28
+ export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
29
+ ]);
29
30
  /**
30
31
  * An array of HTML element properties and events.
31
32
  *
@@ -39,78 +40,90 @@ export const htmlElementProperties = /*#__PURE__*/toObjectMap(baseElementPropert
39
40
  * @public
40
41
  */
41
42
 
42
- export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form']);
43
+ export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
44
+ ]);
43
45
  /**
44
46
  * An array of AUDIO tag properties and events.
45
47
 
46
48
  * @public
47
49
  */
48
50
 
49
- export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
51
+ export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
52
+ ]);
50
53
  /**
51
54
  * An array of VIDEO tag properties and events.
52
55
  *
53
56
  * @public
54
57
  */
55
58
 
56
- export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster']);
59
+ export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster' // video
60
+ ]);
57
61
  /**
58
62
  * An array of OL tag properties and events.
59
63
  *
60
64
  * @public
61
65
  */
62
66
 
63
- export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start']);
67
+ export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start' // ol
68
+ ]);
64
69
  /**
65
70
  * An array of LI tag properties and events.
66
71
  *
67
72
  * @public
68
73
  */
69
74
 
70
- export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value']);
75
+ export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
76
+ ]);
71
77
  /**
72
78
  * An array of A tag properties and events.
73
79
  *
74
80
  * @public
75
81
  */
76
82
 
77
- export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
83
+ export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
84
+ ]);
78
85
  /**
79
86
  * An array of BUTTON tag properties and events.
80
87
  *
81
88
  * @public
82
89
  */
83
90
 
84
- export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
91
+ export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
92
+ ]);
85
93
  /**
86
94
  * An array of INPUT tag properties and events.
87
95
  *
88
96
  * @public
89
97
  */
90
98
 
91
- export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
99
+ export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
100
+ ]);
92
101
  /**
93
102
  * An array of TEXTAREA tag properties and events.
94
103
  *
95
104
  * @public
96
105
  */
97
106
 
98
- export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
107
+ export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
108
+ ]);
99
109
  /**
100
110
  * An array of SELECT tag properties and events.
101
111
  *
102
112
  * @public
103
113
  */
104
114
 
105
- export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required']);
106
- export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value']);
115
+ export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
116
+ ]);
117
+ export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
118
+ ]);
107
119
  /**
108
120
  * An array of TABLE tag properties and events.
109
121
  *
110
122
  * @public
111
123
  */
112
124
 
113
- export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing']);
125
+ export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing' // table
126
+ ]);
114
127
  /**
115
128
  * An array of TR tag properties and events.
116
129
  *
@@ -124,37 +137,44 @@ export const trProperties = htmlElementProperties;
124
137
  * @public
125
138
  */
126
139
 
127
- export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['rowSpan', 'scope']);
140
+ export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['rowSpan', 'scope' // th
141
+ ]);
128
142
  /**
129
143
  * An array of TD tag properties and events.
130
144
  *
131
145
  * @public
132
146
  */
133
147
 
134
- export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
135
- export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
136
- export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
148
+ export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
149
+ ]);
150
+ export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
151
+ ]);
152
+ export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
153
+ ]);
137
154
  /**
138
155
  * An array of FORM tag properties and events.
139
156
  *
140
157
  * @public
141
158
  */
142
159
 
143
- export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
160
+ export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
161
+ ]);
144
162
  /**
145
163
  * An array of IFRAME tag properties and events.
146
164
  *
147
165
  * @public
148
166
  */
149
167
 
150
- export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
168
+ export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
169
+ ]);
151
170
  /**
152
171
  * An array of IMAGE tag properties and events.
153
172
  *
154
173
  * @public
155
174
  */
156
175
 
157
- export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
176
+ export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
177
+ ]);
158
178
  /**
159
179
  * @deprecated Use imgProperties for img elements.
160
180
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ut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,iBAJI,EAIwB;AAE5B;AACA;AACA;AACA;AACA;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,gBAAd,CAAhB,CAR4B,CAS5B;;AACA,QAAM,MAAM,GAAwB,EAApC;AACA,QAAM,IAAI,GAAG,MAAM,CAAC,IAAP,CAAY,KAAZ,CAAb;;AAEA,OAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,UAAM,YAAY,GACf,CAAC,OAAD,IAAa,gBAA2C,CAAC,GAAD,CAAzD,IACC,OAAO,IAAK,gBAA6B,CAAC,OAA9B,CAAsC,GAAtC,KAA8C,CAD3D,IAEA,GAAG,CAAC,OAAJ,CAAY,OAAZ,MAAyB,CAFzB,IAGA,GAAG,CAAC,OAAJ,CAAY,OAAZ,MAAyB,CAJ3B;;AAMA,QAAI,YAAY,KAAK,CAAC,iBAAD,IAAsB,CAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAE,OAAnB,CAA2B,GAA3B,CAAA,MAAoC,CAAC,CAAhE,CAAhB,EAAoF;AAClF;AACA,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,KAAM,CAAC,GAAD,CAApB;AACD;AACF;;AAED,SAAO,MAAP;AACD","sourceRoot":""}
@@ -1,10 +1,10 @@
1
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]>>;
2
+ import type { AsIntrinsicElement, ComponentState, ExtractSlotProps, SlotPropsRecord, UnionToIntersection } from './types';
3
+ export declare type Slots<S extends SlotPropsRecord> = {
4
+ [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<ExtractSlotProps<S[K]>>;
5
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;
6
+ declare type ObjectSlotProps<S extends SlotPropsRecord> = {
7
+ [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? P : never;
8
8
  };
9
9
  /**
10
10
  * Given the state and an array of slot names, will break out `slots` and `slotProps`
@@ -15,15 +15,16 @@ 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 SlotPropsRecord>(state: ComponentState<R>): {
26
27
  slots: Slots<R>;
27
- slotProps: SlotProps<R>;
28
+ slotProps: ObjectSlotProps<R>;
28
29
  };
29
30
  export {};
@@ -7,8 +7,6 @@ exports.getSlots = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
10
- const nullRender_1 = /*#__PURE__*/require("./nullRender");
11
-
12
10
  const omit_1 = /*#__PURE__*/require("../utils/omit");
13
11
  /**
14
12
  * Given the state and an array of slot names, will break out `slots` and `slotProps`
@@ -19,18 +17,20 @@ const omit_1 = /*#__PURE__*/require("../utils/omit");
19
17
  * Slots will render as null if they are rendered as primitives with undefined children.
20
18
  *
21
19
  * The slotProps will always omit the `as` prop within them, and for slots that are string
22
- * primitives, the props will be filtered according the the slot type. For example, if the
23
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
20
+ * primitives, the props will be filtered according to the slot type by the type system.
21
+ * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
22
+ * anchor props. Note that this is only enforced at build time by Typescript -- there is no
23
+ * runtime code filtering props in this function.
24
24
  *
25
25
  * @param state - State including slot definitions
26
- * @param slotNames - Name of which props are slots
27
26
  * @returns An object containing the `slots` map and `slotProps` map.
28
27
  */
29
28
 
30
29
 
31
- function getSlots(state, slotNames = ['root']) {
30
+ function getSlots(state) {
32
31
  const slots = {};
33
32
  const slotProps = {};
33
+ const slotNames = Object.keys(state.components);
34
34
 
35
35
  for (const slotName of slotNames) {
36
36
  const [slot, props] = getSlot(state, slotName);
@@ -50,7 +50,7 @@ function getSlot(state, slotName) {
50
50
  var _a, _b, _c;
51
51
 
52
52
  if (state[slotName] === undefined) {
53
- return [nullRender_1.nullRender, undefined];
53
+ return [null, undefined];
54
54
  }
55
55
 
56
56
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compose/getSlots.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAUA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,MAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;AAqBA;;;;;;;;;;;;;;;AAeG;;;AACH,SAAgB,QAAhB,CACE,KADF,EA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AAD,CAAV,EAAuB,CAAC,IAAD,CAAvB,CAAH,GAAoC,KAAK,CAAC,QAAD,CAA5E;AAEA,SAAO,CAAC,IAAD,EAAO,SAAP,CAAP;AACD","sourceRoot":""}
@@ -1,4 +1,3 @@
1
1
  export * from './getSlots';
2
- export * from './nullRender';
3
2
  export * from './resolveShorthand';
4
3
  export * from './types';
@@ -8,8 +8,6 @@ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./getSlots"), exports);
10
10
 
11
- tslib_1.__exportStar(require("./nullRender"), exports);
12
-
13
11
  tslib_1.__exportStar(require("./resolveShorthand"), exports);
14
12
 
15
13
  tslib_1.__exportStar(require("./types"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compose/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["../../src/compose/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -1,12 +1,16 @@
1
- import type { DefaultObjectShorthandProps, ShorthandProps } from './types';
2
- export declare type ResolveShorthandOptions<Props extends Record<string, any>, Required extends boolean = false> = {
1
+ import type { ReplaceNullWithUndefined, SlotShorthandValue, UnknownSlotProps } from './types';
2
+ export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = {
3
3
  required?: Required;
4
4
  defaultProps?: Props;
5
5
  };
6
+ export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
7
+ <P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, true>): ReplaceNullWithUndefined<P>;
8
+ <P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>): ReplaceNullWithUndefined<P> | undefined;
9
+ };
6
10
  /**
7
- * Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
11
+ * Resolves shorthands into slot props, to ensure normalization of the signature
8
12
  * being passed down to getSlots method
9
- * @param value - the base ShorthandProps
10
- * @param options - options to resolve ShorthandProps
13
+ * @param value - the base shorthand props
14
+ * @param options - options to resolve shorthand props
11
15
  */
12
- export declare function resolveShorthand<Props extends DefaultObjectShorthandProps, Required extends boolean = false>(value: ShorthandProps<Props>, options?: ResolveShorthandOptions<Props, Required>): Required extends false ? Props | undefined : Props;
16
+ export declare const resolveShorthand: ResolveShorthandFunction;
@@ -7,14 +7,14 @@ exports.resolveShorthand = void 0;
7
7
 
8
8
  const react_1 = /*#__PURE__*/require("react");
9
9
  /**
10
- * Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
10
+ * Resolves shorthands into slot props, to ensure normalization of the signature
11
11
  * being passed down to getSlots method
12
- * @param value - the base ShorthandProps
13
- * @param options - options to resolve ShorthandProps
12
+ * @param value - the base shorthand props
13
+ * @param options - options to resolve shorthand props
14
14
  */
15
15
 
16
16
 
17
- function resolveShorthand(value, options) {
17
+ const resolveShorthand = (value, options) => {
18
18
  const {
19
19
  required = false,
20
20
  defaultProps
@@ -35,7 +35,7 @@ function resolveShorthand(value, options) {
35
35
  return defaultProps ? { ...defaultProps,
36
36
  ...resolvedShorthand
37
37
  } : resolvedShorthand;
38
- }
38
+ };
39
39
 
40
40
  exports.resolveShorthand = resolveShorthand;
41
41
  //# sourceMappingURL=resolveShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compose/resolveShorthand.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AASA;;;;;AAKG;;;AACH,SAAgB,gBAAhB,CACE,KADF,EAEE,OAFF,EAEoD;AAElD,QAAM;AAAE,IAAA,QAAQ,GAAG,KAAb;AAAoB,IAAA;AAApB,MAAqC,OAAO,IAAI,EAAtD;;AACA,MAAI,KAAK,KAAK,IAAV,IAAmB,KAAK,KAAK,SAAV,IAAuB,CAAC,QAA/C,EAA0D;AACxD,WAAO,SAAP;AACD;;AAED,MAAI,iBAAiB,GAAG,EAAxB;;AAEA,MAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,OAAO,KAAP,KAAiB,QAA9C,IAA0D,KAAK,CAAC,OAAN,CAAc,KAAd,CAA1D,IAAkF,OAAA,CAAA,cAAA,CAAe,KAAf,CAAtF,EAA6G;AAC3G,IAAA,iBAAiB,CAAC,QAAlB,GAA6B,KAA7B;AACD,GAFD,MAEO,IAAI,OAAO,KAAP,KAAiB,QAArB,EAA+B;AACpC,IAAA,iBAAiB,GAAG,KAApB;AACD;;AAED,SAAQ,YAAY,GAAG,EAAE,GAAG,YAAL;AAAmB,OAAG;AAAtB,GAAH,GAA+C,iBAAnE;AAGD;;AApBD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourceRoot":""}
1
+ {"version":3,"sources":["../../src/compose/resolveShorthand.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAkBA;;;;;AAKG;;;AACI,MAAM,gBAAgB,GAA6B,CAAC,KAAD,EAAQ,OAAR,KAAmB;AAC3E,QAAM;AAAE,IAAA,QAAQ,GAAG,KAAb;AAAoB,IAAA;AAApB,MAAqC,OAAO,IAAI,EAAtD;;AACA,MAAI,KAAK,KAAK,IAAV,IAAmB,KAAK,KAAK,SAAV,IAAuB,CAAC,QAA/C,EAA0D;AACxD,WAAO,SAAP;AACD;;AAED,MAAI,iBAAiB,GAAG,EAAxB;;AAEA,MAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,OAAO,KAAP,KAAiB,QAA9C,IAA0D,KAAK,CAAC,OAAN,CAAc,KAAd,CAA1D,IAAkF,OAAA,CAAA,cAAA,CAAe,KAAf,CAAtF,EAA6G;AAC3G,IAAA,iBAAiB,CAAC,QAAlB,GAA6B,KAA7B;AACD,GAFD,MAEO,IAAI,OAAO,KAAP,KAAiB,QAArB,EAA+B;AACpC,IAAA,iBAAiB,GAAG,KAApB;AACD;;AAED,SAAO,YAAY,GAAG,EAAE,GAAG,YAAL;AAAmB,OAAG;AAAtB,GAAH,GAA+C,iBAAlE;AACD,CAfM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourceRoot":""}
@@ -1,47 +1,83 @@
1
1
  import * as React from 'react';
2
- export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
3
- export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
4
- export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | Props;
2
+ export declare type SlotRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
5
3
  /**
6
- * Matches any shorthand props type.
4
+ * Matches any component's Slots type (such as ButtonSlots).
7
5
  *
8
- * This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
6
+ * This should ONLY be used in type templates as in `extends SlotPropsRecord`;
7
+ * it shouldn't be used as a component's Slots type.
8
+ */
9
+ export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
10
+ /**
11
+ * The shorthand value of a slot allows specifying its child
12
+ */
13
+ export declare type SlotShorthandValue = React.ReactChild | React.ReactNodeArray | React.ReactPortal;
14
+ /**
15
+ * Matches any slot props type.
16
+ *
17
+ * This should ONLY be used in type templates as in `extends UnknownSlotProps`;
9
18
  * it shouldn't be used as the type of a slot.
10
19
  */
11
- export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
12
- children?: React.ReactNode;
20
+ export declare type UnknownSlotProps = Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
13
21
  as?: keyof JSX.IntrinsicElements;
14
- }>;
22
+ };
15
23
  /**
16
- * Defines the slot props for a slot that supports a Component type.
17
- *
18
- * For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
24
+ * Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.
19
25
  */
20
- export declare type ObjectShorthandProps<Props extends {
21
- children?: React.ReactNode;
22
- } = {}> = Props & {
23
- children?: Props['children'] | ShorthandRenderFunction<Props>;
26
+ declare type WithSlotShorthandValue<Props extends {
27
+ children?: unknown;
28
+ }> = Props | Extract<SlotShorthandValue, Props['children']>;
29
+ /**
30
+ * Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
31
+ * to be a render function that takes those props.
32
+ */
33
+ declare type WithSlotRenderFunction<Props extends {
34
+ children?: unknown;
35
+ }> = Props & {
36
+ children?: Props['children'] | SlotRenderFunction<Props>;
24
37
  };
25
38
  /**
26
- * Define the slot arguments for a slot that supports one or more intrinsic element types, such as 'div'.
27
- * For slots that support custom components, use {@link ObjectShorthandProps} instead.
39
+ * HTML element types that are not allowed to have children.
28
40
  *
29
- * The first param is the slot's default type if no `as` prop is specified.
30
- * The second param is an optional union of alternative types that can be specified for the `as` prop.
41
+ * Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
42
+ */
43
+ declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
44
+ /**
45
+ * Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
46
+ * * Removes legacy string ref.
47
+ * * Disallows children for empty tags like 'img'.
48
+ */
49
+ declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = React.PropsWithRef<JSX.IntrinsicElements[Type]> & (Type extends EmptyIntrisicElements ? {
50
+ children?: never;
51
+ } : {});
52
+ /**
53
+ * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
54
+ * or a component like `typeof Button`.
31
55
  *
56
+ * If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).
57
+ *
58
+ * By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,
59
+ * wrap with `NonNullable` (see examples below).
60
+ *
61
+ * @example
32
62
  * ```
33
- * IntrinsicShorthandProps<'div'> // Slot is always div
34
- * IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
35
- * IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
63
+ * // Intrinsic element examples:
64
+ * Slot<'div'> // Slot is always div
65
+ * Slot<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
66
+ * Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as="div" or as="pre"
67
+ * NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)
68
+ *
69
+ * // Component examples:
70
+ * Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props
71
+ * NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
36
72
  * ```
37
73
  */
38
- 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' : ({
39
- as?: DefaultAs;
40
- } & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[DefaultAs]>>) | {
74
+ export declare type Slot<Type extends keyof JSX.IntrinsicElements | React.ComponentType | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
75
+ as?: Type;
76
+ } & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
41
77
  [As in AlternateAs]: {
42
78
  as: As;
43
- } & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[As]>>;
44
- }[AlternateAs];
79
+ } & WithSlotRenderFunction<IntrisicElementProps<As>>;
80
+ }[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
45
81
  /**
46
82
  * Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.
47
83
  *
@@ -70,20 +106,35 @@ export declare type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> =
70
106
  export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
71
107
  /**
72
108
  * Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
73
- * IntrinsicShorthandProps). This allows IntrinsicShorthandProps to be used with React.forwardRef.
109
+ * IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
74
110
  *
75
111
  * The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional
76
112
  * types, to prevent unions from being expanded.
77
113
  */
78
114
  export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
79
- export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
80
- [Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
81
- }, Primary> & PropsWithoutRef<Shorthands[Primary]>;
82
- export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
83
- components?: {
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);
115
+ /**
116
+ * Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.
117
+ */
118
+ export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
119
+ /**
120
+ * Defines the Props type for a component given its slots and the definition of which one is the primary slot,
121
+ * defaulting to root if one is not provided.
122
+ */
123
+ export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
124
+ /**
125
+ * If type T includes `null`, remove it and add `undefined` instead.
126
+ */
127
+ export declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
128
+ /**
129
+ * Defines the State object of a component given its slots.
130
+ */
131
+ export declare type ComponentState<Slots extends SlotPropsRecord> = {
132
+ components: {
133
+ [Key in keyof Slots]-?: React.ComponentType<ExtractSlotProps<Slots[Key]>> | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
85
134
  };
86
- } & Shorthands;
135
+ } & {
136
+ [Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
137
+ };
87
138
  /**
88
139
  * This is part of a hack to infer the element type from a native element *props* type.
89
140
  * The only place the original element is found in a native props type (at least that's workable
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":";;;;IA2IA;AACA;AACA;AACA;AACA","sourceRoot":""}
1
+ {"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":";;;;IAqNA;AACA;AACA;AACA;AACA","sourceRoot":""}
@@ -1,11 +1,11 @@
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';
8
7
  export * from './useIsomorphicLayoutEffect';
8
+ export * from './useMergedEventCallbacks';
9
9
  export * from './useMergedRefs';
10
10
  export * from './useMount';
11
11
  export * from './useOnClickOutside';