@fluentui/react-utilities 9.9.1 → 9.9.2

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 (172) hide show
  1. package/CHANGELOG.json +16 -1
  2. package/CHANGELOG.md +11 -2
  3. package/dist/index.d.ts +1 -1
  4. package/lib/compose/constants.js +1 -2
  5. package/lib/compose/constants.js.map +1 -1
  6. package/lib/compose/getSlots.js +40 -36
  7. package/lib/compose/getSlots.js.map +1 -1
  8. package/lib/compose/getSlotsNext.js +30 -28
  9. package/lib/compose/getSlotsNext.js.map +1 -1
  10. package/lib/compose/index.js +0 -1
  11. package/lib/compose/index.js.map +1 -1
  12. package/lib/compose/isResolvedShorthand.js +2 -4
  13. package/lib/compose/isResolvedShorthand.js.map +1 -1
  14. package/lib/compose/resolveShorthand.js +21 -26
  15. package/lib/compose/resolveShorthand.js.map +1 -1
  16. package/lib/compose/types.js +0 -1
  17. package/lib/compose/types.js.map +1 -1
  18. package/lib/events/index.js +0 -1
  19. package/lib/events/index.js.map +1 -1
  20. package/lib/events/mouseTouchHelpers.js +27 -27
  21. package/lib/events/mouseTouchHelpers.js.map +1 -1
  22. package/lib/hooks/index.js +0 -1
  23. package/lib/hooks/index.js.map +1 -1
  24. package/lib/hooks/useControllableState.js +55 -42
  25. package/lib/hooks/useControllableState.js.map +1 -1
  26. package/lib/hooks/useEventCallback.js +15 -13
  27. package/lib/hooks/useEventCallback.js.map +1 -1
  28. package/lib/hooks/useFirstMount.js +7 -9
  29. package/lib/hooks/useFirstMount.js.map +1 -1
  30. package/lib/hooks/useForceUpdate.js +2 -4
  31. package/lib/hooks/useForceUpdate.js.map +1 -1
  32. package/lib/hooks/useId.js +32 -29
  33. package/lib/hooks/useId.js.map +1 -1
  34. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  35. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  36. package/lib/hooks/useMergedRefs.js +17 -18
  37. package/lib/hooks/useMergedRefs.js.map +1 -1
  38. package/lib/hooks/useOnClickOutside.js +110 -114
  39. package/lib/hooks/useOnClickOutside.js.map +1 -1
  40. package/lib/hooks/useOnScrollOutside.js +25 -29
  41. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  42. package/lib/hooks/usePrevious.js +8 -8
  43. package/lib/hooks/usePrevious.js.map +1 -1
  44. package/lib/hooks/useScrollbarWidth.js +24 -26
  45. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  46. package/lib/hooks/useTimeout.js +22 -19
  47. package/lib/hooks/useTimeout.js.map +1 -1
  48. package/lib/index.js +0 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/ssr/SSRContext.js +40 -39
  51. package/lib/ssr/SSRContext.js.map +1 -1
  52. package/lib/ssr/canUseDOM.js +3 -5
  53. package/lib/ssr/canUseDOM.js.map +1 -1
  54. package/lib/ssr/index.js +0 -1
  55. package/lib/ssr/index.js.map +1 -1
  56. package/lib/trigger/applyTriggerPropsToChildren.js +20 -23
  57. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  58. package/lib/trigger/getTriggerChild.js +7 -10
  59. package/lib/trigger/getTriggerChild.js.map +1 -1
  60. package/lib/trigger/index.js +0 -1
  61. package/lib/trigger/index.js.map +1 -1
  62. package/lib/trigger/isFluentTrigger.js +2 -4
  63. package/lib/trigger/isFluentTrigger.js.map +1 -1
  64. package/lib/trigger/types.js +0 -1
  65. package/lib/trigger/types.js.map +1 -1
  66. package/lib/utils/clamp.js +1 -2
  67. package/lib/utils/clamp.js.map +1 -1
  68. package/lib/utils/getNativeElementProps.js +38 -40
  69. package/lib/utils/getNativeElementProps.js.map +1 -1
  70. package/lib/utils/getRTLSafeKey.js +12 -13
  71. package/lib/utils/getRTLSafeKey.js.map +1 -1
  72. package/lib/utils/getReactCallbackName.js +16 -15
  73. package/lib/utils/getReactCallbackName.js.map +1 -1
  74. package/lib/utils/index.js +0 -1
  75. package/lib/utils/index.js.map +1 -1
  76. package/lib/utils/isHTMLElement.js +5 -6
  77. package/lib/utils/isHTMLElement.js.map +1 -1
  78. package/lib/utils/isInteractiveHTMLElement.js +13 -17
  79. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  80. package/lib/utils/mergeCallbacks.js +5 -6
  81. package/lib/utils/mergeCallbacks.js.map +1 -1
  82. package/lib/utils/omit.js +7 -8
  83. package/lib/utils/omit.js.map +1 -1
  84. package/lib/utils/priorityQueue.js +85 -86
  85. package/lib/utils/priorityQueue.js.map +1 -1
  86. package/lib/utils/properties.js +290 -80
  87. package/lib/utils/properties.js.map +1 -1
  88. package/lib-commonjs/compose/constants.js +1 -3
  89. package/lib-commonjs/compose/constants.js.map +1 -1
  90. package/lib-commonjs/compose/getSlots.js +1 -3
  91. package/lib-commonjs/compose/getSlots.js.map +1 -1
  92. package/lib-commonjs/compose/getSlotsNext.js +2 -3
  93. package/lib-commonjs/compose/getSlotsNext.js.map +1 -1
  94. package/lib-commonjs/compose/index.js +0 -3
  95. package/lib-commonjs/compose/index.js.map +1 -1
  96. package/lib-commonjs/compose/isResolvedShorthand.js +1 -3
  97. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  98. package/lib-commonjs/compose/resolveShorthand.js +1 -3
  99. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  100. package/lib-commonjs/compose/types.js +0 -3
  101. package/lib-commonjs/compose/types.js.map +1 -1
  102. package/lib-commonjs/events/index.js +0 -3
  103. package/lib-commonjs/events/index.js.map +1 -1
  104. package/lib-commonjs/events/mouseTouchHelpers.js +1 -3
  105. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  106. package/lib-commonjs/hooks/index.js +0 -3
  107. package/lib-commonjs/hooks/index.js.map +1 -1
  108. package/lib-commonjs/hooks/useControllableState.js +1 -3
  109. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  110. package/lib-commonjs/hooks/useEventCallback.js +1 -3
  111. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  112. package/lib-commonjs/hooks/useFirstMount.js +1 -3
  113. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  114. package/lib-commonjs/hooks/useForceUpdate.js +1 -3
  115. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  116. package/lib-commonjs/hooks/useId.js +1 -3
  117. package/lib-commonjs/hooks/useId.js.map +1 -1
  118. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -3
  119. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  120. package/lib-commonjs/hooks/useMergedRefs.js +2 -5
  121. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  122. package/lib-commonjs/hooks/useOnClickOutside.js +1 -3
  123. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  124. package/lib-commonjs/hooks/useOnScrollOutside.js +1 -3
  125. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  126. package/lib-commonjs/hooks/usePrevious.js +1 -3
  127. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  128. package/lib-commonjs/hooks/useScrollbarWidth.js +2 -4
  129. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  130. package/lib-commonjs/hooks/useTimeout.js +1 -3
  131. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  132. package/lib-commonjs/index.js +0 -3
  133. package/lib-commonjs/index.js.map +1 -1
  134. package/lib-commonjs/ssr/SSRContext.js +1 -3
  135. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  136. package/lib-commonjs/ssr/canUseDOM.js +1 -3
  137. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  138. package/lib-commonjs/ssr/index.js +0 -3
  139. package/lib-commonjs/ssr/index.js.map +1 -1
  140. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +1 -3
  141. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  142. package/lib-commonjs/trigger/getTriggerChild.js +2 -5
  143. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  144. package/lib-commonjs/trigger/index.js +0 -3
  145. package/lib-commonjs/trigger/index.js.map +1 -1
  146. package/lib-commonjs/trigger/isFluentTrigger.js +1 -3
  147. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  148. package/lib-commonjs/trigger/types.js +0 -3
  149. package/lib-commonjs/trigger/types.js.map +1 -1
  150. package/lib-commonjs/utils/clamp.js +1 -3
  151. package/lib-commonjs/utils/clamp.js.map +1 -1
  152. package/lib-commonjs/utils/getNativeElementProps.js +1 -3
  153. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  154. package/lib-commonjs/utils/getRTLSafeKey.js +1 -3
  155. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  156. package/lib-commonjs/utils/getReactCallbackName.js +1 -3
  157. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  158. package/lib-commonjs/utils/index.js +0 -3
  159. package/lib-commonjs/utils/index.js.map +1 -1
  160. package/lib-commonjs/utils/isHTMLElement.js +1 -3
  161. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  162. package/lib-commonjs/utils/isInteractiveHTMLElement.js +1 -3
  163. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  164. package/lib-commonjs/utils/mergeCallbacks.js +1 -3
  165. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  166. package/lib-commonjs/utils/omit.js +1 -3
  167. package/lib-commonjs/utils/omit.js.map +1 -1
  168. package/lib-commonjs/utils/priorityQueue.js +5 -7
  169. package/lib-commonjs/utils/priorityQueue.js.map +1 -1
  170. package/lib-commonjs/utils/properties.js +28 -31
  171. package/lib-commonjs/utils/properties.js.map +1 -1
  172. package/package.json +1 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 25 May 2023 09:57:45 GMT",
5
+ "date": "Wed, 31 May 2023 06:43:05 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.9.2",
7
+ "version": "9.9.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "commit": "4b637ced41e430bf8d79c7fc67c103d5efdfd3a8",
14
+ "comment": "fix: tweak type errors exposed in ts 4.5"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 25 May 2023 10:00:48 GMT",
6
21
  "tag": "@fluentui/react-utilities_v9.9.1",
7
22
  "version": "9.9.1",
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 Thu, 25 May 2023 09:57:45 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 31 May 2023 06:43:05 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.9.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.9.2)
8
+
9
+ Wed, 31 May 2023 06:43:05 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.9.1..@fluentui/react-utilities_v9.9.2)
11
+
12
+ ### Patches
13
+
14
+ - fix: tweak type errors exposed in ts 4.5 ([PR #27936](https://github.com/microsoft/fluentui/pull/27936) by martinhochel@microsoft.com)
15
+
7
16
  ## [9.9.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.9.1)
8
17
 
9
- Thu, 25 May 2023 09:57:45 GMT
18
+ Thu, 25 May 2023 10:00:48 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.9.0..@fluentui/react-utilities_v9.9.1)
11
20
 
12
21
  ### Patches
package/dist/index.d.ts CHANGED
@@ -199,7 +199,7 @@ export declare function getTriggerChild<TriggerChildProps>(children: TriggerProp
199
199
  /**
200
200
  * @internal
201
201
  */
202
- declare type HTMLElementConstructorName = 'HTMLElement' | 'HTMLAnchorElement' | 'HTMLAreaElement' | 'HTMLAudioElement' | 'HTMLBaseElement' | 'HTMLBodyElement' | 'HTMLBRElement' | 'HTMLButtonElement' | 'HTMLCanvasElement' | 'HTMLDataElement' | 'HTMLDataListElement' | 'HTMLDetailsElement' | 'HTMLDialogElement' | 'HTMLDivElement' | 'HTMLDListElement' | 'HTMLEmbedElement' | 'HTMLFieldSetElement' | 'HTMLFormElement' | 'HTMLHeadingElement' | 'HTMLHeadElement' | 'HTMLHRElement' | 'HTMLHtmlElement' | 'HTMLIFrameElement' | 'HTMLImageElement' | 'HTMLInputElement' | 'HTMLModElement' | 'HTMLLabelElement' | 'HTMLLegendElement' | 'HTMLLIElement' | 'HTMLLinkElement' | 'HTMLMapElement' | 'HTMLMetaElement' | 'HTMLMeterElement' | 'HTMLObjectElement' | 'HTMLOListElement' | 'HTMLOptGroupElement' | 'HTMLOptionElement' | 'HTMLOutputElement' | 'HTMLParagraphElement' | 'HTMLParamElement' | 'HTMLPreElement' | 'HTMLProgressElement' | 'HTMLQuoteElement' | 'HTMLSlotElement' | 'HTMLScriptElement' | 'HTMLSelectElement' | 'HTMLSourceElement' | 'HTMLSpanElement' | 'HTMLStyleElement' | 'HTMLTableElement' | 'HTMLTableColElement' | 'HTMLTableRowElement' | 'HTMLTableSectionElement' | 'HTMLTemplateElement' | 'HTMLTextAreaElement' | 'HTMLTimeElement' | 'HTMLTitleElement' | 'HTMLTrackElement' | 'HTMLUListElement' | 'HTMLVideoElement';
202
+ declare type HTMLElementConstructorName = 'HTMLElement' | 'HTMLAnchorElement' | 'HTMLAreaElement' | 'HTMLAudioElement' | 'HTMLBaseElement' | 'HTMLBodyElement' | 'HTMLBRElement' | 'HTMLButtonElement' | 'HTMLCanvasElement' | 'HTMLDataElement' | 'HTMLDataListElement' | 'HTMLDetailsElement' | 'HTMLDivElement' | 'HTMLDListElement' | 'HTMLEmbedElement' | 'HTMLFieldSetElement' | 'HTMLFormElement' | 'HTMLHeadingElement' | 'HTMLHeadElement' | 'HTMLHRElement' | 'HTMLHtmlElement' | 'HTMLIFrameElement' | 'HTMLImageElement' | 'HTMLInputElement' | 'HTMLModElement' | 'HTMLLabelElement' | 'HTMLLegendElement' | 'HTMLLIElement' | 'HTMLLinkElement' | 'HTMLMapElement' | 'HTMLMetaElement' | 'HTMLMeterElement' | 'HTMLObjectElement' | 'HTMLOListElement' | 'HTMLOptGroupElement' | 'HTMLOptionElement' | 'HTMLOutputElement' | 'HTMLParagraphElement' | 'HTMLParamElement' | 'HTMLPreElement' | 'HTMLProgressElement' | 'HTMLQuoteElement' | 'HTMLSlotElement' | 'HTMLScriptElement' | 'HTMLSelectElement' | 'HTMLSourceElement' | 'HTMLSpanElement' | 'HTMLStyleElement' | 'HTMLTableElement' | 'HTMLTableColElement' | 'HTMLTableRowElement' | 'HTMLTableSectionElement' | 'HTMLTemplateElement' | 'HTMLTextAreaElement' | 'HTMLTimeElement' | 'HTMLTitleElement' | 'HTMLTrackElement' | 'HTMLUListElement' | 'HTMLVideoElement';
203
203
 
204
204
  /**
205
205
  * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions
@@ -1,5 +1,4 @@
1
1
  /**
2
2
  * @internal
3
3
  * Internal reference for the render function
4
- */export const SLOT_RENDER_FUNCTION_SYMBOL = /*#__PURE__*/Symbol('fui.slotRenderFunction');
5
- //# sourceMappingURL=constants.js.map
4
+ */ export const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');
@@ -1 +1 @@
1
- {"version":3,"names":["SLOT_RENDER_FUNCTION_SYMBOL","Symbol"],"sources":["../../src/compose/constants.ts"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */\nexport const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');\n"],"mappings":"AAAA;;;GAIA,OAAO,MAAMA,2BAAA,gBAA8BC,MAAA,CAAO"}
1
+ {"version":3,"sources":["constants.ts"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */\nexport const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');\n"],"names":["SLOT_RENDER_FUNCTION_SYMBOL","Symbol"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,8BAA8BC,OAAO,0BAA0B"}
@@ -17,42 +17,46 @@ import { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';
17
17
  *
18
18
  * @param state - State including slot definitions
19
19
  * @returns An object containing the `slots` map and `slotProps` map.
20
- */
21
- export function getSlots(state) {
22
- const slots = {};
23
- const slotProps = {};
24
- const slotNames = Object.keys(state.components);
25
- for (const slotName of slotNames) {
26
- const [slot, props] = getSlot(state, slotName);
27
- slots[slotName] = slot;
28
- slotProps[slotName] = props;
29
- }
30
- return {
31
- slots,
32
- slotProps: slotProps
33
- };
20
+ */ export function getSlots(state) {
21
+ const slots = {};
22
+ const slotProps = {};
23
+ const slotNames = Object.keys(state.components);
24
+ for (const slotName of slotNames){
25
+ const [slot, props] = getSlot(state, slotName);
26
+ slots[slotName] = slot;
27
+ slotProps[slotName] = props;
28
+ }
29
+ return {
30
+ slots,
31
+ slotProps: slotProps
32
+ };
34
33
  }
35
34
  function getSlot(state, slotName) {
36
- var _state_components, _state_components1;
37
- const props = state[slotName];
38
- if (props === undefined) {
39
- return [null, undefined];
40
- }
41
- const {
42
- children,
43
- as: asProp,
44
- [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,
45
- ...rest
46
- } = props;
47
- const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
48
- if (renderFunction || typeof children === 'function') {
49
- const render = renderFunction || children;
50
- return [React.Fragment, {
51
- children: render(slot, rest)
52
- }];
53
- }
54
- const shouldOmitAsProp = typeof slot === 'string' && asProp;
55
- const slotProps = shouldOmitAsProp ? omit(props, ['as']) : props;
56
- return [slot, slotProps];
35
+ var _state_components, _state_components1;
36
+ const props = state[slotName];
37
+ if (props === undefined) {
38
+ return [
39
+ null,
40
+ undefined
41
+ ];
42
+ }
43
+ const { children , as: asProp , [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction , ...rest } = props;
44
+ const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
45
+ if (renderFunction || typeof children === 'function') {
46
+ const render = renderFunction || children;
47
+ return [
48
+ React.Fragment,
49
+ {
50
+ children: render(slot, rest)
51
+ }
52
+ ];
53
+ }
54
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
55
+ const slotProps = shouldOmitAsProp ? omit(props, [
56
+ 'as'
57
+ ]) : props;
58
+ return [
59
+ slot,
60
+ slotProps
61
+ ];
57
62
  }
58
- //# sourceMappingURL=getSlots.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","omit","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","children","as","asProp","renderFunction","rest","render","Fragment","shouldOmitAsProp"],"sources":["../../src/compose/getSlots.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n UnknownSlotProps,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n const {\n children,\n as: asProp,\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,\n ...rest\n } = props as typeof props & { [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<R[K]> };\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || (children as SlotRenderFunction<R[K]>);\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [slot, slotProps];\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,SAASC,IAAI,QAAQ;AACrB,SAASC,2BAA2B,QAAQ;AA8B5C;;;;;;;;;;;;;;;;;AAiBA,OAAO,SAASC,SACdC,KAAwB,EAIxB;EACA,MAAMC,KAAA,GAAQ,CAAC;EACf,MAAMC,SAAA,GAAY,CAAC;EAEnB,MAAMC,SAAA,GAAyBC,MAAA,CAAOC,IAAI,CAACL,KAAA,CAAMM,UAAU;EAC3D,KAAK,MAAMC,QAAA,IAAYJ,SAAA,EAAW;IAChC,MAAM,CAACK,IAAA,EAAMC,KAAA,CAAM,GAAGC,OAAA,CAAQV,KAAA,EAAOO,QAAA;IACrCN,KAAK,CAACM,QAAA,CAAS,GAAGC,IAAA;IAClBN,SAAS,CAACK,QAAA,CAAS,GAAGE,KAAA;EACxB;EACA,OAAO;IAAER,KAAA;IAAOC,SAAA,EAAWA;EAA2C;AACxE;AAEA,SAASQ,QACPV,KAAwB,EACxBO,QAAW,EACsC;MAe/CI,iBAAA,EACcC,kBAAA;EAfhB,MAAMH,KAAA,GAAQT,KAAK,CAACO,QAAA,CAAS;EAE7B,IAAIE,KAAA,KAAUI,SAAA,EAAW;IACvB,OAAO,CAAC,IAAI,EAAEA,SAAA,CAAkB;EAClC;EAEA,MAAM;IACJC,QAAA;IACAC,EAAA,EAAIC,MAAA;IACJ,CAAClB,2BAAA,GAA8BmB,cAAA;IAC/B,GAAGC;EAAA,CACJ,GAAGT,KAAA;EAEJ,MAAMD,IAAA,GACJ,EAAAG,iBAAA,GAAAX,KAAA,CAAMM,UAAU,cAAhBK,iBAAA,uBAAAA,iBAAkB,CAACJ,QAAA,CAAS,MAAKM,SAAA,IAAa,OAAOb,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS,KAAK,WAChFS,MAAA,KAAU,CAAAJ,kBAAA,GAAAZ,KAAA,CAAMM,UAAU,cAAhBM,kBAAA,uBAAAA,kBAAkB,CAACL,QAAA,CAAS,CAAD,IAAK,QAC1CP,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS;EAGhC,IAAIU,cAAA,IAAkB,OAAOH,QAAA,KAAa,YAAY;IACpD,MAAMK,MAAA,GAASF,cAAA,IAAmBH,QAAA;IAClC,OAAO,CACLlB,KAAA,CAAMwB,QAAQ,EACd;MACEN,QAAA,EAAUK,MAAA,CAAOX,IAAA,EAAMU,IAAA;IACzB,EACD;EACH;EAEA,MAAMG,gBAAA,GAAmB,OAAOb,IAAA,KAAS,YAAYQ,MAAA;EACrD,MAAMd,SAAA,GAAamB,gBAAA,GAAmBxB,IAAA,CAAKY,KAAA,EAAO,CAAC,KAAK,IAAKA,KAA0B;EACvF,OAAO,CAACD,IAAA,EAAMN,SAAA,CAAU;AAC1B"}
1
+ {"version":3,"sources":["getSlots.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n UnknownSlotProps,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n const {\n children,\n as: asProp,\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,\n ...rest\n } = props as typeof props & { [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<R[K]> };\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || (children as SlotRenderFunction<R[K]>);\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [slot, slotProps];\n}\n"],"names":["React","omit","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","children","as","asProp","renderFunction","rest","render","Fragment","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,2BAA2B,QAAQ,cAAc;AA8B1D;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,SACdC,KAAwB,EAIxB;IACA,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE,CAAC;AAED,SAASQ,QACPV,KAAwB,EACxBO,QAAW,EACsC;QAe/CP,mBACcA;IAfhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAkB;IAClC,CAAC;IAED,MAAM,EACJC,SAAQ,EACRC,IAAIC,OAAM,EACV,CAAChB,4BAA4B,EAAEiB,eAAc,EAC7C,GAAGC,MACJ,GAAGP;IAEJ,MAAMD,OACJR,CAAAA,CAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,+BAAAA,KAAAA,IAAAA,iBAAkB,CAACO,SAAS,AAAD,MAAMI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFO,UAAUd,CAAAA,CAAAA,qBAAAA,MAAMM,UAAU,cAAhBN,gCAAAA,KAAAA,IAAAA,kBAAkB,CAACO,SAAS,AAAD,KAAK,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,IAAIQ,kBAAkB,OAAOH,aAAa,YAAY;QACpD,MAAMK,SAASF,kBAAmBH;QAClC,OAAO;YACLhB,MAAMsB,QAAQ;YACd;gBACEN,UAAUK,OAAOT,MAAMQ;YACzB;SACD;IACH,CAAC;IAED,MAAMG,mBAAmB,OAAOX,SAAS,YAAYM;IACrD,MAAMZ,YAAaiB,mBAAmBtB,KAAKY,OAAO;QAAC;KAAK,IAAKA,KAA0B;IACvF,OAAO;QAACD;QAAMN;KAAU;AAC1B"}
@@ -1,34 +1,36 @@
1
1
  import * as React from 'react';
2
2
  /**
3
3
  * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma
4
- */
5
- export function getSlotsNext(state) {
6
- const slots = {};
7
- const slotProps = {};
8
- const slotNames = Object.keys(state.components);
9
- for (const slotName of slotNames) {
10
- const [slot, props] = getSlotNext(state, slotName);
11
- slots[slotName] = slot;
12
- slotProps[slotName] = props;
13
- }
14
- return {
15
- slots,
16
- slotProps: slotProps
17
- };
4
+ */ export function getSlotsNext(state) {
5
+ const slots = {};
6
+ const slotProps = {};
7
+ const slotNames = Object.keys(state.components);
8
+ for (const slotName of slotNames){
9
+ const [slot, props] = getSlotNext(state, slotName);
10
+ slots[slotName] = slot;
11
+ slotProps[slotName] = props;
12
+ }
13
+ return {
14
+ slots,
15
+ slotProps: slotProps
16
+ };
18
17
  }
19
18
  function getSlotNext(state, slotName) {
20
- var _state_components, _state_components1;
21
- const props = state[slotName];
22
- if (props === undefined) {
23
- return [null, undefined];
24
- }
25
- const {
26
- as: asProp,
27
- ...propsWithoutAs
28
- } = props;
29
- const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
30
- const shouldOmitAsProp = typeof slot === 'string' && asProp;
31
- const slotProps = shouldOmitAsProp ? propsWithoutAs : props;
32
- return [slot, slotProps];
19
+ var _state_components, _state_components1;
20
+ const props = state[slotName];
21
+ if (props === undefined) {
22
+ return [
23
+ null,
24
+ undefined
25
+ ];
26
+ }
27
+ // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)
28
+ const { as: asProp , ...propsWithoutAs } = props;
29
+ const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
30
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
31
+ const slotProps = shouldOmitAsProp ? propsWithoutAs : props;
32
+ return [
33
+ slot,
34
+ slotProps
35
+ ];
33
36
  }
34
- //# sourceMappingURL=getSlotsNext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"sources":["../../src/compose/getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from './types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n const { as: asProp, ...propsWithoutAs } = props;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIvB;;;AAGA,OAAO,SAASC,aACdC,KAAwB,EAIxB;EACA,MAAMC,KAAA,GAAQ,CAAC;EACf,MAAMC,SAAA,GAAY,CAAC;EAEnB,MAAMC,SAAA,GAAyBC,MAAA,CAAOC,IAAI,CAACL,KAAA,CAAMM,UAAU;EAC3D,KAAK,MAAMC,QAAA,IAAYJ,SAAA,EAAW;IAChC,MAAM,CAACK,IAAA,EAAMC,KAAA,CAAM,GAAGC,WAAA,CAAYV,KAAA,EAAOO,QAAA;IACzCN,KAAK,CAACM,QAAA,CAAS,GAAGC,IAAA;IAClBN,SAAS,CAACK,QAAA,CAAS,GAAGE,KAAA;EACxB;EACA,OAAO;IAAER,KAAA;IAAOC,SAAA,EAAWA;EAA2C;AACxE;AAEA,SAASQ,YACPV,KAAwB,EACxBO,QAAW,EACsC;MAS/CI,iBAAA,EACcC,kBAAA;EAThB,MAAMH,KAAA,GAAQT,KAAK,CAACO,QAAA,CAAS;EAE7B,IAAIE,KAAA,KAAUI,SAAA,EAAW;IACvB,OAAO,CAAC,IAAI,EAAEA,SAAA,CAAkB;EAClC;EACA,MAAM;IAAEC,EAAA,EAAIC,MAAA;IAAQ,GAAGC;EAAA,CAAgB,GAAGP,KAAA;EAE1C,MAAMD,IAAA,GACJ,EAAAG,iBAAA,GAAAX,KAAA,CAAMM,UAAU,cAAhBK,iBAAA,uBAAAA,iBAAkB,CAACJ,QAAA,CAAS,MAAKM,SAAA,IAAa,OAAOb,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS,KAAK,WAChFQ,MAAA,KAAU,CAAAH,kBAAA,GAAAZ,KAAA,CAAMM,UAAU,cAAhBM,kBAAA,uBAAAA,kBAAkB,CAACL,QAAA,CAAS,CAAD,IAAK,QAC1CP,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS;EAGhC,MAAMU,gBAAA,GAAmB,OAAOT,IAAA,KAAS,YAAYO,MAAA;EACrD,MAAMb,SAAA,GAA8Be,gBAAA,GAAmBD,cAAA,GAAiBP,KAAK;EAE7E,OAAO,CAACD,IAAA,EAAMN,SAAA,CAAkB;AAClC"}
1
+ {"version":3,"sources":["getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from './types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,SAASC,aACdC,KAAwB,EAIxB;IACA,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE,CAAC;AAED,SAASQ,YACPV,KAAwB,EACxBO,QAAW,EACsC;QAY/CP,mBACcA;IAZhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAkB;IAClC,CAAC;IAGD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJR,CAAAA,CAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,+BAAAA,KAAAA,IAAAA,iBAAkB,CAACO,SAAS,AAAD,MAAMI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,UAAUb,CAAAA,CAAAA,qBAAAA,MAAMM,UAAU,cAAhBN,gCAAAA,KAAAA,IAAAA,kBAAkB,CAACO,SAAS,AAAD,KAAK,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL,KAAK;IAE7E,OAAO;QAACD;QAAMN;KAAkB;AAClC"}
@@ -4,4 +4,3 @@ export * from './types';
4
4
  export * from './isResolvedShorthand';
5
5
  export * from './constants';
6
6
  export * from './getSlotsNext';
7
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/compose/index.ts"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n"],"names":[],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,qBAAqB;AACnC,cAAc,UAAU;AACxB,cAAc,wBAAwB;AACtC,cAAc,cAAc;AAC5B,cAAc,iBAAiB"}
@@ -28,8 +28,6 @@ import { isValidElement } from 'react';
28
28
  * )
29
29
  * })
30
30
  * ```
31
- */
32
- export function isResolvedShorthand(shorthand) {
33
- return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);
31
+ */ export function isResolvedShorthand(shorthand) {
32
+ return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);
34
33
  }
35
- //# sourceMappingURL=isResolvedShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isValidElement","isResolvedShorthand","shorthand","Array","isArray"],"sources":["../../src/compose/isResolvedShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { ExtractSlotProps, Slot, UnknownSlotProps } from './types';\n\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand<Shorthand extends Slot<UnknownSlotProps>>(\n shorthand?: Shorthand,\n): shorthand is ExtractSlotProps<Shorthand> {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAO,SAASC,oBACdC,SAAqB,EACqB;EAC1C,OAAOA,SAAA,KAAc,IAAI,IAAI,OAAOA,SAAA,KAAc,YAAY,CAACC,KAAA,CAAMC,OAAO,CAACF,SAAA,KAAc,eAACF,cAAA,CAAeE,SAAA;AAC7G"}
1
+ {"version":3,"sources":["isResolvedShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { ExtractSlotProps, Slot, UnknownSlotProps } from './types';\n\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand<Shorthand extends Slot<UnknownSlotProps>>(\n shorthand?: Shorthand,\n): shorthand is ExtractSlotProps<Shorthand> {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"names":["isValidElement","isResolvedShorthand","shorthand","Array","isArray"],"mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AAGvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC,oBACdC,SAAqB,EACqB;IAC1C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,CAACF,eAAeE;AAC7G,CAAC"}
@@ -5,30 +5,25 @@ import { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';
5
5
  * being passed down to getSlots method
6
6
  * @param value - the base shorthand props
7
7
  * @param options - options to resolve shorthand props
8
- */
9
- export const resolveShorthand = (value, options) => {
10
- const {
11
- required = false,
12
- defaultProps
13
- } = options || {};
14
- if (value === null || value === undefined && !required) {
15
- return undefined;
16
- }
17
- let resolvedShorthand = {};
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {
20
- resolvedShorthand.children = value;
21
- } else if (typeof value === 'object') {
22
- resolvedShorthand = value;
23
- }
24
- resolvedShorthand = {
25
- ...defaultProps,
26
- ...resolvedShorthand
27
- };
28
- if (typeof resolvedShorthand.children === 'function') {
29
- resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;
30
- resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
31
- }
32
- return resolvedShorthand;
8
+ */ export const resolveShorthand = (value, options)=>{
9
+ const { required =false , defaultProps } = options || {};
10
+ if (value === null || value === undefined && !required) {
11
+ return undefined;
12
+ }
13
+ let resolvedShorthand = {};
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {
16
+ resolvedShorthand.children = value;
17
+ } else if (typeof value === 'object') {
18
+ resolvedShorthand = value;
19
+ }
20
+ resolvedShorthand = {
21
+ ...defaultProps,
22
+ ...resolvedShorthand
23
+ };
24
+ if (typeof resolvedShorthand.children === 'function') {
25
+ resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;
26
+ resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
27
+ }
28
+ return resolvedShorthand;
33
29
  };
34
- //# sourceMappingURL=resolveShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isValidElement","SLOT_RENDER_FUNCTION_SYMBOL","resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","children"],"sources":["../../src/compose/resolveShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { SlotRenderFunction, SlotShorthandValue, UnknownSlotProps } from './types';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand: UnknownSlotProps & {\n [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<UnknownSlotProps>;\n } = {};\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement<any>(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand,\n };\n\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children as SlotRenderFunction<UnknownSlotProps>;\n resolvedShorthand.children = defaultProps?.children;\n }\n\n return resolvedShorthand;\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ;AAa5C;;;;;;AAMA,OAAO,MAAMC,gBAAA,GAA6CA,CAACC,KAAA,EAAOC,OAAA,KAAY;EAC5E,MAAM;IAAEC,QAAA,GAAW,KAAK;IAAEC;EAAY,CAAE,GAAGF,OAAA,IAAW,CAAC;EACvD,IAAID,KAAA,KAAU,IAAI,IAAKA,KAAA,KAAUI,SAAA,IAAa,CAACF,QAAA,EAAW;IACxD,OAAOE,SAAA;EACT;EAEA,IAAIC,iBAAA,GAEA,CAAC;EAEL;EACA,IAAI,OAAOL,KAAA,KAAU,YAAY,OAAOA,KAAA,KAAU,YAAYM,KAAA,CAAMC,OAAO,CAACP,KAAA,kBAAUH,cAAA,CAAoBG,KAAA,GAAQ;IAChHK,iBAAA,CAAkBG,QAAQ,GAAGR,KAAA;EAC/B,OAAO,IAAI,OAAOA,KAAA,KAAU,UAAU;IACpCK,iBAAA,GAAoBL,KAAA;EACtB;EAEAK,iBAAA,GAAoB;IAClB,GAAGF,YAAY;IACf,GAAGE;EACL;EAEA,IAAI,OAAOA,iBAAA,CAAkBG,QAAQ,KAAK,YAAY;IACpDH,iBAAiB,CAACP,2BAAA,CAA4B,GAAGO,iBAAA,CAAkBG,QAAQ;IAC3EH,iBAAA,CAAkBG,QAAQ,GAAGL,YAAA,aAAAA,YAAA,uBAAAA,YAAA,CAAcK,QAAQ;EACrD;EAEA,OAAOH,iBAAA;AACT"}
1
+ {"version":3,"sources":["resolveShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { SlotRenderFunction, SlotShorthandValue, UnknownSlotProps } from './types';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand: UnknownSlotProps & {\n [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<UnknownSlotProps>;\n } = {};\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement<any>(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand,\n };\n\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children as SlotRenderFunction<UnknownSlotProps>;\n resolvedShorthand.children = defaultProps?.children;\n }\n\n return resolvedShorthand;\n};\n"],"names":["isValidElement","SLOT_RENDER_FUNCTION_SYMBOL","resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","children"],"mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AAEvC,SAASC,2BAA2B,QAAQ,cAAc;AAa1D;;;;;CAKC,GACD,OAAO,MAAMC,mBAA6C,CAACC,OAAOC,UAAY;IAC5E,MAAM,EAAEC,UAAW,KAAK,CAAA,EAAEC,aAAY,EAAE,GAAGF,WAAW,CAAC;IACvD,IAAID,UAAU,IAAI,IAAKA,UAAUI,aAAa,CAACF,UAAW;QACxD,OAAOE;IACT,CAAC;IAED,IAAIC,oBAEA,CAAC;IAEL,8DAA8D;IAC9D,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAUH,eAAoBG,QAAQ;QAChHK,kBAAkBG,QAAQ,GAAGR;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoBL;IACtB,CAAC;IAEDK,oBAAoB;QAClB,GAAGF,YAAY;QACf,GAAGE,iBAAiB;IACtB;IAEA,IAAI,OAAOA,kBAAkBG,QAAQ,KAAK,YAAY;QACpDH,iBAAiB,CAACP,4BAA4B,GAAGO,kBAAkBG,QAAQ;QAC3EH,kBAAkBG,QAAQ,GAAGL,yBAAAA,0BAAAA,KAAAA,IAAAA,aAAcK,QAAQ;IACrD,CAAC;IAED,OAAOH;AACT,EAAE"}
@@ -1,2 +1 @@
1
1
  import * as React from 'react';
2
- //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../../src/compose/types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type SlotRenderFunction<Props> = (\n Component: React.ElementType<Props>,\n props: Omit<Props, 'as'>,\n) => React.ReactNode;\n\n/**\n * Matches any component's Slots type (such as ButtonSlots).\n *\n * This should ONLY be used in type templates as in `extends SlotPropsRecord`;\n * it shouldn't be used as a component's Slots type.\n */\nexport type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;\n\n/**\n * The shorthand value of a slot allows specifying its child\n */\nexport type SlotShorthandValue = React.ReactChild | React.ReactNode[] | React.ReactPortal;\n\n/**\n * Matches any slot props type.\n *\n * This should ONLY be used in type templates as in `extends UnknownSlotProps`;\n * it shouldn't be used as the type of a slot.\n */\nexport type UnknownSlotProps = Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {\n as?: keyof JSX.IntrinsicElements;\n};\n\n/**\n * Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.\n */\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\n/**\n * Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`\n * to be a render function that takes those props.\n */\ntype WithSlotRenderFunction<Props> = Props & {\n children?: (Props extends { children?: unknown } ? Props['children'] : never) | SlotRenderFunction<Props>;\n};\n\n/**\n * HTML element types that are not allowed to have children.\n *\n * Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element\n */\ntype EmptyIntrinsicElements =\n | 'area'\n | 'base'\n | 'br'\n | 'col'\n | 'embed'\n | 'hr'\n | 'img'\n | 'input'\n | 'link'\n | 'meta'\n | 'param'\n | 'source'\n | 'track'\n | 'wbr';\n\n/**\n * Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:\n * * Removes legacy string ref.\n * * Disallows children for empty tags like 'img'.\n */\ntype IntrinsicElementProps<Type extends keyof JSX.IntrinsicElements> = Type extends EmptyIntrinsicElements\n ? PropsWithoutChildren<React.PropsWithRef<JSX.IntrinsicElements[Type]>>\n : React.PropsWithRef<JSX.IntrinsicElements[Type]>;\n\n/**\n * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,\n * or a component like `typeof Button`.\n *\n * If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).\n *\n * By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,\n * wrap with `NonNullable` (see examples below).\n *\n * @example\n * ```\n * // Intrinsic element examples:\n * Slot<'div'> // Slot is always div\n * Slot<'button', 'a'> // Defaults to button, but allows as=\"a\" with anchor-specific props\n * Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as=\"div\" or as=\"pre\"\n * NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)\n *\n * // Component examples:\n * Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props\n * NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)\n * ```\n */\nexport type Slot<\n Type extends keyof JSX.IntrinsicElements | React.ComponentType | React.VoidFunctionComponent | UnknownSlotProps,\n AlternateAs extends keyof JSX.IntrinsicElements = never,\n> = IsSingleton<Extract<Type, string>> extends true\n ?\n | WithSlotShorthandValue<\n Type extends keyof JSX.IntrinsicElements // Intrinsic elements like `div`\n ? { as?: Type } & WithSlotRenderFunction<IntrinsicElementProps<Type>>\n : Type extends React.ComponentType<infer Props> // Component types like `typeof Button`\n ? WithSlotRenderFunction<Props>\n : Type // Props types like `ButtonProps`\n >\n | {\n [As in AlternateAs]: { as: As } & WithSlotRenderFunction<IntrinsicElementProps<As>>;\n }[AlternateAs]\n | null\n : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';\n\n/**\n * Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.\n *\n * ```\n * IsSingleton<'a'> // true\n * IsSingleton<'a' | 'b' | 'c'> // false\n * ```\n */\nexport type IsSingleton<T extends string> = { [K in T]: Exclude<T, K> extends never ? true : false }[T];\n\n/**\n * Helper type for inferring the type of the as prop from a Props type.\n *\n * For example:\n * ```\n * type Example<T> = T extends AsIntrinsicElement<infer As> ? As : never;\n * ```\n */\nexport type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> = { as?: As };\n\n/**\n * Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)\n */\nexport type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;\n\n/**\n * Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by\n * IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.\n *\n * The conditional \"extends unknown\" (always true) exploits a quirk in the way TypeScript handles conditional\n * types, to prevent unions from being expanded.\n */\nexport type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;\n\n/**\n * Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by\n * IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.\n *\n * The conditional \"extends unknown\" (always true) exploits a quirk in the way TypeScript handles conditional\n * types, to prevent unions from being expanded.\n */\nexport type PropsWithoutChildren<P> = 'children' extends keyof P ? (P extends unknown ? Omit<P, 'children'> : P) : P;\n\n/**\n * Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.\n */\nexport type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;\n\n/**\n * Defines the Props type for a component given its slots and the definition of which one is the primary slot,\n * defaulting to root if one is not provided.\n */\nexport type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> =\n // Include a prop for each slot (see note below about the Omit)\n Omit<Slots, Primary & 'root'> &\n // Include all of the props of the primary slot inline in the component's props\n PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;\n\n// Note: the `Omit<Slots, Primary & 'root'>` above is a little tricky. Here's what it's doing:\n// * If the Primary slot is 'root', then omit the `root` slot prop.\n// * Otherwise, don't omit any props: include *both* the Primary and `root` props.\n// We need both props to allow the user to specify native props for either slot because the `root` slot is\n// special and always gets className and style props, per RFC https://github.com/microsoft/fluentui/pull/18983\n\n/**\n * If type T includes `null`, remove it and add `undefined` instead.\n */\nexport type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;\n\n/**\n * Defines the State object of a component given its slots.\n */\nexport type ComponentState<Slots extends SlotPropsRecord> = {\n components: {\n [Key in keyof Slots]-?:\n | React.ComponentType<ExtractSlotProps<Slots[Key]>>\n | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);\n };\n} & {\n // Include a prop for each slot, with the shorthand resolved to a props object\n // The root slot can never be null, so also exclude null from it\n [Key in keyof Slots]: ReplaceNullWithUndefined<\n Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>\n >;\n};\n\n/**\n * This is part of a hack to infer the element type from a native element *props* type.\n * The only place the original element is found in a native props type (at least that's workable\n * for inference) is in the event handlers, so some of the helper types use this event handler\n * name to infer the original element type.\n *\n * Notes:\n * - Using an extremely obscure event handler reduces the likelihood that its signature will be\n * modified in any component's props.\n * - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be\n * less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.\n */\ntype ObscureEventName = 'onLostPointerCaptureCapture';\n\n/**\n * Return type for `React.forwardRef`, including inference of the proper typing for the ref.\n */\nexport type ForwardRefComponent<Props> = ObscureEventName extends keyof Props\n ? Required<Props>[ObscureEventName] extends React.PointerEventHandler<infer Element>\n ? React.ForwardRefExoticComponent<Props & React.RefAttributes<Element>>\n : never\n : never;\n// A definition like this would also work, but typescript is more likely to unnecessarily expand\n// the props type with this version (and it's likely much more expensive to evaluate)\n// export type ForwardRefComponent<Props> = Props extends React.DOMAttributes<infer Element>\n// ? React.ForwardRefExoticComponent<Props> & React.RefAttributes<Element>\n// : never;\n\n/**\n * Helper type to correctly define the slot class names object.\n */\nexport type SlotClassNames<Slots> = {\n [SlotName in keyof Slots]-?: string;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
1
+ {"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type SlotRenderFunction<Props> = (\n Component: React.ElementType<Props>,\n props: Omit<Props, 'as'>,\n) => React.ReactNode;\n\n/**\n * Matches any component's Slots type (such as ButtonSlots).\n *\n * This should ONLY be used in type templates as in `extends SlotPropsRecord`;\n * it shouldn't be used as a component's Slots type.\n */\nexport type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;\n\n/**\n * The shorthand value of a slot allows specifying its child\n */\nexport type SlotShorthandValue = React.ReactChild | React.ReactNode[] | React.ReactPortal;\n\n/**\n * Matches any slot props type.\n *\n * This should ONLY be used in type templates as in `extends UnknownSlotProps`;\n * it shouldn't be used as the type of a slot.\n */\nexport type UnknownSlotProps = Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {\n as?: keyof JSX.IntrinsicElements;\n};\n\n/**\n * Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.\n */\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\n/**\n * Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`\n * to be a render function that takes those props.\n */\ntype WithSlotRenderFunction<Props> = Props & {\n children?: (Props extends { children?: unknown } ? Props['children'] : never) | SlotRenderFunction<Props>;\n};\n\n/**\n * HTML element types that are not allowed to have children.\n *\n * Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element\n */\ntype EmptyIntrinsicElements =\n | 'area'\n | 'base'\n | 'br'\n | 'col'\n | 'embed'\n | 'hr'\n | 'img'\n | 'input'\n | 'link'\n | 'meta'\n | 'param'\n | 'source'\n | 'track'\n | 'wbr';\n\n/**\n * Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:\n * * Removes legacy string ref.\n * * Disallows children for empty tags like 'img'.\n */\ntype IntrinsicElementProps<Type extends keyof JSX.IntrinsicElements> = Type extends EmptyIntrinsicElements\n ? PropsWithoutChildren<React.PropsWithRef<JSX.IntrinsicElements[Type]>>\n : React.PropsWithRef<JSX.IntrinsicElements[Type]>;\n\n/**\n * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,\n * or a component like `typeof Button`.\n *\n * If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).\n *\n * By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,\n * wrap with `NonNullable` (see examples below).\n *\n * @example\n * ```\n * // Intrinsic element examples:\n * Slot<'div'> // Slot is always div\n * Slot<'button', 'a'> // Defaults to button, but allows as=\"a\" with anchor-specific props\n * Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as=\"div\" or as=\"pre\"\n * NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)\n *\n * // Component examples:\n * Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props\n * NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)\n * ```\n */\nexport type Slot<\n Type extends keyof JSX.IntrinsicElements | React.ComponentType | React.VoidFunctionComponent | UnknownSlotProps,\n AlternateAs extends keyof JSX.IntrinsicElements = never,\n> = IsSingleton<Extract<Type, string>> extends true\n ?\n | WithSlotShorthandValue<\n Type extends keyof JSX.IntrinsicElements // Intrinsic elements like `div`\n ? { as?: Type } & WithSlotRenderFunction<IntrinsicElementProps<Type>>\n : Type extends React.ComponentType<infer Props> // Component types like `typeof Button`\n ? WithSlotRenderFunction<Props>\n : Type // Props types like `ButtonProps`\n >\n | {\n [As in AlternateAs]: { as: As } & WithSlotRenderFunction<IntrinsicElementProps<As>>;\n }[AlternateAs]\n | null\n : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';\n\n/**\n * Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.\n *\n * ```\n * IsSingleton<'a'> // true\n * IsSingleton<'a' | 'b' | 'c'> // false\n * ```\n */\nexport type IsSingleton<T extends string> = { [K in T]: Exclude<T, K> extends never ? true : false }[T];\n\n/**\n * Helper type for inferring the type of the as prop from a Props type.\n *\n * For example:\n * ```\n * type Example<T> = T extends AsIntrinsicElement<infer As> ? As : never;\n * ```\n */\nexport type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> = { as?: As };\n\n/**\n * Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)\n */\nexport type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;\n\n/**\n * Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by\n * IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.\n *\n * The conditional \"extends unknown\" (always true) exploits a quirk in the way TypeScript handles conditional\n * types, to prevent unions from being expanded.\n */\nexport type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;\n\n/**\n * Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by\n * IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.\n *\n * The conditional \"extends unknown\" (always true) exploits a quirk in the way TypeScript handles conditional\n * types, to prevent unions from being expanded.\n */\nexport type PropsWithoutChildren<P> = 'children' extends keyof P ? (P extends unknown ? Omit<P, 'children'> : P) : P;\n\n/**\n * Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.\n */\nexport type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;\n\n/**\n * Defines the Props type for a component given its slots and the definition of which one is the primary slot,\n * defaulting to root if one is not provided.\n */\nexport type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> =\n // Include a prop for each slot (see note below about the Omit)\n Omit<Slots, Primary & 'root'> &\n // Include all of the props of the primary slot inline in the component's props\n PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;\n\n// Note: the `Omit<Slots, Primary & 'root'>` above is a little tricky. Here's what it's doing:\n// * If the Primary slot is 'root', then omit the `root` slot prop.\n// * Otherwise, don't omit any props: include *both* the Primary and `root` props.\n// We need both props to allow the user to specify native props for either slot because the `root` slot is\n// special and always gets className and style props, per RFC https://github.com/microsoft/fluentui/pull/18983\n\n/**\n * If type T includes `null`, remove it and add `undefined` instead.\n */\nexport type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;\n\n/**\n * Defines the State object of a component given its slots.\n */\nexport type ComponentState<Slots extends SlotPropsRecord> = {\n components: {\n [Key in keyof Slots]-?:\n | React.ComponentType<ExtractSlotProps<Slots[Key]>>\n | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);\n };\n} & {\n // Include a prop for each slot, with the shorthand resolved to a props object\n // The root slot can never be null, so also exclude null from it\n [Key in keyof Slots]: ReplaceNullWithUndefined<\n Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>\n >;\n};\n\n/**\n * This is part of a hack to infer the element type from a native element *props* type.\n * The only place the original element is found in a native props type (at least that's workable\n * for inference) is in the event handlers, so some of the helper types use this event handler\n * name to infer the original element type.\n *\n * Notes:\n * - Using an extremely obscure event handler reduces the likelihood that its signature will be\n * modified in any component's props.\n * - Inferring based on a single prop name instead of a larger type like `DOMAttributes<T>` should be\n * less expensive for typescript to evaluate and is less likely to result in type expansion in .d.ts.\n */\ntype ObscureEventName = 'onLostPointerCaptureCapture';\n\n/**\n * Return type for `React.forwardRef`, including inference of the proper typing for the ref.\n */\nexport type ForwardRefComponent<Props> = ObscureEventName extends keyof Props\n ? Required<Props>[ObscureEventName] extends React.PointerEventHandler<infer Element>\n ? React.ForwardRefExoticComponent<Props & React.RefAttributes<Element>>\n : never\n : never;\n// A definition like this would also work, but typescript is more likely to unnecessarily expand\n// the props type with this version (and it's likely much more expensive to evaluate)\n// export type ForwardRefComponent<Props> = Props extends React.DOMAttributes<infer Element>\n// ? React.ForwardRefExoticComponent<Props> & React.RefAttributes<Element>\n// : never;\n\n/**\n * Helper type to correctly define the slot class names object.\n */\nexport type SlotClassNames<Slots> = {\n [SlotName in keyof Slots]-?: string;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -1,2 +1 @@
1
1
  export * from './mouseTouchHelpers';
2
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/events/index.ts"],"sourcesContent":["export * from './mouseTouchHelpers';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './mouseTouchHelpers';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB"}
@@ -1,39 +1,39 @@
1
1
  import * as React from 'react';
2
2
  /**
3
3
  * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.
4
- */
5
- export function isTouchEvent(event) {
6
- return event.type.startsWith('touch');
4
+ */ export function isTouchEvent(event) {
5
+ return event.type.startsWith('touch');
7
6
  }
8
7
  /**
9
8
  * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.
10
- */
11
- export function isMouseEvent(event) {
12
- return event.type.startsWith('mouse') || ['click', 'contextmenu', 'dblclick'].indexOf(event.type) > -1;
9
+ */ export function isMouseEvent(event) {
10
+ return event.type.startsWith('mouse') || [
11
+ 'click',
12
+ 'contextmenu',
13
+ 'dblclick'
14
+ ].indexOf(event.type) > -1;
13
15
  }
14
16
  /**
15
17
  * Returns an object with clientX, clientY for TouchOrMouseEvent.
16
18
  * Returns zeros in case the event is not a mouse or a touch event.
17
- */
18
- export function getEventClientCoords(event) {
19
- if (isMouseEvent(event)) {
20
- return {
21
- clientX: event.clientX,
22
- clientY: event.clientY
23
- };
24
- } else if (isTouchEvent(event)) {
25
- return {
26
- clientX: event.touches[0].clientX,
27
- clientY: event.touches[0].clientY
28
- };
29
- } else {
30
- if (process.env.NODE_ENV !== 'production') {
31
- throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');
19
+ */ export function getEventClientCoords(event) {
20
+ if (isMouseEvent(event)) {
21
+ return {
22
+ clientX: event.clientX,
23
+ clientY: event.clientY
24
+ };
25
+ } else if (isTouchEvent(event)) {
26
+ return {
27
+ clientX: event.touches[0].clientX,
28
+ clientY: event.touches[0].clientY
29
+ };
30
+ } else {
31
+ if (process.env.NODE_ENV !== 'production') {
32
+ throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');
33
+ }
34
+ return {
35
+ clientX: 0,
36
+ clientY: 0
37
+ };
32
38
  }
33
- return {
34
- clientX: 0,
35
- clientY: 0
36
- };
37
- }
38
39
  }
39
- //# sourceMappingURL=mouseTouchHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isTouchEvent","event","type","startsWith","isMouseEvent","indexOf","getEventClientCoords","clientX","clientY","touches","process","env","NODE_ENV","Error"],"sources":["../../src/events/mouseTouchHelpers.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type NativeTouchOrMouseEvent = MouseEvent | TouchEvent;\n\nexport type ReactTouchOrMouseEvent = React.MouseEvent | React.TouchEvent;\n\nexport type TouchOrMouseEvent = NativeTouchOrMouseEvent | ReactTouchOrMouseEvent;\n\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isTouchEvent(event: TouchOrMouseEvent): event is TouchEvent | React.TouchEvent {\n return event.type.startsWith('touch');\n}\n\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isMouseEvent(event: TouchOrMouseEvent): event is MouseEvent | React.MouseEvent {\n return event.type.startsWith('mouse') || ['click', 'contextmenu', 'dblclick'].indexOf(event.type) > -1;\n}\n\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */\nexport function getEventClientCoords(event: TouchOrMouseEvent): { clientX: number; clientY: number } {\n if (isMouseEvent(event)) {\n return { clientX: event.clientX, clientY: event.clientY };\n } else if (isTouchEvent(event)) {\n return { clientX: event.touches[0].clientX, clientY: event.touches[0].clientY };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return { clientX: 0, clientY: 0 };\n }\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAQvB;;;AAGA,OAAO,SAASC,aAAaC,KAAwB,EAA0C;EAC7F,OAAOA,KAAA,CAAMC,IAAI,CAACC,UAAU,CAAC;AAC/B;AAEA;;;AAGA,OAAO,SAASC,aAAaH,KAAwB,EAA0C;EAC7F,OAAOA,KAAA,CAAMC,IAAI,CAACC,UAAU,CAAC,YAAY,CAAC,SAAS,eAAe,WAAW,CAACE,OAAO,CAACJ,KAAA,CAAMC,IAAI,IAAI,CAAC;AACvG;AAEA;;;;AAIA,OAAO,SAASI,qBAAqBL,KAAwB,EAAwC;EACnG,IAAIG,YAAA,CAAaH,KAAA,GAAQ;IACvB,OAAO;MAAEM,OAAA,EAASN,KAAA,CAAMM,OAAO;MAAEC,OAAA,EAASP,KAAA,CAAMO;IAAQ;EAC1D,OAAO,IAAIR,YAAA,CAAaC,KAAA,GAAQ;IAC9B,OAAO;MAAEM,OAAA,EAASN,KAAA,CAAMQ,OAAO,CAAC,EAAE,CAACF,OAAO;MAAEC,OAAA,EAASP,KAAA,CAAMQ,OAAO,CAAC,EAAE,CAACD;IAAQ;EAChF,OAAO;IACL,IAAIE,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;MACzC,MAAM,IAAIC,KAAA,CAAM;IAClB;IACA,OAAO;MAAEN,OAAA,EAAS;MAAGC,OAAA,EAAS;IAAE;EAClC;AACF"}
1
+ {"version":3,"sources":["mouseTouchHelpers.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type NativeTouchOrMouseEvent = MouseEvent | TouchEvent;\n\nexport type ReactTouchOrMouseEvent = React.MouseEvent | React.TouchEvent;\n\nexport type TouchOrMouseEvent = NativeTouchOrMouseEvent | ReactTouchOrMouseEvent;\n\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isTouchEvent(event: TouchOrMouseEvent): event is TouchEvent | React.TouchEvent {\n return event.type.startsWith('touch');\n}\n\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isMouseEvent(event: TouchOrMouseEvent): event is MouseEvent | React.MouseEvent {\n return event.type.startsWith('mouse') || ['click', 'contextmenu', 'dblclick'].indexOf(event.type) > -1;\n}\n\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */\nexport function getEventClientCoords(event: TouchOrMouseEvent): { clientX: number; clientY: number } {\n if (isMouseEvent(event)) {\n return { clientX: event.clientX, clientY: event.clientY };\n } else if (isTouchEvent(event)) {\n return { clientX: event.touches[0].clientX, clientY: event.touches[0].clientY };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return { clientX: 0, clientY: 0 };\n }\n}\n"],"names":["React","isTouchEvent","event","type","startsWith","isMouseEvent","indexOf","getEventClientCoords","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAQ/B;;CAEC,GACD,OAAO,SAASC,aAAaC,KAAwB,EAA0C;IAC7F,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC;AAC/B,CAAC;AAED;;CAEC,GACD,OAAO,SAASC,aAAaH,KAAwB,EAA0C;IAC7F,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC,YAAY;QAAC;QAAS;QAAe;KAAW,CAACE,OAAO,CAACJ,MAAMC,IAAI,IAAI,CAAC;AACvG,CAAC;AAED;;;CAGC,GACD,OAAO,SAASI,qBAAqBL,KAAwB,EAAwC;IACnG,IAAIG,aAAaH,QAAQ;QACvB,OAAO;YAAEM,SAASN,MAAMM,OAAO;YAAEC,SAASP,MAAMO,OAAO;QAAC;IAC1D,OAAO,IAAIR,aAAaC,QAAQ;QAC9B,OAAO;YAAEM,SAASN,MAAMQ,OAAO,CAAC,EAAE,CAACF,OAAO;YAAEC,SAASP,MAAMQ,OAAO,CAAC,EAAE,CAACD,OAAO;QAAC;IAChF,OAAO;QACL,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAM,IAAIC,MAAM,0EAA0E;QAC5F,CAAC;QACD,OAAO;YAAEN,SAAS;YAAGC,SAAS;QAAE;IAClC,CAAC;AACH,CAAC"}
@@ -10,4 +10,3 @@ export * from './useOnScrollOutside';
10
10
  export * from './usePrevious';
11
11
  export * from './useScrollbarWidth';
12
12
  export * from './useTimeout';
13
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n"],"names":[],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,cAAc,8BAA8B;AAC5C,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,uBAAuB;AACrC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,eAAe"}