Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,13 @@
'use client';
import * as React from 'react';
import { useAriaLive_unstable } from './useAriaLive';
import { renderAriaLive_unstable } from './renderAriaLive';
import { useAriaLiveStyles_unstable } from './useAriaLiveStyles.styles';
/**
* A component that manages aria live announcements imperatively
*/ export const AriaLive = (props)=>{
const state = useAriaLive_unstable(props);
useAriaLiveStyles_unstable(state);
return renderAriaLive_unstable(state);
};
AriaLive.displayName = 'AriaLive';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/AriaLive.tsx"],"sourcesContent":["'use client';\n\nimport * 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":["React","useAriaLive_unstable","renderAriaLive_unstable","useAriaLiveStyles_unstable","AriaLive","props","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,6BAA6B;AAGxE;;CAEC,GACD,OAAO,MAAMC,WAAoCC,CAAAA;IAC/C,MAAMC,QAAQL,qBAAqBI;IAEnCF,2BAA2BG;IAC3B,OAAOJ,wBAAwBI;AACjC,EAAE;AAEFF,SAASG,WAAW,GAAG"}

View File

@@ -0,0 +1 @@
import * as React from 'react';

View File

@@ -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 children?: React.ReactNode;\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":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}

View File

@@ -0,0 +1,4 @@
export { AriaLive } from './AriaLive';
export { renderAriaLive_unstable } from './renderAriaLive';
export { useAriaLive_unstable } from './useAriaLive';
export { ariaLiveClassNames, useAriaLiveStyles_unstable } from './useAriaLiveStyles.styles';

View File

@@ -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","renderAriaLive_unstable","useAriaLive_unstable","ariaLiveClassNames","useAriaLiveStyles_unstable"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AAUtC,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,6BAA6B"}

View File

@@ -0,0 +1,13 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of AriaLive
*/ export const renderAriaLive_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx(state.assertive, {}),
/*#__PURE__*/ _jsx(state.polite, {})
]
});
};

View File

@@ -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 { JSXElement } 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): JSXElement => {\n assertSlots<AriaLiveSlots>(state);\n\n return (\n <>\n <state.assertive />\n <state.polite />\n </>\n );\n};\n"],"names":["assertSlots","renderAriaLive_unstable","state","assertive","polite"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtCF,YAA2BE;IAE3B,qBACE;;0BACE,KAACA,MAAMC,SAAS;0BAChB,KAACD,MAAME,MAAM;;;AAGnB,EAAE"}

View File

@@ -0,0 +1,77 @@
'use client';
import * as React from 'react';
import { createPriorityQueue, useEventCallback, slot, useTimeout } from '@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;
/**
* Create the state required to render AriaLive.
*
* The returned state can be modified with hooks such as useAriaLiveStyles_unstable,
* before being passed to renderAriaLive_unstable.
*
* @param props - props from this instance of AriaLive
*/ export 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(()=>createPriorityQueue((a, b)=>{
if (a.politeness === b.politeness) {
return a.createdAt - b.createdAt;
}
return a.politeness === 'assertive' ? -1 : 1;
}));
const announce = 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] = 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: slot.always(props.assertive, {
defaultProps: {
'aria-live': 'assertive',
children: assertiveMessage
},
elementType: 'div'
}),
polite: slot.always(props.polite, {
defaultProps: {
'aria-live': 'polite',
children: politeMessage
},
elementType: 'div'
})
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/useAriaLive.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPriorityQueue, useEventCallback, slot, useTimeout } from '@fluentui/react-utilities';\nimport type { AnnounceOptions, AriaLiveProps, AriaLiveState, LiveMessage } from './AriaLive.types';\n\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */\nconst MESSAGE_DURATION = 500;\n\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */\nexport const useAriaLive_unstable = (props: AriaLiveProps): AriaLiveState => {\n const [currentMessage, setCurrentMessage] = React.useState<LiveMessage | undefined>(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(() =>\n createPriorityQueue<LiveMessage>((a, b) => {\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n\n return a.politeness === 'assertive' ? -1 : 1;\n }),\n );\n\n const announce = useEventCallback((message: string, options: AnnounceOptions) => {\n const { politeness } = options;\n if (message === currentMessage?.message) {\n return;\n }\n\n const liveMessage: LiveMessage = {\n message,\n politeness,\n createdAt: order.current++,\n };\n\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n\n const [setMessageTimeout, clearMessageTimeout] = useTimeout();\n\n React.useEffect(() => {\n setMessageTimeout(() => {\n if (messageQueue.peek()) {\n setCurrentMessage(messageQueue.dequeue());\n } else {\n setCurrentMessage(undefined);\n }\n }, MESSAGE_DURATION);\n\n return () => clearMessageTimeout();\n }, [currentMessage, messageQueue, setMessageTimeout, clearMessageTimeout]);\n\n React.useImperativeHandle(props.announceRef, () => announce);\n\n const politeMessage = currentMessage?.politeness === 'polite' ? currentMessage.message : undefined;\n const assertiveMessage = currentMessage?.politeness === 'assertive' ? currentMessage.message : undefined;\n\n return {\n components: {\n assertive: 'div',\n polite: 'div',\n },\n\n assertive: slot.always(props.assertive, {\n defaultProps: { 'aria-live': 'assertive', children: assertiveMessage },\n elementType: 'div',\n }),\n polite: slot.always(props.polite, {\n defaultProps: { 'aria-live': 'polite', children: politeMessage },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","createPriorityQueue","useEventCallback","slot","useTimeout","MESSAGE_DURATION","useAriaLive_unstable","props","currentMessage","setCurrentMessage","useState","undefined","order","useRef","messageQueue","a","b","politeness","createdAt","announce","message","options","liveMessage","current","enqueue","setMessageTimeout","clearMessageTimeout","useEffect","peek","dequeue","useImperativeHandle","announceRef","politeMessage","assertiveMessage","components","assertive","polite","always","defaultProps","children","elementType"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,4BAA4B;AAGpG,gHAAgH,GAChH,MAAMC,mBAAmB;AAEzB;;;;;;;CAOC,GACD,OAAO,MAAMC,uBAAuB,CAACC;IACnC,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGT,MAAMU,QAAQ,CAA0BC;IACpF,mFAAmF;IACnF,MAAMC,QAAQZ,MAAMa,MAAM,CAAC;IAC3B,MAAM,CAACC,aAAa,GAAGd,MAAMU,QAAQ,CAAC,IACpCT,oBAAiC,CAACc,GAAGC;YACnC,IAAID,EAAEE,UAAU,KAAKD,EAAEC,UAAU,EAAE;gBACjC,OAAOF,EAAEG,SAAS,GAAGF,EAAEE,SAAS;YAClC;YAEA,OAAOH,EAAEE,UAAU,KAAK,cAAc,CAAC,IAAI;QAC7C;IAGF,MAAME,WAAWjB,iBAAiB,CAACkB,SAAiBC;QAClD,MAAM,EAAEJ,UAAU,EAAE,GAAGI;QACvB,IAAID,aAAYZ,2BAAAA,qCAAAA,eAAgBY,OAAO,GAAE;YACvC;QACF;QAEA,MAAME,cAA2B;YAC/BF;YACAH;YACAC,WAAWN,MAAMW,OAAO;QAC1B;QAEA,IAAI,CAACf,gBAAgB;YACnBC,kBAAkBa;QACpB,OAAO;YACLR,aAAaU,OAAO,CAACF;QACvB;IACF;IAEA,MAAM,CAACG,mBAAmBC,oBAAoB,GAAGtB;IAEjDJ,MAAM2B,SAAS,CAAC;QACdF,kBAAkB;YAChB,IAAIX,aAAac,IAAI,IAAI;gBACvBnB,kBAAkBK,aAAae,OAAO;YACxC,OAAO;gBACLpB,kBAAkBE;YACpB;QACF,GAAGN;QAEH,OAAO,IAAMqB;IACf,GAAG;QAAClB;QAAgBM;QAAcW;QAAmBC;KAAoB;IAEzE1B,MAAM8B,mBAAmB,CAACvB,MAAMwB,WAAW,EAAE,IAAMZ;IAEnD,MAAMa,gBAAgBxB,CAAAA,2BAAAA,qCAAAA,eAAgBS,UAAU,MAAK,WAAWT,eAAeY,OAAO,GAAGT;IACzF,MAAMsB,mBAAmBzB,CAAAA,2BAAAA,qCAAAA,eAAgBS,UAAU,MAAK,cAAcT,eAAeY,OAAO,GAAGT;IAE/F,OAAO;QACLuB,YAAY;YACVC,WAAW;YACXC,QAAQ;QACV;QAEAD,WAAWhC,KAAKkC,MAAM,CAAC9B,MAAM4B,SAAS,EAAE;YACtCG,cAAc;gBAAE,aAAa;gBAAaC,UAAUN;YAAiB;YACrEO,aAAa;QACf;QACAJ,QAAQjC,KAAKkC,MAAM,CAAC9B,MAAM6B,MAAM,EAAE;YAChCE,cAAc;gBAAE,aAAa;gBAAUC,UAAUP;YAAc;YAC/DQ,aAAa;QACf;IACF;AACF,EAAE"}

View File

@@ -0,0 +1,22 @@
'use client';
import { mergeClasses, __resetStyles } from '@griffel/react';
export const ariaLiveClassNames = {
assertive: 'fui-AriaLive__assertive',
polite: 'fui-AriaLive__polite'
};
/**
* Styles for the root slot
*/
const useResetStyles = /*#__PURE__*/__resetStyles("rrd10u0", null, [".rrd10u0{clip:rect(0px, 0px, 0px, 0px);height:1px;margin:-1px;overflow:hidden;padding:0px;width:1px;position:absolute;}"]);
/**
* Apply styling to the AriaLive slots based on the state
*/
export const useAriaLiveStyles_unstable = state => {
'use no memo';
const visuallyHidden = useResetStyles();
state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["mergeClasses","__resetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"sources":["useAriaLiveStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"mappings":"AAAA,YAAY;;AACZ,SAASA,YAAY,EAAAC,aAAA,QAAyB,gBAAgB;AAC9D,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,SAAS,EAAE,yBAAyB;EACpCC,MAAM,EAAE;AACZ,CAAC;AACD;AACA;AACA;AAAI,MAAMC,cAAc,gBAAGJ,aAAA,6IAQ1B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,0BAA0B,GAAIC,KAAK,IAAG;EACnD,aAAa;;EACb,MAAMC,cAAc,GAAGH,cAAc,CAAC,CAAC;EACvCE,KAAK,CAACJ,SAAS,CAACM,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACC,SAAS,EAAEI,KAAK,CAACJ,SAAS,CAACM,SAAS,CAAC;EACjHF,KAAK,CAACH,MAAM,CAACK,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACE,MAAM,EAAEG,KAAK,CAACH,MAAM,CAACK,SAAS,CAAC;EACxG,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,26 @@
'use client';
import { mergeClasses, makeResetStyles } from '@griffel/react';
export const ariaLiveClassNames = {
assertive: 'fui-AriaLive__assertive',
polite: 'fui-AriaLive__polite'
};
/**
* Styles for the root slot
*/ const useResetStyles = makeResetStyles({
clip: 'rect(0px, 0px, 0px, 0px)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0px',
width: '1px',
position: 'absolute'
});
/**
* Apply styling to the AriaLive slots based on the state
*/ export const useAriaLiveStyles_unstable = (state)=>{
'use no memo';
const visuallyHidden = useResetStyles();
state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/AriaLive/useAriaLiveStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { mergeClasses, makeResetStyles } from '@griffel/react';\nimport type { AriaLiveSlots, AriaLiveState } from './AriaLive.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const ariaLiveClassNames: SlotClassNames<AriaLiveSlots> = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite',\n};\n\n/**\n * Styles for the root slot\n */\nconst 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/**\n * Apply styling to the AriaLive slots based on the state\n */\nexport const useAriaLiveStyles_unstable = (state: AriaLiveState): AriaLiveState => {\n 'use no memo';\n\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\n return state;\n};\n"],"names":["mergeClasses","makeResetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","clip","height","margin","overflow","padding","width","position","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"mappings":"AAAA;AAEA,SAASA,YAAY,EAAEC,eAAe,QAAQ,iBAAiB;AAI/D,OAAO,MAAMC,qBAAoD;IAC/DC,WAAW;IACXC,QAAQ;AACV,EAAE;AAEF;;CAEC,GACD,MAAMC,iBAAiBJ,gBAAgB;IACrCK,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC,OAAO;IACPC,UAAU;AACZ;AAEA;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzC;IAEA,MAAMC,iBAAiBV;IACvBS,MAAMX,SAAS,CAACa,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBC,SAAS,EAAEW,MAAMX,SAAS,CAACa,SAAS;IAChHF,MAAMV,MAAM,CAACY,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBE,MAAM,EAAEU,MAAMV,MAAM,CAACY,SAAS;IAEvG,OAAOF;AACT,EAAE"}

View File

@@ -0,0 +1,22 @@
'use client';
import * as React from 'react';
import { useBaseAnimationStyles } from './useTimerStyles.styles';
export const Timer = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const baseAnimationStyles = 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';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Timer/Timer.tsx"],"sourcesContent":["'use client';\n\nimport * 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":["React","useBaseAnimationStyles","Timer","forwardRef","props","ref","baseAnimationStyles","running","timeout","onTimeout","style","animationDuration","animationPlayState","span","onAnimationEnd","data-timer-status","className","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,0BAA0B;AAUjE,OAAO,MAAMC,sBAAQF,MAAMG,UAAU,CAA6B,CAACC,OAAOC;IACxE,MAAMC,sBAAsBL;IAC5B,MAAM,EAAEM,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGL;IAExC,MAAMM,QAA6B;QACjCC,mBAAmB,GAAGH,QAAQ,EAAE,CAAC;QACjCI,oBAAoBL,UAAU,YAAY;IAC5C;IAEA,IAAIC,UAAU,GAAG;QACf,OAAO;IACT;IAEA,qBACE,oBAACK;QACCC,gBAAgBL;QAChBM,qBAAmBL,MAAME,kBAAkB;QAC3CP,KAAKA;QACLK,OAAOA;QACPM,WAAWV;;AAGjB,GAAG;AAEHJ,MAAMe,WAAW,GAAG"}

View File

@@ -0,0 +1 @@
export { Timer } from './Timer';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Timer/index.ts"],"sourcesContent":["export type { TimerProps } from './Timer';\nexport { Timer } from './Timer';\n"],"names":["Timer"],"mappings":"AACA,SAASA,KAAK,QAAQ,UAAU"}

View File

@@ -0,0 +1,4 @@
'use client';
import { __resetStyles } from '@griffel/react';
export const useBaseAnimationStyles = /*#__PURE__*/__resetStyles("r16zaflb", "r75casi", [".r16zaflb{animation-name:rsacmq1;}", "@keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}", ".r75casi{animation-name:rsacmq1;}"]);

View File

@@ -0,0 +1 @@
{"version":3,"names":["__resetStyles","useBaseAnimationStyles"],"sources":["useTimerStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,QAAgC,gBAAgB;AAChD,OAAO,MAAMC,sBAAsB,gBAAGD,aAAA,yJASrC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,12 @@
'use client';
import { makeResetStyles } from '@griffel/react';
export const useBaseAnimationStyles = makeResetStyles({
animationName: {
from: {
opacity: 0
},
to: {
opacity: 0
}
}
});

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Timer/useTimerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles } from '@griffel/react';\n\nexport const useBaseAnimationStyles = makeResetStyles({\n animationName: {\n from: {\n opacity: 0,\n },\n to: {\n opacity: 0,\n },\n },\n});\n"],"names":["makeResetStyles","useBaseAnimationStyles","animationName","from","opacity","to"],"mappings":"AAAA;AAEA,SAASA,eAAe,QAAQ,iBAAiB;AAEjD,OAAO,MAAMC,yBAAyBD,gBAAgB;IACpDE,eAAe;QACbC,MAAM;YACJC,SAAS;QACX;QACAC,IAAI;YACFD,SAAS;QACX;IACF;AACF,GAAG"}

View File

@@ -0,0 +1,16 @@
'use client';
import * as React from 'react';
import { useToast_unstable } from './useToast';
import { renderToast_unstable } from './renderToast';
import { useToastStyles_unstable } from './useToastStyles.styles';
import { useToastContextValues_unstable } from './useToastContextValues';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* Toast component
*/ export const Toast = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useToast_unstable(props, ref);
useToastStyles_unstable(state);
useCustomStyleHook_unstable('useToastStyles_unstable')(state);
return renderToast_unstable(state, useToastContextValues_unstable(state));
});
Toast.displayName = 'Toast';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * 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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useToastStyles_unstable')(state);\n\n return renderToast_unstable(state, useToastContextValues_unstable(state));\n});\n\nToast.displayName = 'Toast';\n"],"names":["React","useToast_unstable","renderToast_unstable","useToastStyles_unstable","useToastContextValues_unstable","useCustomStyleHook_unstable","Toast","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,sBAAyCN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7E,MAAMC,QAAQT,kBAAkBO,OAAOC;IAEvCN,wBAAwBO;IACxBL,4BAA4B,2BAA2BK;IAEvD,OAAOR,qBAAqBQ,OAAON,+BAA+BM;AACpE,GAAG;AAEHJ,MAAMK,WAAW,GAAG"}

View File

@@ -0,0 +1,3 @@
/**
* State used in rendering Toast
*/ export { };

View File

@@ -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":[],"mappings":"AAmBA;;CAEC,GACD,WAGE"}

View File

@@ -0,0 +1,4 @@
export { Toast } from './Toast';
export { renderToast_unstable } from './renderToast';
export { useToast_unstable } from './useToast';
export { toastClassNames, useToastStyles_unstable } from './useToastStyles.styles';

View File

@@ -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","useToast_unstable","toastClassNames","useToastStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAEhC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}

View File

@@ -0,0 +1,12 @@
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
import { BackgroundAppearanceProvider } from '@fluentui/react-shared-contexts';
/**
* Render the final JSX of Toast
*/ export const renderToast_unstable = (state, contextValues)=>{
assertSlots(state);
return /*#__PURE__*/ _jsx(BackgroundAppearanceProvider, {
value: contextValues.backgroundAppearance,
children: /*#__PURE__*/ _jsx(state.root, {})
});
};

View File

@@ -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 type { JSXElement } 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): JSXElement => {\n assertSlots<ToastSlots>(state);\n\n return (\n <BackgroundAppearanceProvider value={contextValues.backgroundAppearance}>\n <state.root />\n </BackgroundAppearanceProvider>\n );\n};\n"],"names":["assertSlots","BackgroundAppearanceProvider","renderToast_unstable","state","contextValues","value","backgroundAppearance","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,4BAA4B,QAAQ,kCAAkC;AAG/E;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC;IACtDJ,YAAwBG;IAExB,qBACE,KAACF;QAA6BI,OAAOD,cAAcE,oBAAoB;kBACrE,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}

View File

@@ -0,0 +1,31 @@
'use client';
import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import { useToastContainerContext } from '../../contexts/toastContainerContext';
/**
* Create the state required to render Toast.
*
* The returned state can be modified with hooks such as useToastStyles_unstable,
* before being passed to renderToast_unstable.
*
* @param props - props from this instance of Toast
* @param ref - reference to root HTMLElement of Toast
*/ export const useToast_unstable = (props, ref)=>{
const { intent } = useToastContainerContext();
return {
components: {
root: 'div'
},
root: slot.always(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
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["'use client';\n\nimport * 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":["React","getIntrinsicElementProps","slot","useToastContainerContext","useToast_unstable","props","ref","intent","components","root","always","elementType","backgroundAppearance","appearance"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,MAAM,EAAE,GAAGJ;IAEnB,OAAO;QACLK,YAAY;YACVC,MAAM;QACR;QACAA,MAAMP,KAAKQ,MAAM,CACfT,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FK,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;QAEvBC,sBAAsBP,MAAMQ,UAAU;QACtCN;IACF;AACF,EAAE"}

View File

@@ -0,0 +1,6 @@
export function useToastContextValues_unstable(state) {
const { backgroundAppearance } = state;
return {
backgroundAppearance
};
}

View File

@@ -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"],"mappings":"AAEA,OAAO,SAASA,+BAA+BC,KAAiB;IAC9D,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;IAEjC,OAAO;QACLC;IACF;AACF"}

View File

@@ -0,0 +1,27 @@
'use client';
import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastClassNames = {
root: 'fui-Toast'
};
const useRootBaseClassName = /*#__PURE__*/__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__*/__styles({
inverted: {
sj55zd: "f1w7i9ko",
De3pzq: "f5pduvr"
}
}, {
d: [".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}", ".f5pduvr{background-color:var(--colorNeutralBackgroundInverted);}"]
});
/**
* Apply styling to the Toast slots based on the state
*/
export const useToastStyles_unstable = state => {
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const styles = useStyles();
state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","toastClassNames","root","useRootBaseClassName","useStyles","inverted","sj55zd","De3pzq","d","useToastStyles_unstable","state","rootBaseClassName","styles","className","backgroundAppearance"],"sources":["useToastStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,eAAe,GAAG;EAC3BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGN,aAAA,4XAY5B,CAAC;AACF,MAAMO,SAAS,gBAAGN,QAAA;EAAAO,QAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAKjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,uBAAuB,GAAIC,KAAK,IAAG;EAChD,aAAa;;EACb,MAAMC,iBAAiB,GAAGR,oBAAoB,CAAC,CAAC;EAChD,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1BM,KAAK,CAACR,IAAI,CAACW,SAAS,GAAGd,YAAY,CAACE,eAAe,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACI,oBAAoB,KAAK,UAAU,IAAIF,MAAM,CAACP,QAAQ,EAAEK,KAAK,CAACR,IAAI,CAACW,SAAS,CAAC;EAChK,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,34 @@
'use client';
import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastClassNames = {
root: 'fui-Toast'
};
const useRootBaseClassName = makeResetStyles({
display: 'grid',
gridTemplateColumns: 'auto 1fr auto',
padding: '12px',
borderRadius: tokens.borderRadiusMedium,
border: `1px solid ${tokens.colorTransparentStroke}`,
boxShadow: tokens.shadow8,
fontSize: tokens.fontSizeBase300,
lineHeight: '20px',
fontWeight: tokens.fontWeightSemibold,
color: tokens.colorNeutralForeground1,
backgroundColor: tokens.colorNeutralBackground1
});
const useStyles = makeStyles({
inverted: {
color: tokens.colorNeutralForegroundInverted2,
backgroundColor: tokens.colorNeutralBackgroundInverted
}
});
/**
* Apply styling to the Toast slots based on the state
*/ export const useToastStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const styles = useStyles();
state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Toast/useToastStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ToastSlots, ToastState } from './Toast.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const toastClassNames: SlotClassNames<ToastSlots> = {\n root: 'fui-Toast',\n};\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});\n\nconst useStyles = makeStyles({\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted,\n },\n});\n\n/**\n * Apply styling to the Toast slots based on the state\n */\nexport const useToastStyles_unstable = (state: ToastState): ToastState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(\n toastClassNames.root,\n rootBaseClassName,\n state.backgroundAppearance === 'inverted' && styles.inverted,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","toastClassNames","root","useRootBaseClassName","display","gridTemplateColumns","padding","borderRadius","borderRadiusMedium","border","colorTransparentStroke","boxShadow","shadow8","fontSize","fontSizeBase300","lineHeight","fontWeight","fontWeightSemibold","color","colorNeutralForeground1","backgroundColor","colorNeutralBackground1","useStyles","inverted","colorNeutralForegroundInverted2","colorNeutralBackgroundInverted","useToastStyles_unstable","state","rootBaseClassName","styles","className","backgroundAppearance"],"mappings":"AAAA;AAEA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC3E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,OAAO,MAAMC,kBAA8C;IACzDC,MAAM;AACR,EAAE;AAEF,MAAMC,uBAAuBN,gBAAgB;IAC3CO,SAAS;IACTC,qBAAqB;IACrBC,SAAS;IACTC,cAAcP,OAAOQ,kBAAkB;IACvCC,QAAQ,CAAC,UAAU,EAAET,OAAOU,sBAAsB,EAAE;IACpDC,WAAWX,OAAOY,OAAO;IACzBC,UAAUb,OAAOc,eAAe;IAChCC,YAAY;IACZC,YAAYhB,OAAOiB,kBAAkB;IACrCC,OAAOlB,OAAOmB,uBAAuB;IACrCC,iBAAiBpB,OAAOqB,uBAAuB;AACjD;AAEA,MAAMC,YAAYxB,WAAW;IAC3ByB,UAAU;QACRL,OAAOlB,OAAOwB,+BAA+B;QAC7CJ,iBAAiBpB,OAAOyB,8BAA8B;IACxD;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC;IAEA,MAAMC,oBAAoBzB;IAC1B,MAAM0B,SAASP;IACfK,MAAMzB,IAAI,CAAC4B,SAAS,GAAG/B,aACrBE,gBAAgBC,IAAI,EACpB0B,mBACAD,MAAMI,oBAAoB,KAAK,cAAcF,OAAON,QAAQ,EAC5DI,MAAMzB,IAAI,CAAC4B,SAAS;IAGtB,OAAOH;AACT,EAAE"}

View File

@@ -0,0 +1,15 @@
'use client';
import * as React from 'react';
import { useToastBody_unstable } from './useToastBody';
import { renderToastBody_unstable } from './renderToastBody';
import { useToastBodyStyles_unstable } from './useToastBodyStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* ToastBody component
*/ export const ToastBody = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useToastBody_unstable(props, ref);
useToastBodyStyles_unstable(state);
useCustomStyleHook_unstable('useToastBodyStyles_unstable')(state);
return renderToastBody_unstable(state);
});
ToastBody.displayName = 'ToastBody';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/ToastBody.tsx"],"sourcesContent":["'use client';\n\nimport * 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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useToastBodyStyles_unstable')(state);\n\n return renderToastBody_unstable(state);\n});\n\nToastBody.displayName = 'ToastBody';\n"],"names":["React","useToastBody_unstable","renderToastBody_unstable","useToastBodyStyles_unstable","useCustomStyleHook_unstable","ToastBody","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,8BAA8B;AAG1E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,0BAAiDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACrF,MAAMC,QAAQR,sBAAsBM,OAAOC;IAE3CL,4BAA4BM;IAC5BL,4BAA4B,+BAA+BK;IAE3D,OAAOP,yBAAyBO;AAClC,GAAG;AAEHJ,UAAUK,WAAW,GAAG"}

View File

@@ -0,0 +1,3 @@
/**
* State used in rendering ToastBody
*/ export { };

View File

@@ -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":[],"mappings":"AAaA;;CAEC,GACD,WAEE"}

View File

@@ -0,0 +1,4 @@
export { ToastBody } from './ToastBody';
export { renderToastBody_unstable } from './renderToastBody';
export { useToastBody_unstable } from './useToastBody';
export { toastBodyClassNames, useToastBodyStyles_unstable } from './useToastBodyStyles.styles';

View File

@@ -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","useToastBody_unstable","toastBodyClassNames","useToastBodyStyles_unstable"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,mBAAmB,EAAEC,2BAA2B,QAAQ,8BAA8B"}

View File

@@ -0,0 +1,13 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of ToastBody
*/ export const renderToastBody_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx(state.root, {}),
state.subtitle ? /*#__PURE__*/ _jsx(state.subtitle, {}) : null
]
});
};

View File

@@ -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 { JSXElement } 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): JSXElement => {\n assertSlots<ToastBodySlots>(state);\n\n return (\n <>\n <state.root />\n {state.subtitle ? <state.subtitle /> : null}\n </>\n );\n};\n"],"names":["assertSlots","renderToastBody_unstable","state","root","subtitle"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,qBACE;;0BACE,KAACA,MAAMC,IAAI;YACVD,MAAME,QAAQ,iBAAG,KAACF,MAAME,QAAQ,QAAM;;;AAG7C,EAAE"}

View File

@@ -0,0 +1,37 @@
'use client';
import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import { useToastContainerContext } from '../../contexts/toastContainerContext';
import { useBackgroundAppearance } from '@fluentui/react-shared-contexts';
/**
* Create the state required to render ToastBody.
*
* The returned state can be modified with hooks such as useToastBodyStyles_unstable,
* before being passed to renderToastBody_unstable.
*
* @param props - props from this instance of ToastBody
* @param ref - reference to root HTMLElement of ToastBody
*/ export const useToastBody_unstable = (props, ref)=>{
const backgroundAppearance = useBackgroundAppearance();
const { bodyId } = useToastContainerContext();
return {
components: {
root: 'div',
subtitle: 'div'
},
subtitle: slot.optional(props.subtitle, {
elementType: 'div'
}),
root: slot.always(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
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/useToastBody.ts"],"sourcesContent":["'use client';\n\nimport * 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":["React","getIntrinsicElementProps","slot","useToastContainerContext","useBackgroundAppearance","useToastBody_unstable","props","ref","backgroundAppearance","bodyId","components","root","subtitle","optional","elementType","always","id"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,wBAAwB,QAAQ,uCAAuC;AAChF,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAMC,uBAAuBJ;IAC7B,MAAM,EAAEK,MAAM,EAAE,GAAGN;IACnB,OAAO;QACLO,YAAY;YACVC,MAAM;YACNC,UAAU;QACZ;QACAA,UAAUV,KAAKW,QAAQ,CAACP,MAAMM,QAAQ,EAAE;YAAEE,aAAa;QAAM;QAC7DH,MAAMT,KAAKa,MAAM,CACfd,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FM,KAAKA;YACLS,IAAIP;YACJ,GAAGH,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;QAEvBN;IACF;AACF,EAAE"}

View File

@@ -0,0 +1,35 @@
'use client';
import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastBodyClassNames = {
root: 'fui-ToastBody',
subtitle: 'fui-ToastBody__subtitle'
};
const useRootBaseClassName = /*#__PURE__*/__resetStyles("r1u44l4o", null, [".r1u44l4o{grid-column-start:2;grid-column-end:3;padding-top:6px;font-size:var(--fontSizeBase300);line-height:var(--lineHeightBase300);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground1);word-break:break-word;}"]);
const useSubtitleBaseClassName = /*#__PURE__*/__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__*/__styles({
root: {
sj55zd: "f1w7i9ko"
},
subtitle: {
sj55zd: "f1w7i9ko"
}
}, {
d: [".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}"]
});
/**
* Apply styling to the ToastBody slots based on the state
*/
export const useToastBodyStyles_unstable = state => {
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const subtitleBaseClassName = useSubtitleBaseClassName();
const invertedStyles = useInvertedStyles();
state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.subtitle) {
state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);
}
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","toastBodyClassNames","root","subtitle","useRootBaseClassName","useSubtitleBaseClassName","useInvertedStyles","sj55zd","d","useToastBodyStyles_unstable","state","rootBaseClassName","subtitleBaseClassName","invertedStyles","className","backgroundAppearance"],"sources":["useToastBodyStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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.lineHeightBase300,\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"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,mBAAmB,GAAG;EAC/BC,IAAI,EAAE,eAAe;EACrBC,QAAQ,EAAE;AACd,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,8PAS5B,CAAC;AACF,MAAMQ,wBAAwB,gBAAGR,aAAA,oOAQhC,CAAC;AACF,MAAMS,iBAAiB,gBAAGR,QAAA;EAAAI,IAAA;IAAAK,MAAA;EAAA;EAAAJ,QAAA;IAAAI,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAOzB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,2BAA2B,GAAIC,KAAK,IAAG;EACpD,aAAa;;EACb,MAAMC,iBAAiB,GAAGP,oBAAoB,CAAC,CAAC;EAChD,MAAMQ,qBAAqB,GAAGP,wBAAwB,CAAC,CAAC;EACxD,MAAMQ,cAAc,GAAGP,iBAAiB,CAAC,CAAC;EAC1CI,KAAK,CAACR,IAAI,CAACY,SAAS,GAAGf,YAAY,CAACE,mBAAmB,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACK,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACX,IAAI,EAAEQ,KAAK,CAACR,IAAI,CAACY,SAAS,CAAC;EACxK,IAAIJ,KAAK,CAACP,QAAQ,EAAE;IAChBO,KAAK,CAACP,QAAQ,CAACW,SAAS,GAAGf,YAAY,CAACE,mBAAmB,CAACE,QAAQ,EAAES,qBAAqB,EAAEF,KAAK,CAACK,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACV,QAAQ,EAAEO,KAAK,CAACP,QAAQ,CAACW,SAAS,CAAC;EAChM;EACA,OAAOJ,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,47 @@
'use client';
import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastBodyClassNames = {
root: 'fui-ToastBody',
subtitle: 'fui-ToastBody__subtitle'
};
const useRootBaseClassName = makeResetStyles({
gridColumnStart: 2,
gridColumnEnd: 3,
paddingTop: '6px',
fontSize: tokens.fontSizeBase300,
lineHeight: tokens.lineHeightBase300,
fontWeight: tokens.fontWeightRegular,
color: tokens.colorNeutralForeground1,
wordBreak: 'break-word'
});
const useSubtitleBaseClassName = makeResetStyles({
paddingTop: '4px',
gridColumnStart: 2,
gridColumnEnd: 3,
fontSize: tokens.fontSizeBase200,
lineHeight: tokens.fontSizeBase200,
fontWeight: tokens.fontWeightRegular,
color: tokens.colorNeutralForeground2
});
const useInvertedStyles = makeStyles({
root: {
color: tokens.colorNeutralForegroundInverted2
},
subtitle: {
color: tokens.colorNeutralForegroundInverted2
}
});
/**
* Apply styling to the ToastBody slots based on the state
*/ export const useToastBodyStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
const subtitleBaseClassName = useSubtitleBaseClassName();
const invertedStyles = useInvertedStyles();
state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.subtitle) {
state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);
}
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastBody/useToastBodyStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ToastBodySlots, ToastBodyState } from './ToastBody.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const toastBodyClassNames: SlotClassNames<ToastBodySlots> = {\n root: 'fui-ToastBody',\n subtitle: 'fui-ToastBody__subtitle',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n gridColumnStart: 2,\n gridColumnEnd: 3,\n paddingTop: '6px',\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n fontWeight: tokens.fontWeightRegular,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word',\n});\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});\n\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n subtitle: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n});\n\n/**\n * Apply styling to the ToastBody slots based on the state\n */\nexport const useToastBodyStyles_unstable = (state: ToastBodyState): ToastBodyState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const subtitleBaseClassName = useSubtitleBaseClassName();\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(\n toastBodyClassNames.root,\n rootBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.root,\n state.root.className,\n );\n\n if (state.subtitle) {\n state.subtitle.className = mergeClasses(\n toastBodyClassNames.subtitle,\n subtitleBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.subtitle,\n state.subtitle.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","toastBodyClassNames","root","subtitle","useRootBaseClassName","gridColumnStart","gridColumnEnd","paddingTop","fontSize","fontSizeBase300","lineHeight","lineHeightBase300","fontWeight","fontWeightRegular","color","colorNeutralForeground1","wordBreak","useSubtitleBaseClassName","fontSizeBase200","colorNeutralForeground2","useInvertedStyles","colorNeutralForegroundInverted2","useToastBodyStyles_unstable","state","rootBaseClassName","subtitleBaseClassName","invertedStyles","className","backgroundAppearance"],"mappings":"AAAA;AAEA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC3E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,MAAMC,uBAAuBP,gBAAgB;IAC3CQ,iBAAiB;IACjBC,eAAe;IACfC,YAAY;IACZC,UAAUR,OAAOS,eAAe;IAChCC,YAAYV,OAAOW,iBAAiB;IACpCC,YAAYZ,OAAOa,iBAAiB;IACpCC,OAAOd,OAAOe,uBAAuB;IACrCC,WAAW;AACb;AAEA,MAAMC,2BAA2BpB,gBAAgB;IAC/CU,YAAY;IACZF,iBAAiB;IACjBC,eAAe;IACfE,UAAUR,OAAOkB,eAAe;IAChCR,YAAYV,OAAOkB,eAAe;IAClCN,YAAYZ,OAAOa,iBAAiB;IACpCC,OAAOd,OAAOmB,uBAAuB;AACvC;AAEA,MAAMC,oBAAoBtB,WAAW;IACnCI,MAAM;QACJY,OAAOd,OAAOqB,+BAA+B;IAC/C;IACAlB,UAAU;QACRW,OAAOd,OAAOqB,+BAA+B;IAC/C;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,8BAA8B,CAACC;IAC1C;IAEA,MAAMC,oBAAoBpB;IAC1B,MAAMqB,wBAAwBR;IAC9B,MAAMS,iBAAiBN;IACvBG,MAAMrB,IAAI,CAACyB,SAAS,GAAG5B,aACrBE,oBAAoBC,IAAI,EACxBsB,mBACAD,MAAMK,oBAAoB,KAAK,cAAcF,eAAexB,IAAI,EAChEqB,MAAMrB,IAAI,CAACyB,SAAS;IAGtB,IAAIJ,MAAMpB,QAAQ,EAAE;QAClBoB,MAAMpB,QAAQ,CAACwB,SAAS,GAAG5B,aACzBE,oBAAoBE,QAAQ,EAC5BsB,uBACAF,MAAMK,oBAAoB,KAAK,cAAcF,eAAevB,QAAQ,EACpEoB,MAAMpB,QAAQ,CAACwB,SAAS;IAE5B;IAEA,OAAOJ;AACT,EAAE"}

View File

@@ -0,0 +1,16 @@
'use client';
import * as React from 'react';
import { useToastContainer_unstable } from './useToastContainer';
import { renderToastContainer_unstable } from './renderToastContainer';
import { useToastContainerStyles_unstable } from './useToastContainerStyles.styles';
import { useToastContainerContextValues_unstable } from './useToastContainerContextValues';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* ToastContainer component
*/ export const ToastContainer = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useToastContainer_unstable(props, ref);
useToastContainerStyles_unstable(state);
useCustomStyleHook_unstable('useToastContainerStyles_unstable')(state);
return renderToastContainer_unstable(state, useToastContainerContextValues_unstable(state));
});
ToastContainer.displayName = 'ToastContainer';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/ToastContainer.tsx"],"sourcesContent":["'use client';\n\nimport * 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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useToastContainerStyles_unstable')(state);\n\n return renderToastContainer_unstable(state, useToastContainerContextValues_unstable(state));\n});\n\nToastContainer.displayName = 'ToastContainer';\n"],"names":["React","useToastContainer_unstable","renderToastContainer_unstable","useToastContainerStyles_unstable","useToastContainerContextValues_unstable","useCustomStyleHook_unstable","ToastContainer","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,SAASC,uCAAuC,QAAQ,mCAAmC;AAC3F,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,+BAA2DN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQT,2BAA2BO,OAAOC;IAEhDN,iCAAiCO;IACjCL,4BAA4B,oCAAoCK;IAEhE,OAAOR,8BAA8BQ,OAAON,wCAAwCM;AACtF,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}

View File

@@ -0,0 +1 @@
import * as React from 'react';

View File

@@ -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 now merged with root ref\n */\n nodeRef: React.Ref<HTMLDivElement>;\n\n onMotionFinish?: (event: null, data: { direction: 'enter' | 'exit' }) => void;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}

View File

@@ -0,0 +1,5 @@
export { ToastContainer } from './ToastContainer';
export { renderToastContainer_unstable } from './renderToastContainer';
export { useToastContainer_unstable } from './useToastContainer';
export { toastContainerClassNames, useToastContainerStyles_unstable } from './useToastContainerStyles.styles';
export { useToastContainerContextValues_unstable } from './useToastContainerContextValues';

View File

@@ -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","useToastContainer_unstable","toastContainerClassNames","useToastContainerStyles_unstable","useToastContainerContextValues_unstable"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAOlD,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,wBAAwB,EAAEC,gCAAgC,QAAQ,mCAAmC;AAC9G,SAASC,uCAAuC,QAAQ,mCAAmC"}

View File

@@ -0,0 +1,26 @@
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
import { ToastContainerContextProvider } from '../../contexts/toastContainerContext';
import { CollapseDelayed } from '@fluentui/react-motion-components-preview';
/**
* Render the final JSX of ToastContainer
*/ export const renderToastContainer_unstable = (state, contextValues)=>{
const { onMotionFinish, visible, updateId } = state;
assertSlots(state);
return /*#__PURE__*/ _jsx(ToastContainerContextProvider, {
value: contextValues.toast,
children: /*#__PURE__*/ _jsx(CollapseDelayed, {
appear: true,
onMotionFinish: onMotionFinish,
visible: visible,
unmountOnExit: true,
children: /*#__PURE__*/ _jsxs(state.root, {
children: [
state.root.children,
/*#__PURE__*/ _jsx(state.timer, {}, updateId)
]
})
})
});
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\n'use client';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\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":["assertSlots","ToastContainerContextProvider","CollapseDelayed","renderToastContainer_unstable","state","contextValues","onMotionFinish","visible","updateId","value","toast","appear","unmountOnExit","root","children","timer"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,6BAA6B,QAAQ,uCAAuC;AACrF,SAASC,eAAe,QAAQ,4CAA4C;AAE5E;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9CJ,YAAiCI;IAEjC,qBACE,KAACH;QAA8BQ,OAAOJ,cAAcK,KAAK;kBACvD,cAAA,KAACR;YAAgBS,MAAM;YAACL,gBAAgBA;YAAgBC,SAASA;YAASK,aAAa;sBACrF,cAAA,MAACR,MAAMS,IAAI;;oBACRT,MAAMS,IAAI,CAACC,QAAQ;kCACpB,KAACV,MAAMW,KAAK,MAAMP;;;;;AAK5B,EAAE"}

View File

@@ -0,0 +1,232 @@
'use client';
import * as React from 'react';
import { getIntrinsicElementProps, useMergedRefs, useEventCallback, useId, slot } from '@fluentui/react-utilities';
import { useFluent_unstable } from '@fluentui/react-shared-contexts';
import { Delete, Tab } from '@fluentui/keyboard-keys';
import { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';
import { Timer } from '../Timer/Timer';
const intentPolitenessMap = {
success: 'assertive',
warning: 'assertive',
error: 'assertive',
info: 'polite'
};
/**
* Create the state required to render ToastContainer.
*
* The returned state can be modified with hooks such as useToastContainerStyles_unstable,
* before being passed to renderToastContainer_unstable.
*
* @param props - props from this instance of ToastContainer
* @param ref - reference to root HTMLElement of ToastContainer
*/ export const useToastContainer_unstable = (props, ref)=>{
const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, content: _content, ...rest } = props;
const titleId = useId('toast-title');
const bodyId = useId('toast-body');
const toastRef = React.useRef(null);
const { targetDocument } = useFluent_unstable();
const [running, setRunning] = React.useState(false);
const imperativePauseRef = React.useRef(false);
const focusedToastBeforeClose = React.useRef(false);
const focusableGroupAttribute = 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 = 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 = 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 = useEventCallback(()=>setRunning(false));
const play = 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 = 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 = 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 } = useFocusFinders();
const onKeyDown = useEventCallback((e)=>{
var _userRootSlot_onKeyDown;
if (e.key === Delete) {
e.preventDefault();
close();
}
if (e.key === 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,
root: 'div'
},
timer: slot.always({
onTimeout: close,
running,
timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1
}, {
elementType: Timer
}),
root: slot.always(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: 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

View File

@@ -0,0 +1,19 @@
'use client';
import * as React from 'react';
export 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
};
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/useToastContainerContextValues.ts"],"sourcesContent":["'use client';\n\nimport * 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":["React","useToastContainerContextValues_unstable","state","close","intent","titleId","bodyId","toastContainerContext","useMemo","toast"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAG/B,OAAO,SAASC,wCAAwCC,KAA0B;IAChF,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAE3C,MAAMK,wBAAwBP,MAAMQ,OAAO,CACzC,IAAO,CAAA;YACLL;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QAACH;QAAOC;QAAQC;QAASC;KAAO;IAGlC,OAAO;QACLG,OAAOF;IACT;AACF"}

View File

@@ -0,0 +1,20 @@
'use client';
import { __resetStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
export const toastContainerClassNames = {
root: 'fui-ToastContainer',
timer: 'fui-ToastContainer__timer'
};
const useRootBaseClassName = /*#__PURE__*/__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);}"]);
/**
* Apply styling to the ToastContainer slots based on the state
*/
export const useToastContainerStyles_unstable = state => {
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["__resetStyles","mergeClasses","tokens","createCustomFocusIndicatorStyle","toastContainerClassNames","root","timer","useRootBaseClassName","useToastContainerStyles_unstable","state","rootBaseClassName","className"],"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAA0BC,YAAY,QAAQ,gBAAgB;AAC9D,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,sOAQ5B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMQ,gCAAgC,GAAIC,KAAK,IAAG;EACzD,aAAa;;EACb,MAAMC,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAChDE,KAAK,CAACJ,IAAI,CAACM,SAAS,GAAGV,YAAY,CAACG,wBAAwB,CAACC,IAAI,EAAEK,iBAAiB,EAAED,KAAK,CAACJ,IAAI,CAACM,SAAS,CAAC;EAC3G,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,25 @@
'use client';
import { makeResetStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
export const toastContainerClassNames = {
root: 'fui-ToastContainer',
timer: 'fui-ToastContainer__timer'
};
const useRootBaseClassName = makeResetStyles({
boxSizing: 'border-box',
marginTop: '16px',
pointerEvents: 'all',
borderRadius: tokens.borderRadiusMedium,
...createCustomFocusIndicatorStyle({
outline: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`
})
});
/**
* Apply styling to the ToastContainer slots based on the state
*/ export const useToastContainerStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastContainer/useToastContainerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport type { ToastContainerSlots, ToastContainerState } from './ToastContainer.types';\n\nexport const toastContainerClassNames: SlotClassNames<ToastContainerSlots> = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer',\n};\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/**\n * Apply styling to the ToastContainer slots based on the state\n */\nexport const useToastContainerStyles_unstable = (state: ToastContainerState): ToastContainerState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","createCustomFocusIndicatorStyle","toastContainerClassNames","root","timer","useRootBaseClassName","boxSizing","marginTop","pointerEvents","borderRadius","borderRadiusMedium","outline","strokeWidthThick","colorStrokeFocus2","useToastContainerStyles_unstable","state","rootBaseClassName","className"],"mappings":"AAAA;AAEA,SAASA,eAAe,EAAEC,YAAY,QAAQ,iBAAiB;AAC/D,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,SAASC,+BAA+B,QAAQ,0BAA0B;AAG1E,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;IACNC,OAAO;AACT,EAAE;AAEF,MAAMC,uBAAuBP,gBAAgB;IAC3CQ,WAAW;IACXC,WAAW;IACXC,eAAe;IACfC,cAAcT,OAAOU,kBAAkB;IACvC,GAAGT,gCAAgC;QACjCU,SAAS,GAAGX,OAAOY,gBAAgB,CAAC,OAAO,EAAEZ,OAAOa,iBAAiB,EAAE;IACzE,EAAE;AACJ;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,oBAAoBX;IAC1BU,MAAMZ,IAAI,CAACc,SAAS,GAAGlB,aAAaG,yBAAyBC,IAAI,EAAEa,mBAAmBD,MAAMZ,IAAI,CAACc,SAAS;IAE1G,OAAOF;AACT,EAAE"}

View File

@@ -0,0 +1,15 @@
'use client';
import * as React from 'react';
import { useToastFooter_unstable } from './useToastFooter';
import { renderToastFooter_unstable } from './renderToastFooter';
import { useToastFooterStyles_unstable } from './useToastFooterStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* ToastFooter component
*/ export const ToastFooter = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useToastFooter_unstable(props, ref);
useToastFooterStyles_unstable(state);
useCustomStyleHook_unstable('useToastFooterStyles_unstable')(state);
return renderToastFooter_unstable(state);
});
ToastFooter.displayName = 'ToastFooter';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/ToastFooter.tsx"],"sourcesContent":["'use client';\n\nimport * 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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useToastFooterStyles_unstable')(state);\n\n return renderToastFooter_unstable(state);\n});\n\nToastFooter.displayName = 'ToastFooter';\n"],"names":["React","useToastFooter_unstable","renderToastFooter_unstable","useToastFooterStyles_unstable","useCustomStyleHook_unstable","ToastFooter","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAC9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}

View File

@@ -0,0 +1,3 @@
/**
* State used in rendering ToastFooter
*/ export { };

View File

@@ -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":[],"mappings":"AAWA;;CAEC,GACD,WAAgE"}

View File

@@ -0,0 +1,4 @@
export { ToastFooter } from './ToastFooter';
export { renderToastFooter_unstable } from './renderToastFooter';
export { useToastFooter_unstable } from './useToastFooter';
export { toastFooterClassNames, useToastFooterStyles_unstable } from './useToastFooterStyles.styles';

View File

@@ -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","useToastFooter_unstable","toastFooterClassNames","useToastFooterStyles_unstable"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,gCAAgC"}

View File

@@ -0,0 +1,8 @@
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of ToastFooter
*/ export const renderToastFooter_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsx(state.root, {});
};

View File

@@ -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 { JSXElement } 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): JSXElement => {\n assertSlots<ToastFooterSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderToastFooter_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}

View File

@@ -0,0 +1,26 @@
import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
/**
* Create the state required to render ToastFooter.
*
* The returned state can be modified with hooks such as useToastFooterStyles_unstable,
* before being passed to renderToastFooter_unstable.
*
* @param props - props from this instance of ToastFooter
* @param ref - reference to root HTMLElement of ToastFooter
*/ export const useToastFooter_unstable = (props, ref)=>{
return {
components: {
root: 'div'
},
root: slot.always(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'
})
};
};

View File

@@ -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":["React","getIntrinsicElementProps","slot","useToastFooter_unstable","props","ref","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAML,KAAKM,MAAM,CACfP,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FI,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEK,aAAa;QAAM;IAEzB;AACF,EAAE"}

View File

@@ -0,0 +1,20 @@
'use client';
import { __resetStyles, mergeClasses } from '@griffel/react';
export const toastFooterClassNames = {
root: 'fui-ToastFooter'
};
/**
* Styles for the root slot
*/
const useRootBaseClassName = /*#__PURE__*/__resetStyles("r56x6h2", null, [".r56x6h2{padding-top:16px;grid-column-start:2;grid-column-end:3;display:flex;align-items:center;gap:14px;}"]);
/**
* Apply styling to the ToastFooter slots based on the state
*/
export const useToastFooterStyles_unstable = state => {
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = mergeClasses(toastFooterClassNames.root, rootBaseClassName, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["__resetStyles","mergeClasses","toastFooterClassNames","root","useRootBaseClassName","useToastFooterStyles_unstable","state","rootBaseClassName","className"],"sources":["useToastFooterStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAA0BC,YAAY,QAAQ,gBAAgB;AAC9D,OAAO,MAAMC,qBAAqB,GAAG;EACjCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,oBAAoB,gBAAGJ,aAAA,gIAOhC,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,6BAA6B,GAAIC,KAAK,IAAG;EACtD,aAAa;;EACb,MAAMC,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAChDE,KAAK,CAACH,IAAI,CAACK,SAAS,GAAGP,YAAY,CAACC,qBAAqB,CAACC,IAAI,EAAEI,iBAAiB,EAAED,KAAK,CAACH,IAAI,CAACK,SAAS,CAAC;EACxG,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,23 @@
'use client';
import { makeResetStyles, mergeClasses } from '@griffel/react';
export const toastFooterClassNames = {
root: 'fui-ToastFooter'
};
/**
* Styles for the root slot
*/ const useRootBaseClassName = makeResetStyles({
paddingTop: '16px',
gridColumnStart: 2,
gridColumnEnd: 3,
display: 'flex',
alignItems: 'center',
gap: '14px'
});
/**
* Apply styling to the ToastFooter slots based on the state
*/ export const useToastFooterStyles_unstable = (state)=>{
'use no memo';
const rootBaseClassName = useRootBaseClassName();
state.root.className = mergeClasses(toastFooterClassNames.root, rootBaseClassName, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastFooter/useToastFooterStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { ToastFooterSlots, ToastFooterState } from './ToastFooter.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const toastFooterClassNames: SlotClassNames<ToastFooterSlots> = {\n root: 'fui-ToastFooter',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n paddingTop: '16px',\n gridColumnStart: 2,\n gridColumnEnd: 3,\n display: 'flex',\n alignItems: 'center',\n gap: '14px',\n});\n\n/**\n * Apply styling to the ToastFooter slots based on the state\n */\nexport const useToastFooterStyles_unstable = (state: ToastFooterState): ToastFooterState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastFooterClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","toastFooterClassNames","root","useRootBaseClassName","paddingTop","gridColumnStart","gridColumnEnd","display","alignItems","gap","useToastFooterStyles_unstable","state","rootBaseClassName","className"],"mappings":"AAAA;AAEA,SAASA,eAAe,EAAEC,YAAY,QAAQ,iBAAiB;AAI/D,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBJ,gBAAgB;IAC3CK,YAAY;IACZC,iBAAiB;IACjBC,eAAe;IACfC,SAAS;IACTC,YAAY;IACZC,KAAK;AACP;AAEA;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5C;IAEA,MAAMC,oBAAoBT;IAC1BQ,MAAMT,IAAI,CAACW,SAAS,GAAGb,aAAaC,sBAAsBC,IAAI,EAAEU,mBAAmBD,MAAMT,IAAI,CAACW,SAAS;IAEvG,OAAOF;AACT,EAAE"}

View File

@@ -0,0 +1,15 @@
'use client';
import * as React from 'react';
import { useToastTitle_unstable } from './useToastTitle';
import { renderToastTitle_unstable } from './renderToastTitle';
import { useToastTitleStyles_unstable } from './useToastTitleStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* ToastTitle component
*/ export const ToastTitle = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useToastTitle_unstable(props, ref);
useToastTitleStyles_unstable(state);
useCustomStyleHook_unstable('useToastTitleStyles_unstable')(state);
return renderToastTitle_unstable(state);
});
ToastTitle.displayName = 'ToastTitle';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/ToastTitle.tsx"],"sourcesContent":["'use client';\n\nimport * 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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useToastTitleStyles_unstable')(state);\n\n return renderToastTitle_unstable(state);\n});\n\nToastTitle.displayName = 'ToastTitle';\n"],"names":["React","useToastTitle_unstable","renderToastTitle_unstable","useToastTitleStyles_unstable","useCustomStyleHook_unstable","ToastTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,+BAA+B;AAG5E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,2BAAmDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQR,uBAAuBM,OAAOC;IAE5CL,6BAA6BM;IAC7BL,4BAA4B,gCAAgCK;IAE5D,OAAOP,0BAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}

View File

@@ -0,0 +1,3 @@
/**
* State used in rendering ToastTitle
*/ export { };

View File

@@ -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":[],"mappings":"AAeA;;CAEC,GACD,WAGI"}

View File

@@ -0,0 +1,4 @@
export { ToastTitle } from './ToastTitle';
export { renderToastTitle_unstable } from './renderToastTitle';
export { useToastTitle_unstable } from './useToastTitle';
export { toastTitleClassNames, useToastTitleStyles_unstable } from './useToastTitleStyles.styles';

View File

@@ -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","useToastTitle_unstable","toastTitleClassNames","useToastTitleStyles_unstable"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAE1C,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,+BAA+B"}

View File

@@ -0,0 +1,14 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of ToastTitle
*/ export const renderToastTitle_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsxs(_Fragment, {
children: [
state.media ? /*#__PURE__*/ _jsx(state.media, {}) : null,
/*#__PURE__*/ _jsx(state.root, {}),
state.action ? /*#__PURE__*/ _jsx(state.action, {}) : null
]
});
};

View File

@@ -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 { JSXElement } 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): JSXElement => {\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":["assertSlots","renderToastTitle_unstable","state","media","root","action"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAE7B,qBACE;;YACGA,MAAMC,KAAK,iBAAG,KAACD,MAAMC,KAAK,QAAM;0BACjC,KAACD,MAAME,IAAI;YACVF,MAAMG,MAAM,iBAAG,KAACH,MAAMG,MAAM,QAAM;;;AAGzC,EAAE"}

View File

@@ -0,0 +1,63 @@
'use client';
import * as React from 'react';
import { CheckmarkCircleFilled, DiamondDismissFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import { useBackgroundAppearance } from '@fluentui/react-shared-contexts';
import { useToastContainerContext } from '../../contexts/toastContainerContext';
/**
* Create the state required to render ToastTitle.
*
* The returned state can be modified with hooks such as useToastTitleStyles_unstable,
* before being passed to renderToastTitle_unstable.
*
* @param props - props from this instance of ToastTitle
* @param ref - reference to root HTMLElement of ToastTitle
*/ export const useToastTitle_unstable = (props, ref)=>{
const { intent, titleId } = useToastContainerContext();
const backgroundAppearance = useBackgroundAppearance();
/** Determine the role and media to render based on the intent */ let defaultIcon;
switch(intent){
case 'success':
defaultIcon = /*#__PURE__*/ React.createElement(CheckmarkCircleFilled, null);
break;
case 'error':
defaultIcon = /*#__PURE__*/ React.createElement(DiamondDismissFilled, null);
break;
case 'warning':
defaultIcon = /*#__PURE__*/ React.createElement(WarningFilled, null);
break;
case 'info':
defaultIcon = /*#__PURE__*/ React.createElement(InfoFilled, null);
break;
}
return {
action: slot.optional(props.action, {
elementType: 'div'
}),
components: {
root: 'div',
media: 'div',
action: 'div'
},
media: slot.optional(props.media, {
renderByDefault: !!intent,
defaultProps: {
children: defaultIcon
},
elementType: 'div'
}),
root: slot.always(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
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTitle/useToastTitle.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { CheckmarkCircleFilled, DiamondDismissFilled, 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 = <DiamondDismissFilled />;\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":["React","CheckmarkCircleFilled","DiamondDismissFilled","InfoFilled","WarningFilled","getIntrinsicElementProps","slot","useBackgroundAppearance","useToastContainerContext","useToastTitle_unstable","props","ref","intent","titleId","backgroundAppearance","defaultIcon","action","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","id"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB;AAC/G,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,SAASC,uBAAuB,QAAQ,kCAAkC;AAG1E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC;IAC7D,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAC5B,MAAMM,uBAAuBP;IAE7B,+DAA+D,GAC/D,IAAIQ;IACJ,OAAQH;QACN,KAAK;YACHG,4BAAc,oBAACd;YACf;QACF,KAAK;YACHc,4BAAc,oBAACb;YACf;QACF,KAAK;YACHa,4BAAc,oBAACX;YACf;QACF,KAAK;YACHW,4BAAc,oBAACZ;YACf;IACJ;IAEA,OAAO;QACLa,QAAQV,KAAKW,QAAQ,CAACP,MAAMM,MAAM,EAAE;YAAEE,aAAa;QAAM;QACzDC,YAAY;YAAEC,MAAM;YAAOC,OAAO;YAAOL,QAAQ;QAAM;QACvDK,OAAOf,KAAKW,QAAQ,CAACP,MAAMW,KAAK,EAAE;YAChCC,iBAAiB,CAAC,CAACV;YACnBW,cAAc;gBAAEC,UAAUT;YAAY;YACtCG,aAAa;QACf;QACAE,MAAMd,KAAKmB,MAAM,CACfpB,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FM,KAAKA;YACLa,UAAUd,MAAMc,QAAQ;YACxBE,IAAIb;YACJ,GAAGH,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;QAEvBN;QACAE;IACF;AACF,EAAE"}

View File

@@ -0,0 +1,81 @@
'use client';
import { __styles, __resetStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastTitleClassNames = {
root: 'fui-ToastTitle',
media: 'fui-ToastTitle__media',
action: 'fui-ToastTitle__action'
};
const useRootBaseClassName = /*#__PURE__*/__resetStyles("rdjap1e", null, [".rdjap1e{display:flex;grid-column-end:3;color:var(--colorNeutralForeground1);word-break:break-word;}"]);
const useMediaBaseClassName = /*#__PURE__*/__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__*/__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__*/__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__*/__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__*/__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);}"]
});
/**
* Apply styling to the ToastTitle slots based on the state
*/
export 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 = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.media) {
state.media.className = 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 = 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

View File

@@ -0,0 +1,88 @@
'use client';
import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const toastTitleClassNames = {
root: 'fui-ToastTitle',
media: 'fui-ToastTitle__media',
action: 'fui-ToastTitle__action'
};
const useRootBaseClassName = makeResetStyles({
display: 'flex',
gridColumnEnd: 3,
color: tokens.colorNeutralForeground1,
wordBreak: 'break-word'
});
const useMediaBaseClassName = makeResetStyles({
display: 'flex',
paddingTop: '2px',
gridColumnEnd: 2,
paddingRight: '8px',
fontSize: '16px',
color: tokens.colorNeutralForeground1
});
const useActionBaseClassName = makeResetStyles({
display: 'flex',
alignItems: 'start',
paddingLeft: '12px',
gridColumnEnd: -1,
color: tokens.colorBrandForeground1
});
const useInvertedStyles = makeStyles({
root: {
color: tokens.colorNeutralForegroundInverted2
},
action: {
color: tokens.colorBrandForegroundInverted
},
media: {
color: tokens.colorNeutralForegroundInverted
}
});
const useIntentIconStyles = makeStyles({
success: {
color: tokens.colorStatusSuccessForeground1
},
error: {
color: tokens.colorStatusDangerForeground1
},
warning: {
color: tokens.colorStatusWarningForeground1
},
info: {
color: tokens.colorNeutralForeground2
}
});
const useIntentIconStylesInverted = makeStyles({
success: {
color: tokens.colorStatusSuccessForegroundInverted
},
error: {
color: tokens.colorStatusDangerForegroundInverted
},
warning: {
color: tokens.colorStatusWarningForegroundInverted
},
info: {
color: tokens.colorNeutralForegroundInverted2
}
});
/**
* Apply styling to the ToastTitle slots based on the state
*/ export 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 = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
if (state.media) {
state.media.className = 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 = 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

View File

@@ -0,0 +1,11 @@
'use client';
import * as React from 'react';
import { useToastTrigger_unstable } from './useToastTrigger';
import { renderToastTrigger_unstable } from './renderToastTrigger';
/**
* ToastTrigger component
*/ export const ToastTrigger = (props)=>{
const state = useToastTrigger_unstable(props);
return renderToastTrigger_unstable(state);
};
ToastTrigger.displayName = 'ToastTrigger';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToastTrigger/ToastTrigger.tsx"],"sourcesContent":["'use client';\n\nimport * 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":["React","useToastTrigger_unstable","renderToastTrigger_unstable","ToastTrigger","props","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,uBAAuB;AAGnE;;CAEC,GACD,OAAO,MAAMC,eAA4CC,CAAAA;IACvD,MAAMC,QAAQJ,yBAAyBG;IAEvC,OAAOF,4BAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}

View File

@@ -0,0 +1 @@
import * as React from 'react';

View File

@@ -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":["React"],"mappings":"AAEA,YAAYA,WAAW,QAAQ"}

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