@fluentui/react-message-bar 9.7.3 → 9.7.4

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 CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-message-bar
2
2
 
3
- This log was last generated on Mon, 29 Jun 2026 15:14:11 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 04 Aug 2026 10:10:10 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.7.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.7.4)
8
+
9
+ Tue, 04 Aug 2026 10:10:10 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.7.3..@fluentui/react-message-bar_v9.7.4)
11
+
12
+ ### Patches
13
+
14
+ - fix(MessageBar): v9 MessageBar Resize Flicker Fix ([PR #36405](https://github.com/microsoft/fluentui/pull/36405) by jiangemma@microsoft.com)
15
+
7
16
  ## [9.7.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.7.3)
8
17
 
9
- Mon, 29 Jun 2026 15:14:11 GMT
18
+ Mon, 29 Jun 2026 15:15:07 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.7.2..@fluentui/react-message-bar_v9.7.3)
11
20
 
12
21
  ### Patches
@@ -8,7 +8,7 @@ export function useMessageBarReflow(enabled = false) {
8
8
  const reflowingRef = React.useRef(false);
9
9
  // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
10
10
  const resizeObserverRef = React.useRef(null);
11
- const prevInlineSizeRef = React.useRef(-1);
11
+ const singleLineWidthRef = React.useRef(Number.POSITIVE_INFINITY);
12
12
  const handleResize = React.useCallback((entries)=>{
13
13
  var _entry_borderBoxSize_, _entry_borderBoxSize;
14
14
  // Resize observer is only owned by this component - one resize observer entry expected
@@ -33,20 +33,17 @@ export function useMessageBarReflow(enabled = false) {
33
33
  return;
34
34
  }
35
35
  let nextReflowing;
36
- // No easy way to really determine when the single line layout will fit
37
- // Just keep try to set single line layout as long as the size is growing
38
- // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case
39
36
  if (reflowingRef.current) {
40
- if (prevInlineSizeRef.current < inlineSize) {
37
+ if (inlineSize >= singleLineWidthRef.current) {
41
38
  nextReflowing = false;
42
39
  }
43
40
  } else {
44
41
  const scrollWidth = target.scrollWidth;
45
42
  if (inlineSize < scrollWidth) {
46
43
  nextReflowing = true;
44
+ singleLineWidthRef.current = scrollWidth;
47
45
  }
48
46
  }
49
- prevInlineSizeRef.current = inlineSize;
50
47
  if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {
51
48
  reflowingRef.current = nextReflowing;
52
49
  forceUpdate();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBar/useMessageBarReflow.ts"],"sourcesContent":["'use client';\n\nimport * 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 ref: React.RefCallback<HTMLElement>;\n reflowing: boolean;\n} {\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\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 // `borderBoxSize` is not supported before Chrome 84, Firefox 92, nor Safari 15.4\n const inlineSize = entry?.borderBoxSize?.[0]?.inlineSize ?? entry?.target.getBoundingClientRect().width;\n\n if (inlineSize === undefined || !entry) {\n return;\n }\n\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 // eslint-disable-next-line react-hooks/refs\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","entry","process","env","NODE_ENV","length","console","error","join","inlineSize","borderBoxSize","target","getBoundingClientRect","width","undefined","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":"AAAA;A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B,kBAAkBmB,OAAO,GAAGP,YAAY;gBAC1CM,gBAAgB;YAClB;QACF,OAAO;YACL,MAAME,cAAcN,OAAOM,WAAW;YACtC,IAAIR,aAAaQ,aAAa;gBAC5BF,gBAAgB;YAClB;QACF;QAEAlB,kBAAkBmB,OAAO,GAAGP;QAC5B,IAAI,OAAOM,kBAAkB,eAAerB,aAAasB,OAAO,KAAKD,eAAe;YAClFrB,aAAasB,OAAO,GAAGD;YACvBvB;QACF;IACF,GACA;QAACA;KAAY;IAGf,MAAM0B,MAAMjC,MAAMc,WAAW,CAC3B,CAACoB;YAKCvB;QAJA,IAAI,CAACN,WAAW,CAAC6B,MAAM,EAAC5B,2BAAAA,qCAAAA,eAAgB6B,WAAW,GAAE;YACnD;QACF;SAEAxB,6BAAAA,kBAAkBoB,OAAO,cAAzBpB,iDAAAA,2BAA2ByB,UAAU;QAErC,MAAMC,MAAM/B,eAAe6B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAAC1B;QAC9CF,kBAAkBoB,OAAO,GAAGO;QAC5BA,eAAeE,OAAO,CAACN,IAAI;YAAEO,KAAK;QAAa;IACjD,GACA;QAACnC;QAAgBO;QAAcR;KAAQ;IAGzCL,MAAM0C,SAAS,CAAC;QACd,OAAO;gBACL/B;aAAAA,6BAAAA,kBAAkBoB,OAAO,cAAzBpB,iDAAAA,2BAA2ByB,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,4CAA4C;IAC5C,OAAO;QAAEH;QAAKU,WAAWlC,aAAasB,OAAO;IAAC;AAChD"}
1
+ {"version":3,"sources":["../src/components/MessageBar/useMessageBarReflow.ts"],"sourcesContent":["'use client';\n\nimport * 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 ref: React.RefCallback<HTMLElement>;\n reflowing: boolean;\n} {\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\n const resizeObserverRef = React.useRef<ResizeObserver | null>(null);\n const singleLineWidthRef = React.useRef(Number.POSITIVE_INFINITY);\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 // `borderBoxSize` is not supported before Chrome 84, Firefox 92, nor Safari 15.4\n const inlineSize = entry?.borderBoxSize?.[0]?.inlineSize ?? entry?.target.getBoundingClientRect().width;\n\n if (inlineSize === undefined || !entry) {\n return;\n }\n\n const { target } = entry;\n\n if (!isHTMLElement(target)) {\n return;\n }\n\n let nextReflowing: boolean | undefined;\n\n if (reflowingRef.current) {\n if (inlineSize >= singleLineWidthRef.current) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n singleLineWidthRef.current = scrollWidth;\n }\n }\n\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 // eslint-disable-next-line react-hooks/refs\n return { ref, reflowing: reflowingRef.current };\n}\n"],"names":["React","useFluent_unstable","useFluent","isHTMLElement","useMessageBarReflow","enabled","targetDocument","forceUpdate","useReducer","reflowingRef","useRef","resizeObserverRef","singleLineWidthRef","Number","POSITIVE_INFINITY","handleResize","useCallback","entries","entry","process","env","NODE_ENV","length","console","error","join","inlineSize","borderBoxSize","target","getBoundingClientRect","width","undefined","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,aAAa,QAAQ,4BAA4B;AAE1D,OAAO,SAASC,oBAAoBC,UAAmB,KAAK;IAI1D,MAAM,EAAEC,cAAc,EAAE,GAAGJ;IAC3B,MAAMK,cAAcP,MAAMQ,UAAU,CAAC,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC,EAAE,CAAC,EAAE;IACvD,MAAMC,eAAeT,MAAMU,MAAM,CAAC;IAClC,8FAA8F;IAE9F,MAAMC,oBAAoBX,MAAMU,MAAM,CAAwB;IAC9D,MAAME,qBAAqBZ,MAAMU,MAAM,CAACG,OAAOC,iBAAiB;IAEhE,MAAMC,eAAuCf,MAAMgB,WAAW,CAC5DC,CAAAA;YAgBqBC,uBAAAA;QAfnB,uFAAuF;QACvF,wEAAwE;QACxE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgBJ,QAAQK,MAAM,GAAG,GAAG;YAC/D,sCAAsC;YACtCC,QAAQC,KAAK,CACX;gBACE;gBACA;gBACA;aACD,CAACC,IAAI,CAAC;QAEX;QAEA,MAAMP,QAAQD,OAAO,CAAC,EAAE;YAELC;QADnB,iFAAiF;QACjF,MAAMQ,aAAaR,CAAAA,mCAAAA,kBAAAA,6BAAAA,uBAAAA,MAAOS,aAAa,cAApBT,4CAAAA,wBAA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4CAA4C;IAC5C,OAAO;QAAEH;QAAKU,WAAWpC,aAAawB,OAAO;IAAC;AAChD"}
@@ -19,7 +19,7 @@ function useMessageBarReflow(enabled = false) {
19
19
  const reflowingRef = _react.useRef(false);
20
20
  // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
21
21
  const resizeObserverRef = _react.useRef(null);
22
- const prevInlineSizeRef = _react.useRef(-1);
22
+ const singleLineWidthRef = _react.useRef(Number.POSITIVE_INFINITY);
23
23
  const handleResize = _react.useCallback((entries)=>{
24
24
  var _entry_borderBoxSize_, _entry_borderBoxSize;
25
25
  // Resize observer is only owned by this component - one resize observer entry expected
@@ -44,20 +44,17 @@ function useMessageBarReflow(enabled = false) {
44
44
  return;
45
45
  }
46
46
  let nextReflowing;
47
- // No easy way to really determine when the single line layout will fit
48
- // Just keep try to set single line layout as long as the size is growing
49
- // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case
50
47
  if (reflowingRef.current) {
51
- if (prevInlineSizeRef.current < inlineSize) {
48
+ if (inlineSize >= singleLineWidthRef.current) {
52
49
  nextReflowing = false;
53
50
  }
54
51
  } else {
55
52
  const scrollWidth = target.scrollWidth;
56
53
  if (inlineSize < scrollWidth) {
57
54
  nextReflowing = true;
55
+ singleLineWidthRef.current = scrollWidth;
58
56
  }
59
57
  }
60
- prevInlineSizeRef.current = inlineSize;
61
58
  if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {
62
59
  reflowingRef.current = nextReflowing;
63
60
  forceUpdate();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBar/useMessageBarReflow.ts"],"sourcesContent":["'use client';\n\nimport * 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 ref: React.RefCallback<HTMLElement>;\n reflowing: boolean;\n} {\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\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 // `borderBoxSize` is not supported before Chrome 84, Firefox 92, nor Safari 15.4\n const inlineSize = entry?.borderBoxSize?.[0]?.inlineSize ?? entry?.target.getBoundingClientRect().width;\n\n if (inlineSize === undefined || !entry) {\n return;\n }\n\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 // eslint-disable-next-line react-hooks/refs\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","entry","process","env","NODE_ENV","length","console","error","join","inlineSize","borderBoxSize","target","getBoundingClientRect","width","undefined","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":"AAAA;;;;;+BAMgBI;;;;;;;iEAJO,QAAQ;qCACiB,kCAAkC;gCACpD,4BAA4B;AAEnD,6BAA6BC,UAAmB,KAAK;IAI1D,MAAM,EAAEC,cAAc,EAAE,OAAGJ,uCAAAA;IAC3B,MAAMK,cAAcP,OAAMQ,UAAU,CAAC,IAAO,CAAA,EAAC,CAAA,EAAI,CAAC,EAAE,CAAC,EAAE;IACvD,MAAMC,eAAeT,OAAMU,MAAM,CAAC;IAClC,8FAA8F;IAE9F,MAAMC,oBAAoBX,OAAMU,MAAM,CAAwB;IAC9D,MAAME,oBAAoBZ,OAAMU,MAAM,CAAC,CAAC;IAExC,MAAMG,eAAuCb,OAAMc,WAAW,CAC5DC,CAAAA;YAgBqBC,uBAAAA;QAfnB,uFAAuF;QACvF,wEAAwE;QACxE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgBJ,QAAQK,MAAM,GAAG,GAAG;YAC/D,sCAAsC;YACtCC,QAAQC,KAAK,CACX;gBACE;gBACA;gBACA;aACD,CAACC,IAAI,CAAC;QAEX;QAEA,MAAMP,QAAQD,OAAO,CAAC,EAAE;YAELC;QADnB,iFAAiF;QACjF,MAAMQ,aAAaR,CAAAA,mCAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,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eAAe6B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAAC1B;QAC9CF,kBAAkBoB,OAAO,GAAGO;QAC5BA,eAAeE,OAAO,CAACN,IAAI;YAAEO,KAAK;QAAa;IACjD,GACA;QAACnC;QAAgBO;QAAcR;KAAQ;IAGzCL,OAAM0C,SAAS,CAAC;QACd,OAAO;gBACL/B;aAAAA,6BAAAA,kBAAkBoB,OAAAA,AAAO,MAAA,QAAzBpB,+BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,2BAA2ByB,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,4CAA4C;IAC5C,OAAO;QAAEH;QAAKU,WAAWlC,aAAasB,OAAO;IAAC;AAChD"}
1
+ {"version":3,"sources":["../src/components/MessageBar/useMessageBarReflow.ts"],"sourcesContent":["'use client';\n\nimport * 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 ref: React.RefCallback<HTMLElement>;\n reflowing: boolean;\n} {\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\n const resizeObserverRef = React.useRef<ResizeObserver | null>(null);\n const singleLineWidthRef = React.useRef(Number.POSITIVE_INFINITY);\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 // `borderBoxSize` is not supported before Chrome 84, Firefox 92, nor Safari 15.4\n const inlineSize = entry?.borderBoxSize?.[0]?.inlineSize ?? entry?.target.getBoundingClientRect().width;\n\n if (inlineSize === undefined || !entry) {\n return;\n }\n\n const { target } = entry;\n\n if (!isHTMLElement(target)) {\n return;\n }\n\n let nextReflowing: boolean | undefined;\n\n if (reflowingRef.current) {\n if (inlineSize >= singleLineWidthRef.current) {\n nextReflowing = false;\n }\n } else {\n const scrollWidth = target.scrollWidth;\n if (inlineSize < scrollWidth) {\n nextReflowing = true;\n singleLineWidthRef.current = scrollWidth;\n }\n }\n\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 // eslint-disable-next-line react-hooks/refs\n return { ref, reflowing: reflowingRef.current };\n}\n"],"names":["React","useFluent_unstable","useFluent","isHTMLElement","useMessageBarReflow","enabled","targetDocument","forceUpdate","useReducer","reflowingRef","useRef","resizeObserverRef","singleLineWidthRef","Number","POSITIVE_INFINITY","handleResize","useCallback","entries","entry","process","env","NODE_ENV","length","console","error","join","inlineSize","borderBoxSize","target","getBoundingClientRect","width","undefined","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win","resizeObserver","ResizeObserver","observe","box","useEffect","reflowing"],"mappings":"AAAA;;;;;+BAMgBI;;;;;;;iEAJO,QAAQ;qCACiB,kCAAkC;gCACpD,4BAA4B;AAEnD,6BAA6BC,UAAmB,KAAK;IAI1D,MAAM,EAAEC,cAAc,EAAE,OAAGJ,uCAAAA;IAC3B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AO,EAAE;gBAC5CD,gBAAgB;YAClB;QACF,OAAO;YACL,MAAME,cAAcN,OAAOM,WAAW;YACtC,IAAIR,aAAaQ,aAAa;gBAC5BF,gBAAgB;gBAChBpB,mBAAmBqB,OAAO,GAAGC;YAC/B;QACF;QAEA,IAAI,OAAOF,kBAAkB,eAAevB,aAAawB,OAAO,KAAKD,eAAe;YAClFvB,aAAawB,OAAO,GAAGD;YACvBzB;QACF;IACF,GACA;QAACA;KAAY;IAGf,MAAM4B,MAAMnC,OAAMgB,WAAW,CAC3B,CAACoB;YAKCzB;QAJA,IAAI,CAACN,WAAW,CAAC+B,MAAM,EAAC9B,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgB+B,WAAAA,AAAW,GAAE;YACnD;QACF;SAEA1B,6BAAAA,kBAAkBsB,OAAAA,AAAO,MAAA,QAAzBtB,+BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,2BAA2B2B,UAAU;QAErC,MAAMC,MAAMjC,eAAe+B,WAAW;QACtC,MAAMG,iBAAiB,IAAID,IAAIE,cAAc,CAAC1B;QAC9CJ,kBAAkBsB,OAAO,GAAGO;QAC5BA,eAAeE,OAAO,CAACN,IAAI;YAAEO,KAAK;QAAa;IACjD,GACA;QAACrC;QAAgBS;QAAcV;KAAQ;IAGzCL,OAAM4C,SAAS,CAAC;QACd,OAAO;gBACLjC;aAAAA,6BAAAA,kBAAkBsB,OAAAA,AAAO,MAAA,QAAzBtB,+BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,2BAA2B2B,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,4CAA4C;IAC5C,OAAO;QAAEH;QAAKU,WAAWpC,aAAawB,OAAO;IAAC;AAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-message-bar",
3
- "version": "9.7.3",
3
+ "version": "9.7.4",
4
4
  "description": "Fluent UI MessageBar component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -15,10 +15,10 @@
15
15
  "@fluentui/react-button": "^9.10.1",
16
16
  "@fluentui/react-icons": "^2.0.245",
17
17
  "@fluentui/react-jsx-runtime": "^9.4.4",
18
+ "@fluentui/react-link": "^9.8.3",
18
19
  "@fluentui/react-motion": "^9.16.1",
19
20
  "@fluentui/react-motion-components-preview": "^0.15.6",
20
21
  "@fluentui/react-shared-contexts": "^9.26.2",
21
- "@fluentui/react-link": "^9.8.3",
22
22
  "@fluentui/react-theme": "^9.2.1",
23
23
  "@fluentui/react-utilities": "^9.26.5",
24
24
  "@griffel/react": "^1.5.32",