@fluentui/react-utilities 9.0.0-rc.7 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/CHANGELOG.json +120 -1
  2. package/CHANGELOG.md +48 -2
  3. package/dist/index.d.ts +31 -278
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/resolveShorthand.js.map +1 -1
  7. package/lib/compose/types.js.map +1 -1
  8. package/lib/hooks/index.js +0 -4
  9. package/lib/hooks/index.js.map +1 -1
  10. package/lib/hooks/useControllableState.js +3 -2
  11. package/lib/hooks/useControllableState.js.map +1 -1
  12. package/lib/hooks/useEventCallback.js +1 -0
  13. package/lib/hooks/useEventCallback.js.map +1 -1
  14. package/lib/hooks/useFirstMount.js +1 -0
  15. package/lib/hooks/useFirstMount.js.map +1 -1
  16. package/lib/hooks/useForceUpdate.js +1 -0
  17. package/lib/hooks/useForceUpdate.js.map +1 -1
  18. package/lib/hooks/useId.js +0 -2
  19. package/lib/hooks/useId.js.map +1 -1
  20. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -0
  21. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  22. package/lib/hooks/useMergedEventCallbacks.js +1 -0
  23. package/lib/hooks/useMergedEventCallbacks.js.map +1 -1
  24. package/lib/hooks/useMergedRefs.js +1 -0
  25. package/lib/hooks/useMergedRefs.js.map +1 -1
  26. package/lib/hooks/useOnClickOutside.js +2 -1
  27. package/lib/hooks/useOnClickOutside.js.map +1 -1
  28. package/lib/hooks/useOnScrollOutside.js +1 -0
  29. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  30. package/lib/hooks/usePrevious.js +4 -0
  31. package/lib/hooks/usePrevious.js.map +1 -1
  32. package/lib/hooks/useTimeout.js +2 -2
  33. package/lib/hooks/useTimeout.js.map +1 -1
  34. package/lib/index.js +4 -4
  35. package/lib/index.js.map +1 -1
  36. package/lib/ssr/SSRContext.js.map +1 -1
  37. package/lib/ssr/canUseDOM.js.map +1 -1
  38. package/lib/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  39. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -0
  40. package/lib/{utils → trigger}/getTriggerChild.js +2 -0
  41. package/lib/trigger/getTriggerChild.js.map +1 -0
  42. package/lib/trigger/index.js +5 -0
  43. package/lib/trigger/index.js.map +1 -0
  44. package/lib/{utils → trigger}/isFluentTrigger.js +0 -0
  45. package/lib/trigger/isFluentTrigger.js.map +1 -0
  46. package/lib/trigger/types.js +2 -0
  47. package/lib/trigger/types.js.map +1 -0
  48. package/lib/utils/clamp.js +1 -0
  49. package/lib/utils/clamp.js.map +1 -1
  50. package/lib/utils/getNativeElementProps.js +3 -2
  51. package/lib/utils/getNativeElementProps.js.map +1 -1
  52. package/lib/utils/getRTLSafeKey.js +1 -0
  53. package/lib/utils/getRTLSafeKey.js.map +1 -1
  54. package/lib/utils/getReactCallbackName.js.map +1 -1
  55. package/lib/utils/index.js +0 -3
  56. package/lib/utils/index.js.map +1 -1
  57. package/lib/utils/omit.js.map +1 -1
  58. package/lib/utils/properties.js +10 -6
  59. package/lib/utils/properties.js.map +1 -1
  60. package/lib/utils/shouldPreventDefaultOnKeyDown.js +1 -0
  61. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  62. package/lib-commonjs/compose/getSlots.js.map +1 -1
  63. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  64. package/lib-commonjs/hooks/index.js +0 -8
  65. package/lib-commonjs/hooks/index.js.map +1 -1
  66. package/lib-commonjs/hooks/useControllableState.js +3 -3
  67. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  68. package/lib-commonjs/hooks/useEventCallback.js +1 -0
  69. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  70. package/lib-commonjs/hooks/useFirstMount.js +1 -0
  71. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  72. package/lib-commonjs/hooks/useForceUpdate.js +1 -0
  73. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  74. package/lib-commonjs/hooks/useId.js +0 -2
  75. package/lib-commonjs/hooks/useId.js.map +1 -1
  76. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -0
  77. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  78. package/lib-commonjs/hooks/useMergedEventCallbacks.js +1 -0
  79. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -1
  80. package/lib-commonjs/hooks/useMergedRefs.js +1 -0
  81. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  82. package/lib-commonjs/hooks/useOnClickOutside.js +2 -1
  83. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  84. package/lib-commonjs/hooks/useOnScrollOutside.js +1 -0
  85. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  86. package/lib-commonjs/hooks/usePrevious.js +4 -0
  87. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  88. package/lib-commonjs/hooks/useTimeout.js +2 -3
  89. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  90. package/lib-commonjs/index.js +8 -223
  91. package/lib-commonjs/index.js.map +1 -1
  92. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  93. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  94. package/lib-commonjs/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  95. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -0
  96. package/lib-commonjs/{utils → trigger}/getTriggerChild.js +2 -0
  97. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -0
  98. package/lib-commonjs/trigger/index.js +16 -0
  99. package/lib-commonjs/trigger/index.js.map +1 -0
  100. package/lib-commonjs/{utils → trigger}/isFluentTrigger.js +0 -0
  101. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -0
  102. package/lib-commonjs/trigger/types.js +6 -0
  103. package/lib-commonjs/trigger/types.js.map +1 -0
  104. package/lib-commonjs/utils/clamp.js +1 -0
  105. package/lib-commonjs/utils/clamp.js.map +1 -1
  106. package/lib-commonjs/utils/getNativeElementProps.js +2 -1
  107. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  108. package/lib-commonjs/utils/getRTLSafeKey.js +1 -0
  109. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  110. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  111. package/lib-commonjs/utils/index.js +0 -6
  112. package/lib-commonjs/utils/index.js.map +1 -1
  113. package/lib-commonjs/utils/omit.js.map +1 -1
  114. package/lib-commonjs/utils/properties.js +11 -7
  115. package/lib-commonjs/utils/properties.js.map +1 -1
  116. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +1 -0
  117. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  118. package/package.json +4 -7
  119. package/lib/compose/getSlots.d.ts +0 -30
  120. package/lib/compose/index.d.ts +0 -3
  121. package/lib/compose/resolveShorthand.d.ts +0 -16
  122. package/lib/compose/types.d.ts +0 -161
  123. package/lib/hooks/index.d.ts +0 -16
  124. package/lib/hooks/useBoolean.d.ts +0 -17
  125. package/lib/hooks/useBoolean.js +0 -28
  126. package/lib/hooks/useBoolean.js.map +0 -1
  127. package/lib/hooks/useConst.d.ts +0 -12
  128. package/lib/hooks/useConst.js +0 -30
  129. package/lib/hooks/useConst.js.map +0 -1
  130. package/lib/hooks/useControllableState.d.ts +0 -31
  131. package/lib/hooks/useEventCallback.d.ts +0 -13
  132. package/lib/hooks/useFirstMount.d.ts +0 -11
  133. package/lib/hooks/useForceUpdate.d.ts +0 -4
  134. package/lib/hooks/useId.d.ts +0 -15
  135. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  136. package/lib/hooks/useMergedEventCallbacks.d.ts +0 -18
  137. package/lib/hooks/useMergedRefs.d.ts +0 -13
  138. package/lib/hooks/useMount.d.ts +0 -6
  139. package/lib/hooks/useMount.js +0 -17
  140. package/lib/hooks/useMount.js.map +0 -1
  141. package/lib/hooks/useOnClickOutside.d.ts +0 -29
  142. package/lib/hooks/useOnScrollOutside.d.ts +0 -5
  143. package/lib/hooks/usePrevious.d.ts +0 -1
  144. package/lib/hooks/useTimeout.d.ts +0 -8
  145. package/lib/hooks/useUnmount.d.ts +0 -6
  146. package/lib/hooks/useUnmount.js +0 -17
  147. package/lib/hooks/useUnmount.js.map +0 -1
  148. package/lib/index.d.ts +0 -8
  149. package/lib/ssr/SSRContext.d.ts +0 -33
  150. package/lib/ssr/canUseDOM.d.ts +0 -4
  151. package/lib/ssr/index.d.ts +0 -2
  152. package/lib/utils/applyTriggerPropsToChildren.d.ts +0 -5
  153. package/lib/utils/applyTriggerPropsToChildren.js.map +0 -1
  154. package/lib/utils/clamp.d.ts +0 -8
  155. package/lib/utils/getNativeElementProps.d.ts +0 -31
  156. package/lib/utils/getRTLSafeKey.d.ts +0 -4
  157. package/lib/utils/getReactCallbackName.d.ts +0 -25
  158. package/lib/utils/getTriggerChild.d.ts +0 -22
  159. package/lib/utils/getTriggerChild.js.map +0 -1
  160. package/lib/utils/index.d.ts +0 -9
  161. package/lib/utils/isFluentTrigger.d.ts +0 -22
  162. package/lib/utils/isFluentTrigger.js.map +0 -1
  163. package/lib/utils/omit.d.ts +0 -14
  164. package/lib/utils/properties.d.ts +0 -154
  165. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
  166. package/lib-commonjs/compose/getSlots.d.ts +0 -30
  167. package/lib-commonjs/compose/index.d.ts +0 -3
  168. package/lib-commonjs/compose/resolveShorthand.d.ts +0 -16
  169. package/lib-commonjs/compose/types.d.ts +0 -161
  170. package/lib-commonjs/hooks/index.d.ts +0 -16
  171. package/lib-commonjs/hooks/useBoolean.d.ts +0 -17
  172. package/lib-commonjs/hooks/useBoolean.js +0 -39
  173. package/lib-commonjs/hooks/useBoolean.js.map +0 -1
  174. package/lib-commonjs/hooks/useConst.d.ts +0 -12
  175. package/lib-commonjs/hooks/useConst.js +0 -40
  176. package/lib-commonjs/hooks/useConst.js.map +0 -1
  177. package/lib-commonjs/hooks/useControllableState.d.ts +0 -31
  178. package/lib-commonjs/hooks/useEventCallback.d.ts +0 -13
  179. package/lib-commonjs/hooks/useFirstMount.d.ts +0 -11
  180. package/lib-commonjs/hooks/useForceUpdate.d.ts +0 -4
  181. package/lib-commonjs/hooks/useId.d.ts +0 -15
  182. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  183. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +0 -18
  184. package/lib-commonjs/hooks/useMergedRefs.d.ts +0 -13
  185. package/lib-commonjs/hooks/useMount.d.ts +0 -6
  186. package/lib-commonjs/hooks/useMount.js +0 -27
  187. package/lib-commonjs/hooks/useMount.js.map +0 -1
  188. package/lib-commonjs/hooks/useOnClickOutside.d.ts +0 -29
  189. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +0 -5
  190. package/lib-commonjs/hooks/usePrevious.d.ts +0 -1
  191. package/lib-commonjs/hooks/useTimeout.d.ts +0 -8
  192. package/lib-commonjs/hooks/useUnmount.d.ts +0 -6
  193. package/lib-commonjs/hooks/useUnmount.js +0 -27
  194. package/lib-commonjs/hooks/useUnmount.js.map +0 -1
  195. package/lib-commonjs/index.d.ts +0 -8
  196. package/lib-commonjs/ssr/SSRContext.d.ts +0 -33
  197. package/lib-commonjs/ssr/canUseDOM.d.ts +0 -4
  198. package/lib-commonjs/ssr/index.d.ts +0 -2
  199. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +0 -5
  200. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +0 -1
  201. package/lib-commonjs/utils/clamp.d.ts +0 -8
  202. package/lib-commonjs/utils/getNativeElementProps.d.ts +0 -31
  203. package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
  204. package/lib-commonjs/utils/getReactCallbackName.d.ts +0 -25
  205. package/lib-commonjs/utils/getTriggerChild.d.ts +0 -22
  206. package/lib-commonjs/utils/getTriggerChild.js.map +0 -1
  207. package/lib-commonjs/utils/index.d.ts +0 -9
  208. package/lib-commonjs/utils/isFluentTrigger.d.ts +0 -22
  209. package/lib-commonjs/utils/isFluentTrigger.js.map +0 -1
  210. package/lib-commonjs/utils/omit.d.ts +0 -14
  211. package/lib-commonjs/utils/properties.d.ts +0 -154
  212. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC","sourcesContent":["export * from './useBoolean';\nexport * from './useConst';\nexport * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedEventCallbacks';\nexport * from './useMergedRefs';\nexport * from './useMount';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useTimeout';\nexport * from './useUnmount';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC","sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedEventCallbacks';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useTimeout';\n"]}
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
- import { useConst } from './useConst';
3
2
 
4
3
  function isFactoryDispatch(newState) {
5
4
  return typeof newState === 'function';
6
5
  }
7
6
  /**
7
+ * @internal
8
+ *
8
9
  * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
9
10
  * such as a checked state or text input string.
10
11
  *
@@ -51,7 +52,7 @@ export const useControllableState = options => {
51
52
  */
52
53
 
53
54
  const useIsControlled = controlledValue => {
54
- const isControlled = useConst(controlledValue !== undefined);
55
+ const [isControlled] = React.useState(() => controlledValue !== undefined);
55
56
 
56
57
  if (process.env.NODE_ENV !== 'production') {
57
58
  // We don't want these warnings in production even though it is against native behaviour
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useControllableState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,YAAzB;;AAkBA,SAAS,iBAAT,CAAkC,QAAlC,EAAuE;AACrE,SAAO,OAAO,QAAP,KAAoB,UAA3B;AACD;AAED;;;;;;;;;;;;;AAaG;;;AACH,OAAO,MAAM,oBAAoB,GAC/B,OADkC,IAEsB;AACxD,QAAM,YAAY,GAAG,eAAe,CAAC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J,EAAd;AAEA,cAAM,cAAc,GAAG,YAAY,GAC/B,uCAD+B,GAE/B,wCAFJ;AAIA,cAAM,gBAAgB,GAAG,YAAY,GAAG,yBAAH,GAA+B,wBAApE,CAPoD,CASpD;;AACA,QAAA,OAAO,CAAC,KAAR,CACE,CACE;AACA,qCAA6B,cAA7B,GAA8C,sCAFhD,EAGE,mBAAmB,gBAAnB,GAAsC,kCAHxC,EAIE,oGAJF,EAKE,2DALF,EAME,KAAK,CAAC,KANR,EAOE,IAPF,CAOO,GAPP,CADF;AAUD;AACF,KAtBD,EAsBG,CAAC,YAAD,EAAe,eAAf,CAtBH;AAuBD;;AAED,SAAO,YAAP;AACD,CAhCD","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\nfunction isFactoryDispatch<State>(newState: React.SetStateAction<State>): newState is (prevState: State) => State {\n return typeof newState === 'function';\n}\n\n/**\n * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,\n * such as a checked state or text input string.\n *\n * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a\n * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.\n *\n * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array\n * of the current value and an updater (dispatch) function. The updater function is referentially\n * stable (won't change during the component's lifecycle). It can take either a new value, or a\n * function which is passed the previous value and returns the new value. Unlike `setState`, calls\n * to the updater function will only be respected if the component is uncontrolled.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport const useControllableState = <State>(\n options: UseControllableStateOptions<State>,\n): [State, React.Dispatch<React.SetStateAction<State>>] => {\n const isControlled = useIsControlled(options.state);\n const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;\n const [internalState, setInternalState] = React.useState<State>(initialState);\n\n const state = isControlled ? (options.state as State) : internalState;\n\n const stateRef = React.useRef(state);\n React.useEffect(() => {\n stateRef.current = state;\n }, [state]);\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setState = React.useCallback((newState: React.SetStateAction<State>) => {\n // React dispatch can use a factory\n // https://reactjs.org/docs/hooks-reference.html#functional-updates\n if (isFactoryDispatch(newState)) {\n stateRef.current = newState(stateRef.current);\n } else {\n stateRef.current = newState;\n }\n\n setInternalState(stateRef.current);\n }, []);\n\n return [state, setState];\n};\n\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = (controlledValue: unknown) => {\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n\n const controlWarning = isControlled\n ? 'a controlled value to be uncontrolled'\n : 'an uncontrolled value to be controlled';\n\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n\n // eslint-disable-next-line no-console\n console.error(\n [\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack,\n ].join(' '),\n );\n }\n }, [isControlled, controlledValue]);\n }\n\n return isControlled;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useControllableState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;;AAqBA,SAAS,iBAAT,CAAkC,QAAlC,EA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B,EAA2C;IACzC;IACA;IACA,KAAK,CAAC,SAAN,CAAgB,MAAK;MACnB,IAAI,YAAY,MAAM,eAAe,KAAK,SAA1B,CAAhB,EAAsD;QACpD,MAAM,KAAK,GAAG,IAAI,KAAJ,EAAd;QAEA,MAAM,cAAc,GAAG,YAAY,GAC/B,uCAD+B,GAE/B,wCAFJ;QAIA,MAAM,gBAAgB,GAAG,YAAY,GAAG,yBAAH,GAA+B,wBAApE,CAPoD,CASpD;;QACA,OAAO,CAAC,KAAR,CACE,CACE;QACA,6BAA6B,cAA7B,GAA8C,sCAFhD,EAGE,mBAAmB,gBAAnB,GAAsC,kCAHxC,EAIE,oGAJF,EAKE,2DALF,EAME,KAAK,CAAC,KANR,EAOE,IAPF,CAOO,GAPP,CADF;MAUD;IACF,CAtBD,EAsBG,CAAC,YAAD,EAAe,eAAf,CAtBH;EAuBD;;EAED,OAAO,YAAP;AACD,CAhCD","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\nfunction isFactoryDispatch<State>(newState: React.SetStateAction<State>): newState is (prevState: State) => State {\n return typeof newState === 'function';\n}\n\n/**\n * @internal\n *\n * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,\n * such as a checked state or text input string.\n *\n * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a\n * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.\n *\n * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array\n * of the current value and an updater (dispatch) function. The updater function is referentially\n * stable (won't change during the component's lifecycle). It can take either a new value, or a\n * function which is passed the previous value and returns the new value. Unlike `setState`, calls\n * to the updater function will only be respected if the component is uncontrolled.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport const useControllableState = <State>(\n options: UseControllableStateOptions<State>,\n): [State, React.Dispatch<React.SetStateAction<State>>] => {\n const isControlled = useIsControlled(options.state);\n const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;\n const [internalState, setInternalState] = React.useState<State>(initialState);\n\n const state = isControlled ? (options.state as State) : internalState;\n\n const stateRef = React.useRef(state);\n React.useEffect(() => {\n stateRef.current = state;\n }, [state]);\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setState = React.useCallback((newState: React.SetStateAction<State>) => {\n // React dispatch can use a factory\n // https://reactjs.org/docs/hooks-reference.html#functional-updates\n if (isFactoryDispatch(newState)) {\n stateRef.current = newState(stateRef.current);\n } else {\n stateRef.current = newState;\n }\n\n setInternalState(stateRef.current);\n }, []);\n\n return [state, setState];\n};\n\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = (controlledValue: unknown) => {\n const [isControlled] = React.useState<boolean>(() => controlledValue !== undefined);\n\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n\n const controlWarning = isControlled\n ? 'a controlled value to be uncontrolled'\n : 'an uncontrolled value to be controlled';\n\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n\n // eslint-disable-next-line no-console\n console.error(\n [\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack,\n ].join(' '),\n );\n }\n }, [isControlled, controlledValue]);\n }\n\n return isControlled;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
3
3
  /**
4
+ * @internal
4
5
  * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
5
6
  *
6
7
  * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useEventCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,6BAA1C;AAEA;;;;;;;;;;;AAWG;;AACH,OAAO,MAAM,gBAAgB,GAAoC,EAAjC,IAAkE;AAChG,QAAM,WAAW,GAAG,KAAK,CAAC,MAAN,CAAwB,MAAK;AAC/C,UAAM,IAAI,KAAJ,CAAU,8CAAV,CAAN;AACD,GAFmB,CAApB;AAIA,EAAA,yBAAyB,CAAC,MAAK;AAC7B,IAAA,WAAW,CAAC,OAAZ,GAAsB,EAAtB;AACD,GAFwB,EAEtB,CAAC,EAAD,CAFsB,CAAzB;AAIA,SAAO,KAAK,CAAC,WAAN,CACL,CAAC,GAAG,IAAJ,KAAkB;AAChB,UAAM,QAAQ,GAAG,WAAW,CAAC,OAA7B;AACA,WAAO,QAAQ,CAAC,GAAG,IAAJ,CAAf;AACD,GAJI,EAKL,CAAC,WAAD,CALK,CAAP;AAOD,CAhBM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\n/**\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */\nexport const useEventCallback = <Args extends unknown[], Return>(fn: (...args: Args) => Return) => {\n const callbackRef = React.useRef<typeof fn>(() => {\n throw new Error('Cannot call an event handler while rendering');\n });\n\n useIsomorphicLayoutEffect(() => {\n callbackRef.current = fn;\n }, [fn]);\n\n return React.useCallback(\n (...args: Args) => {\n const callback = callbackRef.current;\n return callback(...args);\n },\n [callbackRef],\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useEventCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,6BAA1C;AAEA;;;;;;;;;;;;AAYG;;AACH,OAAO,MAAM,gBAAgB,GAAoC,EAAjC,IAAkE;EAChG,MAAM,WAAW,GAAG,KAAK,CAAC,MAAN,CAAwB,MAAK;IAC/C,MAAM,IAAI,KAAJ,CAAU,8CAAV,CAAN;EACD,CAFmB,CAApB;EAIA,yBAAyB,CAAC,MAAK;IAC7B,WAAW,CAAC,OAAZ,GAAsB,EAAtB;EACD,CAFwB,EAEtB,CAAC,EAAD,CAFsB,CAAzB;EAIA,OAAO,KAAK,CAAC,WAAN,CACL,CAAC,GAAG,IAAJ,KAAkB;IAChB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAA7B;IACA,OAAO,QAAQ,CAAC,GAAG,IAAJ,CAAf;EACD,CAJI,EAKL,CAAC,WAAD,CALK,CAAP;AAOD,CAhBM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */\nexport const useEventCallback = <Args extends unknown[], Return>(fn: (...args: Args) => Return) => {\n const callbackRef = React.useRef<typeof fn>(() => {\n throw new Error('Cannot call an event handler while rendering');\n });\n\n useIsomorphicLayoutEffect(() => {\n callbackRef.current = fn;\n }, [fn]);\n\n return React.useCallback(\n (...args: Args) => {\n const callback = callbackRef.current;\n return callback(...args);\n },\n [callbackRef],\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  /**
3
+ * @internal
3
4
  * Checks if components was mounted the first time.
4
5
  * Since concurrent mode will be released in the future this needs to be verified
5
6
  * Currently (React 17) will always render the initial mount once
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useFirstMount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;;;;;;;;AASG;;AACH,OAAM,SAAU,aAAV,GAAuB;AAC3B,QAAM,OAAO,GAAG,KAAK,CAAC,MAAN,CAAa,IAAb,CAAhB;;AAEA,MAAI,OAAO,CAAC,OAAZ,EAAqB;AACnB,IAAA,OAAO,CAAC,OAAR,GAAkB,KAAlB;AACA,WAAO,IAAP;AACD;;AAED,SAAO,OAAO,CAAC,OAAf;AACD","sourcesContent":["import * as React from 'react';\n\n/**\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n\n return isFirst.current;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useFirstMount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;;;;;;;;;AAUG;;AACH,OAAM,SAAU,aAAV,GAAuB;EAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAN,CAAa,IAAb,CAAhB;;EAEA,IAAI,OAAO,CAAC,OAAZ,EAAqB;IACnB,OAAO,CAAC,OAAR,GAAkB,KAAlB;IACA,OAAO,IAAP;EACD;;EAED,OAAO,OAAO,CAAC,OAAf;AACD","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n\n return isFirst.current;\n}\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,6 @@
1
1
  import { useReducer } from 'react';
2
2
  /**
3
+ * @internal
3
4
  * Forces a re-render, similar to `forceUpdate` in class components.
4
5
  */
5
6
 
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useForceUpdate.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,OAA3B;AAEA;;AAEG;;AACH,OAAM,SAAU,cAAV,GAAwB;AAC5B,SAAO,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAV,EAAa,CAAb,CAAV,CAA0B,CAA1B,CAAP;AACD","sourcesContent":["import { useReducer } from 'react';\n\n/**\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useForceUpdate.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,OAA3B;AAEA;;;AAGG;;AACH,OAAM,SAAU,cAAV,GAAwB;EAC5B,OAAO,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAV,EAAa,CAAb,CAAV,CAA0B,CAA1B,CAAP;AACD","sourcesContent":["import { useReducer } from 'react';\n\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n"],"sourceRoot":"../src/"}
@@ -2,8 +2,6 @@ import * as React from 'react';
2
2
  import { defaultSSRContextValue, useSSRContext } from '../ssr/index';
3
3
  /**
4
4
  * Resets generated IDs, should be used only in tests.
5
- *
6
- * @private
7
5
  */
8
6
 
9
7
  export function resetIdsForTests() {
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,sBAAT,EAAiC,aAAjC,QAAsD,cAAtD;AAEA;;;;AAIG;;AACH,OAAM,SAAU,gBAAV,GAA0B;AAC9B,EAAA,sBAAsB,CAAC,OAAvB,GAAiC,CAAjC;AACD;AAED;;;;;;;AAOG;;AACH,OAAM,SAAU,KAAV,CAAgB,MAAA,GAAiB,MAAjC,EAAyC,UAAzC,EAA4D;AAChE,QAAM,YAAY,GAAG,aAAa,EAAlC;AAEA,SAAO,KAAK,CAAC,OAAN,CAAc,MAAK;AACxB,QAAI,UAAJ,EAAgB;AACd,aAAO,UAAP;AACD;;AAED,WAAO,GAAG,MAAM,GAAG,EAAE,YAAY,CAAC,OAAO,EAAzC;AACD,GANM,EAMJ,CAAC,MAAD,EAAS,UAAT,EAAqB,YAArB,CANI,CAAP;AAOD","sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\n/**\n * Resets generated IDs, should be used only in tests.\n *\n * @private\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\n\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n\n return `${prefix}${++contextValue.current}`;\n }, [prefix, providedId, contextValue]);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,sBAAT,EAAiC,aAAjC,QAAsD,cAAtD;AAEA;;AAEG;;AACH,OAAM,SAAU,gBAAV,GAA0B;EAC9B,sBAAsB,CAAC,OAAvB,GAAiC,CAAjC;AACD;AAED;;;;;;;AAOG;;AACH,OAAM,SAAU,KAAV,CAAgB,MAAA,GAAiB,MAAjC,EAAyC,UAAzC,EAA4D;EAChE,MAAM,YAAY,GAAG,aAAa,EAAlC;EAEA,OAAO,KAAK,CAAC,OAAN,CAAc,MAAK;IACxB,IAAI,UAAJ,EAAgB;MACd,OAAO,UAAP;IACD;;IAED,OAAO,GAAG,MAAM,GAAG,EAAE,YAAY,CAAC,OAAO,EAAzC;EACD,CANM,EAMJ,CAAC,MAAD,EAAS,UAAT,EAAqB,YAArB,CANI,CAAP;AAOD","sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\n\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n\n return `${prefix}${++contextValue.current}`;\n }, [prefix, providedId, contextValue]);\n}\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { canUseDOM } from '../ssr/index';
3
3
  /**
4
+ * @internal
4
5
  * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
5
6
  * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
6
7
  * ensure we don't get a render flash for certain operations, but we may also need affected components to render on
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,cAA1B;AAEA;;;;;;;;AAQG;AACH;;AACA,OAAO,MAAM,yBAAyB,GAA2B,aAAA,SAAS,KAAK,KAAK,CAAC,eAAX,GAA6B,KAAK,CAAC,SAAtG","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n\n/**\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */\n// eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect: typeof React.useEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,cAA1B;AAEA;;;;;;;;;AASG;AACH;;AACA,OAAO,MAAM,yBAAyB,GAA2B,aAAA,SAAS,KAAK,KAAK,CAAC,eAAX,GAA6B,KAAK,CAAC,SAAtG","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n\n/**\n * @internal\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */\n// eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect: typeof React.useEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,6 @@
1
1
  import { useEventCallback } from './useEventCallback';
2
2
  /**
3
+ * @internal
3
4
  * Combine two event callbacks into a single callback function that calls each one in order.
4
5
  *
5
6
  * This is useful to add an event listener to an existing element without overwriting the current listener, if any.
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useMergedEventCallbacks.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA;;;;;;;;;;;;;;;;AAgBG;;AACH,OAAM,SAAU,uBAAV,CACJ,SADI,EAEJ,SAFI,EAE4C;AAEhD,SAAO,gBAAgB,CAAC,CAAC,GAAG,IAAJ,KAAkB;AACxC,IAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;AACA,IAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;AACD,GAHsB,CAAvB;AAID","sourcesContent":["import { useEventCallback } from './useEventCallback';\n\n/**\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * This is useful to add an event listener to an existing element without overwriting the current listener, if any.\n *\n * For example:\n * ```ts\n * state.slot.onChange = useMergedCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * @param callback1 - The first callback to be called\n * @param callback2 - The second callback to be called\n *\n * @returns An event callback that calls the callbacks in order, and is stable between renders\n */\nexport function useMergedEventCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return useEventCallback((...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n });\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useMergedEventCallbacks.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA;;;;;;;;;;;;;;;;;AAiBG;;AACH,OAAM,SAAU,uBAAV,CACJ,SADI,EAEJ,SAFI,EAE4C;EAEhD,OAAO,gBAAgB,CAAC,CAAC,GAAG,IAAJ,KAAkB;IACxC,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;IACA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;EACD,CAHsB,CAAvB;AAID","sourcesContent":["import { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * This is useful to add an event listener to an existing element without overwriting the current listener, if any.\n *\n * For example:\n * ```ts\n * state.slot.onChange = useMergedCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * @param callback1 - The first callback to be called\n * @param callback2 - The second callback to be called\n *\n * @returns An event callback that calls the callbacks in order, and is stable between renders\n */\nexport function useMergedEventCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return useEventCallback((...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n });\n}\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  /**
3
+ * @internal
3
4
  * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
4
5
  * updates all provided refs
5
6
  * @param refs - Refs to collectively update with one ref value.
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAQA;;;;;AAKG;;AACH,OAAM,SAAU,aAAV,CAA2B,GAAG,IAA9B,EAAgE;AACpE,QAAM,cAAc,GAA0B,KAAK,CAAC,WAAN,CAC3C,KAAD,IAAa;AACX;AACE,IAAA,cAAwD,CAAC,OAAzD,GAAmE,KAAnE;;AAEF,SAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,UAAI,OAAO,GAAP,KAAe,UAAnB,EAA+B;AAC7B,QAAA,GAAG,CAAC,KAAD,CAAH;AACD,OAFD,MAEO,IAAI,GAAJ,EAAS;AACd;AACE,QAAA,GAA6C,CAAC,OAA9C,GAAwD,KAAxD;AACH;AACF;AACF,GAb2C,EAc5C;AACA,GAAC,GAAG,IAAJ,CAf4C,CAA9C;AAkBA,SAAO,cAAP;AACD","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = (React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n ((mergedCallback as unknown) as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ((ref as unknown) as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown) as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AASA;;;;;;AAMG;;AACH,OAAM,SAAU,aAAV,CAA2B,GAAG,IAA9B,EAAgE;EACpE,MAAM,cAAc,GAA0B,KAAK,CAAC,WAAN,CAC3C,KAAD,IAAa;IACX;IACE,cAAwD,CAAC,OAAzD,GAAmE,KAAnE;;IAEF,KAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;MACtB,IAAI,OAAO,GAAP,KAAe,UAAnB,EAA+B;QAC7B,GAAG,CAAC,KAAD,CAAH;MACD,CAFD,MAEO,IAAI,GAAJ,EAAS;QACd;QACE,GAA6C,CAAC,OAA9C,GAAwD,KAAxD;MACH;IACF;EACF,CAb2C,EAc5C;EACA,CAAC,GAAG,IAAJ,CAf4C,CAA9C;EAkBA,OAAO,cAAP;AACD","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * @internal\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = (React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n ((mergedCallback as unknown) as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ((ref as unknown) as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown) as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useEventCallback } from './useEventCallback';
3
3
  /**
4
+ * @internal
4
5
  * Utility to perform checks where a click/touch event was made outside a component
5
6
  */
6
7
 
@@ -117,7 +118,7 @@ const useIFrameFocus = (enableFrameFocusDispatch, targetDocument, callback, poll
117
118
  timeoutRef.current = (_a = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) === null || _a === void 0 ? void 0 : _a.setInterval(() => {
118
119
  const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
119
120
 
120
- if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME') {
121
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
121
122
  const event = new CustomEvent(FUI_FRAME_EVENT, {
122
123
  bubbles: true
123
124
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useOnClickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AA8BA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,GAAI,OAAD,IAA8C;AAC7E,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,QAAR;AAAkB,IAAA,OAAlB;AAA2B,IAAA,QAA3B;AAAqC,IAAA,QAAQ,EAAE;AAA/C,MAAgE,OAAtE;AACA,QAAM,SAAS,GAAG,KAAK,CAAC,MAAN,CAAiC,SAAjC,CAAlB;AACA,EAAA,cAAc,CAAC,CAAC,QAAF,EAAY,OAAZ,EAAqB,QAArB,CAAd;AAEA,QAAM,QAAQ,GAAG,gBAAgB,CAAE,EAAD,IAAgC;AACh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B,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,WAAF,CAAc,MAAK;AACjE,cAAM,aAAa,GAAG,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAAtC;;AACA,YAAI,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,QAA/B,EAAyC;AACvC,gBAAM,KAAK,GAAG,IAAI,WAAJ,CAAgB,eAAhB,EAAiC;AAAE,YAAA,OAAO,EAAE;AAAX,WAAjC,CAAd;AACA,UAAA,aAAa,CAAC,aAAd,CAA4B,KAA5B;AACD;AACF,OAN+C,EAM7C,YAN6C,CAAhD;AAOD;;AACD,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,UAAU,CAAC,OAA1B,CAA3B;AACD,KAFD;AAGD,GAbD,EAaG,CAAC,cAAD,EAAiB,wBAAjB,EAA2C,YAA3C,CAbH;AAcD,CAvCD","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(!disabled, element, callback as (e: Event) => void);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n\n listener(event);\n };\n\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n }\n\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n *\n * @param enableFrameFocusDispatch - boolean flag to start dispatching events\n * @param targetDocument - the document to dispatch events and set timeouts\n * @param pollDuration - in milliseconds\n */\nconst useIFrameFocus = (\n enableFrameFocusDispatch: boolean,\n targetDocument: Document | undefined,\n callback: (e: Event) => void,\n pollDuration: number = 1000,\n) => {\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n if (callback) {\n callback(e);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n }\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, enableFrameFocusDispatch, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, enableFrameFocusDispatch, pollDuration]);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useOnClickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAiCA;;;AAGG;;AACH,OAAO,MAAM,iBAAiB,GAAI,OAAD,IAA8C;EAC7E,MAA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nClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(!disabled, element, callback as (e: Event) => void);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n\n listener(event);\n };\n\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n }\n\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n *\n * @param enableFrameFocusDispatch - boolean flag to start dispatching events\n * @param targetDocument - the document to dispatch events and set timeouts\n * @param pollDuration - in milliseconds\n */\nconst useIFrameFocus = (\n enableFrameFocusDispatch: boolean,\n targetDocument: Document | undefined,\n callback: (e: Event) => void,\n pollDuration: number = 1000,\n) => {\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n if (callback) {\n callback(e);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n }\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, enableFrameFocusDispatch, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME' || activeElement?.tagName === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, enableFrameFocusDispatch, pollDuration]);\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useEventCallback } from './useEventCallback';
3
3
  /**
4
+ * @internal
4
5
  * Utility to perform checks where a click/touch event was made outside a component
5
6
  */
6
7
 
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useOnScrollOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAGA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAI,OAAD,IAA8C;AAC9E,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,QAAR;AAAkB,IAAA,OAAlB;AAA2B,IAAA,QAA3B;AAAqC,IAAA,QAAQ,EAAE;AAA/C,MAAgE,OAAtE;AAEA,QAAM,QAAQ,GAAG,gBAAgB,CAAE,EAAD,IAAgC;AAChE,UAAM,QAAQ,GACZ,YAAY,KAAK,CAAC,MAAD,EAAS,KAAT,KAAmB,CAAC,EAAC,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,QAAR,CAAiB,KAAjB,CAAD,CAAzB,CADd;;AAGA,UAAM,SAAS,GAAG,IAAI,CAAC,KAAL,CAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAJ,IAAe,IAAhB,EAAsB,EAAE,CAAC,MAAzB,CAA3B,CAAlB;;AACA,QAAI,SAAS,IAAI,CAAC,QAAlB,EAA4B;AAC1B,MAAA,QAAQ,CAAC,EAAD,CAAR;AACD;AACF,GARgC,CAAjC;AAUA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,CAAC,QAAL,EAAe;AACb,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,gBAAT,CAA0B,OAA1B,EAAmC,QAAnC,CAAA;AACA,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,gBAAT,CAA0B,WAA1B,EAAuC,QAAvC,CAAA;AACD;;AAED,WAAO,MAAK;AACV,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,OAA7B,EAAsC,QAAtC,CAAA;AACA,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,WAA7B,EAA0C,QAA1C,CAAA;AACD,KAHD;AAID,GAVD,EAUG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CAVH;AAWD,CAxBM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useOnScrollOutside.ts"],"names":[],"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AtC,CAAA;MACA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,WAA7B,EAA0C,QAA1C,CAAA;IACD,CAHD;EAID,CAVD,EAUG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CAVH;AAWD,CAxBM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,8 @@
1
1
  import * as React from 'react';
2
+ /**
3
+ * @internal
4
+ */
5
+
2
6
  export const usePrevious = value => {
3
7
  const ref = React.useRef(null);
4
8
  React.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,OAAO,MAAM,WAAW,GAAyB,KAAtB,IAA0C;AACnE,QAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA+B,IAA/B,CAAZ;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,IAAA,GAAG,CAAC,OAAJ,GAAc,KAAd;AACD,GAFD,EAEG,CAAC,KAAD,CAFH;AAGA,SAAO,GAAG,CAAC,OAAX;AACD,CANM","sourcesContent":["import * as React from 'react';\n\nexport const usePrevious = <ValueType = unknown>(value: ValueType) => {\n const ref = React.useRef<ValueType | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;AAEG;;AACH,OAAO,MAAM,WAAW,GAAyB,KAAtB,IAA0C;EACnE,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA+B,IAA/B,CAAZ;EACA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,GAAG,CAAC,OAAJ,GAAc,KAAd;EACD,CAFD,EAEG,CAAC,KAAD,CAFH;EAGA,OAAO,GAAG,CAAC,OAAX;AACD,CANM","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport const usePrevious = <ValueType = unknown>(value: ValueType) => {\n const ref = React.useRef<ValueType | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { useConst } from './useConst';
3
2
  /**
3
+ * @internal
4
4
  * Helper to manage a browser timeout.
5
5
  * Ensures that the timeout isn't set multiple times at once,
6
6
  * and is cleaned up when the component is unloaded.
@@ -9,7 +9,7 @@ import { useConst } from './useConst';
9
9
  */
10
10
 
11
11
  export function useTimeout() {
12
- const timeout = useConst(() => ({
12
+ const [timeout] = React.useState(() => ({
13
13
  id: undefined,
14
14
  set: (fn, delay) => {
15
15
  timeout.clear();
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,YAAzB;AAEA;;;;;;AAMG;;AACH,OAAM,SAAU,UAAV,GAAoB;AACxB,QAAM,OAAO,GAAG,QAAQ,CAAC,OAAO;AAC9B,IAAA,EAAE,EAAE,SAD0B;AAE9B,IAAA,GAAG,EAAE,CAAC,EAAD,EAAiB,KAAjB,KAAkC;AACrC,MAAA,OAAO,CAAC,KAAR;AACA,MAAA,OAAO,CAAC,EAAR,GAAa,UAAU,CAAC,EAAD,EAAK,KAAL,CAAvB;AACD,KAL6B;AAM9B,IAAA,KAAK,EAAE,MAAK;AACV,UAAI,OAAO,CAAC,EAAR,KAAe,SAAnB,EAA8B;AAC5B,QAAA,YAAY,CAAC,OAAO,CAAC,EAAT,CAAZ;AACA,QAAA,OAAO,CAAC,EAAR,GAAa,SAAb;AACD;AACF;AAX6B,GAAP,CAAD,CAAxB,CADwB,CAexB;;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAM,OAAO,CAAC,KAA9B,EAAqC,CAAC,OAAD,CAArC;AAEA,SAAO,CAAC,OAAO,CAAC,GAAT,EAAc,OAAO,CAAC,KAAtB,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\n/**\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const timeout = useConst(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;;;;;;AAOG;;AACH,OAAM,SAAU,UAAV,GAAoB;EACxB,MAAM,CAAC,OAAD,IAAY,KAAK,CAAC,QAAN,CAAe,OAAO;IACtC,EAAE,EAAE,SADkC;IAEtC,GAAG,EAAE,CAAC,EAAD,EAAiB,KAAjB,KAAkC;MACrC,OAAO,CAAC,KAAR;MACA,OAAO,CAAC,EAAR,GAAa,UAAU,CAAC,EAAD,EAAK,KAAL,CAAvB;IACD,CALqC;IAMtC,KAAK,EAAE,MAAK;MACV,IAAI,OAAO,CAAC,EAAR,KAAe,SAAnB,EAA8B;QAC5B,YAAY,CAAC,OAAO,CAAC,EAAT,CAAZ;QACA,OAAO,CAAC,EAAR,GAAa,SAAb;MACD;IACF;EAXqC,CAAP,CAAf,CAAlB,CADwB,CAexB;;EACA,KAAK,CAAC,SAAN,CAAgB,MAAM,OAAO,CAAC,KAA9B,EAAqC,CAAC,OAAD,CAArC;EAEA,OAAO,CAAC,OAAO,CAAC,GAAT,EAAc,OAAO,CAAC,KAAtB,CAAP;AACD","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"sourceRoot":"../src/"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { getSlots, resolveShorthand } from './compose/index';
2
- export { resetIdsForTests, useBoolean, useConst, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedEventCallbacks, useMergedRefs, useMount, useOnClickOutside, useOnScrollOutside, usePrevious, useTimeout, useUnmount } from './hooks/index';
3
- export { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRContext, SSRProvider } from './ssr/index';
4
- export { anchorProperties, applyTriggerPropsToChildren, audioProperties, baseElementEvents, baseElementProperties, buttonProperties, clamp, colGroupProperties, colProperties, divProperties, fieldsetProperties, formProperties, getNativeElementProps, getNativeProps, getPartitionedNativeProps, getRTLSafeKey, getTriggerChild, htmlElementProperties, iframeProperties, // eslint-disable-next-line deprecation/deprecation
5
- imageProperties, imgProperties, inputProperties, isFluentTrigger, labelProperties, liProperties, olProperties, omit, optionProperties, selectProperties, shouldPreventDefaultOnKeyDown, tableProperties, tdProperties, textAreaProperties, thProperties, trProperties, videoProperties } from './utils/index';
2
+ export { resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedEventCallbacks, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useTimeout } from './hooks/index';
3
+ export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
+ export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, shouldPreventDefaultOnKeyDown } from './utils/index';
5
+ export { applyTriggerPropsToChildren, getTriggerChild } from './trigger/index';
6
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,QAA2C,iBAA3C;AAsBA,SACE,gBADF,EAEE,UAFF,EAGE,QAHF,EAIE,oBAJF,EAKE,gBALF,EAME,aANF,EAOE,cAPF,EAQE,KARF,EASE,yBATF,EAUE,uBAVF,EAWE,aAXF,EAYE,QAZF,EAaE,iBAbF,EAcE,kBAdF,EAeE,WAfF,EAgBE,UAhBF,EAiBE,UAjBF,QAkBO,eAlBP;AA0BA,SAAS,SAAT,EAAoB,sBAApB,EAA4C,QAA5C,EAAsD,aAAtD,EAAqE,UAArE,EAAiF,WAAjF,QAAoG,aAApG;AAGA,SACE,gBADF,EAEE,2BAFF,EAGE,eAHF,EAIE,iBAJF,EAKE,qBALF,EAME,gBANF,EAOE,KAPF,EAQE,kBARF,EASE,aATF,EAUE,aAVF,EAWE,kBAXF,EAYE,cAZF,EAaE,qBAbF,EAcE,cAdF,EAeE,yBAfF,EAgBE,aAhBF,EAiBE,eAjBF,EAkBE,qBAlBF,EAmBE,gBAnBF,EAoBE;AACA,eArBF,EAsBE,aAtBF,EAuBE,eAvBF,EAwBE,eAxBF,EAyBE,eAzBF,EA0BE,YA1BF,EA2BE,YA3BF,EA4BE,IA5BF,EA6BE,gBA7BF,EA8BE,gBA9BF,EA+BE,6BA/BF,EAgCE,eAhCF,EAiCE,YAjCF,EAkCE,kBAlCF,EAmCE,YAnCF,EAoCE,YApCF,EAqCE,eArCF,QAsCO,eAtCP","sourcesContent":["export { getSlots, resolveShorthand } from './compose/index';\nexport type {\n AsIntrinsicElement,\n ComponentProps,\n ComponentState,\n ExtractSlotProps,\n ForwardRefComponent,\n IsSingleton,\n PropsWithoutRef,\n ReplaceNullWithUndefined,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnionToIntersection,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n resetIdsForTests,\n useBoolean,\n useConst,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedEventCallbacks,\n useMergedRefs,\n useMount,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useTimeout,\n useUnmount,\n} from './hooks/index';\nexport type {\n RefObjectFunction,\n UseBooleanCallbacks,\n UseControllableStateOptions,\n UseOnClickOrScrollOutsideOptions,\n} from './hooks/index';\n\nexport { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRContext, SSRProvider } from './ssr/index';\nexport type { SSRContextValue } from './ssr/index';\n\nexport {\n anchorProperties,\n applyTriggerPropsToChildren,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n clamp,\n colGroupProperties,\n colProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeElementProps,\n getNativeProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n getTriggerChild,\n htmlElementProperties,\n iframeProperties,\n // eslint-disable-next-line deprecation/deprecation\n imageProperties,\n imgProperties,\n inputProperties,\n isFluentTrigger,\n labelProperties,\n liProperties,\n olProperties,\n omit,\n optionProperties,\n selectProperties,\n shouldPreventDefaultOnKeyDown,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n trProperties,\n videoProperties,\n} from './utils/index';\nexport type { FluentTriggerComponent } from './utils/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,QAA2C,iBAA3C;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,uBARF,EASE,aATF,EAUE,iBAVF,EAWE,kBAXF,EAYE,WAZF,EAaE,UAbF,QAcO,eAdP;AAiBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,6BALF,QAMO,eANP;AAQA,SAAS,2BAAT,EAAsC,eAAtC,QAA6D,iBAA7D","sourcesContent":["export { getSlots, resolveShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedEventCallbacks,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n shouldPreventDefaultOnKeyDown,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild } from './trigger/index';\n\nexport type { FluentTriggerComponent } from './trigger/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ssr/SSRContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,aAA1B;AAYA;;;;AAIG;;AACH,OAAO,MAAM,sBAAsB,GAAoB;AACrD,EAAA,OAAO,EAAE;AAD4C,CAAhD;AAIP,OAAO,MAAM,UAAU,gBAAG,KAAK,CAAC,aAAN,CAAqC,sBAArC,CAAnB;AAEP;;AAEG;;AACH,OAAM,SAAU,aAAV,GAAuB;AAC3B,SAAO,KAAK,CAAC,UAAN,CAAiB,UAAjB,CAAP;AACD;AAED;;;;;AAKG;;AACH,OAAO,MAAM,WAAW,GAAa,KAAK,IAAG;AAC3C,QAAM,CAAC,KAAD,IAAU,KAAK,CAAC,QAAN,CAAgC,OAAO;AAAE,IAAA,OAAO,EAAE;AAAX,GAAP,CAAhC,CAAhB;AAEA,sBAAO,KAAA,CAAA,aAAA,CAAC,UAAU,CAAC,QAAZ,EAAoB;AAAC,IAAA,KAAK,EAAE;AAAR,GAApB,EAAoC,KAAK,CAAC,QAA1C,CAAP;AACD,CAJM;AAMP;;;AAGG;;AACH,OAAM,SAAU,QAAV,GAAkB;AACtB,QAAM,cAAc,GAAG,aAAa,OAAO,sBAA3C;AACA,QAAM,CAAC,KAAD,EAAQ,QAAR,IAAoB,KAAK,CAAC,QAAN,CAAe,cAAf,CAA1B,CAFsB,CAItB;AACA;;AACA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,QAAI,CAAC,cAAD,IAAmB,CAAC,SAAS,EAAjC,EAAqC;AACnC;AACA,MAAA,OAAO,CAAC,KAAR,CACE,4GACE,0CAFJ;AAID;AACF,GAdqB,CAgBtB;AACA;;;AACA,MAAI,SAAS,MAAM,cAAnB,EAAmC;AACjC;AACA;AACA;AACA,IAAA,KAAK,CAAC,eAAN,CAAsB,MAAK;AACzB,MAAA,QAAQ,CAAC,KAAD,CAAR;AACD,KAFD,EAEG,EAFH;AAGD;;AAED,SAAO,KAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue>(defaultSSRContextValue);\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext);\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["ssr/SSRContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,aAA1B;AAYA;;;;AAIG;;AACH,OAAO,MAAM,sBAAsB,GAAoB;EACrD,OAAO,EAAE;AAD4C,CAAhD;AAIP,OAAO,MAAM,UAAU,gBAAG,KAAK,CAAC,aAAN,CAAqC,sBAArC,CAAnB;AAEP;;AAEG;;AACH,OAAM,SAAU,aAAV,GAAuB;EAC3B,OAAO,KAAK,CAAC,UAAN,CAAiB,UAAjB,CAAP;AACD;AAED;;;;;AAKG;;AACH,OAAO,MAAM,WAAW,GAAa,KAAK,IAAG;EAC3C,MAAM,CAAC,KAAD,IAAU,KAAK,CAAC,QAAN,CAAgC,OAAO;IAAE,OAAO,EAAE;EAAX,CAAP,CAAhC,CAAhB;EAEA,oBAAO,KAAA,CAAA,aAAA,CAAC,UAAU,CAAC,QAAZ,EAAoB;IAAC,KAAK,EAAE;EAAR,CAApB,EAAoC,KAAK,CAAC,QAA1C,CAAP;AACD,CAJM;AAMP;;;AAGG;;AACH,OAAM,SAAU,QAAV,GAAkB;EACtB,MAAM,cAAc,GAAG,aAAa,OAAO,sBAA3C;EACA,MAAM,CAAC,KAAD,EAAQ,QAAR,IAAoB,KAAK,CAAC,QAAN,CAAe,cAAf,CAA1B,CAFsB,CAItB;EACA;;EACA,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC,IAAI,CAAC,cAAD,IAAmB,CAAC,SAAS,EAAjC,EAAqC;MACnC;MACA,OAAO,CAAC,KAAR,CACE,4GACE,0CAFJ;IAID;EACF,CAdqB,CAgBtB;EACA;;;EACA,IAAI,SAAS,MAAM,cAAnB,EAAmC;IACjC;IACA;IACA;IACA,KAAK,CAAC,eAAN,CAAsB,MAAK;MACzB,QAAQ,CAAC,KAAD,CAAR;IACD,CAFD,EAEG,EAFH;EAGD;;EAED,OAAO,KAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue>(defaultSSRContextValue);\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext);\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ssr/canUseDOM.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAM,SAAU,SAAV,GAAmB;AACvB,SACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;AACA,EAAA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["ssr/canUseDOM.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAM,SAAU,SAAV,GAAmB;EACvB,OACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;EACA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { isFluentTrigger } from './isFluentTrigger';
3
3
  /**
4
+ * @internal
4
5
  * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
5
6
  */
6
7
 
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/applyTriggerPropsToChildren.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAEA;;;AAGG;;AACH,OAAO,MAAM,2BAA2B,GAAG,CACzC,QADyC,EAEzC,YAFyC,KAGZ;EAC7B,IAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;IAClC,OAAO,QAAQ,CAAC,YAAD,CAAf;EACD,CAFD,MAEO,IAAI,QAAJ,EAAc;IACnB,OAAO,gBAAgB,CAAC,QAAD,EAAW,YAAX,CAAvB;EACD,CAL4B,CAO7B;EACA;EACA;;;EACA,OAAO,QAAQ,IAAI,IAAnB;AACD,CAdM;AAgBP;;;AAGG;;AACH,MAAM,gBAAgB,GAAG,CAAgB,KAAhB,EAAwC,YAAxC,KAA2F;EAClH,IAAI,eAAC,KAAK,CAAC,cAAN,CAAqB,KAArB,CAAD,IAAgC,KAAK,CAAC,IAAN,KAAe,KAAK,CAAC,QAAzD,EAAmE;IACjE,MAAM,IAAI,KAAJ,CACJ,oEACE,sDAFE,CAAN;EAID;;EAED,IAAI,eAAe,CAAC,KAAD,CAAnB,EAA4B;IAC1B,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,EAAuB,YAAvB,CAAnC;IACA,oBAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,SAA1B,EAAqC,UAArC,CAAP;EACD,CAHD,MAGO;IACL,oBAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,YAA1B,CAAP;EACD;AACF,CAdD","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * @internal\n * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport const applyTriggerPropsToChildren = <TTriggerProps>(\n children: React.ReactElement | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined,\n triggerProps: TTriggerProps,\n): React.ReactElement | null => {\n if (typeof children === 'function') {\n return children(triggerProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n};\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nconst cloneTriggerTree = <TTriggerProps>(child: React.ReactNode, triggerProps: TTriggerProps): React.ReactElement => {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps);\n }\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { isFluentTrigger } from './isFluentTrigger';
3
3
  /**
4
+ * @internal
4
5
  * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
5
6
  *
6
7
  * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
@@ -18,6 +19,7 @@ import { isFluentTrigger } from './isFluentTrigger';
18
19
  * );
19
20
  * ```
20
21
  */
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
23
 
22
24
  export const getTriggerChild = children => {
23
25
  const child = React.Children.only(children);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/getTriggerChild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACH;;AACA,OAAO,MAAM,eAAe,GAC1B,QAD6B,IAE2B;EACxD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAN,CAAe,IAAf,CAAoB,QAApB,CAAd;EACA,OAAO,eAAe,CAAC,KAAD,CAAf,GAAyB,eAAe,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,CAAxC,GAAiE,KAAxE;AACD,CALM","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * @internal\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const getTriggerChild = <P = any>(\n children: React.ReactNode,\n): React.ReactElement<P> & { ref?: React.Ref<unknown> } => {\n const child = React.Children.only(children) as React.ReactElement;\n return isFluentTrigger(child) ? getTriggerChild(child.props.children) : child;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export * from './applyTriggerPropsToChildren';
2
+ export * from './getTriggerChild';
3
+ export * from './isFluentTrigger';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["trigger/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC","sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"]}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/isFluentTrigger.ts"],"names":[],"mappings":"AAGA;;;AAGG;AACH,OAAO,MAAM,eAAe,GAAI,OAAD,IAAgC;EAC7D,OAAQ,OAAO,CAAC,IAAR,CAAwC,wBAAhD;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport { FluentTriggerComponent } from './types';\n\n/**\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport const isFluentTrigger = (element: React.ReactElement) => {\n return (element.type as FluentTriggerComponent).isFluentTriggerComponent;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"../src/","sources":["trigger/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @internal
2
3
  * Clamps `value` to a number between the min and max.
3
4
  *
4
5
  * @param value - the value to be clamped
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"../src/","sources":["utils/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"]}
1
+ {"version":3,"file":"clamp.js","sourceRoot":"../src/","sources":["utils/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * @internal\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"]}
@@ -1,4 +1,4 @@
1
- import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps } from './properties';
1
+ import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties } from './properties';
2
2
  const nativeElementMap = {
3
3
  label: labelProperties,
4
4
  audio: audioProperties,
@@ -20,7 +20,8 @@ const nativeElementMap = {
20
20
  fieldset: fieldsetProperties,
21
21
  form: formProperties,
22
22
  iframe: iframeProperties,
23
- img: imgProperties
23
+ img: imgProperties,
24
+ time: timeProperties
24
25
  };
25
26
  /**
26
27
  * Given an element tagname and user props, filters the props to only allowed props for the given
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getNativeElementProps.ts"],"names":[],"mappings":"AACA,SACE,eADF,EAEE,eAFF,EAGE,eAHF,EAIE,YAJF,EAKE,YALF,EAME,gBANF,EAOE,gBAPF,EAQE,eARF,EASE,kBATF,EAUE,gBAVF,EAWE,gBAXF,EAYE,eAZF,EAaE,YAbF,EAcE,YAdF,EAeE,YAfF,EAgBE,kBAhBF,EAiBE,aAjBF,EAkBE,kBAlBF,EAmBE,cAnBF,EAoBE,gBApBF,EAqBE,aArBF,EAsBE,qBAtBF,EAuBE,cAvBF,QAwBO,cAxBP;AA0BA,MAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,eADwD;AAE/D,EAAA,KAAK,EAAE,eAFwD;AAG/D,EAAA,KAAK,EAAE,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAL2D;AAM/D,EAAA,CAAC,EAAE,gBAN4D;AAO/D,EAAA,MAAM,EAAE,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,eARwD;AAS/D,EAAA,QAAQ,EAAE,kBATqD;AAU/D,EAAA,MAAM,EAAE,gBAVuD;AAW/D,EAAA,MAAM,EAAE,gBAXuD;AAY/D,EAAA,KAAK,EAAE,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAb2D;AAc/D,EAAA,EAAE,EAAE,YAd2D;AAe/D,EAAA,EAAE,EAAE,YAf2D;AAgB/D,EAAA,QAAQ,EAAE,kBAhBqD;AAiB/D,EAAA,GAAG,EAAE,aAjB0D;AAkB/D,EAAA,QAAQ,EAAE,kBAlBqD;AAmB/D,EAAA,IAAI,EAAE,cAnByD;AAoB/D,EAAA,MAAM,EAAE,gBApBuD;AAqB/D,EAAA,GAAG,EAAE;AArB0D,CAAjE;AAwBA;;;;;;AAMG;AACH;;AACA,OAAM,SAAU,qBAAV,CACJ,OADI,EAEJ,KAFI,EAGJ,iBAHI,EAGwB;AAE5B,QAAM,gBAAgB,GAAI,OAAO,IAAI,gBAAgB,CAAC,OAAD,CAA5B,IAA0C,qBAAnE;AACA,EAAA,gBAAgB,CAAC,EAAjB,GAAsB,CAAtB;AAEA,SAAO,cAAc,CAAC,KAAD,EAAQ,gBAAR,EAA0B,iBAA1B,CAArB;AACD;AAED;;;;;;;AAOG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CAGvC;AACA,EAAA,kBADA;AAEA,EAAA,KAFA;AAGA,EAAA;AAHA,CAHuC,KAgBpC;AACH,SAAO;AACL,IAAA,IAAI,EAAE;AAAE,MAAA,KAAK,EAAE,KAAK,CAAC,KAAf;AAAsB,MAAA,SAAS,EAAE,KAAK,CAAC;AAAvC,KADD;AAEL,IAAA,OAAO,EAAE,qBAAqB,CAAgC,kBAAhC,EAAoD,KAApD,EAA2D,CACvF,IAAI,iBAAiB,IAAI,EAAzB,CADuF,EAEvF,OAFuF,EAGvF,WAHuF,CAA3D;AAFzB,GAAP;AAQD,CAzBM","sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getNativeElementProps.ts"],"names":[],"mappings":"AACA,SACE,eADF,EAEE,eAFF,EAGE,eAHF,EAIE,YAJF,EAKE,YALF,EAME,gBANF,EAOE,gBAPF,EAQE,eARF,EASE,kBATF,EAUE,gBAVF,EAWE,gBAXF,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pC;EACH,OAAO;IACL,IAAI,EAAE;MAAE,KAAK,EAAE,KAAK,CAAC,KAAf;MAAsB,SAAS,EAAE,KAAK,CAAC;IAAvC,CADD;IAEL,OAAO,EAAE,qBAAqB,CAAgC,kBAAhC,EAAoD,KAApD,EAA2D,CACvF,IAAI,iBAAiB,IAAI,EAAzB,CADuF,EAEvF,OAFuF,EAGvF,WAHuF,CAA3D;EAFzB,CAAP;AAQD,CAzBM","sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @internal
2
3
  * Finds and swaps a provided key for it's right to left format.
3
4
  */
4
5
  export const getRTLSafeKey = (key, dir) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getRTLSafeKey.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAO,MAAM,aAAa,GAAG,CAAC,GAAD,EAAc,GAAd,KAAoC;AAC/D,MAAI,GAAG,KAAK,KAAZ,EAAmB;AACjB,YAAQ,GAAR;AACE,WAAK,WAAL;AAAkB;AAChB,iBAAO,YAAP;AACD;;AAED,WAAK,YAAL;AAAmB;AACjB,iBAAO,WAAP;AACD;AAPH;AASD;;AAED,SAAO,GAAP;AACD,CAdM","sourcesContent":["/**\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getRTLSafeKey.ts"],"names":[],"mappings":"AAAA;;;AAGG;AACH,OAAO,MAAM,aAAa,GAAG,CAAC,GAAD,EAAc,GAAd,KAAoC;EAC/D,IAAI,GAAG,KAAK,KAAZ,EAAmB;IACjB,QAAQ,GAAR;MACE,KAAK,WAAL;QAAkB;UAChB,OAAO,YAAP;QACD;;MAED,KAAK,YAAL;QAAmB;UACjB,OAAO,WAAP;QACD;IAPH;EASD;;EAED,OAAO,GAAP;AACD,CAdM","sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getReactCallbackName.ts"],"names":[],"mappings":"AAwBA;;;;;;AAMG;AACH,OAAM,SAAU,oBAAV,CAA+B,KAA/B,EAAyD;AAC7D,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,WAAO,KAAK,CAAC,UAAb;AACD;;AAED,MAAI,KAAK,CAAC,cAAV,EAA0B;AACxB,QAAI,KAAK,CAAC,cAAN,CAAqB,gBAAzB,EAA2C;AACzC,aAAO,KAAK,CAAC,cAAN,CAAqB,gBAA5B;AACD;;AAED,WAAO,KAAK,CAAC,cAAN,CAAqB,uBAArB,CAA6C,OAApD;AACD;;AAED,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA,IAAA,OAAO,CAAC,KAAR,CAAc,CACZ,kFADY,EAEZ,mFAFY,CAAd;AAID;AACF","sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getReactCallbackName.ts"],"names":[],"mappings":"AAwBA;;;;;;AAMG;AACH,OAAM,SAAU,oBAAV,CAA+B,KAA/B,EAAyD;EAC7D,IAAI,KAAK,CAAC,UAAV,EAAsB;IACpB,OAAO,KAAK,CAAC,UAAb;EACD;;EAED,IAAI,KAAK,CAAC,cAAV,EAA0B;IACxB,IAAI,KAAK,CAAC,cAAN,CAAqB,gBAAzB,EAA2C;MACzC,OAAO,KAAK,CAAC,cAAN,CAAqB,gBAA5B;IACD;;IAED,OAAO,KAAK,CAAC,cAAN,CAAqB,uBAArB,CAA6C,OAApD;EACD;;EAED,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC;IACA,OAAO,CAAC,KAAR,CAAc,CACZ,kFADY,EAEZ,mFAFY,CAAd;EAID;AACF","sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"],"sourceRoot":"../src/"}