@fluentui/react-utilities 0.0.0-nightly-20230316-0427.1 → 0.0.0-nightly-20230317-1454.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.swcrc +39 -0
  2. package/CHANGELOG.json +20 -5
  3. package/CHANGELOG.md +14 -5
  4. package/dist/index.d.ts +16 -4
  5. package/lib/compose/getSlots.js +6 -7
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js +4 -4
  8. package/lib/compose/index.js.map +1 -1
  9. package/lib/compose/isResolvedShorthand.js +2 -2
  10. package/lib/compose/isResolvedShorthand.js.map +1 -1
  11. package/lib/compose/resolveShorthand.js +3 -3
  12. package/lib/compose/resolveShorthand.js.map +1 -1
  13. package/lib/compose/types.js +1 -1
  14. package/lib/compose/types.js.map +1 -1
  15. package/lib/events/index.js +1 -1
  16. package/lib/events/index.js.map +1 -1
  17. package/lib/events/mouseTouchHelpers.js +5 -4
  18. package/lib/events/mouseTouchHelpers.js.map +1 -1
  19. package/lib/hooks/index.js +12 -12
  20. package/lib/hooks/index.js.map +1 -1
  21. package/lib/hooks/useControllableState.js +7 -7
  22. package/lib/hooks/useControllableState.js.map +1 -1
  23. package/lib/hooks/useEventCallback.js +3 -3
  24. package/lib/hooks/useEventCallback.js.map +1 -1
  25. package/lib/hooks/useFirstMount.js +1 -1
  26. package/lib/hooks/useFirstMount.js.map +1 -1
  27. package/lib/hooks/useForceUpdate.js +1 -1
  28. package/lib/hooks/useForceUpdate.js.map +1 -1
  29. package/lib/hooks/useId.js +6 -6
  30. package/lib/hooks/useId.js.map +1 -1
  31. package/lib/hooks/useIsomorphicLayoutEffect.js +3 -4
  32. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  33. package/lib/hooks/useMergedRefs.js +2 -2
  34. package/lib/hooks/useMergedRefs.js.map +1 -1
  35. package/lib/hooks/useOnClickOutside.js +20 -23
  36. package/lib/hooks/useOnClickOutside.js.map +1 -1
  37. package/lib/hooks/useOnScrollOutside.js +7 -7
  38. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  39. package/lib/hooks/usePrevious.js +1 -1
  40. package/lib/hooks/usePrevious.js.map +1 -1
  41. package/lib/hooks/useScrollbarWidth.js +5 -5
  42. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  43. package/lib/hooks/useTimeout.js +1 -1
  44. package/lib/hooks/useTimeout.js.map +1 -1
  45. package/lib/index.js +6 -6
  46. package/lib/index.js.map +1 -1
  47. package/lib/ssr/SSRContext.js +5 -6
  48. package/lib/ssr/SSRContext.js.map +1 -1
  49. package/lib/ssr/canUseDOM.js +2 -3
  50. package/lib/ssr/canUseDOM.js.map +1 -1
  51. package/lib/ssr/index.js +2 -2
  52. package/lib/ssr/index.js.map +1 -1
  53. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  54. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  55. package/lib/trigger/getTriggerChild.js +2 -2
  56. package/lib/trigger/getTriggerChild.js.map +1 -1
  57. package/lib/trigger/index.js +4 -4
  58. package/lib/trigger/index.js.map +1 -1
  59. package/lib/trigger/isFluentTrigger.js +1 -0
  60. package/lib/trigger/isFluentTrigger.js.map +1 -1
  61. package/lib/trigger/types.js +1 -1
  62. package/lib/trigger/types.js.map +1 -1
  63. package/lib/utils/clamp.js +1 -2
  64. package/lib/utils/clamp.js.map +1 -1
  65. package/lib/utils/getNativeElementProps.js +4 -4
  66. package/lib/utils/getNativeElementProps.js.map +1 -1
  67. package/lib/utils/getRTLSafeKey.js +6 -7
  68. package/lib/utils/getRTLSafeKey.js.map +1 -1
  69. package/lib/utils/getReactCallbackName.js +3 -2
  70. package/lib/utils/getReactCallbackName.js.map +1 -1
  71. package/lib/utils/index.js +8 -8
  72. package/lib/utils/index.js.map +1 -1
  73. package/lib/utils/isHTMLElement.js +10 -7
  74. package/lib/utils/isHTMLElement.js.map +1 -1
  75. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  76. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  77. package/lib/utils/mergeCallbacks.js +3 -4
  78. package/lib/utils/mergeCallbacks.js.map +1 -1
  79. package/lib/utils/omit.js +1 -2
  80. package/lib/utils/omit.js.map +1 -1
  81. package/lib/utils/properties.js +28 -55
  82. package/lib/utils/properties.js.map +1 -1
  83. package/lib-commonjs/compose/getSlots.js +47 -55
  84. package/lib-commonjs/compose/getSlots.js.map +1 -1
  85. package/lib-commonjs/compose/index.js +8 -7
  86. package/lib-commonjs/compose/index.js.map +1 -1
  87. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  88. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  89. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  90. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  91. package/lib-commonjs/compose/types.js +5 -2
  92. package/lib-commonjs/compose/types.js.map +1 -1
  93. package/lib-commonjs/events/index.js +5 -4
  94. package/lib-commonjs/events/index.js.map +1 -1
  95. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  96. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  97. package/lib-commonjs/hooks/index.js +16 -15
  98. package/lib-commonjs/hooks/index.js.map +1 -1
  99. package/lib-commonjs/hooks/useControllableState.js +63 -64
  100. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  101. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  102. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  103. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  104. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  105. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  106. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  107. package/lib-commonjs/hooks/useId.js +48 -47
  108. package/lib-commonjs/hooks/useId.js.map +1 -1
  109. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  110. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  111. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  112. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  113. package/lib-commonjs/hooks/useOnClickOutside.js +109 -115
  114. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  115. package/lib-commonjs/hooks/useOnScrollOutside.js +33 -36
  116. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  117. package/lib-commonjs/hooks/usePrevious.js +17 -15
  118. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  119. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  120. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  121. package/lib-commonjs/hooks/useTimeout.js +30 -30
  122. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  123. package/lib-commonjs/index.js +52 -214
  124. package/lib-commonjs/index.js.map +1 -1
  125. package/lib-commonjs/ssr/SSRContext.js +56 -59
  126. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  127. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  128. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  129. package/lib-commonjs/ssr/index.js +6 -5
  130. package/lib-commonjs/ssr/index.js.map +1 -1
  131. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  132. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  133. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  134. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  135. package/lib-commonjs/trigger/index.js +8 -7
  136. package/lib-commonjs/trigger/index.js.map +1 -1
  137. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  138. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  139. package/lib-commonjs/trigger/types.js +5 -2
  140. package/lib-commonjs/trigger/types.js.map +1 -1
  141. package/lib-commonjs/utils/clamp.js +10 -9
  142. package/lib-commonjs/utils/clamp.js.map +1 -1
  143. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  144. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  145. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  146. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  147. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  148. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  149. package/lib-commonjs/utils/index.js +12 -11
  150. package/lib-commonjs/utils/index.js.map +1 -1
  151. package/lib-commonjs/utils/isHTMLElement.js +20 -15
  152. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  153. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  154. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  155. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  156. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  157. package/lib-commonjs/utils/omit.js +18 -17
  158. package/lib-commonjs/utils/omit.js.map +1 -1
  159. package/lib-commonjs/utils/properties.js +327 -223
  160. package/lib-commonjs/utils/properties.js.map +1 -1
  161. package/package.json +4 -4
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import { isFluentTrigger } from './isFluentTrigger';
1
+ import * as React from "react";
2
+ import { isFluentTrigger } from "./isFluentTrigger";
3
3
  /**
4
4
  * @internal
5
5
  * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.
6
6
  */
7
7
  export function applyTriggerPropsToChildren(children, triggerChildProps) {
8
- if (typeof children === 'function') {
8
+ if (typeof children === "function") {
9
9
  return children(triggerChildProps);
10
10
  } else if (children) {
11
11
  return cloneTriggerTree(children, triggerChildProps);
@@ -21,7 +21,7 @@ export function applyTriggerPropsToChildren(children, triggerChildProps) {
21
21
  */
22
22
  function cloneTriggerTree(child, triggerProps) {
23
23
  if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {
24
- throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
24
+ throw new Error("A trigger element must be a single element for this component. " + "Please ensure that you're not using React Fragments.");
25
25
  }
26
26
  if (isFluentTrigger(child)) {
27
27
  const grandchild = cloneTriggerTree(child.props.children, triggerProps);
@@ -1 +1 @@
1
- {"version":3,"names":["React","isFluentTrigger","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","isValidElement","type","Fragment","Error","grandchild","props","cloneElement","undefined"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): 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 as TriggerChildProps & React.Attributes);\n }\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,mBAAmB;AAGnD;;;;AAIA,OAAM,SAAUC,2BAA2BA,CACzCC,QAAqD,EACrDC,iBAAoC;EAEpC,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAE;IAClC,OAAOA,QAAQ,CAACC,iBAAiB,CAAC;GACnC,MAAM,IAAID,QAAQ,EAAE;IACnB,OAAOE,gBAAgB,CAACF,QAAQ,EAAEC,iBAAiB,CAAC;;EAGtD;EACA;EACA;EACA,OAAOD,QAAQ,IAAI,IAAI;AACzB;AAEA;;;;AAIA,SAASE,gBAAgBA,CACvBC,KAAsB,EACtBC,YAA+B;EAE/B,IAAI,eAACP,KAAK,CAACQ,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKT,KAAK,CAACU,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAK,CACb,iEAAiE,GAC/D,sDAAsD,CACzD;;EAGH,IAAIV,eAAe,CAACK,KAAK,CAAC,EAAE;IAC1B,MAAMM,UAAU,GAAGP,gBAAgB,CAACC,KAAK,CAACO,KAAK,CAACV,QAAQ,EAAEI,YAAY,CAAC;IACvE,oBAAOP,KAAK,CAACc,YAAY,CAACR,KAAK,EAAES,SAAS,EAAEH,UAAU,CAAC;GACxD,MAAM;IACL,oBAAOZ,KAAK,CAACc,YAAY,CAACR,KAAK,EAAEC,YAAoD,CAAC;;AAE1F"}
1
+ {"version":3,"names":["React","isFluentTrigger","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","isValidElement","type","Fragment","Error","grandchild","props","cloneElement","undefined"],"sources":["../../src/trigger/applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): 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 as TriggerChildProps & React.Attributes);\n }\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,eAAe,QAAQ;AAGhC;;;;AAIA,OAAO,SAASC,4BACdC,QAAqD,EACrDC,iBAAoC,EACT;EAC3B,IAAI,OAAOD,QAAA,KAAa,YAAY;IAClC,OAAOA,QAAA,CAASC,iBAAA;EAClB,OAAO,IAAID,QAAA,EAAU;IACnB,OAAOE,gBAAA,CAAiBF,QAAA,EAAUC,iBAAA;EACpC;EAEA;EACA;EACA;EACA,OAAOD,QAAA,IAAY,IAAI;AACzB;AAEA;;;;AAIA,SAASE,iBACPC,KAAsB,EACtBC,YAA+B,EACX;EACpB,IAAI,eAACP,KAAA,CAAMQ,cAAc,CAACF,KAAA,KAAUA,KAAA,CAAMG,IAAI,KAAKT,KAAA,CAAMU,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAA,CACR,oEACE;EAEN;EAEA,IAAIV,eAAA,CAAgBK,KAAA,GAAQ;IAC1B,MAAMM,UAAA,GAAaP,gBAAA,CAAiBC,KAAA,CAAMO,KAAK,CAACV,QAAQ,EAAEI,YAAA;IAC1D,oBAAOP,KAAA,CAAMc,YAAY,CAACR,KAAA,EAAOS,SAAA,EAAWH,UAAA;EAC9C,OAAO;IACL,oBAAOZ,KAAA,CAAMc,YAAY,CAACR,KAAA,EAAOC,YAAA;EACnC;AACF"}
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
- import { isFluentTrigger } from './isFluentTrigger';
1
+ import * as React from "react";
2
+ import { isFluentTrigger } from "./isFluentTrigger";
3
3
  /**
4
4
  * @internal
5
5
  * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
@@ -1 +1 @@
1
- {"version":3,"names":["React","isFluentTrigger","getTriggerChild","children","isValidElement","props"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\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 * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,mBAAmB;AAGnD;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAM,SAAUC,eAAeA,CAC7BC,QAAqD;EAGrD,IAAI,eAACH,KAAK,CAACI,cAAc,CAAoBD,QAAQ,CAAC,EAAE;IACtD,OAAO,IAAI;;EAEb,OAAOF,eAAe,CAACE,QAAQ,CAAC,GAC5BD,eAAe;EACb;EACA;EACCC,QAAQ,CAACE,KAAsB,CAACF,QAAQ,CAC1C,GACDA,QAAQ;AACd"}
1
+ {"version":3,"names":["React","isFluentTrigger","getTriggerChild","children","isValidElement","props"],"sources":["../../src/trigger/getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\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 * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,eAAe,QAAQ;AAGhC;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAO,SAASC,gBACdC,QAAqD,EAE+B;EACpF,IAAI,eAACH,KAAA,CAAMI,cAAc,CAAoBD,QAAA,GAAW;IACtD,OAAO,IAAI;EACb;EACA,OAAOF,eAAA,CAAgBE,QAAA,IACnBD,eAAA;EAGE;EADA;EACCC,QAAA,CAASE,KAAK,CAAkBF,QAAQ,IAE3CA,QAAQ;AACd"}
@@ -1,5 +1,5 @@
1
- export * from './applyTriggerPropsToChildren';
2
- export * from './getTriggerChild';
3
- export * from './isFluentTrigger';
4
- export * from './types';
1
+ export * from "./applyTriggerPropsToChildren";
2
+ export * from "./getTriggerChild";
3
+ export * from "./isFluentTrigger";
4
+ export * from "./types";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/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"]}
1
+ {"version":3,"names":[],"sources":["../../src/trigger/index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  /**
2
3
  * @internal
3
4
  * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
@@ -1 +1 @@
1
- {"version":3,"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\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 function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"mappings":"AAGA;;;;;AAKA,OAAM,SAAUA,eAAeA,CAACC,OAA2B;EACzD,OAAOC,OAAO,CAAED,OAAO,CAACE,IAA+B,CAACC,wBAAwB,CAAC;AACnF"}
1
+ {"version":3,"names":["React","isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sources":["../../src/trigger/isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\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 function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAGvB;;;;;AAKA,OAAO,SAASC,gBAAgBC,OAA2B,EAA+C;EACxG,OAAOC,OAAA,CAAQD,OAAC,CAAQE,IAAI,CAA4BC,wBAAwB;AAClF"}
@@ -1,2 +1,2 @@
1
- export {};
1
+ import * as React from "react";
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\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\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"]}
1
+ {"version":3,"names":["React"],"sources":["../../src/trigger/types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\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\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
@@ -5,6 +5,5 @@
5
5
  * @param value - the value to be clamped
6
6
  * @param min - the lowest valid value
7
7
  * @param max - the highest valid value
8
- */
9
- export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
8
+ */export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
10
9
  //# sourceMappingURL=clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/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
+ {"version":3,"names":["clamp","value","min","max","Math"],"sources":["../../src/utils/clamp.ts"],"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"],"mappings":"AAAA;;;;;;;GAQA,OAAO,MAAMA,KAAA,GAAQA,CAACC,KAAA,EAAeC,GAAA,EAAaC,GAAA,KAAwBC,IAAA,CAAKD,GAAG,CAACD,GAAA,EAAKE,IAAA,CAAKF,GAAG,CAACC,GAAA,EAAKF,KAAA,IAAS"}
@@ -1,4 +1,5 @@
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, dialogProperties } from './properties';
1
+ import * as React from "react";
2
+ 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, dialogProperties } from "./properties";
2
3
  const nativeElementMap = {
3
4
  label: labelProperties,
4
5
  audio: audioProperties,
@@ -30,8 +31,7 @@ const nativeElementMap = {
30
31
  * @param tagName - Tag name (e.g. "div")
31
32
  * @param props - Props object
32
33
  * @param excludedPropNames - List of props to disallow
33
- */
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
35
  export function getNativeElementProps(tagName, props, excludedPropNames) {
36
36
  const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
37
37
  allowedPropNames.as = 1;
@@ -55,7 +55,7 @@ export const getPartitionedNativeProps = ({
55
55
  style: props.style,
56
56
  className: props.className
57
57
  },
58
- primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
58
+ primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), "style", "className"])
59
59
  };
60
60
  };
61
61
  //# sourceMappingURL=getNativeElementProps.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getNativeElementProps.ts"],"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 dialogProperties,\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 dialog: dialogProperties,\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"],"mappings":"AACA,SACEA,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX,cAAc;AAErB,MAAMC,gBAAgB,GAA2C;EAC/DC,KAAK,EAAE1B,eAAe;EACtB2B,KAAK,EAAE1B,eAAe;EACtB2B,KAAK,EAAE1B,eAAe;EACtB2B,EAAE,EAAE1B,YAAY;EAChB2B,EAAE,EAAE1B,YAAY;EAChB2B,CAAC,EAAE1B,gBAAgB;EACnB2B,MAAM,EAAE1B,gBAAgB;EACxB2B,KAAK,EAAE1B,eAAe;EACtB2B,QAAQ,EAAE1B,kBAAkB;EAC5B2B,MAAM,EAAE1B,gBAAgB;EACxB2B,MAAM,EAAE1B,gBAAgB;EACxB2B,KAAK,EAAE1B,eAAe;EACtB2B,EAAE,EAAE1B,YAAY;EAChB2B,EAAE,EAAE1B,YAAY;EAChB2B,EAAE,EAAE1B,YAAY;EAChB2B,QAAQ,EAAE1B,kBAAkB;EAC5B2B,GAAG,EAAE1B,aAAa;EAClB2B,QAAQ,EAAE1B,kBAAkB;EAC5B2B,IAAI,EAAE1B,cAAc;EACpB2B,MAAM,EAAE1B,gBAAgB;EACxB2B,GAAG,EAAE1B,aAAa;EAClB2B,IAAI,EAAExB,cAAc;EACpByB,MAAM,EAAExB;CACT;AAED;;;;;;;AAOA;AACA,OAAM,SAAUyB,qBAAqBA,CACnCC,OAAe,EACfC,KAAS,EACTC,iBAA4B;EAE5B,MAAMC,gBAAgB,GAAIH,OAAO,IAAIzB,gBAAgB,CAACyB,OAAO,CAAC,IAAK7B,qBAAqB;EACxFgC,gBAAgB,CAACC,EAAE,GAAG,CAAC;EAEvB,OAAOhC,cAAc,CAAC6B,KAAK,EAAEE,gBAAgB,EAAED,iBAAiB,CAAC;AACnE;AAEA;;;;;;;;AAQA,OAAO,MAAMG,yBAAyB,GAAGA,CAGvC;EACAC,kBAAkB;EAClBL,KAAK;EACLC;AAAiB,CAUlB,KAAI;EACH,OAAO;IACLK,IAAI,EAAE;MAAEC,KAAK,EAAEP,KAAK,CAACO,KAAK;MAAEC,SAAS,EAAER,KAAK,CAACQ;IAAS,CAAE;IACxDC,OAAO,EAAEX,qBAAqB,CAAgCO,kBAAkB,EAAEL,KAAK,EAAE,CACvF,IAAIC,iBAAiB,IAAI,EAAE,CAAC,EAC5B,OAAO,EACP,WAAW,CACZ;GACF;AACH,CAAC"}
1
+ {"version":3,"names":["React","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sources":["../../src/utils/getNativeElementProps.ts"],"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 dialogProperties,\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 dialog: dialogProperties,\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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX;AAEP,MAAMC,gBAAA,GAA2D;EAC/DC,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,CAAA,EAAG1B,gBAAA;EACH2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,QAAA,EAAU1B,kBAAA;EACV2B,MAAA,EAAQ1B,gBAAA;EACR2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,QAAA,EAAU1B,kBAAA;EACV2B,GAAA,EAAK1B,aAAA;EACL2B,QAAA,EAAU1B,kBAAA;EACV2B,IAAA,EAAM1B,cAAA;EACN2B,MAAA,EAAQ1B,gBAAA;EACR2B,GAAA,EAAK1B,aAAA;EACL2B,IAAA,EAAMxB,cAAA;EACNyB,MAAA,EAAQxB;AACV;AAEA;;;;;;GAAA,CAOA;AACA,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B,EACf;EACb,MAAMC,gBAAA,GAAmBH,OAAC,IAAWzB,gBAAgB,CAACyB,OAAA,CAAQ,IAAK7B,qBAAA;EACnEgC,gBAAA,CAAiBC,EAAE,GAAG;EAEtB,OAAOhC,cAAA,CAAe6B,KAAA,EAAOE,gBAAA,EAAkBD,iBAAA;AACjD;AAEA;;;;;;;;AAQA,OAAO,MAAMG,yBAAA,GAA4BA,CAGvC;EACAC,kBAAA;EACAL,KAAA;EACAC;AAAiB,CAUlB,KAAK;EACJ,OAAO;IACLK,IAAA,EAAM;MAAEC,KAAA,EAAOP,KAAA,CAAMO,KAAK;MAAEC,SAAA,EAAWR,KAAA,CAAMQ;IAAU;IACvDC,OAAA,EAASX,qBAAA,CAAqDO,kBAAA,EAAoBL,KAAA,EAAO,C,IACnFC,iBAAA,IAAqB,EAAE,GAC3B,SACA,YACD;EACH;AACF"}
@@ -1,17 +1,16 @@
1
1
  /**
2
2
  * @internal
3
3
  * Finds and swaps a provided key for it's right to left format.
4
- */
5
- export const getRTLSafeKey = (key, dir) => {
6
- if (dir === 'rtl') {
4
+ */export const getRTLSafeKey = (key, dir) => {
5
+ if (dir === "rtl") {
7
6
  switch (key) {
8
- case 'ArrowLeft':
7
+ case "ArrowLeft":
9
8
  {
10
- return 'ArrowRight';
9
+ return "ArrowRight";
11
10
  }
12
- case 'ArrowRight':
11
+ case "ArrowRight":
13
12
  {
14
- return 'ArrowLeft';
13
+ return "ArrowLeft";
15
14
  }
16
15
  }
17
16
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getRTLSafeKey","key","dir"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getRTLSafeKey.ts"],"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"],"mappings":"AAAA;;;;AAIA,OAAO,MAAMA,aAAa,GAAGA,CAACC,GAAW,EAAEC,GAAkB,KAAI;EAC/D,IAAIA,GAAG,KAAK,KAAK,EAAE;IACjB,QAAQD,GAAG;MACT,KAAK,WAAW;QAAE;UAChB,OAAO,YAAY;;MAGrB,KAAK,YAAY;QAAE;UACjB,OAAO,WAAW;;IACnB;;EAIL,OAAOA,GAAG;AACZ,CAAC"}
1
+ {"version":3,"names":["getRTLSafeKey","key","dir"],"sources":["../../src/utils/getRTLSafeKey.ts"],"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"],"mappings":"AAAA;;;GAIA,OAAO,MAAMA,aAAA,GAAgBA,CAACC,GAAA,EAAaC,GAAA,KAAuB;EAChE,IAAIA,GAAA,KAAQ,OAAO;IACjB,QAAQD,GAAA;MACN,KAAK;QAAa;UAChB,OAAO;QACT;MAEA,KAAK;QAAc;UACjB,OAAO;QACT;IAAA;EAEJ;EAEA,OAAOA,GAAA;AACT"}
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  /**
2
3
  * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
3
4
  *
@@ -15,9 +16,9 @@ export function getReactCallbackName(event) {
15
16
  }
16
17
  return event.dispatchConfig.phasedRegistrationNames.bubbled;
17
18
  }
18
- if (process.env.NODE_ENV !== 'production') {
19
+ if (process.env.NODE_ENV !== "production") {
19
20
  // eslint-disable-next-line no-console
20
- console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
21
+ console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', "This should not happen, please report it to https://github.com/microsoft/fluentui"]);
21
22
  }
22
23
  }
23
24
  //# sourceMappingURL=getReactCallbackName.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getReactCallbackName.ts"],"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"],"mappings":"AAwBA;;;;;;;AAOA,OAAM,SAAUA,oBAAoBA,CAACC,KAA0B;EAC7D,IAAIA,KAAK,CAACC,UAAU,EAAE;IACpB,OAAOD,KAAK,CAACC,UAA+B;;EAG9C,IAAID,KAAK,CAACE,cAAc,EAAE;IACxB,IAAIF,KAAK,CAACE,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAK,CAACE,cAAc,CAACC,gBAAqC;;IAGnE,OAAOH,KAAK,CAACE,cAAc,CAACE,uBAAuB,CAACC,OAA4B;;EAGlF,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,KAAK,CAAC,CACZ,kFAAkF,EAClF,mFAAmF,CACpF,CAAC;;AAEN"}
1
+ {"version":3,"names":["React","getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sources":["../../src/utils/getReactCallbackName.ts"],"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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAwBvB;;;;;;;AAOA,OAAO,SAASC,qBAAqBC,KAA0B,EAAiC;EAC9F,IAAIA,KAAA,CAAMC,UAAU,EAAE;IACpB,OAAOD,KAAA,CAAMC,UAAU;EACzB;EAEA,IAAID,KAAA,CAAME,cAAc,EAAE;IACxB,IAAIF,KAAA,CAAME,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAA,CAAME,cAAc,CAACC,gBAAgB;IAC9C;IAEA,OAAOH,KAAA,CAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;EAC7D;EAEA,IAAIC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACAC,OAAA,CAAQC,KAAK,CAAC,CACZ,oFACA,oFACD;EACH;AACF"}
@@ -1,9 +1,9 @@
1
- export * from './clamp';
2
- export * from './getNativeElementProps';
3
- export * from './getRTLSafeKey';
4
- export * from './mergeCallbacks';
5
- export * from './omit';
6
- export * from './properties';
7
- export * from './isHTMLElement';
8
- export * from './isInteractiveHTMLElement';
1
+ export * from "./clamp";
2
+ export * from "./getNativeElementProps";
3
+ export * from "./getRTLSafeKey";
4
+ export * from "./mergeCallbacks";
5
+ export * from "./omit";
6
+ export * from "./properties";
7
+ export * from "./isHTMLElement";
8
+ export * from "./isInteractiveHTMLElement";
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"]}
1
+ {"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -1,15 +1,18 @@
1
1
  /**
2
- * @internal
3
2
  * Verifies if a given node is an HTMLElement,
4
3
  * this method works seamlessly with frames and elements from different documents
5
4
  *
6
- * This is required as simply using `instanceof`
7
- * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
5
+ * This is preferred over simply using `instanceof`.
6
+ * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
8
7
  *
9
- */
10
- export function isHTMLElement(element, options) {
11
- var _a, _b;
8
+ * @example
9
+ * ```ts
10
+ * isHTMLElement(event.target) && event.target.focus()
11
+ * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value
12
+ * ```
13
+ *
14
+ */export function isHTMLElement(element, options) {
12
15
  const typedElement = element;
13
- return Boolean(((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_b = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _b !== void 0 ? _b : 'HTMLElement']);
16
+ return Boolean(typedElement?.ownerDocument?.defaultView && typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? "HTMLElement"]);
14
17
  }
15
18
  //# sourceMappingURL=isHTMLElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","_a","ownerDocument","defaultView","_b","constructorName"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: { constructorName?: ConstructorName },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\ntype HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"mappings":"AAAA;;;;;;;;;AASA,OAAM,SAAUA,aAAaA,CAC3BC,OAAiB,EACjBC,OAA+C;;EAE/C,MAAMC,YAAY,GAAGF,OAAkC;EACvD,OAAOG,OAAO,CACZ,EAAAC,EAAA,GAAAF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,WAAW,KACtCJ,YAAY,YAAYA,YAAY,CAACG,aAAa,CAACC,WAAW,CAAC,CAAAC,EAAA,GAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,eAAe,cAAAD,EAAA,cAAAA,EAAA,GAAI,aAAa,CAAC,CAC5G;AACH"}
1
+ {"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","ownerDocument","defaultView","constructorName"],"sources":["../../src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is preferred over simply using `instanceof`.\n * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\n/**\n * @internal\n */\nexport type HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"mappings":"AAAA;;;;;;;;;;;;;GAcA,OAAO,SAASA,cACdC,OAAiB,EACjBC,OAMC,EAC8D;EAC/D,MAAMC,YAAA,GAAeF,OAAA;EACrB,OAAOG,OAAA,CACLD,YAAA,EAAcE,aAAA,EAAeC,WAAA,IAC3BH,YAAA,YAAwBA,YAAA,CAAaE,aAAa,CAACC,WAAW,CAACJ,OAAA,EAASK,eAAA,IAAmB,cAAc;AAE/G"}
@@ -1,4 +1,4 @@
1
- import { isHTMLElement } from './isHTMLElement';
1
+ import { isHTMLElement } from "./isHTMLElement";
2
2
  /**
3
3
  * @internal
4
4
  * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
@@ -11,10 +11,10 @@ export function isInteractiveHTMLElement(element) {
11
11
  tagName
12
12
  } = element;
13
13
  switch (tagName) {
14
- case 'BUTTON':
15
- case 'A':
16
- case 'INPUT':
17
- case 'TEXTAREA':
14
+ case "BUTTON":
15
+ case "A":
16
+ case "INPUT":
17
+ case "TEXTAREA":
18
18
  return true;
19
19
  }
20
20
  return element.isContentEditable;
@@ -1 +1 @@
1
- {"version":3,"names":["isHTMLElement","isInteractiveHTMLElement","element","tagName","isContentEditable"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C;;;;AAIA,OAAM,SAAUC,wBAAwBA,CAACC,OAAgB;EACvD,IAAI,CAACF,aAAa,CAACE,OAAO,CAAC,EAAE;IAC3B,OAAO,KAAK;;EAGd,MAAM;IAAEC;EAAO,CAAE,GAAGD,OAAO;EAC3B,QAAQC,OAAO;IACb,KAAK,QAAQ;IACb,KAAK,GAAG;IACR,KAAK,OAAO;IACZ,KAAK,UAAU;MACb,OAAO,IAAI;EAAC;EAGhB,OAAOD,OAAO,CAACE,iBAAiB;AAClC"}
1
+ {"version":3,"names":["isHTMLElement","isInteractiveHTMLElement","element","tagName","isContentEditable"],"sources":["../../src/utils/isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAE9B;;;;AAIA,OAAO,SAASC,yBAAyBC,OAAgB,EAAE;EACzD,IAAI,CAACF,aAAA,CAAcE,OAAA,GAAU;IAC3B,OAAO,KAAK;EACd;EAEA,MAAM;IAAEC;EAAO,CAAE,GAAGD,OAAA;EACpB,QAAQC,OAAA;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;MACH,OAAO,IAAI;EAAA;EAGf,OAAOD,OAAA,CAAQE,iBAAiB;AAClC"}
@@ -20,11 +20,10 @@
20
20
  * @param callback2 - The second callback to be called, or undefined
21
21
  *
22
22
  * @returns A function that that calls the provided functions in order
23
- */
24
- export function mergeCallbacks(callback1, callback2) {
23
+ */export function mergeCallbacks(callback1, callback2) {
25
24
  return (...args) => {
26
- callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);
27
- callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);
25
+ callback1?.(...args);
26
+ callback2?.(...args);
28
27
  };
29
28
  }
30
29
  //# sourceMappingURL=mergeCallbacks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAM,SAAUA,cAAcA,CAC5BC,SAAgD,EAChDC,SAAgD;EAEhD,OAAO,CAAC,GAAGC,IAAU,KAAI;IACvBF,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGE,IAAI,CAAC;IACpBD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGC,IAAI,CAAC;EACtB,CAAC;AACH"}
1
+ {"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["../../src/utils/mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAuBA,OAAO,SAASA,eACdC,SAAgD,EAChDC,SAAgD,EAChD;EACA,OAAO,CAAC,GAAGC,IAAA,KAAe;IACxBF,SAAA,MAAeE,IAAA;IACfD,SAAA,MAAeC,IAAA;EACjB;AACF"}
package/lib/utils/omit.js CHANGED
@@ -10,8 +10,7 @@
10
10
  *
11
11
  * @param obj - The object to clone
12
12
  * @param exclusions - The array of keys to exclude
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
14
  export function omit(obj, exclusions) {
16
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
16
  const result = {};
@@ -1 +1 @@
1
- {"version":3,"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/omit.ts"],"sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"mappings":"AAAA;;;;;;;;;;;;;AAaA;AACA,OAAM,SAAUA,IAAIA,CAClBC,GAAS,EACTC,UAAsB;EAEtB;EACA,MAAMC,MAAM,GAAwB,EAAE;EAEtC,KAAK,MAAMC,GAAG,IAAIH,GAAG,EAAE;IACrB,IAAIC,UAAU,CAACG,OAAO,CAACD,GAAG,CAAC,KAAK,CAAC,CAAC,IAAIH,GAAG,CAACK,cAAc,CAACF,GAAG,CAAC,EAAE;MAC7DD,MAAM,CAACC,GAAG,CAAC,GAAGH,GAAG,CAACG,GAAG,CAAC;;;EAI1B,OAAOD,MAAc;AACvB"}
1
+ {"version":3,"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"sources":["../../src/utils/omit.ts"],"sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"mappings":"AAAA;;;;;;;;;;;;GAAA,CAaA;AACA,OAAO,SAASA,KACdC,GAAS,EACTC,UAAsB,EACU;EAChC;EACA,MAAMC,MAAA,GAA8B,CAAC;EAErC,KAAK,MAAMC,GAAA,IAAOH,GAAA,EAAK;IACrB,IAAIC,UAAA,CAAWG,OAAO,CAACD,GAAA,MAAS,CAAC,KAAKH,GAAA,CAAIK,cAAc,CAACF,GAAA,GAAM;MAC7DD,MAAM,CAACC,GAAA,CAAI,GAAGH,GAAG,CAACG,GAAA,CAAI;IACxB;EACF;EAEA,OAAOD,MAAA;AACT"}