@aglyn/shared-ui-snackstack 1.0.0-beta.231 → 1.0.0-beta.233

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/shared-ui-snackstack",
3
- "version": "1.0.0-beta.231",
3
+ "version": "1.0.0-beta.233",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  * limitations under the License.
19
19
  */ // eslint-disable-next-line @nx/enforce-module-boundaries
20
20
  import { createChainedFunction } from "@aglyn/shared-util-tools";
21
- import { Collapse, emphasize, styled } from "@mui/material";
21
+ import { Collapse, emphasize, IconButton, SvgIcon, styled } from "@mui/material";
22
22
  import clsx from "clsx";
23
23
  import { forwardRef, useEffect, useRef, useState } from "react";
24
24
  import SnackbarContent from "../SnackbarContent.js";
@@ -91,7 +91,9 @@ const StyledSnackbar = styled(Snackbar)(({ theme })=>{
91
91
  }
92
92
  };
93
93
  });
94
+ /** mdi `close`, inline: this package draws its own icons (`defaultIconVariants`). */ const CLOSE_ICON_PATH = 'M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z';
94
95
  const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
96
+ var _ref;
95
97
  const { classes: propClasses } = props, rest = _object_without_properties_loose(props, [
96
98
  "classes"
97
99
  ]);
@@ -116,7 +118,7 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
116
118
  setCollapsed(!collapsed);
117
119
  }, 125);
118
120
  };
119
- const { style, dense, ariaAttributes: otherAriaAttributes, className: otherClassName, hideIconVariant, iconVariant, snack, action: otherAction, content: otherContent, TransitionComponent: otherTranComponent, TransitionProps: otherTranProps, transitionDuration: otherTranDuration, onEnter: ignoredOnEnter, onEntered: ignoredOnEntered, onEntering: ignoredOnEntering, onExit: ignoredOnExit, onExited: ignoredOnExited, onExiting: ignoredOnExiting } = rest, other = _object_without_properties_loose(rest, [
121
+ const { style, dense, ariaAttributes: otherAriaAttributes, className: otherClassName, hideIconVariant, iconVariant, snack, action: otherAction, dismissible: otherDismissible, content: otherContent, TransitionComponent: otherTranComponent, TransitionProps: otherTranProps, transitionDuration: otherTranDuration, onEnter: ignoredOnEnter, onEntered: ignoredOnEntered, onEntering: ignoredOnEntering, onExit: ignoredOnExit, onExited: ignoredOnExited, onExiting: ignoredOnExiting } = rest, other = _object_without_properties_loose(rest, [
120
122
  "style",
121
123
  "dense",
122
124
  "ariaAttributes",
@@ -125,6 +127,7 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
125
127
  "iconVariant",
126
128
  "snack",
127
129
  "action",
130
+ "dismissible",
128
131
  "content",
129
132
  "TransitionComponent",
130
133
  "TransitionProps",
@@ -136,7 +139,7 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
136
139
  "onExited",
137
140
  "onExiting"
138
141
  ]);
139
- const { persist, snackbarId, open, entered, requestClose, className: singleClassName, variant, content: singleContent, action: singleAction, ariaAttributes: singleAriaAttributes, anchorOrigin, message: snackMessage, TransitionComponent: singleTranComponent, TransitionProps: singleTranProps, transitionDuration: singleTranDuration, onEnter, onEntered, onEntering, onExit, onExited, onExiting } = snack, singleSnackProps = _object_without_properties_loose(snack, [
142
+ const { persist, snackbarId, open, entered, requestClose, className: singleClassName, variant, content: singleContent, action: singleAction, dismissible: singleDismissible, ariaAttributes: singleAriaAttributes, anchorOrigin, message: snackMessage, TransitionComponent: singleTranComponent, TransitionProps: singleTranProps, transitionDuration: singleTranDuration, onEnter, onEntered, onEntering, onExit, onExited, onExiting } = snack, singleSnackProps = _object_without_properties_loose(snack, [
140
143
  "persist",
141
144
  "snackbarId",
142
145
  "open",
@@ -146,6 +149,7 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
146
149
  "variant",
147
150
  "content",
148
151
  "action",
152
+ "dismissible",
149
153
  "ariaAttributes",
150
154
  "anchorOrigin",
151
155
  "message",
@@ -172,6 +176,7 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
172
176
  if (typeof action === 'function') {
173
177
  action = action(snackbarId);
174
178
  }
179
+ const dismissible = (_ref = singleDismissible != null ? singleDismissible : otherDismissible) != null ? _ref : false;
175
180
  let content = singleContent || otherContent;
176
181
  if (typeof content === 'function') {
177
182
  content = content(snackbarId, snack.message);
@@ -231,10 +236,26 @@ const SnackbarItem = /*#__PURE__*/ forwardRef((props, ref)=>{
231
236
  snackMessage
232
237
  ]
233
238
  }),
234
- action && /*#__PURE__*/ _jsx("div", {
239
+ action || dismissible ? /*#__PURE__*/ _jsxs("div", {
235
240
  className: classes.action,
236
- children: action
237
- })
241
+ children: [
242
+ action,
243
+ dismissible ? /*#__PURE__*/ _jsx(IconButton, {
244
+ size: "small",
245
+ color: "inherit",
246
+ "aria-label": "Dismiss",
247
+ // Closes it the way `closeSnackbar` does, so the
248
+ // provider's own `onClose` hears the same reason.
249
+ onClick: ()=>handleClose(null, REASONS.INSTRUCTED),
250
+ children: /*#__PURE__*/ _jsx(SvgIcon, {
251
+ fontSize: "small",
252
+ children: /*#__PURE__*/ _jsx("path", {
253
+ d: CLOSE_ICON_PATH
254
+ })
255
+ })
256
+ }) : null
257
+ ]
258
+ }) : null
238
259
  ]
239
260
  }))
240
261
  }))
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/shared/ui/snackstack/src/lib/SnackbarItem/SnackbarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { createChainedFunction } from '@aglyn/shared-util-tools'\nimport {\n Collapse,\n emphasize,\n type SnackbarClassKey,\n styled,\n} from '@mui/material'\nimport clsx from 'clsx'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\nimport SnackbarContent from '../SnackbarContent'\nimport { type Snack } from '../SnackbarProvider'\nimport {\n type ClassNameMap,\n type RequiredBy,\n type SharedProps,\n type SnackbarProviderProps as ProviderProps,\n type TransitionHandlerProps,\n} from '../types'\nimport { DEFAULTS, objectMerge, REASONS, transformer } from '../utils/constants'\nimport defaultIconVariants from '../utils/defaultIconVariants'\nimport Snackbar from './Snackbar'\nimport { getTransitionDirection } from './SnackbarItem.util'\n\nconst componentName = 'SnackbarItem'\n\nconst classes = {\n contentRoot: `${componentName}-contentRoot`,\n lessPadding: `${componentName}-lessPadding`,\n variantSuccess: `${componentName}-variantSuccess`,\n variantError: `${componentName}-variantError`,\n variantInfo: `${componentName}-variantInfo`,\n variantWarning: `${componentName}-variantWarning`,\n message: `${componentName}-message`,\n action: `${componentName}-action`,\n wrappedRoot: `${componentName}-wrappedRoot`,\n}\n\nconst StyledSnackbar = styled(Snackbar)(({ theme }) => {\n const mode = theme.palette.mode\n const backgroundColor = emphasize(\n theme.palette.background.default,\n mode === 'light' ? 0.8 : 0.98,\n )\n\n return {\n [`&.${classes.wrappedRoot}`]: {\n position: 'relative',\n transform: 'translateX(0)',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n [`.${classes.contentRoot}`]: {\n ...theme.typography.body2,\n backgroundColor,\n color: theme.palette.getContrastText(backgroundColor),\n alignItems: 'center',\n padding: '6px 16px',\n borderRadius: '4px',\n boxShadow:\n '0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)',\n },\n [`.${classes.lessPadding}`]: {\n paddingLeft: 8 * 2.5,\n },\n [`.${classes.variantSuccess}`]: {\n backgroundColor: '#43a047', // green\n color: '#fff',\n },\n [`.${classes.variantError}`]: {\n backgroundColor: '#d32f2f', // dark red\n color: '#fff',\n },\n [`.${classes.variantInfo}`]: {\n backgroundColor: '#2196f3', // nice blue\n color: '#fff',\n },\n [`.${classes.variantWarning}`]: {\n backgroundColor: '#ff9800', // amber\n color: '#fff',\n },\n [`.${classes.message}`]: {\n display: 'flex',\n alignItems: 'center',\n padding: '8px 0',\n },\n [`.${classes.action}`]: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n paddingLeft: 16,\n marginRight: -8,\n },\n }\n})\n\ntype RemovedProps =\n | 'variant' // the one received from Provider is processed and passed to snack prop\n | 'anchorOrigin' // same as above\n | 'autoHideDuration' // same as above\n | 'preventDuplicate' // the one recevied from enqueueSnackbar is processed in provider, therefore\n// shouldn't be passed to SnackbarItem */\n\nexport interface SnackbarItemProps\n extends RequiredBy<\n Omit<SharedProps, RemovedProps>,\n 'onEntered' | 'onExited' | 'onClose'\n > {\n snack: Snack\n dense: ProviderProps['dense']\n iconVariant: ProviderProps['iconVariant']\n hideIconVariant: ProviderProps['hideIconVariant']\n classes: Partial<ClassNameMap<SnackbarClassKey>>\n}\n\nconst SnackbarItem = forwardRef<any, SnackbarItemProps>((props, ref) => {\n const { classes: propClasses, ...rest } = props\n const timeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const [collapsed, setCollapsed] = useState(true)\n\n useEffect(\n () => (): void => {\n if (timeout.current) {\n clearTimeout(timeout.current)\n }\n },\n [],\n )\n\n const handleClose = createChainedFunction(\n [rest.snack.onClose, rest.onClose],\n null,\n rest.snack.snackbarId,\n )\n\n const handleEntered: TransitionHandlerProps['onEntered'] = () => {\n if (rest.snack.requestClose) {\n handleClose(null, REASONS.INSTRUCTED)\n }\n }\n\n const handleExitedScreen = (): void => {\n timeout.current = setTimeout(() => {\n setCollapsed(!collapsed)\n }, 125)\n }\n\n const {\n style,\n dense,\n ariaAttributes: otherAriaAttributes,\n className: otherClassName,\n hideIconVariant,\n iconVariant,\n snack,\n action: otherAction,\n content: otherContent,\n TransitionComponent: otherTranComponent,\n TransitionProps: otherTranProps,\n transitionDuration: otherTranDuration,\n onEnter: ignoredOnEnter,\n onEntered: ignoredOnEntered,\n onEntering: ignoredOnEntering,\n onExit: ignoredOnExit,\n onExited: ignoredOnExited,\n onExiting: ignoredOnExiting,\n ...other\n } = rest\n\n const {\n persist,\n snackbarId,\n open,\n entered,\n requestClose,\n className: singleClassName,\n variant,\n content: singleContent,\n action: singleAction,\n ariaAttributes: singleAriaAttributes,\n anchorOrigin,\n message: snackMessage,\n TransitionComponent: singleTranComponent,\n TransitionProps: singleTranProps,\n transitionDuration: singleTranDuration,\n onEnter,\n onEntered,\n onEntering,\n onExit,\n onExited,\n onExiting,\n ...singleSnackProps\n } = snack\n\n const icon = {\n ...defaultIconVariants,\n ...iconVariant,\n }[variant]\n\n const ariaAttributes = {\n 'aria-describedby': 'notistack-snackbar',\n ...objectMerge(singleAriaAttributes, otherAriaAttributes),\n }\n\n const TransitionComponent =\n singleTranComponent || otherTranComponent || DEFAULTS.TransitionComponent\n const transitionDuration = objectMerge(\n singleTranDuration,\n otherTranDuration,\n DEFAULTS.transitionDuration,\n )\n const transitionProps = {\n direction: getTransitionDirection(anchorOrigin),\n ...objectMerge(singleTranProps, otherTranProps),\n }\n\n let action = singleAction || otherAction\n if (typeof action === 'function') {\n action = action(snackbarId)\n }\n\n let content = singleContent || otherContent\n if (typeof content === 'function') {\n content = content(snackbarId, snack.message)\n }\n\n // eslint-disable-next-line operator-linebreak\n const callbacks: { [key in keyof TransitionHandlerProps]?: any } = [\n 'onEnter',\n 'onEntering',\n 'onEntered',\n 'onExit',\n 'onExiting',\n 'onExited',\n ].reduce(\n (acc, callbackName) => ({\n ...acc,\n [callbackName]: createChainedFunction(\n [\n rest.snack[callbackName as keyof Snack],\n rest[callbackName as keyof SnackbarItemProps],\n ],\n null,\n rest.snack.snackbarId,\n ),\n }),\n {},\n )\n\n return (\n <Collapse\n ref={ref}\n unmountOnExit\n timeout={175}\n in={collapsed}\n onExited={callbacks.onExited}\n >\n <StyledSnackbar\n {...other}\n {...singleSnackProps}\n open={open}\n className={clsx(\n propClasses.root,\n classes.wrappedRoot,\n propClasses[transformer.toAnchorOrigin(anchorOrigin)],\n )}\n onClose={handleClose}\n >\n <TransitionComponent\n appear\n in={open}\n timeout={transitionDuration}\n {...transitionProps}\n onExit={callbacks.onExit}\n onExiting={callbacks.onExiting}\n onExited={handleExitedScreen}\n onEnter={callbacks.onEnter}\n onEntering={callbacks.onEntering}\n // order matters. first callbacks.onEntered to set entered: true,\n // then handleEntered to check if there's a request for closing\n onEntered={createChainedFunction([\n callbacks.onEntered,\n handleEntered,\n ])}\n >\n {/* @ts-expect-error — SnackbarContent children typing is overly strict */}\n {content || (\n <SnackbarContent\n {...ariaAttributes}\n role=\"alert\"\n style={style}\n className={clsx(\n classes.contentRoot,\n { [classes.lessPadding]: !hideIconVariant && icon },\n classes[transformer.toVariant(variant)],\n propClasses[transformer.toVariant(variant)],\n otherClassName,\n singleClassName,\n )}\n >\n <div\n id={ariaAttributes['aria-describedby']}\n className={classes.message}\n >\n {!hideIconVariant ? icon : null}\n {snackMessage}\n </div>\n {action && <div className={classes.action}>{action}</div>}\n </SnackbarContent>\n )}\n </TransitionComponent>\n </StyledSnackbar>\n </Collapse>\n )\n})\n\nexport default SnackbarItem\n"],"names":["createChainedFunction","Collapse","emphasize","styled","clsx","forwardRef","useEffect","useRef","useState","SnackbarContent","DEFAULTS","objectMerge","REASONS","transformer","defaultIconVariants","Snackbar","getTransitionDirection","componentName","classes","contentRoot","lessPadding","variantSuccess","variantError","variantInfo","variantWarning","message","action","wrappedRoot","StyledSnackbar","theme","mode","palette","backgroundColor","background","default","position","transform","top","right","bottom","left","typography","body2","color","getContrastText","alignItems","padding","borderRadius","boxShadow","paddingLeft","display","marginLeft","marginRight","SnackbarItem","props","ref","propClasses","rest","timeout","undefined","collapsed","setCollapsed","current","clearTimeout","handleClose","snack","onClose","snackbarId","handleEntered","requestClose","INSTRUCTED","handleExitedScreen","setTimeout","style","dense","ariaAttributes","otherAriaAttributes","className","otherClassName","hideIconVariant","iconVariant","otherAction","content","otherContent","TransitionComponent","otherTranComponent","TransitionProps","otherTranProps","transitionDuration","otherTranDuration","onEnter","ignoredOnEnter","onEntered","ignoredOnEntered","onEntering","ignoredOnEntering","onExit","ignoredOnExit","onExited","ignoredOnExited","onExiting","ignoredOnExiting","other","persist","open","entered","singleClassName","variant","singleContent","singleAction","singleAriaAttributes","anchorOrigin","snackMessage","singleTranComponent","singleTranProps","singleTranDuration","singleSnackProps","icon","transitionProps","direction","callbacks","reduce","acc","callbackName","unmountOnExit","in","root","toAnchorOrigin","appear","role","toVariant","div","id"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,yDAAyD;AACzD,SAASA,qBAAqB,QAAQ,2BAA0B;AAChE,SACEC,QAAQ,EACRC,SAAS,EAETC,MAAM,QACD,gBAAe;AACtB,OAAOC,UAAU,OAAM;AACvB,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,OAAOC,qBAAqB,wBAAoB;AAShD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAEC,WAAW,QAAQ,wBAAoB;AAChF,OAAOC,yBAAyB,kCAA8B;AAC9D,OAAOC,cAAc,gBAAY;AACjC,SAASC,sBAAsB,QAAQ,yBAAqB;AAE5D,MAAMC,gBAAgB;AAEtB,MAAMC,UAAU;IACdC,aAAa,GAAGF,cAAc,YAAY,CAAC;IAC3CG,aAAa,GAAGH,cAAc,YAAY,CAAC;IAC3CI,gBAAgB,GAAGJ,cAAc,eAAe,CAAC;IACjDK,cAAc,GAAGL,cAA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"version":3,"sources":["../../../../../../../../libs/shared/ui/snackstack/src/lib/SnackbarItem/SnackbarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { createChainedFunction } from '@aglyn/shared-util-tools'\nimport {\n Collapse,\n emphasize,\n IconButton,\n SvgIcon,\n type SnackbarClassKey,\n styled,\n} from '@mui/material'\nimport clsx from 'clsx'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\nimport SnackbarContent from '../SnackbarContent'\nimport { type Snack } from '../SnackbarProvider'\nimport {\n type ClassNameMap,\n type RequiredBy,\n type SharedProps,\n type SnackbarProviderProps as ProviderProps,\n type TransitionHandlerProps,\n} from '../types'\nimport { DEFAULTS, objectMerge, REASONS, transformer } from '../utils/constants'\nimport defaultIconVariants from '../utils/defaultIconVariants'\nimport Snackbar from './Snackbar'\nimport { getTransitionDirection } from './SnackbarItem.util'\n\nconst componentName = 'SnackbarItem'\n\nconst classes = {\n contentRoot: `${componentName}-contentRoot`,\n lessPadding: `${componentName}-lessPadding`,\n variantSuccess: `${componentName}-variantSuccess`,\n variantError: `${componentName}-variantError`,\n variantInfo: `${componentName}-variantInfo`,\n variantWarning: `${componentName}-variantWarning`,\n message: `${componentName}-message`,\n action: `${componentName}-action`,\n wrappedRoot: `${componentName}-wrappedRoot`,\n}\n\nconst StyledSnackbar = styled(Snackbar)(({ theme }) => {\n const mode = theme.palette.mode\n const backgroundColor = emphasize(\n theme.palette.background.default,\n mode === 'light' ? 0.8 : 0.98,\n )\n\n return {\n [`&.${classes.wrappedRoot}`]: {\n position: 'relative',\n transform: 'translateX(0)',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n [`.${classes.contentRoot}`]: {\n ...theme.typography.body2,\n backgroundColor,\n color: theme.palette.getContrastText(backgroundColor),\n alignItems: 'center',\n padding: '6px 16px',\n borderRadius: '4px',\n boxShadow:\n '0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)',\n },\n [`.${classes.lessPadding}`]: {\n paddingLeft: 8 * 2.5,\n },\n [`.${classes.variantSuccess}`]: {\n backgroundColor: '#43a047', // green\n color: '#fff',\n },\n [`.${classes.variantError}`]: {\n backgroundColor: '#d32f2f', // dark red\n color: '#fff',\n },\n [`.${classes.variantInfo}`]: {\n backgroundColor: '#2196f3', // nice blue\n color: '#fff',\n },\n [`.${classes.variantWarning}`]: {\n backgroundColor: '#ff9800', // amber\n color: '#fff',\n },\n [`.${classes.message}`]: {\n display: 'flex',\n alignItems: 'center',\n padding: '8px 0',\n },\n [`.${classes.action}`]: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n paddingLeft: 16,\n marginRight: -8,\n },\n }\n})\n\ntype RemovedProps =\n | 'variant' // the one received from Provider is processed and passed to snack prop\n | 'anchorOrigin' // same as above\n | 'autoHideDuration' // same as above\n | 'preventDuplicate' // the one recevied from enqueueSnackbar is processed in provider, therefore\n// shouldn't be passed to SnackbarItem */\n\nexport interface SnackbarItemProps\n extends RequiredBy<\n Omit<SharedProps, RemovedProps>,\n 'onEntered' | 'onExited' | 'onClose'\n > {\n snack: Snack\n dense: ProviderProps['dense']\n iconVariant: ProviderProps['iconVariant']\n hideIconVariant: ProviderProps['hideIconVariant']\n classes: Partial<ClassNameMap<SnackbarClassKey>>\n}\n\n/** mdi `close`, inline: this package draws its own icons (`defaultIconVariants`). */\nconst CLOSE_ICON_PATH =\n 'M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z'\n\nconst SnackbarItem = forwardRef<any, SnackbarItemProps>((props, ref) => {\n const { classes: propClasses, ...rest } = props\n const timeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const [collapsed, setCollapsed] = useState(true)\n\n useEffect(\n () => (): void => {\n if (timeout.current) {\n clearTimeout(timeout.current)\n }\n },\n [],\n )\n\n const handleClose = createChainedFunction(\n [rest.snack.onClose, rest.onClose],\n null,\n rest.snack.snackbarId,\n )\n\n const handleEntered: TransitionHandlerProps['onEntered'] = () => {\n if (rest.snack.requestClose) {\n handleClose(null, REASONS.INSTRUCTED)\n }\n }\n\n const handleExitedScreen = (): void => {\n timeout.current = setTimeout(() => {\n setCollapsed(!collapsed)\n }, 125)\n }\n\n const {\n style,\n dense,\n ariaAttributes: otherAriaAttributes,\n className: otherClassName,\n hideIconVariant,\n iconVariant,\n snack,\n action: otherAction,\n dismissible: otherDismissible,\n content: otherContent,\n TransitionComponent: otherTranComponent,\n TransitionProps: otherTranProps,\n transitionDuration: otherTranDuration,\n onEnter: ignoredOnEnter,\n onEntered: ignoredOnEntered,\n onEntering: ignoredOnEntering,\n onExit: ignoredOnExit,\n onExited: ignoredOnExited,\n onExiting: ignoredOnExiting,\n ...other\n } = rest\n\n const {\n persist,\n snackbarId,\n open,\n entered,\n requestClose,\n className: singleClassName,\n variant,\n content: singleContent,\n action: singleAction,\n dismissible: singleDismissible,\n ariaAttributes: singleAriaAttributes,\n anchorOrigin,\n message: snackMessage,\n TransitionComponent: singleTranComponent,\n TransitionProps: singleTranProps,\n transitionDuration: singleTranDuration,\n onEnter,\n onEntered,\n onEntering,\n onExit,\n onExited,\n onExiting,\n ...singleSnackProps\n } = snack\n\n const icon = {\n ...defaultIconVariants,\n ...iconVariant,\n }[variant]\n\n const ariaAttributes = {\n 'aria-describedby': 'notistack-snackbar',\n ...objectMerge(singleAriaAttributes, otherAriaAttributes),\n }\n\n const TransitionComponent =\n singleTranComponent || otherTranComponent || DEFAULTS.TransitionComponent\n const transitionDuration = objectMerge(\n singleTranDuration,\n otherTranDuration,\n DEFAULTS.transitionDuration,\n )\n const transitionProps = {\n direction: getTransitionDirection(anchorOrigin),\n ...objectMerge(singleTranProps, otherTranProps),\n }\n\n let action = singleAction || otherAction\n if (typeof action === 'function') {\n action = action(snackbarId)\n }\n\n const dismissible = singleDismissible ?? otherDismissible ?? false\n\n let content = singleContent || otherContent\n if (typeof content === 'function') {\n content = content(snackbarId, snack.message)\n }\n\n // eslint-disable-next-line operator-linebreak\n const callbacks: { [key in keyof TransitionHandlerProps]?: any } = [\n 'onEnter',\n 'onEntering',\n 'onEntered',\n 'onExit',\n 'onExiting',\n 'onExited',\n ].reduce(\n (acc, callbackName) => ({\n ...acc,\n [callbackName]: createChainedFunction(\n [\n rest.snack[callbackName as keyof Snack],\n rest[callbackName as keyof SnackbarItemProps],\n ],\n null,\n rest.snack.snackbarId,\n ),\n }),\n {},\n )\n\n return (\n <Collapse\n ref={ref}\n unmountOnExit\n timeout={175}\n in={collapsed}\n onExited={callbacks.onExited}\n >\n <StyledSnackbar\n {...other}\n {...singleSnackProps}\n open={open}\n className={clsx(\n propClasses.root,\n classes.wrappedRoot,\n propClasses[transformer.toAnchorOrigin(anchorOrigin)],\n )}\n onClose={handleClose}\n >\n <TransitionComponent\n appear\n in={open}\n timeout={transitionDuration}\n {...transitionProps}\n onExit={callbacks.onExit}\n onExiting={callbacks.onExiting}\n onExited={handleExitedScreen}\n onEnter={callbacks.onEnter}\n onEntering={callbacks.onEntering}\n // order matters. first callbacks.onEntered to set entered: true,\n // then handleEntered to check if there's a request for closing\n onEntered={createChainedFunction([\n callbacks.onEntered,\n handleEntered,\n ])}\n >\n {/* @ts-expect-error — SnackbarContent children typing is overly strict */}\n {content || (\n <SnackbarContent\n {...ariaAttributes}\n role=\"alert\"\n style={style}\n className={clsx(\n classes.contentRoot,\n { [classes.lessPadding]: !hideIconVariant && icon },\n classes[transformer.toVariant(variant)],\n propClasses[transformer.toVariant(variant)],\n otherClassName,\n singleClassName,\n )}\n >\n <div\n id={ariaAttributes['aria-describedby']}\n className={classes.message}\n >\n {!hideIconVariant ? icon : null}\n {snackMessage}\n </div>\n {action || dismissible ? (\n <div className={classes.action}>\n {action}\n {dismissible ? (\n <IconButton\n size=\"small\"\n color=\"inherit\"\n aria-label=\"Dismiss\"\n // Closes it the way `closeSnackbar` does, so the\n // provider's own `onClose` hears the same reason.\n onClick={() => handleClose(null, REASONS.INSTRUCTED)}\n >\n <SvgIcon fontSize=\"small\">\n <path d={CLOSE_ICON_PATH} />\n </SvgIcon>\n </IconButton>\n ) : null}\n </div>\n ) : null}\n </SnackbarContent>\n )}\n </TransitionComponent>\n </StyledSnackbar>\n </Collapse>\n )\n})\n\nexport default SnackbarItem\n"],"names":["createChainedFunction","Collapse","emphasize","IconButton","SvgIcon","styled","clsx","forwardRef","useEffect","useRef","useState","SnackbarContent","DEFAULTS","objectMerge","REASONS","transformer","defaultIconVariants","Snackbar","getTransitionDirection","componentName","classes","contentRoot","lessPadding","variantSuccess","variantError","variantInfo","variantWarning","message","action","wrappedRoot","StyledSnackbar","theme","mode","palette","backgroundColor","background","default","position","transform","top","right","bottom","left","typography","body2","color","getContrastText","alignItems","padding","borderRadius","boxShadow","paddingLeft","display","marginLeft","marginRight","CLOSE_ICON_PATH","SnackbarItem","props","ref","singleDismissible","propClasses","rest","timeout","undefined","collapsed","setCollapsed","current","clearTimeout","handleClose","snack","onClose","snackbarId","handleEntered","requestClose","INSTRUCTED","handleExitedScreen","setTimeout","style","dense","ariaAttributes","otherAriaAttributes","className","otherClassName","hideIconVariant","iconVariant","otherAction","dismissible","otherDismissible","content","otherContent","TransitionComponent","otherTranComponent","TransitionProps","otherTranProps","transitionDuration","otherTranDuration","onEnter","ignoredOnEnter","onEntered","ignoredOnEntered","onEntering","ignoredOnEntering","onExit","ignoredOnExit","onExited","ignoredOnExited","onExiting","ignoredOnExiting","other","persist","open","entered","singleClassName","variant","singleContent","singleAction","singleAriaAttributes","anchorOrigin","snackMessage","singleTranComponent","singleTranProps","singleTranDuration","singleSnackProps","icon","transitionProps","direction","callbacks","reduce","acc","callbackName","unmountOnExit","in","root","toAnchorOrigin","appear","role","toVariant","div","id","size","aria-label","onClick","fontSize","path","d"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,yDAAyD;AACzD,SAASA,qBAAqB,QAAQ,2BAA0B;AAChE,SACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,OAAO,EAEPC,MAAM,QACD,gBAAe;AACtB,OAAOC,UAAU,OAAM;AACvB,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,OAAOC,qBAAqB,wBAAoB;AAShD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAEC,WAAW,QAAQ,wBAAoB;AAChF,OAAOC,yBAAyB,kCAA8B;AAC9D,OAAOC,cAAc,gBAAY;AACjC,SAASC,sBAAsB,QAAQ,yBAAqB;AAE5D,MAAMC,gBAAgB;AAEtB,MAAMC,UAAU;IACdC,aAAa,GAAGF,cAAc,YAAY,CAAC;IAC3CG,aAAa,GAAGH,cAAc,YAAY,CAAC;IAC3CI,gBAAgB,GAAGJ,cAAc,eAAe,CAAC;IACjDK,cAAc,GAAGL,cAAc,aAAa,CAAC;IAC7CM,aAAa,GAAGN,cAAc,YAAY,CAAC;IAC3CO,gBAAgB,GAAGP,cAAc,eAAe,CAAC;IACjDQ,SAAS,GAAGR,cAAc,QAAQ,CAAC;IACnCS,QAAQ,GAAGT,cAAc,OAAO,CAAC;IACjCU,aAAa,GAAGV,cAAc,YAAY,CAAC;AAC7C;AAEA,MAAMW,iBAAiBzB,OAAOY,UAAU,CAAC,EAAEc,KAAK,EAAE;IAChD,MAAMC,OAAOD,MAAME,OAAO,CAACD,IAAI;IAC/B,MAAME,kBAAkBhC,UACtB6B,MAAME,OAA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;;6BAEJ;;;;;;AAOlB;AAEA,eAAeC,aAAY"}
@@ -201,6 +201,13 @@ export interface SharedProps extends Omit<SnackbarProps, 'classes' | 'content'>,
201
201
  * @param {string|number} snackbarId ID of a snackbar
202
202
  */
203
203
  action?: SnackbarAction;
204
+ /**
205
+ * A close button after the message (and after any `action`), so a reader
206
+ * can clear a toast without waiting out its timer. Set on the provider for
207
+ * every snackbar; a single snackbar can still opt out with `false`.
208
+ * @default false
209
+ */
210
+ dismissible?: boolean;
204
211
  }
205
212
  /**
206
213
  * @category Enqueue
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/shared/ui/snackstack/src/lib/types.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Part of the following typing and documentation is from\n * material-ui/src/Snackbar/Snackbar.d.ts\n */\nimport type {\n ClickAwayListenerProps,\n SnackbarClassKey,\n StandardProps,\n} from '@mui/material'\nimport { TransitionProps } from '@mui/material/transitions'\nimport type {\n AriaAttributes,\n ComponentType,\n HTMLAttributes,\n Ref,\n SyntheticEvent,\n} from 'react'\nimport type SnackbarProvider from './SnackbarProvider'\n\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>\nexport type ClassNameMap<ClassKey extends string = string> = Record<\n ClassKey,\n string\n>\ntype Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>\ntype Modify<T, R> = Pick<T, Exclude<keyof T, keyof R>> & R\n\nexport type SnackbarId = string | number\nexport type VariantType = 'default' | 'error' | 'success' | 'warning' | 'info'\nexport type CloseReason = 'timeout' | 'clickaway' | 'maxsnack' | 'instructed'\n\nexport type SnackbarMessage = string | JSX.Node\nexport type SnackbarAction = JSX.Node | ((snackbarId: SnackbarId) => JSX.Node)\nexport type SnackbarContentCallback =\n | JSX.Node\n | ((snackbarId: SnackbarId, message: SnackbarMessage) => JSX.Node)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TransitionCloseHandler = (\n event: SyntheticEvent<any> | null,\n reason: CloseReason,\n snackbarId?: SnackbarId,\n) => void\nexport type TransitionEnterHandler = (\n node: HTMLElement,\n isAppearing: boolean,\n snackbarId: SnackbarId,\n) => void\nexport type TransitionHandler = (\n node: HTMLElement,\n snackbarId: SnackbarId,\n) => void\n\nexport type ContainerClassKey =\n | 'containerRoot'\n | 'containerAnchorOriginTopCenter'\n | 'containerAnchorOriginBottomCenter'\n | 'containerAnchorOriginTopRight'\n | 'containerAnchorOriginBottomRight'\n | 'containerAnchorOriginTopLeft'\n | 'containerAnchorOriginBottomLeft'\n\nexport type VariantClassKey =\n | 'variantSuccess'\n | 'variantError'\n | 'variantInfo'\n | 'variantWarning'\nexport type CombinedClassKey =\n | VariantClassKey\n | ContainerClassKey\n | SnackbarClassKey\n\nexport interface SnackbarOrigin {\n vertical: 'top' | 'bottom'\n horizontal: 'left' | 'center' | 'right'\n}\n\nexport interface IconVariant {\n /**\n * Icon displayed when variant of a snackbar is set to `default`.\n */\n default: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `error`.\n */\n error: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `success`.\n */\n success: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `warning`.\n */\n warning: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `info`.\n */\n info: JSX.Node\n}\n\n/**\n * @category Shared\n */\nexport interface TransitionHandlerProps {\n /**\n * Callback fired before snackbar requests to get closed.\n * The `reason` parameter can optionally be used to control the response to\n * `onClose`.\n *\n * @param {object} event The event source of the callback\n * @param {string} reason Can be:`\"timeout\"` (`autoHideDuration` expired) or:\n * `\"clickaway\"` or: `\"maxsnack\"` (snackbar was closed because `maxSnack`\n * has reached) or: `\"instructed\"`\n * (snackbar was closed programmatically)\n * @param {string|number|undefined} snackbarId ID of a Snackbar. snackbarId\n * will be `undefined` if closeSnackbar is called with no snackbarId (user\n * requested all the snackbars to be closed)\n */\n onClose: TransitionCloseHandler\n /**\n * Callback fired before the transition is entering.\n */\n onEnter: TransitionHandler\n /**\n * Callback fired when the transition is entering.\n */\n onEntering: TransitionHandler\n /**\n * Callback fired when the transition has entered.\n */\n onEntered: TransitionEnterHandler\n /**\n * Callback fired before the transition is exiting.\n */\n onExit: TransitionHandler\n /**\n * Callback fired when the transition is exiting.\n */\n onExiting: TransitionHandler\n /**\n * Callback fired when the transition has exited.\n */\n onExited: TransitionHandler\n}\n\nexport type SnackbarContentProps = HTMLAttributes<HTMLDivElement>\n\n// backwards compatibility\nexport type WithSnackbarProps = ProviderContext\n\n/**\n * @category Shared\n */\nexport interface SnackbarProps\n extends StandardProps<HTMLAttributes<HTMLDivElement>, SnackbarClassKey> {\n /**\n * The anchor of the `Snackbar`.\n * @default { horizontal: left, vertical: bottom }\n */\n anchorOrigin?: SnackbarOrigin\n /**\n * The number of milliseconds to wait before automatically calling the\n * `onClose` function. By default snackbars get closed after 5000\n * milliseconds. Set autoHideDuration to 'null' if you don't want snackbars\n * to automatically close. Alternatively pass `persist: true` in the options\n * parameter of enqueueSnackbar.\n * @default 5000\n */\n autoHideDuration?: number | null\n /**\n * @ignore\n * Properties applied to ClickAwayListener component\n */\n ClickAwayListenerProps?: Partial<ClickAwayListenerProps>\n /**\n * Aria attributes applied to snackbar's content component\n */\n ariaAttributes?: AriaAttributes\n /**\n * If `true`, the `autoHideDuration` timer will expire even if the window is\n * not focused.\n * @default false\n */\n disableWindowBlurListener?: boolean\n /**\n * The number of milliseconds to wait before dismissing after user\n * interaction. If `autoHideDuration` property isn't specified, it does\n * nothing. If `autoHideDuration` property is specified but\n * `resumeHideDuration` isn't, we use the default value.\n * @default autoHideDuration / 2 ms.\n */\n resumeHideDuration?: number\n /**\n * The component used for the transition. (e.g. Slide, Grow, Zoom, etc.)\n * @default Slide\n */\n TransitionComponent?: ComponentType<TransitionProps>\n /**\n * The duration for the transition, in milliseconds.\n * You may specify the duration with an object in the following shape:\n * ```js\n * transitionDuration={{ enter: 300, exit: 500 }}\n * ```\n * @default { enter: 225, exit: 195 }\n */\n transitionDuration?: { appear?: number; enter?: number; exit?: number }\n /**\n * Properties applied to Transition component (e.g. Slide, Grow, Zoom, etc.)\n */\n TransitionProps?: TransitionProps\n}\n\n/**\n * @category Shared\n */\nexport interface SharedProps\n extends Omit<SnackbarProps, 'classes' | 'content'>,\n Partial<TransitionHandlerProps> {\n /**\n * Used to easily display different variant of snackbars. When passed to\n * `SnackbarProvider` all snackbars inherit the `variant`, unless you\n * override it in `enqueueSnackbar` options.\n * @default default\n */\n variant?: VariantType\n /**\n * Ignores displaying multiple snackbars with the same `message`\n * @default false\n */\n allowDuplicate?: boolean\n /**\n * Replace the snackbar. Callback used for displaying entirely customized\n * snackbar.\n * @param {string|number} snackbarId ID of a snackbar\n */\n content?: SnackbarContentCallback\n /**\n * Callback used for getting action(s). actions are mostly buttons displayed\n * in Snackbar.\n * @param {string|number} snackbarId ID of a snackbar\n */\n action?: SnackbarAction\n}\n\n/**\n * @category Enqueue\n */\nexport interface OptionsObject extends SharedProps {\n /**\n * Unique identifier to reference a snackbar.\n * @default random unique string\n */\n snackbarId?: SnackbarId\n /**\n * Snackbar stays on the screen, unless it is dismissed (programmatically or\n * through user interaction).\n * @default false\n */\n persist?: boolean\n}\n\n/**\n * All material-ui props, including class keys for notistack and material-ui\n * with additional notistack props\n * @category Provider\n */\nexport interface SnackbarProviderProps extends SharedProps {\n /**\n * Most of the time this is your App. every component from this point onward\n * will be able to show snackbars.\n */\n children: JSX.Children\n /**\n * Denser margins for snackbars. Recommended to be used on mobile devices.\n * @default false\n */\n dense?: boolean\n /**\n * Maximum snackbars that can be stacked on top of one another.\n * @default 3\n */\n maxSnack?: number\n /**\n * Hides iconVariant if set to `true`.\n * @default false\n */\n hideIconVariant?: boolean\n /**\n * Valid and exist HTML Node element, used to target `ReactDOM.createPortal`\n */\n domRoot?: HTMLElement\n /**\n * Override or extend the styles applied to the container component or\n * Snackbars.\n */\n classes?: Partial<ClassNameMap<CombinedClassKey>>\n /**\n * Little icon that is displayed at left corner of a snackbar.\n */\n iconVariant?: Partial<IconVariant>\n /**\n * @ignore\n * SnackbarProvider's ref\n */\n ref?: Ref<SnackbarProvider>\n}\n\nexport interface ProviderContext {\n enqueueSnackbar: (\n message: SnackbarMessage,\n options?: OptionsObject,\n ) => SnackbarId\n closeSnackbar: (snackbarId?: SnackbarId) => void\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAgTD,WAMC"}
1
+ {"version":3,"sources":["../../../../../../../libs/shared/ui/snackstack/src/lib/types.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Part of the following typing and documentation is from\n * material-ui/src/Snackbar/Snackbar.d.ts\n */\nimport type {\n ClickAwayListenerProps,\n SnackbarClassKey,\n StandardProps,\n} from '@mui/material'\nimport { TransitionProps } from '@mui/material/transitions'\nimport type {\n AriaAttributes,\n ComponentType,\n HTMLAttributes,\n Ref,\n SyntheticEvent,\n} from 'react'\nimport type SnackbarProvider from './SnackbarProvider'\n\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>\nexport type ClassNameMap<ClassKey extends string = string> = Record<\n ClassKey,\n string\n>\ntype Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>\ntype Modify<T, R> = Pick<T, Exclude<keyof T, keyof R>> & R\n\nexport type SnackbarId = string | number\nexport type VariantType = 'default' | 'error' | 'success' | 'warning' | 'info'\nexport type CloseReason = 'timeout' | 'clickaway' | 'maxsnack' | 'instructed'\n\nexport type SnackbarMessage = string | JSX.Node\nexport type SnackbarAction = JSX.Node | ((snackbarId: SnackbarId) => JSX.Node)\nexport type SnackbarContentCallback =\n | JSX.Node\n | ((snackbarId: SnackbarId, message: SnackbarMessage) => JSX.Node)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TransitionCloseHandler = (\n event: SyntheticEvent<any> | null,\n reason: CloseReason,\n snackbarId?: SnackbarId,\n) => void\nexport type TransitionEnterHandler = (\n node: HTMLElement,\n isAppearing: boolean,\n snackbarId: SnackbarId,\n) => void\nexport type TransitionHandler = (\n node: HTMLElement,\n snackbarId: SnackbarId,\n) => void\n\nexport type ContainerClassKey =\n | 'containerRoot'\n | 'containerAnchorOriginTopCenter'\n | 'containerAnchorOriginBottomCenter'\n | 'containerAnchorOriginTopRight'\n | 'containerAnchorOriginBottomRight'\n | 'containerAnchorOriginTopLeft'\n | 'containerAnchorOriginBottomLeft'\n\nexport type VariantClassKey =\n | 'variantSuccess'\n | 'variantError'\n | 'variantInfo'\n | 'variantWarning'\nexport type CombinedClassKey =\n | VariantClassKey\n | ContainerClassKey\n | SnackbarClassKey\n\nexport interface SnackbarOrigin {\n vertical: 'top' | 'bottom'\n horizontal: 'left' | 'center' | 'right'\n}\n\nexport interface IconVariant {\n /**\n * Icon displayed when variant of a snackbar is set to `default`.\n */\n default: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `error`.\n */\n error: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `success`.\n */\n success: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `warning`.\n */\n warning: JSX.Node\n /**\n * Icon displayed when variant of a snackbar is set to `info`.\n */\n info: JSX.Node\n}\n\n/**\n * @category Shared\n */\nexport interface TransitionHandlerProps {\n /**\n * Callback fired before snackbar requests to get closed.\n * The `reason` parameter can optionally be used to control the response to\n * `onClose`.\n *\n * @param {object} event The event source of the callback\n * @param {string} reason Can be:`\"timeout\"` (`autoHideDuration` expired) or:\n * `\"clickaway\"` or: `\"maxsnack\"` (snackbar was closed because `maxSnack`\n * has reached) or: `\"instructed\"`\n * (snackbar was closed programmatically)\n * @param {string|number|undefined} snackbarId ID of a Snackbar. snackbarId\n * will be `undefined` if closeSnackbar is called with no snackbarId (user\n * requested all the snackbars to be closed)\n */\n onClose: TransitionCloseHandler\n /**\n * Callback fired before the transition is entering.\n */\n onEnter: TransitionHandler\n /**\n * Callback fired when the transition is entering.\n */\n onEntering: TransitionHandler\n /**\n * Callback fired when the transition has entered.\n */\n onEntered: TransitionEnterHandler\n /**\n * Callback fired before the transition is exiting.\n */\n onExit: TransitionHandler\n /**\n * Callback fired when the transition is exiting.\n */\n onExiting: TransitionHandler\n /**\n * Callback fired when the transition has exited.\n */\n onExited: TransitionHandler\n}\n\nexport type SnackbarContentProps = HTMLAttributes<HTMLDivElement>\n\n// backwards compatibility\nexport type WithSnackbarProps = ProviderContext\n\n/**\n * @category Shared\n */\nexport interface SnackbarProps\n extends StandardProps<HTMLAttributes<HTMLDivElement>, SnackbarClassKey> {\n /**\n * The anchor of the `Snackbar`.\n * @default { horizontal: left, vertical: bottom }\n */\n anchorOrigin?: SnackbarOrigin\n /**\n * The number of milliseconds to wait before automatically calling the\n * `onClose` function. By default snackbars get closed after 5000\n * milliseconds. Set autoHideDuration to 'null' if you don't want snackbars\n * to automatically close. Alternatively pass `persist: true` in the options\n * parameter of enqueueSnackbar.\n * @default 5000\n */\n autoHideDuration?: number | null\n /**\n * @ignore\n * Properties applied to ClickAwayListener component\n */\n ClickAwayListenerProps?: Partial<ClickAwayListenerProps>\n /**\n * Aria attributes applied to snackbar's content component\n */\n ariaAttributes?: AriaAttributes\n /**\n * If `true`, the `autoHideDuration` timer will expire even if the window is\n * not focused.\n * @default false\n */\n disableWindowBlurListener?: boolean\n /**\n * The number of milliseconds to wait before dismissing after user\n * interaction. If `autoHideDuration` property isn't specified, it does\n * nothing. If `autoHideDuration` property is specified but\n * `resumeHideDuration` isn't, we use the default value.\n * @default autoHideDuration / 2 ms.\n */\n resumeHideDuration?: number\n /**\n * The component used for the transition. (e.g. Slide, Grow, Zoom, etc.)\n * @default Slide\n */\n TransitionComponent?: ComponentType<TransitionProps>\n /**\n * The duration for the transition, in milliseconds.\n * You may specify the duration with an object in the following shape:\n * ```js\n * transitionDuration={{ enter: 300, exit: 500 }}\n * ```\n * @default { enter: 225, exit: 195 }\n */\n transitionDuration?: { appear?: number; enter?: number; exit?: number }\n /**\n * Properties applied to Transition component (e.g. Slide, Grow, Zoom, etc.)\n */\n TransitionProps?: TransitionProps\n}\n\n/**\n * @category Shared\n */\nexport interface SharedProps\n extends Omit<SnackbarProps, 'classes' | 'content'>,\n Partial<TransitionHandlerProps> {\n /**\n * Used to easily display different variant of snackbars. When passed to\n * `SnackbarProvider` all snackbars inherit the `variant`, unless you\n * override it in `enqueueSnackbar` options.\n * @default default\n */\n variant?: VariantType\n /**\n * Ignores displaying multiple snackbars with the same `message`\n * @default false\n */\n allowDuplicate?: boolean\n /**\n * Replace the snackbar. Callback used for displaying entirely customized\n * snackbar.\n * @param {string|number} snackbarId ID of a snackbar\n */\n content?: SnackbarContentCallback\n /**\n * Callback used for getting action(s). actions are mostly buttons displayed\n * in Snackbar.\n * @param {string|number} snackbarId ID of a snackbar\n */\n action?: SnackbarAction\n /**\n * A close button after the message (and after any `action`), so a reader\n * can clear a toast without waiting out its timer. Set on the provider for\n * every snackbar; a single snackbar can still opt out with `false`.\n * @default false\n */\n dismissible?: boolean\n}\n\n/**\n * @category Enqueue\n */\nexport interface OptionsObject extends SharedProps {\n /**\n * Unique identifier to reference a snackbar.\n * @default random unique string\n */\n snackbarId?: SnackbarId\n /**\n * Snackbar stays on the screen, unless it is dismissed (programmatically or\n * through user interaction).\n * @default false\n */\n persist?: boolean\n}\n\n/**\n * All material-ui props, including class keys for notistack and material-ui\n * with additional notistack props\n * @category Provider\n */\nexport interface SnackbarProviderProps extends SharedProps {\n /**\n * Most of the time this is your App. every component from this point onward\n * will be able to show snackbars.\n */\n children: JSX.Children\n /**\n * Denser margins for snackbars. Recommended to be used on mobile devices.\n * @default false\n */\n dense?: boolean\n /**\n * Maximum snackbars that can be stacked on top of one another.\n * @default 3\n */\n maxSnack?: number\n /**\n * Hides iconVariant if set to `true`.\n * @default false\n */\n hideIconVariant?: boolean\n /**\n * Valid and exist HTML Node element, used to target `ReactDOM.createPortal`\n */\n domRoot?: HTMLElement\n /**\n * Override or extend the styles applied to the container component or\n * Snackbars.\n */\n classes?: Partial<ClassNameMap<CombinedClassKey>>\n /**\n * Little icon that is displayed at left corner of a snackbar.\n */\n iconVariant?: Partial<IconVariant>\n /**\n * @ignore\n * SnackbarProvider's ref\n */\n ref?: Ref<SnackbarProvider>\n}\n\nexport interface ProviderContext {\n enqueueSnackbar: (\n message: SnackbarMessage,\n options?: OptionsObject,\n ) => SnackbarId\n closeSnackbar: (snackbarId?: SnackbarId) => void\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAuTD,WAMC"}