@fluentui/react-utilities 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.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 (160) hide show
  1. package/CHANGELOG.json +5 -5
  2. package/CHANGELOG.md +5 -5
  3. package/lib/compose/getSlots.js +7 -6
  4. package/lib/compose/getSlots.js.map +1 -1
  5. package/lib/compose/index.js +4 -4
  6. package/lib/compose/index.js.map +1 -1
  7. package/lib/compose/isResolvedShorthand.js +2 -2
  8. package/lib/compose/isResolvedShorthand.js.map +1 -1
  9. package/lib/compose/resolveShorthand.js +3 -3
  10. package/lib/compose/resolveShorthand.js.map +1 -1
  11. package/lib/compose/types.js +1 -1
  12. package/lib/compose/types.js.map +1 -1
  13. package/lib/events/index.js +1 -1
  14. package/lib/events/index.js.map +1 -1
  15. package/lib/events/mouseTouchHelpers.js +4 -5
  16. package/lib/events/mouseTouchHelpers.js.map +1 -1
  17. package/lib/hooks/index.js +12 -12
  18. package/lib/hooks/index.js.map +1 -1
  19. package/lib/hooks/useControllableState.js +7 -7
  20. package/lib/hooks/useControllableState.js.map +1 -1
  21. package/lib/hooks/useEventCallback.js +3 -3
  22. package/lib/hooks/useEventCallback.js.map +1 -1
  23. package/lib/hooks/useFirstMount.js +1 -1
  24. package/lib/hooks/useFirstMount.js.map +1 -1
  25. package/lib/hooks/useForceUpdate.js +1 -1
  26. package/lib/hooks/useForceUpdate.js.map +1 -1
  27. package/lib/hooks/useId.js +6 -6
  28. package/lib/hooks/useId.js.map +1 -1
  29. package/lib/hooks/useIsomorphicLayoutEffect.js +4 -3
  30. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  31. package/lib/hooks/useMergedRefs.js +2 -2
  32. package/lib/hooks/useMergedRefs.js.map +1 -1
  33. package/lib/hooks/useOnClickOutside.js +23 -20
  34. package/lib/hooks/useOnClickOutside.js.map +1 -1
  35. package/lib/hooks/useOnScrollOutside.js +7 -7
  36. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  37. package/lib/hooks/usePrevious.js +1 -1
  38. package/lib/hooks/usePrevious.js.map +1 -1
  39. package/lib/hooks/useScrollbarWidth.js +5 -5
  40. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  41. package/lib/hooks/useTimeout.js +1 -1
  42. package/lib/hooks/useTimeout.js.map +1 -1
  43. package/lib/index.js +6 -6
  44. package/lib/index.js.map +1 -1
  45. package/lib/ssr/SSRContext.js +6 -5
  46. package/lib/ssr/SSRContext.js.map +1 -1
  47. package/lib/ssr/canUseDOM.js +3 -2
  48. package/lib/ssr/canUseDOM.js.map +1 -1
  49. package/lib/ssr/index.js +2 -2
  50. package/lib/ssr/index.js.map +1 -1
  51. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  52. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  53. package/lib/trigger/getTriggerChild.js +2 -2
  54. package/lib/trigger/getTriggerChild.js.map +1 -1
  55. package/lib/trigger/index.js +4 -4
  56. package/lib/trigger/index.js.map +1 -1
  57. package/lib/trigger/isFluentTrigger.js +0 -1
  58. package/lib/trigger/isFluentTrigger.js.map +1 -1
  59. package/lib/trigger/types.js +1 -1
  60. package/lib/trigger/types.js.map +1 -1
  61. package/lib/utils/clamp.js +2 -1
  62. package/lib/utils/clamp.js.map +1 -1
  63. package/lib/utils/getNativeElementProps.js +4 -4
  64. package/lib/utils/getNativeElementProps.js.map +1 -1
  65. package/lib/utils/getRTLSafeKey.js +7 -6
  66. package/lib/utils/getRTLSafeKey.js.map +1 -1
  67. package/lib/utils/getReactCallbackName.js +2 -3
  68. package/lib/utils/getReactCallbackName.js.map +1 -1
  69. package/lib/utils/index.js +8 -8
  70. package/lib/utils/index.js.map +1 -1
  71. package/lib/utils/isHTMLElement.js +4 -2
  72. package/lib/utils/isHTMLElement.js.map +1 -1
  73. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  74. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  75. package/lib/utils/mergeCallbacks.js +4 -3
  76. package/lib/utils/mergeCallbacks.js.map +1 -1
  77. package/lib/utils/omit.js +2 -1
  78. package/lib/utils/omit.js.map +1 -1
  79. package/lib/utils/properties.js +55 -28
  80. package/lib/utils/properties.js.map +1 -1
  81. package/lib-commonjs/compose/getSlots.js +55 -47
  82. package/lib-commonjs/compose/getSlots.js.map +1 -1
  83. package/lib-commonjs/compose/index.js +7 -8
  84. package/lib-commonjs/compose/index.js.map +1 -1
  85. package/lib-commonjs/compose/isResolvedShorthand.js +37 -9
  86. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  87. package/lib-commonjs/compose/resolveShorthand.js +32 -25
  88. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  89. package/lib-commonjs/compose/types.js +2 -5
  90. package/lib-commonjs/compose/types.js.map +1 -1
  91. package/lib-commonjs/events/index.js +4 -5
  92. package/lib-commonjs/events/index.js.map +1 -1
  93. package/lib-commonjs/events/mouseTouchHelpers.js +37 -40
  94. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  95. package/lib-commonjs/hooks/index.js +15 -16
  96. package/lib-commonjs/hooks/index.js.map +1 -1
  97. package/lib-commonjs/hooks/useControllableState.js +64 -63
  98. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  99. package/lib-commonjs/hooks/useEventCallback.js +31 -25
  100. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  101. package/lib-commonjs/hooks/useFirstMount.js +23 -15
  102. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  103. package/lib-commonjs/hooks/useForceUpdate.js +11 -9
  104. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  105. package/lib-commonjs/hooks/useId.js +47 -48
  106. package/lib-commonjs/hooks/useId.js.map +1 -1
  107. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +16 -10
  108. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  109. package/lib-commonjs/hooks/useMergedRefs.js +27 -25
  110. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  111. package/lib-commonjs/hooks/useOnClickOutside.js +115 -109
  112. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  113. package/lib-commonjs/hooks/useOnScrollOutside.js +36 -33
  114. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  115. package/lib-commonjs/hooks/usePrevious.js +15 -17
  116. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  117. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  118. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  119. package/lib-commonjs/hooks/useTimeout.js +30 -30
  120. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  121. package/lib-commonjs/index.js +214 -52
  122. package/lib-commonjs/index.js.map +1 -1
  123. package/lib-commonjs/ssr/SSRContext.js +59 -56
  124. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  125. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  126. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  127. package/lib-commonjs/ssr/index.js +5 -6
  128. package/lib-commonjs/ssr/index.js.map +1 -1
  129. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +31 -29
  130. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  131. package/lib-commonjs/trigger/getTriggerChild.js +36 -16
  132. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  133. package/lib-commonjs/trigger/index.js +7 -8
  134. package/lib-commonjs/trigger/index.js.map +1 -1
  135. package/lib-commonjs/trigger/isFluentTrigger.js +11 -10
  136. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  137. package/lib-commonjs/trigger/types.js +2 -5
  138. package/lib-commonjs/trigger/types.js.map +1 -1
  139. package/lib-commonjs/utils/clamp.js +9 -10
  140. package/lib-commonjs/utils/clamp.js.map +1 -1
  141. package/lib-commonjs/utils/getNativeElementProps.js +61 -54
  142. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  143. package/lib-commonjs/utils/getRTLSafeKey.js +21 -22
  144. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  145. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  146. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  147. package/lib-commonjs/utils/index.js +11 -12
  148. package/lib-commonjs/utils/index.js.map +1 -1
  149. package/lib-commonjs/utils/isHTMLElement.js +12 -12
  150. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  151. package/lib-commonjs/utils/isInteractiveHTMLElement.js +24 -20
  152. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  153. package/lib-commonjs/utils/mergeCallbacks.js +13 -14
  154. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  155. package/lib-commonjs/utils/omit.js +17 -18
  156. package/lib-commonjs/utils/omit.js.map +1 -1
  157. package/lib-commonjs/utils/properties.js +223 -327
  158. package/lib-commonjs/utils/properties.js.map +1 -1
  159. package/package.json +5 -4
  160. package/.swcrc +0 -39
@@ -1,38 +1,40 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "applyTriggerPropsToChildren", {
6
- enumerable: true,
7
- get: ()=>applyTriggerPropsToChildren
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _isFluentTrigger = require("./isFluentTrigger");
6
+ exports.applyTriggerPropsToChildren = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
9
+ /**
10
+ * @internal
11
+ * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.
12
+ */
12
13
  function applyTriggerPropsToChildren(children, triggerChildProps) {
13
- if (typeof children === "function") {
14
- return children(triggerChildProps);
15
- } else if (children) {
16
- return cloneTriggerTree(children, triggerChildProps);
17
- }
18
- // Components in React should return either JSX elements or "null", otherwise React will throw:
19
- // Nothing was returned from render.
20
- // This usually means a return statement is missing. Or, to render nothing, return null.
21
- return children || null;
14
+ if (typeof children === 'function') {
15
+ return children(triggerChildProps);
16
+ } else if (children) {
17
+ return cloneTriggerTree(children, triggerChildProps);
18
+ }
19
+ // Components in React should return either JSX elements or "null", otherwise React will throw:
20
+ // Nothing was returned from render.
21
+ // This usually means a return statement is missing. Or, to render nothing, return null.
22
+ return children || null;
22
23
  }
24
+ exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
23
25
  /**
24
26
  * Clones a React element tree, and applies the given props to the first grandchild that is not
25
27
  * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
26
- */ function cloneTriggerTree(child, triggerProps) {
27
- if (!/*#__PURE__*/ _react.isValidElement(child) || child.type === _react.Fragment) {
28
- throw new Error("A trigger element must be a single element for this component. " + "Please ensure that you're not using React Fragments.");
29
- }
30
- if ((0, _isFluentTrigger.isFluentTrigger)(child)) {
31
- const grandchild = cloneTriggerTree(child.props.children, triggerProps);
32
- return /*#__PURE__*/ _react.cloneElement(child, undefined, grandchild);
33
- } else {
34
- return /*#__PURE__*/ _react.cloneElement(child, triggerProps);
35
- }
36
- } //# sourceMappingURL=applyTriggerPropsToChildren.js.map
37
-
28
+ */
29
+ function cloneTriggerTree(child, triggerProps) {
30
+ if (!React.isValidElement(child) || child.type === React.Fragment) {
31
+ throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
32
+ }
33
+ if (isFluentTrigger_1.isFluentTrigger(child)) {
34
+ const grandchild = cloneTriggerTree(child.props.children, triggerProps);
35
+ return React.cloneElement(child, undefined, grandchild);
36
+ } else {
37
+ return React.cloneElement(child, triggerProps);
38
+ }
39
+ }
38
40
  //# sourceMappingURL=applyTriggerPropsToChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/trigger/applyTriggerPropsToChildren.js"],"sourcesContent":["import * as React from \"react\";\nimport { isFluentTrigger } from \"./isFluentTrigger\";\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(children, triggerChildProps) {\n if (typeof children === \"function\") {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 * 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(child, triggerProps) {\n if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\"A trigger element must be a single element for this component. \" + \"Please ensure that you're not using React Fragments.\");\n }\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return /*#__PURE__*/React.cloneElement(child, undefined, grandchild);\n } else {\n return /*#__PURE__*/React.cloneElement(child, triggerProps);\n }\n}\n//# sourceMappingURL=applyTriggerPropsToChildren.js.map"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"mappings":";;;;+BAMgBA;;aAAAA;;;6DANO;iCACS;AAKzB,SAASA,4BAA4BC,QAAQ,EAAEC,iBAAiB,EAAE;IACvE,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC,CAAC;IACD,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY,IAAI;AACzB;AACA;;;CAGC,GACD,SAASE,iBAAiBC,KAAK,EAAEC,YAAY,EAAE;IAC7C,IAAI,CAAE,WAAW,GAAEC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QAC/E,MAAM,IAAIC,MAAM,oEAAoE,wDAAwD;IAC9I,CAAC;IACD,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QAC1B,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,OAAO,WAAW,GAAEC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAC3D,OAAO;QACL,OAAO,WAAW,GAAEN,OAAMQ,YAAY,CAACV,OAAOC;IAChD,CAAC;AACH,EACA,uDAAuD"}
1
+ {"version":3,"names":["React","require","isFluentTrigger_1","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","exports","child","triggerProps","isValidElement","type","Fragment","Error","isFluentTrigger","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,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;;AAIA,SAAgBE,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;AAdAG,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA;AAgBA;;;;AAIA,SAASG,gBAAgBA,CACvBE,KAAsB,EACtBC,YAA+B;EAE/B,IAAI,CAACT,KAAK,CAACU,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKX,KAAK,CAACY,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAK,CACb,iEAAiE,GAC/D,sDAAsD,CACzD;;EAGH,IAAIX,iBAAA,CAAAY,eAAe,CAACN,KAAK,CAAC,EAAE;IAC1B,MAAMO,UAAU,GAAGT,gBAAgB,CAACE,KAAK,CAACQ,KAAK,CAACZ,QAAQ,EAAEK,YAAY,CAAC;IACvE,OAAOT,KAAK,CAACiB,YAAY,CAACT,KAAK,EAAEU,SAAS,EAAEH,UAAU,CAAC;GACxD,MAAM;IACL,OAAOf,KAAK,CAACiB,YAAY,CAACT,KAAK,EAAEC,YAAoD,CAAC;;AAE1F"}
@@ -1,21 +1,41 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getTriggerChild", {
6
- enumerable: true,
7
- get: ()=>getTriggerChild
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _isFluentTrigger = require("./isFluentTrigger");
6
+ exports.getTriggerChild = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
9
+ /**
10
+ * @internal
11
+ * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
12
+ *
13
+ * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
14
+ * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
15
+ * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
16
+ *
17
+ * For example, the following returns `<div id="child" />`:
18
+ * ```jsx
19
+ * getTriggerChild(
20
+ * <Tooltip>
21
+ * <MenuTrigger>
22
+ * <div id="child" />
23
+ * </MenuTrigger>
24
+ * </Tooltip>
25
+ * );
26
+ * ```
27
+ *
28
+ * In the case where the immediate child is not a valid element,
29
+ * null is returned
30
+ */
12
31
  function getTriggerChild(children) {
13
- if (!/*#__PURE__*/ _react.isValidElement(children)) {
14
- return null;
15
- }
16
- return (0, _isFluentTrigger.isFluentTrigger)(children) ? getTriggerChild(// FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
17
- // but for some reason it's failing on build
18
- children.props.children) : children;
19
- } //# sourceMappingURL=getTriggerChild.js.map
20
-
32
+ if (!React.isValidElement(children)) {
33
+ return null;
34
+ }
35
+ return isFluentTrigger_1.isFluentTrigger(children) ? getTriggerChild(
36
+ // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
37
+ // but for some reason it's failing on build
38
+ children.props.children) : children;
39
+ }
40
+ exports.getTriggerChild = getTriggerChild;
21
41
  //# sourceMappingURL=getTriggerChild.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/trigger/getTriggerChild.js"],"sourcesContent":["import * as React from \"react\";\nimport { isFluentTrigger } from \"./isFluentTrigger\";\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(children) {\n if (! /*#__PURE__*/React.isValidElement(children)) {\n return null;\n }\n return isFluentTrigger(children) ? 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.children) : children;\n}\n//# sourceMappingURL=getTriggerChild.js.map"],"names":["getTriggerChild","children","React","isValidElement","isFluentTrigger","props"],"mappings":";;;;+BAwBgBA;;aAAAA;;;6DAxBO;iCACS;AAuBzB,SAASA,gBAAgBC,QAAQ,EAAE;IACxC,IAAI,CAAE,WAAW,GAAEC,OAAMC,cAAc,CAACF,WAAW;QACjD,OAAO,IAAI;IACb,CAAC;IACD,OAAOG,IAAAA,gCAAe,EAACH,YAAYD,gBACnC,uFAAuF;IACvF,4CAA4C;IAC5CC,SAASI,KAAK,CAACJ,QAAQ,IAAIA,QAAQ;AACrC,EACA,2CAA2C"}
1
+ {"version":3,"names":["React","require","isFluentTrigger_1","getTriggerChild","children","isValidElement","isFluentTrigger","props","exports"],"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,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgBE,eAAeA,CAC7BC,QAAqD;EAGrD,IAAI,CAACJ,KAAK,CAACK,cAAc,CAAoBD,QAAQ,CAAC,EAAE;IACtD,OAAO,IAAI;;EAEb,OAAOF,iBAAA,CAAAI,eAAe,CAACF,QAAQ,CAAC,GAC5BD,eAAe;EACb;EACA;EACCC,QAAQ,CAACG,KAAsB,CAACH,QAAQ,CAC1C,GACDA,QAAQ;AACd;AAdAI,OAAA,CAAAL,eAAA,GAAAA,eAAA"}
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./applyTriggerPropsToChildren"), exports);
7
- _exportStar(require("./getTriggerChild"), exports);
8
- _exportStar(require("./isFluentTrigger"), exports);
9
- _exportStar(require("./types"), exports);
10
- //# sourceMappingURL=index.js.map
11
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
8
+ tslib_1.__exportStar(require("./getTriggerChild"), exports);
9
+ tslib_1.__exportStar(require("./isFluentTrigger"), exports);
10
+ tslib_1.__exportStar(require("./types"), exports);
12
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/trigger/index.js"],"sourcesContent":["export * from \"./applyTriggerPropsToChildren\";\nexport * from \"./getTriggerChild\";\nexport * from \"./isFluentTrigger\";\nexport * from \"./types\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mCAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,aAAAC,OAAA"}
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "isFluentTrigger", {
6
- enumerable: true,
7
- get: ()=>isFluentTrigger
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
6
+ exports.isFluentTrigger = void 0;
7
+ /**
8
+ * @internal
9
+ * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
10
+ * See the {@link FluentTriggerComponent} type for more info.
11
+ */
11
12
  function isFluentTrigger(element) {
12
- return Boolean(element.type.isFluentTriggerComponent);
13
- } //# sourceMappingURL=isFluentTrigger.js.map
14
-
13
+ return Boolean(element.type.isFluentTriggerComponent);
14
+ }
15
+ exports.isFluentTrigger = isFluentTrigger;
15
16
  //# sourceMappingURL=isFluentTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/trigger/isFluentTrigger.js"],"sourcesContent":["import * as React from \"react\";\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) {\n return Boolean(element.type.isFluentTriggerComponent);\n}\n//# sourceMappingURL=isFluentTrigger.js.map"],"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"mappings":";;;;+BAMgBA;;aAAAA;;;6DANO;AAMhB,SAASA,gBAAgBC,OAAO,EAAE;IACvC,OAAOC,QAAQD,QAAQE,IAAI,CAACC,wBAAwB;AACtD,EACA,2CAA2C"}
1
+ {"version":3,"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent","exports"],"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,SAAgBA,eAAeA,CAACC,OAA2B;EACzD,OAAOC,OAAO,CAAED,OAAO,CAACE,IAA+B,CAACC,wBAAwB,CAAC;AACnF;AAFAC,OAAA,CAAAL,eAAA,GAAAA,eAAA"}
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
- //# sourceMappingURL=types.js.map
8
-
9
6
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/trigger/types.js"],"sourcesContent":["import * as React from \"react\";\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
1
+ {"version":3,"names":[],"sources":["../../../../../../../../packages/react-components/react-utilities/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":""}
@@ -1,3 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clamp = void 0;
1
7
  /**
2
8
  * @internal
3
9
  * Clamps `value` to a number between the min and max.
@@ -5,14 +11,7 @@
5
11
  * @param value - the value to be clamped
6
12
  * @param min - the lowest valid value
7
13
  * @param max - the highest valid value
8
- */ "use strict";
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- Object.defineProperty(exports, "clamp", {
13
- enumerable: true,
14
- get: ()=>clamp
15
- });
16
- const clamp = (value, min, max)=>Math.max(min, Math.min(max, value || 0)); //# sourceMappingURL=clamp.js.map
17
-
14
+ */
15
+ const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
16
+ exports.clamp = clamp;
18
17
  //# sourceMappingURL=clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/utils/clamp.js"],"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 */export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));\n//# sourceMappingURL=clamp.js.map"],"names":["clamp","value","min","max","Math"],"mappings":"AAAA;;;;;;;CAOC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,QAAQ,CAACC,OAAOC,KAAKC,MAAQC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS,KAClF,iCAAiC"}
1
+ {"version":3,"names":["clamp","value","min","max","Math","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/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;;;;;;;;AAQO,MAAMA,KAAK,GAAGA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,KAAaC,IAAI,CAACD,GAAG,CAACD,GAAG,EAAEE,IAAI,CAACF,GAAG,CAACC,GAAG,EAAEF,KAAK,IAAI,CAAC,CAAC,CAAC;AAArGI,OAAA,CAAAL,KAAK,GAAAA,KAAA"}
@@ -1,62 +1,69 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getNativeElementProps: ()=>getNativeElementProps,
13
- getPartitionedNativeProps: ()=>getPartitionedNativeProps
4
+ value: true
14
5
  });
15
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
16
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
17
- const _properties = require("./properties");
6
+ exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;
7
+ const properties_1 = /*#__PURE__*/require("./properties");
18
8
  const nativeElementMap = {
19
- label: _properties.labelProperties,
20
- audio: _properties.audioProperties,
21
- video: _properties.videoProperties,
22
- ol: _properties.olProperties,
23
- li: _properties.liProperties,
24
- a: _properties.anchorProperties,
25
- button: _properties.buttonProperties,
26
- input: _properties.inputProperties,
27
- textarea: _properties.textAreaProperties,
28
- select: _properties.selectProperties,
29
- option: _properties.optionProperties,
30
- table: _properties.tableProperties,
31
- tr: _properties.trProperties,
32
- th: _properties.thProperties,
33
- td: _properties.tdProperties,
34
- colGroup: _properties.colGroupProperties,
35
- col: _properties.colProperties,
36
- fieldset: _properties.fieldsetProperties,
37
- form: _properties.formProperties,
38
- iframe: _properties.iframeProperties,
39
- img: _properties.imgProperties,
40
- time: _properties.timeProperties,
41
- dialog: _properties.dialogProperties
9
+ label: properties_1.labelProperties,
10
+ audio: properties_1.audioProperties,
11
+ video: properties_1.videoProperties,
12
+ ol: properties_1.olProperties,
13
+ li: properties_1.liProperties,
14
+ a: properties_1.anchorProperties,
15
+ button: properties_1.buttonProperties,
16
+ input: properties_1.inputProperties,
17
+ textarea: properties_1.textAreaProperties,
18
+ select: properties_1.selectProperties,
19
+ option: properties_1.optionProperties,
20
+ table: properties_1.tableProperties,
21
+ tr: properties_1.trProperties,
22
+ th: properties_1.thProperties,
23
+ td: properties_1.tdProperties,
24
+ colGroup: properties_1.colGroupProperties,
25
+ col: properties_1.colProperties,
26
+ fieldset: properties_1.fieldsetProperties,
27
+ form: properties_1.formProperties,
28
+ iframe: properties_1.iframeProperties,
29
+ img: properties_1.imgProperties,
30
+ time: properties_1.timeProperties,
31
+ dialog: properties_1.dialogProperties
42
32
  };
33
+ /**
34
+ * Given an element tagname and user props, filters the props to only allowed props for the given
35
+ * element type.
36
+ * @param tagName - Tag name (e.g. "div")
37
+ * @param props - Props object
38
+ * @param excludedPropNames - List of props to disallow
39
+ */
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
41
  function getNativeElementProps(tagName, props, excludedPropNames) {
44
- const allowedPropNames = tagName && nativeElementMap[tagName] || _properties.htmlElementProperties;
45
- allowedPropNames.as = 1;
46
- return (0, _properties.getNativeProps)(props, allowedPropNames, excludedPropNames);
42
+ const allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
43
+ allowedPropNames.as = 1;
44
+ return properties_1.getNativeProps(props, allowedPropNames, excludedPropNames);
47
45
  }
48
- const getPartitionedNativeProps = ({ primarySlotTagName , props , excludedPropNames })=>{
49
- return {
50
- root: {
51
- style: props.style,
52
- className: props.className
53
- },
54
- primary: getNativeElementProps(primarySlotTagName, props, [
55
- ...excludedPropNames || [],
56
- "style",
57
- "className"
58
- ])
59
- };
60
- }; //# sourceMappingURL=getNativeElementProps.js.map
61
-
46
+ exports.getNativeElementProps = getNativeElementProps;
47
+ /**
48
+ * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
49
+ *
50
+ * This function is only for use with components that have a primary slot other than `root`.
51
+ * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
52
+ *
53
+ * @returns An object containing the native props for the `root` and primary slots.
54
+ */
55
+ const getPartitionedNativeProps = ({
56
+ primarySlotTagName,
57
+ props,
58
+ excludedPropNames
59
+ }) => {
60
+ return {
61
+ root: {
62
+ style: props.style,
63
+ className: props.className
64
+ },
65
+ primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
66
+ };
67
+ };
68
+ exports.getPartitionedNativeProps = getPartitionedNativeProps;
62
69
  //# sourceMappingURL=getNativeElementProps.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/utils/getNativeElementProps.js"],"sourcesContent":["import * as React from \"react\";\nimport { 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\";\nconst nativeElementMap = {\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 * 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 */ // eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps(tagName, props, excludedPropNames) {\n const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;\n allowedPropNames.as = 1;\n return getNativeProps(props, allowedPropNames, excludedPropNames);\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 primarySlotTagName,\n props,\n excludedPropNames\n}) => {\n return {\n root: {\n style: props.style,\n className: props.className\n },\n primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), \"style\", \"className\"])\n };\n};\n//# sourceMappingURL=getNativeElementProps.js.map"],"names":["getNativeElementProps","getPartitionedNativeProps","nativeElementMap","label","labelProperties","audio","audioProperties","video","videoProperties","ol","olProperties","li","liProperties","a","anchorProperties","button","buttonProperties","input","inputProperties","textarea","textAreaProperties","select","selectProperties","option","optionProperties","table","tableProperties","tr","trProperties","th","thProperties","td","tdProperties","colGroup","colGroupProperties","col","colProperties","fieldset","fieldsetProperties","form","formProperties","iframe","iframeProperties","img","imgProperties","time","timeProperties","dialog","dialogProperties","tagName","props","excludedPropNames","allowedPropNames","htmlElementProperties","as","getNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":";;;;;;;;;;;IAkCgBA,qBAAqB,MAArBA;IAaHC,yBAAyB,MAAzBA;;;6DA/CU;4BACga;AACvb,MAAMC,mBAAmB;IACvBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,GAAGC,4BAAgB;IACnBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,UAAUC,8BAAkB;IAC5BC,QAAQC,4BAAgB;IACxBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,UAAUC,8BAAkB;IAC5BC,KAAKC,yBAAa;IAClBC,UAAUC,8BAAkB;IAC5BC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;IACxBC,KAAKC,yBAAa;IAClBC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;AAC1B;AAQO,SAAShD,sBAAsBiD,OAAO,EAAEC,KAAK,EAAEC,iBAAiB,EAAE;IACvE,MAAMC,mBAAmBH,WAAW/C,gBAAgB,CAAC+C,QAAQ,IAAII,iCAAqB;IACtFD,iBAAiBE,EAAE,GAAG;IACtB,OAAOC,IAAAA,0BAAc,EAACL,OAAOE,kBAAkBD;AACjD;AASO,MAAMlD,4BAA4B,CAAC,EACxCuD,mBAAkB,EAClBN,MAAK,EACLC,kBAAiB,EAClB,GAAK;IACJ,OAAO;QACLM,MAAM;YACJC,OAAOR,MAAMQ,KAAK;YAClBC,WAAWT,MAAMS,SAAS;QAC5B;QACAC,SAAS5D,sBAAsBwD,oBAAoBN,OAAO;eAAKC,qBAAqB,EAAE;YAAG;YAAS;SAAY;IAChH;AACF,GACA,iDAAiD"}
1
+ {"version":3,"names":["properties_1","require","nativeElementMap","label","labelProperties","audio","audioProperties","video","videoProperties","ol","olProperties","li","liProperties","a","anchorProperties","button","buttonProperties","input","inputProperties","textarea","textAreaProperties","select","selectProperties","option","optionProperties","table","tableProperties","tr","trProperties","th","thProperties","td","tdProperties","colGroup","colGroupProperties","col","colProperties","fieldset","fieldsetProperties","form","formProperties","iframe","iframeProperties","img","imgProperties","time","timeProperties","dialog","dialogProperties","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","htmlElementProperties","as","getNativeProps","exports","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,MAAAA,YAAA,gBAAAC,OAAA;AA4BA,MAAMC,gBAAgB,GAA2C;EAC/DC,KAAK,EAAEH,YAAA,CAAAI,eAAe;EACtBC,KAAK,EAAEL,YAAA,CAAAM,eAAe;EACtBC,KAAK,EAAEP,YAAA,CAAAQ,eAAe;EACtBC,EAAE,EAAET,YAAA,CAAAU,YAAY;EAChBC,EAAE,EAAEX,YAAA,CAAAY,YAAY;EAChBC,CAAC,EAAEb,YAAA,CAAAc,gBAAgB;EACnBC,MAAM,EAAEf,YAAA,CAAAgB,gBAAgB;EACxBC,KAAK,EAAEjB,YAAA,CAAAkB,eAAe;EACtBC,QAAQ,EAAEnB,YAAA,CAAAoB,kBAAkB;EAC5BC,MAAM,EAAErB,YAAA,CAAAsB,gBAAgB;EACxBC,MAAM,EAAEvB,YAAA,CAAAwB,gBAAgB;EACxBC,KAAK,EAAEzB,YAAA,CAAA0B,eAAe;EACtBC,EAAE,EAAE3B,YAAA,CAAA4B,YAAY;EAChBC,EAAE,EAAE7B,YAAA,CAAA8B,YAAY;EAChBC,EAAE,EAAE/B,YAAA,CAAAgC,YAAY;EAChBC,QAAQ,EAAEjC,YAAA,CAAAkC,kBAAkB;EAC5BC,GAAG,EAAEnC,YAAA,CAAAoC,aAAa;EAClBC,QAAQ,EAAErC,YAAA,CAAAsC,kBAAkB;EAC5BC,IAAI,EAAEvC,YAAA,CAAAwC,cAAc;EACpBC,MAAM,EAAEzC,YAAA,CAAA0C,gBAAgB;EACxBC,GAAG,EAAE3C,YAAA,CAAA4C,aAAa;EAClBC,IAAI,EAAE7C,YAAA,CAAA8C,cAAc;EACpBC,MAAM,EAAE/C,YAAA,CAAAgD;CACT;AAED;;;;;;;AAOA;AACA,SAAgBC,qBAAqBA,CACnCC,OAAe,EACfC,KAAS,EACTC,iBAA4B;EAE5B,MAAMC,gBAAgB,GAAIH,OAAO,IAAIhD,gBAAgB,CAACgD,OAAO,CAAC,IAAKlD,YAAA,CAAAsD,qBAAqB;EACxFD,gBAAgB,CAACE,EAAE,GAAG,CAAC;EAEvB,OAAOvD,YAAA,CAAAwD,cAAc,CAACL,KAAK,EAAEE,gBAAgB,EAAED,iBAAiB,CAAC;AACnE;AATAK,OAAA,CAAAR,qBAAA,GAAAA,qBAAA;AAWA;;;;;;;;AAQO,MAAMS,yBAAyB,GAAGA,CAGvC;EACAC,kBAAkB;EAClBR,KAAK;EACLC;AAAiB,CAUlB,KAAI;EACH,OAAO;IACLQ,IAAI,EAAE;MAAEC,KAAK,EAAEV,KAAK,CAACU,KAAK;MAAEC,SAAS,EAAEX,KAAK,CAACW;IAAS,CAAE;IACxDC,OAAO,EAAEd,qBAAqB,CAAgCU,kBAAkB,EAAER,KAAK,EAAE,CACvF,IAAIC,iBAAiB,IAAI,EAAE,CAAC,EAC5B,OAAO,EACP,WAAW,CACZ;GACF;AACH,CAAC;AAzBYK,OAAA,CAAAC,yBAAyB,GAAAA,yBAAA"}
@@ -1,28 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getRTLSafeKey = void 0;
1
7
  /**
2
8
  * @internal
3
9
  * Finds and swaps a provided key for it's right to left format.
4
- */ "use strict";
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "getRTLSafeKey", {
9
- enumerable: true,
10
- get: ()=>getRTLSafeKey
11
- });
12
- const getRTLSafeKey = (key, dir)=>{
13
- if (dir === "rtl") {
14
- switch(key){
15
- case "ArrowLeft":
16
- {
17
- return "ArrowRight";
18
- }
19
- case "ArrowRight":
20
- {
21
- return "ArrowLeft";
22
- }
10
+ */
11
+ const getRTLSafeKey = (key, dir) => {
12
+ if (dir === 'rtl') {
13
+ switch (key) {
14
+ case 'ArrowLeft':
15
+ {
16
+ return 'ArrowRight';
17
+ }
18
+ case 'ArrowRight':
19
+ {
20
+ return 'ArrowLeft';
23
21
  }
24
22
  }
25
- return key;
26
- }; //# sourceMappingURL=getRTLSafeKey.js.map
27
-
23
+ }
24
+ return key;
25
+ };
26
+ exports.getRTLSafeKey = getRTLSafeKey;
28
27
  //# sourceMappingURL=getRTLSafeKey.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/utils/getRTLSafeKey.js"],"sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */export const getRTLSafeKey = (key, dir) => {\n if (dir === \"rtl\") {\n switch (key) {\n case \"ArrowLeft\":\n {\n return \"ArrowRight\";\n }\n case \"ArrowRight\":\n {\n return \"ArrowLeft\";\n }\n }\n }\n return key;\n};\n//# sourceMappingURL=getRTLSafeKey.js.map"],"names":["getRTLSafeKey","key","dir"],"mappings":"AAAA;;;CAGC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,gBAAgB,CAACC,KAAKC,MAAQ;IAC5C,IAAIA,QAAQ,OAAO;QACjB,OAAQD;YACN,KAAK;gBACH;oBACE,OAAO;gBACT;YACF,KAAK;gBACH;oBACE,OAAO;gBACT;QACJ;IACF,CAAC;IACD,OAAOA;AACT,GACA,yCAAyC"}
1
+ {"version":3,"names":["getRTLSafeKey","key","dir","exports"],"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;;;;AAIO,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;AAdYE,OAAA,CAAAH,aAAa,GAAAA,aAAA"}
@@ -1,30 +1,30 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getReactCallbackName", {
6
- enumerable: true,
7
- get: ()=>getReactCallbackName
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
6
+ exports.getReactCallbackName = void 0;
7
+ /**
8
+ * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
9
+ *
10
+ * Ideally, it should also distinguish regular and "capture" callbacks, but it's possible only with React 17 as
11
+ * ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
12
+ * are handled in bubble phase.
13
+ */
11
14
  function getReactCallbackName(event) {
12
- if (event._reactName) {
13
- return event._reactName;
14
- }
15
- if (event.dispatchConfig) {
16
- if (event.dispatchConfig.registrationName) {
17
- return event.dispatchConfig.registrationName;
18
- }
19
- return event.dispatchConfig.phasedRegistrationNames.bubbled;
15
+ if (event._reactName) {
16
+ return event._reactName;
17
+ }
18
+ if (event.dispatchConfig) {
19
+ if (event.dispatchConfig.registrationName) {
20
+ return event.dispatchConfig.registrationName;
20
21
  }
21
- if (process.env.NODE_ENV !== "production") {
22
- // eslint-disable-next-line no-console
23
- console.error([
24
- 'Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".',
25
- "This should not happen, please report it to https://github.com/microsoft/fluentui"
26
- ]);
27
- }
28
- } //# sourceMappingURL=getReactCallbackName.js.map
29
-
22
+ return event.dispatchConfig.phasedRegistrationNames.bubbled;
23
+ }
24
+ if (process.env.NODE_ENV !== 'production') {
25
+ // eslint-disable-next-line no-console
26
+ console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
27
+ }
28
+ }
29
+ exports.getReactCallbackName = getReactCallbackName;
30
30
  //# sourceMappingURL=getReactCallbackName.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/utils/getReactCallbackName.js"],"sourcesContent":["import * as React from \"react\";\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) {\n if (event._reactName) {\n return event._reactName;\n }\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName;\n }\n return event.dispatchConfig.phasedRegistrationNames.bubbled;\n }\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.error(['Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".', \"This should not happen, please report it to https://github.com/microsoft/fluentui\"]);\n }\n}\n//# sourceMappingURL=getReactCallbackName.js.map"],"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"mappings":";;;;+BAQgBA;;aAAAA;;;6DARO;AAQhB,SAASA,qBAAqBC,KAAK,EAAE;IAC1C,IAAIA,MAAMC,UAAU,EAAE;QACpB,OAAOD,MAAMC,UAAU;IACzB,CAAC;IACD,IAAID,MAAME,cAAc,EAAE;QACxB,IAAIF,MAAME,cAAc,CAACC,gBAAgB,EAAE;YACzC,OAAOH,MAAME,cAAc,CAACC,gBAAgB;QAC9C,CAAC;QACD,OAAOH,MAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;IAC7D,CAAC;IACD,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sCAAsC;QACtCC,QAAQC,KAAK,CAAC;YAAC;YAAoF;SAAoF;IACzL,CAAC;AACH,EACA,gDAAgD"}
1
+ {"version":3,"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error","exports"],"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,SAAgBA,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;AApBAC,OAAA,CAAAZ,oBAAA,GAAAA,oBAAA"}
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./clamp"), exports);
7
- _exportStar(require("./getNativeElementProps"), exports);
8
- _exportStar(require("./getRTLSafeKey"), exports);
9
- _exportStar(require("./mergeCallbacks"), exports);
10
- _exportStar(require("./omit"), exports);
11
- _exportStar(require("./properties"), exports);
12
- _exportStar(require("./isHTMLElement"), exports);
13
- _exportStar(require("./isInteractiveHTMLElement"), exports);
14
- //# sourceMappingURL=index.js.map
15
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./clamp"), exports);
8
+ tslib_1.__exportStar(require("./getNativeElementProps"), exports);
9
+ tslib_1.__exportStar(require("./getRTLSafeKey"), exports);
10
+ tslib_1.__exportStar(require("./mergeCallbacks"), exports);
11
+ tslib_1.__exportStar(require("./omit"), exports);
12
+ tslib_1.__exportStar(require("./properties"), exports);
13
+ tslib_1.__exportStar(require("./isHTMLElement"), exports);
14
+ tslib_1.__exportStar(require("./isInteractiveHTMLElement"), exports);
16
15
  //# sourceMappingURL=index.js.map