@fluentui/react-toast 0.0.0-nightly-20240702-0406.1 → 0.0.0-nightly-20240704-0407.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -16
- package/lib/AriaLive.js.map +1 -1
- package/lib/Toast.js.map +1 -1
- package/lib/ToastBody.js.map +1 -1
- package/lib/ToastContainer.js.map +1 -1
- package/lib/ToastFooter.js.map +1 -1
- package/lib/ToastTitle.js.map +1 -1
- package/lib/ToastTrigger.js.map +1 -1
- package/lib/Toaster.js.map +1 -1
- package/lib/components/AriaLive/AriaLive.js.map +1 -1
- package/lib/components/AriaLive/AriaLive.types.js.map +1 -1
- package/lib/components/AriaLive/index.js.map +1 -1
- package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib/components/Timer/Timer.js.map +1 -1
- package/lib/components/Timer/index.js.map +1 -1
- package/lib/components/Toast/Toast.js.map +1 -1
- package/lib/components/Toast/Toast.types.js +3 -1
- package/lib/components/Toast/Toast.types.js.map +1 -1
- package/lib/components/Toast/index.js.map +1 -1
- package/lib/components/Toast/renderToast.js.map +1 -1
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/Toast/useToastContextValues.js.map +1 -1
- package/lib/components/ToastBody/ToastBody.js.map +1 -1
- package/lib/components/ToastBody/ToastBody.types.js +3 -1
- package/lib/components/ToastBody/ToastBody.types.js.map +1 -1
- package/lib/components/ToastBody/index.js.map +1 -1
- package/lib/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBody.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainer.types.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainerMotion.js.map +1 -1
- package/lib/components/ToastContainer/index.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/ToastFooter.types.js +3 -1
- package/lib/components/ToastFooter/ToastFooter.types.js.map +1 -1
- package/lib/components/ToastFooter/index.js.map +1 -1
- package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/ToastTitle.types.js +3 -1
- package/lib/components/ToastTitle/ToastTitle.types.js.map +1 -1
- package/lib/components/ToastTitle/index.js.map +1 -1
- package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib/components/ToastTrigger/ToastTrigger.types.js.map +1 -1
- package/lib/components/ToastTrigger/index.js.map +1 -1
- package/lib/components/ToastTrigger/renderToastTrigger.js.map +1 -1
- package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/Toaster.types.js +3 -1
- package/lib/components/Toaster/Toaster.types.js.map +1 -1
- package/lib/components/Toaster/index.js.map +1 -1
- package/lib/components/Toaster/renderToaster.js.map +1 -1
- package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib/components/Toaster/useToaster.js.map +1 -1
- package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib/contexts/toastContainerContext.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/state/constants.js.map +1 -1
- package/lib/state/index.js.map +1 -1
- package/lib/state/types.js.map +1 -1
- package/lib/state/useToastController.js.map +1 -1
- package/lib/state/useToaster.js.map +1 -1
- package/lib/state/vanilla/createToaster.js.map +1 -1
- package/lib/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib/state/vanilla/dismissToast.js.map +1 -1
- package/lib/state/vanilla/dispatchToast.js.map +1 -1
- package/lib/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib/state/vanilla/index.js.map +1 -1
- package/lib/state/vanilla/pauseToast.js.map +1 -1
- package/lib/state/vanilla/playToast.js.map +1 -1
- package/lib/state/vanilla/updateToast.js.map +1 -1
- package/lib-commonjs/AriaLive.js.map +1 -1
- package/lib-commonjs/Toast.js.map +1 -1
- package/lib-commonjs/ToastBody.js.map +1 -1
- package/lib-commonjs/ToastContainer.js.map +1 -1
- package/lib-commonjs/ToastFooter.js.map +1 -1
- package/lib-commonjs/ToastTitle.js.map +1 -1
- package/lib-commonjs/ToastTrigger.js.map +1 -1
- package/lib-commonjs/Toaster.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -1
- package/lib-commonjs/components/AriaLive/index.js.map +1 -1
- package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Timer/Timer.js.map +1 -1
- package/lib-commonjs/components/Timer/index.js.map +1 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toast/Toast.js.map +1 -1
- package/lib-commonjs/components/Toast/Toast.types.js +3 -1
- package/lib-commonjs/components/Toast/Toast.types.js.map +1 -1
- package/lib-commonjs/components/Toast/index.js.map +1 -1
- package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/ToastBody.types.js +3 -1
- package/lib-commonjs/components/ToastBody/ToastBody.types.js.map +1 -1
- package/lib-commonjs/components/ToastBody/index.js.map +1 -1
- package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainerMotion.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/index.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/ToastFooter.types.js +3 -1
- package/lib-commonjs/components/ToastFooter/ToastFooter.types.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/index.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/ToastTitle.types.js +3 -1
- package/lib-commonjs/components/ToastTitle/ToastTitle.types.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/index.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/index.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib-commonjs/components/Toaster/Toaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/Toaster.types.js +3 -1
- package/lib-commonjs/components/Toaster/Toaster.types.js.map +1 -1
- package/lib-commonjs/components/Toaster/index.js.map +1 -1
- package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/toastContainerContext.js.map +1 -1
- package/lib-commonjs/index.js +50 -50
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/state/constants.js.map +1 -1
- package/lib-commonjs/state/index.js +3 -3
- package/lib-commonjs/state/index.js.map +1 -1
- package/lib-commonjs/state/types.js.map +1 -1
- package/lib-commonjs/state/useToastController.js.map +1 -1
- package/lib-commonjs/state/useToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/createToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib-commonjs/state/vanilla/index.js.map +1 -1
- package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/playToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/updateToast.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTitle.
|
|
1
|
+
{"version":3,"sources":["useToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\nimport type { ToastTitleProps, ToastTitleState } from './ToastTitle.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render ToastTitle.\n *\n * The returned state can be modified with hooks such as useToastTitleStyles_unstable,\n * before being passed to renderToastTitle_unstable.\n *\n * @param props - props from this instance of ToastTitle\n * @param ref - reference to root HTMLElement of ToastTitle\n */\nexport const useToastTitle_unstable = (props: ToastTitleProps, ref: React.Ref<HTMLElement>): ToastTitleState => {\n const { intent, titleId } = useToastContainerContext();\n const backgroundAppearance = useBackgroundAppearance();\n\n /** Determine the role and media to render based on the intent */\n let defaultIcon;\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n return {\n action: slot.optional(props.action, { elementType: 'div' }),\n components: { root: 'div', media: 'div', action: 'div' },\n media: slot.optional(props.media, {\n renderByDefault: !!intent,\n defaultProps: { children: defaultIcon },\n elementType: 'div',\n }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n children: props.children,\n id: titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n intent,\n backgroundAppearance,\n };\n};\n"],"names":["useToastTitle_unstable","props","ref","intent","titleId","useToastContainerContext","backgroundAppearance","useBackgroundAppearance","defaultIcon","React","createElement","CheckmarkCircleFilled","DismissCircleFilled","WarningFilled","InfoFilled","action","slot","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","getIntrinsicElementProps","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBaA;;;eAAAA;;;;iEAlBU;4BAE+D;gCACvC;qCACP;uCAGC;AAWlC,MAAMA,yBAAyB,CAACC,OAAwBC;IAC7D,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGC,IAAAA,+CAAAA;IAC5B,MAAMC,uBAAuBC,IAAAA,4CAAAA;IAE7B,+DAA+D,GAC/D,IAAIC;IACJ,OAAQL;QACN,KAAK;YACHK,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACC,iCAAAA,EAAAA;YACf;QACF,KAAK;YACHH,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACE,+BAAAA,EAAAA;YACf;QACF,KAAK;YACHJ,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACG,yBAAAA,EAAAA;YACf;QACF,KAAK;YACHL,cAAAA,WAAAA,GAAcC,OAAAC,aAAA,CAACI,sBAAAA,EAAAA;YACf;IACJ;IAEA,OAAO;QACLC,QAAQC,oBAAAA,CAAKC,QAAQ,CAAChB,MAAMc,MAAM,EAAE;YAAEG,aAAa;QAAM;QACzDC,YAAY;YAAEC,MAAM;YAAOC,OAAO;YAAON,QAAQ;QAAM;QACvDM,OAAOL,oBAAAA,CAAKC,QAAQ,CAAChB,MAAMoB,KAAK,EAAE;YAChCC,iBAAiB,CAAC,CAACnB;YACnBoB,cAAc;gBAAEC,UAAUhB;YAAY;YACtCU,aAAa;QACf;QACAE,MAAMJ,oBAAAA,CAAKS,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FxB,KAAKA;YACLsB,UAAUvB,MAAMuB,QAAQ;YACxBG,IAAIvB;YACJ,GAAGH,KAAK;QACV,IACA;YAAEiB,aAAa;QAAM;QAEvBf;QACAG;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, state.media.className, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent]);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"names":["toastTitleClassNames","useToastTitleStyles_unstable","root","media","action","useRootBaseClassName","__resetStyles","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","__styles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","mergeClasses","backgroundAppearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IAmEIC,4BAA4B;eAA5BA;;;uBArEyC;AAEnD,MAAMD,uBAAuB;IAChCE,MAAM;IACNC,OAAO;IACPC,QAAQ;AACZ;AACA,MAAMC,uBAAoB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,WAAA,MAAA;IAAA;CAK5B;AACD,MAAMC,wBAAqB,WAAA,GAAGD,IAAAA,oBAAA,EAAA,WAAA,YAAA;IAAA;IAAA;C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gB,MAAMhB,KAAK,CAACwB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBG,KAAK,EAAEmB,oBAAoBH,MAAMU,oBAAoB,KAAK,cAAcH,eAAevB,KAAK,EAAEgB,MAAMhB,KAAK,CAACwB,SAAS,EAAEF,UAAUF,gBAAgB,CAACE,OAAO,EAAEA,UAAUN,MAAMU,oBAAoB,KAAK,cAAcL,wBAAwB,CAACC,OAAO;IAC9S;IACA,IAAIN,MAAMf,MAAM,EAAE;QACde,MAAMf,MAAM,CAACuB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBI,MAAM,EAAEiB,qBAAqBF,MAAMU,oBAAoB,KAAK,cAAcH,eAAetB,MAAM,EAAEe,MAAMf,MAAM,CAACuB,SAAS;IACtL;IACA,OAAOR;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ToastTrigger.
|
|
1
|
+
{"version":3,"sources":["ToastTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTrigger_unstable } from './useToastTrigger';\nimport { renderToastTrigger_unstable } from './renderToastTrigger';\nimport type { ToastTriggerProps } from './ToastTrigger.types';\n\n/**\n * ToastTrigger component\n */\nexport const ToastTrigger: React.FC<ToastTriggerProps> = props => {\n const state = useToastTrigger_unstable(props);\n\n return renderToastTrigger_unstable(state);\n};\n\nToastTrigger.displayName = 'ToastTrigger';\n"],"names":["ToastTrigger","props","state","useToastTrigger_unstable","renderToastTrigger_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;iCACkB;oCACG;AAMrC,MAAMA,eAA4CC,CAAAA;IACvD,MAAMC,QAAQC,IAAAA,yCAAAA,EAAyBF;IAEvC,OAAOG,IAAAA,+CAAAA,EAA4BF;AACrC;AAEAF,aAAaK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ToastTrigger.types.
|
|
1
|
+
{"version":3,"sources":["ToastTrigger.types.ts"],"sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type ToastTriggerProps = TriggerProps<ToastTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * Props that are passed to the child of the ToastTrigger when cloned to ensure correct behaviour for the Toast\n */\nexport type ToastTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props\n>;\n\nexport type ToastTriggerState = {\n children: React.ReactElement | null;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAEuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ToastTrigger';\nexport * from './ToastTrigger.types';\nexport * from './renderToastTrigger';\nexport * from './useToastTrigger';\n"],"names":[],"rangeMappings":";;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastTrigger.
|
|
1
|
+
{"version":3,"sources":["renderToastTrigger.tsx"],"sourcesContent":["import type { ToastTriggerState } from './ToastTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderToastTrigger_unstable = (state: ToastTriggerState) => state.children;\n"],"names":["renderToastTrigger_unstable","state","children"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAEA;;;;CAIC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,8BAA8B,CAACC,QAA6BA,MAAMC,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTrigger.
|
|
1
|
+
{"version":3,"sources":["useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport type { ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will close a `Toast`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Toast`\n * Besides being a trigger that closes a toast through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of a toast.\n */\nexport const useToastTrigger_unstable = (props: ToastTriggerProps): ToastTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const { close } = useToastContainerContext();\n\n const child = getTriggerChild(children);\n\n const handleClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(e);\n if (!e.isDefaultPrevented()) {\n close();\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["useToastTrigger_unstable","props","children","disableButtonEnhancement","close","useToastContainerContext","child","getTriggerChild","handleClick","useEventCallback","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","useARIAButtonProps","type","applyTriggerPropsToChildren"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAeaA;;;eAAAA;;;;iEAfU;gCACwD;2BAC5C;uCAEM;AAWlC,MAAMA,2BAA2B,CAACC;IACvC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAM,EAAEG,KAAK,EAAE,GAAGC,IAAAA,+CAAAA;IAElB,MAAMC,QAAQC,IAAAA,+BAAAA,EAAgBL;IAE9B,MAAMM,cAAcC,IAAAA,gCAAAA,EAClB,CAACC;YACCJ,sBAAAA;QAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,uBAAAA,CAAAA,eAAAA,MAAOL,KAAK,AAALA,EAAMU,OAAO,AAAPA,MAAO,QAApBL,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAAA,IAAAA,CAAAA,cAAuBI;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BR;QACF;IACF;IAGF,MAAMS,oBAAoB;WACrBP,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOL,KAAK;QACfa,KAAKR,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,GAAG;QACfH,SAASH;IACX;IAEA,MAAMO,8BAA8BC,IAAAA,6BAAAA,EAClCV,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOW,IAAI,AAAJA,MAAS,YAAYX,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOW,IAAI,AAAJA,MAAS,MAAMX,MAAMW,IAAI,GAAG,OAC/D;QACE,GAAGJ,iBAAiB;QACpBI,MAAM;IACR;IAGF,OAAO;QACLf,UAAUgB,IAAAA,2CAAAA,EACRhB,UACAC,2BAA2BU,oBAAoBE;IAEnD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Toaster.
|
|
1
|
+
{"version":3,"sources":["Toaster.tsx"],"sourcesContent":["import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\nimport { useToaster_unstable } from './useToaster';\nimport { renderToaster_unstable } from './renderToaster';\nimport { useToasterStyles_unstable } from './useToasterStyles.styles';\nimport type { ToasterProps } from './Toaster.types';\n\n/**\n * Toaster component - renders a collection of toasts dispatched imperatively\n */\nexport const Toaster: React.FC<ToasterProps> = props => {\n const state = useToaster_unstable(props);\n\n useToasterStyles_unstable(state);\n useCustomStyleHook_unstable('useToasterStyles_unstable')(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["Toaster","props","state","useToaster_unstable","useToasterStyles_unstable","useCustomStyleHook_unstable","renderToaster_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;qCAX+B;iEACrB;4BAEa;+BACG;wCACG;AAMnC,MAAMA,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQC,IAAAA,+BAAAA,EAAoBF;IAElCG,IAAAA,iDAAAA,EAA0BF;IAC1BG,IAAAA,gDAAAA,EAA4B,6BAA6BH;IACzD,OAAOI,IAAAA,qCAAAA,EAAuBJ;AAChC;AAEAF,QAAQO,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["Toaster.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\nimport { ToasterOptions } from '../../state/types';\nimport { Announce, AriaLiveProps } from '../AriaLive';\n\nexport type ToasterSlots = {\n /**\n * NOTE: This root slot maps in exactly the same way to the containers rendered for each toast position\n * There is no intention (currently) to let users customize the div for each toast position.\n */\n root: Slot<'div'>;\n};\n\nexport type ToasterSlotsInternal = ToasterSlots & {\n bottomEnd?: Slot<'div'>;\n bottomStart?: Slot<'div'>;\n topEnd?: Slot<'div'>;\n topStart?: Slot<'div'>;\n top?: Slot<'div'>;\n bottom?: Slot<'div'>;\n};\n\n/**\n * Toaster Props\n */\nexport type ToasterProps = Omit<ComponentProps<ToasterSlots>, 'children'> &\n Partial<ToasterOptions> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * User override API for aria-live narration for toasts\n */\n announce?: Announce;\n\n inline?: boolean;\n };\n\n/**\n * State used in rendering Toaster\n */\nexport type ToasterState = ComponentState<ToasterSlotsInternal> &\n Pick<AriaLiveProps, 'announceRef'> &\n Pick<PortalProps, 'mountNode'> &\n Pick<Required<ToasterProps>, 'announce' | 'inline'> & {\n offset: ToasterOptions['offset'] | undefined;\n renderAriaLive: boolean;\n dir: 'rtl' | 'ltr';\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAoCA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Toaster';\nexport * from './Toaster.types';\nexport * from './renderToaster';\nexport * from './useToaster';\nexport * from './useToasterStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToaster.
|
|
1
|
+
{"version":3,"sources":["renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState) => {\n const { announceRef, renderAriaLive, inline, mountNode } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts =\n !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;\n\n const ariaLive = renderAriaLive ? <AriaLive announceRef={announceRef} /> : null;\n const positionSlots = (\n <>\n {state.bottom ? <state.bottom /> : null}\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n {state.top ? <state.top /> : null}\n </>\n );\n\n if (inline) {\n return (\n <>\n {ariaLive}\n {hasToasts ? positionSlots : null}\n </>\n );\n }\n\n return (\n <>\n {ariaLive}\n {hasToasts ? <Portal mountNode={mountNode}>{positionSlots}</Portal> : null}\n </>\n );\n};\n"],"names":["renderToaster_unstable","state","announceRef","renderAriaLive","inline","mountNode","assertSlots","hasToasts","bottomStart","bottomEnd","topStart","topEnd","top","bottom","ariaLive","_jsx","AriaLive","positionSlots","_jsxs","_Fragment","Portal"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;gCAE4B;6BACL;0BAEE;AAKlB,MAAMA,yBAAyB,CAACC;IACrC,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGJ;IAC3DK,IAAAA,2BAAAA,EAAkCL;IAElC,MAAMM,YACJ,CAAC,CAACN,MAAMO,WAAW,IAAI,CAAC,CAACP,MAAMQ,SAAS,IAAI,CAAC,CAACR,MAAMS,QAAQ,IAAI,CAAC,CAACT,MAAMU,MAAM,IAAI,CAAC,CAACV,MAAMW,GAAG,IAAI,CAAC,CAACX,MAAMY,MAAM;IAEjH,MAAMC,WAAWX,iBAAAA,WAAAA,GAAiBY,IAAAA,eAAA,EAACC,kBAAAA,EAAAA;QAASd,aAAaA;SAAkB;IAC3E,MAAMe,gBAAAA,WAAAA,GACJC,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;YACGlB,MAAMY,MAAM,GAAA,WAAA,GAAGE,IAAAA,eAAA,EAACd,MAAMY,MAAM,EAAA,CAAA,KAAM;YAClCZ,MAAMO,WAAW,GAAA,WAAA,GAAGO,IAAAA,eAAA,EAACd,MAAMO,WAAW,EAAA,CAAA,KAAM;YAC5CP,MAAMQ,SAAS,GAAA,WAAA,GAAGM,IAAAA,eAAA,EAACd,MAAMQ,SAAS,EAAA,CAAA,KAAM;YACxCR,MAAMS,QAAQ,GAAA,WAAA,GAAGK,IAAAA,eAAA,EAACd,MAAMS,QAAQ,EAAA,CAAA,KAAM;YACtCT,MAAMU,MAAM,GAAA,WAAA,GAAGI,IAAAA,eAAA,EAACd,MAAMU,MAAM,EAAA,CAAA,KAAM;YAClCV,MAAMW,GAAG,GAAA,WAAA,GAAGG,IAAAA,eAAA,EAACd,MAAMW,GAAG,EAAA,CAAA,KAAM;;;IAIjC,IAAIR,QAAQ;QACV,OAAA,WAAA,GACEc,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;gBACGL;gBACAP,YAAYU,gBAAgB;;;IAGnC;IAEA,OAAA,WAAA,GACEC,IAAAA,gBAAA,EAAAC,oBAAA,EAAA;;YACGL;YACAP,YAAAA,WAAAA,GAAYQ,IAAAA,eAAA,EAACK,mBAAAA,EAAAA;gBAAOf,WAAWA;0BAAYY;iBAA0B;;;AAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastAnnounce.
|
|
1
|
+
{"version":3,"sources":["useToastAnnounce.ts"],"sourcesContent":["import * as React from 'react';\nimport { Announce } from '../AriaLive';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */\nexport function useToastAnnounce(announce: Announce) {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef<() => void>(() => undefined);\n const announceToast = React.useCallback<Announce>(\n (message, options) => {\n if (activeRef.current) {\n announce(message, options);\n }\n },\n [announce],\n );\n\n const toasterRef = React.useCallback((el: HTMLDivElement | null) => {\n if (!el) {\n cleanupRef.current();\n return;\n }\n\n const onFocusIn = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = false;\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = true;\n };\n\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n\n cleanupRef.current = () => {\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n\n return {\n announceToast,\n toasterRef,\n };\n}\n"],"names":["useToastAnnounce","announce","activeRef","React","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","isHTMLElement","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;;iEAXO;gCAEO;AASvB,SAASA,iBAAiBC,QAAkB;IACjD,MAAMC,YAAYC,OAAMC,MAAM,CAAC;IAC/B,MAAMC,aAAaF,OAAMC,MAAM,CAAa,IAAME;IAClD,MAAMC,gBAAgBJ,OAAMK,WAAW,CACrC,CAACC,SAASC;QACR,IAAIR,UAAUS,OAAO,EAAE;YACrBV,SAASQ,SAASC;QACpB;IACF,GACA;QAACT;KAAS;IAGZ,MAAMW,aAAaT,OAAMK,WAAW,CAAC,CAACK;QACpC,IAAI,CAACA,IAAI;YACPR,WAAWM,OAAO;YAClB;QACF;QAEA,MAAMG,YAAY,CAACC;YACjB,IACEC,IAAAA,6BAAAA,EAAcD,EAAEE,aAAa,KAC7BF,EAAEE,aAAa,CAACC,QAAQ,CAACF,IAAAA,6BAAAA,EAAcD,EAAEI,aAAa,IAAIJ,EAAEI,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAjB,UAAUS,OAAO,GAAG;QACtB;QAEA,MAAMS,aAAa,CAACL;YAClB,IACEC,IAAAA,6BAAAA,EAAcD,EAAEE,aAAa,KAC7BF,EAAEE,aAAa,CAACC,QAAQ,CAACF,IAAAA,6BAAAA,EAAcD,EAAEI,aAAa,IAAIJ,EAAEI,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAjB,UAAUS,OAAO,GAAG;QACtB;QAEAE,GAAGQ,gBAAgB,CAAC,WAAWP;QAC/BD,GAAGQ,gBAAgB,CAAC,YAAYD;QAEhCf,WAAWM,OAAO,GAAG;YACnBE,GAAGS,mBAAmB,CAAC,WAAWR;YAClCD,GAAGS,mBAAmB,CAAC,YAAYF;QACrC;IACF,GAAG,EAAE;IAEL,OAAO;QACLb;QACAK;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToaster.
|
|
1
|
+
{"version":3,"sources":["useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = slot.always(getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest), {\n elementType: 'div',\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n props.onKeyDown?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","React","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useToaster","useCallback","message","options","current","dir","useFluent","rootProps","slot","always","getIntrinsicElementProps","elementType","focusableGroupAttr","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Escape","onKeyDown","useEventCallback","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","useToasterFocusManagement_unstable","announceToast","toasterRef","useToastAnnounce","optional","has","defaultProps","ref","useMergedRefs","children","get","map","toast","createElement","ToastContainer","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","TOAST_POSITIONS","renderAriaLive"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAwBaA;;;eAAAA;;;;iEAxBU;gCAQhB;qCACyC;8BACd;8BACX;uBAEoC;gCAE5B;2CACoB;kCAClB;AAO1B,MAAMA,sBAAsB,CAACC;IAClC;IAEA,MAAM,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAEC,SAAS,EAAEC,SAAS,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAC/E,MAAMO,cAAcC,OAAMC,MAAM,CAAW,IAAM;IACjD,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,cAAc,EAAE,GACtGC,IAAAA,iBAAAA,EAA2BV;IAC7B,MAAMJ,WAAWM,OAAMS,WAAW,CAAW,CAACC,SAASC,UAAYZ,YAAYa,OAAO,CAACF,SAASC,UAAU,EAAE;I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wBAClBC,SAAS/C,eAAe0C,MAAMI,OAAO;uBAEpCJ,MAAMM,OAAO;gBAGlB1B;gBACA,GAAGL,kBAAkB;gBACrB,yBAAyBW;gBACzBqB,MAAM;YAER;YACAjC,aAAa;QACf;IACF;IAEA,OAAO;QACLN;QACAjB;QACAyD,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAMtC,oBAAAA,CAAKC,MAAM,CAACF,WAAW;YAAEI,aAAa;QAAM;QAClDoC,aAAazB,gBAAgB+B,sBAAAA,CAAgBN,WAAW;QACxDC,WAAW1B,gBAAgB+B,sBAAAA,CAAgBL,SAAS;QACpDC,UAAU3B,gBAAgB+B,sBAAAA,CAAgBJ,QAAQ;QAClDC,QAAQ5B,gBAAgB+B,sBAAAA,CAAgBH,MAAM;QAC9CC,KAAK7B,gBAAgB+B,sBAAAA,CAAgBF,GAAG;QACxCC,QAAQ9B,gBAAgB+B,sBAAAA,CAAgBD,MAAM;QAC9C7D;QACAN;QACAC,UAAUC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgBD;QAC1BoE,gBAAgB,CAACnE;QACjBE;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToasterFocusManagement.
|
|
1
|
+
{"version":3,"sources":["useToasterFocusManagement.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(pauseAllToasts: () => void, playAllToasts: () => void) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["useToasterFocusManagement_unstable","noop","undefined","pauseAllToasts","playAllToasts","targetDocument","useFluent","cleanupListenersRef","React","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHTMLElement","classList","contains","toastContainerClassNames","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","ArrowDown","currentNode","nextToastContainer","nextNode","focus","ArrowUp","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;;gCAXc;iEACP;qCACyB;8BACb;gCACM;AAEzC,MAAMC,OAAO,IAAMC;AAKZ,SAASF,mCAAmCG,cAA0B,EAAEC,aAAyB;IACtG,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAAA;IAC3B,MAAMC,sBAAsBC,OAAMC,MAAM,CAAaR;IAErD,OAAOO,OAAME,WAAW,CACtB,CAACC;QACC,IAAI,CAACA,MAAM,CAACN,gBAAgB;YAC1BE,oBAAoBK,OAAO;YAC3BL,oBAAoBK,OAAO,GAAGX;YAC9B;QACF;QAEA,MAAMY,uBAAuBR,eAAeS,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACxFC,YAAWC,IAAU;gBACnB,IAAIC,IAAAA,6BAAAA,EAAcD,SAASA,KAAKE,SAAS,CAACC,QAAQ,CAACC,wCAAAA,CAAyBC,IAAI,GAAG;oBACjF,OAAOR,WAAW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ACnB,QAAQ,CAACF,IAAAA,6BAAAA,EAAcQ,EAAEc,aAAa,IAAId,EAAEc,aAAa,GAAG,OAC7E;gBACArC;YACF;QACF;QAEAO,GAAGgC,gBAAgB,CAAC,WAAWjB;QAC/Bf,GAAGgC,gBAAgB,CAAC,WAAWJ;QAC/B5B,GAAGgC,gBAAgB,CAAC,YAAYD;QAEhCnC,oBAAoBK,OAAO,GAAG;YAC5BD,GAAGiC,mBAAmB,CAAC,WAAWlB;YAClCf,GAAGiC,mBAAmB,CAAC,WAAWL;YAClC5B,GAAGiC,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAACrC;QAAgBF;QAAgBC;KAAc;AAEnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */ const useRootBaseClassName = makeResetStyles({\n position: 'fixed',\n width: '292px',\n pointerEvents: 'none'\n});\nconst useToasterStyles = makeStyles({\n inline: {\n position: 'absolute'\n }\n});\n/**\n * Apply styling to the Toaster slots based on the state\n */ export const useToasterStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useToasterStyles();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.inline && styles.inline, state.root.className);\n if (state.bottomStart) {\n var _state_bottomStart;\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n var _state_bottomEnd;\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n var _state_topStart;\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n var _state_topEnd;\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n if (state.top) {\n var _state_top;\n state.top.className = className;\n var _style4;\n (_style4 = (_state_top = state.top).style) !== null && _style4 !== void 0 ? _style4 : _state_top.style = {};\n Object.assign(state.top.style, getPositionStyles(TOAST_POSITIONS.top, state.dir, state.offset));\n }\n if (state.bottom) {\n var _state_bottom;\n state.bottom.className = className;\n var _style5;\n (_style5 = (_state_bottom = state.bottom).style) !== null && _style5 !== void 0 ? _style5 : _state_bottom.style = {};\n Object.assign(state.bottom.style, getPositionStyles(TOAST_POSITIONS.bottom, state.dir, state.offset));\n }\n return state;\n};\n"],"names":["toasterClassNames","useToasterStyles_unstable","root","useRootBaseClassName","__resetStyles","useToasterStyles","__styles","inline","qhf8xq","d","state","rootBaseClassName","styles","className","mergeClasses","bottomStart","_state_bottomStart","_style","style","Object","assign","getPositionStyles","TOAST_POSITIONS","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3","top","_state_top","_style4","bottom","_state_bottom","_style5"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAChB,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACY,GAAG,EAAExB,MAAMa,GAAG,EAAEb,MAAMc,MAAM;IACjG;IACA,IAAId,MAAM2B,MAAM,EAAE;QACd,IAAIC;QACJ5B,MAAM2B,MAAM,CAACxB,SAAS,GAAGA;QACzB,IAAI0B;QACHA,CAAAA,UAAU,AAACD,CAAAA,gBAAgB5B,MAAM2B,MAAM,AAANA,EAAQnB,KAAK,AAALA,MAAW,QAAQqB,YAAY,KAAK,IAAIA,UAAUD,cAAcpB,KAAK,GAAG,CAAC;QACnHC,OAAOC,MAAM,CAACV,MAAM2B,MAAM,CAACnB,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACe,MAAM,EAAE3B,MAAMa,GAAG,EAAEb,MAAMc,MAAM;IACvG;IACA,OAAOd;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["toastContainerContext.
|
|
1
|
+
{"version":3,"sources":["toastContainerContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ToastIntent } from '../state/types';\n\nexport type ToastContainerContextValue = {\n close: () => void;\n intent: ToastIntent | undefined;\n bodyId: string;\n titleId: string;\n};\n\nconst toastContainerContextDefaultValue: ToastContainerContextValue = {\n close: () => null,\n intent: undefined,\n bodyId: '',\n titleId: '',\n};\n\nconst ToastContainerContext = React.createContext<ToastContainerContextValue | undefined>(undefined);\n\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nexport const useToastContainerContext = () =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["ToastContainerContextProvider","useToastContainerContext","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","React","createContext","Provider","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAmBaA,6BAAAA;eAAAA;;IACAC,wBAAAA;eAAAA;;;;iEApBU;AAUvB,MAAMC,oCAAgE;IACpEC,OAAO,IAAM;IACbC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,wBAAAA,WAAAA,GAAwBC,OAAMC,aAAa,CAAyCL;AAEnF,MAAML,gCAAgCQ,sBAAsBG,QAAQ;AACpE,MAAMV,2BAA2B;QACtCQ;WAAAA,CAAAA,oBAAAA,OAAMG,UAAU,CAACJ,sBAAAA,MAAAA,QAAjBC,sBAAAA,KAAAA,IAAAA,oBAA2CP;AAAgC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -9,65 +9,56 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
Toast: function() {
|
|
13
|
+
return _Toast.Toast;
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
ToastBody: function() {
|
|
16
|
+
return _ToastBody.ToastBody;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
ToastFooter: function() {
|
|
19
|
+
return _ToastFooter.ToastFooter;
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
return
|
|
21
|
+
ToastTitle: function() {
|
|
22
|
+
return _ToastTitle.ToastTitle;
|
|
23
|
+
},
|
|
24
|
+
ToastTrigger: function() {
|
|
25
|
+
return _ToastTrigger.ToastTrigger;
|
|
23
26
|
},
|
|
24
27
|
Toaster: function() {
|
|
25
28
|
return _Toaster.Toaster;
|
|
26
29
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
useToasterStyles_unstable: function() {
|
|
31
|
-
return _Toaster.useToasterStyles_unstable;
|
|
32
|
-
},
|
|
33
|
-
renderToaster_unstable: function() {
|
|
34
|
-
return _Toaster.renderToaster_unstable;
|
|
35
|
-
},
|
|
36
|
-
toasterClassNames: function() {
|
|
37
|
-
return _Toaster.toasterClassNames;
|
|
30
|
+
renderToastBody_unstable: function() {
|
|
31
|
+
return _ToastBody.renderToastBody_unstable;
|
|
38
32
|
},
|
|
39
|
-
|
|
40
|
-
return
|
|
33
|
+
renderToastFooter_unstable: function() {
|
|
34
|
+
return _ToastFooter.renderToastFooter_unstable;
|
|
41
35
|
},
|
|
42
|
-
|
|
43
|
-
return
|
|
36
|
+
renderToastTitle_unstable: function() {
|
|
37
|
+
return _ToastTitle.renderToastTitle_unstable;
|
|
44
38
|
},
|
|
45
|
-
|
|
46
|
-
return
|
|
39
|
+
renderToastTrigger_unstable: function() {
|
|
40
|
+
return _ToastTrigger.renderToastTrigger_unstable;
|
|
47
41
|
},
|
|
48
42
|
renderToast_unstable: function() {
|
|
49
43
|
return _Toast.renderToast_unstable;
|
|
50
44
|
},
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
ToastTitle: function() {
|
|
55
|
-
return _ToastTitle.ToastTitle;
|
|
45
|
+
renderToaster_unstable: function() {
|
|
46
|
+
return _Toaster.renderToaster_unstable;
|
|
56
47
|
},
|
|
57
|
-
|
|
58
|
-
return
|
|
48
|
+
toastBodyClassNames: function() {
|
|
49
|
+
return _ToastBody.toastBodyClassNames;
|
|
59
50
|
},
|
|
60
|
-
|
|
61
|
-
return
|
|
51
|
+
toastClassNames: function() {
|
|
52
|
+
return _Toast.toastClassNames;
|
|
62
53
|
},
|
|
63
|
-
|
|
64
|
-
return
|
|
54
|
+
toastFooterClassNames: function() {
|
|
55
|
+
return _ToastFooter.toastFooterClassNames;
|
|
65
56
|
},
|
|
66
57
|
toastTitleClassNames: function() {
|
|
67
58
|
return _ToastTitle.toastTitleClassNames;
|
|
68
59
|
},
|
|
69
|
-
|
|
70
|
-
return
|
|
60
|
+
toasterClassNames: function() {
|
|
61
|
+
return _Toaster.toasterClassNames;
|
|
71
62
|
},
|
|
72
63
|
useToastBodyStyles_unstable: function() {
|
|
73
64
|
return _ToastBody.useToastBodyStyles_unstable;
|
|
@@ -75,14 +66,8 @@ _export(exports, {
|
|
|
75
66
|
useToastBody_unstable: function() {
|
|
76
67
|
return _ToastBody.useToastBody_unstable;
|
|
77
68
|
},
|
|
78
|
-
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
toastBodyClassNames: function() {
|
|
82
|
-
return _ToastBody.toastBodyClassNames;
|
|
83
|
-
},
|
|
84
|
-
ToastFooter: function() {
|
|
85
|
-
return _ToastFooter.ToastFooter;
|
|
69
|
+
useToastController: function() {
|
|
70
|
+
return _state.useToastController;
|
|
86
71
|
},
|
|
87
72
|
useToastFooterStyles_unstable: function() {
|
|
88
73
|
return _ToastFooter.useToastFooterStyles_unstable;
|
|
@@ -90,11 +75,26 @@ _export(exports, {
|
|
|
90
75
|
useToastFooter_unstable: function() {
|
|
91
76
|
return _ToastFooter.useToastFooter_unstable;
|
|
92
77
|
},
|
|
93
|
-
|
|
94
|
-
return
|
|
78
|
+
useToastStyles_unstable: function() {
|
|
79
|
+
return _Toast.useToastStyles_unstable;
|
|
95
80
|
},
|
|
96
|
-
|
|
97
|
-
return
|
|
81
|
+
useToastTitleStyles_unstable: function() {
|
|
82
|
+
return _ToastTitle.useToastTitleStyles_unstable;
|
|
83
|
+
},
|
|
84
|
+
useToastTitle_unstable: function() {
|
|
85
|
+
return _ToastTitle.useToastTitle_unstable;
|
|
86
|
+
},
|
|
87
|
+
useToastTrigger_unstable: function() {
|
|
88
|
+
return _ToastTrigger.useToastTrigger_unstable;
|
|
89
|
+
},
|
|
90
|
+
useToast_unstable: function() {
|
|
91
|
+
return _Toast.useToast_unstable;
|
|
92
|
+
},
|
|
93
|
+
useToasterStyles_unstable: function() {
|
|
94
|
+
return _Toaster.useToasterStyles_unstable;
|
|
95
|
+
},
|
|
96
|
+
useToaster_unstable: function() {
|
|
97
|
+
return _Toaster.useToaster_unstable;
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
const _state = require("./state");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { useToastController } from './state';\nexport type { ToastPosition, ToastId, ToastOffset, ToastPoliteness, ToastStatus, ToastIntent } from './state';\n\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport type { ToastTriggerChildProps, ToastTriggerProps, ToastTriggerState } from './ToastTrigger';\nexport {\n Toaster,\n useToaster_unstable,\n useToasterStyles_unstable,\n renderToaster_unstable,\n toasterClassNames,\n} from './Toaster';\nexport type { ToasterProps, ToasterState, ToasterSlots } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport type { ToastProps, ToastState, ToastSlots } from './Toast';\n\nexport {\n ToastTitle,\n useToastTitleStyles_unstable,\n useToastTitle_unstable,\n renderToastTitle_unstable,\n toastTitleClassNames,\n} from './ToastTitle';\nexport type { ToastTitleProps, ToastTitleState, ToastTitleSlots } from './ToastTitle';\n\nexport {\n ToastBody,\n useToastBodyStyles_unstable,\n useToastBody_unstable,\n renderToastBody_unstable,\n toastBodyClassNames,\n} from './ToastBody';\nexport type { ToastBodyProps, ToastBodyState, ToastBodySlots } from './ToastBody';\n\nexport {\n ToastFooter,\n useToastFooterStyles_unstable,\n useToastFooter_unstable,\n renderToastFooter_unstable,\n toastFooterClassNames,\n} from './ToastFooter';\nexport type { ToastFooterProps, ToastFooterState, ToastFooterSlots } from './ToastFooter';\n"],"names":["Toast","ToastBody","ToastFooter","ToastTitle","ToastTrigger","Toaster","renderToastBody_unstable","renderToastFooter_unstable","renderToastTitle_unstable","renderToastTrigger_unstable","renderToast_unstable","renderToaster_unstable","toastBodyClassNames","toastClassNames","toastFooterClassNames","toastTitleClassNames","toasterClassNames","useToastBodyStyles_unstable","useToastBody_unstable","useToastController","useToastFooterStyles_unstable","useToastFooter_unstable","useToastStyles_unstable","useToastTitleStyles_unstable","useToastTitle_unstable","useToastTrigger_unstable","useToast_unstable","useToasterStyles_unstable","useToaster_unstable"],"rangeMappings":";;;;;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version":3,"sources":["constants.ts"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play',\n} as const;\n\nexport const TOAST_POSITIONS = {\n bottom: 'bottom',\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n top: 'top',\n topEnd: 'top-end',\n topStart: 'top-start',\n} as const;\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottom","bottomEnd","bottomStart","top","topEnd","topStart"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAAaA,MAAAA;eAAAA;;IASAC,eAAAA;eAAAA;;;AATN,MAAMD,SAAS;IACpBE,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACR;AAEO,MAAMN,kBAAkB;IAC7BO,QAAQ;IACRC,WAAW;IACXC,aAAa;IACbC,KAAK;IACLC,QAAQ;IACRC,UAAU;AACZ"}
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getPositionStyles: function() {
|
|
13
|
-
return _vanilla.getPositionStyles;
|
|
14
|
-
},
|
|
15
12
|
TOAST_POSITIONS: function() {
|
|
16
13
|
return _constants.TOAST_POSITIONS;
|
|
14
|
+
},
|
|
15
|
+
getPositionStyles: function() {
|
|
16
|
+
return _vanilla.getPositionStyles;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["TOAST_POSITIONS","getPositionStyles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAISA,eAAe;eAAfA,0BAAe;;IADfC,iBAAiB;eAAjBA,0BAAiB;;;;uBAHZ;uBACA;uBACA;yBACoB;2BACF"}
|