@fluentui/react-message-bar 0.0.0-nightly-20240523-0405.1 → 0.0.0-nightly-20240524-0405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -11
- package/lib/components/MessageBar/useMessageBarReflow.js +2 -0
- package/lib/components/MessageBar/useMessageBarReflow.js.map +1 -1
- package/lib-commonjs/components/MessageBar/useMessageBarReflow.js +2 -0
- package/lib-commonjs/components/MessageBar/useMessageBarReflow.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-message-bar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 24 May 2024 04:21:02 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20240524-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v0.0.0-nightly-20240524-0405.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.2.
|
|
9
|
+
Fri, 24 May 2024 04:21:02 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.2.1..@fluentui/react-message-bar_v0.0.0-nightly-20240524-0405.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-button to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
18
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
19
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
20
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
|
21
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-button to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
20
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
21
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.2.1)
|
|
24
|
+
|
|
25
|
+
Thu, 23 May 2024 08:02:45 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.2.0..@fluentui/react-message-bar_v9.2.1)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- chore: replace usage of .shorthands() in styles ([PR #31458](https://github.com/microsoft/fluentui/pull/31458) by olfedias@microsoft.com)
|
|
31
|
+
- Bump @fluentui/react-button to v9.3.82 ([commit](https://github.com/microsoft/fluentui/commit/03599d609e8310b08c57d1f871cffbf717d79207) by beachball)
|
|
22
32
|
|
|
23
33
|
## [9.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.2.0)
|
|
24
34
|
|
|
@@ -5,6 +5,8 @@ export function useMessageBarReflow(enabled = false) {
|
|
|
5
5
|
const { targetDocument } = useFluent();
|
|
6
6
|
const forceUpdate = React.useReducer(()=>({}), {})[1];
|
|
7
7
|
const reflowingRef = React.useRef(false);
|
|
8
|
+
// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
|
|
9
|
+
// eslint-disable-next-line no-restricted-globals
|
|
8
10
|
const resizeObserverRef = React.useRef(null);
|
|
9
11
|
const prevInlineSizeRef = React.useRef(-1);
|
|
10
12
|
const handleResize = React.useCallback((entries)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useMessageBarReflow.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\nexport function useMessageBarReflow(enabled: boolean = false) {\n const { targetDocument } = useFluent();\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n const reflowingRef = React.useRef(false);\n const resizeObserverRef = React.useRef<ResizeObserver | null>(null);\n const prevInlineSizeRef = React.useRef(-1);\n\n const handleResize: ResizeObserverCallback = React.useCallback(\n entries => {\n // Resize observer is only owned by this component - one resize observer entry expected\n // No need to support multiple fragments - one border box entry expected\n if (process.env.NODE_ENV !== 'production' && entries.length > 1) {\n // eslint-disable-next-line no-console\n console.error(\n [\n 'useMessageBarReflow: Resize observer should only have one entry. ',\n 'If multiple entries are observed, the first entry will be used.',\n 'This is a bug, please report it to the Fluent UI team.',\n ].join(' '),\n );\n }\n\n const entry = entries[0];\n const borderBoxSize = entry?.borderBoxSize[0];\n if (!borderBoxSize || !entry) {\n return;\n }\n\n const { inlineSize } = borderBoxSize;\n const { target } = entry;\n\n if (!isHTMLElement(target)) {\n return;\n }\n\n let nextReflowing: boolean | undefined;\n\n // No easy way to really determine when the single line layout will fit\n // Just keep try to set single line layout as long as the size is growing\n // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case\n if (reflowingRef.current) {\n if (prevInlineSizeRef.current < inlineSize) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n }\n }\n\n prevInlineSizeRef.current = inlineSize;\n if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {\n reflowingRef.current = nextReflowing;\n forceUpdate();\n }\n },\n [forceUpdate],\n );\n\n const ref = React.useCallback(\n (el: HTMLElement | null) => {\n if (!enabled || !el || !targetDocument?.defaultView) {\n return;\n }\n\n resizeObserverRef.current?.disconnect();\n\n const win = targetDocument.defaultView;\n const resizeObserver = new win.ResizeObserver(handleResize);\n resizeObserverRef.current = resizeObserver;\n resizeObserver.observe(el, { box: 'border-box' });\n },\n [targetDocument, handleResize, enabled],\n );\n\n React.useEffect(() => {\n return () => {\n resizeObserverRef.current?.disconnect();\n };\n }, []);\n\n return { ref, reflowing: reflowingRef.current };\n}\n"],"names":["React","useFluent_unstable","useFluent","isHTMLElement","useMessageBarReflow","enabled","targetDocument","forceUpdate","useReducer","reflowingRef","useRef","resizeObserverRef","prevInlineSizeRef","handleResize","useCallback","entries","process","env","NODE_ENV","length","console","error","join","entry","borderBoxSize","inlineSize","target","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC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AAelB,aAAamB,OAAO,KAAKD,eAAe;YAClFlB,aAAamB,OAAO,GAAGD;YACvBpB;QACF;IACF,GACA;QAACA;KAAY;IAGf,MAAMuB,MAAM9B,MAAMc,WAAW,CAC3B,CAACiB;YAKCpB;QAJA,IAAI,CAACN,WAAW,CAAC0B,MAAM,EAACzB,2BAAAA,qCAAAA,eAAgB0B,WAAW,GAAE;YACnD;QACF;SAEArB,6BAAAA,kBAAkBiB,OAAO,cAAzBjB,iDAAAA,2BAA2BsB,UAAU;QAErC,MAAMC,MAAM5B,eAAe0B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAACvB;QAC9CF,kBAAkBiB,OAAO,GAAGO;QAC5BA,eAAeE,OAAO,CAACN,IAAI;YAAEO,KAAK;QAAa;IACjD,GACA;QAAChC;QAAgBO;QAAcR;KAAQ;IAGzCL,MAAMuC,SAAS,CAAC;QACd,OAAO;gBACL5B;aAAAA,6BAAAA,kBAAkBiB,OAAO,cAAzBjB,iDAAAA,2BAA2BsB,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,OAAO;QAAEH;QAAKU,WAAW/B,aAAamB,OAAO;IAAC;AAChD"}
|
|
1
|
+
{"version":3,"sources":["useMessageBarReflow.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\nexport function useMessageBarReflow(enabled: boolean = false) {\n const { targetDocument } = useFluent();\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n const reflowingRef = React.useRef(false);\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n const resizeObserverRef = React.useRef<ResizeObserver | null>(null);\n const prevInlineSizeRef = React.useRef(-1);\n\n const handleResize: ResizeObserverCallback = React.useCallback(\n entries => {\n // Resize observer is only owned by this component - one resize observer entry expected\n // No need to support multiple fragments - one border box entry expected\n if (process.env.NODE_ENV !== 'production' && entries.length > 1) {\n // eslint-disable-next-line no-console\n console.error(\n [\n 'useMessageBarReflow: Resize observer should only have one entry. ',\n 'If multiple entries are observed, the first entry will be used.',\n 'This is a bug, please report it to the Fluent UI team.',\n ].join(' '),\n );\n }\n\n const entry = entries[0];\n const borderBoxSize = entry?.borderBoxSize[0];\n if (!borderBoxSize || !entry) {\n return;\n }\n\n const { inlineSize } = borderBoxSize;\n const { target } = entry;\n\n if (!isHTMLElement(target)) {\n return;\n }\n\n let nextReflowing: boolean | undefined;\n\n // No easy way to really determine when the single line layout will fit\n // Just keep try to set single line layout as long as the size is growing\n // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case\n if (reflowingRef.current) {\n if (prevInlineSizeRef.current < inlineSize) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n }\n }\n\n prevInlineSizeRef.current = inlineSize;\n if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {\n reflowingRef.current = nextReflowing;\n forceUpdate();\n }\n },\n [forceUpdate],\n );\n\n const ref = React.useCallback(\n (el: HTMLElement | null) => {\n if (!enabled || !el || !targetDocument?.defaultView) {\n return;\n }\n\n resizeObserverRef.current?.disconnect();\n\n const win = targetDocument.defaultView;\n const resizeObserver = new win.ResizeObserver(handleResize);\n resizeObserverRef.current = resizeObserver;\n resizeObserver.observe(el, { box: 'border-box' });\n },\n [targetDocument, handleResize, enabled],\n );\n\n React.useEffect(() => {\n return () => {\n resizeObserverRef.current?.disconnect();\n };\n }, []);\n\n return { ref, reflowing: reflowingRef.current };\n}\n"],"names":["React","useFluent_unstable","useFluent","isHTMLElement","useMessageBarReflow","enabled","targetDocument","forceUpdate","useReducer","reflowingRef","useRef","resizeObserverRef","prevInlineSizeRef","handleResize","useCallback","entries","process","env","NODE_ENV","length","console","error","join","entry","borderBoxSize","inlineSize","target","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resize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AaI,aAAa;gBAC5BF,gBAAgB;YAClB;QACF;QAEAf,kBAAkBgB,OAAO,GAAGH;QAC5B,IAAI,OAAOE,kBAAkB,eAAelB,aAAamB,OAAO,KAAKD,eAAe;YAClFlB,aAAamB,OAAO,GAAGD;YACvBpB;QACF;IACF,GACA;QAACA;KAAY;IAGf,MAAMuB,MAAM9B,MAAMc,WAAW,CAC3B,CAACiB;YAKCpB;QAJA,IAAI,CAACN,WAAW,CAAC0B,MAAM,EAACzB,2BAAAA,qCAAAA,eAAgB0B,WAAW,GAAE;YACnD;QACF;SAEArB,6BAAAA,kBAAkBiB,OAAO,cAAzBjB,iDAAAA,2BAA2BsB,UAAU;QAErC,MAAMC,MAAM5B,eAAe0B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAACvB;QAC9CF,kBAAkBiB,OAAO,GAAGO;QAC5BA,eAAeE,OAAO,CAACN,IAAI;YAAEO,KAAK;QAAa;IACjD,GACA;QAAChC;QAAgBO;QAAcR;KAAQ;IAGzCL,MAAMuC,SAAS,CAAC;QACd,OAAO;gBACL5B;aAAAA,6BAAAA,kBAAkBiB,OAAO,cAAzBjB,iDAAAA,2BAA2BsB,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,OAAO;QAAEH;QAAKU,WAAW/B,aAAamB,OAAO;IAAC;AAChD"}
|
|
@@ -16,6 +16,8 @@ function useMessageBarReflow(enabled = false) {
|
|
|
16
16
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
17
17
|
const forceUpdate = _react.useReducer(()=>({}), {})[1];
|
|
18
18
|
const reflowingRef = _react.useRef(false);
|
|
19
|
+
// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
|
|
20
|
+
// eslint-disable-next-line no-restricted-globals
|
|
19
21
|
const resizeObserverRef = _react.useRef(null);
|
|
20
22
|
const prevInlineSizeRef = _react.useRef(-1);
|
|
21
23
|
const handleResize = _react.useCallback((entries)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useMessageBarReflow.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nexport function useMessageBarReflow(enabled = false) {\n const { targetDocument } = useFluent();\n const forceUpdate = React.useReducer(()=>({}), {})[1];\n const reflowingRef = React.useRef(false);\n const resizeObserverRef = React.useRef(null);\n const prevInlineSizeRef = React.useRef(-1);\n const handleResize = React.useCallback((entries)=>{\n // Resize observer is only owned by this component - one resize observer entry expected\n // No need to support multiple fragments - one border box entry expected\n if (process.env.NODE_ENV !== 'production' && entries.length > 1) {\n // eslint-disable-next-line no-console\n console.error([\n 'useMessageBarReflow: Resize observer should only have one entry. ',\n 'If multiple entries are observed, the first entry will be used.',\n 'This is a bug, please report it to the Fluent UI team.'\n ].join(' '));\n }\n const entry = entries[0];\n const borderBoxSize = entry === null || entry === void 0 ? void 0 : entry.borderBoxSize[0];\n if (!borderBoxSize || !entry) {\n return;\n }\n const { inlineSize } = borderBoxSize;\n const { target } = entry;\n if (!isHTMLElement(target)) {\n return;\n }\n let nextReflowing;\n // No easy way to really determine when the single line layout will fit\n // Just keep try to set single line layout as long as the size is growing\n // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case\n if (reflowingRef.current) {\n if (prevInlineSizeRef.current < inlineSize) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n }\n }\n prevInlineSizeRef.current = inlineSize;\n if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {\n reflowingRef.current = nextReflowing;\n forceUpdate();\n }\n }, [\n forceUpdate\n ]);\n const ref = React.useCallback((el)=>{\n var _resizeObserverRef_current;\n if (!enabled || !el || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView)) {\n return;\n }\n (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();\n const win = targetDocument.defaultView;\n const resizeObserver = new win.ResizeObserver(handleResize);\n resizeObserverRef.current = resizeObserver;\n resizeObserver.observe(el, {\n box: 'border-box'\n });\n }, [\n targetDocument,\n handleResize,\n enabled\n ]);\n React.useEffect(()=>{\n return ()=>{\n var _resizeObserverRef_current;\n (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();\n };\n }, []);\n return {\n ref,\n reflowing: reflowingRef.current\n };\n}\n"],"names":["useMessageBarReflow","enabled","targetDocument","useFluent","forceUpdate","React","useReducer","reflowingRef","useRef","resizeObserverRef","prevInlineSizeRef","handleResize","useCallback","entries","process","env","NODE_ENV","length","console","error","join","entry","borderBoxSize","inlineSize","target","isHTMLElement","nextReflowing","current","scrollWidth","ref","el","_resizeObserverRef_current","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":";;;;+BAGgBA;;;eAAAA;;;;iEAHO;qCACyB;gCAClB;AACvB,SAASA,oBAAoBC,UAAU,KAAK;IAC/C,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,cAAcC,OAAMC,UAAU,CAAC,IAAK,CAAA,CAAC,CAAA,GAAI,CAAC,EAAE,CAAC,EAAE;IACrD,MAAMC,eAAeF,OAAMG,MAAM,CAAC;IAClC,MAAMC,oBAAoBJ,OAAMG,MAAM,CAAC;IACvC,MAAME,oBAAoBL,OAAMG,MAAM,CAAC,CAAC;IACxC,MAAMG,eAAeN,OAAMO,WAAW,CAAC,CAACC;QACpC,uFAAuF;QACvF,wEAAwE;QACxE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgBH,QAAQI,MAAM,GAAG,GAAG;YAC7D,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;gBACV;gBACA;gBACA;aACH,CAACC,IAAI,CAAC;QACX;QACA,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;QACCpC;QACAS;QACAV;KACH;IACDI,OAAMkC,SAAS,CAAC;QACZ,OAAO;YACH,IAAIR;YACHA,CAAAA,6BAA6BtB,kBAAkBkB,OAAO,AAAD,MAAO,QAAQI,+BAA+B,KAAK,IAAI,KAAK,IAAIA,2BAA2BE,UAAU;QAC/J;IACJ,GAAG,EAAE;IACL,OAAO;QACHJ;QACAW,WAAWjC,aAAaoB,OAAO;IACnC;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useMessageBarReflow.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nexport function useMessageBarReflow(enabled = false) {\n const { targetDocument } = useFluent();\n const forceUpdate = React.useReducer(()=>({}), {})[1];\n const reflowingRef = React.useRef(false);\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n const resizeObserverRef = React.useRef(null);\n const prevInlineSizeRef = React.useRef(-1);\n const handleResize = React.useCallback((entries)=>{\n // Resize observer is only owned by this component - one resize observer entry expected\n // No need to support multiple fragments - one border box entry expected\n if (process.env.NODE_ENV !== 'production' && entries.length > 1) {\n // eslint-disable-next-line no-console\n console.error([\n 'useMessageBarReflow: Resize observer should only have one entry. ',\n 'If multiple entries are observed, the first entry will be used.',\n 'This is a bug, please report it to the Fluent UI team.'\n ].join(' '));\n }\n const entry = entries[0];\n const borderBoxSize = entry === null || entry === void 0 ? void 0 : entry.borderBoxSize[0];\n if (!borderBoxSize || !entry) {\n return;\n }\n const { inlineSize } = borderBoxSize;\n const { target } = entry;\n if (!isHTMLElement(target)) {\n return;\n }\n let nextReflowing;\n // No easy way to really determine when the single line layout will fit\n // Just keep try to set single line layout as long as the size is growing\n // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case\n if (reflowingRef.current) {\n if (prevInlineSizeRef.current < inlineSize) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n }\n }\n prevInlineSizeRef.current = inlineSize;\n if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {\n reflowingRef.current = nextReflowing;\n forceUpdate();\n }\n }, [\n forceUpdate\n ]);\n const ref = React.useCallback((el)=>{\n var _resizeObserverRef_current;\n if (!enabled || !el || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView)) {\n return;\n }\n (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();\n const win = targetDocument.defaultView;\n const resizeObserver = new win.ResizeObserver(handleResize);\n resizeObserverRef.current = resizeObserver;\n resizeObserver.observe(el, {\n box: 'border-box'\n });\n }, [\n targetDocument,\n handleResize,\n enabled\n ]);\n React.useEffect(()=>{\n return ()=>{\n var _resizeObserverRef_current;\n (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();\n };\n }, []);\n return {\n ref,\n reflowing: reflowingRef.current\n };\n}\n"],"names":["useMessageBarReflow","enabled","targetDocument","useFluent","forceUpdate","React","useReducer","reflowingRef","useRef","resizeObserverRef","prevInlineSizeRef","handleResize","useCallback","entries","process","env","NODE_ENV","length","console","error","join","entry","borderBoxSize","inlineSize","target","isHTMLElement","nextReflowing","current","scrollWidth","ref","el","_resizeObserverRef_current","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":";;;;+BAGgBA;;;eAAAA;;;;iEAHO;qCACyB;gCAClB;AACvB,SAASA,oBAAoBC,UAAU,KAAK;IAC/C,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,cAAcC,OAAMC,UAAU,CAAC,IAAK,CAAA,CAAC,CAAA,GAAI,CAAC,EAAE,CAAC,EAAE;IACrD,MAAMC,eAAeF,OAAMG,MAAM,CAAC;IA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,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAe8B,WAAW,AAAD,GAAI;YAClH;QACJ;QACCD,CAAAA,6BAA6BtB,kBAAkBkB,OAAO,AAAD,MAAO,QAAQI,+BAA+B,KAAK,IAAI,KAAK,IAAIA,2BAA2BE,UAAU;QAC3J,MAAMC,MAAMhC,eAAe8B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAACzB;QAC9CF,kBAAkBkB,OAAO,GAAGQ;QAC5BA,eAAeE,OAAO,CAACP,IAAI;YACvBQ,KAAK;QACT;IACJ,GAAG;QACCpC;QACAS;QACAV;KACH;IACDI,OAAMkC,SAAS,CAAC;QACZ,OAAO;YACH,IAAIR;YACHA,CAAAA,6BAA6BtB,kBAAkBkB,OAAO,AAAD,MAAO,QAAQI,+BAA+B,KAAK,IAAI,KAAK,IAAIA,2BAA2BE,UAAU;QAC/J;IACJ,GAAG,EAAE;IACL,OAAO;QACHJ;QACAW,WAAWjC,aAAaoB,OAAO;IACnC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-message-bar",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240524-0405.1",
|
|
4
4
|
"description": "Fluent UI MessageBar component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@fluentui/eslint-plugin": "*",
|
|
28
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
|
29
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
|
28
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20240524-0405.1",
|
|
29
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20240524-0405.1",
|
|
30
30
|
"@fluentui/scripts-api-extractor": "*",
|
|
31
31
|
"@fluentui/scripts-tasks": "*"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@fluentui/react-button": "0.0.0-nightly-
|
|
34
|
+
"@fluentui/react-button": "0.0.0-nightly-20240524-0405.1",
|
|
35
35
|
"@fluentui/react-icons": "^2.0.239",
|
|
36
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
|
37
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
|
38
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
|
39
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
|
36
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20240524-0405.1",
|
|
37
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20240524-0405.1",
|
|
38
|
+
"@fluentui/react-theme": "0.0.0-nightly-20240524-0405.1",
|
|
39
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20240524-0405.1",
|
|
40
40
|
"@griffel/react": "^1.5.22",
|
|
41
41
|
"@swc/helpers": "^0.5.1",
|
|
42
42
|
"react-transition-group": "^4.4.1"
|