@fluentui/react-message-bar 9.2.18 → 9.3.0

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/index.d.ts +9 -1
  3. package/lib/components/MessageBar/MessageBar.types.js.map +1 -1
  4. package/lib/components/MessageBar/useMessageBar.js +1 -0
  5. package/lib/components/MessageBar/useMessageBar.js.map +1 -1
  6. package/lib/components/MessageBar/useMessageBarReflow.js +62 -64
  7. package/lib/components/MessageBar/useMessageBarReflow.js.map +1 -1
  8. package/lib/components/MessageBar/useMessageBarStyles.styles.js +1 -1
  9. package/lib/components/MessageBar/useMessageBarStyles.styles.js.map +1 -1
  10. package/lib/components/MessageBarGroup/MessageBarGroup.motions.js +78 -0
  11. package/lib/components/MessageBarGroup/MessageBarGroup.motions.js.map +1 -0
  12. package/lib/components/MessageBarGroup/MessageBarGroup.types.js.map +1 -1
  13. package/lib/components/MessageBarGroup/renderMessageBarGroup.js +4 -7
  14. package/lib/components/MessageBarGroup/renderMessageBarGroup.js.map +1 -1
  15. package/lib/components/MessageBarGroup/useMessageBarGroupStyles.styles.js +1 -23
  16. package/lib/components/MessageBarGroup/useMessageBarGroupStyles.styles.js.map +1 -1
  17. package/lib/contexts/messageBarTransitionContext.js +1 -1
  18. package/lib/contexts/messageBarTransitionContext.js.map +1 -1
  19. package/lib-commonjs/components/MessageBar/MessageBar.types.js.map +1 -1
  20. package/lib-commonjs/components/MessageBar/useMessageBar.js +1 -0
  21. package/lib-commonjs/components/MessageBar/useMessageBar.js.map +1 -1
  22. package/lib-commonjs/components/MessageBar/useMessageBarReflow.js +61 -63
  23. package/lib-commonjs/components/MessageBar/useMessageBarReflow.js.map +1 -1
  24. package/lib-commonjs/components/MessageBar/useMessageBarStyles.styles.js +1 -1
  25. package/lib-commonjs/components/MessageBar/useMessageBarStyles.styles.js.map +1 -1
  26. package/lib-commonjs/components/MessageBarGroup/MessageBarGroup.motions.js +83 -0
  27. package/lib-commonjs/components/MessageBarGroup/MessageBarGroup.motions.js.map +1 -0
  28. package/lib-commonjs/components/MessageBarGroup/MessageBarGroup.types.js.map +1 -1
  29. package/lib-commonjs/components/MessageBarGroup/renderMessageBarGroup.js +4 -7
  30. package/lib-commonjs/components/MessageBarGroup/renderMessageBarGroup.js.map +1 -1
  31. package/lib-commonjs/components/MessageBarGroup/useMessageBarGroupStyles.styles.js +0 -28
  32. package/lib-commonjs/components/MessageBarGroup/useMessageBarGroupStyles.styles.js.map +1 -1
  33. package/lib-commonjs/contexts/messageBarTransitionContext.js.map +1 -1
  34. package/package.json +7 -6
  35. package/lib/components/MessageBarGroup/MessageBarTransition.js +0 -45
  36. package/lib/components/MessageBarGroup/MessageBarTransition.js.map +0 -1
  37. package/lib-commonjs/components/MessageBarGroup/MessageBarTransition.js +0 -53
  38. package/lib-commonjs/components/MessageBarGroup/MessageBarTransition.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBar/useMessageBar.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { useAnnounce } from '@fluentui/react-shared-contexts';\nimport type { MessageBarProps, MessageBarState } from './MessageBar.types';\nimport { getIntentIcon } from './getIntentIcon';\nimport { useMessageBarReflow } from './useMessageBarReflow';\nimport { useMessageBarTransitionContext } from '../../contexts/messageBarTransitionContext';\n\n/**\n * Create the state required to render MessageBar.\n *\n * The returned state can be modified with hooks such as useMessageBarStyles_unstable,\n * before being passed to renderMessageBar_unstable.\n *\n * @param props - props from this instance of MessageBar\n * @param ref - reference to root HTMLElement of MessageBar\n */\nexport const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HTMLDivElement>): MessageBarState => {\n const { layout = 'auto', intent = 'info', politeness, shape = 'rounded' } = props;\n const computedPoliteness = politeness ?? intent === 'info' ? 'polite' : 'assertive';\n const autoReflow = layout === 'auto';\n const { ref: reflowRef, reflowing } = useMessageBarReflow(autoReflow);\n const computedLayout = autoReflow ? (reflowing ? 'multiline' : 'singleline') : layout;\n const { className: transitionClassName, nodeRef } = useMessageBarTransitionContext();\n const actionsRef = React.useRef<HTMLDivElement | null>(null);\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n const { announce } = useAnnounce();\n const titleId = useId();\n\n React.useEffect(() => {\n const bodyMessage = bodyRef.current?.textContent;\n const actionsMessage = actionsRef.current?.textContent;\n\n const message = [bodyMessage, actionsMessage].filter(Boolean).join(',');\n announce(message, { polite: computedPoliteness === 'polite', alert: computedPoliteness === 'assertive' });\n }, [bodyRef, actionsRef, announce, computedPoliteness]);\n\n return {\n components: {\n root: 'div',\n icon: 'div',\n bottomReflowSpacer: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, reflowRef, nodeRef),\n role: 'group',\n 'aria-labelledby': titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n\n icon: slot.optional(props.icon, {\n renderByDefault: true,\n elementType: 'div',\n defaultProps: { children: getIntentIcon(intent) },\n }),\n bottomReflowSpacer: slot.optional(props.bottomReflowSpacer, {\n renderByDefault: computedLayout === 'multiline',\n elementType: 'div',\n }),\n layout: computedLayout,\n intent,\n transitionClassName,\n actionsRef,\n bodyRef,\n titleId,\n shape,\n };\n};\n"],"names":["useMessageBar_unstable","props","ref","layout","intent","politeness","shape","computedPoliteness","autoReflow","reflowRef","reflowing","useMessageBarReflow","computedLayout","className","transitionClassName","nodeRef","useMessageBarTransitionContext","actionsRef","React","useRef","bodyRef","announce","useAnnounce","titleId","useId","useEffect","bodyMessage","current","textContent","actionsMessage","message","filter","Boolean","join","polite","alert","components","root","icon","bottomReflowSpacer","slot","always","getIntrinsicElementProps","useMergedRefs","role","elementType","optional","renderByDefault","defaultProps","children","getIntentIcon"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAYI;QAAUd;KAAmB;IAEtD,OAAO;QACL6B,YAAY;YACVC,MAAM;YACNC,MAAM;YACNC,oBAAoB;QACtB;QACAF,MAAMG,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9BxC,KAAKyC,IAAAA,6BAAAA,EAAczC,KAAKO,WAAWM;YACnC6B,MAAM;YACN,mBAAmBrB;YACnB,GAAGtB,KAAK;QACV,IACA;YAAE4C,aAAa;QAAM;QAGvBP,MAAME,oBAAAA,CAAKM,QAAQ,CAAC7C,MAAMqC,IAAI,EAAE;YAC9BS,iBAAiB;YACjBF,aAAa;YACbG,cAAc;gBAAEC,UAAUC,IAAAA,4BAAAA,EAAc9C;YAAQ;QAClD;QACAmC,oBAAoBC,oBAAAA,CAAKM,QAAQ,CAAC7C,MAAMsC,kBAAkB,EAAE;YAC1DQ,iBAAiBnC,mBAAmB;YACpCiC,aAAa;QACf;QACA1C,QAAQS;QACRR;QACAU;QACAG;QACAG;QACAG;QACAjB;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/MessageBar/useMessageBar.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { useAnnounce } from '@fluentui/react-shared-contexts';\nimport type { MessageBarProps, MessageBarState } from './MessageBar.types';\nimport { getIntentIcon } from './getIntentIcon';\nimport { useMessageBarReflow } from './useMessageBarReflow';\nimport { useMessageBarTransitionContext } from '../../contexts/messageBarTransitionContext';\n\n/**\n * Create the state required to render MessageBar.\n *\n * The returned state can be modified with hooks such as useMessageBarStyles_unstable,\n * before being passed to renderMessageBar_unstable.\n *\n * @param props - props from this instance of MessageBar\n * @param ref - reference to root HTMLElement of MessageBar\n */\nexport const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HTMLDivElement>): MessageBarState => {\n const { layout = 'auto', intent = 'info', politeness, shape = 'rounded' } = props;\n const computedPoliteness = politeness ?? intent === 'info' ? 'polite' : 'assertive';\n const autoReflow = layout === 'auto';\n const { ref: reflowRef, reflowing } = useMessageBarReflow(autoReflow);\n const computedLayout = autoReflow ? (reflowing ? 'multiline' : 'singleline') : layout;\n // eslint-disable-next-line deprecation/deprecation\n const { className: transitionClassName, nodeRef } = useMessageBarTransitionContext();\n const actionsRef = React.useRef<HTMLDivElement | null>(null);\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n const { announce } = useAnnounce();\n const titleId = useId();\n\n React.useEffect(() => {\n const bodyMessage = bodyRef.current?.textContent;\n const actionsMessage = actionsRef.current?.textContent;\n\n const message = [bodyMessage, actionsMessage].filter(Boolean).join(',');\n announce(message, { polite: computedPoliteness === 'polite', alert: computedPoliteness === 'assertive' });\n }, [bodyRef, actionsRef, announce, computedPoliteness]);\n\n return {\n components: {\n root: 'div',\n icon: 'div',\n bottomReflowSpacer: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, reflowRef, nodeRef),\n role: 'group',\n 'aria-labelledby': titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n\n icon: slot.optional(props.icon, {\n renderByDefault: true,\n elementType: 'div',\n defaultProps: { children: getIntentIcon(intent) },\n }),\n bottomReflowSpacer: slot.optional(props.bottomReflowSpacer, {\n renderByDefault: computedLayout === 'multiline',\n elementType: 'div',\n }),\n layout: computedLayout,\n intent,\n transitionClassName,\n actionsRef,\n bodyRef,\n titleId,\n shape,\n };\n};\n"],"names":["useMessageBar_unstable","props","ref","layout","intent","politeness","shape","computedPoliteness","autoReflow","reflowRef","reflowing","useMessageBarReflow","computedLayout","className","transitionClassName","nodeRef","useMessageBarTransitionContext","actionsRef","React","useRef","bodyRef","announce","useAnnounce","titleId","useId","useEffect","bodyMessage","current","textContent","actionsMessage","message","filter","Boolean","join","polite","alert","components","root","icon","bottomReflowSpacer","slot","always","getIntrinsicElementProps","useMergedRefs","role","elementType","optional","renderByDefault","defaultProps","children","getIntentIcon"],"rangeMappings":";;;;;;;;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EI,QAAQ3B,uBAAuB;YAAU4B,OAAO5B,uBAAuB;QAAY;IACzG,GAAG;QAACa;QAASH;QAAYI;QAAUd;KAAmB;IAEtD,OAAO;QACL6B,YAAY;YACVC,MAAM;YACNC,MAAM;YACNC,oBAAoB;QACtB;QACAF,MAAMG,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9BxC,KAAKyC,IAAAA,6BAAAA,EAAczC,KAAKO,WAAWM;YACnC6B,MAAM;YACN,mBAAmBrB;YACnB,GAAGtB,KAAK;QACV,IACA;YAAE4C,aAAa;QAAM;QAGvBP,MAAME,oBAAAA,CAAKM,QAAQ,CAAC7C,MAAMqC,IAAI,EAAE;YAC9BS,iBAAiB;YACjBF,aAAa;YACbG,cAAc;gBAAEC,UAAUC,IAAAA,4BAAAA,EAAc9C;YAAQ;QAClD;QACAmC,oBAAoBC,oBAAAA,CAAKM,QAAQ,CAAC7C,MAAMsC,kBAAkB,EAAE;YAC1DQ,iBAAiBnC,mBAAmB;YACpCiC,aAAa;QACf;QACA1C,QAAQS;QACRR;QACAU;QACAG;QACAG;QACAG;QACAjB;IACF;AACF"}
@@ -14,81 +14,79 @@ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
14
14
  const _reactutilities = require("@fluentui/react-utilities");
15
15
  function useMessageBarReflow(enabled = false) {
16
16
  const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
17
- const forceUpdate = _react.useReducer(()=>({}), {})[1];
18
- const reflowingRef = _react.useRef(false);
19
- // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
20
- const resizeObserverRef = _react.useRef(null);
21
17
  const prevInlineSizeRef = _react.useRef(-1);
22
- const handleResize = _react.useCallback((entries)=>{
23
- var _entry_borderBoxSize_, _entry_borderBoxSize;
24
- // Resize observer is only owned by this component - one resize observer entry expected
25
- // No need to support multiple fragments - one border box entry expected
26
- if (process.env.NODE_ENV !== 'production' && entries.length > 1) {
27
- // eslint-disable-next-line no-console
28
- console.error([
29
- 'useMessageBarReflow: Resize observer should only have one entry. ',
30
- 'If multiple entries are observed, the first entry will be used.',
31
- 'This is a bug, please report it to the Fluent UI team.'
32
- ].join(' '));
33
- }
34
- const entry = entries[0];
35
- var _entry_borderBoxSize__inlineSize;
36
- // `borderBoxSize` is not supported before Chrome 84, Firefox 92, nor Safari 15.4
37
- const inlineSize = (_entry_borderBoxSize__inlineSize = entry === null || entry === void 0 ? void 0 : (_entry_borderBoxSize = entry.borderBoxSize) === null || _entry_borderBoxSize === void 0 ? void 0 : (_entry_borderBoxSize_ = _entry_borderBoxSize[0]) === null || _entry_borderBoxSize_ === void 0 ? void 0 : _entry_borderBoxSize_.inlineSize) !== null && _entry_borderBoxSize__inlineSize !== void 0 ? _entry_borderBoxSize__inlineSize : entry === null || entry === void 0 ? void 0 : entry.target.getBoundingClientRect().width;
38
- if (inlineSize === undefined || !entry) {
39
- return;
40
- }
41
- const { target } = entry;
42
- if (!(0, _reactutilities.isHTMLElement)(target)) {
18
+ const messageBarRef = _react.useRef(null);
19
+ const [reflowing, setReflowing] = _react.useState(false);
20
+ // This layout effect 'sanity checks' what observers have done
21
+ // since DOM has not been flushed when observers run
22
+ (0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
23
+ if (!messageBarRef.current) {
43
24
  return;
44
25
  }
45
- let nextReflowing;
46
- // No easy way to really determine when the single line layout will fit
47
- // Just keep try to set single line layout as long as the size is growing
48
- // Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case
49
- if (reflowingRef.current) {
50
- if (prevInlineSizeRef.current < inlineSize) {
51
- nextReflowing = false;
52
- }
53
- } else {
54
- const scrollWidth = target.scrollWidth;
55
- if (inlineSize < scrollWidth) {
56
- nextReflowing = true;
26
+ setReflowing((prevReflowing)=>{
27
+ if (!prevReflowing && messageBarRef.current && isReflowing(messageBarRef.current)) {
28
+ return true;
57
29
  }
58
- }
59
- prevInlineSizeRef.current = inlineSize;
60
- if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {
61
- reflowingRef.current = nextReflowing;
62
- forceUpdate();
63
- }
30
+ return prevReflowing;
31
+ });
64
32
  }, [
65
- forceUpdate
33
+ reflowing
66
34
  ]);
67
- const ref = _react.useCallback((el)=>{
68
- var _resizeObserverRef_current;
69
- if (!enabled || !el || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView)) {
35
+ const handleResize = _react.useCallback(()=>{
36
+ if (!messageBarRef.current) {
70
37
  return;
71
38
  }
72
- (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();
73
- const win = targetDocument.defaultView;
74
- const resizeObserver = new win.ResizeObserver(handleResize);
75
- resizeObserverRef.current = resizeObserver;
76
- resizeObserver.observe(el, {
77
- box: 'border-box'
78
- });
39
+ const inlineSize = messageBarRef.current.getBoundingClientRect().width;
40
+ const scrollWidth = messageBarRef.current.scrollWidth;
41
+ const expanding = prevInlineSizeRef.current < inlineSize;
42
+ const overflowing = inlineSize < scrollWidth;
43
+ setReflowing(!expanding || overflowing);
44
+ }, []);
45
+ const handleIntersection = _react.useCallback((entries)=>{
46
+ if (entries[0].intersectionRatio < 1) {
47
+ setReflowing(true);
48
+ }
49
+ }, []);
50
+ const ref = _react.useMemo(()=>{
51
+ let resizeObserver = null;
52
+ let intersectionObserer = null;
53
+ return (el)=>{
54
+ if (!enabled || !el || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView)) {
55
+ resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
56
+ intersectionObserer === null || intersectionObserer === void 0 ? void 0 : intersectionObserer.disconnect();
57
+ return;
58
+ }
59
+ messageBarRef.current = el;
60
+ const win = targetDocument.defaultView;
61
+ resizeObserver = new win.ResizeObserver(handleResize);
62
+ intersectionObserer = new win.IntersectionObserver(handleIntersection, {
63
+ threshold: 1
64
+ });
65
+ intersectionObserer.observe(el);
66
+ resizeObserver.observe(el, {
67
+ box: 'border-box'
68
+ });
69
+ };
79
70
  }, [
80
- targetDocument,
81
71
  handleResize,
82
- enabled
72
+ handleIntersection,
73
+ enabled,
74
+ targetDocument
83
75
  ]);
84
- _react.useEffect(()=>{
85
- return ()=>{
86
- var _resizeObserverRef_current;
87
- (_resizeObserverRef_current = resizeObserverRef.current) === null || _resizeObserverRef_current === void 0 ? void 0 : _resizeObserverRef_current.disconnect();
88
- };
89
- }, []);
90
76
  return {
91
77
  ref,
92
- reflowing: reflowingRef.current
78
+ reflowing
93
79
  };
94
80
  }
81
+ const isReflowing = (el)=>{
82
+ return el.scrollWidth > el.offsetWidth || !isFullyInViewport(el);
83
+ };
84
+ const isFullyInViewport = (el)=>{
85
+ const rect = el.getBoundingClientRect();
86
+ const doc = el.ownerDocument;
87
+ const win = doc.defaultView;
88
+ if (!win) {
89
+ return true;
90
+ }
91
+ return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (win.innerHeight || doc.documentElement.clientHeight) && rect.right <= (win.innerWidth || doc.documentElement.clientWidth);
92
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBar/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\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 return { ref, reflowing: reflowingRef.current };\n}\n"],"names":["useMessageBarReflow","enabled","targetDocument","useFluent","forceUpdate","React","useReducer","reflowingRef","useRef","resizeObserverRef","prevInlineSizeRef","handleResize","useCallback","entries","entry","process","env","NODE_ENV","length","console","error","join","inlineSize","borderBoxSize","target","getBoundingClientRect","width","undefined","isHTMLElement","nextReflowing","current","scrollWidth","ref","el","defaultView","disconnect","win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AAA,6BAAAA,kBAAkBqB,OAAO,AAAPA,MAAO,QAAzBrB,+BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,2BAA2B0B,UAAU;QACvC;IACF,GAAG,EAAE;IAEL,OAAO;QAAEH;QAAKU,WAAWnC,aAAauB,OAAO;IAAC;AAChD"}
1
+ {"version":3,"sources":["../src/components/MessageBar/useMessageBarReflow.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\nexport function useMessageBarReflow(enabled: boolean = false) {\n const { targetDocument } = useFluent();\n const prevInlineSizeRef = React.useRef(-1);\n const messageBarRef = React.useRef<HTMLElement | null>(null);\n\n const [reflowing, setReflowing] = React.useState(false);\n\n // This layout effect 'sanity checks' what observers have done\n // since DOM has not been flushed when observers run\n useIsomorphicLayoutEffect(() => {\n if (!messageBarRef.current) {\n return;\n }\n\n setReflowing(prevReflowing => {\n if (!prevReflowing && messageBarRef.current && isReflowing(messageBarRef.current)) {\n return true;\n }\n\n return prevReflowing;\n });\n }, [reflowing]);\n\n const handleResize: ResizeObserverCallback = React.useCallback(() => {\n if (!messageBarRef.current) {\n return;\n }\n\n const inlineSize = messageBarRef.current.getBoundingClientRect().width;\n const scrollWidth = messageBarRef.current.scrollWidth;\n\n const expanding = prevInlineSizeRef.current < inlineSize;\n const overflowing = inlineSize < scrollWidth;\n\n setReflowing(!expanding || overflowing);\n }, []);\n\n const handleIntersection: IntersectionObserverCallback = React.useCallback(entries => {\n if (entries[0].intersectionRatio < 1) {\n setReflowing(true);\n }\n }, []);\n\n const ref = React.useMemo(() => {\n let resizeObserver: ResizeObserver | null = null;\n let intersectionObserer: IntersectionObserver | null = null;\n\n return (el: HTMLElement | null) => {\n if (!enabled || !el || !targetDocument?.defaultView) {\n resizeObserver?.disconnect();\n intersectionObserer?.disconnect();\n return;\n }\n\n messageBarRef.current = el;\n\n const win = targetDocument.defaultView;\n resizeObserver = new win.ResizeObserver(handleResize);\n intersectionObserer = new win.IntersectionObserver(handleIntersection, { threshold: 1 });\n\n intersectionObserer.observe(el);\n resizeObserver.observe(el, { box: 'border-box' });\n };\n }, [handleResize, handleIntersection, enabled, targetDocument]);\n\n return { ref, reflowing };\n}\n\nconst isReflowing = (el: HTMLElement) => {\n return el.scrollWidth > el.offsetWidth || !isFullyInViewport(el);\n};\n\nconst isFullyInViewport = (el: HTMLElement) => {\n const rect = el.getBoundingClientRect();\n const doc = el.ownerDocument;\n const win = doc.defaultView;\n\n if (!win) {\n return true;\n }\n\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <= (win.innerHeight || doc.documentElement.clientHeight) &&\n rect.right <= (win.innerWidth || doc.documentElement.clientWidth)\n );\n};\n"],"names":["useMessageBarReflow","enabled","targetDocument","useFluent","prevInlineSizeRef","React","useRef","messageBarRef","reflowing","setReflowing","useState","useIsomorphicLayoutEffect","current","prevReflowing","isReflowing","handleResize","useCallback","inlineSize","getBoundingClientRect","width","scrollWidth","expanding","overflowing","handleIntersection","entries","intersectionRatio","ref","useMemo","resizeObserver","intersectionObserer","el","defaultView","disconnect","win","ResizeObserver","IntersectionObserver","threshold","observe","box","offsetWidth","isFullyInViewport","rect","doc","ownerDocument","top","left","bottom","innerHeight","documentElement","clientHeight","right","innerWidth","clientWidth"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIgBA;;;eAAAA;;;;iEAJO;qCACyB;gCACN;AAEnC,SAASA,oBAAoBC,UAAmB,KAAK;IAC1D,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAAA;IAC3B,MAAMC,oBAAoBC,OAAMC,MAAM,CAAC,CAAC;IACxC,MAAMC,gBAAgBF,OAAMC,MAAM,CAAqB;IAEvD,MAAM,CAACE,WAAWC,aAAa,G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AAW;YACtCH,iBAAiB,IAAIK,IAAIC,cAAc,CAACnB;YACxCc,sBAAsB,IAAII,IAAIE,oBAAoB,CAACZ,oBAAoB;gBAAEa,WAAW;YAAE;YAEtFP,oBAAoBQ,OAAO,CAACP;YAC5BF,eAAeS,OAAO,CAACP,IAAI;gBAAEQ,KAAK;YAAa;QACjD;IACF,GAAG;QAACvB;QAAcQ;QAAoBtB;QAASC;KAAe;IAE9D,OAAO;QAAEwB;QAAKlB;IAAU;AAC1B;AAEA,MAAMM,cAAc,CAACgB;IACnB,OAAOA,GAAGV,WAAW,GAAGU,GAAGS,WAAW,IAAI,CAACC,kBAAkBV;AAC/D;AAEA,MAAMU,oBAAoB,CAACV;IACzB,MAAMW,OAAOX,GAAGZ,qBAAqB;IACrC,MAAMwB,MAAMZ,GAAGa,aAAa;IAC5B,MAAMV,MAAMS,IAAIX,WAAW;IAE3B,IAAI,CAACE,KAAK;QACR,OAAO;IACT;IAEA,OACEQ,KAAKG,GAAG,IAAI,KACZH,KAAKI,IAAI,IAAI,KACbJ,KAAKK,MAAM,IAAKb,CAAAA,IAAIc,WAAW,IAAIL,IAAIM,eAAe,CAACC,YAAY,AAAZA,KACvDR,KAAKS,KAAK,IAAKjB,CAAAA,IAAIkB,UAAU,IAAIT,IAAIM,eAAe,CAACI,WAAW,AAAXA;AAEzD"}
@@ -163,7 +163,7 @@ const useMessageBarStyles_unstable = (state)=>{
163
163
  const rootIntentStyles = useRootIntentStyles();
164
164
  const reflowSpacerStyles = useReflowSpacerBaseStyles();
165
165
  const styles = useStyles();
166
- state.root.className = (0, _react.mergeClasses)(messageBarClassNames.root, rootBaseStyles, state.layout === 'multiline' && styles.rootMultiline, state.shape === 'square' && styles.square, rootIntentStyles[state.intent], state.transitionClassName, state.root.className);
166
+ state.root.className = (0, _react.mergeClasses)(messageBarClassNames.root, rootBaseStyles, state.layout === 'multiline' && styles.rootMultiline, state.shape === 'square' && styles.square, rootIntentStyles[state.intent], state.root.className);
167
167
  if (state.icon) {
168
168
  state.icon.className = (0, _react.mergeClasses)(messageBarClassNames.icon, iconBaseStyles, iconIntentStyles[state.intent], state.icon.className);
169
169
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useMessageBarStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const messageBarClassNames = {\n root: 'fui-MessageBar',\n icon: 'fui-MessageBar__icon',\n bottomReflowSpacer: 'fui-MessageBar__bottomReflowSpacer'\n};\nconst useRootBaseStyles = makeResetStyles({\n whiteSpace: 'nowrap',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto auto',\n gridTemplateRows: '1fr',\n gridTemplateAreas: '\"icon body secondaryActions actions\"',\n paddingLeft: tokens.spacingHorizontalM,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n alignItems: 'center',\n minHeight: '36px',\n boxSizing: 'border-box',\n backgroundColor: tokens.colorNeutralBackground3\n});\nconst useIconBaseStyles = makeResetStyles({\n gridArea: 'icon',\n fontSize: tokens.fontSizeBase500,\n marginRight: tokens.spacingHorizontalS,\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n alignItems: 'center'\n});\nconst useReflowSpacerBaseStyles = makeResetStyles({\n marginBottom: tokens.spacingVerticalS,\n gridArea: 'secondaryActions'\n});\nconst useStyles = makeStyles({\n rootMultiline: {\n whiteSpace: 'normal',\n alignItems: 'start',\n paddingTop: tokens.spacingVerticalMNudge,\n gridTemplateColumns: 'auto 1fr auto',\n gridTemplateAreas: `\n \"icon body actions\"\n \"secondaryActions secondaryActions secondaryActions\"\n `\n },\n secondaryActionsMultiline: {\n justifyContent: 'end',\n marginTop: tokens.spacingVerticalMNudge,\n marginBottom: tokens.spacingVerticalS,\n marginRight: '0px'\n },\n square: {\n borderRadius: '0'\n }\n});\nconst useIconIntentStyles = makeStyles({\n info: {\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground3\n },\n success: {\n color: tokens.colorStatusSuccessForeground1\n }\n});\nconst useRootIntentStyles = makeStyles({\n info: {\n },\n error: {\n backgroundColor: tokens.colorStatusDangerBackground1,\n ...shorthands.borderColor(tokens.colorStatusDangerBorder1)\n },\n warning: {\n backgroundColor: tokens.colorStatusWarningBackground1,\n ...shorthands.borderColor(tokens.colorStatusWarningBorder1)\n },\n success: {\n backgroundColor: tokens.colorStatusSuccessBackground1,\n ...shorthands.borderColor(tokens.colorStatusSuccessBorder1)\n }\n});\n/**\n * Apply styling to the MessageBar slots based on the state\n */ export const useMessageBarStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseStyles = useRootBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconIntentStyles = useIconIntentStyles();\n const rootIntentStyles = useRootIntentStyles();\n const reflowSpacerStyles = useReflowSpacerBaseStyles();\n const styles = useStyles();\n state.root.className = mergeClasses(messageBarClassNames.root, rootBaseStyles, state.layout === 'multiline' && styles.rootMultiline, state.shape === 'square' && styles.square, rootIntentStyles[state.intent], state.transitionClassName, state.root.className);\n if (state.icon) {\n state.icon.className = mergeClasses(messageBarClassNames.icon, iconBaseStyles, iconIntentStyles[state.intent], state.icon.className);\n }\n if (state.bottomReflowSpacer) {\n state.bottomReflowSpacer.className = mergeClasses(messageBarClassNames.bottomReflowSpacer, reflowSpacerStyles);\n }\n return state;\n};\n"],"names":["messageBarClassNames","useMessageBarStyles_unstable","root","icon","bottomReflowSpacer","useRootBaseStyles","__resetStyles","useIconBaseStyles","useReflowSpacerBaseStyles","useStyles","__styles","rootMultiline","Huce71","Bt984gj","z8tnut","Budl1dq","zoa1oz","secondaryActionsMultiline","Brf1p80","B6of3ja","jrapky","t21cq0","square","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","d","p","useIconIntentStyles","info","error","sj55zd","warning","success","useRootIntentStyles","De3pzq","g2u3we","h3c5rm","B9xav0g","zhjwy3","state","rootBaseStyles","iconBaseStyles","iconIntentStyles","rootIntentStyles","reflowSpacerStyles","styles","className","mergeClasses","layout","shape","intent","transitionClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IAmFIC,4BAA4B;eAA5BA;;;uBArFqD;AAE/D,MAAMD,uBAAuB;IAChCE,MAAM;IACNC,MAAM;IACNC,oBAAoB;AACxB;AACA,MAAMC,oBAAiB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,YAAA;IAAA;IAAA;CAazB;AACD,MAAMC,oBAAiB,WAAA,GAAGD,IAAAA,oBAAA,EAAA,YAAA,WAAA;IAAA;IAAA;CAOzB;AACD,MAAME,4BAAyB,WAAA,GAAGF,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAGjC;AACD,MAAMG,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,eAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;IAAAC,2BAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAC,GAAA,CAAA;YAAA;SAAA;KAAA;AAAA;AAqBlB,MAAMC,sBAAmB,WAAA,GAAGpB,IAAAA,eAAA,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/P,IAAIP,MAAMvC,IAAI,EAAE;QACZuC,MAAMvC,IAAI,CAAC8C,SAAS,GAAGC,IAAAA,mBAAY,EAAClD,qBAAqBG,IAAI,EAAEyC,gBAAgBC,gBAAgB,CAACH,MAAMW,MAAM,CAAC,EAAEX,MAAMvC,IAAI,CAAC8C,SAAS;IACvI;IACA,IAAIP,MAAMtC,kBAAkB,EAAE;QAC1BsC,MAAMtC,kBAAkB,CAAC6C,SAAS,GAAGC,IAAAA,mBAAY,EAAClD,qBAAqBI,kBAAkB,EAAE2C;IAC/F;IACA,OAAOL;AACX"}
1
+ {"version":3,"sources":["useMessageBarStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const messageBarClassNames = {\n root: 'fui-MessageBar',\n icon: 'fui-MessageBar__icon',\n bottomReflowSpacer: 'fui-MessageBar__bottomReflowSpacer'\n};\nconst useRootBaseStyles = makeResetStyles({\n whiteSpace: 'nowrap',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto auto',\n gridTemplateRows: '1fr',\n gridTemplateAreas: '\"icon body secondaryActions actions\"',\n paddingLeft: tokens.spacingHorizontalM,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n alignItems: 'center',\n minHeight: '36px',\n boxSizing: 'border-box',\n backgroundColor: tokens.colorNeutralBackground3\n});\nconst useIconBaseStyles = makeResetStyles({\n gridArea: 'icon',\n fontSize: tokens.fontSizeBase500,\n marginRight: tokens.spacingHorizontalS,\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n alignItems: 'center'\n});\nconst useReflowSpacerBaseStyles = makeResetStyles({\n marginBottom: tokens.spacingVerticalS,\n gridArea: 'secondaryActions'\n});\nconst useStyles = makeStyles({\n rootMultiline: {\n whiteSpace: 'normal',\n alignItems: 'start',\n paddingTop: tokens.spacingVerticalMNudge,\n gridTemplateColumns: 'auto 1fr auto',\n gridTemplateAreas: `\n \"icon body actions\"\n \"secondaryActions secondaryActions secondaryActions\"\n `\n },\n secondaryActionsMultiline: {\n justifyContent: 'end',\n marginTop: tokens.spacingVerticalMNudge,\n marginBottom: tokens.spacingVerticalS,\n marginRight: '0px'\n },\n square: {\n borderRadius: '0'\n }\n});\nconst useIconIntentStyles = makeStyles({\n info: {\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground3\n },\n success: {\n color: tokens.colorStatusSuccessForeground1\n }\n});\nconst useRootIntentStyles = makeStyles({\n info: {\n },\n error: {\n backgroundColor: tokens.colorStatusDangerBackground1,\n ...shorthands.borderColor(tokens.colorStatusDangerBorder1)\n },\n warning: {\n backgroundColor: tokens.colorStatusWarningBackground1,\n ...shorthands.borderColor(tokens.colorStatusWarningBorder1)\n },\n success: {\n backgroundColor: tokens.colorStatusSuccessBackground1,\n ...shorthands.borderColor(tokens.colorStatusSuccessBorder1)\n }\n});\n/**\n * Apply styling to the MessageBar slots based on the state\n */ export const useMessageBarStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseStyles = useRootBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconIntentStyles = useIconIntentStyles();\n const rootIntentStyles = useRootIntentStyles();\n const reflowSpacerStyles = useReflowSpacerBaseStyles();\n const styles = useStyles();\n state.root.className = mergeClasses(messageBarClassNames.root, rootBaseStyles, state.layout === 'multiline' && styles.rootMultiline, state.shape === 'square' && styles.square, rootIntentStyles[state.intent], state.root.className);\n if (state.icon) {\n state.icon.className = mergeClasses(messageBarClassNames.icon, iconBaseStyles, iconIntentStyles[state.intent], state.icon.className);\n }\n if (state.bottomReflowSpacer) {\n state.bottomReflowSpacer.className = mergeClasses(messageBarClassNames.bottomReflowSpacer, reflowSpacerStyles);\n }\n return state;\n};\n"],"names":["messageBarClassNames","useMessageBarStyles_unstable","root","icon","bottomReflowSpacer","useRootBaseStyles","__resetStyles","useIconBaseStyles","useReflowSpacerBaseStyles","useStyles","__styles","rootMultiline","Huce71","Bt984gj","z8tnut","Budl1dq","zoa1oz","secondaryActionsMultiline","Brf1p80","B6of3ja","jrapky","t21cq0","square","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","d","p","useIconIntentStyles","info","error","sj55zd","warning","success","useRootIntentStyles","De3pzq","g2u3we","h3c5rm","B9xav0g","zhjwy3","state","rootBaseStyles","iconBaseStyles","iconIntentStyles","rootIntentStyles","reflowSpacerStyles","styles","className","mergeClasses","layout","shape","intent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IAmFIC,4BAA4B;eAA5BA;;;uBArFqD;AAE/D,MAAMD,uBAAuB;IAChCE,MAAM;IACNC,MAAM;IACNC,oBAAoB;AACxB;AACA,MAAMC,oBAAiB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,YAAA;IAAA;IAAA;CAazB;AACD,MAAMC,oBAAiB,WAAA,GAAGD,IAAAA,oBAAA,EAAA,YAAA,WAAA;IAAA;IAAA;CAOzB;AACD,MAAME,4BAAyB,WAAA,GAAGF,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAGjC;AACD,MAAMG,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,eAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;IAAAC,2BAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAA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D,qBAAqBE,IAAI,EAAEyC,gBAAgBD,MAAMS,MAAM,KAAK,eAAeH,OAAOrC,aAAa,EAAE+B,MAAMU,KAAK,KAAK,YAAYJ,OAAO1B,MAAM,EAAEwB,gBAAgB,CAACJ,MAAMW,MAAM,CAAC,EAAEX,MAAMxC,IAAI,CAAC+C,SAAS;IACpO,IAAIP,MAAMvC,IAAI,EAAE;QACZuC,MAAMvC,IAAI,CAAC8C,SAAS,GAAGC,IAAAA,mBAAY,EAAClD,qBAAqBG,IAAI,EAAEyC,gBAAgBC,gBAAgB,CAACH,MAAMW,MAAM,CAAC,EAAEX,MAAMvC,IAAI,CAAC8C,SAAS;IACvI;IACA,IAAIP,MAAMtC,kBAAkB,EAAE;QAC1BsC,MAAMtC,kBAAkB,CAAC6C,SAAS,GAAGC,IAAAA,mBAAY,EAAClD,qBAAqBI,kBAAkB,EAAE2C;IAC/F;IACA,OAAOL;AACX"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "MessageBarMotion", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return MessageBarMotion;
9
+ }
10
+ });
11
+ const _reactmotion = require("@fluentui/react-motion");
12
+ /**
13
+ * Generates a motion atom object for a fade in or fade out.
14
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
15
+ * @param duration - The duration of the motion in milliseconds.
16
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
17
+ * @param fromValue - The starting opacity value. Defaults to 0.
18
+ * @returns A motion atom object with opacity keyframes and the supplied duration and easing.
19
+ */ const fadeAtom = ({ direction, duration, easing = _reactmotion.motionTokens.curveLinear, fromValue = 0 })=>{
20
+ const keyframes = [
21
+ {
22
+ opacity: fromValue
23
+ },
24
+ {
25
+ opacity: 1
26
+ }
27
+ ];
28
+ if (direction === 'exit') {
29
+ keyframes.reverse();
30
+ }
31
+ return {
32
+ keyframes,
33
+ duration,
34
+ easing
35
+ };
36
+ };
37
+ /**
38
+ * Generates a motion atom object for an X or Y translation, from a specified distance to zero.
39
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
40
+ * @param axis - The axis of the translation: 'X' or 'Y'.
41
+ * @param fromValue - The starting position of the slide; it can be a percentage or pixels.
42
+ * @param duration - The duration of the motion in milliseconds.
43
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveDecelerateMid`.
44
+ */ const slideAtom = ({ direction, axis, fromValue, duration, easing = _reactmotion.motionTokens.curveDecelerateMid })=>{
45
+ const keyframes = [
46
+ {
47
+ transform: `translate${axis}(${fromValue})`
48
+ },
49
+ {
50
+ transform: `translate${axis}(0)`
51
+ }
52
+ ];
53
+ if (direction === 'exit') {
54
+ keyframes.reverse();
55
+ }
56
+ return {
57
+ keyframes,
58
+ duration,
59
+ easing
60
+ };
61
+ };
62
+ const MessageBarMotion = (0, _reactmotion.createPresenceComponent)(({ animate })=>{
63
+ const duration = _reactmotion.motionTokens.durationGentle;
64
+ return {
65
+ enter: animate === 'both' ? [
66
+ fadeAtom({
67
+ direction: 'enter',
68
+ duration
69
+ }),
70
+ slideAtom({
71
+ direction: 'enter',
72
+ axis: 'Y',
73
+ fromValue: '-100%',
74
+ duration
75
+ })
76
+ ] : [],
77
+ // Always exit with a fade
78
+ exit: fadeAtom({
79
+ direction: 'exit',
80
+ duration
81
+ })
82
+ };
83
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/MessageBarGroup/MessageBarGroup.motions.tsx"],"sourcesContent":["import { motionTokens, createPresenceComponent, PresenceDirection, AtomMotion } from '@fluentui/react-motion';\nimport { MessageBarGroupProps } from './MessageBarGroup.types';\n\n// TODO: import these atoms from react-motion-components-preview once they're available there\n\ninterface FadeAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromValue?: number;\n}\n\n/**\n * Generates a motion atom object for a fade in or fade out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromValue - The starting opacity value. Defaults to 0.\n * @returns A motion atom object with opacity keyframes and the supplied duration and easing.\n */\nconst fadeAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromValue = 0,\n}: FadeAtomParams): AtomMotion => {\n const keyframes = [{ opacity: fromValue }, { opacity: 1 }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n\n/**\n * Generates a motion atom object for an X or Y translation, from a specified distance to zero.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param axis - The axis of the translation: 'X' or 'Y'.\n * @param fromValue - The starting position of the slide; it can be a percentage or pixels.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveDecelerateMid`.\n */\nconst slideAtom = ({\n direction,\n axis,\n fromValue,\n duration,\n easing = motionTokens.curveDecelerateMid,\n}: {\n direction: PresenceDirection;\n axis: 'X' | 'Y';\n fromValue: string;\n duration: number;\n easing?: string;\n}): AtomMotion => {\n const keyframes = [{ transform: `translate${axis}(${fromValue})` }, { transform: `translate${axis}(0)` }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n\n/**\n * A presence component for a MessageBar to enter and exit from a MessageBarGroup.\n * It has an optional enter transition of a slide-in and fade-in,\n * when the `animate` prop is set to `'both'`.\n * It always has an exit transition of a fade-out.\n */\nexport const MessageBarMotion = createPresenceComponent<{ animate?: MessageBarGroupProps['animate'] }>(\n ({ animate }) => {\n const duration = motionTokens.durationGentle;\n\n return {\n enter:\n animate === 'both'\n ? // enter with slide and fade\n [\n fadeAtom({ direction: 'enter', duration }),\n slideAtom({ direction: 'enter', axis: 'Y', fromValue: '-100%', duration }),\n ]\n : [], // no enter motion\n\n // Always exit with a fade\n exit: fadeAtom({ direction: 'exit', duration }),\n };\n },\n);\n"],"names":["MessageBarMotion","fadeAtom","direction","duration","easing","motionTokens","curveLinear","fromValue","keyframes","opacity","reverse","slideAtom","axis","curveDecelerateMid","transform","createPresenceComponent","animate","durationGentle","enter","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA2EaA;;;eAAAA;;;6BA3EwE;AAYrF;;;;;;;CAOC,GACD,MAAMC,WAAW,CAAC,EAChBC,SAAS,EACTC,QAAQ,EACRC,SAASC,yBAAAA,CAAaC,WAAW,EACjCC,YAAY,CAAC,EACE;IACf,MAAMC,YAAY;QAAC;YAAEC,SAASF;QAAU;QAAG;YAAEE,SAAS;QAAE;KAAE;IAC1D,IAAIP,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;IACF;AACF;AAEA;;;;;;;CAOC,GACD,MAAMO,YAAY,CAAC,EACjBT,SAAS,EACTU,IAAI,EACJL,SAAS,EACTJ,QAAQ,EACRC,SAASC,yBAAAA,CAAaQ,kBAAkB,EAOzC;IACC,MAAML,YAAY;QAAC;YAAEM,WAAW,CAAC,SAAS,EAAEF,KAAK,CAAC,EAAEL,UAAU,CAAC,CAAC;QAAC;QAAG;YAAEO,WAAW,CAAC,SAAS,EAAEF,KAAK,GAAG,CAAC;QAAC;KAAE;IACzG,IAAIV,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;IACF;AACF;AAQO,MAAMJ,mBAAmBe,IAAAA,oCAAAA,EAC9B,CAAC,EAAEC,OAAO,EAAE;IACV,MAAMb,WAAWE,yBAAAA,CAAaY,cAAc;IAE5C,OAAO;QACLC,OACEF,YAAY,SAER;YACEf,SAAS;gBAAEC,WAAW;gBAASC;YAAS;YACxCQ,UAAU;gBAAET,WAAW;gBAASU,MAAM;gBAAKL,WAAW;gBAASJ;YAAS;SACzE,GACD,EAAE;QAER,0BAA0B;QAC1BgB,MAAMlB,SAAS;YAAEC,WAAW;YAAQC;QAAS;IAC/C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBarGroup/MessageBarGroup.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type MessageBarGroupSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MessageBarGroup Props\n */\nexport type MessageBarGroupProps = ComponentProps<MessageBarGroupSlots> & {\n children: React.ReactElement[] | React.ReactElement;\n animate?: 'exit-only' | 'both';\n};\n\n/**\n * State used in rendering MessageBarGroup\n */\nexport type MessageBarGroupState = ComponentState<MessageBarGroupSlots> &\n Pick<MessageBarGroupProps, 'animate'> & {\n enterStyles: string;\n exitStyles: string;\n children: React.ReactElement[];\n };\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEACuB"}
1
+ {"version":3,"sources":["../src/components/MessageBarGroup/MessageBarGroup.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type MessageBarGroupSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MessageBarGroup Props\n */\nexport type MessageBarGroupProps = ComponentProps<MessageBarGroupSlots> & {\n children: React.ReactElement[] | React.ReactElement;\n animate?: 'exit-only' | 'both';\n};\n\n/**\n * State used in rendering MessageBarGroup\n */\nexport type MessageBarGroupState = ComponentState<MessageBarGroupSlots> &\n Pick<MessageBarGroupProps, 'animate'> & {\n /** @deprecated property is unused; these CSS animations were replaced by motion components */\n enterStyles: string;\n /** @deprecated property is unused; these CSS animations were replaced by motion components */\n exitStyles: string;\n children: React.ReactElement[];\n };\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEACuB"}
@@ -10,17 +10,14 @@ Object.defineProperty(exports, "renderMessageBarGroup_unstable", {
10
10
  });
11
11
  const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
12
  const _reactutilities = require("@fluentui/react-utilities");
13
- const _reacttransitiongroup = require("react-transition-group");
14
- const _MessageBarTransition = require("./MessageBarTransition");
13
+ const _reactmotion = require("@fluentui/react-motion");
14
+ const _MessageBarGroupmotions = require("./MessageBarGroup.motions");
15
15
  const renderMessageBarGroup_unstable = (state)=>{
16
16
  (0, _reactutilities.assertSlots)(state);
17
17
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {
18
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttransitiongroup.TransitionGroup, {
19
- component: null,
20
- children: state.children.map((child)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_MessageBarTransition.MessageBarTransition, {
18
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactmotion.PresenceGroup, {
19
+ children: state.children.map((child)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_MessageBarGroupmotions.MessageBarMotion, {
21
20
  animate: state.animate,
22
- enterClassName: state.enterStyles,
23
- exitClassName: state.exitStyles,
24
21
  children: child
25
22
  }, child.key))
26
23
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MessageBarGroup/renderMessageBarGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { MessageBarGroupState, MessageBarGroupSlots } from './MessageBarGroup.types';\nimport { TransitionGroup } from 'react-transition-group';\nimport { MessageBarTransition } from './MessageBarTransition';\n\n/**\n * Render the final JSX of MessageBarGroup\n */\nexport const renderMessageBarGroup_unstable = (state: MessageBarGroupState) => {\n assertSlots<MessageBarGroupSlots>(state);\n\n return (\n <state.root>\n <TransitionGroup component={null}>\n {state.children.map(child => (\n <MessageBarTransition\n animate={state.animate}\n key={child.key}\n enterClassName={state.enterStyles}\n exitClassName={state.exitStyles}\n >\n {child}\n </MessageBarTransition>\n ))}\n </TransitionGroup>\n </state.root>\n );\n};\n"],"names":["renderMessageBarGroup_unstable","state","assertSlots","_jsx","root","TransitionGroup","component","children","map","child","MessageBarTransition","animate","enterClassName","enterStyles","exitClassName","exitStyles","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;gCAE4B;sCAEI;sCACK;AAK9B,MAAMA,iCAAiC,CAACC;IAC7CC,IAAAA,2BAAAA,EAAkCD;IAElC,OAAA,WAAA,GACEE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA;kBACT,WAAA,GAAAD,IAAAA,eAAA,EAACE,qCAAAA,EAAAA;YAAgBC,WAAW;sBACzBL,MAAMM,QAAQ,CAACC,GAAG,CAACC,CAAAA,QAAAA,WAAAA,GAClBN,IAAAA,eAAA,EAACO,0CAAAA,EAAAA;oBACCC,SAASV,MAAMU,OAAO;oBAEtBC,gBAAgBX,MAAMY,WAAW;oBACjCC,eAAeb,MAAMc,UAAU;8BAE9BN;mBAJIA,MAAMO,GAAG;;;AAU1B"}
1
+ {"version":3,"sources":["../src/components/MessageBarGroup/renderMessageBarGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { MessageBarGroupState, MessageBarGroupSlots } from './MessageBarGroup.types';\nimport { PresenceGroup } from '@fluentui/react-motion';\nimport { MessageBarMotion } from './MessageBarGroup.motions';\n\n/**\n * Render the final JSX of MessageBarGroup\n */\nexport const renderMessageBarGroup_unstable = (state: MessageBarGroupState) => {\n assertSlots<MessageBarGroupSlots>(state);\n\n return (\n <state.root>\n <PresenceGroup>\n {state.children.map(child => (\n <MessageBarMotion key={child.key} animate={state.animate}>\n {child}\n </MessageBarMotion>\n ))}\n </PresenceGroup>\n </state.root>\n );\n};\n"],"names":["renderMessageBarGroup_unstable","state","assertSlots","_jsx","root","PresenceGroup","children","map","child","MessageBarMotion","animate","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;gCAE4B;6BAEE;wCACG;AAK1B,MAAMA,iCAAiC,CAACC;IAC7CC,IAAAA,2BAAAA,EAAkCD;IAElC,OAAA,WAAA,GACEE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA;kBACT,WAAA,GAAAD,IAAAA,eAAA,EAACE,0BAAAA,EAAAA;sBACEJ,MAAMK,QAAQ,CAACC,GAAG,CAACC,CAAAA,QAAAA,WAAAA,GAClBL,IAAAA,eAAA,EAACM,wCAAAA,EAAAA;oBAAiCC,SAAST,MAAMS,OAAO;8BACrDF;mBADoBA,MAAMG,GAAG;;;AAO1C"}
@@ -20,36 +20,8 @@ const _react = require("@griffel/react");
20
20
  const messageBarGroupClassNames = {
21
21
  root: 'fui-MessageBarGroup'
22
22
  };
23
- /**
24
- * Styles for the root slot
25
- */ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
26
- base: {
27
- Bf5fcs: "f4cll0y",
28
- vin17d: "fy8si0b"
29
- },
30
- enter: {
31
- Bv12yb3: "f1dg9w1v"
32
- },
33
- exit: {
34
- Bv12yb3: "fu80iee"
35
- }
36
- }, {
37
- d: [
38
- ".f4cll0y{animation-fill-mode:forwards;}",
39
- ".fy8si0b{animation-duration:var(--durationNormal);}",
40
- ".f1dg9w1v{animation-name:fngeioi;}",
41
- ".fu80iee{animation-name:fk0lfw7;}"
42
- ],
43
- k: [
44
- "@keyframes fngeioi{from{opacity:0;transform:translateY(-100%);}to{opacity:1;transform:translateY(0);}}",
45
- "@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}"
46
- ]
47
- });
48
23
  const useMessageBarGroupStyles_unstable = (state)=>{
49
24
  'use no memo';
50
- const styles = useStyles();
51
25
  state.root.className = (0, _react.mergeClasses)(messageBarGroupClassNames.root, state.root.className);
52
- state.enterStyles = (0, _react.mergeClasses)(styles.base, styles.enter);
53
- state.exitStyles = (0, _react.mergeClasses)(styles.base, styles.exit);
54
26
  return state;
55
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useMessageBarGroupStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const messageBarGroupClassNames = {\n root: 'fui-MessageBarGroup'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n base: {\n animationFillMode: 'forwards',\n animationDuration: tokens.durationNormal\n },\n enter: {\n animationName: {\n from: {\n opacity: 0,\n transform: 'translateY(-100%)'\n },\n to: {\n opacity: 1,\n transform: 'translateY(0)'\n }\n }\n },\n exit: {\n animationName: {\n from: {\n opacity: 1\n },\n to: {\n opacity: 0\n }\n }\n }\n});\n/**\n * Apply styling to the MessageBarGroup slots based on the state\n */ export const useMessageBarGroupStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n state.root.className = mergeClasses(messageBarGroupClassNames.root, state.root.className);\n state.enterStyles = mergeClasses(styles.base, styles.enter);\n state.exitStyles = mergeClasses(styles.base, styles.exit);\n return state;\n};\n"],"names":["messageBarGroupClassNames","useMessageBarGroupStyles_unstable","root","useStyles","__styles","base","Bf5fcs","vin17d","enter","Bv12yb3","exit","d","k","state","styles","className","mergeClasses","enterStyles","exitStyles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,yBAAyB;eAAzBA;;IAmCIC,iCAAiC;eAAjCA;;;uBArCwB;AAElC,MAAMD,4BAA4B;IACrCE,MAAM;AACV;AACA;;CAEA,GAAI,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,MAAA;QAAAC,QAAA;QAAAC,QAAA;IAAA;IAAAC,OAAA;QAAAC,SAAA;IAAA;IAAAC,MAAA;QAAAD,SAAA;IAAA;AAAA,GAAA;IAAAE,GAAA;QAAA;QAAA;QAAA;QAAA;KAAA;IAAAC,GAAA;QAAA;QAAA;KAAA;AAAA;AA8BX,MAAMX,oCAAqCY,CAAAA;IAClD;IACA,MAAMC,SAASX;IACfU,MAAMX,IAAI,CAACa,SAAS,GAAGC,IAAAA,mBAAY,EAAChB,0BAA0BE,IAAI,EAAEW,MAAMX,IAAI,CAACa,SAAS;IACxFF,MAAMI,WAAW,GAAGD,IAAAA,mBAAY,EAACF,OAAOT,IAAI,EAAES,OAAON,KAAK;IAC1DK,MAAMK,UAAU,GAAGF,IAAAA,mBAAY,EAACF,OAAOT,IAAI,EAAES,OAAOJ,IAAI;IACxD,OAAOG;AACX"}
1
+ {"version":3,"sources":["useMessageBarGroupStyles.styles.js"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nexport const messageBarGroupClassNames = {\n root: 'fui-MessageBarGroup'\n};\n/**\n * Apply styling to the MessageBarGroup slots based on the state\n */ export const useMessageBarGroupStyles_unstable = (state)=>{\n 'use no memo';\n state.root.className = mergeClasses(messageBarGroupClassNames.root, state.root.className);\n return state;\n};\n"],"names":["messageBarGroupClassNames","useMessageBarGroupStyles_unstable","root","state","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,yBAAyB;eAAzBA;;IAKIC,iCAAiC;eAAjCA;;;uBANY;AACtB,MAAMD,4BAA4B;IACrCE,MAAM;AACV;AAGW,MAAMD,oCAAqCE,CAAAA;IAClD;IACAA,MAAMD,IAAI,CAACE,SAAS,GAAGC,IAAAA,mBAAY,EAACL,0BAA0BE,IAAI,EAAEC,MAAMD,IAAI,CAACE,SAAS;IACxF,OAAOD;AACX"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/contexts/messageBarTransitionContext.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type MessageBarTransitionContextValue = {\n className: string;\n nodeRef: React.Ref<HTMLDivElement | null>;\n};\n\nconst messageBarTransitionContext = React.createContext<MessageBarTransitionContextValue | undefined>(undefined);\n\n/**\n * @internal\n */\nexport const messageBarTransitionContextDefaultValue: MessageBarTransitionContextValue = {\n className: '',\n nodeRef: React.createRef<HTMLDivElement | null>(),\n};\n\n/**\n * Context to pass animation className to MessageBar components\n * @internal\n */\nexport const MessageBarTransitionContextProvider = messageBarTransitionContext.Provider;\n/**\n * @internal\n */\nexport const useMessageBarTransitionContext = () =>\n React.useContext(messageBarTransitionContext) ?? messageBarTransitionContextDefaultValue;\n"],"names":["MessageBarTransitionContextProvider","messageBarTransitionContextDefaultValue","useMessageBarTransitionContext","messageBarTransitionContext","React","createContext","undefined","className","nodeRef","createRef","Provider","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAqBaA,mCAAAA;eAAAA;;IATAC,uCAAAA;eAAAA;;IAaAC,8BAAAA;eAAAA;;;;iEAzBU;AAOvB,MAAMC,4CAA8BC,OAAMC,aAAa,CAA+CC;AAK/F,MAAML,0CAA4E;IACvFM,WAAW;IACXC,uBAASJ,OAAMK,SAAS;AAC1B;AAMO,MAAMT,sCAAsCG,4BAA4BO,QAAQ;AAIhF,MAAMR,iCAAiC;QAC5CE;WAAAA,CAAAA,oBAAAA,OAAMO,UAAU,CAACR,4BAAAA,MAAAA,QAAjBC,sBAAAA,KAAAA,IAAAA,oBAAiDH;AAAsC"}
1
+ {"version":3,"sources":["../src/contexts/messageBarTransitionContext.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type MessageBarTransitionContextValue = {\n /**\n * @deprecated CSS className is no longer used for this transition, replaced by motion components\n */\n className: string;\n nodeRef: React.Ref<HTMLDivElement | null>;\n};\n\nconst messageBarTransitionContext = React.createContext<MessageBarTransitionContextValue | undefined>(undefined);\n\n/**\n * @internal\n */\nexport const messageBarTransitionContextDefaultValue: MessageBarTransitionContextValue = {\n className: '',\n nodeRef: React.createRef<HTMLDivElement | null>(),\n};\n\n/**\n * Context to pass nodeRef for animation to MessageBar components\n * @internal\n */\nexport const MessageBarTransitionContextProvider = messageBarTransitionContext.Provider;\n/**\n * @internal\n */\nexport const useMessageBarTransitionContext = () =>\n React.useContext(messageBarTransitionContext) ?? messageBarTransitionContextDefaultValue;\n"],"names":["MessageBarTransitionContextProvider","messageBarTransitionContextDefaultValue","useMessageBarTransitionContext","messageBarTransitionContext","React","createContext","undefined","className","nodeRef","createRef","Provider","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAwBaA,mCAAAA;eAAAA;;IATAC,uCAAAA;eAAAA;;IAaAC,8BAAAA;eAAAA;;;;iEA5BU;AAUvB,MAAMC,4CAA8BC,OAAMC,aAAa,CAA+CC;AAK/F,MAAML,0CAA4E;IACvFM,WAAW;IACXC,uBAASJ,OAAMK,SAAS;AAC1B;AAMO,MAAMT,sCAAsCG,4BAA4BO,QAAQ;AAIhF,MAAMR,iCAAiC;QAC5CE;WAAAA,CAAAA,oBAAAA,OAAMO,UAAU,CAACR,4BAAAA,MAAAA,QAAjBC,sBAAAA,KAAAA,IAAAA,oBAAiDH;AAAsC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-message-bar",
3
- "version": "9.2.18",
3
+ "version": "9.3.0",
4
4
  "description": "Fluent UI MessageBar component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -18,16 +18,17 @@
18
18
  "@fluentui/scripts-api-extractor": "*"
19
19
  },
20
20
  "dependencies": {
21
- "@fluentui/react-button": "^9.3.98",
21
+ "@fluentui/react-button": "^9.3.99",
22
22
  "@fluentui/react-icons": "^2.0.245",
23
- "@fluentui/react-jsx-runtime": "^9.0.48",
23
+ "@fluentui/react-jsx-runtime": "^9.0.49",
24
+ "@fluentui/react-motion": "^9.6.6",
25
+ "@fluentui/react-motion-components-preview": "^0.4.2",
24
26
  "@fluentui/react-shared-contexts": "^9.21.2",
25
- "@fluentui/react-link": "^9.3.5",
27
+ "@fluentui/react-link": "^9.3.6",
26
28
  "@fluentui/react-theme": "^9.1.24",
27
29
  "@fluentui/react-utilities": "^9.18.19",
28
30
  "@griffel/react": "^1.5.22",
29
- "@swc/helpers": "^0.5.1",
30
- "react-transition-group": "^4.4.1"
31
+ "@swc/helpers": "^0.5.1"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "@types/react": ">=16.8.0 <19.0.0",
@@ -1,45 +0,0 @@
1
- import * as React from 'react';
2
- import { Transition } from 'react-transition-group';
3
- import { MessageBarTransitionContextProvider } from '../../contexts/messageBarTransitionContext';
4
- const getClassName = (status, enterClassName, exitClassName, animate)=>{
5
- switch(status){
6
- case 'entering':
7
- case 'entered':
8
- return animate === 'both' ? enterClassName : '';
9
- case 'exiting':
10
- case 'exited':
11
- return exitClassName;
12
- default:
13
- return '';
14
- }
15
- };
16
- /**
17
- * Internal component that controls the animation transition for MessageBar components
18
- * @internal
19
- */ export const MessageBarTransition = ({ children, enterClassName, exitClassName, animate, ...rest })=>{
20
- const nodeRef = React.useRef(null);
21
- return /*#__PURE__*/ React.createElement(Transition, {
22
- timeout: 250,
23
- nodeRef: nodeRef,
24
- ...rest
25
- }, (state)=>/*#__PURE__*/ React.createElement(MessageBarTransitionInner, {
26
- animate: animate,
27
- enterClassName: enterClassName,
28
- exitClassName: exitClassName,
29
- nodeRef: nodeRef,
30
- state: state
31
- }, children));
32
- };
33
- const MessageBarTransitionInner = ({ children, state, enterClassName, exitClassName, animate, nodeRef })=>{
34
- const className = getClassName(state, enterClassName, exitClassName, animate);
35
- const context = React.useMemo(()=>({
36
- className,
37
- nodeRef
38
- }), [
39
- className,
40
- nodeRef
41
- ]);
42
- return /*#__PURE__*/ React.createElement(MessageBarTransitionContextProvider, {
43
- value: context
44
- }, children);
45
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/MessageBarGroup/MessageBarTransition.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Transition, TransitionStatus } from 'react-transition-group';\nimport { MessageBarTransitionContextProvider } from '../../contexts/messageBarTransitionContext';\nimport { MessageBarGroupProps } from './MessageBarGroup.types';\n\nconst getClassName = (\n status: TransitionStatus,\n enterClassName: string,\n exitClassName: string,\n animate: MessageBarGroupProps['animate'],\n) => {\n switch (status) {\n case 'entering':\n case 'entered':\n return animate === 'both' ? enterClassName : '';\n case 'exiting':\n case 'exited':\n return exitClassName;\n default:\n return '';\n }\n};\n\n/**\n * Internal component that controls the animation transition for MessageBar components\n * @internal\n */\nexport const MessageBarTransition: React.FC<{\n children: React.ReactElement;\n enterClassName: string;\n exitClassName: string;\n animate: MessageBarGroupProps['animate'];\n}> = ({ children, enterClassName, exitClassName, animate, ...rest }) => {\n const nodeRef = React.useRef<HTMLDivElement>(null);\n\n return (\n <Transition timeout={250} nodeRef={nodeRef} {...rest}>\n {state => (\n <MessageBarTransitionInner\n animate={animate}\n enterClassName={enterClassName}\n exitClassName={exitClassName}\n nodeRef={nodeRef}\n state={state}\n >\n {children}\n </MessageBarTransitionInner>\n )}\n </Transition>\n );\n};\n\nconst MessageBarTransitionInner: React.FC<{\n children: React.ReactElement;\n enterClassName: string;\n exitClassName: string;\n animate: MessageBarGroupProps['animate'];\n nodeRef: React.Ref<HTMLDivElement | null>;\n state: TransitionStatus;\n}> = ({ children, state, enterClassName, exitClassName, animate, nodeRef }) => {\n const className = getClassName(state, enterClassName, exitClassName, animate);\n const context = React.useMemo(\n () => ({\n className,\n nodeRef,\n }),\n [className, nodeRef],\n );\n\n return <MessageBarTransitionContextProvider value={context}>{children}</MessageBarTransitionContextProvider>;\n};\n"],"names":["React","Transition","MessageBarTransitionContextProvider","getClassName","status","enterClassName","exitClassName","animate","MessageBarTransition","children","rest","nodeRef","useRef","timeout","state","MessageBarTransitionInner","className","context","useMemo","value"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,UAAU,QAA0B,yBAAyB;AACtE,SAASC,mCAAmC,QAAQ,6CAA6C;AAGjG,MAAMC,eAAe,CACnBC,QACAC,gBACAC,eACAC;IAEA,OAAQH;QACN,KAAK;QACL,KAAK;YACH,OAAOG,YAAY,SAASF,iBAAiB;QAC/C,KAAK;QACL,KAAK;YACH,OAAOC;QACT;YACE,OAAO;IACX;AACF;AAEA;;;CAGC,GACD,OAAO,MAAME,uBAKR,CAAC,EAAEC,QAAQ,EAAEJ,cAAc,EAAEC,aAAa,EAAEC,OAAO,EAAE,GAAGG,MAAM;IACjE,MAAMC,UAAUX,MAAMY,MAAM,CAAiB;IAE7C,qBACE,oBAACX;QAAWY,SAAS;QAAKF,SAASA;QAAU,GAAGD,IAAI;OACjDI,CAAAA,sBACC,oBAACC;YACCR,SAASA;YACTF,gBAAgBA;YAChBC,eAAeA;YACfK,SAASA;YACTG,OAAOA;WAENL;AAKX,EAAE;AAEF,MAAMM,4BAOD,CAAC,EAAEN,QAAQ,EAAEK,KAAK,EAAET,cAAc,EAAEC,aAAa,EAAEC,OAAO,EAAEI,OAAO,EAAE;IACxE,MAAMK,YAAYb,aAAaW,OAAOT,gBAAgBC,eAAeC;IACrE,MAAMU,UAAUjB,MAAMkB,OAAO,CAC3B,IAAO,CAAA;YACLF;YACAL;QACF,CAAA,GACA;QAACK;QAAWL;KAAQ;IAGtB,qBAAO,oBAACT;QAAoCiB,OAAOF;OAAUR;AAC/D"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "MessageBarTransition", {
6
- enumerable: true,
7
- get: function() {
8
- return MessageBarTransition;
9
- }
10
- });
11
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
- const _reacttransitiongroup = require("react-transition-group");
14
- const _messageBarTransitionContext = require("../../contexts/messageBarTransitionContext");
15
- const getClassName = (status, enterClassName, exitClassName, animate)=>{
16
- switch(status){
17
- case 'entering':
18
- case 'entered':
19
- return animate === 'both' ? enterClassName : '';
20
- case 'exiting':
21
- case 'exited':
22
- return exitClassName;
23
- default:
24
- return '';
25
- }
26
- };
27
- const MessageBarTransition = ({ children, enterClassName, exitClassName, animate, ...rest })=>{
28
- const nodeRef = _react.useRef(null);
29
- return /*#__PURE__*/ _react.createElement(_reacttransitiongroup.Transition, {
30
- timeout: 250,
31
- nodeRef: nodeRef,
32
- ...rest
33
- }, (state)=>/*#__PURE__*/ _react.createElement(MessageBarTransitionInner, {
34
- animate: animate,
35
- enterClassName: enterClassName,
36
- exitClassName: exitClassName,
37
- nodeRef: nodeRef,
38
- state: state
39
- }, children));
40
- };
41
- const MessageBarTransitionInner = ({ children, state, enterClassName, exitClassName, animate, nodeRef })=>{
42
- const className = getClassName(state, enterClassName, exitClassName, animate);
43
- const context = _react.useMemo(()=>({
44
- className,
45
- nodeRef
46
- }), [
47
- className,
48
- nodeRef
49
- ]);
50
- return /*#__PURE__*/ _react.createElement(_messageBarTransitionContext.MessageBarTransitionContextProvider, {
51
- value: context
52
- }, children);
53
- };