@fluentui/react-utilities 9.7.1 → 9.7.3
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/.swcrc +30 -0
- package/CHANGELOG.json +49 -1
- package/CHANGELOG.md +23 -2
- package/dist/index.d.ts +16 -4
- package/lib/compose/getSlots.js +3 -3
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- 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.map +1 -1
- package/lib/events/mouseTouchHelpers.js +1 -0
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +16 -9
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +3 -1
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +2 -2
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +1 -2
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js +1 -0
- 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 +1 -2
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +2 -2
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +1 -2
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +1 -0
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +12 -7
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +1 -2
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +1 -2
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +24 -51
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +48 -55
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +8 -7
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +25 -32
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +5 -2
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +5 -4
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +16 -15
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +63 -64
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +25 -31
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +15 -23
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +9 -11
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +47 -46
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +25 -27
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +118 -114
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +35 -36
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +17 -15
- 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 +52 -214
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +57 -59
- 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 +6 -5
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +16 -36
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +8 -7
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +5 -2
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +10 -9
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +54 -61
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
- 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 +12 -11
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +22 -15
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +14 -13
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +18 -17
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +327 -223
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +5 -4
- package/lib-amd/compose/getSlots.js +0 -58
- package/lib-amd/compose/getSlots.js.map +0 -1
- package/lib-amd/compose/index.js +0 -9
- package/lib-amd/compose/index.js.map +0 -1
- package/lib-amd/compose/isResolvedShorthand.js +0 -40
- package/lib-amd/compose/isResolvedShorthand.js.map +0 -1
- package/lib-amd/compose/resolveShorthand.js +0 -27
- package/lib-amd/compose/resolveShorthand.js.map +0 -1
- package/lib-amd/compose/types.js +0 -5
- package/lib-amd/compose/types.js.map +0 -1
- package/lib-amd/events/index.js +0 -6
- package/lib-amd/events/index.js.map +0 -1
- package/lib-amd/events/mouseTouchHelpers.js +0 -39
- package/lib-amd/events/mouseTouchHelpers.js.map +0 -1
- package/lib-amd/hooks/index.js +0 -17
- package/lib-amd/hooks/index.js.map +0 -1
- package/lib-amd/hooks/useControllableState.js +0 -81
- package/lib-amd/hooks/useControllableState.js.map +0 -1
- package/lib-amd/hooks/useEventCallback.js +0 -36
- package/lib-amd/hooks/useEventCallback.js.map +0 -1
- package/lib-amd/hooks/useFirstMount.js +0 -26
- package/lib-amd/hooks/useFirstMount.js.map +0 -1
- package/lib-amd/hooks/useForceUpdate.js +0 -14
- package/lib-amd/hooks/useForceUpdate.js.map +0 -1
- package/lib-amd/hooks/useId.js +0 -54
- package/lib-amd/hooks/useId.js.map +0 -1
- package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -17
- package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
- package/lib-amd/hooks/useMergedRefs.js +0 -34
- package/lib-amd/hooks/useMergedRefs.js.map +0 -1
- package/lib-amd/hooks/useOnClickOutside.js +0 -114
- package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
- package/lib-amd/hooks/useOnScrollOutside.js +0 -31
- package/lib-amd/hooks/useOnScrollOutside.js.map +0 -1
- package/lib-amd/hooks/usePrevious.js +0 -17
- package/lib-amd/hooks/usePrevious.js.map +0 -1
- package/lib-amd/hooks/useScrollbarWidth.js +0 -32
- package/lib-amd/hooks/useScrollbarWidth.js.map +0 -1
- package/lib-amd/hooks/useTimeout.js +0 -33
- package/lib-amd/hooks/useTimeout.js.map +0 -1
- package/lib-amd/index.js +0 -40
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/ssr/SSRContext.js +0 -69
- package/lib-amd/ssr/SSRContext.js.map +0 -1
- package/lib-amd/ssr/canUseDOM.js +0 -16
- package/lib-amd/ssr/canUseDOM.js.map +0 -1
- package/lib-amd/ssr/index.js +0 -7
- package/lib-amd/ssr/index.js.map +0 -1
- package/lib-amd/trigger/applyTriggerPropsToChildren.js +0 -40
- package/lib-amd/trigger/applyTriggerPropsToChildren.js.map +0 -1
- package/lib-amd/trigger/getTriggerChild.js +0 -40
- package/lib-amd/trigger/getTriggerChild.js.map +0 -1
- package/lib-amd/trigger/index.js +0 -9
- package/lib-amd/trigger/index.js.map +0 -1
- package/lib-amd/trigger/isFluentTrigger.js +0 -15
- package/lib-amd/trigger/isFluentTrigger.js.map +0 -1
- package/lib-amd/trigger/types.js +0 -5
- package/lib-amd/trigger/types.js.map +0 -1
- package/lib-amd/utils/clamp.js +0 -16
- package/lib-amd/utils/clamp.js.map +0 -1
- package/lib-amd/utils/getNativeElementProps.js +0 -64
- package/lib-amd/utils/getNativeElementProps.js.map +0 -1
- package/lib-amd/utils/getRTLSafeKey.js +0 -24
- package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
- package/lib-amd/utils/index.js +0 -13
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/isHTMLElement.js +0 -22
- package/lib-amd/utils/isHTMLElement.js.map +0 -1
- package/lib-amd/utils/isInteractiveHTMLElement.js +0 -25
- package/lib-amd/utils/isInteractiveHTMLElement.js.map +0 -1
- package/lib-amd/utils/mergeCallbacks.js +0 -40
- package/lib-amd/utils/mergeCallbacks.js.map +0 -1
- package/lib-amd/utils/omit.js +0 -31
- package/lib-amd/utils/omit.js.map +0 -1
- package/lib-amd/utils/properties.js +0 -450
- package/lib-amd/utils/properties.js.map +0 -1
@@ -1,69 +1,67 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
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
|
+
defaultSSRContextValue: ()=>defaultSSRContextValue,
|
13
|
+
SSRContext: ()=>SSRContext,
|
14
|
+
useSSRContext: ()=>useSSRContext,
|
15
|
+
SSRProvider: ()=>SSRProvider,
|
16
|
+
useIsSSR: ()=>useIsSSR
|
5
17
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
* @internal
|
13
|
-
*/
|
14
|
-
exports.defaultSSRContextValue = {
|
15
|
-
current: 0
|
18
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
19
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
20
|
+
const _canUseDOM = require("./canUseDOM");
|
21
|
+
const defaultSSRContextValue = {
|
22
|
+
current: 0
|
16
23
|
};
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @internal
|
20
|
-
*/
|
24
|
+
const SSRContext = /*#__PURE__*/ _react.createContext(undefined);
|
21
25
|
function useSSRContext() {
|
22
|
-
|
23
|
-
|
26
|
+
var _React_useContext;
|
27
|
+
return (_React_useContext = _react.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
|
24
28
|
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
const SSRProvider = props => {
|
33
|
-
const [value] = React.useState(() => ({
|
34
|
-
current: 0
|
35
|
-
}));
|
36
|
-
return React.createElement(exports.SSRContext.Provider, {
|
37
|
-
value: value
|
38
|
-
}, props.children);
|
29
|
+
const SSRProvider = (props)=>{
|
30
|
+
const [value] = _react.useState(()=>({
|
31
|
+
current: 0
|
32
|
+
}));
|
33
|
+
return /*#__PURE__*/ _react.createElement(SSRContext.Provider, {
|
34
|
+
value: value
|
35
|
+
}, props.children);
|
39
36
|
};
|
40
|
-
exports.SSRProvider = SSRProvider;
|
41
|
-
/**
|
42
|
-
* Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
|
43
|
-
* browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
|
44
|
-
*/
|
45
37
|
function useIsSSR() {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
|
39
|
+
const [isSSR, setIsSSR] = _react.useState(isInSSRContext);
|
40
|
+
// If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
|
41
|
+
// developer to add one.
|
42
|
+
if (process.env.NODE_ENV !== 'production') {
|
43
|
+
if (!isInSSRContext && !(0, _canUseDOM.canUseDOM)()) {
|
44
|
+
// eslint-disable-next-line no-console
|
45
|
+
console.error([
|
46
|
+
'@fluentui/react-components: ',
|
47
|
+
'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.',
|
48
|
+
'\n',
|
49
|
+
'\n',
|
50
|
+
'Check documentation at https://aka.ms/fluentui-ssr'
|
51
|
+
].join(''));
|
52
|
+
}
|
54
53
|
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
exports.useIsSSR = useIsSSR;
|
54
|
+
// If on the client, and the component was initially server rendered, then schedule a layout effect to update the
|
55
|
+
// component after hydration.
|
56
|
+
if ((0, _canUseDOM.canUseDOM)() && isInSSRContext) {
|
57
|
+
// This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
|
58
|
+
// mounting.
|
59
|
+
// eslint-disable-next-line
|
60
|
+
_react.useLayoutEffect(()=>{
|
61
|
+
setIsSSR(false);
|
62
|
+
}, []);
|
63
|
+
}
|
64
|
+
return isSSR;
|
65
|
+
} //# sourceMappingURL=SSRContext.js.map
|
66
|
+
|
69
67
|
//# sourceMappingURL=SSRContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/ssr/SSRContext.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue = {\n current: 0\n};\nexport const SSRContext = /*#__PURE__*/React.createContext(undefined);\n/**\n * @internal\n */\nexport function useSSRContext() {\n var _React_useContext;\n return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;\n}\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider = props => {\n const [value] = React.useState(() => ({\n current: 0\n }));\n return /*#__PURE__*/React.createElement(SSRContext.Provider, {\n value: value\n }, props.children);\n};\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR() {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(['@fluentui/react-components: ', 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.', '\\n', '\\n', 'Check documentation at https://aka.ms/fluentui-ssr'].join(''));\n }\n }\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n return isSSR;\n}\n//# sourceMappingURL=SSRContext.js.map"],"names":["defaultSSRContextValue","SSRContext","useSSRContext","SSRProvider","useIsSSR","current","React","createContext","undefined","_React_useContext","useContext","props","value","useState","createElement","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"mappings":";;;;;;;;;;;IAOaA,sBAAsB,MAAtBA;IAGAC,UAAU,MAAVA;IAIGC,aAAa,MAAbA;IAUHC,WAAW,MAAXA;IAYGC,QAAQ,MAARA;;;6DApCO;2BACG;AAMnB,MAAMJ,yBAAyB;IACpCK,SAAS;AACX;AACO,MAAMJ,aAAa,WAAW,GAAEK,OAAMC,aAAa,CAACC;AAIpD,SAASN,gBAAgB;IAC9B,IAAIO;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACT,WAAU,MAAO,IAAI,IAAIQ,sBAAsB,KAAK,IAAIA,oBAAoBT,sBAAsB;AACjJ;AAOO,MAAMG,cAAcQ,CAAAA,QAAS;IAClC,MAAM,CAACC,MAAM,GAAGN,OAAMO,QAAQ,CAAC,IAAO,CAAA;YACpCR,SAAS;QACX,CAAA;IACA,OAAO,WAAW,GAAEC,OAAMQ,aAAa,CAACb,WAAWc,QAAQ,EAAE;QAC3DH,OAAOA;IACT,GAAGD,MAAMK,QAAQ;AACnB;AAKO,SAASZ,WAAW;IACzB,MAAMa,iBAAiBf,oBAAoBF;IAC3C,MAAM,CAACkB,OAAOC,SAAS,GAAGb,OAAMO,QAAQ,CAACI;IACzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACnC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;gBAAC;gBAAgC,4GAA4G;gBAA4C;gBAAM;gBAAM;aAAqD,CAACC,IAAI,CAAC;QAChR,CAAC;IACH,CAAC;IACD,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BX,OAAMqB,eAAe,CAAC,IAAM;YAC1BR,SAAS,KAAK;QAChB,GAAG,EAAE;IACP,CAAC;IACD,OAAOD;AACT,EACA,sCAAsC"}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.canUseDOM = void 0;
|
7
1
|
/**
|
8
2
|
* Verifies if an application can use DOM.
|
9
|
-
*/
|
3
|
+
*/ "use strict";
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
Object.defineProperty(exports, "canUseDOM", {
|
8
|
+
enumerable: true,
|
9
|
+
get: ()=>canUseDOM
|
10
|
+
});
|
10
11
|
function canUseDOM() {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
exports.canUseDOM = canUseDOM;
|
12
|
+
return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
|
13
|
+
window.document.createElement);
|
14
|
+
} //# sourceMappingURL=canUseDOM.js.map
|
15
|
+
|
16
16
|
//# sourceMappingURL=canUseDOM.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/ssr/canUseDOM.js"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */export function canUseDOM() {\n return typeof window !== 'undefined' && !!(window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement);\n}\n//# sourceMappingURL=canUseDOM.js.map"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,YAAY;IAC7B,OAAO,OAAOC,WAAW,eAAe,CAAC,CAAEA,CAAAA,OAAOC,QAAQ,IAC1D,mDAAmD;IACnDD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAC9B,EACA,qCAAqC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
8
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./canUseDOM"), exports);
|
7
|
+
_exportStar(require("./SSRContext"), exports);
|
8
|
+
//# sourceMappingURL=index.js.map
|
9
|
+
|
9
10
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/ssr/index.js"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;CACd,iCAAiC"}
|
@@ -1,40 +1,38 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
exports
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
Object.defineProperty(exports, "applyTriggerPropsToChildren", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>applyTriggerPropsToChildren
|
8
|
+
});
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _isFluentTrigger = require("./isFluentTrigger");
|
13
12
|
function applyTriggerPropsToChildren(children, triggerChildProps) {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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;
|
23
22
|
}
|
24
|
-
exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
|
25
23
|
/**
|
26
24
|
* Clones a React element tree, and applies the given props to the first grandchild that is not
|
27
25
|
* a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
|
28
|
-
*/
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
+
|
40
38
|
//# sourceMappingURL=applyTriggerPropsToChildren.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,41 +1,21 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getTriggerChild", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>getTriggerChild
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
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
|
-
*/
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _isFluentTrigger = require("./isFluentTrigger");
|
31
12
|
function getTriggerChild(children) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
exports.getTriggerChild = getTriggerChild;
|
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
|
+
|
41
21
|
//# sourceMappingURL=getTriggerChild.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,11 +1,12 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
+
|
11
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,16 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "isFluentTrigger", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>isFluentTrigger
|
5
8
|
});
|
6
|
-
|
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
|
-
*/
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
12
11
|
function isFluentTrigger(element) {
|
13
|
-
|
14
|
-
}
|
15
|
-
|
12
|
+
return Boolean(element.type.isFluentTriggerComponent);
|
13
|
+
} //# sourceMappingURL=isFluentTrigger.js.map
|
14
|
+
|
16
15
|
//# sourceMappingURL=isFluentTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
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
|
+
|
6
9
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,9 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.clamp = void 0;
|
7
1
|
/**
|
8
2
|
* @internal
|
9
3
|
* Clamps `value` to a number between the min and max.
|
@@ -11,7 +5,14 @@ exports.clamp = void 0;
|
|
11
5
|
* @param value - the value to be clamped
|
12
6
|
* @param min - the lowest valid value
|
13
7
|
* @param max - the highest valid value
|
14
|
-
*/
|
15
|
-
|
16
|
-
|
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
|
+
|
17
18
|
//# sourceMappingURL=clamp.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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"}
|