@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.
- package/CHANGELOG.json +5 -5
- package/CHANGELOG.md +5 -5
- package/lib/compose/getSlots.js +7 -6
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js +4 -4
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +2 -2
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/resolveShorthand.js +3 -3
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js +4 -5
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js +12 -12
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +7 -7
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +3 -3
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +6 -6
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +4 -3
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +2 -2
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +23 -20
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +7 -7
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js +5 -5
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +6 -5
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +3 -2
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js +2 -2
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js +2 -2
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js +4 -4
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js +0 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js +2 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +4 -4
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +7 -6
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +2 -3
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +8 -8
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +4 -2
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +5 -5
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +4 -3
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +2 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +55 -28
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +55 -47
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +7 -8
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +37 -9
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +32 -25
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +2 -5
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +4 -5
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +37 -40
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +15 -16
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +64 -63
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +31 -25
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +23 -15
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +11 -9
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +47 -48
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +16 -10
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +27 -25
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +115 -109
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +36 -33
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +15 -17
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +30 -30
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +214 -52
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +59 -56
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +12 -12
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +5 -6
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +31 -29
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +36 -16
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +7 -8
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +11 -10
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +2 -5
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +9 -10
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +61 -54
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +21 -22
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +24 -24
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +11 -12
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +12 -12
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +24 -20
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +13 -14
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +17 -18
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +223 -327
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +5 -4
- package/.swcrc +0 -39
@@ -1,38 +1,40 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "applyTriggerPropsToChildren", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>applyTriggerPropsToChildren
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
*/
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
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":["
|
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
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "getTriggerChild", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>getTriggerChild
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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":["
|
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
|
-
|
4
|
+
value: true
|
4
5
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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":["
|
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
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "isFluentTrigger", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>isFluentTrigger
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
}
|
14
|
-
|
13
|
+
return Boolean(element.type.isFluentTriggerComponent);
|
14
|
+
}
|
15
|
+
exports.isFluentTrigger = isFluentTrigger;
|
15
16
|
//# sourceMappingURL=isFluentTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
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
|
-
|
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":["
|
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
|
-
*/
|
9
|
-
|
10
|
-
|
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":["
|
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
|
-
|
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
|
-
|
16
|
-
const
|
17
|
-
const _properties = require("./properties");
|
6
|
+
exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;
|
7
|
+
const properties_1 = /*#__PURE__*/require("./properties");
|
18
8
|
const nativeElementMap = {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
42
|
+
const allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
|
43
|
+
allowedPropNames.as = 1;
|
44
|
+
return properties_1.getNativeProps(props, allowedPropNames, excludedPropNames);
|
47
45
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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,"
|
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
|
-
*/
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
23
|
+
}
|
24
|
+
return key;
|
25
|
+
};
|
26
|
+
exports.getRTLSafeKey = getRTLSafeKey;
|
28
27
|
//# sourceMappingURL=getRTLSafeKey.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
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
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "getReactCallbackName", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>getReactCallbackName
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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":["
|
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
|
-
|
4
|
+
value: true
|
4
5
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|