@fluentui/react-hooks
Advanced tools
+13
-2
| # Change Log - @fluentui/react-hooks | ||
| This log was last generated on Fri, 11 Oct 2024 16:49:41 GMT and should not be manually modified. | ||
| This log was last generated on Fri, 21 Feb 2025 07:20:19 GMT and should not be manually modified. | ||
| <!-- Start content --> | ||
| ## [8.8.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-hooks_v8.8.17) | ||
| Fri, 21 Feb 2025 07:20:19 GMT | ||
| [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-hooks_v8.8.16..@fluentui/react-hooks_v8.8.17) | ||
| ### Patches | ||
| - Bump @fluentui/react-window-provider to v2.2.29 ([PR #33879](https://github.com/microsoft/fluentui/pull/33879) by beachball) | ||
| - Bump @fluentui/set-version to v8.2.24 ([PR #33879](https://github.com/microsoft/fluentui/pull/33879) by beachball) | ||
| - Bump @fluentui/utilities to v8.15.20 ([PR #33879](https://github.com/microsoft/fluentui/pull/33879) by beachball) | ||
| ## [8.8.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-hooks_v8.8.16) | ||
| Fri, 11 Oct 2024 16:49:41 GMT | ||
| Fri, 11 Oct 2024 16:51:54 GMT | ||
| [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-hooks_v8.8.15..@fluentui/react-hooks_v8.8.16) | ||
@@ -11,0 +22,0 @@ |
@@ -1,1 +0,1 @@ | ||
| var FluentUIReactHooks;!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useAsync:function(){return l},useBoolean:function(){return d},useConst:function(){return f},useConstCallback:function(){return h},useControllableValue:function(){return v},useEventCallback:function(){return m},useForceUpdate:function(){return _},useId:function(){return F},useIsomorphicLayoutEffect:function(){return p},useMergedRefs:function(){return A},useMount:function(){return D},useMountSync:function(){return O},useOnEvent:function(){return P},usePrevious:function(){return j},useRefEffect:function(){return x},useSetInterval:function(){return q},useSetTimeout:function(){return M},useTarget:function(){return V},useUnmount:function(){return H},useWarnings:function(){return G}});var n={},r=void 0;try{r=window}catch(e){}function o(e,t){if(void 0!==r){var o=r.__packages__=r.__packages__||{};o[e]&&n[e]||(n[e]=t,(o[e]=o[e]||[]).push(t))}}function i(){return"undefined"!=typeof window&&!(!window.document||!window.document.createElement)}o("@fluentui/set-version","6.0.0"),o("@fluentui/react-hooks","8.8.16");var u=void 0;try{u=window}catch(e){}function s(e){if(i()&&void 0!==u){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:u}}var a=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var n=this,r=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),r=setTimeout((function(){try{n._timeoutIds&&delete n._timeoutIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._timeoutIds[r]=!0),r},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var n=this,r=0,o=s(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),r=o.setTimeout((function(){try{n._immediateIds&&delete n._immediateIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),0),this._immediateIds[r]=!0),r},e.prototype.clearImmediate=function(e,t){var n=s(t);this._immediateIds&&this._immediateIds[e]&&(n.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var n=this,r=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),r=setInterval((function(){try{e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._intervalIds[r]=!0),r},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,n){var r=this;if(this._isDisposed)return this._noop;var o,i,u=t||0,s=!0,a=!0,c=0,l=null;n&&"boolean"==typeof n.leading&&(s=n.leading),n&&"boolean"==typeof n.trailing&&(a=n.trailing);var f=function(t){var n=Date.now(),d=n-c,h=s?u-d:u;return d>=u&&(!t||s)?(c=n,l&&(r.clearTimeout(l),l=null),o=e.apply(r._parent,i)):null===l&&a&&(l=r.setTimeout(f,h)),o};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i=e,f(!0)}},e.prototype.debounce=function(e,t,n){var r=this;if(this._isDisposed){var o=function(){};return o.cancel=function(){},o.flush=function(){return null},o.pending=function(){return!1},o}var i,u,s=t||0,a=!1,c=!0,l=null,f=0,d=Date.now(),h=null;n&&"boolean"==typeof n.leading&&(a=n.leading),n&&"boolean"==typeof n.trailing&&(c=n.trailing),n&&"number"==typeof n.maxWait&&!isNaN(n.maxWait)&&(l=n.maxWait);var v=function(e){h&&(r.clearTimeout(h),h=null),d=e},p=function(t){v(t),i=e.apply(r._parent,u)},m=function(e){var t=Date.now(),n=!1;e&&(a&&t-f>=s&&(n=!0),f=t);var o=t-f,u=s-o,v=t-d,_=!1;return null!==l&&(v>=l&&h?_=!0:u=Math.min(u,l-v)),o>=s||_||n?p(t):null!==h&&e||!c||(h=r.setTimeout(m,u)),i},_=function(){return!!h},y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u=e,m(!0)};return y.cancel=function(){_()&&v(Date.now())},y.flush=function(){return _()&&p(Date.now()),i},y.pending=_,y},e.prototype.requestAnimationFrame=function(e,t){var n=this,r=0,o=s(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var i=function(){try{n._animationFrameIds&&delete n._animationFrameIds[r],e.apply(n._parent)}catch(e){n._logError(e)}};r=o.requestAnimationFrame?o.requestAnimationFrame(i):o.setTimeout(i,0),this._animationFrameIds[r]=!0}return r},e.prototype.cancelAnimationFrame=function(e,t){var n=s(t);this._animationFrameIds&&this._animationFrameIds[e]&&(n.cancelAnimationFrame?n.cancelAnimationFrame(e):n.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),c=React;function l(){var e=c.useRef();return e.current||(e.current=new a),c.useEffect((function(){return function(){var t;null===(t=e.current)||void 0===t||t.dispose(),e.current=void 0}}),[]),e.current}function f(e){var t=c.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}function d(e){var t=c.useState(e),n=t[0],r=t[1];return[n,{setTrue:f((function(){return function(){r(!0)}})),setFalse:f((function(){return function(){r(!1)}})),toggle:f((function(){return function(){r((function(e){return!e}))}}))}]}function h(e){var t=c.useRef();return t.current||(t.current=e),t.current}function v(e,t,n){var r=c.useState(t),o=r[0],i=r[1],u=f(void 0!==e),s=u?e:o,a=c.useRef(s),l=c.useRef(n);c.useEffect((function(){a.current=s,l.current=n}));var d=f((function(){return function(e,t){var n="function"==typeof e?e(a.current):e;l.current&&l.current(t,n),u||i(n)}}));return[s,d]}var p=i()?c.useLayoutEffect:c.useEffect;function m(e){var t=c.useRef((function(){throw new Error("Cannot call an event handler while rendering")}));return p((function(){t.current=e}),[e]),f((function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.current.apply(void 0,e)}}))}function _(){var e=c.useState(0)[1];return f((function(){return function(){return e((function(e){return++e}))}}))}var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},y.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var g,I="__shadow_dom_stylesheet__",w="__stylesheet__",b="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),R={};try{R=window||{}}catch(e){}var T=function(){function e(e,t){var n,r,o,i,u,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=y({injectionMode:"undefined"==typeof document?0:1,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(n=null==t?void 0:t.classNameToArgs)&&void 0!==n?n:this._classNameToArgs,this._counter=null!==(r=null==t?void 0:t.counter)&&void 0!==r?r:this._counter,this._keyToClassName=null!==(i=null!==(o=this._config.classNameCache)&&void 0!==o?o:null==t?void 0:t.keyToClassName)&&void 0!==i?i:this._keyToClassName,this._preservedRules=null!==(u=null==t?void 0:t.preservedRules)&&void 0!==u?u:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(t){if(g=R[w],R[I])return R[I].getInstance(t);if(!g||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var n=(null==R?void 0:R.FabricConfig)||{},r=new e(n.mergeStyles,n.serializedStylesheet);g=r,R[w]=r}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=y(y({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace,n=e||this._config.defaultPrefix;return"".concat(t?t+"-":"").concat(n,"-").concat(this._counter++)},e.prototype.cacheClassName=function(e,t,n,r){this._keyToClassName[this._getCacheKey(t)]=e,this._classNameToArgs[e]={args:n,rules:r}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[this._getCacheKey(e)]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t,n){void 0===n&&(n="__global__");var r=this._config.injectionMode,o=0!==r?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),o)switch(r){case 1:this._insertRuleIntoSheet(o.sheet,e);break;case 2:o.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(t){return t({key:n,sheet:o?o.sheet:void 0,rule:e})}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._createStyleElement=function(){var e,t=(null===(e=this._config.window)||void 0===e?void 0:e.document)||document,n=t.head,r=t.createElement("style"),o=null;r.setAttribute("data-merge-styles","true");var i=this._config.cspSettings;if(i&&i.nonce&&r.setAttribute("nonce",i.nonce),this._lastStyleElement)o=this._lastStyleElement.nextElementSibling;else{var u=this._findPlaceholderStyleTag();o=u?u.nextElementSibling:n.childNodes[0]}return n.insertBefore(r,n.contains(o)?o:null),this._lastStyleElement=r,r},e.prototype._insertRuleIntoSheet=function(e,t){if(!e)return!1;try{return e.insertRule(t,e.cssRules.length),!0}catch(e){}return!1},e.prototype._getCacheKey=function(e){return e},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||(this._styleElement=this._createStyleElement(),b||(this._config.window||window).requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}(),C="__currentId__",E="id__",S=s()||{};void 0===S[C]&&(S[C]=0);var N=!1;function k(e){void 0===e&&(e=0),S[C]=e}function F(e,t){var n=c.useRef(t);return n.current||(n.current=function(e){if(!N){var t=T.getInstance();t&&t.onReset&&t.onReset(k),N=!0}var n=S[C]++;return(void 0===e?E:e)+n}(e)),n.current}function A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=c.useCallback((function(t){n.current=t;for(var r=0,o=e;r<o.length;r++){var i=o[r];"function"==typeof i?i(t):i&&(i.current=t)}}),function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0));return n}var D=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])},O=function(e){var t=c.useRef(e);t.current=e,c.useLayoutEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])};function P(e,t,n,r){var o=c.useRef(n);o.current=n,c.useEffect((function(){var n=e&&"current"in e?e.current:e;if(n&&n.addEventListener){var i=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(n,t,(function(e){return o.current(e)}),r);return i}}),[e,t,r])}function j(e){var t=(0,c.useRef)();return(0,c.useEffect)((function(){t.current=e})),t.current}function x(e,t){void 0===t&&(t=null);var n,r=c.useRef({ref:(n=function(e){r.ref.current!==e&&(r.cleanup&&(r.cleanup(),r.cleanup=void 0),r.ref.current=e,null!==e&&(r.cleanup=r.callback(e)))},n.current=t,n),callback:e}).current;return r.callback=e,r.ref}var q=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearInterval(r)}}}),[e]),f({setInterval:function(t,n){var r=setInterval(t,n);return e[r]=1,r},clearInterval:function(t){delete e[t],clearInterval(t)}})},M=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearTimeout(r)}}}),[e]),f({setTimeout:function(t,n){var r=setTimeout(t,n);return e[r]=1,r},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},U=c.createContext({window:"object"==typeof window?window:void 0}),W=function(){return c.useContext(U).window};function V(e,t){var n,r,o,u=c.useRef(),s=c.useRef(null),a=W();if(!e||e!==u.current||"string"==typeof e){var l=null==t?void 0:t.current;if(e)if("string"==typeof e)if(null===(n=null==l?void 0:l.getRootNode())||void 0===n?void 0:n.host)s.current=null!==(o=null===(r=null==l?void 0:l.getRootNode())||void 0===r?void 0:r.querySelector(e))&&void 0!==o?o:null;else{var f=function(e){if(i()&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}(l);s.current=f?f.querySelector(e):null}else s.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;u.current=e}return[s,a]}var L,H=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){return function(){var e;null===(e=t.current)||void 0===e||e.call(t)}}),[])},K=void 0;function B(e){K?K(e):console&&console.warn&&console.warn(e)}function z(e,t,n,r,o){if(!0===o)for(var i=0,u=n;i<u.length;i++){var s=u[i];s in t||B("".concat(e," property '").concat(s,"' is required when '").concat(r,"' is used.'"))}}function Y(e,t){return void 0!==e[t]&&null!==e[t]}L={valueOnChange:{},valueDefaultValue:{},controlledToUncontrolled:{},uncontrolledToControlled:{}};var J=0;function G(e){var t=e.name,n=e.props,r=e.other,o=void 0===r?[]:r,i=e.conditionallyRequired,u=e.deprecations,s=e.mutuallyExclusive,a=e.controlledUsage,l=c.useRef(!1),d=f((function(){return"useWarnings_".concat(J++)})),h=j(n);if(!l.current){l.current=!0;for(var v=0,p=o;v<p.length;v++)B(p[v]);if(i)for(var m=0,_=i;m<_.length;m++){var g=_[m];z(t,n,g.requiredProps,g.conditionalPropName,g.condition)}u&&function(e,t,n){for(var r in n)if(t&&r in t){var o="".concat(e," property '").concat(r,"' was used but has been deprecated."),i=n[r];i&&(o+=" Use '".concat(i,"' instead.")),B(o)}}(t,n,u),s&&function(e,t,n){for(var r in n)if(t&&void 0!==t[r]){var o=n[r];o&&void 0!==t[o]&&B("".concat(e," property '").concat(r,"' is mutually exclusive with '").concat(n[r],"'. ")+"Use one or the other.")}}(t,n,s)}a&&function(e){var t=e.componentId,n=e.componentName,r=e.defaultValueProp,o=e.props,i=e.oldProps,u=e.onChangeProp,s=e.readOnlyProp,a=e.valueProp,c=i?Y(i,a):void 0,l=Y(o,a);if(l){var f=!!o[u],d=!(!s||!o[s]);f||d||L.valueOnChange[t]||(L.valueOnChange[t]=!0,B("Warning: You provided a '".concat(String(a),"' prop to a ").concat(String(n)," without an '").concat(String(u),"' handler. ")+"This will render a read-only field. If the field should be mutable use '".concat(String(r),"'. ")+"Otherwise, set '".concat(String(u),"'").concat(s?" or '".concat(String(s),"'"):"","."))),null==o[r]||L.valueDefaultValue[t]||(L.valueDefaultValue[t]=!0,B("Warning: You provided both '".concat(String(a),"' and '").concat(String(r),"' to a ").concat(n,". ")+"Form fields must be either controlled or uncontrolled (specify either the '".concat(String(a),"' prop, ")+"or the '".concat(String(r),"' prop, but not both). Decide between using a controlled or uncontrolled ")+"".concat(n," and remove one of these props. More info: https://fb.me/react-controlled-components")))}if(i&&l!==c){var h=c?"a controlled":"an uncontrolled",v=c?"uncontrolled":"controlled",p=c?L.controlledToUncontrolled:L.uncontrolledToControlled;p[t]||(p[t]=!0,B("Warning: A component is changing ".concat(h," ").concat(n," to be ").concat(v,". ")+"".concat(n,"s should not switch from controlled to uncontrolled (or vice versa). ")+"Decide between using controlled or uncontrolled for the lifetime of the component. More info: https://fb.me/react-controlled-components"))}}(y(y({},a),{componentId:d,props:n,componentName:t,oldProps:h}))}FluentUIReactHooks=t}(); | ||
| var FluentUIReactHooks;!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useAsync:function(){return l},useBoolean:function(){return d},useConst:function(){return f},useConstCallback:function(){return h},useControllableValue:function(){return v},useEventCallback:function(){return m},useForceUpdate:function(){return _},useId:function(){return F},useIsomorphicLayoutEffect:function(){return p},useMergedRefs:function(){return A},useMount:function(){return D},useMountSync:function(){return O},useOnEvent:function(){return P},usePrevious:function(){return j},useRefEffect:function(){return x},useSetInterval:function(){return q},useSetTimeout:function(){return M},useTarget:function(){return V},useUnmount:function(){return H},useWarnings:function(){return G}});var n={},r=void 0;try{r=window}catch(e){}function o(e,t){if(void 0!==r){var o=r.__packages__=r.__packages__||{};o[e]&&n[e]||(n[e]=t,(o[e]=o[e]||[]).push(t))}}function i(){return"undefined"!=typeof window&&!(!window.document||!window.document.createElement)}o("@fluentui/set-version","6.0.0"),o("@fluentui/react-hooks","8.8.17");var u=void 0;try{u=window}catch(e){}function s(e){if(i()&&void 0!==u){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:u}}var a=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var n=this,r=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),r=setTimeout((function(){try{n._timeoutIds&&delete n._timeoutIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._timeoutIds[r]=!0),r},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var n=this,r=0,o=s(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),r=o.setTimeout((function(){try{n._immediateIds&&delete n._immediateIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),0),this._immediateIds[r]=!0),r},e.prototype.clearImmediate=function(e,t){var n=s(t);this._immediateIds&&this._immediateIds[e]&&(n.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var n=this,r=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),r=setInterval((function(){try{e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._intervalIds[r]=!0),r},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,n){var r=this;if(this._isDisposed)return this._noop;var o,i,u=t||0,s=!0,a=!0,c=0,l=null;n&&"boolean"==typeof n.leading&&(s=n.leading),n&&"boolean"==typeof n.trailing&&(a=n.trailing);var f=function(t){var n=Date.now(),d=n-c,h=s?u-d:u;return d>=u&&(!t||s)?(c=n,l&&(r.clearTimeout(l),l=null),o=e.apply(r._parent,i)):null===l&&a&&(l=r.setTimeout(f,h)),o};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i=e,f(!0)}},e.prototype.debounce=function(e,t,n){var r=this;if(this._isDisposed){var o=function(){};return o.cancel=function(){},o.flush=function(){return null},o.pending=function(){return!1},o}var i,u,s=t||0,a=!1,c=!0,l=null,f=0,d=Date.now(),h=null;n&&"boolean"==typeof n.leading&&(a=n.leading),n&&"boolean"==typeof n.trailing&&(c=n.trailing),n&&"number"==typeof n.maxWait&&!isNaN(n.maxWait)&&(l=n.maxWait);var v=function(e){h&&(r.clearTimeout(h),h=null),d=e},p=function(t){v(t),i=e.apply(r._parent,u)},m=function(e){var t=Date.now(),n=!1;e&&(a&&t-f>=s&&(n=!0),f=t);var o=t-f,u=s-o,v=t-d,_=!1;return null!==l&&(v>=l&&h?_=!0:u=Math.min(u,l-v)),o>=s||_||n?p(t):null!==h&&e||!c||(h=r.setTimeout(m,u)),i},_=function(){return!!h},y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u=e,m(!0)};return y.cancel=function(){_()&&v(Date.now())},y.flush=function(){return _()&&p(Date.now()),i},y.pending=_,y},e.prototype.requestAnimationFrame=function(e,t){var n=this,r=0,o=s(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var i=function(){try{n._animationFrameIds&&delete n._animationFrameIds[r],e.apply(n._parent)}catch(e){n._logError(e)}};r=o.requestAnimationFrame?o.requestAnimationFrame(i):o.setTimeout(i,0),this._animationFrameIds[r]=!0}return r},e.prototype.cancelAnimationFrame=function(e,t){var n=s(t);this._animationFrameIds&&this._animationFrameIds[e]&&(n.cancelAnimationFrame?n.cancelAnimationFrame(e):n.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),c=React;function l(){var e=c.useRef();return e.current||(e.current=new a),c.useEffect((function(){return function(){var t;null===(t=e.current)||void 0===t||t.dispose(),e.current=void 0}}),[]),e.current}function f(e){var t=c.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}function d(e){var t=c.useState(e),n=t[0],r=t[1];return[n,{setTrue:f((function(){return function(){r(!0)}})),setFalse:f((function(){return function(){r(!1)}})),toggle:f((function(){return function(){r((function(e){return!e}))}}))}]}function h(e){var t=c.useRef();return t.current||(t.current=e),t.current}function v(e,t,n){var r=c.useState(t),o=r[0],i=r[1],u=f(void 0!==e),s=u?e:o,a=c.useRef(s),l=c.useRef(n);c.useEffect((function(){a.current=s,l.current=n}));var d=f((function(){return function(e,t){var n="function"==typeof e?e(a.current):e;l.current&&l.current(t,n),u||i(n)}}));return[s,d]}var p=i()?c.useLayoutEffect:c.useEffect;function m(e){var t=c.useRef((function(){throw new Error("Cannot call an event handler while rendering")}));return p((function(){t.current=e}),[e]),f((function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.current.apply(void 0,e)}}))}function _(){var e=c.useState(0)[1];return f((function(){return function(){return e((function(e){return++e}))}}))}var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},y.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var g,I="__shadow_dom_stylesheet__",w="__stylesheet__",b="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),R={};try{R=window||{}}catch(e){}var T=function(){function e(e,t){var n,r,o,i,u,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=y({injectionMode:"undefined"==typeof document?0:1,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(n=null==t?void 0:t.classNameToArgs)&&void 0!==n?n:this._classNameToArgs,this._counter=null!==(r=null==t?void 0:t.counter)&&void 0!==r?r:this._counter,this._keyToClassName=null!==(i=null!==(o=this._config.classNameCache)&&void 0!==o?o:null==t?void 0:t.keyToClassName)&&void 0!==i?i:this._keyToClassName,this._preservedRules=null!==(u=null==t?void 0:t.preservedRules)&&void 0!==u?u:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(t){if(g=R[w],R[I])return R[I].getInstance(t);if(!g||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var n=(null==R?void 0:R.FabricConfig)||{},r=new e(n.mergeStyles,n.serializedStylesheet);g=r,R[w]=r}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=y(y({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace,n=e||this._config.defaultPrefix;return"".concat(t?t+"-":"").concat(n,"-").concat(this._counter++)},e.prototype.cacheClassName=function(e,t,n,r){this._keyToClassName[this._getCacheKey(t)]=e,this._classNameToArgs[e]={args:n,rules:r}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[this._getCacheKey(e)]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t,n){void 0===n&&(n="__global__");var r=this._config.injectionMode,o=0!==r?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),o)switch(r){case 1:this._insertRuleIntoSheet(o.sheet,e);break;case 2:o.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(t){return t({key:n,sheet:o?o.sheet:void 0,rule:e})}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._createStyleElement=function(){var e,t=(null===(e=this._config.window)||void 0===e?void 0:e.document)||document,n=t.head,r=t.createElement("style"),o=null;r.setAttribute("data-merge-styles","true");var i=this._config.cspSettings;if(i&&i.nonce&&r.setAttribute("nonce",i.nonce),this._lastStyleElement)o=this._lastStyleElement.nextElementSibling;else{var u=this._findPlaceholderStyleTag();o=u?u.nextElementSibling:n.childNodes[0]}return n.insertBefore(r,n.contains(o)?o:null),this._lastStyleElement=r,r},e.prototype._insertRuleIntoSheet=function(e,t){if(!e)return!1;try{return e.insertRule(t,e.cssRules.length),!0}catch(e){}return!1},e.prototype._getCacheKey=function(e){return e},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||(this._styleElement=this._createStyleElement(),b||(this._config.window||window).requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}(),C="__currentId__",E="id__",S=s()||{};void 0===S[C]&&(S[C]=0);var N=!1;function k(e){void 0===e&&(e=0),S[C]=e}function F(e,t){var n=c.useRef(t);return n.current||(n.current=function(e){if(!N){var t=T.getInstance();t&&t.onReset&&t.onReset(k),N=!0}var n=S[C]++;return(void 0===e?E:e)+n}(e)),n.current}function A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=c.useCallback((function(t){n.current=t;for(var r=0,o=e;r<o.length;r++){var i=o[r];"function"==typeof i?i(t):i&&(i.current=t)}}),function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0));return n}var D=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])},O=function(e){var t=c.useRef(e);t.current=e,c.useLayoutEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])};function P(e,t,n,r){var o=c.useRef(n);o.current=n,c.useEffect((function(){var n=e&&"current"in e?e.current:e;if(n&&n.addEventListener){var i=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(n,t,(function(e){return o.current(e)}),r);return i}}),[e,t,r])}function j(e){var t=c.useRef();return c.useEffect((function(){t.current=e})),t.current}function x(e,t){void 0===t&&(t=null);var n,r=c.useRef({ref:(n=function(e){r.ref.current!==e&&(r.cleanup&&(r.cleanup(),r.cleanup=void 0),r.ref.current=e,null!==e&&(r.cleanup=r.callback(e)))},n.current=t,n),callback:e}).current;return r.callback=e,r.ref}var q=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearInterval(r)}}}),[e]),f({setInterval:function(t,n){var r=setInterval(t,n);return e[r]=1,r},clearInterval:function(t){delete e[t],clearInterval(t)}})},M=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearTimeout(r)}}}),[e]),f({setTimeout:function(t,n){var r=setTimeout(t,n);return e[r]=1,r},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},U=c.createContext({window:"object"==typeof window?window:void 0}),W=function(){return c.useContext(U).window};function V(e,t){var n,r,o,u=c.useRef(),s=c.useRef(null),a=W();if(!e||e!==u.current||"string"==typeof e){var l=null==t?void 0:t.current;if(e)if("string"==typeof e)if(null===(n=null==l?void 0:l.getRootNode())||void 0===n?void 0:n.host)s.current=null!==(o=null===(r=null==l?void 0:l.getRootNode())||void 0===r?void 0:r.querySelector(e))&&void 0!==o?o:null;else{var f=function(e){if(i()&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}(l);s.current=f?f.querySelector(e):null}else s.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;u.current=e}return[s,a]}var L,H=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){return function(){var e;null===(e=t.current)||void 0===e||e.call(t)}}),[])},K=void 0;function B(e){K?K(e):console&&console.warn&&console.warn(e)}function z(e,t,n,r,o){if(!0===o)for(var i=0,u=n;i<u.length;i++){var s=u[i];s in t||B("".concat(e," property '").concat(s,"' is required when '").concat(r,"' is used.'"))}}function Y(e,t){return void 0!==e[t]&&null!==e[t]}L={valueOnChange:{},valueDefaultValue:{},controlledToUncontrolled:{},uncontrolledToControlled:{}};var J=0;function G(e){var t=e.name,n=e.props,r=e.other,o=void 0===r?[]:r,i=e.conditionallyRequired,u=e.deprecations,s=e.mutuallyExclusive,a=e.controlledUsage,l=c.useRef(!1),d=f((function(){return"useWarnings_".concat(J++)})),h=j(n);if(!l.current){l.current=!0;for(var v=0,p=o;v<p.length;v++)B(p[v]);if(i)for(var m=0,_=i;m<_.length;m++){var g=_[m];z(t,n,g.requiredProps,g.conditionalPropName,g.condition)}u&&function(e,t,n){for(var r in n)if(t&&r in t){var o="".concat(e," property '").concat(r,"' was used but has been deprecated."),i=n[r];i&&(o+=" Use '".concat(i,"' instead.")),B(o)}}(t,n,u),s&&function(e,t,n){for(var r in n)if(t&&void 0!==t[r]){var o=n[r];o&&void 0!==t[o]&&B("".concat(e," property '").concat(r,"' is mutually exclusive with '").concat(n[r],"'. ")+"Use one or the other.")}}(t,n,s)}a&&function(e){var t=e.componentId,n=e.componentName,r=e.defaultValueProp,o=e.props,i=e.oldProps,u=e.onChangeProp,s=e.readOnlyProp,a=e.valueProp,c=i?Y(i,a):void 0,l=Y(o,a);if(l){var f=!!o[u],d=!(!s||!o[s]);f||d||L.valueOnChange[t]||(L.valueOnChange[t]=!0,B("Warning: You provided a '".concat(String(a),"' prop to a ").concat(String(n)," without an '").concat(String(u),"' handler. ")+"This will render a read-only field. If the field should be mutable use '".concat(String(r),"'. ")+"Otherwise, set '".concat(String(u),"'").concat(s?" or '".concat(String(s),"'"):"","."))),null==o[r]||L.valueDefaultValue[t]||(L.valueDefaultValue[t]=!0,B("Warning: You provided both '".concat(String(a),"' and '").concat(String(r),"' to a ").concat(n,". ")+"Form fields must be either controlled or uncontrolled (specify either the '".concat(String(a),"' prop, ")+"or the '".concat(String(r),"' prop, but not both). Decide between using a controlled or uncontrolled ")+"".concat(n," and remove one of these props. More info: https://fb.me/react-controlled-components")))}if(i&&l!==c){var h=c?"a controlled":"an uncontrolled",v=c?"uncontrolled":"controlled",p=c?L.controlledToUncontrolled:L.uncontrolledToControlled;p[t]||(p[t]=!0,B("Warning: A component is changing ".concat(h," ").concat(n," to be ").concat(v,". ")+"".concat(n,"s should not switch from controlled to uncontrolled (or vice versa). ")+"Decide between using controlled or uncontrolled for the lifetime of the component. More info: https://fb.me/react-controlled-components"))}}(y(y({},a),{componentId:d,props:n,componentName:t,oldProps:h}))}FluentUIReactHooks=t}(); |
@@ -1,1 +0,1 @@ | ||
| var FluentUIReactHooks;!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useAsync:function(){return l},useBoolean:function(){return d},useConst:function(){return f},useConstCallback:function(){return h},useControllableValue:function(){return m},useEventCallback:function(){return _},useForceUpdate:function(){return p},useId:function(){return F},useIsomorphicLayoutEffect:function(){return v},useMergedRefs:function(){return A},useMount:function(){return D},useMountSync:function(){return O},useOnEvent:function(){return j},usePrevious:function(){return P},useRefEffect:function(){return x},useSetInterval:function(){return M},useSetTimeout:function(){return q},useTarget:function(){return K},useUnmount:function(){return U},useWarnings:function(){return W}});var n={},r=void 0;try{r=window}catch(e){}function i(e,t){if(void 0!==r){var i=r.__packages__=r.__packages__||{};i[e]&&n[e]||(n[e]=t,(i[e]=i[e]||[]).push(t))}}function o(){return"undefined"!=typeof window&&!(!window.document||!window.document.createElement)}i("@fluentui/set-version","6.0.0"),i("@fluentui/react-hooks","8.8.16");var u=void 0;try{u=window}catch(e){}function s(e){if(o()&&void 0!==u){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:u}}var a=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var n=this,r=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),r=setTimeout((function(){try{n._timeoutIds&&delete n._timeoutIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._timeoutIds[r]=!0),r},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var n=this,r=0,i=s(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),r=i.setTimeout((function(){try{n._immediateIds&&delete n._immediateIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),0),this._immediateIds[r]=!0),r},e.prototype.clearImmediate=function(e,t){var n=s(t);this._immediateIds&&this._immediateIds[e]&&(n.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var n=this,r=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),r=setInterval((function(){try{e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._intervalIds[r]=!0),r},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,n){var r=this;if(this._isDisposed)return this._noop;var i,o,u=t||0,s=!0,a=!0,c=0,l=null;n&&"boolean"==typeof n.leading&&(s=n.leading),n&&"boolean"==typeof n.trailing&&(a=n.trailing);var f=function(t){var n=Date.now(),d=n-c,h=s?u-d:u;return d>=u&&(!t||s)?(c=n,l&&(r.clearTimeout(l),l=null),i=e.apply(r._parent,o)):null===l&&a&&(l=r.setTimeout(f,h)),i};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o=e,f(!0)}},e.prototype.debounce=function(e,t,n){var r=this;if(this._isDisposed){var i=function(){};return i.cancel=function(){},i.flush=function(){return null},i.pending=function(){return!1},i}var o,u,s=t||0,a=!1,c=!0,l=null,f=0,d=Date.now(),h=null;n&&"boolean"==typeof n.leading&&(a=n.leading),n&&"boolean"==typeof n.trailing&&(c=n.trailing),n&&"number"==typeof n.maxWait&&!isNaN(n.maxWait)&&(l=n.maxWait);var m=function(e){h&&(r.clearTimeout(h),h=null),d=e},v=function(t){m(t),o=e.apply(r._parent,u)},_=function(e){var t=Date.now(),n=!1;e&&(a&&t-f>=s&&(n=!0),f=t);var i=t-f,u=s-i,m=t-d,p=!1;return null!==l&&(m>=l&&h?p=!0:u=Math.min(u,l-m)),i>=s||p||n?v(t):null!==h&&e||!c||(h=r.setTimeout(_,u)),o},p=function(){return!!h},y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u=e,_(!0)};return y.cancel=function(){p()&&m(Date.now())},y.flush=function(){return p()&&v(Date.now()),o},y.pending=p,y},e.prototype.requestAnimationFrame=function(e,t){var n=this,r=0,i=s(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var o=function(){try{n._animationFrameIds&&delete n._animationFrameIds[r],e.apply(n._parent)}catch(e){n._logError(e)}};r=i.requestAnimationFrame?i.requestAnimationFrame(o):i.setTimeout(o,0),this._animationFrameIds[r]=!0}return r},e.prototype.cancelAnimationFrame=function(e,t){var n=s(t);this._animationFrameIds&&this._animationFrameIds[e]&&(n.cancelAnimationFrame?n.cancelAnimationFrame(e):n.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),c=React;function l(){var e=c.useRef();return e.current||(e.current=new a),c.useEffect((function(){return function(){var t;null===(t=e.current)||void 0===t||t.dispose(),e.current=void 0}}),[]),e.current}function f(e){var t=c.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}function d(e){var t=c.useState(e),n=t[0],r=t[1];return[n,{setTrue:f((function(){return function(){r(!0)}})),setFalse:f((function(){return function(){r(!1)}})),toggle:f((function(){return function(){r((function(e){return!e}))}}))}]}function h(e){var t=c.useRef();return t.current||(t.current=e),t.current}function m(e,t,n){var r=c.useState(t),i=r[0],o=r[1],u=f(void 0!==e),s=u?e:i,a=c.useRef(s),l=c.useRef(n);c.useEffect((function(){a.current=s,l.current=n}));var d=f((function(){return function(e,t){var n="function"==typeof e?e(a.current):e;l.current&&l.current(t,n),u||o(n)}}));return[s,d]}var v=o()?c.useLayoutEffect:c.useEffect;function _(e){var t=c.useRef((function(){throw new Error("Cannot call an event handler while rendering")}));return v((function(){t.current=e}),[e]),f((function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.current.apply(void 0,e)}}))}function p(){var e=c.useState(0)[1];return f((function(){return function(){return e((function(e){return++e}))}}))}var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},y.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var g,I="__shadow_dom_stylesheet__",R="__stylesheet__",w="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),E={};try{E=window||{}}catch(e){}var T=function(){function e(e,t){var n,r,i,o,u,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=y({injectionMode:"undefined"==typeof document?0:1,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(n=null==t?void 0:t.classNameToArgs)&&void 0!==n?n:this._classNameToArgs,this._counter=null!==(r=null==t?void 0:t.counter)&&void 0!==r?r:this._counter,this._keyToClassName=null!==(o=null!==(i=this._config.classNameCache)&&void 0!==i?i:null==t?void 0:t.keyToClassName)&&void 0!==o?o:this._keyToClassName,this._preservedRules=null!==(u=null==t?void 0:t.preservedRules)&&void 0!==u?u:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(t){if(g=E[R],E[I])return E[I].getInstance(t);if(!g||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var n=(null==E?void 0:E.FabricConfig)||{},r=new e(n.mergeStyles,n.serializedStylesheet);g=r,E[R]=r}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=y(y({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace,n=e||this._config.defaultPrefix;return"".concat(t?t+"-":"").concat(n,"-").concat(this._counter++)},e.prototype.cacheClassName=function(e,t,n,r){this._keyToClassName[this._getCacheKey(t)]=e,this._classNameToArgs[e]={args:n,rules:r}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[this._getCacheKey(e)]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t,n){void 0===n&&(n="__global__");var r=this._config.injectionMode,i=0!==r?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),i)switch(r){case 1:this._insertRuleIntoSheet(i.sheet,e);break;case 2:i.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(t){return t({key:n,sheet:i?i.sheet:void 0,rule:e})}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._createStyleElement=function(){var e,t=(null===(e=this._config.window)||void 0===e?void 0:e.document)||document,n=t.head,r=t.createElement("style"),i=null;r.setAttribute("data-merge-styles","true");var o=this._config.cspSettings;if(o&&o.nonce&&r.setAttribute("nonce",o.nonce),this._lastStyleElement)i=this._lastStyleElement.nextElementSibling;else{var u=this._findPlaceholderStyleTag();i=u?u.nextElementSibling:n.childNodes[0]}return n.insertBefore(r,n.contains(i)?i:null),this._lastStyleElement=r,r},e.prototype._insertRuleIntoSheet=function(e,t){if(!e)return!1;try{return e.insertRule(t,e.cssRules.length),!0}catch(e){}return!1},e.prototype._getCacheKey=function(e){return e},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||(this._styleElement=this._createStyleElement(),w||(this._config.window||window).requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}(),b="__currentId__",C="id__",k=s()||{};void 0===k[b]&&(k[b]=0);var S=!1;function N(e){void 0===e&&(e=0),k[b]=e}function F(e,t){var n=c.useRef(t);return n.current||(n.current=function(e){if(!S){var t=T.getInstance();t&&t.onReset&&t.onReset(N),S=!0}var n=k[b]++;return(void 0===e?C:e)+n}(e)),n.current}function A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=c.useCallback((function(t){n.current=t;for(var r=0,i=e;r<i.length;r++){var o=i[r];"function"==typeof o?o(t):o&&(o.current=t)}}),function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0));return n}var D=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])},O=function(e){var t=c.useRef(e);t.current=e,c.useLayoutEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])};function j(e,t,n,r){var i=c.useRef(n);i.current=n,c.useEffect((function(){var n=e&&"current"in e?e.current:e;if(n&&n.addEventListener){var o=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(n,t,(function(e){return i.current(e)}),r);return o}}),[e,t,r])}function P(e){var t=(0,c.useRef)();return(0,c.useEffect)((function(){t.current=e})),t.current}function x(e,t){void 0===t&&(t=null);var n,r=c.useRef({ref:(n=function(e){r.ref.current!==e&&(r.cleanup&&(r.cleanup(),r.cleanup=void 0),r.ref.current=e,null!==e&&(r.cleanup=r.callback(e)))},n.current=t,n),callback:e}).current;return r.callback=e,r.ref}var M=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearInterval(r)}}}),[e]),f({setInterval:function(t,n){var r=setInterval(t,n);return e[r]=1,r},clearInterval:function(t){delete e[t],clearInterval(t)}})},q=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearTimeout(r)}}}),[e]),f({setTimeout:function(t,n){var r=setTimeout(t,n);return e[r]=1,r},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},L=c.createContext({window:"object"==typeof window?window:void 0}),H=function(){return c.useContext(L).window};function K(e,t){var n,r,i,u=c.useRef(),s=c.useRef(null),a=H();if(!e||e!==u.current||"string"==typeof e){var l=null==t?void 0:t.current;if(e)if("string"==typeof e)if(null===(n=null==l?void 0:l.getRootNode())||void 0===n?void 0:n.host)s.current=null!==(i=null===(r=null==l?void 0:l.getRootNode())||void 0===r?void 0:r.querySelector(e))&&void 0!==i?i:null;else{var f=function(e){if(o()&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}(l);s.current=f?f.querySelector(e):null}else s.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;u.current=e}return[s,a]}var U=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){return function(){var e;null===(e=t.current)||void 0===e||e.call(t)}}),[])};function W(e){}FluentUIReactHooks=t}(); | ||
| var FluentUIReactHooks;!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useAsync:function(){return l},useBoolean:function(){return d},useConst:function(){return f},useConstCallback:function(){return h},useControllableValue:function(){return m},useEventCallback:function(){return _},useForceUpdate:function(){return p},useId:function(){return F},useIsomorphicLayoutEffect:function(){return v},useMergedRefs:function(){return A},useMount:function(){return D},useMountSync:function(){return O},useOnEvent:function(){return j},usePrevious:function(){return P},useRefEffect:function(){return x},useSetInterval:function(){return M},useSetTimeout:function(){return q},useTarget:function(){return K},useUnmount:function(){return U},useWarnings:function(){return W}});var n={},r=void 0;try{r=window}catch(e){}function i(e,t){if(void 0!==r){var i=r.__packages__=r.__packages__||{};i[e]&&n[e]||(n[e]=t,(i[e]=i[e]||[]).push(t))}}function o(){return"undefined"!=typeof window&&!(!window.document||!window.document.createElement)}i("@fluentui/set-version","6.0.0"),i("@fluentui/react-hooks","8.8.17");var u=void 0;try{u=window}catch(e){}function s(e){if(o()&&void 0!==u){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:u}}var a=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var n=this,r=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),r=setTimeout((function(){try{n._timeoutIds&&delete n._timeoutIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._timeoutIds[r]=!0),r},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var n=this,r=0,i=s(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),r=i.setTimeout((function(){try{n._immediateIds&&delete n._immediateIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),0),this._immediateIds[r]=!0),r},e.prototype.clearImmediate=function(e,t){var n=s(t);this._immediateIds&&this._immediateIds[e]&&(n.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var n=this,r=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),r=setInterval((function(){try{e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._intervalIds[r]=!0),r},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,n){var r=this;if(this._isDisposed)return this._noop;var i,o,u=t||0,s=!0,a=!0,c=0,l=null;n&&"boolean"==typeof n.leading&&(s=n.leading),n&&"boolean"==typeof n.trailing&&(a=n.trailing);var f=function(t){var n=Date.now(),d=n-c,h=s?u-d:u;return d>=u&&(!t||s)?(c=n,l&&(r.clearTimeout(l),l=null),i=e.apply(r._parent,o)):null===l&&a&&(l=r.setTimeout(f,h)),i};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o=e,f(!0)}},e.prototype.debounce=function(e,t,n){var r=this;if(this._isDisposed){var i=function(){};return i.cancel=function(){},i.flush=function(){return null},i.pending=function(){return!1},i}var o,u,s=t||0,a=!1,c=!0,l=null,f=0,d=Date.now(),h=null;n&&"boolean"==typeof n.leading&&(a=n.leading),n&&"boolean"==typeof n.trailing&&(c=n.trailing),n&&"number"==typeof n.maxWait&&!isNaN(n.maxWait)&&(l=n.maxWait);var m=function(e){h&&(r.clearTimeout(h),h=null),d=e},v=function(t){m(t),o=e.apply(r._parent,u)},_=function(e){var t=Date.now(),n=!1;e&&(a&&t-f>=s&&(n=!0),f=t);var i=t-f,u=s-i,m=t-d,p=!1;return null!==l&&(m>=l&&h?p=!0:u=Math.min(u,l-m)),i>=s||p||n?v(t):null!==h&&e||!c||(h=r.setTimeout(_,u)),o},p=function(){return!!h},y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u=e,_(!0)};return y.cancel=function(){p()&&m(Date.now())},y.flush=function(){return p()&&v(Date.now()),o},y.pending=p,y},e.prototype.requestAnimationFrame=function(e,t){var n=this,r=0,i=s(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var o=function(){try{n._animationFrameIds&&delete n._animationFrameIds[r],e.apply(n._parent)}catch(e){n._logError(e)}};r=i.requestAnimationFrame?i.requestAnimationFrame(o):i.setTimeout(o,0),this._animationFrameIds[r]=!0}return r},e.prototype.cancelAnimationFrame=function(e,t){var n=s(t);this._animationFrameIds&&this._animationFrameIds[e]&&(n.cancelAnimationFrame?n.cancelAnimationFrame(e):n.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),c=React;function l(){var e=c.useRef();return e.current||(e.current=new a),c.useEffect((function(){return function(){var t;null===(t=e.current)||void 0===t||t.dispose(),e.current=void 0}}),[]),e.current}function f(e){var t=c.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}function d(e){var t=c.useState(e),n=t[0],r=t[1];return[n,{setTrue:f((function(){return function(){r(!0)}})),setFalse:f((function(){return function(){r(!1)}})),toggle:f((function(){return function(){r((function(e){return!e}))}}))}]}function h(e){var t=c.useRef();return t.current||(t.current=e),t.current}function m(e,t,n){var r=c.useState(t),i=r[0],o=r[1],u=f(void 0!==e),s=u?e:i,a=c.useRef(s),l=c.useRef(n);c.useEffect((function(){a.current=s,l.current=n}));var d=f((function(){return function(e,t){var n="function"==typeof e?e(a.current):e;l.current&&l.current(t,n),u||o(n)}}));return[s,d]}var v=o()?c.useLayoutEffect:c.useEffect;function _(e){var t=c.useRef((function(){throw new Error("Cannot call an event handler while rendering")}));return v((function(){t.current=e}),[e]),f((function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.current.apply(void 0,e)}}))}function p(){var e=c.useState(0)[1];return f((function(){return function(){return e((function(e){return++e}))}}))}var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},y.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var g,I="__shadow_dom_stylesheet__",R="__stylesheet__",w="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),E={};try{E=window||{}}catch(e){}var T=function(){function e(e,t){var n,r,i,o,u,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=y({injectionMode:"undefined"==typeof document?0:1,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(n=null==t?void 0:t.classNameToArgs)&&void 0!==n?n:this._classNameToArgs,this._counter=null!==(r=null==t?void 0:t.counter)&&void 0!==r?r:this._counter,this._keyToClassName=null!==(o=null!==(i=this._config.classNameCache)&&void 0!==i?i:null==t?void 0:t.keyToClassName)&&void 0!==o?o:this._keyToClassName,this._preservedRules=null!==(u=null==t?void 0:t.preservedRules)&&void 0!==u?u:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(t){if(g=E[R],E[I])return E[I].getInstance(t);if(!g||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var n=(null==E?void 0:E.FabricConfig)||{},r=new e(n.mergeStyles,n.serializedStylesheet);g=r,E[R]=r}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=y(y({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace,n=e||this._config.defaultPrefix;return"".concat(t?t+"-":"").concat(n,"-").concat(this._counter++)},e.prototype.cacheClassName=function(e,t,n,r){this._keyToClassName[this._getCacheKey(t)]=e,this._classNameToArgs[e]={args:n,rules:r}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[this._getCacheKey(e)]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t,n){void 0===n&&(n="__global__");var r=this._config.injectionMode,i=0!==r?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),i)switch(r){case 1:this._insertRuleIntoSheet(i.sheet,e);break;case 2:i.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(t){return t({key:n,sheet:i?i.sheet:void 0,rule:e})}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._createStyleElement=function(){var e,t=(null===(e=this._config.window)||void 0===e?void 0:e.document)||document,n=t.head,r=t.createElement("style"),i=null;r.setAttribute("data-merge-styles","true");var o=this._config.cspSettings;if(o&&o.nonce&&r.setAttribute("nonce",o.nonce),this._lastStyleElement)i=this._lastStyleElement.nextElementSibling;else{var u=this._findPlaceholderStyleTag();i=u?u.nextElementSibling:n.childNodes[0]}return n.insertBefore(r,n.contains(i)?i:null),this._lastStyleElement=r,r},e.prototype._insertRuleIntoSheet=function(e,t){if(!e)return!1;try{return e.insertRule(t,e.cssRules.length),!0}catch(e){}return!1},e.prototype._getCacheKey=function(e){return e},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||(this._styleElement=this._createStyleElement(),w||(this._config.window||window).requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}(),b="__currentId__",C="id__",k=s()||{};void 0===k[b]&&(k[b]=0);var S=!1;function N(e){void 0===e&&(e=0),k[b]=e}function F(e,t){var n=c.useRef(t);return n.current||(n.current=function(e){if(!S){var t=T.getInstance();t&&t.onReset&&t.onReset(N),S=!0}var n=k[b]++;return(void 0===e?C:e)+n}(e)),n.current}function A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=c.useCallback((function(t){n.current=t;for(var r=0,i=e;r<i.length;r++){var o=i[r];"function"==typeof o?o(t):o&&(o.current=t)}}),function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0));return n}var D=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])},O=function(e){var t=c.useRef(e);t.current=e,c.useLayoutEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])};function j(e,t,n,r){var i=c.useRef(n);i.current=n,c.useEffect((function(){var n=e&&"current"in e?e.current:e;if(n&&n.addEventListener){var o=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(n,t,(function(e){return i.current(e)}),r);return o}}),[e,t,r])}function P(e){var t=c.useRef();return c.useEffect((function(){t.current=e})),t.current}function x(e,t){void 0===t&&(t=null);var n,r=c.useRef({ref:(n=function(e){r.ref.current!==e&&(r.cleanup&&(r.cleanup(),r.cleanup=void 0),r.ref.current=e,null!==e&&(r.cleanup=r.callback(e)))},n.current=t,n),callback:e}).current;return r.callback=e,r.ref}var M=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearInterval(r)}}}),[e]),f({setInterval:function(t,n){var r=setInterval(t,n);return e[r]=1,r},clearInterval:function(t){delete e[t],clearInterval(t)}})},q=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearTimeout(r)}}}),[e]),f({setTimeout:function(t,n){var r=setTimeout(t,n);return e[r]=1,r},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},L=c.createContext({window:"object"==typeof window?window:void 0}),H=function(){return c.useContext(L).window};function K(e,t){var n,r,i,u=c.useRef(),s=c.useRef(null),a=H();if(!e||e!==u.current||"string"==typeof e){var l=null==t?void 0:t.current;if(e)if("string"==typeof e)if(null===(n=null==l?void 0:l.getRootNode())||void 0===n?void 0:n.host)s.current=null!==(i=null===(r=null==l?void 0:l.getRootNode())||void 0===r?void 0:r.querySelector(e))&&void 0!==i?i:null;else{var f=function(e){if(o()&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}(l);s.current=f?f.querySelector(e):null}else s.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;u.current=e}return[s,a]}var U=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){return function(){var e;null===(e=t.current)||void 0===e||e.call(t)}}),[])};function W(e){}FluentUIReactHooks=t}(); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":";;;;IAGA;;;;;;;OAOG;IACH,8DAA8D;IAC9D,SAAgB,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;QAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;YAC3D,IAAI,YAAiC,CAAC;YACtC,IAAI,SAAS,GAAG,CAAC,CAAC;YAElB,IAAM,aAAa,GAA4B;gBAC7C,SAAS,EAAE,CAAC;gBACZ,sDAAsD;gBACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;gBACzE,OAAO,gCAAO,CAAC;YACjB,CAAC,CAAC;YAEF,IAAM,OAAO,GAAG,IAAA,cAAK,EAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;YACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;YACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;YAClC,YAAY,GAAG,SAAS,CAAC;YAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;YAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,IAAI;oBACF,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;iBAChD;gBAAC,OAAO,GAAG,EAAE;oBACZ,wCAAwC;oBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;iBAC5G;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IArCD,kEAqCC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":";;;;IAGA;;;;;;;OAOG;IACH,8DAA8D;IAC9D,SAAgB,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;QAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;YAC3D,IAAI,YAAiC,CAAC;YACtC,IAAI,SAAS,GAAG,CAAC,CAAC;YAElB,IAAM,aAAa,GAA4B;gBAC7C,SAAS,EAAE,CAAC;gBACZ,sDAAsD;gBACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;gBACzE,OAAO,gCAAO,CAAC;YACjB,CAAC,CAAC;YAEF,IAAM,OAAO,GAAG,IAAA,cAAK,EAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;YACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;YACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;YAClC,YAAY,GAAG,SAAS,CAAC;YAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;YAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC9C,IAAI,CAAC;oBACH,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,wCAAwC;oBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;gBAC7G,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IArCD,kEAqCC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACH,SAAgB,QAAQ;QACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,iBAAK,EAAE,CAAC;SAChC;QACD,KAAK,CAAC,SAAS,CAAC;YACd,OAAO;;gBACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;gBAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;YAC/B,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAZD,4BAYC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACH,SAAgB,QAAQ;QACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,QAAQ,CAAC,OAAO,GAAG,IAAI,iBAAK,EAAE,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,SAAS,CAAC;YACd,OAAO;;gBACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;gBAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;YAC/B,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAZD,4BAYC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":";;;;IAEA;;;;;;;;;;OAUG;IACH,SAAgB,QAAQ,CAAI,YAA2B;QACrD,+FAA+F;QAC/F,8FAA8F;QAC9F,0DAA0D;QAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;QACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE;YAC7B,wFAAwF;YACxF,uBAAuB;YACvB,GAAG,CAAC,OAAO,GAAG;gBACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;aACxF,CAAC;SACH;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;IAbD,4BAaC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":";;;;IAEA;;;;;;;;;;OAUG;IACH,SAAgB,QAAQ,CAAI,YAA2B;QACrD,+FAA+F;QAC/F,8FAA8F;QAC9F,0DAA0D;QAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;QACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9B,wFAAwF;YACxF,uBAAuB;YACvB,GAAG,CAAC,OAAO,GAAG;gBACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;aACxF,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;IAbD,4BAaC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":";;;;IAEA;;;;;;;;;OASG;IACH,8DAA8D;IAC9D,SAAgB,gBAAgB,CAAoC,QAAW;QAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;SACxB;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAND,4CAMC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":";;;;IAEA;;;;;;;;;OASG;IACH,8DAA8D;IAC9D,SAAgB,gBAAgB,CAAoC,QAAW;QAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;QACzB,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAND,4CAMC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":";;;;IAmCA,SAAgB,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;QAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;QACvF,IAAM,YAAY,GAAG,IAAA,mBAAQ,EAAU,eAAe,KAAK,SAAS,CAAC,CAAC;QACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;QAE5D,8EAA8E;QAC9E,oEAAoE;QACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,KAAK,CAAC,SAAS,CAAC;YACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;YAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,2FAA2F;QAC3F,4FAA4F;QAC5F,IAAM,sBAAsB,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;YAC1G,2FAA2F;YAC3F,yCAAyC;YACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YAEhG,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;aACpC;YAED,IAAI,CAAC,YAAY,EAAE;gBACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;aACpB;QACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;QAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;IACzD,CAAC;IAvCD,oDAuCC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":";;;;IAmCA,SAAgB,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;QAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;QACvF,IAAM,YAAY,GAAG,IAAA,mBAAQ,EAAU,eAAe,KAAK,SAAS,CAAC,CAAC;QACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;QAE5D,8EAA8E;QAC9E,oEAAoE;QACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,KAAK,CAAC,SAAS,CAAC;YACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;YAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,2FAA2F;QAC3F,4FAA4F;QAC5F,IAAM,sBAAsB,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;YAC1G,2FAA2F;YAC3F,yCAAyC;YACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YAEhG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACxB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC;YAED,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;QAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;IACzD,CAAC;IAvCD,oDAuCC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":";;;;IAGA;;;;;;;OAOG;IACH,SAAgB,KAAK,CAAC,MAAe,EAAE,UAAmB;QACxD,+FAA+F;QAC/F,+FAA+F;QAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,GAAG,CAAC,OAAO,GAAG,IAAA,iBAAK,EAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IARD,sBAQC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":";;;;IAGA;;;;;;;OAOG;IACH,SAAgB,KAAK,CAAC,MAAe,EAAE,UAAmB;QACxD,+FAA+F;QAC/F,+FAA+F;QAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,IAAA,iBAAK,EAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IARD,sBAQC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";;;;IAQA;;;;;OAKG;IACH,SAAgB,aAAa;QAAI,cAAqC;aAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;YAArC,yBAAqC;;QACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;YACP,qDAAqD;YACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;YAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;gBAAnB,IAAM,GAAG,aAAA;gBACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;oBAC7B,GAAG,CAAC,KAAK,CAAC,CAAC;iBACZ;qBAAM,IAAI,GAAG,EAAE;oBACd,qDAAqD;oBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC/D;aACF;QACH,CAAC,4BAEG,IAAI,QAC0B,CAAC;QAErC,OAAO,cAAc,CAAC;IACxB,CAAC;IApBD,sCAoBC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";;;;IAQA;;;;;OAKG;IACH,SAAgB,aAAa;QAAI,cAAqC;aAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;YAArC,yBAAqC;;QACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;YACP,qDAAqD;YACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;YAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE,CAAC;gBAApB,IAAM,GAAG,aAAA;gBACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;oBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;gBACb,CAAC;qBAAM,IAAI,GAAG,EAAE,CAAC;oBACf,qDAAqD;oBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC,4BAEG,IAAI,QAC0B,CAAC;QAErC,OAAO,cAAc,CAAC;IACxB,CAAC;IApBD,sCAoBC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":";;;;IAGA;;;;;;OAMG;IACH,SAAgB,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;QAEpB,oHAAoH;QACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,KAAK,CAAC,SAAS,CAAC;YACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE;gBACrD,OAAO;aACR;YAED,IAAM,OAAO,GAAG,IAAA,cAAE,EAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;YAClG,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACvC,CAAC;IAnBD,gCAmBC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":";;;;IAGA;;;;;;OAMG;IACH,SAAgB,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;QAEpB,oHAAoH;QACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,KAAK,CAAC,SAAS,CAAC;YACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC;gBACtD,OAAO;YACT,CAAC;YAED,IAAM,OAAO,GAAG,IAAA,cAAE,EAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;YAClG,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACvC,CAAC;IAnBD,gCAmBC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} |
@@ -1,2 +0,2 @@ | ||
| define(["require", "exports", "react"], function (require, exports, react_1) { | ||
| define(["require", "exports", "react"], function (require, exports, React) { | ||
| "use strict"; | ||
@@ -11,4 +11,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
| function usePrevious(value) { | ||
| var ref = (0, react_1.useRef)(); | ||
| (0, react_1.useEffect)(function () { | ||
| var ref = React.useRef(); | ||
| React.useEffect(function () { | ||
| ref.current = value; | ||
@@ -15,0 +15,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":";;;;IAEA;;;;OAIG;IACH,SAAgB,WAAW,CAAI,KAAQ;QACrC,IAAM,GAAG,GAAG,IAAA,cAAM,GAAiB,CAAC;QACpC,IAAA,iBAAS,EAAC;YACR,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAND,kCAMC","sourcesContent":["import { useRef, useEffect } from 'react';\n\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":";;;;IACA;;;;OAIG;IACH,SAAgB,WAAW,CAAI,KAAQ;QACrC,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAiB,CAAC;QAC1C,KAAK,CAAC,SAAS,CAAC;YACd,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAND,kCAMC","sourcesContent":["import * as React from 'react';\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = React.useRef<T | undefined>();\n React.useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":";;;;IAOA;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAgB,YAAY,CAAI,QAA2C,EAAE,OAAwB;QAAxB,wBAAA,EAAA,cAAwB;QAOnG,IAAM,iBAAiB,GAAG;YACxB,IAAM,WAAW,GAAG,UAAC,KAAe;gBAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;oBAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;wBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;wBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;qBAC1B;oBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;oBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE;wBAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;qBACrC;iBACF;YACH,CAAC,CAAC;YAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC;QAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;YACjC,GAAG,EAAE,iBAAiB,EAAE;YACxB,QAAQ,UAAA;SACT,CAAC,CAAC,OAAO,CAAC;QAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAnCD,oCAmCC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":";;;;IAOA;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAgB,YAAY,CAAI,QAA2C,EAAE,OAAwB;QAAxB,wBAAA,EAAA,cAAwB;QAOnG,IAAM,iBAAiB,GAAG;YACxB,IAAM,WAAW,GAAG,UAAC,KAAe;gBAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;oBAC/B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;wBACjB,IAAI,CAAC,OAAO,EAAE,CAAC;wBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;oBAC3B,CAAC;oBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;oBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;wBACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;YAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC;QAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;YACjC,GAAG,EAAE,iBAAiB,EAAE;YACxB,QAAQ,UAAA;SACT,CAAC,CAAC,OAAO,CAAC;QAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAnCD,oCAmCC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":";;;;IAQA;;OAEG;IACI,IAAM,cAAc,GAAG;QAC5B,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;YACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;gBAAtC,IAAM,EAAE,SAAA;gBACX,8DAA8D;gBAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;aAC1B;QACH,CAAC,EALK,CAKL;QACD,6FAA6F;QAC7F,CAAC,WAAW,CAAC,CACd,CAAC;QAEF,OAAO,IAAA,mBAAQ,EAAC;YACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;gBAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;gBAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;gBAEpB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,aAAa,EAAE,UAAC,EAAU;gBACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;gBACvB,aAAa,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IA5BW,QAAA,cAAc,kBA4BzB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":";;;;IAQA;;OAEG;IACI,IAAM,cAAc,GAAG;QAC5B,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;YACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE,CAAC;gBAAvC,IAAM,EAAE,SAAA;gBACX,8DAA8D;gBAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,EALK,CAKL;QACD,6FAA6F;QAC7F,CAAC,WAAW,CAAC,CACd,CAAC;QAEF,OAAO,IAAA,mBAAQ,EAAC;YACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;gBAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;gBAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;gBAEpB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,aAAa,EAAE,UAAC,EAAU;gBACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;gBACvB,aAAa,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IA5BW,QAAA,cAAc,kBA4BzB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":";;;;IAQA;;OAEG;IACI,IAAM,aAAa,GAAG;QAC3B,IAAM,UAAU,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;QAExD,oBAAoB;QACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;YACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;gBAArC,IAAM,EAAE,SAAA;gBACX,8DAA8D;gBAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;aACzB;QACH,CAAC,EALK,CAKL;QACD,6FAA6F;QAC7F,CAAC,UAAU,CAAC,CACb,CAAC;QAEF,0CAA0C;QAC1C,OAAO,IAAA,mBAAQ,EAAC;YACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;gBAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;gBAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;gBAEnB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,YAAY,EAAE,UAAC,EAAU;gBACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;gBACtB,YAAY,CAAC,EAAE,CAAC,CAAC;YACnB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IA9BW,QAAA,aAAa,iBA8BxB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":";;;;IAQA;;OAEG;IACI,IAAM,aAAa,GAAG;QAC3B,IAAM,UAAU,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;QAExD,oBAAoB;QACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;YACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE,CAAC;gBAAtC,IAAM,EAAE,SAAA;gBACX,8DAA8D;gBAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,EALK,CAKL;QACD,6FAA6F;QAC7F,CAAC,UAAU,CAAC,CACb,CAAC;QAEF,0CAA0C;QAC1C,OAAO,IAAA,mBAAQ,EAAC;YACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;gBAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;gBAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;gBAEnB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,YAAY,EAAE,UAAC,EAAU;gBACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;gBACtB,YAAY,CAAC,EAAE,CAAC,CAAC;YACnB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IA9BW,QAAA,aAAa,iBA8BxB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":";;;;IAOA;;;;;;OAMG;IACH,SAAgB,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;QAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;QAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;QACtF;;;WAGG;QACH,IAAM,YAAY,GAAG,IAAA,iCAAS,GAAE,CAAC;QAEjC,sEAAsE;QACtE,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAClF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;YAC5C,IAAI,MAAM,EAAE;gBACV,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;oBAC9B,8FAA8F;oBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE;wBACvD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;qBAClG;yBAAM;wBACL,IAAM,UAAU,GAAa,IAAA,uBAAW,EAAC,cAAc,CAAE,CAAC;wBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;qBAC1E;iBACF;qBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE;oBACtC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;iBAC5B;qBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE;oBAC5C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;iBAC5B;qBAAM,IAAI,SAAS,IAAI,MAAM,EAAE;oBAC9B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;iBACpC;qBAAM;oBACL,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;iBAC5B;aACF;YACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;SACrC;QAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;IAC5C,CAAC;IA3CD,8BA2CC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":";;;;IAOA;;;;;;OAMG;IACH,SAAgB,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;QAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;QAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;QACtF;;;WAGG;QACH,IAAM,YAAY,GAAG,IAAA,iCAAS,GAAE,CAAC;QAEjC,sEAAsE;QACtE,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACnF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;YAC5C,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC/B,8FAA8F;oBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE,CAAC;wBACxD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;oBACnG,CAAC;yBAAM,CAAC;wBACN,IAAM,UAAU,GAAa,IAAA,uBAAW,EAAC,cAAc,CAAE,CAAC;wBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBAC3E,CAAC;gBACH,CAAC;qBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE,CAAC;oBACvC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;gBAC7B,CAAC;qBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE,CAAC;oBAC7C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;gBAC7B,CAAC;qBAAM,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;oBAC/B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;gBACrC,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;QACtC,CAAC;QAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;IAC5C,CAAC;IA3CD,8BA2CC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";;;;IA4DA,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB;;;;OAIG;IACH,SAAgB,WAAW,CAAe,OAA2B;QACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;YAEvC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;YAEZ,yEAAyE;YACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;YACjE,IAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;YACpC,8CAA8C;YAE9C,kFAAkF;YAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;gBACzB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;gBAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;oBAAxB,IAAM,OAAO,cAAA;oBAChB,IAAA,gBAAI,EAAC,OAAO,CAAC,CAAC;iBACf;gBAED,IAAI,qBAAqB,EAAE;oBACzB,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE;wBAApC,IAAM,GAAG,8BAAA;wBACZ,IAAA,0CAA8B,EAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;qBACxG;iBACF;gBAED,YAAY,IAAI,IAAA,4BAAgB,EAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;gBAE5D,iBAAiB,IAAI,IAAA,iCAAqB,EAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;aAC5E;YAED,0FAA0F;YAC1F,yFAAyF;YACzF,2FAA2F;YAC3F,8EAA8E;YAC9E,eAAe,IAAI,IAAA,+BAAmB,wCAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;SACnH;IACH,CAAC;IA3CD,kCA2CC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";;;;IA4DA,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB;;;;OAIG;IACH,SAAgB,WAAW,CAAe,OAA2B;QACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAExC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;YAEZ,yEAAyE;YACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;YACjE,IAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;YACpC,8CAA8C;YAE9C,kFAAkF;YAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1B,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;gBAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE,CAAC;oBAAzB,IAAM,OAAO,cAAA;oBAChB,IAAA,gBAAI,EAAC,OAAO,CAAC,CAAC;gBAChB,CAAC;gBAED,IAAI,qBAAqB,EAAE,CAAC;oBAC1B,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE,CAAC;wBAArC,IAAM,GAAG,8BAAA;wBACZ,IAAA,0CAA8B,EAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;oBACzG,CAAC;gBACH,CAAC;gBAED,YAAY,IAAI,IAAA,4BAAgB,EAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;gBAE5D,iBAAiB,IAAI,IAAA,iCAAqB,EAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;YAC7E,CAAC;YAED,0FAA0F;YAC1F,yFAAyF;YACzF,2FAA2F;YAC3F,8EAA8E;YAC9E,eAAe,IAAI,IAAA,+BAAmB,wCAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;QACpH,CAAC;IACH,CAAC;IA3CD,kCA2CC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} |
| define(["require", "exports", "@fluentui/set-version"], function (require, exports, set_version_1) { | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| (0, set_version_1.setVersion)('@fluentui/react-hooks', '8.8.16'); | ||
| (0, set_version_1.setVersion)('@fluentui/react-hooks', '8.8.17'); | ||
| }); | ||
| //# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;;IAGA,IAAA,wBAAU,EAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.16');"]} | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;;IAGA,IAAA,wBAAU,EAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.17');"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,iCAA+B;AAE/B;;;;;;;GAOG;AACH,8DAA8D;AAC9D,SAAgB,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;IAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;QAC3D,IAAI,YAAiC,CAAC;QACtC,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,aAAa,GAA4B;YAC7C,SAAS,EAAE,CAAC;YACZ,sDAAsD;YACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;YACzE,OAAO,gCAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG,IAAA,cAAK,EAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAClC,YAAY,GAAG,SAAS,CAAC;QAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IAAI;gBACF,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aAChD;YAAC,OAAO,GAAG,EAAE;gBACZ,wCAAwC;gBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;aAC5G;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AArCD,kEAqCC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,iCAA+B;AAE/B;;;;;;;GAOG;AACH,8DAA8D;AAC9D,SAAgB,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;IAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;QAC3D,IAAI,YAAiC,CAAC;QACtC,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,aAAa,GAA4B;YAC7C,SAAS,EAAE,CAAC;YACZ,sDAAsD;YACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;YACzE,OAAO,gCAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG,IAAA,cAAK,EAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAClC,YAAY,GAAG,SAAS,CAAC;QAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,IAAI,CAAC;gBACH,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,wCAAwC;gBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;YAC7G,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AArCD,kEAqCC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAC5C,6BAA+B;AAE/B;;GAEG;AACH,SAAgB,QAAQ;IACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,iBAAK,EAAE,CAAC;KAChC;IACD,KAAK,CAAC,SAAS,CAAC;QACd,OAAO;;YACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAZD,4BAYC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAC5C,6BAA+B;AAE/B;;GAEG;AACH,SAAgB,QAAQ;IACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,OAAO,GAAG,IAAI,iBAAK,EAAE,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,SAAS,CAAC;QACd,OAAO;;YACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAZD,4BAYC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAE/B;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAI,YAA2B;IACrD,+FAA+F;IAC/F,8FAA8F;IAC9F,0DAA0D;IAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;IACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE;QAC7B,wFAAwF;QACxF,uBAAuB;QACvB,GAAG,CAAC,OAAO,GAAG;YACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;SACxF,CAAC;KACH;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC;AAbD,4BAaC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAE/B;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAI,YAA2B;IACrD,+FAA+F;IAC/F,8FAA8F;IAC9F,0DAA0D;IAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;IACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9B,wFAAwF;QACxF,uBAAuB;QACvB,GAAG,CAAC,OAAO,GAAG;YACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;SACxF,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC;AAbD,4BAaC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAE/B;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,SAAgB,gBAAgB,CAAoC,QAAW;IAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;QAChB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;KACxB;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAND,4CAMC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAE/B;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,SAAgB,gBAAgB,CAAoC,QAAW;IAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAND,4CAMC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAkCtC,SAAgB,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;IAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;IACvF,IAAM,YAAY,GAAG,IAAA,mBAAQ,EAAU,eAAe,KAAK,SAAS,CAAC,CAAC;IACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAE5D,8EAA8E;IAC9E,oEAAoE;IACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,KAAK,CAAC,SAAS,CAAC;QACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;QAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,4FAA4F;IAC5F,IAAM,sBAAsB,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;QAC1G,2FAA2F;QAC3F,yCAAyC;QACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhG,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;SACpC;QAED,IAAI,CAAC,YAAY,EAAE;YACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;IACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;AACzD,CAAC;AAvCD,oDAuCC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAkCtC,SAAgB,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;IAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;IACvF,IAAM,YAAY,GAAG,IAAA,mBAAQ,EAAU,eAAe,KAAK,SAAS,CAAC,CAAC;IACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAE5D,8EAA8E;IAC9E,oEAAoE;IACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,KAAK,CAAC,SAAS,CAAC;QACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;QAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,4FAA4F;IAC5F,IAAM,sBAAsB,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;QAC1G,2FAA2F;QAC3F,yCAAyC;QACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;AACzD,CAAC;AAvCD,oDAuCC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,iDAA4C;AAE5C;;;;;;;GAOG;AACH,SAAgB,KAAK,CAAC,MAAe,EAAE,UAAmB;IACxD,+FAA+F;IAC/F,+FAA+F;IAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;QAChB,GAAG,CAAC,OAAO,GAAG,IAAA,iBAAK,EAAC,MAAM,CAAC,CAAC;KAC7B;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AARD,sBAQC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,iDAA4C;AAE5C;;;;;;;GAOG;AACH,SAAgB,KAAK,CAAC,MAAe,EAAE,UAAmB;IACxD,+FAA+F;IAC/F,+FAA+F;IAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,GAAG,CAAC,OAAO,GAAG,IAAA,iBAAK,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AARD,sBAQC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAQ/B;;;;;GAKG;AACH,SAAgB,aAAa;IAAI,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;QACP,qDAAqD;QACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;QAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC7B,GAAG,CAAC,KAAK,CAAC,CAAC;aACZ;iBAAM,IAAI,GAAG,EAAE;gBACd,qDAAqD;gBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;aAC/D;SACF;IACH,CAAC,4BAEG,IAAI,QAC0B,CAAC;IAErC,OAAO,cAAc,CAAC;AACxB,CAAC;AApBD,sCAoBC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAQ/B;;;;;GAKG;AACH,SAAgB,aAAa;IAAI,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;QACP,qDAAqD;QACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;QAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE,CAAC;YAApB,IAAM,GAAG,aAAA;YACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;YACb,CAAC;iBAAM,IAAI,GAAG,EAAE,CAAC;gBACf,qDAAqD;gBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC,4BAEG,IAAI,QAC0B,CAAC;IAErC,OAAO,cAAc,CAAC;AACxB,CAAC;AApBD,sCAoBC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,6BAA+B;AAE/B;;;;;;GAMG;AACH,SAAgB,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;IAEpB,oHAAoH;IACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,KAAK,CAAC,SAAS,CAAC;QACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE;YACrD,OAAO;SACR;QAED,IAAM,OAAO,GAAG,IAAA,cAAE,EAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC;AAnBD,gCAmBC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,6BAA+B;AAE/B;;;;;;GAMG;AACH,SAAgB,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;IAEpB,oHAAoH;IACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,KAAK,CAAC,SAAS,CAAC;QACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC;YACtD,OAAO;QACT,CAAC;QAED,IAAM,OAAO,GAAG,IAAA,cAAE,EAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC;AAnBD,gCAmBC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.usePrevious = void 0; | ||
| var react_1 = require("react"); | ||
| var React = require("react"); | ||
| /** | ||
@@ -11,4 +11,4 @@ * Hook keeping track of a given value from a previous execution of the component the Hook is used in. | ||
| function usePrevious(value) { | ||
| var ref = (0, react_1.useRef)(); | ||
| (0, react_1.useEffect)(function () { | ||
| var ref = React.useRef(); | ||
| React.useEffect(function () { | ||
| ref.current = value; | ||
@@ -15,0 +15,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":";;;AAAA,+BAA0C;AAE1C;;;;GAIG;AACH,SAAgB,WAAW,CAAI,KAAQ;IACrC,IAAM,GAAG,GAAG,IAAA,cAAM,GAAiB,CAAC;IACpC,IAAA,iBAAS,EAAC;QACR,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAND,kCAMC","sourcesContent":["import { useRef, useEffect } from 'react';\n\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B;;;;GAIG;AACH,SAAgB,WAAW,CAAI,KAAQ;IACrC,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAiB,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC;QACd,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAND,kCAMC","sourcesContent":["import * as React from 'react';\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = React.useRef<T | undefined>();\n React.useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAO/B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,YAAY,CAAI,QAA2C,EAAE,OAAwB;IAAxB,wBAAA,EAAA,cAAwB;IAOnG,IAAM,iBAAiB,GAAG;QACxB,IAAM,WAAW,GAAG,UAAC,KAAe;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;gBAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;oBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;iBAC1B;gBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE;oBAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACrC;aACF;QACH,CAAC,CAAC;QAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;QACjC,GAAG,EAAE,iBAAiB,EAAE;QACxB,QAAQ,UAAA;KACT,CAAC,CAAC,OAAO,CAAC;IAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC;AAnCD,oCAmCC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAO/B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,YAAY,CAAI,QAA2C,EAAE,OAAwB;IAAxB,wBAAA,EAAA,cAAwB;IAOnG,IAAM,iBAAiB,GAAG;QACxB,IAAM,WAAW,GAAG,UAAC,KAAe;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;gBAC3B,CAAC;gBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;QACjC,GAAG,EAAE,iBAAiB,EAAE;QACxB,QAAQ,UAAA;KACT,CAAC,CAAC,OAAO,CAAC;IAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC;AAnCD,oCAmCC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAOtC;;GAEG;AACI,IAAM,cAAc,GAAG;IAC5B,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;IAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;YAAtC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;SAC1B;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,IAAA,mBAAQ,EAAC;QACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,aAAa,EAAE,UAAC,EAAU;YACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;YACvB,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA5BW,QAAA,cAAc,kBA4BzB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAOtC;;GAEG;AACI,IAAM,cAAc,GAAG;IAC5B,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;IAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE,CAAC;YAAvC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,IAAA,mBAAQ,EAAC;QACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,aAAa,EAAE,UAAC,EAAU;YACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;YACvB,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA5BW,QAAA,cAAc,kBA4BzB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAOtC;;GAEG;AACI,IAAM,aAAa,GAAG;IAC3B,IAAM,UAAU,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;IAExD,oBAAoB;IACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;YAArC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;SACzB;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,0CAA0C;IAC1C,OAAO,IAAA,mBAAQ,EAAC;QACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,YAAY,EAAE,UAAC,EAAU;YACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;YACtB,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,aAAa,iBA8BxB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAOtC;;GAEG;AACI,IAAM,aAAa,GAAG;IAC3B,IAAM,UAAU,GAAG,IAAA,mBAAQ,EAAyB,EAAE,CAAC,CAAC;IAExD,oBAAoB;IACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE,CAAC;YAAtC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,0CAA0C;IAC1C,OAAO,IAAA,mBAAQ,EAAC;QACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,YAAY,EAAE,UAAC,EAAU;YACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;YACtB,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,aAAa,iBA8BxB","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,6BAA+B;AAC/B,yEAA4D;AAK5D;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;IAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;IAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;IACtF;;;OAGG;IACH,IAAM,YAAY,GAAG,IAAA,iCAAS,GAAE,CAAC;IAEjC,sEAAsE;IACtE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAClF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;QAC5C,IAAI,MAAM,EAAE;YACV,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE;oBACvD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;iBAClG;qBAAM;oBACL,IAAM,UAAU,GAAa,IAAA,uBAAW,EAAC,cAAc,CAAE,CAAC;oBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;iBAC1E;aACF;iBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE;gBACtC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;iBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE;gBAC5C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;iBAAM,IAAI,SAAS,IAAI,MAAM,EAAE;gBAC9B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;aACpC;iBAAM;gBACL,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;SACF;QACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;KACrC;IAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;AAC5C,CAAC;AA3CD,8BA2CC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,6BAA+B;AAC/B,yEAA4D;AAK5D;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;IAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;IAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;IACtF;;;OAGG;IACH,IAAM,YAAY,GAAG,IAAA,iCAAS,GAAE,CAAC;IAEjC,sEAAsE;IACtE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACnF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,8FAA8F;gBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE,CAAC;oBACxD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;gBACnG,CAAC;qBAAM,CAAC;oBACN,IAAM,UAAU,GAAa,IAAA,uBAAW,EAAC,cAAc,CAAE,CAAC;oBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3E,CAAC;YACH,CAAC;iBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE,CAAC;gBACvC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;iBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE,CAAC;gBAC7C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;iBAAM,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;gBAC/B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;AAC5C,CAAC;AA3CD,8BA2CC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,iDAM6B;AAC7B,6CAA4C;AAC5C,uCAAsC;AAmDtC,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;;;GAIG;AACH,SAAgB,WAAW,CAAe,OAA2B;IACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAEvC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;QAEZ,yEAAyE;QACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;QACjE,IAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;QACpC,8CAA8C;QAE9C,kFAAkF;QAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;gBAAxB,IAAM,OAAO,cAAA;gBAChB,IAAA,gBAAI,EAAC,OAAO,CAAC,CAAC;aACf;YAED,IAAI,qBAAqB,EAAE;gBACzB,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE;oBAApC,IAAM,GAAG,8BAAA;oBACZ,IAAA,0CAA8B,EAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;iBACxG;aACF;YAED,YAAY,IAAI,IAAA,4BAAgB,EAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;YAE5D,iBAAiB,IAAI,IAAA,iCAAqB,EAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;SAC5E;QAED,0FAA0F;QAC1F,yFAAyF;QACzF,2FAA2F;QAC3F,8EAA8E;QAC9E,eAAe,IAAI,IAAA,+BAAmB,wCAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;KACnH;AACH,CAAC;AA3CD,kCA2CC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,iDAM6B;AAC7B,6CAA4C;AAC5C,uCAAsC;AAmDtC,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;;;GAIG;AACH,SAAgB,WAAW,CAAe,OAA2B;IACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAExC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;QAEZ,yEAAyE;QACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAM,WAAW,GAAG,IAAA,mBAAQ,EAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;QACjE,IAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;QACpC,8CAA8C;QAE9C,kFAAkF;QAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE,CAAC;gBAAzB,IAAM,OAAO,cAAA;gBAChB,IAAA,gBAAI,EAAC,OAAO,CAAC,CAAC;YAChB,CAAC;YAED,IAAI,qBAAqB,EAAE,CAAC;gBAC1B,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE,CAAC;oBAArC,IAAM,GAAG,8BAAA;oBACZ,IAAA,0CAA8B,EAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;gBACzG,CAAC;YACH,CAAC;YAED,YAAY,IAAI,IAAA,4BAAgB,EAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;YAE5D,iBAAiB,IAAI,IAAA,iCAAqB,EAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAC7E,CAAC;QAED,0FAA0F;QAC1F,yFAAyF;QACzF,2FAA2F;QAC3F,8EAA8E;QAC9E,eAAe,IAAI,IAAA,+BAAmB,wCAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;IACpH,CAAC;AACH,CAAC;AA3CD,kCA2CC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} |
@@ -6,3 +6,3 @@ "use strict"; | ||
| var set_version_1 = require("@fluentui/set-version"); | ||
| (0, set_version_1.setVersion)('@fluentui/react-hooks', '8.8.16'); | ||
| (0, set_version_1.setVersion)('@fluentui/react-hooks', '8.8.17'); | ||
| //# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,qDAAmD;AACnD,IAAA,wBAAU,EAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.16');"]} | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,qDAAmD;AACnD,IAAA,wBAAU,EAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.17');"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B;;;;;;;GAOG;AACH,8DAA8D;AAC9D,MAAM,UAAU,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;IAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;QAC3D,IAAI,YAAiC,CAAC;QACtC,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,aAAa,GAA4B;YAC7C,SAAS,EAAE,CAAC;YACZ,sDAAsD;YACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;YACzE,OAAO,gCAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG,KAAK,CAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAClC,YAAY,GAAG,SAAS,CAAC;QAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IAAI;gBACF,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aAChD;YAAC,OAAO,GAAG,EAAE;gBACZ,wCAAwC;gBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;aAC5G;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} | ||
| {"version":3,"file":"testUtilities.js","sourceRoot":"../src/","sources":["testUtilities.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B;;;;;;;GAOG;AACH,8DAA8D;AAC9D,MAAM,UAAU,2BAA2B,CACzC,eAAuB,EACvB,OAAsB,EACtB,YAA4B;IAE5B,EAAE,CAAC,eAAe,IAAI,qCAAqC,EAAE;QAC3D,IAAI,YAAiC,CAAC;QACtC,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,aAAa,GAA4B;YAC7C,SAAS,EAAE,CAAC;YACZ,sDAAsD;YACtD,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;YACzE,OAAO,gCAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG,KAAK,CAAC,oBAAC,aAAa,OAAG,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAM,WAAW,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAClC,YAAY,GAAG,SAAS,CAAC;QAEzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,MAAM,CAAC,CAAC;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,IAAI,CAAC;gBACH,MAAM,CAAC,YAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,wCAAwC;gBACxC,IAAM,SAAS,GAAG,YAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAA8B,CAAC,yDAA+C,SAAS,CAAE,CAAC,CAAC;YAC7G,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as React from 'react';\nimport { mount } from 'enzyme';\n\n/**\n * Validate that value(s) returned by a hook do not change in identity.\n * @param testDescription - Custom test description\n * @param useHook - Function to invoke the hook and return an array of return values which\n * should not change\n * @param useHookAgain - If you want to verify that the return value doesn't change when hook\n * parameters change, you can pass this second callback which calls the hook differently.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateHookValueNotChanged<TValues extends NonNullable<any>[]>(\n testDescription: string,\n useHook: () => TValues,\n useHookAgain?: () => TValues,\n) {\n it(testDescription || 'returns the same value(s) each time', () => {\n let latestValues: TValues | undefined;\n let callCount = 0;\n\n const TestComponent: React.FunctionComponent = () => {\n callCount++;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n latestValues = callCount === 1 ? useHook() : (useHookAgain || useHook)();\n return <div />;\n };\n\n const wrapper = mount(<TestComponent />);\n expect(callCount).toBe(1);\n const firstValues = latestValues;\n expect(firstValues).toBeDefined();\n latestValues = undefined;\n\n wrapper.setProps({});\n expect(callCount).toBe(2);\n expect(latestValues).toBeDefined();\n expect(latestValues).toHaveLength(firstValues!.length);\n\n for (let i = 0; i < latestValues!.length; i++) {\n try {\n expect(latestValues![i]).toBe(firstValues![i]);\n } catch (err) {\n // Make a more informative error message\n const valueText = latestValues![i].toString();\n expect('').toBe(`Identity of value at index ${i} has changed. This might help identify it:\\n${valueText}`);\n }\n }\n });\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,QAAQ;IACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,KAAK,EAAE,CAAC;KAChC;IACD,KAAK,CAAC,SAAS,CAAC;QACd,OAAO;;YACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} | ||
| {"version":3,"file":"useAsync.js","sourceRoot":"../src/","sources":["useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,QAAQ;IACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAS,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,OAAO,GAAG,IAAI,KAAK,EAAE,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,SAAS,CAAC;QACd,OAAO;;YACL,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC","sourcesContent":["import { Async } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to provide an Async instance that is automatically cleaned up on dismount.\n */\nexport function useAsync() {\n const asyncRef = React.useRef<Async>();\n if (!asyncRef.current) {\n asyncRef.current = new Async();\n }\n React.useEffect(() => {\n return () => {\n asyncRef.current?.dispose();\n asyncRef.current = undefined;\n };\n }, []);\n return asyncRef.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAI,YAA2B;IACrD,+FAA+F;IAC/F,8FAA8F;IAC9F,0DAA0D;IAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;IACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE;QAC7B,wFAAwF;QACxF,uBAAuB;QACvB,GAAG,CAAC,OAAO,GAAG;YACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;SACxF,CAAC;KACH;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} | ||
| {"version":3,"file":"useConst.js","sourceRoot":"../src/","sources":["useConst.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAI,YAA2B;IACrD,+FAA+F;IAC/F,8FAA8F;IAC9F,0DAA0D;IAC1D,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;IACzC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9B,wFAAwF;QACxF,uBAAuB;QACvB,GAAG,CAAC,OAAO,GAAG;YACZ,KAAK,EAAE,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,YAAyB,EAAE,CAAC,CAAC,CAAC,YAAY;SACxF,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to\n * always return the same value (and if the initializer is a function, only call it once).\n * This is similar to setting a private member in a class constructor.\n *\n * If the value should ever change based on dependencies, use `React.useMemo` instead.\n *\n * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`,\n * only the value/function passed in the first time this is called is respected.\n * @returns The value. The identity of this value will always be the same.\n */\nexport function useConst<T>(initialValue: T | (() => T)): T {\n // Use useRef to store the value because it's the least expensive built-in hook that works here\n // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive\n // internally due to reducer handling which we don't need)\n const ref = React.useRef<{ value: T }>();\n if (ref.current === undefined) {\n // Box the value in an object so we can tell if it's initialized even if the initializer\n // returns/is undefined\n ref.current = {\n value: typeof initialValue === 'function' ? (initialValue as Function)() : initialValue,\n };\n }\n return ref.current.value;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,gBAAgB,CAAoC,QAAW;IAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;QAChB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;KACxB;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useConstCallback.js","sourceRoot":"../src/","sources":["useConstCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,gBAAgB,CAAoC,QAAW;IAC7E,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAK,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead.\n * If you need a callback reference that never changes, consider `useEventCallback`.\n *\n * This hook was intended for creating callbacks which have no dependencies, and therefore never\n * need to change. It works fine if everyone using it is extremely mindful of how closures work,\n * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs\n * like unintentionally capturing the first value of a prop and not respecting updates (when\n * updates should be respected).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useConstCallback<T extends (...args: any[]) => any>(callback: T): T {\n const ref = React.useRef<T>();\n if (!ref.current) {\n ref.current = callback;\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkCtC,MAAM,UAAU,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;IAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;IACvF,IAAM,YAAY,GAAG,QAAQ,CAAU,eAAe,KAAK,SAAS,CAAC,CAAC;IACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAE5D,8EAA8E;IAC9E,oEAAoE;IACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,KAAK,CAAC,SAAS,CAAC;QACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;QAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,4FAA4F;IAC5F,IAAM,sBAAsB,GAAG,QAAQ,CAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;QAC1G,2FAA2F;QAC3F,yCAAyC;QACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhG,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;SACpC;QAED,IAAI,CAAC,YAAY,EAAE;YACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;IACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;AACzD,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} | ||
| {"version":3,"file":"useControllableValue.js","sourceRoot":"../src/","sources":["useControllableValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkCtC,MAAM,UAAU,oBAAoB,CAKlC,eAAmC,EACnC,wBAA4C,EAC5C,QAAmD;IAE7C,IAAA,KAAoB,KAAK,CAAC,QAAQ,CAAqB,wBAAwB,CAAC,EAA/E,KAAK,QAAA,EAAE,QAAQ,QAAgE,CAAC;IACvF,IAAM,YAAY,GAAG,QAAQ,CAAU,eAAe,KAAK,SAAS,CAAC,CAAC;IACtE,IAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAE5D,8EAA8E;IAC9E,oEAAoE;IACpE,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,KAAK,CAAC,SAAS,CAAC;QACd,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC;QAChC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,4FAA4F;IAC5F,IAAM,sBAAsB,GAAG,QAAQ,CAAC,cAAM,OAAA,UAAC,MAAgD,EAAE,EAAW;QAC1G,2FAA2F;QAC3F,yCAAyC;QACzC,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,WAAW,CAAC,OAAO,CAAC,EAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAZ6C,CAY7C,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAU,CAAC;AACzD,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type ChangeCallback<\n TElement extends HTMLElement,\n TValue,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n> = (ev: TEvent, newValue: TValue | undefined) => void;\n\n/**\n * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or\n * text box string.\n * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,\n * and the internal state will be updated to reflect it.\n * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.\n * @returns An array of the current value and an updater callback. Like `React.useState`, the updater\n * callback always has the same identity, and it can take either a new value, or a function which\n * is passed the previous value and returns the new value.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport function useControllableValue<TValue, TElement extends HTMLElement>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange: ChangeCallback<TElement, TValue, TEvent> | undefined,\n): Readonly<\n [TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]\n>;\nexport function useControllableValue<\n TValue,\n TElement extends HTMLElement,\n TEvent extends React.SyntheticEvent<TElement> | undefined,\n>(\n controlledValue: TValue | undefined,\n defaultUncontrolledValue: TValue | undefined,\n onChange?: ChangeCallback<TElement, TValue, TEvent>,\n) {\n const [value, setValue] = React.useState<TValue | undefined>(defaultUncontrolledValue);\n const isControlled = useConst<boolean>(controlledValue !== undefined);\n const currentValue = isControlled ? controlledValue : value;\n\n // Duplicate the current value and onChange in refs so they're accessible from\n // setValueOrCallOnChange without creating a new callback every time\n const valueRef = React.useRef(currentValue);\n const onChangeRef = React.useRef(onChange);\n React.useEffect(() => {\n valueRef.current = currentValue;\n onChangeRef.current = onChange;\n });\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setValueOrCallOnChange = useConst(() => (update: React.SetStateAction<TValue | undefined>, ev?: TEvent) => {\n // Assuming here that TValue is not a function, because a controllable value will typically\n // be something a user can enter as input\n const newValue = typeof update === 'function' ? (update as Function)(valueRef.current) : update;\n\n if (onChangeRef.current) {\n onChangeRef.current(ev!, newValue);\n }\n\n if (!isControlled) {\n setValue(newValue);\n }\n });\n\n return [currentValue, setValueOrCallOnChange] as const;\n}\n"]} |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,MAAe,EAAE,UAAmB;IACxD,+FAA+F;IAC/F,+FAA+F;IAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;QAChB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"useId.js","sourceRoot":"../src/","sources":["useId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,MAAe,EAAE,UAAmB;IACxD,+FAA+F;IAC/F,+FAA+F;IAC/F,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAqB,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\nimport { getId } from '@fluentui/utilities';\n\n/**\n * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library).\n *\n * @param prefix - Optional prefix for the ID\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix?: string, providedId?: string): string {\n // getId should only be called once since it updates the global constant for the next ID value.\n // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.)\n const ref = React.useRef<string | undefined>(providedId);\n if (!ref.current) {\n ref.current = getId(prefix);\n }\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAAI,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;QACP,qDAAqD;QACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;QAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC7B,GAAG,CAAC,KAAK,CAAC,CAAC;aACZ;iBAAM,IAAI,GAAG,EAAE;gBACd,qDAAqD;gBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;aAC/D;SACF;IACH,CAAC,oBAEG,IAAI,QAC0B,CAAC;IAErC,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} | ||
| {"version":3,"file":"useMergedRefs.js","sourceRoot":"../src/","sources":["useMergedRefs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAAI,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IACpE,IAAM,cAAc,GAAyB,KAAK,CAAC,WAAW,CAC5D,UAAC,KAAQ;QACP,qDAAqD;QACpD,cAAuD,CAAC,OAAO,GAAG,KAAK,CAAC;QAEzE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE,CAAC;YAApB,IAAM,GAAG,aAAA;YACZ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;YACb,CAAC;iBAAM,IAAI,GAAG,EAAE,CAAC;gBACf,qDAAqD;gBACpD,GAA4C,CAAC,OAAO,GAAG,KAAK,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC,oBAEG,IAAI,QAC0B,CAAC;IAErC,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n (ref as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;IAEpB,oHAAoH;IACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,KAAK,CAAC,SAAS,CAAC;QACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE;YACrD,OAAO;SACR;QAED,IAAM,OAAO,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} | ||
| {"version":3,"file":"useOnEvent.js","sourceRoot":"../src/","sources":["useOnEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,OAAuG,EACvG,SAAiB,EACjB,QAA8B,EAC9B,UAAoB;IAEpB,oHAAoH;IACpH,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,KAAK,CAAC,SAAS,CAAC;QACd,IAAM,aAAa,GAAG,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClF,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC;YACtD,OAAO;QACT,CAAC;QAED,IAAM,OAAO,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,UAAC,EAAU,IAAK,OAAA,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,EAAvB,CAAuB,EAAE,UAAU,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { on } from '@fluentui/utilities';\nimport * as React from 'react';\n\n/**\n * Hook to attach an event handler on mount and handle cleanup.\n * @param element - Element (or ref to an element) to attach the event handler to\n * @param eventName - The event to attach a handler for\n * @param callback - The handler for the event\n * @param useCapture - Whether or not to attach the handler for the capture phase\n */\nexport function useOnEvent<TElement extends Element, TEvent extends Event>(\n element: React.RefObject<TElement | undefined | null> | TElement | Window | Document | undefined | null,\n eventName: string,\n callback: (ev: TEvent) => void,\n useCapture?: boolean,\n) {\n // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n React.useEffect(() => {\n const actualElement = element && 'current' in element ? element.current : element;\n if (!actualElement || !actualElement.addEventListener) {\n return;\n }\n\n const dispose = on(actualElement, eventName, (ev: TEvent) => callbackRef.current(ev), useCapture);\n return dispose;\n }, [element, eventName, useCapture]);\n}\n"]} |
@@ -1,2 +0,2 @@ | ||
| import { useRef, useEffect } from 'react'; | ||
| import * as React from 'react'; | ||
| /** | ||
@@ -8,4 +8,4 @@ * Hook keeping track of a given value from a previous execution of the component the Hook is used in. | ||
| export function usePrevious(value) { | ||
| var ref = useRef(); | ||
| useEffect(function () { | ||
| var ref = React.useRef(); | ||
| React.useEffect(function () { | ||
| ref.current = value; | ||
@@ -12,0 +12,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,IAAM,GAAG,GAAG,MAAM,EAAiB,CAAC;IACpC,SAAS,CAAC;QACR,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import { useRef, useEffect } from 'react';\n\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} | ||
| {"version":3,"file":"usePrevious.js","sourceRoot":"../src/","sources":["usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAiB,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC;QACd,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\n/**\n * Hook keeping track of a given value from a previous execution of the component the Hook is used in.\n *\n * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = React.useRef<T | undefined>();\n React.useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAAI,QAA2C,EAAE,OAAwB;IAAxB,wBAAA,EAAA,cAAwB;IAOnG,IAAM,iBAAiB,GAAG;QACxB,IAAM,WAAW,GAAG,UAAC,KAAe;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;gBAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;oBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;iBAC1B;gBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE;oBAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACrC;aACF;QACH,CAAC,CAAC;QAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;QACjC,GAAG,EAAE,iBAAiB,EAAE;QACxB,QAAQ,UAAA;KACT,CAAC,CAAC,OAAO,CAAC;IAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} | ||
| {"version":3,"file":"useRefEffect.js","sourceRoot":"../src/","sources":["useRefEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAAI,QAA2C,EAAE,OAAwB;IAAxB,wBAAA,EAAA,cAAwB;IAOnG,IAAM,iBAAiB,GAAG;QACxB,IAAM,WAAW,GAAG,UAAC,KAAe;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;gBAC3B,CAAC;gBAED,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEzB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAU;QACjC,GAAG,EAAE,iBAAiB,EAAE;QACxB,QAAQ,UAAA;KACT,CAAC,CAAC,OAAO,CAAC;IAEX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * A callback ref function that also has a .current member for the ref's current value.\n */\nexport type RefCallback<T> = ((value: T | null) => void) & React.RefObject<T>;\n\n/**\n * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return\n * a cleanup function that'll be called before the value changes, and when the ref is unmounted.\n *\n * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see\n * https://github.com/facebook/react/issues/14387#issuecomment-503616820).\n *\n * Usage example:\n * ```ts\n * const myRef = useRefEffect<HTMLElement>(element => {\n * ...\n * return () => { ... cleanup ... };\n * });\n * ```\n * ```jsx\n * <div ref={myRef} />\n * ```\n *\n * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function.\n * @param initial - (Optional) The initial value for the ref.\n *\n * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be\n * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property.\n */\nexport function useRefEffect<T>(callback: (value: T) => (() => void) | void, initial: T | null = null): RefCallback<T> {\n type RefData = {\n ref: ((value: T | null) => void) & React.MutableRefObject<T | null>;\n callback: (value: T) => (() => void) | void;\n cleanup?: (() => void) | void;\n };\n\n const createRefCallback = () => {\n const refCallback = (value: T | null) => {\n if (data.ref.current !== value) {\n if (data.cleanup) {\n data.cleanup();\n data.cleanup = undefined;\n }\n\n data.ref.current = value;\n\n if (value !== null) {\n data.cleanup = data.callback(value);\n }\n }\n };\n\n refCallback.current = initial;\n return refCallback;\n };\n\n const data = React.useRef<RefData>({\n ref: createRefCallback(),\n callback,\n }).current;\n\n data.callback = callback;\n\n return data.ref;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC;;GAEG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,IAAM,WAAW,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;YAAtC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;SAC1B;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,QAAQ,CAAC;QACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,aAAa,EAAE,UAAC,EAAU;YACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;YACvB,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetInterval.js","sourceRoot":"../src/","sources":["useSetInterval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC;;GAEG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,IAAM,WAAW,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IAEzD,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAwB,EAAxB,KAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE,CAAC;YAAvC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,aAAa,CAAC,EAAS,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,QAAQ,CAAC;QACd,WAAW,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC9C,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE5D,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,aAAa,EAAE,UAAC,EAAU;YACxB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;YACvB,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetIntervalReturnType = {\n setInterval: (callback: () => void, duration: number) => number;\n clearInterval: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setInterval` which automatically handles disposal.\n */\nexport const useSetInterval = (): UseSetIntervalReturnType => {\n const intervalIds = useConst<Record<number, number>>({});\n\n React.useEffect(\n () => () => {\n for (const id of Object.keys(intervalIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearInterval(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [intervalIds],\n );\n\n return useConst({\n setInterval: (func: () => void, duration: number): number => {\n const id = setInterval(func, duration) as unknown as number;\n\n intervalIds[id] = 1;\n\n return id;\n },\n\n clearInterval: (id: number): void => {\n delete intervalIds[id];\n clearInterval(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC;;GAEG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG;IAC3B,IAAM,UAAU,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IAExD,oBAAoB;IACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;YAArC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;SACzB;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,0CAA0C;IAC1C,OAAO,QAAQ,CAAC;QACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,YAAY,EAAE,UAAC,EAAU;YACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;YACtB,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} | ||
| {"version":3,"file":"useSetTimeout.js","sourceRoot":"../src/","sources":["useSetTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC;;GAEG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG;IAC3B,IAAM,UAAU,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IAExD,oBAAoB;IACpB,KAAK,CAAC,SAAS,CACb,cAAM,OAAA;QACJ,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE,CAAC;YAAtC,IAAM,EAAE,SAAA;YACX,8DAA8D;YAC9D,YAAY,CAAC,EAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EALK,CAKL;IACD,6FAA6F;IAC7F,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,0CAA0C;IAC1C,OAAO,QAAQ,CAAC;QACd,UAAU,EAAE,UAAC,IAAgB,EAAE,QAAgB;YAC7C,IAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAsB,CAAC;YAE3D,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAEnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,YAAY,EAAE,UAAC,EAAU;YACvB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;YACtB,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\nexport type UseSetTimeoutReturnType = {\n setTimeout: (callback: () => void, duration: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n/**\n * Returns a wrapper function for `setTimeout` which automatically handles disposal.\n */\nexport const useSetTimeout = (): UseSetTimeoutReturnType => {\n const timeoutIds = useConst<Record<number, number>>({});\n\n // Cleanup function.\n React.useEffect(\n () => () => {\n for (const id of Object.keys(timeoutIds)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clearTimeout(id as any);\n }\n },\n // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that\n [timeoutIds],\n );\n\n // Return wrapper which will auto cleanup.\n return useConst({\n setTimeout: (func: () => void, duration: number): number => {\n const id = setTimeout(func, duration) as unknown as number;\n\n timeoutIds[id] = 1;\n\n return id;\n },\n\n clearTimeout: (id: number): void => {\n delete timeoutIds[id];\n clearTimeout(id);\n },\n });\n};\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAK5D;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;IAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;IAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;IACtF;;;OAGG;IACH,IAAM,YAAY,GAAG,SAAS,EAAE,CAAC;IAEjC,sEAAsE;IACtE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAClF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;QAC5C,IAAI,MAAM,EAAE;YACV,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE;oBACvD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;iBAClG;qBAAM;oBACL,IAAM,UAAU,GAAa,WAAW,CAAC,cAAc,CAAE,CAAC;oBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;iBAC1E;aACF;iBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE;gBACtC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;iBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE;gBAC5C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;iBAAM,IAAI,SAAS,IAAI,MAAM,EAAE;gBAC9B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;aACpC;iBAAM;gBACL,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;SACF;QACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;KACrC;IAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;AAC5C,CAAC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} | ||
| {"version":3,"file":"useTarget.js","sourceRoot":"../src/","sources":["useTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAK5D;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,MAA0B,EAC1B,WAA8C;;IAE9C,IAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,EAEpC,CAAC;IAEJ,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAkD,IAAI,CAAC,CAAC;IACtF;;;OAGG;IACH,IAAM,YAAY,GAAG,SAAS,EAAE,CAAC;IAEjC,sEAAsE;IACtE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACnF,IAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,8FAA8F;gBAC9F,IAAI,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,IAAI,EAAE,CAAC;oBACxD,SAAS,CAAC,OAAO,GAAG,MAAA,MAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,EAAiB,0CAAE,aAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;gBACnG,CAAC;qBAAM,CAAC;oBACN,IAAM,UAAU,GAAa,WAAW,CAAC,cAAc,CAAE,CAAC;oBAC1D,SAAS,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3E,CAAC;YACH,CAAC;iBAAM,IAAI,iBAAiB,IAAI,MAAM,EAAE,CAAC;gBACvC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;iBAAM,IAAI,uBAAuB,IAAI,MAAM,EAAE,CAAC;gBAC7C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;iBAAM,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;gBAC/B,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;AAC5C,CAAC","sourcesContent":["import { getDocument, Rectangle } from '@fluentui/utilities';\nimport * as React from 'react';\nimport { useWindow } from '@fluentui/react-window-provider';\nimport type { Point } from '@fluentui/utilities';\n\nexport type Target = Element | string | MouseEvent | Point | Rectangle | null | React.RefObject<Element>;\n\n/**\n * Hook to calculate and cache the target element specified by the given target attribute,\n * as well as the target element's (or host element's) parent window\n * @param target- Target selector passed to the component as a property, describing the element that\n * the callout should target\n * @param hostElement- The callout's host element, used for determining the parent window.\n */\nexport function useTarget<TElement extends HTMLElement = HTMLElement>(\n target: Target | undefined,\n hostElement?: React.RefObject<TElement | null>,\n): Readonly<[React.RefObject<Element | MouseEvent | Point | Rectangle | null>, Window | undefined]> {\n const previousTargetProp = React.useRef<\n Element | string | MouseEvent | Point | Rectangle | React.RefObject<Element> | null | undefined\n >();\n\n const targetRef = React.useRef<Element | MouseEvent | Point | Rectangle | null>(null);\n /**\n * Stores an instance of Window, used to check\n * for server side rendering and if focus was lost.\n */\n const targetWindow = useWindow();\n\n // If the target element changed, find the new one. If we are tracking\n // target with class name, always find element because we do not know if\n // fabric has rendered a new element and disposed the old element.\n if (!target || target !== previousTargetProp.current || typeof target === 'string') {\n const currentElement = hostElement?.current;\n if (target) {\n if (typeof target === 'string') {\n // If element is part of shadow dom, then querySelector on shadow root, else query on document\n if ((currentElement?.getRootNode() as ShadowRoot)?.host) {\n targetRef.current = (currentElement?.getRootNode() as ShadowRoot)?.querySelector(target) ?? null;\n } else {\n const currentDoc: Document = getDocument(currentElement)!;\n targetRef.current = currentDoc ? currentDoc.querySelector(target) : null;\n }\n } else if ('stopPropagation' in target) {\n targetRef.current = target;\n } else if ('getBoundingClientRect' in target) {\n targetRef.current = target;\n } else if ('current' in target) {\n targetRef.current = target.current;\n } else {\n targetRef.current = target;\n }\n }\n previousTargetProp.current = target;\n }\n\n return [targetRef, targetWindow] as const;\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,mBAAmB,EACnB,8BAA8B,EAC9B,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmDtC,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAe,OAA2B;IACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAEvC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;QAEZ,yEAAyE;QACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAM,WAAW,GAAG,QAAQ,CAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;QACjE,IAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,8CAA8C;QAE9C,kFAAkF;QAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;gBAAxB,IAAM,OAAO,cAAA;gBAChB,IAAI,CAAC,OAAO,CAAC,CAAC;aACf;YAED,IAAI,qBAAqB,EAAE;gBACzB,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE;oBAApC,IAAM,GAAG,8BAAA;oBACZ,8BAA8B,CAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;iBACxG;aACF;YAED,YAAY,IAAI,gBAAgB,CAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;YAE5D,iBAAiB,IAAI,qBAAqB,CAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;SAC5E;QAED,0FAA0F;QAC1F,yFAAyF;QACzF,2FAA2F;QAC3F,8EAA8E;QAC9E,eAAe,IAAI,mBAAmB,uBAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;KACnH;AACH,CAAC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} | ||
| {"version":3,"file":"useWarnings.js","sourceRoot":"../src/","sources":["useWarnings.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,mBAAmB,EACnB,8BAA8B,EAC9B,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmDtC,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAe,OAA2B;IACnE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAExC,IAAA,MAAI,GAOF,OAAO,KAPL,EACJ,KAAK,GAMH,OAAO,MANJ,EACL,KAKE,OAAO,MALC,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,qBAAqB,GAInB,OAAO,sBAJY,EACrB,YAAY,GAGV,OAAO,aAHG,EACZ,iBAAiB,GAEf,OAAO,kBAFQ,EACjB,eAAe,GACb,OAAO,gBADM,CACL;QAEZ,yEAAyE;QACzE,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAM,WAAW,GAAG,QAAQ,CAAC,cAAM,OAAA,sBAAe,SAAS,EAAE,CAAE,EAA5B,CAA4B,CAAC,CAAC;QACjE,IAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,8CAA8C;QAE9C,kFAAkF;QAClF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAE5B,KAAsB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE,CAAC;gBAAzB,IAAM,OAAO,cAAA;gBAChB,IAAI,CAAC,OAAO,CAAC,CAAC;YAChB,CAAC;YAED,IAAI,qBAAqB,EAAE,CAAC;gBAC1B,KAAkB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB,EAAE,CAAC;oBAArC,IAAM,GAAG,8BAAA;oBACZ,8BAA8B,CAAC,MAAI,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;gBACzG,CAAC;YACH,CAAC;YAED,YAAY,IAAI,gBAAgB,CAAC,MAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;YAE5D,iBAAiB,IAAI,qBAAqB,CAAC,MAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAC7E,CAAC;QAED,0FAA0F;QAC1F,yFAAyF;QACzF,2FAA2F;QAC3F,8EAA8E;QAC9E,eAAe,IAAI,mBAAmB,uBAAM,eAAe,KAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,aAAa,EAAE,MAAI,EAAE,QAAQ,UAAA,IAAG,CAAC;IACpH,CAAC;AACH,CAAC","sourcesContent":["import * as React from 'react';\nimport {\n warn,\n warnControlledUsage,\n warnConditionallyRequiredProps,\n warnDeprecations,\n warnMutuallyExclusive,\n} from '@fluentui/utilities';\nimport { usePrevious } from './usePrevious';\nimport { useConst } from './useConst';\nimport type { ISettingsMap, IWarnControlledUsageParams } from '@fluentui/utilities';\n\nexport interface IWarningOptions<P> {\n /** Name of the component */\n name: string;\n\n /** Current component props */\n props: P;\n\n /** Generic messages */\n other?: string[];\n\n /** Warns when props are required if a condition is met */\n conditionallyRequired?: {\n /** Props required when the condition is met */\n requiredProps: string[];\n /** Name of the prop that the condition is based on */\n conditionalPropName: string;\n /** Whether the condition is met */\n condition: boolean;\n }[];\n\n /**\n * Warns when deprecated props are being used. Each key is a prop name and each value is\n * either undefined or a replacement prop name.\n */\n deprecations?: ISettingsMap<P>;\n\n /**\n * Warns when two props which are mutually exclusive are both being used.\n * The key is one prop name and the value is the other.\n */\n mutuallyExclusive?: ISettingsMap<P>;\n\n /**\n * Check for and warn on the following error conditions with a form component:\n * - A value prop is provided (indicated it's being used as controlled) without a change handler,\n * and the component is not read-only\n * - Both the value and defaultValue props are provided\n * - The component is attempting to switch between controlled and uncontrolled\n *\n * The messages mimic the warnings React gives for these error conditions on input elements.\n * The warning will only be displayed once per component instance.\n */\n controlledUsage?: Pick<\n IWarnControlledUsageParams<P>,\n 'valueProp' | 'defaultValueProp' | 'onChangeProp' | 'readOnlyProp'\n >;\n}\n\nlet warningId = 0;\n\n/**\n * Only in development mode, display console warnings when certain conditions are met.\n * Note that all warnings except `controlledUsage` will only be shown on first render\n * (new `controlledUsage` warnings may be shown later due to prop changes).\n */\nexport function useWarnings<P extends {}>(options: IWarningOptions<P>) {\n if (process.env.NODE_ENV !== 'production') {\n const {\n name,\n props,\n other = [],\n conditionallyRequired,\n deprecations,\n mutuallyExclusive,\n controlledUsage,\n } = options;\n\n /* eslint-disable react-hooks/rules-of-hooks -- build-time conditional */\n const hasWarnedRef = React.useRef(false);\n const componentId = useConst(() => `useWarnings_${warningId++}`);\n const oldProps = usePrevious(props);\n /* eslint-enable react-hooks/rules-of-hooks */\n\n // Warn synchronously (not in useEffect) on first render to make debugging easier.\n if (!hasWarnedRef.current) {\n hasWarnedRef.current = true;\n\n for (const warning of other) {\n warn(warning);\n }\n\n if (conditionallyRequired) {\n for (const req of conditionallyRequired) {\n warnConditionallyRequiredProps(name, props, req.requiredProps, req.conditionalPropName, req.condition);\n }\n }\n\n deprecations && warnDeprecations(name, props, deprecations);\n\n mutuallyExclusive && warnMutuallyExclusive(name, props, mutuallyExclusive);\n }\n\n // Controlled usage warnings may be displayed on either first or subsequent renders due to\n // prop changes. Note that it's safe to run this synchronously (not in useEffect) even in\n // concurrent mode because `warnControlledUsage` internally tracks which warnings have been\n // displayed for each component instance (so nothing will be displayed twice).\n controlledUsage && warnControlledUsage({ ...controlledUsage, componentId, props, componentName: name, oldProps });\n }\n}\n"]} |
+1
-1
| // Do not modify this file; it is generated as part of publish. | ||
| // The checked in version is a placeholder only and will not be updated. | ||
| import { setVersion } from '@fluentui/set-version'; | ||
| setVersion('@fluentui/react-hooks', '8.8.16'); | ||
| setVersion('@fluentui/react-hooks', '8.8.17'); | ||
| //# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.16');"]} | ||
| {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-hooks', '8.8.17');"]} |
+4
-4
| { | ||
| "name": "@fluentui/react-hooks", | ||
| "version": "8.8.16", | ||
| "version": "8.8.17", | ||
| "description": "Fluent UI React hooks.", | ||
@@ -34,5 +34,5 @@ "main": "lib-commonjs/index.js", | ||
| "dependencies": { | ||
| "@fluentui/react-window-provider": "^2.2.28", | ||
| "@fluentui/set-version": "^8.2.23", | ||
| "@fluentui/utilities": "^8.15.19", | ||
| "@fluentui/react-window-provider": "^2.2.29", | ||
| "@fluentui/set-version": "^8.2.24", | ||
| "@fluentui/utilities": "^8.15.20", | ||
| "tslib": "^2.1.0" | ||
@@ -39,0 +39,0 @@ }, |
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
493010
0.59%6089
0.69%