Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AriaLive", {
enumerable: true,
get: function() {
return AriaLive;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useAriaLive = require("./useAriaLive");
const _renderAriaLive = require("./renderAriaLive");
const _useAriaLiveStylesstyles = require("./useAriaLiveStyles.styles");
const AriaLive = (props)=>{
const state = (0, _useAriaLive.useAriaLive_unstable)(props);
(0, _useAriaLiveStylesstyles.useAriaLiveStyles_unstable)(state);
return (0, _renderAriaLive.renderAriaLive_unstable)(state);
};
AriaLive.displayName = 'AriaLive';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/AriaLive.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useAriaLive_unstable } from './useAriaLive';\nimport { renderAriaLive_unstable } from './renderAriaLive';\nimport { useAriaLiveStyles_unstable } from './useAriaLiveStyles.styles';\nimport type { AriaLiveProps } from './AriaLive.types';\n\n/**\n * A component that manages aria live announcements imperatively\n */\nexport const AriaLive: React.FC<AriaLiveProps> = props => {\n const state = useAriaLive_unstable(props);\n\n useAriaLiveStyles_unstable(state);\n return renderAriaLive_unstable(state);\n};\n\nAriaLive.displayName = 'AriaLive';\n"],"names":["AriaLive","props","state","useAriaLive_unstable","useAriaLiveStyles_unstable","renderAriaLive_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;6BACc;gCACG;yCACG;AAMpC,MAAMA,WAAoCC,CAAAA;IAC/C,MAAMC,QAAQC,IAAAA,iCAAAA,EAAqBF;IAEnCG,IAAAA,mDAAAA,EAA2BF;IAC3B,OAAOG,IAAAA,uCAAAA,EAAwBH;AACjC;AAEAF,SAASM,WAAW,GAAG"}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/AriaLive.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AriaLiveSlots = {\n assertive: NonNullable<Slot<'div'>>;\n polite: NonNullable<Slot<'div'>>;\n};\n\nexport type AriaLivePoliteness = 'polite' | 'assertive';\n\n/**\n * AriaLive Props\n */\nexport type AriaLiveProps = ComponentProps<Partial<AriaLiveSlots>> & {\n announceRef: React.Ref<Announce>;\n};\n\n/**\n * State used in rendering AriaLive\n */\nexport type AriaLiveState = ComponentState<AriaLiveSlots>;\n\nexport type Announce = (message: string, options: AnnounceOptions) => void;\n\nexport type LiveMessage = {\n message: string;\n createdAt: number;\n politeness: AriaLivePoliteness;\n};\n\nexport type AnnounceOptions = {\n politeness: AriaLivePoliteness;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AriaLive: function() {
return _AriaLive.AriaLive;
},
ariaLiveClassNames: function() {
return _useAriaLiveStylesstyles.ariaLiveClassNames;
},
renderAriaLive_unstable: function() {
return _renderAriaLive.renderAriaLive_unstable;
},
useAriaLiveStyles_unstable: function() {
return _useAriaLiveStylesstyles.useAriaLiveStyles_unstable;
},
useAriaLive_unstable: function() {
return _useAriaLive.useAriaLive_unstable;
}
});
const _AriaLive = require("./AriaLive");
const _renderAriaLive = require("./renderAriaLive");
const _useAriaLive = require("./useAriaLive");
const _useAriaLiveStylesstyles = require("./useAriaLiveStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/index.ts"],"sourcesContent":["export { AriaLive } from './AriaLive';\nexport type {\n Announce,\n AnnounceOptions,\n AriaLivePoliteness,\n AriaLiveProps,\n AriaLiveSlots,\n AriaLiveState,\n LiveMessage,\n} from './AriaLive.types';\nexport { renderAriaLive_unstable } from './renderAriaLive';\nexport { useAriaLive_unstable } from './useAriaLive';\nexport { ariaLiveClassNames, useAriaLiveStyles_unstable } from './useAriaLiveStyles.styles';\n"],"names":["AriaLive","ariaLiveClassNames","renderAriaLive_unstable","useAriaLiveStyles_unstable","useAriaLive_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,QAAQ;eAARA,kBAAQ;;IAYRC,kBAAkB;eAAlBA,2CAAkB;;IAFlBC,uBAAuB;eAAvBA,uCAAuB;;IAEHC,0BAA0B;eAA1BA,mDAA0B;;IAD9CC,oBAAoB;eAApBA,iCAAoB;;;0BAXJ;gCAUe;6BACH;yCAC0B"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderAriaLive_unstable", {
enumerable: true,
get: function() {
return renderAriaLive_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderAriaLive_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.assertive, {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.polite, {})
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/renderAriaLive.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { AriaLiveState, AriaLiveSlots } from './AriaLive.types';\n\n/**\n * Render the final JSX of AriaLive\n */\nexport const renderAriaLive_unstable = (state: AriaLiveState) => {\n assertSlots<AriaLiveSlots>(state);\n\n return (\n <>\n <state.assertive />\n <state.polite />\n </>\n );\n};\n"],"names":["renderAriaLive_unstable","state","assertSlots","_jsxs","_Fragment","_jsx","assertive","polite"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,0BAA0B,CAACC;IACtCC,IAAAA,2BAAAA,EAA2BD;IAE3B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;0BACEC,IAAAA,eAAA,EAACJ,MAAMK,SAAS,EAAA,CAAA;0BAChBD,IAAAA,eAAA,EAACJ,MAAMM,MAAM,EAAA,CAAA;;;AAGnB"}
@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useAriaLive_unstable", {
enumerable: true,
get: function() {
return useAriaLive_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */ const MESSAGE_DURATION = 500;
const useAriaLive_unstable = (props)=>{
const [currentMessage, setCurrentMessage] = _react.useState(undefined);
// Can't rely on Date.now() if user invokes announce more than once in a code block
const order = _react.useRef(0);
const [messageQueue] = _react.useState(()=>(0, _reactutilities.createPriorityQueue)((a, b)=>{
if (a.politeness === b.politeness) {
return a.createdAt - b.createdAt;
}
return a.politeness === 'assertive' ? -1 : 1;
}));
const announce = (0, _reactutilities.useEventCallback)((message, options)=>{
const { politeness } = options;
if (message === (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.message)) {
return;
}
const liveMessage = {
message,
politeness,
createdAt: order.current++
};
if (!currentMessage) {
setCurrentMessage(liveMessage);
} else {
messageQueue.enqueue(liveMessage);
}
});
const [setMessageTimeout, clearMessageTimeout] = (0, _reactutilities.useTimeout)();
_react.useEffect(()=>{
setMessageTimeout(()=>{
if (messageQueue.peek()) {
setCurrentMessage(messageQueue.dequeue());
} else {
setCurrentMessage(undefined);
}
}, MESSAGE_DURATION);
return ()=>clearMessageTimeout();
}, [
currentMessage,
messageQueue,
setMessageTimeout,
clearMessageTimeout
]);
_react.useImperativeHandle(props.announceRef, ()=>announce);
const politeMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'polite' ? currentMessage.message : undefined;
const assertiveMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'assertive' ? currentMessage.message : undefined;
return {
components: {
assertive: 'div',
polite: 'div'
},
assertive: _reactutilities.slot.always(props.assertive, {
defaultProps: {
'aria-live': 'assertive',
children: assertiveMessage
},
elementType: 'div'
}),
polite: _reactutilities.slot.always(props.polite, {
defaultProps: {
'aria-live': 'polite',
children: politeMessage
},
elementType: 'div'
})
};
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ariaLiveClassNames: function() {
return ariaLiveClassNames;
},
useAriaLiveStyles_unstable: function() {
return useAriaLiveStyles_unstable;
}
});
const _react = require("@griffel/react");
const ariaLiveClassNames = {
assertive: 'fui-AriaLive__assertive',
polite: 'fui-AriaLive__polite'
};
/**
* Styles for the root slot
*/ const useResetStyles = /*#__PURE__*/ (0, _react.__resetStyles)("rrd10u0", null, [
".rrd10u0{clip:rect(0px, 0px, 0px, 0px);height:1px;margin:-1px;overflow:hidden;padding:0px;width:1px;position:absolute;}"
]);
const useAriaLiveStyles_unstable = (state)=>{
'use no memo';
const visuallyHidden = useResetStyles();
state.assertive.className = (0, _react.mergeClasses)(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
state.polite.className = (0, _react.mergeClasses)(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useAriaLiveStyles.styles.js"],"sourcesContent":["import { mergeClasses, makeResetStyles } from '@griffel/react';\nexport const ariaLiveClassNames = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute'\n});\n/**\n * Apply styling to the AriaLive slots based on the state\n */ export const useAriaLiveStyles_unstable = (state)=>{\n 'use no memo';\n const visuallyHidden = useResetStyles();\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n return state;\n};\n"],"names":["ariaLiveClassNames","useAriaLiveStyles_unstable","assertive","polite","useResetStyles","__resetStyles","state","visuallyHidden","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,kBAAkB;eAAlBA;;IAiBIC,0BAA0B;eAA1BA;;;uBAlB6B;AACvC,MAAMD,qBAAqB;IAC9BE,WAAW;IACXC,QAAQ;AACZ;AACA;;CAEA,GAAI,MAAMC,iBAAc,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAQ1B;AAGU,MAAMJ,6BAA8BK,CAAAA;IAC3C;IACA,MAAMC,iBAAiBH;IACvBE,MAAMJ,SAAS,CAACM,SAAS,GAAGC,IAAAA,mBAAY,EAACF,gBAAgBP,mBAAmBE,SAAS,EAAEI,MAAMJ,SAAS,CAACM,SAAS;IAChHF,MAAMH,MAAM,CAACK,SAAS,GAAGC,IAAAA,mBAAY,EAACF,gBAAgBP,mBAAmBG,MAAM,EAAEG,MAAMH,MAAM,CAACK,SAAS;IACvG,OAAOF;AACX"}
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Timer", {
enumerable: true,
get: function() {
return Timer;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useTimerStylesstyles = require("./useTimerStyles.styles");
const Timer = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const baseAnimationStyles = (0, _useTimerStylesstyles.useBaseAnimationStyles)();
const { running, timeout, onTimeout } = props;
const style = {
animationDuration: `${timeout}ms`,
animationPlayState: running ? 'running' : 'paused'
};
if (timeout < 0) {
return null;
}
return /*#__PURE__*/ _react.createElement("span", {
onAnimationEnd: onTimeout,
"data-timer-status": style.animationPlayState,
ref: ref,
style: style,
className: baseAnimationStyles
});
});
Timer.displayName = 'Timer';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Timer/Timer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useBaseAnimationStyles } from './useTimerStyles.styles';\n\nexport type TimerProps = {\n running: boolean;\n timeout: number;\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onTimeout: () => void;\n as?: 'span';\n};\n\nexport const Timer = React.forwardRef<HTMLDivElement, TimerProps>((props, ref) => {\n const baseAnimationStyles = useBaseAnimationStyles();\n const { running, timeout, onTimeout } = props;\n\n const style: React.CSSProperties = {\n animationDuration: `${timeout}ms`,\n animationPlayState: running ? 'running' : 'paused',\n };\n\n if (timeout < 0) {\n return null;\n }\n\n return (\n <span\n onAnimationEnd={onTimeout}\n data-timer-status={style.animationPlayState}\n ref={ref}\n style={style}\n className={baseAnimationStyles}\n />\n );\n});\n\nTimer.displayName = 'Timer';\n"],"names":["Timer","React","forwardRef","props","ref","baseAnimationStyles","useBaseAnimationStyles","running","timeout","onTimeout","style","animationDuration","animationPlayState","createElement","span","onAnimationEnd","data-timer-status","className","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;sCACgB;AAUhC,MAAMA,QAAAA,WAAAA,GAAQC,OAAMC,UAAU,CAA6B,CAACC,OAAOC;IACxE,MAAMC,sBAAsBC,IAAAA,4CAAAA;IAC5B,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGN;IAExC,MAAMO,QAA6B;QACjCC,mBAAmB,CAAC,EAAEH,QAAQ,EAAE,CAAC;QACjCI,oBAAoBL,UAAU,YAAY;IAC5C;IAEA,IAAIC,UAAU,GAAG;QACf,OAAO;IACT;IAEA,OAAA,WAAA,GACEP,OAAAY,aAAA,CAACC,QAAAA;QACCC,gBAAgBN;QAChBO,qBAAmBN,MAAME,kBAAkB;QAC3CR,KAAKA;QACLM,OAAOA;QACPO,WAAWZ;;AAGjB;AAEAL,MAAMkB,WAAW,GAAG"}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Timer", {
enumerable: true,
get: function() {
return _Timer.Timer;
}
});
const _Timer = require("./Timer");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Timer/index.ts"],"sourcesContent":["export type { TimerProps } from './Timer';\nexport { Timer } from './Timer';\n"],"names":["Timer"],"rangeMappings":";;;;;;;;;;","mappings":";;;;+BACSA;;;eAAAA,YAAK;;;uBAAQ"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useBaseAnimationStyles", {
enumerable: true,
get: function() {
return useBaseAnimationStyles;
}
});
const _react = require("@griffel/react");
const useBaseAnimationStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r16zaflb", "r75casi", [
".r16zaflb{animation-name:rsacmq1;}",
"@keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}",
".r75casi{animation-name:rsacmq1;}"
]);
@@ -0,0 +1 @@
{"version":3,"sources":["useTimerStyles.styles.js"],"sourcesContent":["import { makeResetStyles } from '@griffel/react';\nexport const useBaseAnimationStyles = makeResetStyles({\n animationName: {\n from: {\n opacity: 0\n },\n to: {\n opacity: 0\n }\n }\n});\n"],"names":["useBaseAnimationStyles","__resetStyles"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BACaA;;;eAAAA;;;uBADmB;AACzB,MAAMA,yBAAsB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,YAAA,WAAA;IAAA;IAAA;IAAA;CASrC"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Toast", {
enumerable: true,
get: function() {
return Toast;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToast = require("./useToast");
const _renderToast = require("./renderToast");
const _useToastStylesstyles = require("./useToastStyles.styles");
const _useToastContextValues = require("./useToastContextValues");
const Toast = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToast.useToast_unstable)(props, ref);
(0, _useToastStylesstyles.useToastStyles_unstable)(state);
return (0, _renderToast.renderToast_unstable)(state, (0, _useToastContextValues.useToastContextValues_unstable)(state));
});
Toast.displayName = 'Toast';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToast_unstable } from './useToast';\nimport { renderToast_unstable } from './renderToast';\nimport { useToastStyles_unstable } from './useToastStyles.styles';\nimport type { ToastProps } from './Toast.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToastContextValues_unstable } from './useToastContextValues';\n\n/**\n * Toast component\n */\nexport const Toast: ForwardRefComponent<ToastProps> = React.forwardRef((props, ref) => {\n const state = useToast_unstable(props, ref);\n\n useToastStyles_unstable(state);\n return renderToast_unstable(state, useToastContextValues_unstable(state));\n});\n\nToast.displayName = 'Toast';\n"],"names":["Toast","React","forwardRef","props","ref","state","useToast_unstable","useToastStyles_unstable","renderToast_unstable","useToastContextValues_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;0BACW;6BACG;sCACG;uCAGO;AAKxC,MAAMA,QAAAA,WAAAA,GAAyCC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC7E,MAAMC,QAAQC,IAAAA,2BAAAA,EAAkBH,OAAOC;IAEvCG,IAAAA,6CAAAA,EAAwBF;IACxB,OAAOG,IAAAA,iCAAAA,EAAqBH,OAAOI,IAAAA,qDAAAA,EAA+BJ;AACpE;AAEAL,MAAMU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering Toast
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\nimport type { ToastIntent } from '../../state/types';\n\nexport type ToastSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToastContextValues = {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n\n/**\n * Toast Props\n */\nexport type ToastProps = ComponentProps<ToastSlots> & {\n appearance?: BackgroundAppearanceContextValue;\n};\n\n/**\n * State used in rendering Toast\n */\nexport type ToastState = ComponentState<ToastSlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n intent?: ToastIntent | undefined;\n};\n"],"names":[],"rangeMappings":";;","mappings":"AAmBA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Toast: function() {
return _Toast.Toast;
},
renderToast_unstable: function() {
return _renderToast.renderToast_unstable;
},
toastClassNames: function() {
return _useToastStylesstyles.toastClassNames;
},
useToastStyles_unstable: function() {
return _useToastStylesstyles.useToastStyles_unstable;
},
useToast_unstable: function() {
return _useToast.useToast_unstable;
}
});
const _Toast = require("./Toast");
const _renderToast = require("./renderToast");
const _useToast = require("./useToast");
const _useToastStylesstyles = require("./useToastStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/index.ts"],"sourcesContent":["export { Toast } from './Toast';\nexport type { ToastContextValues, ToastProps, ToastSlots, ToastState } from './Toast.types';\nexport { renderToast_unstable } from './renderToast';\nexport { useToast_unstable } from './useToast';\nexport { toastClassNames, useToastStyles_unstable } from './useToastStyles.styles';\n"],"names":["Toast","renderToast_unstable","toastClassNames","useToastStyles_unstable","useToast_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,KAAK;eAALA,YAAK;;IAELC,oBAAoB;eAApBA,iCAAoB;;IAEpBC,eAAe;eAAfA,qCAAe;;IAAEC,uBAAuB;eAAvBA,6CAAuB;;IADxCC,iBAAiB;eAAjBA,2BAAiB;;;uBAHJ;6BAEe;0BACH;sCACuB"}
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToast_unstable", {
enumerable: true,
get: function() {
return renderToast_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const renderToast_unstable = (state, contextValues)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactsharedcontexts.BackgroundAppearanceProvider, {
value: contextValues.backgroundAppearance,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/renderToast.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceProvider } from '@fluentui/react-shared-contexts';\nimport type { ToastState, ToastSlots, ToastContextValues } from './Toast.types';\n\n/**\n * Render the final JSX of Toast\n */\nexport const renderToast_unstable = (state: ToastState, contextValues: ToastContextValues) => {\n assertSlots<ToastSlots>(state);\n\n return (\n <BackgroundAppearanceProvider value={contextValues.backgroundAppearance}>\n <state.root />\n </BackgroundAppearanceProvider>\n );\n};\n"],"names":["renderToast_unstable","state","contextValues","assertSlots","_jsx","BackgroundAppearanceProvider","value","backgroundAppearance","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAC4B;qCACiB;AAMtC,MAAMA,uBAAuB,CAACC,OAAmBC;IACtDC,IAAAA,2BAAAA,EAAwBF;IAExB,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,iDAAAA,EAAAA;QAA6BC,OAAOJ,cAAcK,oBAAoB;kBACrE,WAAA,GAAAH,IAAAA,eAAA,EAACH,MAAMO,IAAI,EAAA,CAAA;;AAGjB"}
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToast_unstable", {
enumerable: true,
get: function() {
return useToast_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _toastContainerContext = require("../../contexts/toastContainerContext");
const useToast_unstable = (props, ref)=>{
const { intent } = (0, _toastContainerContext.useToastContainerContext)();
return {
components: {
root: 'div'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
...props
}), {
elementType: 'div'
}),
backgroundAppearance: props.appearance,
intent
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastProps, ToastState } from './Toast.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */\nexport const useToast_unstable = (props: ToastProps, ref: React.Ref<HTMLElement>): ToastState => {\n const { intent } = useToastContainerContext();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n ...props,\n }),\n { elementType: 'div' },\n ),\n backgroundAppearance: props.appearance,\n intent,\n };\n};\n"],"names":["useToast_unstable","props","ref","intent","useToastContainerContext","components","root","slot","always","getIntrinsicElementProps","elementType","backgroundAppearance","appearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCACwB;uCAEN;AAWlC,MAAMA,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,MAAM,EAAE,GAAGC,IAAAA,+CAAAA;IAEnB,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FP,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAES,aAAa;QAAM;QAEvBC,sBAAsBV,MAAMW,UAAU;QACtCT;IACF;AACF"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastContextValues_unstable", {
enumerable: true,
get: function() {
return useToastContextValues_unstable;
}
});
function useToastContextValues_unstable(state) {
const { backgroundAppearance } = state;
return {
backgroundAppearance
};
}
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/useToastContextValues.ts"],"sourcesContent":["import { ToastContextValues, ToastState } from './Toast.types';\n\nexport function useToastContextValues_unstable(state: ToastState): ToastContextValues {\n const { backgroundAppearance } = state;\n\n return {\n backgroundAppearance,\n };\n}\n"],"names":["useToastContextValues_unstable","state","backgroundAppearance"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,+BAA+BC,KAAiB;IAC9D,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;IAEjC,OAAO;QACLC;IACF;AACF"}
@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
toastClassNames: function() {
return toastClassNames;
},
useToastStyles_unstable: function() {
return useToastStyles_unstable;
}
});
const _react = require("@griffel/react");
const toastClassNames = {
root: 'fui-Toast'
};
const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rhf7k35", null, [
".rhf7k35{display:grid;grid-template-columns:auto 1fr auto;padding:12px;border-radius:var(--borderRadiusMedium);border:1px solid var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}"
]);
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
inverted: {
sj55zd: "f1w7i9ko",
De3pzq: "f5pduvr"
}
}, {
d: [
".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}",
".f5pduvr{background-color:var(--colorNeutralBackgroundInverted);}"
]
});
const useToastStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const styles = useStyles();
state.root.className = (0, _react.mergeClasses)(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useToastStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n padding: '12px',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n boxShadow: tokens.shadow8,\n fontSize: tokens.fontSizeBase300,\n lineHeight: '20px',\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1\n});\nconst useStyles = makeStyles({\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted\n }\n});\n/**\n * Apply styling to the Toast slots based on the state\n */ export const useToastStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);\n return state;\n};\n"],"names":["toastClassNames","useToastStyles_unstable","root","useRootBaseClassName","__resetStyles","useStyles","__styles","inverted","sj55zd","De3pzq","d","state","rootBaseClassName","styles","className","mergeClasses","backgroundAppearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,eAAe;eAAfA;;IAwBIC,uBAAuB;eAAvBA;;;uBA1ByC;AAEnD,MAAMD,kBAAkB;IAC3BE,MAAM;AACV;AACA,MAAMC,uBAAoB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAY5B;AACD,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,UAAA;QAAAC,QAAA;QAAAC,QAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;KAAA;AAAA;AAQP,MAAMT,0BAA2BU,CAAAA;IACxC;IACA,MAAMC,oBAAoBT;IAC1B,MAAMU,SAASR;IACfM,MAAMT,IAAI,CAACY,SAAS,GAAGC,IAAAA,mBAAY,EAACf,gBAAgBE,IAAI,EAAEU,mBAAmBD,MAAMK,oBAAoB,KAAK,cAAcH,OAAON,QAAQ,EAAEI,MAAMT,IAAI,CAACY,SAAS;IAC/J,OAAOH;AACX"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ToastBody", {
enumerable: true,
get: function() {
return ToastBody;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToastBody = require("./useToastBody");
const _renderToastBody = require("./renderToastBody");
const _useToastBodyStylesstyles = require("./useToastBodyStyles.styles");
const ToastBody = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToastBody.useToastBody_unstable)(props, ref);
(0, _useToastBodyStylesstyles.useToastBodyStyles_unstable)(state);
return (0, _renderToastBody.renderToastBody_unstable)(state);
});
ToastBody.displayName = 'ToastBody';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/ToastBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastBody_unstable } from './useToastBody';\nimport { renderToastBody_unstable } from './renderToastBody';\nimport { useToastBodyStyles_unstable } from './useToastBodyStyles.styles';\nimport type { ToastBodyProps } from './ToastBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastBody component\n */\nexport const ToastBody: ForwardRefComponent<ToastBodyProps> = React.forwardRef((props, ref) => {\n const state = useToastBody_unstable(props, ref);\n\n useToastBodyStyles_unstable(state);\n return renderToastBody_unstable(state);\n});\n\nToastBody.displayName = 'ToastBody';\n"],"names":["ToastBody","React","forwardRef","props","ref","state","useToastBody_unstable","useToastBodyStyles_unstable","renderToastBody_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;;iEAVU;8BACe;iCACG;0CACG;AAOrC,MAAMA,YAAAA,WAAAA,GAAiDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACrF,MAAMC,QAAQC,IAAAA,mCAAAA,EAAsBH,OAAOC;IAE3CG,IAAAA,qDAAAA,EAA4BF;IAC5B,OAAOG,IAAAA,yCAAAA,EAAyBH;AAClC;AAEAL,UAAUS,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ToastBody
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/ToastBody.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\n\nexport type ToastBodySlots = {\n root: Slot<'div'>;\n subtitle?: Slot<'div'>;\n};\n\n/**\n * ToastBody Props\n */\nexport type ToastBodyProps = ComponentProps<ToastBodySlots> & {};\n\n/**\n * State used in rendering ToastBody\n */\nexport type ToastBodyState = ComponentState<ToastBodySlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n"],"names":[],"rangeMappings":";;","mappings":"AAaA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ToastBody: function() {
return _ToastBody.ToastBody;
},
renderToastBody_unstable: function() {
return _renderToastBody.renderToastBody_unstable;
},
toastBodyClassNames: function() {
return _useToastBodyStylesstyles.toastBodyClassNames;
},
useToastBodyStyles_unstable: function() {
return _useToastBodyStylesstyles.useToastBodyStyles_unstable;
},
useToastBody_unstable: function() {
return _useToastBody.useToastBody_unstable;
}
});
const _ToastBody = require("./ToastBody");
const _renderToastBody = require("./renderToastBody");
const _useToastBody = require("./useToastBody");
const _useToastBodyStylesstyles = require("./useToastBodyStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/index.ts"],"sourcesContent":["export { ToastBody } from './ToastBody';\nexport type { ToastBodyProps, ToastBodySlots, ToastBodyState } from './ToastBody.types';\nexport { renderToastBody_unstable } from './renderToastBody';\nexport { useToastBody_unstable } from './useToastBody';\nexport { toastBodyClassNames, useToastBodyStyles_unstable } from './useToastBodyStyles.styles';\n"],"names":["ToastBody","renderToastBody_unstable","toastBodyClassNames","useToastBodyStyles_unstable","useToastBody_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,SAAS;eAATA,oBAAS;;IAETC,wBAAwB;eAAxBA,yCAAwB;;IAExBC,mBAAmB;eAAnBA,6CAAmB;;IAAEC,2BAA2B;eAA3BA,qDAA2B;;IADhDC,qBAAqB;eAArBA,mCAAqB;;;2BAHJ;iCAEe;8BACH;0CAC2B"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToastBody_unstable", {
enumerable: true,
get: function() {
return renderToastBody_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderToastBody_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {}),
state.subtitle ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.subtitle, {}) : null
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/renderToastBody.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastBodyState, ToastBodySlots } from './ToastBody.types';\n\n/**\n * Render the final JSX of ToastBody\n */\nexport const renderToastBody_unstable = (state: ToastBodyState) => {\n assertSlots<ToastBodySlots>(state);\n\n return (\n <>\n <state.root />\n {state.subtitle ? <state.subtitle /> : null}\n </>\n );\n};\n"],"names":["renderToastBody_unstable","state","assertSlots","_jsxs","_Fragment","_jsx","root","subtitle"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,2BAA2B,CAACC;IACvCC,IAAAA,2BAAAA,EAA4BD;IAE5B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;0BACEC,IAAAA,eAAA,EAACJ,MAAMK,IAAI,EAAA,CAAA;YACVL,MAAMM,QAAQ,GAAA,WAAA,GAAGF,IAAAA,eAAA,EAACJ,MAAMM,QAAQ,EAAA,CAAA,KAAM;;;AAG7C"}
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastBody_unstable", {
enumerable: true,
get: function() {
return useToastBody_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _toastContainerContext = require("../../contexts/toastContainerContext");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const useToastBody_unstable = (props, ref)=>{
const backgroundAppearance = (0, _reactsharedcontexts.useBackgroundAppearance)();
const { bodyId } = (0, _toastContainerContext.useToastContainerContext)();
return {
components: {
root: 'div',
subtitle: 'div'
},
subtitle: _reactutilities.slot.optional(props.subtitle, {
elementType: 'div'
}),
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
id: bodyId,
...props
}), {
elementType: 'div'
}),
backgroundAppearance
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/useToastBody.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastBodyProps, ToastBodyState } from './ToastBody.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render ToastBody.\n *\n * The returned state can be modified with hooks such as useToastBodyStyles_unstable,\n * before being passed to renderToastBody_unstable.\n *\n * @param props - props from this instance of ToastBody\n * @param ref - reference to root HTMLElement of ToastBody\n */\nexport const useToastBody_unstable = (props: ToastBodyProps, ref: React.Ref<HTMLElement>): ToastBodyState => {\n const backgroundAppearance = useBackgroundAppearance();\n const { bodyId } = useToastContainerContext();\n return {\n components: {\n root: 'div',\n subtitle: 'div',\n },\n subtitle: slot.optional(props.subtitle, { elementType: 'div' }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n id: bodyId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n backgroundAppearance,\n };\n};\n"],"names":["useToastBody_unstable","props","ref","backgroundAppearance","useBackgroundAppearance","bodyId","useToastContainerContext","components","root","subtitle","slot","optional","elementType","always","getIntrinsicElementProps","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAeaA;;;eAAAA;;;;iEAfU;gCACwB;uCAEN;qCACD;AAWjC,MAAMA,wBAAwB,CAACC,OAAuBC;IAC3D,MAAMC,uBAAuBC,IAAAA,4CAAAA;IAC7B,MAAM,EAAEC,MAAM,EAAE,GAAGC,IAAAA,+CAAAA;IACnB,OAAO;QACLC,YAAY;YACVC,MAAM;YACNC,UAAU;QACZ;QACAA,UAAUC,oBAAAA,CAAKC,QAAQ,CAACV,MAAMQ,QAAQ,EAAE;YAAEG,aAAa;QAAM;QAC7DJ,MAAME,oBAAAA,CAAKG,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FZ,KAAKA;YACLa,IAAIV;YACJ,GAAGJ,KAAK;QACV,IACA;YAAEW,aAAa;QAAM;QAEvBT;IACF;AACF"}
@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
toastBodyClassNames: function() {
return toastBodyClassNames;
},
useToastBodyStyles_unstable: function() {
return useToastBodyStyles_unstable;
}
});
const _react = require("@griffel/react");
const toastBodyClassNames = {
root: 'fui-ToastBody',
subtitle: 'fui-ToastBody__subtitle'
};
const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rciajo9", null, [
".rciajo9{grid-column-start:2;grid-column-end:3;padding-top:6px;font-size:var(--fontSizeBase300);line-height:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground1);word-break:break-word;}"
]);
const useSubtitleBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rzjw1xk", null, [
".rzjw1xk{padding-top:4px;grid-column-start:2;grid-column-end:3;font-size:var(--fontSizeBase200);line-height:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground2);}"
]);
const useInvertedStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
sj55zd: "f1w7i9ko"
},
subtitle: {
sj55zd: "f1w7i9ko"
}
}, {
d: [
".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}"
]
});
const useToastBodyStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const subtitleBaseClassName = useSubtitleBaseClassName();
const invertedStyles = useInvertedStyles();
state.root.className = (0, _react.mergeClasses)(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.subtitle) {
state.subtitle.className = (0, _react.mergeClasses)(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);
}
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useToastBodyStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastBodyClassNames = {\n root: 'fui-ToastBody',\n subtitle: 'fui-ToastBody__subtitle'\n};\nconst useRootBaseClassName = makeResetStyles({\n gridColumnStart: 2,\n gridColumnEnd: 3,\n paddingTop: '6px',\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useSubtitleBaseClassName = makeResetStyles({\n paddingTop: '4px',\n gridColumnStart: 2,\n gridColumnEnd: 3,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.fontSizeBase200,\n fontWeight: tokens.fontWeightRegular,\n color: tokens.colorNeutralForeground2\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n subtitle: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastBody slots based on the state\n */ export const useToastBodyStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const subtitleBaseClassName = useSubtitleBaseClassName();\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.subtitle) {\n state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);\n }\n return state;\n};\n"],"names":["toastBodyClassNames","useToastBodyStyles_unstable","root","subtitle","useRootBaseClassName","__resetStyles","useSubtitleBaseClassName","useInvertedStyles","__styles","sj55zd","d","state","rootBaseClassName","subtitleBaseClassName","invertedStyles","className","mergeClasses","backgroundAppearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,mBAAmB;eAAnBA;;IAiCIC,2BAA2B;eAA3BA;;;uBAnCyC;AAEnD,MAAMD,sBAAsB;IAC/BE,MAAM;IACNC,UAAU;AACd;AACA,MAAMC,uBAAoB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAS5B;AACD,MAAMC,2BAAwB,WAAA,GAAGD,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAQhC;AACD,MAAME,oBAAiB,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAN,MAAA;QAAAO,QAAA;IAAA;IAAAN,UAAA;QAAAM,QAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;KAAA;AAAA;AAUf,MAAMT,8BAA+BU,CAAAA;IAC5C;IACA,MAAMC,oBAAoBR;IAC1B,MAAMS,wBAAwBP;IAC9B,MAAMQ,iBAAiBP;IACvBI,MAAMT,IAAI,CAACa,SAAS,GAAGC,IAAAA,mBAAY,EAAChB,oBAAoBE,IAAI,EAAEU,mBAAmBD,MAAMM,oBAAoB,KAAK,cAAcH,eAAeZ,IAAI,EAAES,MAAMT,IAAI,CAACa,SAAS;IACvK,IAAIJ,MAAMR,QAAQ,EAAE;QAChBQ,MAAMR,QAAQ,CAACY,SAAS,GAAGC,IAAAA,mBAAY,EAAChB,oBAAoBG,QAAQ,EAAEU,uBAAuBF,MAAMM,oBAAoB,KAAK,cAAcH,eAAeX,QAAQ,EAAEQ,MAAMR,QAAQ,CAACY,SAAS;IAC/L;IACA,OAAOJ;AACX"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ToastContainer", {
enumerable: true,
get: function() {
return ToastContainer;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToastContainer = require("./useToastContainer");
const _renderToastContainer = require("./renderToastContainer");
const _useToastContainerStylesstyles = require("./useToastContainerStyles.styles");
const _useToastContainerContextValues = require("./useToastContainerContextValues");
const ToastContainer = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToastContainer.useToastContainer_unstable)(props, ref);
(0, _useToastContainerStylesstyles.useToastContainerStyles_unstable)(state);
return (0, _renderToastContainer.renderToastContainer_unstable)(state, (0, _useToastContainerContextValues.useToastContainerContextValues_unstable)(state));
});
ToastContainer.displayName = 'ToastContainer';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/ToastContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastContainer_unstable } from './useToastContainer';\nimport { renderToastContainer_unstable } from './renderToastContainer';\nimport { useToastContainerStyles_unstable } from './useToastContainerStyles.styles';\nimport type { ToastContainerProps } from './ToastContainer.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToastContainerContextValues_unstable } from './useToastContainerContextValues';\n\n/**\n * ToastContainer component\n */\nexport const ToastContainer: ForwardRefComponent<ToastContainerProps> = React.forwardRef((props, ref) => {\n const state = useToastContainer_unstable(props, ref);\n\n useToastContainerStyles_unstable(state);\n return renderToastContainer_unstable(state, useToastContainerContextValues_unstable(state));\n});\n\nToastContainer.displayName = 'ToastContainer';\n"],"names":["ToastContainer","React","forwardRef","props","ref","state","useToastContainer_unstable","useToastContainerStyles_unstable","renderToastContainer_unstable","useToastContainerContextValues_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;mCACoB;sCACG;+CACG;gDAGO;AAKjD,MAAMA,iBAAAA,WAAAA,GAA2DC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQC,IAAAA,6CAAAA,EAA2BH,OAAOC;IAEhDG,IAAAA,+DAAAA,EAAiCF;IACjC,OAAOG,IAAAA,mDAAAA,EAA8BH,OAAOI,IAAAA,uEAAAA,EAAwCJ;AACtF;AAEAL,eAAeU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/ToastContainer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { Announce } from '../AriaLive/AriaLive.types';\nimport { Toast, ToastIntent } from '../../state';\nimport { ToastContainerContextValue } from '../../contexts/toastContainerContext';\nimport { TimerProps } from '../Timer/Timer';\n\nexport type ToastContainerContextValues = {\n toast: ToastContainerContextValue;\n};\n\nexport type ToastContainerSlots = {\n root: NonNullable<Slot<'div'>>;\n timer: NonNullable<Slot<TimerProps>>;\n};\n\n/**\n * ToastContainer Props\n */\nexport type ToastContainerProps = Omit<ComponentProps<Partial<ToastContainerSlots>>, 'content'> &\n Toast & {\n visible: boolean;\n announce: Announce;\n intent: ToastIntent | undefined;\n tryRestoreFocus: () => void;\n };\n\n/**\n * State used in rendering ToastContainer\n */\nexport type ToastContainerState = ComponentState<ToastContainerSlots> &\n Pick<ToastContainerProps, 'remove' | 'close' | 'updateId' | 'visible' | 'intent'> &\n Pick<ToastContainerContextValue, 'titleId' | 'bodyId'> & {\n /**\n * @deprecated Will be always \"0\".\n */\n transitionTimeout: number;\n timerTimeout: number;\n running: boolean;\n /**\n * @deprecated Will be always no-op.\n */\n onTransitionEntering: () => void;\n /**\n * @deprecated\n */\n nodeRef: React.Ref<HTMLDivElement>;\n\n onMotionFinish?: (event: null, data: { direction: 'enter' | 'exit' }) => void;\n };\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ToastContainer: function() {
return _ToastContainer.ToastContainer;
},
renderToastContainer_unstable: function() {
return _renderToastContainer.renderToastContainer_unstable;
},
toastContainerClassNames: function() {
return _useToastContainerStylesstyles.toastContainerClassNames;
},
useToastContainerContextValues_unstable: function() {
return _useToastContainerContextValues.useToastContainerContextValues_unstable;
},
useToastContainerStyles_unstable: function() {
return _useToastContainerStylesstyles.useToastContainerStyles_unstable;
},
useToastContainer_unstable: function() {
return _useToastContainer.useToastContainer_unstable;
}
});
const _ToastContainer = require("./ToastContainer");
const _renderToastContainer = require("./renderToastContainer");
const _useToastContainer = require("./useToastContainer");
const _useToastContainerStylesstyles = require("./useToastContainerStyles.styles");
const _useToastContainerContextValues = require("./useToastContainerContextValues");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/index.ts"],"sourcesContent":["export { ToastContainer } from './ToastContainer';\nexport type {\n ToastContainerContextValues,\n ToastContainerProps,\n ToastContainerSlots,\n ToastContainerState,\n} from './ToastContainer.types';\nexport { renderToastContainer_unstable } from './renderToastContainer';\nexport { useToastContainer_unstable } from './useToastContainer';\nexport { toastContainerClassNames, useToastContainerStyles_unstable } from './useToastContainerStyles.styles';\nexport { useToastContainerContextValues_unstable } from './useToastContainerContextValues';\n"],"names":["ToastContainer","renderToastContainer_unstable","toastContainerClassNames","useToastContainerContextValues_unstable","useToastContainerStyles_unstable","useToastContainer_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,cAAc;eAAdA,8BAAc;;IAOdC,6BAA6B;eAA7BA,mDAA6B;;IAE7BC,wBAAwB;eAAxBA,uDAAwB;;IACxBC,uCAAuC;eAAvCA,uEAAuC;;IADbC,gCAAgC;eAAhCA,+DAAgC;;IAD1DC,0BAA0B;eAA1BA,6CAA0B;;;gCARJ;sCAOe;mCACH;+CACgC;gDACnB"}
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToastContainer_unstable", {
enumerable: true,
get: function() {
return renderToastContainer_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _toastContainerContext = require("../../contexts/toastContainerContext");
const _reactmotioncomponentspreview = require("@fluentui/react-motion-components-preview");
const renderToastContainer_unstable = (state, contextValues)=>{
const { onMotionFinish, visible, updateId } = state;
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_toastContainerContext.ToastContainerContextProvider, {
value: contextValues.toast,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactmotioncomponentspreview.CollapseDelayed, {
appear: true,
onMotionFinish: onMotionFinish,
visible: visible,
unmountOnExit: true,
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
children: [
state.root.children,
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.timer, {}, updateId)
]
})
})
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\nimport { CollapseDelayed } from '@fluentui/react-motion-components-preview';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onMotionFinish, visible, updateId } = state;\n assertSlots<ToastContainerSlots>(state);\n\n return (\n <ToastContainerContextProvider value={contextValues.toast}>\n <CollapseDelayed appear onMotionFinish={onMotionFinish} visible={visible} unmountOnExit>\n <state.root>\n {state.root.children}\n <state.timer key={updateId} />\n </state.root>\n </CollapseDelayed>\n </ToastContainerContextProvider>\n );\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onMotionFinish","visible","updateId","assertSlots","_jsx","ToastContainerContextProvider","value","toast","CollapseDelayed","appear","unmountOnExit","_jsxs","root","children","timer"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;gCAC4B;uCAEkB;8CACd;AAKzB,MAAMA,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9CK,IAAAA,2BAAAA,EAAiCL;IAEjC,OAAA,WAAA,GACEM,IAAAA,eAAA,EAACC,oDAAAA,EAAAA;QAA8BC,OAAOP,cAAcQ,KAAK;kBACvD,WAAA,GAAAH,IAAAA,eAAA,EAACI,6CAAAA,EAAAA;YAAgBC,QAAM;YAACT,gBAAgBA;YAAgBC,SAASA;YAASS,eAAa;sBACrF,WAAA,GAAAC,IAAAA,gBAAA,EAACb,MAAMc,IAAI,EAAA;;oBACRd,MAAMc,IAAI,CAACC,QAAQ;kCACpBT,IAAAA,eAAA,EAACN,MAAMgB,KAAK,EAAA,CAAA,GAAMZ;;;;;AAK5B"}
@@ -0,0 +1,234 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastContainer_unstable", {
enumerable: true,
get: function() {
return useToastContainer_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const _keyboardkeys = require("@fluentui/keyboard-keys");
const _reacttabster = require("@fluentui/react-tabster");
const _Timer = require("../Timer/Timer");
const intentPolitenessMap = {
success: 'assertive',
warning: 'assertive',
error: 'assertive',
info: 'polite'
};
const useToastContainer_unstable = (props, ref)=>{
const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;
const titleId = (0, _reactutilities.useId)('toast-title');
const bodyId = (0, _reactutilities.useId)('toast-body');
const toastRef = _react.useRef(null);
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
const [running, setRunning] = _react.useState(false);
const imperativePauseRef = _react.useRef(false);
const focusedToastBeforeClose = _react.useRef(false);
const focusableGroupAttribute = (0, _reacttabster.useFocusableGroup)({
tabBehavior: 'limited-trap-focus',
// Users should only use Tab to focus into the toast
// Escape is already reserved to dismiss all toasts
ignoreDefaultKeydown: {
Tab: true,
Escape: true,
Enter: true
}
});
const close = (0, _reactutilities.useEventCallback)(()=>{
var _toastRef_current;
const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
if (activeElement && ((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains(activeElement))) {
focusedToastBeforeClose.current = true;
}
closeProp();
});
const onStatusChange = (0, _reactutilities.useEventCallback)((status)=>{
var _props_onStatusChange;
return (_props_onStatusChange = props.onStatusChange) === null || _props_onStatusChange === void 0 ? void 0 : _props_onStatusChange.call(props, null, {
status,
...props
});
});
const pause = (0, _reactutilities.useEventCallback)(()=>setRunning(false));
const play = (0, _reactutilities.useEventCallback)(()=>{
var _toastRef_current;
if (imperativePauseRef.current) {
return;
}
var _targetDocument_activeElement;
const containsActive = !!((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains((_targetDocument_activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) !== null && _targetDocument_activeElement !== void 0 ? _targetDocument_activeElement : null));
if (timerTimeout < 0) {
setRunning(true);
return;
}
if (!containsActive) {
setRunning(true);
}
});
_react.useImperativeHandle(imperativeRef, ()=>({
focus: ()=>{
if (!toastRef.current) {
return;
}
toastRef.current.focus();
},
play: ()=>{
imperativePauseRef.current = false;
play();
},
pause: ()=>{
imperativePauseRef.current = true;
pause();
}
}));
_react.useEffect(()=>{
return ()=>onStatusChange('unmounted');
}, [
onStatusChange
]);
_react.useEffect(()=>{
if (!targetDocument) {
return;
}
if (pauseOnWindowBlur) {
var _targetDocument_defaultView, _targetDocument_defaultView1;
(_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.addEventListener('focus', play);
(_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.addEventListener('blur', pause);
return ()=>{
var _targetDocument_defaultView, _targetDocument_defaultView1;
(_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.removeEventListener('focus', play);
(_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.removeEventListener('blur', pause);
};
}
}, [
targetDocument,
pause,
play,
pauseOnWindowBlur
]);
// Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController
const userRootSlot = data.root;
const onMotionFinish = _react.useCallback((_, { direction })=>{
if (direction === 'exit') {
remove();
}
if (direction === 'enter') {
// start toast once it's fully animated in
play();
onStatusChange('visible');
}
}, [
onStatusChange,
play,
remove
]);
const onMouseEnter = (0, _reactutilities.useEventCallback)((e)=>{
var _userRootSlot_onMouseEnter;
pause();
userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);
});
const onMouseLeave = (0, _reactutilities.useEventCallback)((e)=>{
var _userRootSlot_onMouseEnter;
play();
userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);
});
const { findFirstFocusable, findLastFocusable } = (0, _reacttabster.useFocusFinders)();
const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
var _userRootSlot_onKeyDown;
if (e.key === _keyboardkeys.Delete) {
e.preventDefault();
close();
}
if (e.key === _keyboardkeys.Tab && e.currentTarget === e.target) {
e.preventDefault();
if (e.shiftKey) {
var _findLastFocusable;
(_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
} else {
var _findFirstFocusable;
(_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();
}
}
userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);
});
_react.useEffect(()=>{
var _toastRef_current;
if (!visible) {
return;
}
const politeness = desiredPoliteness !== null && desiredPoliteness !== void 0 ? desiredPoliteness : intentPolitenessMap[intent];
var _toastRef_current_textContent;
announce((_toastRef_current_textContent = (_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.textContent) !== null && _toastRef_current_textContent !== void 0 ? _toastRef_current_textContent : '', {
politeness
});
}, [
announce,
desiredPoliteness,
toastRef,
visible,
updateId,
intent
]);
_react.useEffect(()=>{
return ()=>{
if (focusedToastBeforeClose.current) {
focusedToastBeforeClose.current = false;
tryRestoreFocus();
}
};
}, [
tryRestoreFocus
]);
return {
components: {
timer: _Timer.Timer,
root: 'div'
},
timer: _reactutilities.slot.always({
onTimeout: close,
running,
timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1
}, {
elementType: _Timer.Timer
}),
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: (0, _reactutilities.useMergedRefs)(ref, toastRef),
children,
tabIndex: 0,
role: 'listitem',
'aria-labelledby': titleId,
'aria-describedby': bodyId,
...rest,
...userRootSlot,
...focusableGroupAttribute,
onMouseEnter,
onMouseLeave,
onKeyDown
}), {
elementType: 'div'
}),
timerTimeout,
transitionTimeout: 0,
running,
visible,
remove,
close,
onTransitionEntering: ()=>{
/* no-op */ },
updateId,
nodeRef: toastRef,
intent,
titleId,
bodyId,
onMotionFinish
};
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastContainerContextValues_unstable", {
enumerable: true,
get: function() {
return useToastContainerContextValues_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
function useToastContainerContextValues_unstable(state) {
const { close, intent, titleId, bodyId } = state;
const toastContainerContext = _react.useMemo(()=>({
close,
intent,
titleId,
bodyId
}), [
close,
intent,
titleId,
bodyId
]);
return {
toast: toastContainerContext
};
}
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/useToastContainerContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { ToastContainerContextValues, ToastContainerState } from './ToastContainer.types';\n\nexport function useToastContainerContextValues_unstable(state: ToastContainerState): ToastContainerContextValues {\n const { close, intent, titleId, bodyId } = state;\n\n const toastContainerContext = React.useMemo(\n () => ({\n close,\n intent,\n titleId,\n bodyId,\n }),\n [close, intent, titleId, bodyId],\n );\n\n return {\n toast: toastContainerContext,\n };\n}\n"],"names":["useToastContainerContextValues_unstable","state","close","intent","titleId","bodyId","toastContainerContext","React","useMemo","toast"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGgBA;;;eAAAA;;;;iEAHO;AAGhB,SAASA,wCAAwCC,KAA0B;IAChF,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAE3C,MAAMK,wBAAwBC,OAAMC,OAAO,CACzC,IAAO,CAAA;YACLN;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QAACH;QAAOC;QAAQC;QAASC;KAAO;IAGlC,OAAO;QACLI,OAAOH;IACT;AACF"}
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
toastContainerClassNames: function() {
return toastContainerClassNames;
},
useToastContainerStyles_unstable: function() {
return useToastContainerStyles_unstable;
}
});
const _react = require("@griffel/react");
const toastContainerClassNames = {
root: 'fui-ToastContainer',
timer: 'fui-ToastContainer__timer'
};
const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r98b696", null, [
".r98b696{box-sizing:border-box;margin-top:16px;pointer-events:all;border-radius:var(--borderRadiusMedium);}",
".r98b696[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}"
]);
const useToastContainerStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = (0, _react.mergeClasses)(toastContainerClassNames.root, rootBaseClassName, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n marginTop: '16px',\n pointerEvents: 'all',\n borderRadius: tokens.borderRadiusMedium,\n ...createCustomFocusIndicatorStyle({\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`\n })\n});\n/**\n * Apply styling to the ToastContainer slots based on the state\n */ export const useToastContainerStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);\n return state;\n};\n"],"names":["toastContainerClassNames","useToastContainerStyles_unstable","root","timer","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAeIC,gCAAgC;eAAhCA;;;uBAlB6B;AAGvC,MAAMD,2BAA2B;IACpCE,MAAM;IACNC,OAAO;AACX;AACA,MAAMC,uBAAoB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;IAAA;CAQ5B;AAGU,MAAMJ,mCAAoCK,CAAAA;IACjD;IACA,MAAMC,oBAAoBH;IAC1BE,MAAMJ,IAAI,CAACM,SAAS,GAAGC,IAAAA,mBAAY,EAACT,yBAAyBE,IAAI,EAAEK,mBAAmBD,MAAMJ,IAAI,CAACM,SAAS;IAC1G,OAAOF;AACX"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ToastFooter", {
enumerable: true,
get: function() {
return ToastFooter;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToastFooter = require("./useToastFooter");
const _renderToastFooter = require("./renderToastFooter");
const _useToastFooterStylesstyles = require("./useToastFooterStyles.styles");
const ToastFooter = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToastFooter.useToastFooter_unstable)(props, ref);
(0, _useToastFooterStylesstyles.useToastFooterStyles_unstable)(state);
return (0, _renderToastFooter.renderToastFooter_unstable)(state);
});
ToastFooter.displayName = 'ToastFooter';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/ToastFooter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastFooter_unstable } from './useToastFooter';\nimport { renderToastFooter_unstable } from './renderToastFooter';\nimport { useToastFooterStyles_unstable } from './useToastFooterStyles.styles';\nimport type { ToastFooterProps } from './ToastFooter.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastFooter component\n */\nexport const ToastFooter: ForwardRefComponent<ToastFooterProps> = React.forwardRef((props, ref) => {\n const state = useToastFooter_unstable(props, ref);\n\n useToastFooterStyles_unstable(state);\n return renderToastFooter_unstable(state);\n});\n\nToastFooter.displayName = 'ToastFooter';\n"],"names":["ToastFooter","React","forwardRef","props","ref","state","useToastFooter_unstable","useToastFooterStyles_unstable","renderToastFooter_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;;iEAVU;gCACiB;mCACG;4CACG;AAOvC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9B,OAAOG,IAAAA,6CAAAA,EAA2BH;AACpC;AAEAL,YAAYS,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ToastFooter
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/ToastFooter.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToastFooterSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * ToastFooter Props\n */\nexport type ToastFooterProps = ComponentProps<ToastFooterSlots> & {};\n\n/**\n * State used in rendering ToastFooter\n */\nexport type ToastFooterState = ComponentState<ToastFooterSlots>;\n"],"names":[],"rangeMappings":";;","mappings":"AAWA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ToastFooter: function() {
return _ToastFooter.ToastFooter;
},
renderToastFooter_unstable: function() {
return _renderToastFooter.renderToastFooter_unstable;
},
toastFooterClassNames: function() {
return _useToastFooterStylesstyles.toastFooterClassNames;
},
useToastFooterStyles_unstable: function() {
return _useToastFooterStylesstyles.useToastFooterStyles_unstable;
},
useToastFooter_unstable: function() {
return _useToastFooter.useToastFooter_unstable;
}
});
const _ToastFooter = require("./ToastFooter");
const _renderToastFooter = require("./renderToastFooter");
const _useToastFooter = require("./useToastFooter");
const _useToastFooterStylesstyles = require("./useToastFooterStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/index.ts"],"sourcesContent":["export { ToastFooter } from './ToastFooter';\nexport type { ToastFooterProps, ToastFooterSlots, ToastFooterState } from './ToastFooter.types';\nexport { renderToastFooter_unstable } from './renderToastFooter';\nexport { useToastFooter_unstable } from './useToastFooter';\nexport { toastFooterClassNames, useToastFooterStyles_unstable } from './useToastFooterStyles.styles';\n"],"names":["ToastFooter","renderToastFooter_unstable","toastFooterClassNames","useToastFooterStyles_unstable","useToastFooter_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAEXC,0BAA0B;eAA1BA,6CAA0B;;IAE1BC,qBAAqB;eAArBA,iDAAqB;;IAAEC,6BAA6B;eAA7BA,yDAA6B;;IADpDC,uBAAuB;eAAvBA,uCAAuB;;;6BAHJ;mCAEe;gCACH;4CAC6B"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToastFooter_unstable", {
enumerable: true,
get: function() {
return renderToastFooter_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderToastFooter_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/renderToastFooter.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastFooterState, ToastFooterSlots } from './ToastFooter.types';\n\n/**\n * Render the final JSX of ToastFooter\n */\nexport const renderToastFooter_unstable = (state: ToastFooterState) => {\n assertSlots<ToastFooterSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderToastFooter_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;4BAPb;gCAC4B;AAMrB,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,2BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastFooter_unstable", {
enumerable: true,
get: function() {
return useToastFooter_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const useToastFooter_unstable = (props, ref)=>{
return {
components: {
root: 'div'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
...props
}), {
elementType: 'div'
})
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/useToastFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastFooterProps, ToastFooterState } from './ToastFooter.types';\n\n/**\n * Create the state required to render ToastFooter.\n *\n * The returned state can be modified with hooks such as useToastFooterStyles_unstable,\n * before being passed to renderToastFooter_unstable.\n *\n * @param props - props from this instance of ToastFooter\n * @param ref - reference to root HTMLElement of ToastFooter\n */\nexport const useToastFooter_unstable = (props: ToastFooterProps, ref: React.Ref<HTMLElement>): ToastFooterState => {\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["useToastFooter_unstable","props","ref","components","root","slot","always","getIntrinsicElementProps","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;gCACwB;AAYxC,MAAMA,0BAA0B,CAACC,OAAyBC;IAC/D,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FL,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEO,aAAa;QAAM;IAEzB;AACF"}
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
toastFooterClassNames: function() {
return toastFooterClassNames;
},
useToastFooterStyles_unstable: function() {
return useToastFooterStyles_unstable;
}
});
const _react = require("@griffel/react");
const toastFooterClassNames = {
root: 'fui-ToastFooter'
};
/**
* Styles for the root slot
*/ const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r56x6h2", null, [
".r56x6h2{padding-top:16px;grid-column-start:2;grid-column-end:3;display:flex;align-items:center;gap:14px;}"
]);
const useToastFooterStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = (0, _react.mergeClasses)(toastFooterClassNames.root, rootBaseClassName, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useToastFooterStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nexport const toastFooterClassNames = {\n root: 'fui-ToastFooter'\n};\n/**\n * Styles for the root slot\n */ const useRootBaseClassName = makeResetStyles({\n paddingTop: '16px',\n gridColumnStart: 2,\n gridColumnEnd: 3,\n display: 'flex',\n alignItems: 'center',\n gap: '14px'\n});\n/**\n * Apply styling to the ToastFooter slots based on the state\n */ export const useToastFooterStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastFooterClassNames.root, rootBaseClassName, state.root.className);\n return state;\n};\n"],"names":["toastFooterClassNames","useToastFooterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,qBAAqB;eAArBA;;IAeIC,6BAA6B;eAA7BA;;;uBAhB6B;AACvC,MAAMD,wBAAwB;IACjCE,MAAM;AACV;AACA;;CAEA,GAAI,MAAMC,uBAAoB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAOhC;AAGU,MAAMH,gCAAiCI,CAAAA;IAC9C;IACA,MAAMC,oBAAoBH;IAC1BE,MAAMH,IAAI,CAACK,SAAS,GAAGC,IAAAA,mBAAY,EAACR,sBAAsBE,IAAI,EAAEI,mBAAmBD,MAAMH,IAAI,CAACK,SAAS;IACvG,OAAOF;AACX"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ToastTitle", {
enumerable: true,
get: function() {
return ToastTitle;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToastTitle = require("./useToastTitle");
const _renderToastTitle = require("./renderToastTitle");
const _useToastTitleStylesstyles = require("./useToastTitleStyles.styles");
const ToastTitle = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToastTitle.useToastTitle_unstable)(props, ref);
(0, _useToastTitleStylesstyles.useToastTitleStyles_unstable)(state);
return (0, _renderToastTitle.renderToastTitle_unstable)(state);
});
ToastTitle.displayName = 'ToastTitle';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/ToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTitle_unstable } from './useToastTitle';\nimport { renderToastTitle_unstable } from './renderToastTitle';\nimport { useToastTitleStyles_unstable } from './useToastTitleStyles.styles';\nimport type { ToastTitleProps } from './ToastTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastTitle component\n */\nexport const ToastTitle: ForwardRefComponent<ToastTitleProps> = React.forwardRef((props, ref) => {\n const state = useToastTitle_unstable(props, ref);\n\n useToastTitleStyles_unstable(state);\n return renderToastTitle_unstable(state);\n});\n\nToastTitle.displayName = 'ToastTitle';\n"],"names":["ToastTitle","React","forwardRef","props","ref","state","useToastTitle_unstable","useToastTitleStyles_unstable","renderToastTitle_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;;iEAVU;+BACgB;kCACG;2CACG;AAOtC,MAAMA,aAAAA,WAAAA,GAAmDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQC,IAAAA,qCAAAA,EAAuBH,OAAOC;IAE5CG,IAAAA,uDAAAA,EAA6BF;IAC7B,OAAOG,IAAAA,2CAAAA,EAA0BH;AACnC;AAEAL,WAAWS,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ToastTitle
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/ToastTitle.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\nimport { ToastContainerContextValue } from '../../contexts/toastContainerContext';\n\nexport type ToastTitleSlots = {\n root: NonNullable<Slot<'div'>>;\n media?: Slot<'div'>;\n action?: Slot<'div'>;\n};\n\n/**\n * ToastTitle Props\n */\nexport type ToastTitleProps = ComponentProps<ToastTitleSlots> & {};\n\n/**\n * State used in rendering ToastTitle\n */\nexport type ToastTitleState = ComponentState<ToastTitleSlots> &\n Pick<ToastContainerContextValue, 'intent'> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAeA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ToastTitle: function() {
return _ToastTitle.ToastTitle;
},
renderToastTitle_unstable: function() {
return _renderToastTitle.renderToastTitle_unstable;
},
toastTitleClassNames: function() {
return _useToastTitleStylesstyles.toastTitleClassNames;
},
useToastTitleStyles_unstable: function() {
return _useToastTitleStylesstyles.useToastTitleStyles_unstable;
},
useToastTitle_unstable: function() {
return _useToastTitle.useToastTitle_unstable;
}
});
const _ToastTitle = require("./ToastTitle");
const _renderToastTitle = require("./renderToastTitle");
const _useToastTitle = require("./useToastTitle");
const _useToastTitleStylesstyles = require("./useToastTitleStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/index.ts"],"sourcesContent":["export { ToastTitle } from './ToastTitle';\nexport type { ToastTitleProps, ToastTitleSlots, ToastTitleState } from './ToastTitle.types';\nexport { renderToastTitle_unstable } from './renderToastTitle';\nexport { useToastTitle_unstable } from './useToastTitle';\nexport { toastTitleClassNames, useToastTitleStyles_unstable } from './useToastTitleStyles.styles';\n"],"names":["ToastTitle","renderToastTitle_unstable","toastTitleClassNames","useToastTitleStyles_unstable","useToastTitle_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,UAAU;eAAVA,sBAAU;;IAEVC,yBAAyB;eAAzBA,2CAAyB;;IAEzBC,oBAAoB;eAApBA,+CAAoB;;IAAEC,4BAA4B;eAA5BA,uDAA4B;;IADlDC,sBAAsB;eAAtBA,qCAAsB;;;4BAHJ;kCAEe;+BACH;2CAC4B"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToastTitle_unstable", {
enumerable: true,
get: function() {
return renderToastTitle_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderToastTitle_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
state.media ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.media, {}) : null,
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {}),
state.action ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.action, {}) : null
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/renderToastTitle.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastTitleState, ToastTitleSlots } from './ToastTitle.types';\n\n/**\n * Render the final JSX of ToastTitle\n */\nexport const renderToastTitle_unstable = (state: ToastTitleState) => {\n assertSlots<ToastTitleSlots>(state);\n\n return (\n <>\n {state.media ? <state.media /> : null}\n <state.root />\n {state.action ? <state.action /> : null}\n </>\n );\n};\n"],"names":["renderToastTitle_unstable","state","assertSlots","_jsxs","_Fragment","media","_jsx","root","action"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,4BAA4B,CAACC;IACxCC,IAAAA,2BAAAA,EAA6BD;IAE7B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;YACGH,MAAMI,KAAK,GAAA,WAAA,GAAGC,IAAAA,eAAA,EAACL,MAAMI,KAAK,EAAA,CAAA,KAAM;0BACjCC,IAAAA,eAAA,EAACL,MAAMM,IAAI,EAAA,CAAA;YACVN,MAAMO,MAAM,GAAA,WAAA,GAAGF,IAAAA,eAAA,EAACL,MAAMO,MAAM,EAAA,CAAA,KAAM;;;AAGzC"}
@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastTitle_unstable", {
enumerable: true,
get: function() {
return useToastTitle_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reacticons = require("@fluentui/react-icons");
const _reactutilities = require("@fluentui/react-utilities");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const _toastContainerContext = require("../../contexts/toastContainerContext");
const useToastTitle_unstable = (props, ref)=>{
const { intent, titleId } = (0, _toastContainerContext.useToastContainerContext)();
const backgroundAppearance = (0, _reactsharedcontexts.useBackgroundAppearance)();
/** Determine the role and media to render based on the intent */ let defaultIcon;
switch(intent){
case 'success':
defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.CheckmarkCircleFilled, null);
break;
case 'error':
defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.DismissCircleFilled, null);
break;
case 'warning':
defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.WarningFilled, null);
break;
case 'info':
defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.InfoFilled, null);
break;
}
return {
action: _reactutilities.slot.optional(props.action, {
elementType: 'div'
}),
components: {
root: 'div',
media: 'div',
action: 'div'
},
media: _reactutilities.slot.optional(props.media, {
renderByDefault: !!intent,
defaultProps: {
children: defaultIcon
},
elementType: 'div'
}),
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
children: props.children,
id: titleId,
...props
}), {
elementType: 'div'
}),
intent,
backgroundAppearance
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/useToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\nimport type { ToastTitleProps, ToastTitleState } from './ToastTitle.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render ToastTitle.\n *\n * The returned state can be modified with hooks such as useToastTitleStyles_unstable,\n * before being passed to renderToastTitle_unstable.\n *\n * @param props - props from this instance of ToastTitle\n * @param ref - reference to root HTMLElement of ToastTitle\n */\nexport const useToastTitle_unstable = (props: ToastTitleProps, ref: React.Ref<HTMLElement>): ToastTitleState => {\n const { intent, titleId } = useToastContainerContext();\n const backgroundAppearance = useBackgroundAppearance();\n\n /** Determine the role and media to render based on the intent */\n let defaultIcon;\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n return {\n action: slot.optional(props.action, { elementType: 'div' }),\n components: { root: 'div', media: 'div', action: 'div' },\n media: slot.optional(props.media, {\n renderByDefault: !!intent,\n defaultProps: { children: defaultIcon },\n elementType: 'div',\n }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n children: props.children,\n id: titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n intent,\n backgroundAppearance,\n };\n};\n"],"names":["useToastTitle_unstable","props","ref","intent","titleId","useToastContainerContext","backgroundAppearance","useBackgroundAppearance","defaultIcon","React","createElement","CheckmarkCircleFilled","DismissCircleFilled","WarningFilled","InfoFilled","action","slot","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","getIntrinsicElementProps","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBaA;;;eAAAA;;;;iEAlBU;4BAE+D;gCACvC;qCACP;uCAGC;AAWlC,MAAMA,yBAAyB,CAACC,OAAwBC;IAC7D,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGC,IAAAA,+CAAAA;IAC5B,MAAMC,uBAAuBC,IAAAA,4CAAAA;IAE7B,+DAA+D,GAC/D,IAAIC;IACJ,OAAQL;QACN,KAAK;YACHK,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACC,iCAAAA,EAAAA;YACf;QACF,KAAK;YACHH,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACE,+BAAAA,EAAAA;YACf;QACF,KAAK;YACHJ,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACG,yBAAAA,EAAAA;YACf;QACF,KAAK;YACHL,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACI,sBAAAA,EAAAA;YACf;IACJ;IAEA,OAAO;QACLC,QAAQC,oBAAAA,CAAKC,QAAQ,CAAChB,MAAMc,MAAM,EAAE;YAAEG,aAAa;QAAM;QACzDC,YAAY;YAAEC,MAAM;YAAOC,OAAO;YAAON,QAAQ;QAAM;QACvDM,OAAOL,oBAAAA,CAAKC,QAAQ,CAAChB,MAAMoB,KAAK,EAAE;YAChCC,iBAAiB,CAAC,CAACnB;YACnBoB,cAAc;gBAAEC,UAAUhB;YAAY;YACtCU,aAAa;QACf;QACAE,MAAMJ,oBAAAA,CAAKS,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FxB,KAAKA;YACLsB,UAAUvB,MAAMuB,QAAQ;YACxBG,IAAIvB;YACJ,GAAGH,KAAK;QACV,IACA;YAAEiB,aAAa;QAAM;QAEvBf;QACAG;IACF;AACF"}
@@ -0,0 +1,112 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
toastTitleClassNames: function() {
return toastTitleClassNames;
},
useToastTitleStyles_unstable: function() {
return useToastTitleStyles_unstable;
}
});
const _react = require("@griffel/react");
const toastTitleClassNames = {
root: 'fui-ToastTitle',
media: 'fui-ToastTitle__media',
action: 'fui-ToastTitle__action'
};
const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rdjap1e", null, [
".rdjap1e{display:flex;grid-column-end:3;color:var(--colorNeutralForeground1);word-break:break-word;}"
]);
const useMediaBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r8x5mrd", "r1soj19y", [
".r8x5mrd{display:flex;padding-top:2px;grid-column-end:2;padding-right:8px;font-size:16px;color:var(--colorNeutralForeground1);}",
".r1soj19y{display:flex;padding-top:2px;grid-column-end:2;padding-left:8px;font-size:16px;color:var(--colorNeutralForeground1);}"
]);
const useActionBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r2j19ip", "rjfozdo", [
".r2j19ip{display:flex;align-items:start;padding-left:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}",
".rjfozdo{display:flex;align-items:start;padding-right:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}"
]);
const useInvertedStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
sj55zd: "f1w7i9ko"
},
action: {
sj55zd: "f1qz2gb0"
},
media: {
sj55zd: "fqpbvvt"
}
}, {
d: [
".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}",
".f1qz2gb0{color:var(--colorBrandForegroundInverted);}",
".fqpbvvt{color:var(--colorNeutralForegroundInverted);}"
]
});
const useIntentIconStyles = /*#__PURE__*/ (0, _react.__styles)({
success: {
sj55zd: "f36rra6"
},
error: {
sj55zd: "f1ca9wz"
},
warning: {
sj55zd: "f13isgzr"
},
info: {
sj55zd: "fkfq4zb"
}
}, {
d: [
".f36rra6{color:var(--colorStatusSuccessForeground1);}",
".f1ca9wz{color:var(--colorStatusDangerForeground1);}",
".f13isgzr{color:var(--colorStatusWarningForeground1);}",
".fkfq4zb{color:var(--colorNeutralForeground2);}"
]
});
const useIntentIconStylesInverted = /*#__PURE__*/ (0, _react.__styles)({
success: {
sj55zd: "ff3wk4x"
},
error: {
sj55zd: "fbq2gqr"
},
warning: {
sj55zd: "fx6hq1t"
},
info: {
sj55zd: "f1w7i9ko"
}
}, {
d: [
".ff3wk4x{color:var(--colorStatusSuccessForegroundInverted);}",
".fbq2gqr{color:var(--colorStatusDangerForegroundInverted);}",
".fx6hq1t{color:var(--colorStatusWarningForegroundInverted);}",
".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}"
]
});
const useToastTitleStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const actionBaseClassName = useActionBaseClassName();
const mediaBaseClassName = useMediaBaseClassName();
const intentIconStyles = useIntentIconStyles();
const intentIconStylesInverted = useIntentIconStylesInverted();
const { intent } = state;
const invertedStyles = useInvertedStyles();
state.root.className = (0, _react.mergeClasses)(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.media) {
state.media.className = (0, _react.mergeClasses)(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent], state.media.className);
}
if (state.action) {
state.action.className = (0, _react.mergeClasses)(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);
}
return state;
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ToastTrigger", {
enumerable: true,
get: function() {
return ToastTrigger;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToastTrigger = require("./useToastTrigger");
const _renderToastTrigger = require("./renderToastTrigger");
const ToastTrigger = (props)=>{
const state = (0, _useToastTrigger.useToastTrigger_unstable)(props);
return (0, _renderToastTrigger.renderToastTrigger_unstable)(state);
};
ToastTrigger.displayName = 'ToastTrigger';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/ToastTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTrigger_unstable } from './useToastTrigger';\nimport { renderToastTrigger_unstable } from './renderToastTrigger';\nimport type { ToastTriggerProps } from './ToastTrigger.types';\n\n/**\n * ToastTrigger component\n */\nexport const ToastTrigger: React.FC<ToastTriggerProps> = props => {\n const state = useToastTrigger_unstable(props);\n\n return renderToastTrigger_unstable(state);\n};\n\nToastTrigger.displayName = 'ToastTrigger';\n"],"names":["ToastTrigger","props","state","useToastTrigger_unstable","renderToastTrigger_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;iCACkB;oCACG;AAMrC,MAAMA,eAA4CC,CAAAA;IACvD,MAAMC,QAAQC,IAAAA,yCAAAA,EAAyBF;IAEvC,OAAOG,IAAAA,+CAAAA,EAA4BF;AACrC;AAEAF,aAAaK,WAAW,GAAG"}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/ToastTrigger.types.ts"],"sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type ToastTriggerProps = TriggerProps<ToastTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * Props that are passed to the child of the ToastTrigger when cloned to ensure correct behaviour for the Toast\n */\nexport type ToastTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props\n>;\n\nexport type ToastTriggerState = {\n children: React.ReactElement | null;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAEuB"}
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ToastTrigger: function() {
return _ToastTrigger.ToastTrigger;
},
renderToastTrigger_unstable: function() {
return _renderToastTrigger.renderToastTrigger_unstable;
},
useToastTrigger_unstable: function() {
return _useToastTrigger.useToastTrigger_unstable;
}
});
const _ToastTrigger = require("./ToastTrigger");
const _renderToastTrigger = require("./renderToastTrigger");
const _useToastTrigger = require("./useToastTrigger");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/index.ts"],"sourcesContent":["export { ToastTrigger } from './ToastTrigger';\nexport type { ToastTriggerChildProps, ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nexport { renderToastTrigger_unstable } from './renderToastTrigger';\nexport { useToastTrigger_unstable } from './useToastTrigger';\n"],"names":["ToastTrigger","renderToastTrigger_unstable","useToastTrigger_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,YAAY;eAAZA,0BAAY;;IAEZC,2BAA2B;eAA3BA,+CAA2B;;IAC3BC,wBAAwB;eAAxBA,yCAAwB;;;8BAHJ;oCAEe;iCACH"}
@@ -0,0 +1,15 @@
/**
* Render the final JSX of MenuTrigger
*
* Only renders children
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToastTrigger_unstable", {
enumerable: true,
get: function() {
return renderToastTrigger_unstable;
}
});
const renderToastTrigger_unstable = (state)=>state.children;
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/renderToastTrigger.tsx"],"sourcesContent":["import type { ToastTriggerState } from './ToastTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderToastTrigger_unstable = (state: ToastTriggerState) => state.children;\n"],"names":["renderToastTrigger_unstable","state","children"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAEA;;;;CAIC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,8BAA8B,CAACC,QAA6BA,MAAMC,QAAQ"}
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToastTrigger_unstable", {
enumerable: true,
get: function() {
return useToastTrigger_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _reactaria = require("@fluentui/react-aria");
const _toastContainerContext = require("../../contexts/toastContainerContext");
const useToastTrigger_unstable = (props)=>{
const { children, disableButtonEnhancement = false } = props;
const { close } = (0, _toastContainerContext.useToastContainerContext)();
const child = (0, _reactutilities.getTriggerChild)(children);
const handleClick = (0, _reactutilities.useEventCallback)((e)=>{
var _child_props_onClick, _child_props;
child === null || child === void 0 ? void 0 : (_child_props_onClick = (_child_props = child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, e);
if (!e.isDefaultPrevented()) {
close();
}
});
const triggerChildProps = {
...child === null || child === void 0 ? void 0 : child.props,
ref: child === null || child === void 0 ? void 0 : child.ref,
onClick: handleClick
};
const ariaButtonTriggerChildProps = (0, _reactaria.useARIAButtonProps)((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {
...triggerChildProps,
type: 'button'
});
return {
children: (0, _reactutilities.applyTriggerPropsToChildren)(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport type { ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will close a `Toast`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Toast`\n * Besides being a trigger that closes a toast through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of a toast.\n */\nexport const useToastTrigger_unstable = (props: ToastTriggerProps): ToastTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const { close } = useToastContainerContext();\n\n const child = getTriggerChild(children);\n\n const handleClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(e);\n if (!e.isDefaultPrevented()) {\n close();\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["useToastTrigger_unstable","props","children","disableButtonEnhancement","close","useToastContainerContext","child","getTriggerChild","handleClick","useEventCallback","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","useARIAButtonProps","type","applyTriggerPropsToChildren"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAeaA;;;eAAAA;;;;iEAfU;gCACwD;2BAC5C;uCAEM;AAWlC,MAAMA,2BAA2B,CAACC;IACvC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAM,EAAEG,KAAK,EAAE,GAAGC,IAAAA,+CAAAA;IAElB,MAAMC,QAAQC,IAAAA,+BAAAA,EAAgBL;IAE9B,MAAMM,cAAcC,IAAAA,gCAAAA,EAClB,CAACC;YACCJ,sBAAAA;QAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,uBAAAA,CAAAA,eAAAA,MAAOL,KAAK,AAALA,EAAMU,OAAO,AAAPA,MAAO,QAApBL,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAAA,IAAAA,CAAAA,cAAuBI;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BR;QACF;IACF;IAGF,MAAMS,oBAAoB;WACrBP,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOL,KAAK;QACfa,KAAKR,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,GAAG;QACfH,SAASH;IACX;IAEA,MAAMO,8BAA8BC,IAAAA,6BAAAA,EAClCV,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOW,IAAI,AAAJA,MAAS,YAAYX,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOW,IAAI,AAAJA,MAAS,MAAMX,MAAMW,IAAI,GAAG,OAC/D;QACE,GAAGJ,iBAAiB;QACpBI,MAAM;IACR;IAGF,OAAO;QACLf,UAAUgB,IAAAA,2CAAAA,EACRhB,UACAC,2BAA2BU,oBAAoBE;IAEnD;AACF"}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Toaster", {
enumerable: true,
get: function() {
return Toaster;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useToaster = require("./useToaster");
const _renderToaster = require("./renderToaster");
const _useToasterStylesstyles = require("./useToasterStyles.styles");
const Toaster = (props)=>{
const state = (0, _useToaster.useToaster_unstable)(props);
(0, _useToasterStylesstyles.useToasterStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useToasterStyles_unstable')(state);
return (0, _renderToaster.renderToaster_unstable)(state);
};
Toaster.displayName = 'Toaster';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toaster/Toaster.tsx"],"sourcesContent":["import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\nimport { useToaster_unstable } from './useToaster';\nimport { renderToaster_unstable } from './renderToaster';\nimport { useToasterStyles_unstable } from './useToasterStyles.styles';\nimport type { ToasterProps } from './Toaster.types';\n\n/**\n * Toaster component - renders a collection of toasts dispatched imperatively\n */\nexport const Toaster: React.FC<ToasterProps> = props => {\n const state = useToaster_unstable(props);\n\n useToasterStyles_unstable(state);\n useCustomStyleHook_unstable('useToasterStyles_unstable')(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["Toaster","props","state","useToaster_unstable","useToasterStyles_unstable","useCustomStyleHook_unstable","renderToaster_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;qCAX+B;iEACrB;4BAEa;+BACG;wCACG;AAMnC,MAAMA,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQC,IAAAA,+BAAAA,EAAoBF;IAElCG,IAAAA,iDAAAA,EAA0BF;IAC1BG,IAAAA,gDAAAA,EAA4B,6BAA6BH;IACzD,OAAOI,IAAAA,qCAAAA,EAAuBJ;AAChC;AAEAF,QAAQO,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering Toaster
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toaster/Toaster.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\nimport { ToasterOptions } from '../../state/types';\nimport { Announce, AriaLiveProps } from '../AriaLive';\n\nexport type ToasterSlots = {\n /**\n * NOTE: This root slot maps in exactly the same way to the containers rendered for each toast position\n * There is no intention (currently) to let users customize the div for each toast position.\n */\n root: Slot<'div'>;\n};\n\nexport type ToasterSlotsInternal = ToasterSlots & {\n bottomEnd?: Slot<'div'>;\n bottomStart?: Slot<'div'>;\n topEnd?: Slot<'div'>;\n topStart?: Slot<'div'>;\n top?: Slot<'div'>;\n bottom?: Slot<'div'>;\n};\n\n/**\n * Toaster Props\n */\nexport type ToasterProps = Omit<ComponentProps<ToasterSlots>, 'children'> &\n Partial<ToasterOptions> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * User override API for aria-live narration for toasts\n */\n announce?: Announce;\n\n inline?: boolean;\n };\n\n/**\n * State used in rendering Toaster\n */\nexport type ToasterState = ComponentState<ToasterSlotsInternal> &\n Pick<AriaLiveProps, 'announceRef'> &\n Pick<PortalProps, 'mountNode'> &\n Pick<Required<ToasterProps>, 'announce' | 'inline'> & {\n offset: ToasterOptions['offset'] | undefined;\n renderAriaLive: boolean;\n dir: 'rtl' | 'ltr';\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAoCA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Toaster: function() {
return _Toaster.Toaster;
},
renderToaster_unstable: function() {
return _renderToaster.renderToaster_unstable;
},
toasterClassNames: function() {
return _useToasterStylesstyles.toasterClassNames;
},
useToasterStyles_unstable: function() {
return _useToasterStylesstyles.useToasterStyles_unstable;
},
useToaster_unstable: function() {
return _useToaster.useToaster_unstable;
}
});
const _Toaster = require("./Toaster");
const _renderToaster = require("./renderToaster");
const _useToaster = require("./useToaster");
const _useToasterStylesstyles = require("./useToasterStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toaster/index.ts"],"sourcesContent":["export { Toaster } from './Toaster';\nexport type { ToasterProps, ToasterSlots, ToasterSlotsInternal, ToasterState } from './Toaster.types';\nexport { renderToaster_unstable } from './renderToaster';\nexport { useToaster_unstable } from './useToaster';\nexport { toasterClassNames, useToasterStyles_unstable } from './useToasterStyles.styles';\n"],"names":["Toaster","renderToaster_unstable","toasterClassNames","useToasterStyles_unstable","useToaster_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,OAAO;eAAPA,gBAAO;;IAEPC,sBAAsB;eAAtBA,qCAAsB;;IAEtBC,iBAAiB;eAAjBA,yCAAiB;;IAAEC,yBAAyB;eAAzBA,iDAAyB;;IAD5CC,mBAAmB;eAAnBA,+BAAmB;;;yBAHJ;+BAEe;4BACH;wCACyB"}
@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderToaster_unstable", {
enumerable: true,
get: function() {
return renderToaster_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _reactportal = require("@fluentui/react-portal");
const _AriaLive = require("../AriaLive");
const renderToaster_unstable = (state)=>{
const { announceRef, renderAriaLive, inline, mountNode } = state;
(0, _reactutilities.assertSlots)(state);
const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;
const ariaLive = renderAriaLive ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_AriaLive.AriaLive, {
announceRef: announceRef
}) : null;
const positionSlots = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
state.bottom ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.bottom, {}) : null,
state.bottomStart ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.bottomStart, {}) : null,
state.bottomEnd ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.bottomEnd, {}) : null,
state.topStart ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.topStart, {}) : null,
state.topEnd ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.topEnd, {}) : null,
state.top ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.top, {}) : null
]
});
if (inline) {
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
ariaLive,
hasToasts ? positionSlots : null
]
});
}
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
ariaLive,
hasToasts ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactportal.Portal, {
mountNode: mountNode,
children: positionSlots
}) : null
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toaster/renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState) => {\n const { announceRef, renderAriaLive, inline, mountNode } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts =\n !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;\n\n const ariaLive = renderAriaLive ? <AriaLive announceRef={announceRef} /> : null;\n const positionSlots = (\n <>\n {state.bottom ? <state.bottom /> : null}\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n {state.top ? <state.top /> : null}\n </>\n );\n\n if (inline) {\n return (\n <>\n {ariaLive}\n {hasToasts ? positionSlots : null}\n </>\n );\n }\n\n return (\n <>\n {ariaLive}\n {hasToasts ? <Portal mountNode={mountNode}>{positionSlots}</Portal> : null}\n </>\n );\n};\n"],"names":["renderToaster_unstable","state","announceRef","renderAriaLive","inline","mountNode","assertSlots","hasToasts","bottomStart","bottomEnd","topStart","topEnd","top","bottom","ariaLive","_jsx","AriaLive","positionSlots","_jsxs","_Fragment","Portal"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;gCAE4B;6BACL;0BAEE;AAKlB,MAAMA,yBAAyB,CAACC;IACrC,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGJ;IAC3DK,IAAAA,2BAAAA,EAAkCL;IAElC,MAAMM,YACJ,CAAC,CAACN,MAAMO,WAAW,IAAI,CAAC,CAACP,MAAMQ,SAAS,IAAI,CAAC,CAACR,MAAMS,QAAQ,IAAI,CAAC,CAACT,MAAMU,MAAM,IAAI,CAAC,CAACV,MAAMW,GAAG,IAAI,CAAC,CAACX,MAAMY,MAAM;IAEjH,MAAMC,WAAWX,iBAAAA,WAAAA,GAAiBY,IAAAA,eAAA,EAACC,kBAAAA,EAAAA;QAASd,aAAaA;SAAkB;IAC3E,MAAMe,gBAAAA,WAAAA,GACJC,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;YACGlB,MAAMY,MAAM,GAAA,WAAA,GAAGE,IAAAA,eAAA,EAACd,MAAMY,MAAM,EAAA,CAAA,KAAM;YAClCZ,MAAMO,WAAW,GAAA,WAAA,GAAGO,IAAAA,eAAA,EAACd,MAAMO,WAAW,EAAA,CAAA,KAAM;YAC5CP,MAAMQ,SAAS,GAAA,WAAA,GAAGM,IAAAA,eAAA,EAACd,MAAMQ,SAAS,EAAA,CAAA,KAAM;YACxCR,MAAMS,QAAQ,GAAA,WAAA,GAAGK,IAAAA,eAAA,EAACd,MAAMS,QAAQ,EAAA,CAAA,KAAM;YACtCT,MAAMU,MAAM,GAAA,WAAA,GAAGI,IAAAA,eAAA,EAACd,MAAMU,MAAM,EAAA,CAAA,KAAM;YAClCV,MAAMW,GAAG,GAAA,WAAA,GAAGG,IAAAA,eAAA,EAACd,MAAMW,GAAG,EAAA,CAAA,KAAM;;;IAIjC,IAAIR,QAAQ;QACV,OAAA,WAAA,GACEc,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;gBACGL;gBACAP,YAAYU,gBAAgB;;;IAGnC;IAEA,OAAA,WAAA,GACEC,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;YACGL;YACAP,YAAAA,WAAAA,GAAYQ,IAAAA,eAAA,EAACK,mBAAAA,EAAAA;gBAAOf,WAAWA;0BAAYY;iBAA0B;;;AAG5E"}

Some files were not shown because too many files have changed in this diff Show More