From dad1e61fa6480f258fbf2c9fa054ec4552070aaa Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 00:53:12 +0100 Subject: [PATCH 01/23] Add mat snackbar --- src/SnackbarItem/Snackbar.js | 253 +++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 src/SnackbarItem/Snackbar.js diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js new file mode 100644 index 00000000..67423400 --- /dev/null +++ b/src/SnackbarItem/Snackbar.js @@ -0,0 +1,253 @@ +import * as React from 'react'; +import clsx from 'clsx'; +import withStyles from '../styles/withStyles'; +import { duration } from '../styles/transitions'; +import ClickAwayListener from '../ClickAwayListener'; +import useEventCallback from '../utils/useEventCallback'; +import capitalize from '../utils/capitalize'; +import createChainedFunction from '../utils/createChainedFunction'; +import Grow from '../Grow'; +import SnackbarContent from '../SnackbarContent'; + +export const styles = (theme) => { + const top1 = { top: 8 }; + const bottom1 = { bottom: 8 }; + const right = { justifyContent: 'flex-end' }; + const left = { justifyContent: 'flex-start' }; + const top3 = { top: 24 }; + const bottom3 = { bottom: 24 }; + const right3 = { right: 24 }; + const left3 = { left: 24 }; + const center = { + left: '50%', + right: 'auto', + transform: 'translateX(-50%)', + }; + + return { + /* Styles applied to the root element. */ + root: { + zIndex: theme.zIndex.snackbar, + position: 'fixed', + display: 'flex', + left: 8, + right: 8, + justifyContent: 'center', + alignItems: 'center', + }, + /* Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */ + anchorOriginTopCenter: { + ...top1, + [theme.breakpoints.up('sm')]: { + ...top3, + ...center, + }, + }, + /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */ + anchorOriginBottomCenter: { + ...bottom1, + [theme.breakpoints.up('sm')]: { + ...bottom3, + ...center, + }, + }, + /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */ + anchorOriginTopRight: { + ...top1, + ...right, + [theme.breakpoints.up('sm')]: { + left: 'auto', + ...top3, + ...right3, + }, + }, + /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */ + anchorOriginBottomRight: { + ...bottom1, + ...right, + [theme.breakpoints.up('sm')]: { + left: 'auto', + ...bottom3, + ...right3, + }, + }, + /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */ + anchorOriginTopLeft: { + ...top1, + ...left, + [theme.breakpoints.up('sm')]: { + right: 'auto', + ...top3, + ...left3, + }, + }, + /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */ + anchorOriginBottomLeft: { + ...bottom1, + ...left, + [theme.breakpoints.up('sm')]: { + right: 'auto', + ...bottom3, + ...left3, + }, + }, + }; +}; + +const Snackbar = React.forwardRef((props, ref) => { + const { + action, + anchorOrigin: { vertical, horizontal } = { vertical: 'bottom', horizontal: 'center' }, + autoHideDuration = null, + children, + classes, + className, + ClickAwayListenerProps, + ContentProps, + disableWindowBlurListener = false, + message, + onClose, + onEnter, + onEntered, + onEntering, + onExit, + onExited, + onExiting, + onMouseEnter, + onMouseLeave, + open, + resumeHideDuration, + TransitionComponent = Grow, + transitionDuration = { + enter: duration.enteringScreen, + exit: duration.leavingScreen, + }, + TransitionProps, + ...other + } = props; + + const timerAutoHide = React.useRef(); + const [exited, setExited] = React.useState(true); + + const handleClose = useEventCallback((...args) => { + if (onClose) { + onClose(...args); + } + }); + + const setAutoHideTimer = useEventCallback((autoHideDurationParam) => { + if (!onClose || autoHideDurationParam == null) { + return; + } + + clearTimeout(timerAutoHide.current); + timerAutoHide.current = setTimeout(() => { + handleClose(null, 'timeout'); + }, autoHideDurationParam); + }); + + React.useEffect(() => { + if (open) { + setAutoHideTimer(autoHideDuration); + } + + return () => { + clearTimeout(timerAutoHide.current); + }; + }, [open, autoHideDuration, setAutoHideTimer]); + + // Pause the timer when the user is interacting with the Snackbar + // or when the user hide the window. + const handlePause = () => { + clearTimeout(timerAutoHide.current); + }; + + // Restart the timer when the user is no longer interacting with the Snackbar + // or when the window is shown back. + const handleResume = React.useCallback(() => { + if (autoHideDuration != null) { + setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5); + } + }, [autoHideDuration, resumeHideDuration, setAutoHideTimer]); + + const handleMouseEnter = (event) => { + if (onMouseEnter) { + onMouseEnter(event); + } + handlePause(); + }; + + const handleMouseLeave = (event) => { + if (onMouseLeave) { + onMouseLeave(event); + } + handleResume(); + }; + + const handleClickAway = (event) => { + if (onClose) { + onClose(event, 'clickaway'); + } + }; + + const handleExited = () => { + setExited(true); + }; + + const handleEnter = () => { + setExited(false); + }; + + React.useEffect(() => { + if (!disableWindowBlurListener && open) { + window.addEventListener('focus', handleResume); + window.addEventListener('blur', handlePause); + + return () => { + window.removeEventListener('focus', handleResume); + window.removeEventListener('blur', handlePause); + }; + } + + return undefined; + }, [disableWindowBlurListener, handleResume, open]); + + // So we only render active snackbars. + if (!open && exited) { + return null; + } + + return ( + +
+ + {children || } + +
+
+ ); +}); + +export default withStyles(styles, { flip: false, name: 'MuiSnackbar' })(Snackbar); From 936ee3f82eeceb32ca60e7e3bd1f2fce5d9a6df1 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 14:56:42 +0100 Subject: [PATCH 02/23] Add snackbar component --- src/SnackbarItem/Snackbar.js | 189 +++------- src/SnackbarItem/SnackbarItem.tsx | 90 ++--- src/SnackbarItem/SnackbarItem.util.ts | 14 - src/SnackbarProvider.tsx | 22 +- src/index.d.ts | 1 - src/utils/constants.ts | 1 + src/utils/defaultIconVariants.tsx | 3 +- typedoc.json | 496 +++++++++++--------------- 8 files changed, 300 insertions(+), 516 deletions(-) diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js index 67423400..6e9bc2a6 100644 --- a/src/SnackbarItem/Snackbar.js +++ b/src/SnackbarItem/Snackbar.js @@ -1,111 +1,45 @@ +/* eslint-disable no-console */ import * as React from 'react'; -import clsx from 'clsx'; -import withStyles from '../styles/withStyles'; -import { duration } from '../styles/transitions'; -import ClickAwayListener from '../ClickAwayListener'; -import useEventCallback from '../utils/useEventCallback'; -import capitalize from '../utils/capitalize'; -import createChainedFunction from '../utils/createChainedFunction'; -import Grow from '../Grow'; -import SnackbarContent from '../SnackbarContent'; - -export const styles = (theme) => { - const top1 = { top: 8 }; - const bottom1 = { bottom: 8 }; - const right = { justifyContent: 'flex-end' }; - const left = { justifyContent: 'flex-start' }; - const top3 = { top: 24 }; - const bottom3 = { bottom: 24 }; - const right3 = { right: 24 }; - const left3 = { left: 24 }; - const center = { - left: '50%', - right: 'auto', - transform: 'translateX(-50%)', - }; +import ClickAwayListener from '@material-ui/core/ClickAwayListener'; +import { REASONS } from 'src/utils/constants'; - return { - /* Styles applied to the root element. */ - root: { - zIndex: theme.zIndex.snackbar, - position: 'fixed', - display: 'flex', - left: 8, - right: 8, - justifyContent: 'center', - alignItems: 'center', - }, - /* Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */ - anchorOriginTopCenter: { - ...top1, - [theme.breakpoints.up('sm')]: { - ...top3, - ...center, - }, - }, - /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */ - anchorOriginBottomCenter: { - ...bottom1, - [theme.breakpoints.up('sm')]: { - ...bottom3, - ...center, - }, - }, - /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */ - anchorOriginTopRight: { - ...top1, - ...right, - [theme.breakpoints.up('sm')]: { - left: 'auto', - ...top3, - ...right3, - }, - }, - /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */ - anchorOriginBottomRight: { - ...bottom1, - ...right, - [theme.breakpoints.up('sm')]: { - left: 'auto', - ...bottom3, - ...right3, - }, - }, - /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */ - anchorOriginTopLeft: { - ...top1, - ...left, - [theme.breakpoints.up('sm')]: { - right: 'auto', - ...top3, - ...left3, - }, - }, - /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */ - anchorOriginBottomLeft: { - ...bottom1, - ...left, - [theme.breakpoints.up('sm')]: { - right: 'auto', - ...bottom3, - ...left3, - }, - }, - }; -}; +const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; + +function useEventCallback(fn) { + const ref = React.useRef(fn); + useEnhancedEffect(() => { + ref.current = fn; + }); + return React.useCallback((...args) => (0, ref.current)(...args), []); +} + +export function createChainedFunction(funcs, extraArg) { + return funcs.reduce((acc, func) => { + if (func == null) return acc; + + if (process.env.NODE_ENV !== 'production') { + if (typeof func !== 'function') { + console.error('Material-UI: Invalid Argument Type, must only provide functions, undefined, or null.'); + } + } + + return function chainedFunction(...args) { + const argums = [...args]; + if (extraArg) argums.push(extraArg); + acc.apply(this, argums); + func.apply(this, argums); + }; + }, () => { }); +} const Snackbar = React.forwardRef((props, ref) => { const { - action, - anchorOrigin: { vertical, horizontal } = { vertical: 'bottom', horizontal: 'center' }, - autoHideDuration = null, + anchorOrigin: dontspread1, + autoHideDuration, children, - classes, className, ClickAwayListenerProps, - ContentProps, disableWindowBlurListener = false, - message, onClose, onEnter, onEntered, @@ -117,17 +51,16 @@ const Snackbar = React.forwardRef((props, ref) => { onMouseLeave, open, resumeHideDuration, - TransitionComponent = Grow, + TransitionComponent, transitionDuration = { - enter: duration.enteringScreen, - exit: duration.leavingScreen, + enter: 225, + exit: 195, }, TransitionProps, ...other } = props; const timerAutoHide = React.useRef(); - const [exited, setExited] = React.useState(true); const handleClose = useEventCallback((...args) => { if (onClose) { @@ -142,7 +75,7 @@ const Snackbar = React.forwardRef((props, ref) => { clearTimeout(timerAutoHide.current); timerAutoHide.current = setTimeout(() => { - handleClose(null, 'timeout'); + handleClose(null, REASONS.TIMEOUT); }, autoHideDurationParam); }); @@ -156,14 +89,18 @@ const Snackbar = React.forwardRef((props, ref) => { }; }, [open, autoHideDuration, setAutoHideTimer]); - // Pause the timer when the user is interacting with the Snackbar - // or when the user hide the window. + /** + * Pause the timer when the user is interacting with the Snackbar + * or when the user hide the window. + */ const handlePause = () => { clearTimeout(timerAutoHide.current); }; - // Restart the timer when the user is no longer interacting with the Snackbar - // or when the window is shown back. + /** + * Restart the timer when the user is no longer interacting with the Snackbar + * or when the window is shown back. + */ const handleResume = React.useCallback(() => { if (autoHideDuration != null) { setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5); @@ -186,18 +123,10 @@ const Snackbar = React.forwardRef((props, ref) => { const handleClickAway = (event) => { if (onClose) { - onClose(event, 'clickaway'); + onClose(event, REASONS.CLICKAWAY); } }; - const handleExited = () => { - setExited(true); - }; - - const handleEnter = () => { - setExited(false); - }; - React.useEffect(() => { if (!disableWindowBlurListener && open) { window.addEventListener('focus', handleResume); @@ -212,42 +141,26 @@ const Snackbar = React.forwardRef((props, ref) => { return undefined; }, [disableWindowBlurListener, handleResume, open]); - // So we only render active snackbars. - if (!open && exited) { - return null; - } - return ( -
+
- {children || } + {children}
); }); -export default withStyles(styles, { flip: false, name: 'MuiSnackbar' })(Snackbar); +export default Snackbar; diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index af379837..9d33acc4 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -1,14 +1,15 @@ import React, { useState, useEffect, useRef } from 'react'; import clsx from 'clsx'; import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles'; -import Snackbar from '@material-ui/core/Snackbar'; import Slide from '@material-ui/core/Slide'; import Collapse from '@material-ui/core/Collapse'; import SnackbarContent from '@material-ui/core/SnackbarContent'; -import { getTransitionDirection, omitNonMuiKeys, omitNonCollapseKeys } from './SnackbarItem.util'; +import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util'; import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/constants'; -import { SnackbarProviderProps, OptionalBy, SnackbarKey, CloseReason, SharedProps, RequiredBy, IconVariant, VariantClassKey } from '../index'; +import { SnackbarProviderProps, SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps } from '../index'; +import defaultIconVariants from '../utils/defaultIconVariants'; import { Snack } from '../SnackbarProvider'; +import Snackbar, { createChainedFunction } from './Snackbar'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const styles = (theme: Theme) => createStyles({ @@ -43,6 +44,10 @@ const styles = (theme: Theme) => createStyles({ right: 0, bottom: 0, left: 0, + zIndex: theme.zIndex.snackbar, + // display: 'flex', + // justifyContent: 'center', + // alignItems: 'center', }, collapseContainer: { [theme.breakpoints.down('xs')]: { @@ -74,7 +79,7 @@ type RemovedProps = export interface SnackbarItemProps extends WithStyles, RequiredBy, 'onEntered' | 'onExited' | 'onClose'> { snack: Snack; dense: SnackbarProviderProps['dense']; - iconVariant: OptionalBy; + iconVariant?: SnackbarProviderProps['iconVariant']; hideIconVariant: SnackbarProviderProps['hideIconVariant']; } @@ -88,60 +93,26 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { } }, []); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const handleClose = (key: SnackbarKey) => (event: React.SyntheticEvent | null, reason: string): void => { - const cause = reason as CloseReason; - if (props.snack.onClose) { - props.snack.onClose(event, cause, key); - } - props.onClose(event, cause, key); - }; - - const handleEntered = (key: SnackbarKey) => (node: HTMLElement, isAppearing: boolean): void => { - const { snack } = props; - if (snack.onEntered) { - snack.onEntered(node, isAppearing, key); - } - props.onEntered(node, isAppearing, key); + const handleClose = createChainedFunction([props.snack.onClose, props.onClose], props.snack.key); - if (snack.requestClose) { - handleClose(key)(null, REASONS.MAXSNACK); + const handleEntered: TransitionHandlerProps['onEntered'] = () => { + if (props.snack.requestClose) { + handleClose(null, REASONS.MAXSNACK); } }; - const handleExited = (key: SnackbarKey) => (node: HTMLElement): void => { - const { onExited, snack: { onExited: singleOnExited } } = props; - if (singleOnExited) singleOnExited(node, key); - onExited(node, key); - }; - const handleExitedScreen = (): void => { timeout.current = setTimeout(() => { setCollapsed(!collapsed); }, 125); }; - const getUnusedCallbacks = () => ( - ['onEnter', 'onEntering', 'onExit', 'onExiting'].reduce((acc, cbName) => ({ - ...acc, - [cbName]: (...args: any[]): void => { - const { snack } = props; - if (typeof snack[cbName] === 'function') { - snack[cbName](...args, snack.key); - } - if (typeof props[cbName] === 'function') { - props[cbName](...args, snack.key); - } - }, - }), {}) - ); - const { action, content, ContentProps = {}, hideIconVariant, - iconVariant, + iconVariant: iVariant, snack, dense, TransitionComponent = Slide, @@ -149,7 +120,12 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { ...other } = props; - const { action: contentAction, className, ...otherContentProps } = ContentProps; + const iconVariant = { + ...defaultIconVariants, + ...iVariant, + }; + + const { className, ...otherContentProps } = ContentProps; const { key, @@ -170,14 +146,13 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { const contentProps = { ...otherContentProps, ...singleContentProps, - action: singleAction || singleContentProps.action || contentAction || action, + action: singleAction || singleContentProps.action || otherContentProps.action || action, }; const transitionProps = { direction: getTransitionDirection(anchorOrigin), ...otherTransitionProps, ...singleTransitionProps, - onExited: handleExitedScreen, }; const ariaDescribedby = contentProps['aria-describedby'] || 'client-snackbar'; @@ -192,13 +167,20 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { snackContent = snackContent(key, snack.message); } + const callbacks: { [key in keyof TransitionHandlerProps]?: any } = + ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].reduce((acc, cbName) => ({ + ...acc, + // @ts-ignore + [cbName]: createChainedFunction([props.snack[cbName], props[cbName]], props.snack.key), + }), {}); + return ( = ({ classes, ...props }) => { open={snack.open} anchorOrigin={anchorOrigin} TransitionProps={transitionProps} - classes={omitNonMuiKeys(classes)} - onClose={handleClose(key)} - onEntered={handleEntered(key)} - {...getUnusedCallbacks()} + className={clsx( + classes.wrappedRoot, + // @ts-ignore + classes[`anchorOrigin${capitalise(anchorOrigin.vertical)}${capitalise(anchorOrigin.horizontal)}`], + // className, // FIXme get the right classname for this + )} + {...callbacks} + onExited={handleExitedScreen} + onEntered={createChainedFunction([handleEntered, callbacks.onEntered], key)} + onClose={handleClose} > {snackContent || ( SnackbarProps['classes'] = (classes) => { - const snackbarMuiClasses = Object.keys(classes) - // @ts-ignore - .filter(key => allClasses.mui[key] !== undefined).reduce((obj, key) => ({ ...obj, [key]: classes[key] }), {}); - - return { - ...snackbarMuiClasses, - root: clsx(classes.root, classes.wrappedRoot), - }; -}; - /** * Omit all class keys except what we need for collapse component */ diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 1e565072..9e73ed45 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -6,8 +6,8 @@ import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys } from './util import SnackbarItem from './SnackbarItem'; import SnackbarContainer from './SnackbarContainer'; import warning from './utils/warning'; -import defaultIconVariants from './utils/defaultIconVariants'; import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps } from '.'; +import { createChainedFunction } from './SnackbarItem/Snackbar'; type Reducer = (state: State) => State; @@ -170,10 +170,6 @@ class SnackbarProvider extends Component { * Set the entered state of the snackbar with the given key. */ handleEnteredSnack: TransitionHandlerProps['onEntered'] = (node, isAppearing, key) => { - if (this.props.onEntered) { - this.props.onEntered(node, isAppearing, key); - } - this.setState(({ snacks }) => ({ snacks: snacks.map(item => ( item.key === key ? { ...item, entered: true } : { ...item } @@ -185,6 +181,8 @@ class SnackbarProvider extends Component { * Hide a snackbar after its timeout. */ handleCloseSnack: TransitionHandlerProps['onClose'] = (event, reason, key) => { + // should not use createChainedFunction for onClose. + // because this.closeSnackbar called this function if (this.props.onClose) { this.props.onClose(event, reason, key); } @@ -239,10 +237,6 @@ class SnackbarProvider extends Component { return this.handleDismissOldest(newState); }); - - if (this.props.onExited) { - this.props.onExited(event, key); - } }; render(): JSX.Element { @@ -269,11 +263,6 @@ class SnackbarProvider extends Component { }; }, {}); - const iconVariant = { - ...defaultIconVariants, - ...this.props.iconVariant, - }; - const snackbars = Object.entries(categ).map(([origin, snacks]) => ( { dense={dense} snack={snack} hideIconVariant={hideIconVariant} - iconVariant={iconVariant} classes={omitContainerKeys(classes)} onClose={this.handleCloseSnack} - onExited={this.handleExitedSnack} - onEntered={this.handleEnteredSnack} + onExited={createChainedFunction([this.handleExitedSnack, this.props.onExited])} + onEntered={createChainedFunction([this.handleEnteredSnack, this.props.onEntered])} /> ))} diff --git a/src/index.d.ts b/src/index.d.ts index f64e4b90..868b9952 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -8,7 +8,6 @@ import { ClickAwayListenerProps } from '@material-ui/core/ClickAwayListener'; import { TransitionProps } from '@material-ui/core/transitions/transition'; import { StandardProps } from '@material-ui/core'; -export type OptionalBy = Omit & Partial> export type RequiredBy = Omit & Required> export type ClassNameMap = Record; type Omit = Pick> diff --git a/src/utils/constants.ts b/src/utils/constants.ts index d45a812c..742c8cb5 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -51,6 +51,7 @@ export const omitContainerKeys = (classes: SnackbarProviderProps['classes']): Sn ); export const REASONS: { [key: string]: CloseReason } = { + TIMEOUT: 'timeout', CLICKAWAY: 'clickaway', MAXSNACK: 'maxsnack', INSTRUCTED: 'instructed', diff --git a/src/utils/defaultIconVariants.tsx b/src/utils/defaultIconVariants.tsx index 025873a8..372841a5 100644 --- a/src/utils/defaultIconVariants.tsx +++ b/src/utils/defaultIconVariants.tsx @@ -44,7 +44,8 @@ const iconStyles = { marginInlineEnd: 8, }; -const defaultIconVariants: Omit = { +const defaultIconVariants: IconVariant = { + default: undefined, success: , warning: , error: , diff --git a/typedoc.json b/typedoc.json index 5154eab4..ca054045 100644 --- a/typedoc.json +++ b/typedoc.json @@ -28,7 +28,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 52, + "line": 50, "character": 11 } ], @@ -51,7 +51,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 56, + "line": 54, "character": 9 } ], @@ -74,7 +74,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 68, + "line": 66, "character": 8 } ], @@ -97,7 +97,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 60, + "line": 58, "character": 11 } ], @@ -120,7 +120,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 64, + "line": 62, "character": 11 } ], @@ -146,13 +146,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 48, + "line": 46, "character": 28 } ] }, { - "id": 53, + "id": 56, "name": "OptionsObject", "kind": 256, "kindString": "Interface", @@ -162,7 +162,7 @@ "comment": {}, "children": [ { - "id": 59, + "id": 62, "name": "action", "kind": 1024, "kindString": "Property", @@ -183,7 +183,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 201, + "line": 199, "character": 10 } ], @@ -194,12 +194,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 50, + "id": 53, "name": "SharedProps.action" } }, { - "id": 58, + "id": 61, "name": "content", "kind": 1024, "kindString": "Property", @@ -220,7 +220,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 196, + "line": 194, "character": 11 } ], @@ -231,12 +231,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 49, + "id": 52, "name": "SharedProps.content" } }, { - "id": 54, + "id": 57, "name": "key", "kind": 1024, "kindString": "Property", @@ -256,7 +256,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 212, + "line": 210, "character": 7 } ], @@ -267,7 +267,7 @@ } }, { - "id": 55, + "id": 58, "name": "persist", "kind": 1024, "kindString": "Property", @@ -287,7 +287,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 217, + "line": 215, "character": 11 } ], @@ -310,7 +310,7 @@ } }, { - "id": 57, + "id": 60, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -330,7 +330,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 191, + "line": 189, "character": 20 } ], @@ -353,12 +353,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 48, + "id": 51, "name": "SharedProps.preventDuplicate" } }, { - "id": 56, + "id": 59, "name": "variant", "kind": 1024, "kindString": "Property", @@ -378,7 +378,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 186, + "line": 184, "character": 11 } ], @@ -389,7 +389,7 @@ }, "inheritedFrom": { "type": "reference", - "id": 47, + "id": 50, "name": "SharedProps.variant" } } @@ -399,32 +399,32 @@ "title": "Properties", "kind": 1024, "children": [ - 59, - 58, - 54, - 55, + 62, + 61, 57, - 56 + 58, + 60, + 59 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 207, + "line": 205, "character": 30 } ], "extendedTypes": [ { "type": "reference", - "id": 46, + "id": 49, "name": "SharedProps" } ] }, { - "id": 72, + "id": 75, "name": "ProviderContext", "kind": 256, "kindString": "Interface", @@ -433,7 +433,7 @@ }, "children": [ { - "id": 78, + "id": 81, "name": "closeSnackbar", "kind": 1024, "kindString": "Property", @@ -443,14 +443,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 263, + "line": 261, "character": 17 } ], "type": { "type": "reflection", "declaration": { - "id": 79, + "id": 82, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -459,7 +459,7 @@ }, "signatures": [ { - "id": 80, + "id": 83, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -468,7 +468,7 @@ }, "parameters": [ { - "id": 81, + "id": 84, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -492,7 +492,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 263, + "line": 261, "character": 18 } ] @@ -500,7 +500,7 @@ } }, { - "id": 73, + "id": 76, "name": "enqueueSnackbar", "kind": 1024, "kindString": "Property", @@ -510,14 +510,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 260, "character": 19 } ], "type": { "type": "reflection", "declaration": { - "id": 74, + "id": 77, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -526,7 +526,7 @@ }, "signatures": [ { - "id": 75, + "id": 78, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -535,7 +535,7 @@ }, "parameters": [ { - "id": 76, + "id": 79, "name": "message", "kind": 32768, "kindString": "Parameter", @@ -549,7 +549,7 @@ } }, { - "id": 77, + "id": 80, "name": "options", "kind": 32768, "kindString": "Parameter", @@ -559,7 +559,7 @@ }, "type": { "type": "reference", - "id": 53, + "id": 56, "name": "OptionsObject" } } @@ -574,7 +574,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 260, "character": 20 } ] @@ -587,21 +587,21 @@ "title": "Properties", "kind": 1024, "children": [ - 78, - 73 + 81, + 76 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 261, + "line": 259, "character": 32 } ] }, { - "id": 46, + "id": 49, "name": "SharedProps", "kind": 256, "kindString": "Interface", @@ -611,7 +611,7 @@ "comment": {}, "children": [ { - "id": 50, + "id": 53, "name": "action", "kind": 1024, "kindString": "Property", @@ -632,7 +632,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 201, + "line": 199, "character": 10 } ], @@ -643,7 +643,7 @@ } }, { - "id": 49, + "id": 52, "name": "content", "kind": 1024, "kindString": "Property", @@ -664,7 +664,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 196, + "line": 194, "character": 11 } ], @@ -675,7 +675,7 @@ } }, { - "id": 48, + "id": 51, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -695,7 +695,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 191, + "line": 189, "character": 20 } ], @@ -718,7 +718,7 @@ } }, { - "id": 47, + "id": 50, "name": "variant", "kind": 1024, "kindString": "Property", @@ -738,7 +738,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 186, + "line": 184, "character": 11 } ], @@ -754,17 +754,17 @@ "title": "Properties", "kind": 1024, "children": [ - 50, - 49, - 48, - 47 + 53, + 52, + 51, + 50 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 180, + "line": 178, "character": 28 } ], @@ -772,7 +772,7 @@ { "type": "reflection", "declaration": { - "id": 51, + "id": 54, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -782,7 +782,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 180, + "line": 178, "character": 36 } ] @@ -791,7 +791,7 @@ { "type": "reflection", "declaration": { - "id": 52, + "id": 55, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -801,7 +801,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 180, + "line": 178, "character": 68 } ] @@ -811,12 +811,12 @@ "extendedBy": [ { "type": "reference", - "id": 53, + "id": 56, "name": "OptionsObject" }, { "type": "reference", - "id": 60, + "id": 63, "name": "SnackbarProviderProps" } ] @@ -841,7 +841,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 45, + "line": 43, "character": 14 } ], @@ -874,7 +874,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 44, + "line": 42, "character": 12 } ], @@ -906,7 +906,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 43, + "line": 41, "character": 31 } ] @@ -942,7 +942,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 156, + "line": 154, "character": 23 } ], @@ -972,7 +972,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 174, + "line": 172, "character": 19 } ], @@ -1003,7 +1003,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 120, + "line": 118, "character": 16 } ], @@ -1034,7 +1034,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 128, + "line": 126, "character": 20 } ], @@ -1053,7 +1053,7 @@ } }, { - "id": 41, + "id": 44, "name": "className", "kind": 1024, "kindString": "Property", @@ -1088,7 +1088,7 @@ } }, { - "id": 39, + "id": 41, "name": "classes", "kind": 1024, "kindString": "Property", @@ -1114,14 +1114,23 @@ "id": 88, "typeArguments": [ { - "type": "reference", - "typeArguments": [ - { - "type": "reference", - "name": "HTMLDivElement" - } - ], - "name": "HTMLAttributes" + "type": "reflection", + "declaration": { + "id": 40, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": { + "isExported": true + }, + "sources": [ + { + "fileName": "src/index.d.ts", + "line": 113, + "character": 53 + } + ] + } } ], "name": "ClassNameMap" @@ -1131,7 +1140,7 @@ }, "inheritedFrom": { "type": "reference", - "id": 39, + "id": 41, "name": "StyledComponentProps.classes" } }, @@ -1156,7 +1165,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 143, + "line": 141, "character": 29 } ], @@ -1179,7 +1188,7 @@ } }, { - "id": 40, + "id": 42, "name": "innerRef", "kind": 1024, "kindString": "Property", @@ -1206,12 +1215,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 40, + "id": 42, "name": "StyledComponentProps.innerRef" } }, { - "id": 42, + "id": 45, "name": "ref", "kind": 1024, "kindString": "Property", @@ -1235,7 +1244,7 @@ "extendsType": { "type": "reflection", "declaration": { - "id": 43, + "id": 46, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -1244,7 +1253,7 @@ }, "children": [ { - "id": 44, + "id": 47, "name": "ref", "kind": 32, "kindString": "Variable", @@ -1270,7 +1279,7 @@ "title": "Variables", "kind": 32, "children": [ - 44 + 47 ] } ], @@ -1325,7 +1334,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 151, + "line": 149, "character": 22 } ], @@ -1344,7 +1353,7 @@ } }, { - "id": 45, + "id": 48, "name": "style", "kind": 1024, "kindString": "Property", @@ -1390,7 +1399,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 170, + "line": 168, "character": 22 } ], @@ -1424,7 +1433,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 170, + "line": 168, "character": 42 } ], @@ -1454,7 +1463,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 170, + "line": 168, "character": 58 } ], @@ -1484,7 +1493,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 170, + "line": 168, "character": 73 } ], @@ -1517,7 +1526,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 170, + "line": 168, "character": 33 } ] @@ -1536,13 +1545,13 @@ 31, 19, 20, + 44, 41, - 39, 23, - 40, 42, - 24, 45, + 24, + 48, 26 ] } @@ -1550,7 +1559,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 115, + "line": 113, "character": 30 } ], @@ -1779,7 +1788,7 @@ ] }, { - "id": 60, + "id": 63, "name": "SnackbarProviderProps", "kind": 256, "kindString": "Interface", @@ -1791,7 +1800,7 @@ }, "children": [ { - "id": 71, + "id": 74, "name": "action", "kind": 1024, "kindString": "Property", @@ -1812,7 +1821,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 201, + "line": 199, "character": 10 } ], @@ -1823,12 +1832,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 50, + "id": 53, "name": "SharedProps.action" } }, { - "id": 61, + "id": 64, "name": "children", "kind": 1024, "kindString": "Property", @@ -1841,7 +1850,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 229, + "line": 227, "character": 12 } ], @@ -1863,7 +1872,7 @@ } }, { - "id": 66, + "id": 69, "name": "classes", "kind": 1024, "kindString": "Property", @@ -1877,7 +1886,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 252, + "line": 250, "character": 11 } ], @@ -1901,7 +1910,7 @@ } }, { - "id": 70, + "id": 73, "name": "content", "kind": 1024, "kindString": "Property", @@ -1922,7 +1931,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 196, + "line": 194, "character": 11 } ], @@ -1933,12 +1942,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 49, + "id": 52, "name": "SharedProps.content" } }, { - "id": 62, + "id": 65, "name": "dense", "kind": 1024, "kindString": "Property", @@ -1958,7 +1967,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 234, + "line": 232, "character": 9 } ], @@ -1981,7 +1990,7 @@ } }, { - "id": 65, + "id": 68, "name": "domRoot", "kind": 1024, "kindString": "Property", @@ -1995,7 +2004,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 248, + "line": 246, "character": 11 } ], @@ -2005,7 +2014,7 @@ } }, { - "id": 64, + "id": 67, "name": "hideIconVariant", "kind": 1024, "kindString": "Property", @@ -2025,7 +2034,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 244, + "line": 242, "character": 19 } ], @@ -2048,7 +2057,7 @@ } }, { - "id": 67, + "id": 70, "name": "iconVariant", "kind": 1024, "kindString": "Property", @@ -2062,7 +2071,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 256, + "line": 254, "character": 15 } ], @@ -2079,7 +2088,7 @@ } }, { - "id": 63, + "id": 66, "name": "maxSnack", "kind": 1024, "kindString": "Property", @@ -2099,7 +2108,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 239, + "line": 237, "character": 12 } ], @@ -2118,7 +2127,7 @@ } }, { - "id": 69, + "id": 72, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -2138,7 +2147,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 191, + "line": 189, "character": 20 } ], @@ -2161,12 +2170,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 48, + "id": 51, "name": "SharedProps.preventDuplicate" } }, { - "id": 68, + "id": 71, "name": "variant", "kind": 1024, "kindString": "Property", @@ -2186,7 +2195,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 186, + "line": 184, "character": 11 } ], @@ -2197,7 +2206,7 @@ }, "inheritedFrom": { "type": "reference", - "id": 47, + "id": 50, "name": "SharedProps.variant" } } @@ -2207,31 +2216,31 @@ "title": "Properties", "kind": 1024, "children": [ - 71, - 61, - 66, - 70, - 62, - 65, + 74, 64, - 67, - 63, 69, - 68 + 73, + 65, + 68, + 67, + 70, + 66, + 72, + 71 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 224, + "line": 222, "character": 38 } ], "extendedTypes": [ { "type": "reference", - "id": 46, + "id": 49, "name": "SharedProps" } ] @@ -2277,7 +2286,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 85, + "line": 83, "character": 11 } ], @@ -2301,7 +2310,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 89, + "line": 87, "character": 11 } ], @@ -2325,7 +2334,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 97, + "line": 95, "character": 13 } ], @@ -2349,7 +2358,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 93, + "line": 91, "character": 14 } ], @@ -2373,7 +2382,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 101, + "line": 99, "character": 10 } ], @@ -2397,7 +2406,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 109, + "line": 107, "character": 12 } ], @@ -2421,7 +2430,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 105, + "line": 103, "character": 13 } ], @@ -2450,7 +2459,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 74, + "line": 72, "character": 39 } ] @@ -2481,7 +2490,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 13, + "line": 12, "character": 24 } ], @@ -2515,7 +2524,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 19, + "line": 18, "character": 23 } ], @@ -2552,7 +2561,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 41, + "line": 39, "character": 28 } ], @@ -2587,7 +2596,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 31, + "line": 30, "character": 29 } ], @@ -2656,7 +2665,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 15, + "line": 14, "character": 11 } ], @@ -2741,7 +2750,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 14, + "line": 13, "character": 9 } ], @@ -2782,106 +2791,6 @@ "name": "Pick" } }, - { - "id": 82, - "name": "OptionalBy", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "typeParameter": [ - { - "id": 83, - "name": "T", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - } - }, - { - "id": 84, - "name": "K", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - }, - "type": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 11, - "character": 22 - } - ], - "type": { - "type": "intersection", - "types": [ - { - "type": "reference", - "id": 90, - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Omit" - }, - { - "type": "reference", - "typeArguments": [ - { - "type": "reference", - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Pick" - } - ], - "name": "Partial" - } - ] - } - }, { "id": 85, "name": "RequiredBy", @@ -2921,7 +2830,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 12, + "line": 11, "character": 22 } ], @@ -2993,7 +2902,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 26 } ], @@ -3048,7 +2957,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 46 } ] @@ -3068,7 +2977,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 23, + "line": 22, "character": 27 } ], @@ -3137,7 +3046,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 23, + "line": 22, "character": 47 } ] @@ -3157,7 +3066,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 17, + "line": 16, "character": 23 } ], @@ -3186,7 +3095,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 21, + "line": 20, "character": 27 } ], @@ -3215,7 +3124,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 34 } ], @@ -3305,7 +3214,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 36 } ] @@ -3323,7 +3232,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 34 } ], @@ -3397,7 +3306,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 36 } ] @@ -3415,7 +3324,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 29, + "line": 28, "character": 29 } ], @@ -3476,7 +3385,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 29, + "line": 28, "character": 31 } ] @@ -3494,7 +3403,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 40, + "line": 38, "character": 27 } ], @@ -3531,7 +3440,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 18, + "line": 17, "character": 23 } ], @@ -3572,13 +3481,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 273, + "line": 271, "character": 29 } ], "type": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } }, @@ -3594,7 +3503,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 259, + "line": 257, "character": 29 } ], @@ -3603,7 +3512,7 @@ "typeArguments": [ { "type": "reference", - "id": 60, + "id": 63, "name": "SnackbarProviderProps" } ], @@ -3629,7 +3538,7 @@ }, "type": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } } @@ -3637,7 +3546,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 270, + "line": 268, "character": 27 } ] @@ -3670,7 +3579,7 @@ }, "type": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } } @@ -3692,7 +3601,7 @@ "name": "P", "constraint": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } } @@ -3716,7 +3625,7 @@ "name": "P", "constraint": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } }, @@ -3725,7 +3634,7 @@ "operator": "keyof", "target": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } } @@ -3757,7 +3666,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 267, + "line": 265, "character": 77 } ], @@ -3769,7 +3678,7 @@ "name": "P", "constraint": { "type": "reference", - "id": 72, + "id": 75, "name": "ProviderContext" } } @@ -3790,7 +3699,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 267, + "line": 265, "character": 58 } ] @@ -3803,7 +3712,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 266, + "line": 264, "character": 28 } ] @@ -3815,39 +3724,39 @@ "kind": 256, "children": [ 4, - 53, - 72, - 46, + 56, + 75, + 49, 1, 18, - 60, + 63, 10 ], "categories": [ { "title": "Enqueue", "children": [ - 53 + 56 ] }, { "title": "Other", "children": [ 4, - 72, + 75, 1 ] }, { "title": "Provider", "children": [ - 60 + 63 ] }, { "title": "Shared", "children": [ - 46, + 49, 18, 10 ] @@ -3864,7 +3773,6 @@ 126, 93, 90, - 82, 85, 100, 104, From 0f01325b1451fc7868c0b2a3f31691b57c6ba0bf Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 17:33:04 +0100 Subject: [PATCH 03/23] Allow any --- .eslintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc b/.eslintrc index 0cbbcc2c..8fad9d32 100644 --- a/.eslintrc +++ b/.eslintrc @@ -66,6 +66,7 @@ }, "rules": { "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": [ "warn", { From 27229006441d719f016879a77db94940b32a48e8 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 17:36:30 +0100 Subject: [PATCH 04/23] Merge provider props. Remove Content props --- src/SnackbarItem/SnackbarItem.tsx | 46 ++++++++++++-------------- src/SnackbarProvider.tsx | 55 ++++++++++++++++++++++--------- 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 9d33acc4..3f565a8a 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -1,12 +1,13 @@ import React, { useState, useEffect, useRef } from 'react'; import clsx from 'clsx'; +import { SnackbarClassKey } from '@material-ui/core/Snackbar'; import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles'; import Slide from '@material-ui/core/Slide'; import Collapse from '@material-ui/core/Collapse'; import SnackbarContent from '@material-ui/core/SnackbarContent'; import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util'; import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/constants'; -import { SnackbarProviderProps, SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps } from '../index'; +import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; import { Snack } from '../SnackbarProvider'; import Snackbar, { createChainedFunction } from './Snackbar'; @@ -44,10 +45,7 @@ const styles = (theme: Theme) => createStyles({ right: 0, bottom: 0, left: 0, - zIndex: theme.zIndex.snackbar, - // display: 'flex', - // justifyContent: 'center', - // alignItems: 'center', + display: 'flex', }, collapseContainer: { [theme.breakpoints.down('xs')]: { @@ -78,9 +76,6 @@ type RemovedProps = export interface SnackbarItemProps extends WithStyles, RequiredBy, 'onEntered' | 'onExited' | 'onClose'> { snack: Snack; - dense: SnackbarProviderProps['dense']; - iconVariant?: SnackbarProviderProps['iconVariant']; - hideIconVariant: SnackbarProviderProps['hideIconVariant']; } const SnackbarItem: React.FC = ({ classes, ...props }) => { @@ -110,26 +105,23 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { const { action, content, + className, ContentProps = {}, - hideIconVariant, - iconVariant: iVariant, snack, - dense, TransitionComponent = Slide, TransitionProps: otherTransitionProps = {}, ...other } = props; - const iconVariant = { - ...defaultIconVariants, - ...iVariant, - }; - - const { className, ...otherContentProps } = ContentProps; + const { ...otherContentProps } = ContentProps; const { + persist: dontspead1, key, - persist, + dense, + message: snackMessage, + hideIconVariant, + iconVariant, entered, requestClose, variant, @@ -141,7 +133,10 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { ...singleSnackProps } = snack; - const icon = iconVariant[variant]; + const icon = { + ...defaultIconVariants, + ...iconVariant, + }[variant]; const contentProps = { ...otherContentProps, @@ -174,6 +169,8 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { [cbName]: createChainedFunction([props.snack[cbName], props[cbName]], props.snack.key), }), {}); + const anchorOriginClass = `anchorOrigin${capitalise(anchorOrigin.vertical)}${capitalise(anchorOrigin.horizontal)}`; + return ( = ({ classes, ...props }) => { anchorOrigin={anchorOrigin} TransitionProps={transitionProps} className={clsx( + classes.root, classes.wrappedRoot, - // @ts-ignore - classes[`anchorOrigin${capitalise(anchorOrigin.vertical)}${capitalise(anchorOrigin.horizontal)}`], - // className, // FIXme get the right classname for this + classes[anchorOriginClass as SnackbarClassKey], )} {...callbacks} onExited={handleExitedScreen} @@ -202,17 +198,17 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { > {snackContent || ( {!hideIconVariant ? icon : null} - {snack.message} + {snackMessage} )} action={finalAction} diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 9e73ed45..344ddc6e 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -6,10 +6,19 @@ import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys } from './util import SnackbarItem from './SnackbarItem'; import SnackbarContainer from './SnackbarContainer'; import warning from './utils/warning'; -import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps } from '.'; +import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps, VariantType, SnackbarOrigin } from '.'; import { createChainedFunction } from './SnackbarItem/Snackbar'; +const DEFAULTS = { + maxSnack: 3, + dense: false, + hideIconVariant: false, + variant: 'default' as VariantType, + autoHideDuration: 5000, + anchorOrigin: { vertical: 'bottom', horizontal: 'left' } as SnackbarOrigin, +}; + type Reducer = (state: State) => State; type SnacksByPosition = { [key: string]: Snack[] }; @@ -18,6 +27,10 @@ export interface Snack extends RequiredBy { } get maxSnack(): number { - return this.props.maxSnack || 3; + return this.props.maxSnack || DEFAULTS.maxSnack; } /** * Adds a new snackbar to the queue to be presented. * Returns generated or user defined key referencing the new snackbar or null */ - enqueueSnackbar = (message: SnackbarMessage, { key, preventDuplicate, ...options }: OptionsObject = {}): SnackbarKey => { + enqueueSnackbar = (message: SnackbarMessage, opts: OptionsObject = {}): SnackbarKey => { + const { + key, + preventDuplicate, + ...options + } = opts; + const hasSpecifiedKey = key || key === 0; const id = hasSpecifiedKey ? (key as SnackbarKey) : new Date().getTime() + Math.random(); + + // @ts-ignore + const merge = (name: string): any => options[name] || this.props[name] || DEFAULTS[name]; + const snack: Snack = { key: id, ...options, @@ -57,9 +80,12 @@ class SnackbarProvider extends Component { open: true, entered: false, requestClose: false, - variant: options.variant || this.props.variant || 'default', - autoHideDuration: options.autoHideDuration || this.props.autoHideDuration || 5000, - anchorOrigin: options.anchorOrigin || this.props.anchorOrigin || { vertical: 'bottom', horizontal: 'left' }, + iconVariant: this.props.iconVariant, + dense: merge('dense'), + hideIconVariant: merge('hideIconVariant'), + variant: merge('variant'), + autoHideDuration: merge('autoHideDuration'), + anchorOrigin: merge('anchorOrigin'), }; if (options.persist) { @@ -242,15 +268,16 @@ class SnackbarProvider extends Component { render(): JSX.Element { const { contextValue } = this.state; const { - variant, - maxSnack, - anchorOrigin, - preventDuplicate, + maxSnack: dontspread1, + preventDuplicate: dontspread2, + dense: dontspread3, + hideIconVariant: dontspread4, + iconVariant: dontspread5, + variant: dontspread6, + anchorOrigin: dontspread7, domRoot, children, classes = {}, - dense = false, - hideIconVariant = false, ...props } = this.props; @@ -266,7 +293,7 @@ class SnackbarProvider extends Component { const snackbars = Object.entries(categ).map(([origin, snacks]) => ( { Date: Sat, 9 May 2020 17:37:10 +0100 Subject: [PATCH 05/23] Minor --- src/SnackbarItem/Snackbar.js | 3 +-- src/SnackbarItem/SnackbarItem.util.ts | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js index 6e9bc2a6..471b7a49 100644 --- a/src/SnackbarItem/Snackbar.js +++ b/src/SnackbarItem/Snackbar.js @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import * as React from 'react'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; -import { REASONS } from 'src/utils/constants'; +import { REASONS } from '../utils/constants'; const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; @@ -37,7 +37,6 @@ const Snackbar = React.forwardRef((props, ref) => { anchorOrigin: dontspread1, autoHideDuration, children, - className, ClickAwayListenerProps, disableWindowBlurListener = false, onClose, diff --git a/src/SnackbarItem/SnackbarItem.util.ts b/src/SnackbarItem/SnackbarItem.util.ts index 243edcdb..9903014c 100644 --- a/src/SnackbarItem/SnackbarItem.util.ts +++ b/src/SnackbarItem/SnackbarItem.util.ts @@ -1,8 +1,7 @@ import clsx from 'clsx'; -import { SnackbarProps } from '@material-ui/core/Snackbar'; -import { allClasses } from '../utils/constants'; import { SnackbarItemProps } from './SnackbarItem'; import { Snack } from '../SnackbarProvider'; +import { SnackbarProviderProps } from '..'; const DIRECTION = { right: 'left', @@ -22,7 +21,7 @@ export const getTransitionDirection = (anchorOrigin: Snack['anchorOrigin']): Dir /** * Omit all class keys except what we need for collapse component */ -export const omitNonCollapseKeys = (classes: SnackbarItemProps['classes'], dense: SnackbarItemProps['dense']): { container: string; wrapper: string } => ({ +export const omitNonCollapseKeys = (classes: SnackbarItemProps['classes'], dense: SnackbarProviderProps['dense']): { container: string; wrapper: string } => ({ container: classes.collapseContainer, wrapper: clsx(classes.collapseWrapper, { [classes.collapseWrapperDense]: dense }), }); From f96efc0492bfa860efdf43d493479969cd65f08c Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 18:17:53 +0100 Subject: [PATCH 06/23] Simpler content props --- src/SnackbarItem/SnackbarItem.tsx | 19 ++++++++++--------- src/index.d.ts | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 3f565a8a..81e0ed07 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -106,6 +106,7 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { action, content, className, + style, ContentProps = {}, snack, TransitionComponent = Slide, @@ -113,8 +114,6 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { ...other } = props; - const { ...otherContentProps } = ContentProps; - const { persist: dontspead1, key, @@ -138,18 +137,18 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { ...iconVariant, }[variant]; - const contentProps = { - ...otherContentProps, - ...singleContentProps, - action: singleAction || singleContentProps.action || otherContentProps.action || action, - }; - const transitionProps = { direction: getTransitionDirection(anchorOrigin), ...otherTransitionProps, ...singleTransitionProps, }; + const contentProps = { + ...ContentProps, + ...singleContentProps, + action: singleAction || action, + }; + const ariaDescribedby = contentProps['aria-describedby'] || 'client-snackbar'; let finalAction = contentProps.action; @@ -199,12 +198,14 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { {snackContent || ( {!hideIconVariant ? icon : null} diff --git a/src/index.d.ts b/src/index.d.ts index 868b9952..42adbab1 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -3,7 +3,6 @@ */ import * as React from 'react'; import { SnackbarClassKey } from '@material-ui/core/Snackbar'; -import { SnackbarContentProps } from '@material-ui/core/SnackbarContent'; import { ClickAwayListenerProps } from '@material-ui/core/ClickAwayListener'; import { TransitionProps } from '@material-ui/core/transitions/transition'; import { StandardProps } from '@material-ui/core'; @@ -108,6 +107,8 @@ export interface TransitionHandlerProps { onExited: TransitionHandler; } +export type SnackbarContentProps = React.HTMLAttributes + /** * @category Shared */ From 63e5b5ab48e4882c222c2889f0669ec2c0a51555 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 18:45:46 +0100 Subject: [PATCH 07/23] Move helper functions to their own file --- src/SnackbarItem/Snackbar.js | 30 +----------------------------- src/SnackbarItem/SnackbarItem.tsx | 3 ++- src/SnackbarProvider.tsx | 2 +- src/utils/createChainedFunction.js | 22 ++++++++++++++++++++++ src/utils/useEventCallback.js | 14 ++++++++++++++ 5 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 src/utils/createChainedFunction.js create mode 100644 src/utils/useEventCallback.js diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js index 471b7a49..cd6b9182 100644 --- a/src/SnackbarItem/Snackbar.js +++ b/src/SnackbarItem/Snackbar.js @@ -2,35 +2,7 @@ import * as React from 'react'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { REASONS } from '../utils/constants'; - -const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; - -function useEventCallback(fn) { - const ref = React.useRef(fn); - useEnhancedEffect(() => { - ref.current = fn; - }); - return React.useCallback((...args) => (0, ref.current)(...args), []); -} - -export function createChainedFunction(funcs, extraArg) { - return funcs.reduce((acc, func) => { - if (func == null) return acc; - - if (process.env.NODE_ENV !== 'production') { - if (typeof func !== 'function') { - console.error('Material-UI: Invalid Argument Type, must only provide functions, undefined, or null.'); - } - } - - return function chainedFunction(...args) { - const argums = [...args]; - if (extraArg) argums.push(extraArg); - acc.apply(this, argums); - func.apply(this, argums); - }; - }, () => { }); -} +import useEventCallback from '../utils/useEventCallback'; const Snackbar = React.forwardRef((props, ref) => { const { diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 81e0ed07..9c098c0a 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -9,8 +9,9 @@ import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/constants'; import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; +import createChainedFunction from '../utils/createChainedFunction'; import { Snack } from '../SnackbarProvider'; -import Snackbar, { createChainedFunction } from './Snackbar'; +import Snackbar from './Snackbar'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const styles = (theme: Theme) => createStyles({ diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 344ddc6e..0b8d0e63 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -7,7 +7,7 @@ import SnackbarItem from './SnackbarItem'; import SnackbarContainer from './SnackbarContainer'; import warning from './utils/warning'; import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps, VariantType, SnackbarOrigin } from '.'; -import { createChainedFunction } from './SnackbarItem/Snackbar'; +import createChainedFunction from './utils/createChainedFunction'; const DEFAULTS = { diff --git a/src/utils/createChainedFunction.js b/src/utils/createChainedFunction.js new file mode 100644 index 00000000..96e0cab3 --- /dev/null +++ b/src/utils/createChainedFunction.js @@ -0,0 +1,22 @@ +/** + * @link /~https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/utils/createChainedFunction.js + */ +export default function createChainedFunction(funcs, extraArg) { + return funcs.reduce((acc, func) => { + if (func == null) return acc; + + if (process.env.NODE_ENV !== 'production') { + if (typeof func !== 'function') { + // eslint-disable-next-line no-console + console.error('Material-UI: Invalid Argument Type, must only provide functions, undefined, or null.'); + } + } + + return function chainedFunction(...args) { + const argums = [...args]; + if (extraArg) argums.push(extraArg); + acc.apply(this, argums); + func.apply(this, argums); + }; + }, () => { }); +} diff --git a/src/utils/useEventCallback.js b/src/utils/useEventCallback.js new file mode 100644 index 00000000..ec99d811 --- /dev/null +++ b/src/utils/useEventCallback.js @@ -0,0 +1,14 @@ +/** + * @link /~https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/utils/useEventCallback.js + */ +import * as React from 'react'; + +const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; + +export default function useEventCallback(fn) { + const ref = React.useRef(fn); + useEnhancedEffect(() => { + ref.current = fn; + }); + return React.useCallback((...args) => (0, ref.current)(...args), []); +} From ade524d22e5fa1abdddcdd20090e44d49c3ebc49 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 18:55:29 +0100 Subject: [PATCH 08/23] Revert some changes --- src/SnackbarItem/SnackbarItem.tsx | 11 +++++++---- src/SnackbarProvider.tsx | 22 +++++++++------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 9c098c0a..c0e1d67b 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -7,7 +7,7 @@ import Collapse from '@material-ui/core/Collapse'; import SnackbarContent from '@material-ui/core/SnackbarContent'; import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util'; import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/constants'; -import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps } from '../index'; +import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps, SnackbarProviderProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; import createChainedFunction from '../utils/createChainedFunction'; import { Snack } from '../SnackbarProvider'; @@ -77,6 +77,9 @@ type RemovedProps = export interface SnackbarItemProps extends WithStyles, RequiredBy, 'onEntered' | 'onExited' | 'onClose'> { snack: Snack; + dense: SnackbarProviderProps['dense']; + iconVariant: SnackbarProviderProps['iconVariant']; + hideIconVariant: SnackbarProviderProps['hideIconVariant']; } const SnackbarItem: React.FC = ({ classes, ...props }) => { @@ -108,6 +111,9 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { content, className, style, + dense, + hideIconVariant, + iconVariant, ContentProps = {}, snack, TransitionComponent = Slide, @@ -118,10 +124,7 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { const { persist: dontspead1, key, - dense, message: snackMessage, - hideIconVariant, - iconVariant, entered, requestClose, variant, diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 0b8d0e63..944fd0f5 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -27,10 +27,6 @@ export interface Snack extends RequiredBy { open: true, entered: false, requestClose: false, - iconVariant: this.props.iconVariant, - dense: merge('dense'), - hideIconVariant: merge('hideIconVariant'), variant: merge('variant'), autoHideDuration: merge('autoHideDuration'), anchorOrigin: merge('anchorOrigin'), @@ -270,11 +263,11 @@ class SnackbarProvider extends Component { const { maxSnack: dontspread1, preventDuplicate: dontspread2, - dense: dontspread3, - hideIconVariant: dontspread4, - iconVariant: dontspread5, - variant: dontspread6, - anchorOrigin: dontspread7, + variant: dontspread3, + anchorOrigin: dontspread4, + iconVariant, + dense = DEFAULTS.dense, + hideIconVariant = DEFAULTS.hideIconVariant, domRoot, children, classes = {}, @@ -293,7 +286,7 @@ class SnackbarProvider extends Component { const snackbars = Object.entries(categ).map(([origin, snacks]) => ( { {...props} key={snack.key} snack={snack} + dense={dense} + iconVariant={iconVariant} + hideIconVariant={hideIconVariant} classes={omitContainerKeys(classes)} onClose={this.handleCloseSnack} onExited={createChainedFunction([this.handleExitedSnack, this.props.onExited])} From b2c6ce8025bc380010663dc4b70d45db3e4c16b5 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 19:23:48 +0100 Subject: [PATCH 09/23] Move transition component one level up --- src/SnackbarItem/Snackbar.js | 31 +------------- src/SnackbarItem/SnackbarItem.tsx | 70 ++++++++++++++++++------------- src/SnackbarProvider.tsx | 6 ++- src/index.d.ts | 11 ++--- 4 files changed, 51 insertions(+), 67 deletions(-) diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js index cd6b9182..c8b7fae3 100644 --- a/src/SnackbarItem/Snackbar.js +++ b/src/SnackbarItem/Snackbar.js @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import * as React from 'react'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { REASONS } from '../utils/constants'; @@ -6,28 +5,15 @@ import useEventCallback from '../utils/useEventCallback'; const Snackbar = React.forwardRef((props, ref) => { const { - anchorOrigin: dontspread1, - autoHideDuration, children, + autoHideDuration, ClickAwayListenerProps, disableWindowBlurListener = false, onClose, - onEnter, - onEntered, - onEntering, - onExit, - onExited, - onExiting, onMouseEnter, onMouseLeave, open, resumeHideDuration, - TransitionComponent, - transitionDuration = { - enter: 225, - exit: 195, - }, - TransitionProps, ...other } = props; @@ -115,20 +101,7 @@ const Snackbar = React.forwardRef((props, ref) => { return (
- - {children} - + {children}
); diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index c0e1d67b..0cb3a67d 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -10,7 +10,7 @@ import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/cons import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps, SnackbarProviderProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; import createChainedFunction from '../utils/createChainedFunction'; -import { Snack } from '../SnackbarProvider'; +import { Snack, DEFAULTS } from '../SnackbarProvider'; import Snackbar from './Snackbar'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type @@ -118,6 +118,7 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { snack, TransitionComponent = Slide, TransitionProps: otherTransitionProps = {}, + transitionDuration: otherTransitionDuration = {}, ...other } = props; @@ -128,11 +129,12 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { entered, requestClose, variant, - content: singleContent, + anchorOrigin, action: singleAction, + content: singleContent, ContentProps: singleContentProps = {}, - anchorOrigin, TransitionProps: singleTransitionProps = {}, + transitionDuration: singleTransitionDuration = {}, ...singleSnackProps } = snack; @@ -153,6 +155,12 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { action: singleAction || action, }; + const transitionDuration = { + ...DEFAULTS.transitionDuration, + ...otherTransitionDuration, + ...singleTransitionDuration, + }; + const ariaDescribedby = contentProps['aria-describedby'] || 'client-snackbar'; let finalAction = contentProps.action; @@ -183,42 +191,46 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { onExited={callbacks.onExited} > - {snackContent || ( - - {!hideIconVariant ? icon : null} - {snackMessage} - - )} - action={finalAction} - /> - )} + + {snackContent || ( + + {!hideIconVariant ? icon : null} + {snackMessage} + + )} + action={finalAction} + /> + )} +
); diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 944fd0f5..1c84f292 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -10,13 +10,17 @@ import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, import createChainedFunction from './utils/createChainedFunction'; -const DEFAULTS = { +export const DEFAULTS = { maxSnack: 3, dense: false, hideIconVariant: false, variant: 'default' as VariantType, autoHideDuration: 5000, anchorOrigin: { vertical: 'bottom', horizontal: 'left' } as SnackbarOrigin, + transitionDuration: { + enter: 225, + exit: 195, + }, }; type Reducer = (state: State) => State; diff --git a/src/index.d.ts b/src/index.d.ts index 42adbab1..50c63f64 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -156,18 +156,13 @@ export interface SnackbarProps extends StandardProps; /** * The duration for the transition, in milliseconds. - * You may specify a single timeout for all transitions, or individually with an object - * in the following shape: + * You may specify the duration with an object in the following shape: * ```js - * timeout={500} - * ``` - * or individually: - * ```js - * timeout={{ enter: 300, exit: 500 }} + * transitionDuration={{ enter: 300, exit: 500 }} * ``` * @default { enter: 225, exit: 195 } */ - transitionDuration?: number | { appear?: number; enter?: number; exit?: number }; + transitionDuration?: { appear?: number; enter?: number; exit?: number }; /** * Properties applied to Transition component (e.g. Slide, Grow, Zoom, etc.) */ From b94e49db44ec7965caa103ad5d886a2fba519f9d Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 19:38:39 +0100 Subject: [PATCH 10/23] Move defaults to constants file --- src/SnackbarItem/SnackbarItem.tsx | 6 +++--- src/SnackbarProvider.tsx | 18 ++---------------- src/utils/constants.ts | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 0cb3a67d..7f9e4fca 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -6,11 +6,11 @@ import Slide from '@material-ui/core/Slide'; import Collapse from '@material-ui/core/Collapse'; import SnackbarContent from '@material-ui/core/SnackbarContent'; import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util'; -import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS } from '../utils/constants'; +import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS, DEFAULTS } from '../utils/constants'; import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps, SnackbarProviderProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; import createChainedFunction from '../utils/createChainedFunction'; -import { Snack, DEFAULTS } from '../SnackbarProvider'; +import { Snack } from '../SnackbarProvider'; import Snackbar from './Snackbar'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type @@ -205,10 +205,10 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { appear in={snack.open} {...callbacks} + {...transitionProps} timeout={transitionDuration} onExited={handleExitedScreen} onEntered={createChainedFunction([handleEntered, callbacks.onEntered], key)} - {...transitionProps} > {snackContent || ( State; type SnacksByPosition = { [key: string]: Snack[] }; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 742c8cb5..2fde54c9 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,5 +1,5 @@ import { SnackbarClassKey } from '@material-ui/core/Snackbar'; -import { CloseReason, ContainerClassKey, SnackbarProviderProps } from '../index'; +import { CloseReason, ContainerClassKey, SnackbarProviderProps, VariantType, SnackbarOrigin } from '../index'; import { SnackbarItemProps } from '../SnackbarItem'; import { Snack } from '../SnackbarProvider'; @@ -36,6 +36,19 @@ export const SNACKBAR_INDENTS = { snackbar: { default: 6, dense: 2 }, }; +export const DEFAULTS = { + maxSnack: 3, + dense: false, + hideIconVariant: false, + variant: 'default' as VariantType, + autoHideDuration: 5000, + anchorOrigin: { vertical: 'bottom', horizontal: 'left' } as SnackbarOrigin, + transitionDuration: { + enter: 225, + exit: 195, + }, +}; + export const capitalise = (text: string): string => text.charAt(0).toUpperCase() + text.slice(1); export const originKeyExtractor = (anchor: Snack['anchorOrigin']): string => ( From 4a78dd631763423394c66dbd3376404039996058 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 19:41:15 +0100 Subject: [PATCH 11/23] Minor --- src/SnackbarItem/SnackbarItem.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 7f9e4fca..45c25553 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -181,6 +181,7 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { }), {}); const anchorOriginClass = `anchorOrigin${capitalise(anchorOrigin.vertical)}${capitalise(anchorOrigin.horizontal)}`; + const variantClass = `variant${capitalise(variant)}`; return ( = ({ classes, ...props }) => { role="alert" {...contentProps} className={clsx( - classes[`variant${capitalise(variant)}` as VariantClassKey], + classes[variantClass as VariantClassKey], { [classes.lessPadding]: !hideIconVariant && icon }, className, )} From 1d12b98e9b6d079c72b9cbbbe2533ad20f91943b Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 9 May 2020 20:30:44 +0100 Subject: [PATCH 12/23] Dont spread callbacks --- src/SnackbarItem/SnackbarItem.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 45c25553..c0289ace 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -205,11 +205,14 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { {snackContent || ( Date: Sat, 9 May 2020 20:40:09 +0100 Subject: [PATCH 13/23] Minor --- src/SnackbarItem/SnackbarItem.tsx | 6 +++--- src/index.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index c0289ace..f552dc09 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -207,12 +207,12 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { in={snack.open} timeout={transitionDuration} {...transitionProps} - onEnter={callbacks.onEnter} - onEntering={callbacks.onEntering} - onEntered={createChainedFunction([handleEntered, callbacks.onEntered], key)} onExit={callbacks.onExit} onExiting={callbacks.onExiting} onExited={handleExitedScreen} + onEnter={callbacks.onEnter} + onEntering={callbacks.onEntering} + onEntered={createChainedFunction([handleEntered, callbacks.onEntered], key)} > {snackContent || ( ; /** - * @ignore - * Properties applied to SnackbarContent component + * Properties applied to SnackbarContent component. + * If `content` property is specified (i.e. you're passing a custom snackbar), it does nothing. */ ContentProps?: Partial; /** From c830d718827e42937c7dc78868e49319da8fdc24 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sun, 10 May 2020 02:57:27 +0100 Subject: [PATCH 14/23] sort out transition component, duration and props properties --- .eslintrc | 1 + src/SnackbarItem/SnackbarItem.tsx | 84 +++++++++++++------------------ src/SnackbarProvider.tsx | 12 ++--- src/utils/constants.ts | 26 +++++++++- 4 files changed, 66 insertions(+), 57 deletions(-) diff --git a/.eslintrc b/.eslintrc index 8fad9d32..81436b9f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -67,6 +67,7 @@ "rules": { "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/no-unused-vars": [ "warn", { diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index f552dc09..8dab98dc 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -1,19 +1,16 @@ import React, { useState, useEffect, useRef } from 'react'; import clsx from 'clsx'; -import { SnackbarClassKey } from '@material-ui/core/Snackbar'; import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles'; -import Slide from '@material-ui/core/Slide'; import Collapse from '@material-ui/core/Collapse'; import SnackbarContent from '@material-ui/core/SnackbarContent'; import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util'; -import { capitalise, allClasses, REASONS, SNACKBAR_INDENTS, DEFAULTS } from '../utils/constants'; -import { SharedProps, RequiredBy, VariantClassKey, TransitionHandlerProps, SnackbarProviderProps } from '../index'; +import { allClasses, REASONS, SNACKBAR_INDENTS, objectMerge, DEFAULTS, transformer } from '../utils/constants'; +import { SharedProps, RequiredBy, TransitionHandlerProps, SnackbarProviderProps as ProviderProps } from '../index'; import defaultIconVariants from '../utils/defaultIconVariants'; import createChainedFunction from '../utils/createChainedFunction'; import { Snack } from '../SnackbarProvider'; import Snackbar from './Snackbar'; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type const styles = (theme: Theme) => createStyles({ ...allClasses.mui, lessPadding: { @@ -77,9 +74,9 @@ type RemovedProps = export interface SnackbarItemProps extends WithStyles, RequiredBy, 'onEntered' | 'onExited' | 'onClose'> { snack: Snack; - dense: SnackbarProviderProps['dense']; - iconVariant: SnackbarProviderProps['iconVariant']; - hideIconVariant: SnackbarProviderProps['hideIconVariant']; + dense: ProviderProps['dense']; + iconVariant: ProviderProps['iconVariant']; + hideIconVariant: ProviderProps['hideIconVariant']; } const SnackbarItem: React.FC = ({ classes, ...props }) => { @@ -107,34 +104,35 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { }; const { - action, - content, className, style, dense, hideIconVariant, iconVariant, - ContentProps = {}, snack, - TransitionComponent = Slide, - TransitionProps: otherTransitionProps = {}, - transitionDuration: otherTransitionDuration = {}, + action: otherAction, + content: otherContent, + ContentProps: otherContentProps, + TransitionComponent: otherTranComponent, + TransitionProps: otherTranProps, + transitionDuration: otherTranDuration, ...other } = props; const { - persist: dontspead1, + persist, key, - message: snackMessage, entered, requestClose, variant, anchorOrigin, + message: snackMessage, action: singleAction, content: singleContent, - ContentProps: singleContentProps = {}, - TransitionProps: singleTransitionProps = {}, - transitionDuration: singleTransitionDuration = {}, + ContentProps: singleContentProps, + TransitionComponent: singleTranComponent, + TransitionProps: singleTranProps, + transitionDuration: singleTranDuration, ...singleSnackProps } = snack; @@ -143,34 +141,26 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { ...iconVariant, }[variant]; - const transitionProps = { - direction: getTransitionDirection(anchorOrigin), - ...otherTransitionProps, - ...singleTransitionProps, - }; - const contentProps = { - ...ContentProps, - ...singleContentProps, - action: singleAction || action, + 'aria-describedby': 'notistack-snackbar', + ...objectMerge(singleContentProps, otherContentProps), }; - const transitionDuration = { - ...DEFAULTS.transitionDuration, - ...otherTransitionDuration, - ...singleTransitionDuration, + const TransitionComponent = singleTranComponent || otherTranComponent || DEFAULTS.TransitionComponent; + const transitionDuration = objectMerge(singleTranDuration, otherTranDuration, DEFAULTS.transitionDuration); + const transitionProps = { + direction: getTransitionDirection(anchorOrigin), + ...objectMerge(singleTranProps, otherTranProps), }; - const ariaDescribedby = contentProps['aria-describedby'] || 'client-snackbar'; - - let finalAction = contentProps.action; - if (typeof finalAction === 'function') { - finalAction = contentProps.action(key); + let action = singleAction || otherAction; + if (typeof action === 'function') { + action = action(key); } - let snackContent = singleContent || content; - if (snackContent && typeof snackContent === 'function') { - snackContent = snackContent(key, snack.message); + let content = singleContent || otherContent; + if (typeof content === 'function') { + content = content(key, snack.message); } const callbacks: { [key in keyof TransitionHandlerProps]?: any } = @@ -180,9 +170,6 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { [cbName]: createChainedFunction([props.snack[cbName], props[cbName]], props.snack.key), }), {}); - const anchorOriginClass = `anchorOrigin${capitalise(anchorOrigin.vertical)}${capitalise(anchorOrigin.horizontal)}`; - const variantClass = `variant${capitalise(variant)}`; - return ( = ({ classes, ...props }) => { className={clsx( classes.root, classes.wrappedRoot, - classes[anchorOriginClass as SnackbarClassKey], + classes[transformer.toAnchorOrigin(anchorOrigin)], )} onClose={handleClose} > @@ -214,24 +201,23 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { onEntering={callbacks.onEntering} onEntered={createChainedFunction([handleEntered, callbacks.onEntered], key)} > - {snackContent || ( + {content || ( + {!hideIconVariant ? icon : null} {snackMessage} )} - action={finalAction} /> )} diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index c3cf2a81..05fc9f27 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { createPortal } from 'react-dom'; import clsx from 'clsx'; import SnackbarContext from './SnackbarContext'; -import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys, DEFAULTS } from './utils/constants'; +import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys, DEFAULTS, merge } from './utils/constants'; import SnackbarItem from './SnackbarItem'; import SnackbarContainer from './SnackbarContainer'; import warning from './utils/warning'; @@ -56,9 +56,7 @@ class SnackbarProvider extends Component { const hasSpecifiedKey = key || key === 0; const id = hasSpecifiedKey ? (key as SnackbarKey) : new Date().getTime() + Math.random(); - // @ts-ignore - const merge = (name: string): any => options[name] || this.props[name] || DEFAULTS[name]; - + const merger = merge(options, this.props, DEFAULTS); const snack: Snack = { key: id, ...options, @@ -66,9 +64,9 @@ class SnackbarProvider extends Component { open: true, entered: false, requestClose: false, - variant: merge('variant'), - autoHideDuration: merge('autoHideDuration'), - anchorOrigin: merge('anchorOrigin'), + variant: merger('variant'), + anchorOrigin: merger('anchorOrigin'), + autoHideDuration: merger('autoHideDuration'), }; if (options.persist) { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 2fde54c9..0417d008 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,5 +1,6 @@ +import Slide from '@material-ui/core/Slide'; import { SnackbarClassKey } from '@material-ui/core/Snackbar'; -import { CloseReason, ContainerClassKey, SnackbarProviderProps, VariantType, SnackbarOrigin } from '../index'; +import { CloseReason, ContainerClassKey, SnackbarProviderProps, VariantType, SnackbarOrigin, VariantClassKey } from '../index'; import { SnackbarItemProps } from '../SnackbarItem'; import { Snack } from '../SnackbarProvider'; @@ -43,6 +44,7 @@ export const DEFAULTS = { variant: 'default' as VariantType, autoHideDuration: 5000, anchorOrigin: { vertical: 'bottom', horizontal: 'left' } as SnackbarOrigin, + TransitionComponent: Slide, transitionDuration: { enter: 225, exit: 195, @@ -69,3 +71,25 @@ export const REASONS: { [key: string]: CloseReason } = { MAXSNACK: 'maxsnack', INSTRUCTED: 'instructed', }; + +/** + * Tranforms classes name + */ +export const transformer = { + toAnchorOrigin: ({ vertical, horizontal }: SnackbarOrigin) => ( + `anchorOrigin${capitalise(vertical)}${capitalise(horizontal)}` as SnackbarClassKey + ), + toVariant: (variant: VariantType) => `variant${capitalise(variant)}` as VariantClassKey, +}; + + +// @ts-ignore +export const merge = (options, props, defaults) => (name: string): any => options[name] || props[name] || defaults[name]; + +export function objectMerge(options = {}, props = {}, defaults = {}) { + return { + ...defaults, + ...props, + ...options, + }; +} From d994e763d2dbe7db4bb4e6bc573ce7215ac777b1 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Fri, 15 May 2020 03:52:50 +0100 Subject: [PATCH 15/23] Update tsdocs --- typedoc.json | 645 +++++++++++++++++++++++++++------------------------ 1 file changed, 344 insertions(+), 301 deletions(-) diff --git a/typedoc.json b/typedoc.json index d5162156..7f09a2b7 100644 --- a/typedoc.json +++ b/typedoc.json @@ -152,7 +152,7 @@ ] }, { - "id": 56, + "id": 53, "name": "OptionsObject", "kind": 256, "kindString": "Interface", @@ -162,7 +162,7 @@ "comment": {}, "children": [ { - "id": 62, + "id": 59, "name": "action", "kind": 1024, "kindString": "Property", @@ -183,23 +183,23 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 202, + "line": 197, "character": 10 } ], "type": { "type": "reference", - "id": 100, + "id": 97, "name": "SnackbarAction" }, "inheritedFrom": { "type": "reference", - "id": 53, + "id": 50, "name": "SharedProps.action" } }, { - "id": 61, + "id": 58, "name": "content", "kind": 1024, "kindString": "Property", @@ -220,23 +220,23 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 197, + "line": 192, "character": 11 } ], "type": { "type": "reference", - "id": 104, + "id": 101, "name": "SnackbarContent" }, "inheritedFrom": { "type": "reference", - "id": 52, + "id": 49, "name": "SharedProps.content" } }, { - "id": 57, + "id": 54, "name": "key", "kind": 1024, "kindString": "Property", @@ -256,18 +256,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 213, + "line": 208, "character": 7 } ], "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } }, { - "id": 58, + "id": 55, "name": "persist", "kind": 1024, "kindString": "Property", @@ -287,7 +287,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 218, + "line": 213, "character": 11 } ], @@ -310,7 +310,7 @@ } }, { - "id": 60, + "id": 57, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -330,7 +330,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 192, + "line": 187, "character": 20 } ], @@ -353,12 +353,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 51, + "id": 48, "name": "SharedProps.preventDuplicate" } }, { - "id": 59, + "id": 56, "name": "variant", "kind": 1024, "kindString": "Property", @@ -378,18 +378,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 187, + "line": 182, "character": 11 } ], "type": { "type": "reference", - "id": 97, + "id": 94, "name": "VariantType" }, "inheritedFrom": { "type": "reference", - "id": 50, + "id": 47, "name": "SharedProps.variant" } } @@ -399,32 +399,32 @@ "title": "Properties", "kind": 1024, "children": [ - 62, - 61, - 57, + 59, 58, - 60, - 59 + 54, + 55, + 57, + 56 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 208, + "line": 203, "character": 30 } ], "extendedTypes": [ { "type": "reference", - "id": 49, + "id": 46, "name": "SharedProps" } ] }, { - "id": 75, + "id": 72, "name": "ProviderContext", "kind": 256, "kindString": "Interface", @@ -433,7 +433,7 @@ }, "children": [ { - "id": 81, + "id": 78, "name": "closeSnackbar", "kind": 1024, "kindString": "Property", @@ -443,14 +443,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 264, + "line": 259, "character": 17 } ], "type": { "type": "reflection", "declaration": { - "id": 82, + "id": 79, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -459,7 +459,7 @@ }, "signatures": [ { - "id": 83, + "id": 80, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -468,7 +468,7 @@ }, "parameters": [ { - "id": 84, + "id": 81, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -478,7 +478,7 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -492,7 +492,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 264, + "line": 259, "character": 18 } ] @@ -500,7 +500,7 @@ } }, { - "id": 76, + "id": 73, "name": "enqueueSnackbar", "kind": 1024, "kindString": "Property", @@ -510,14 +510,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 263, + "line": 258, "character": 19 } ], "type": { "type": "reflection", "declaration": { - "id": 77, + "id": 74, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -526,7 +526,7 @@ }, "signatures": [ { - "id": 78, + "id": 75, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -535,7 +535,7 @@ }, "parameters": [ { - "id": 79, + "id": 76, "name": "message", "kind": 32768, "kindString": "Parameter", @@ -544,12 +544,12 @@ }, "type": { "type": "reference", - "id": 99, + "id": 96, "name": "SnackbarMessage" } }, { - "id": 80, + "id": 77, "name": "options", "kind": 32768, "kindString": "Parameter", @@ -559,14 +559,14 @@ }, "type": { "type": "reference", - "id": 56, + "id": 53, "name": "OptionsObject" } } ], "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -574,7 +574,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 263, + "line": 258, "character": 20 } ] @@ -587,21 +587,21 @@ "title": "Properties", "kind": 1024, "children": [ - 81, - 76 + 78, + 73 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 257, "character": 32 } ] }, { - "id": 49, + "id": 46, "name": "SharedProps", "kind": 256, "kindString": "Interface", @@ -611,7 +611,7 @@ "comment": {}, "children": [ { - "id": 53, + "id": 50, "name": "action", "kind": 1024, "kindString": "Property", @@ -632,18 +632,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 202, + "line": 197, "character": 10 } ], "type": { "type": "reference", - "id": 100, + "id": 97, "name": "SnackbarAction" } }, { - "id": 52, + "id": 49, "name": "content", "kind": 1024, "kindString": "Property", @@ -664,18 +664,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 197, + "line": 192, "character": 11 } ], "type": { "type": "reference", - "id": 104, + "id": 101, "name": "SnackbarContent" } }, { - "id": 51, + "id": 48, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -695,7 +695,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 192, + "line": 187, "character": 20 } ], @@ -718,7 +718,7 @@ } }, { - "id": 50, + "id": 47, "name": "variant", "kind": 1024, "kindString": "Property", @@ -738,13 +738,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 187, + "line": 182, "character": 11 } ], "type": { "type": "reference", - "id": 97, + "id": 94, "name": "VariantType" } } @@ -754,17 +754,17 @@ "title": "Properties", "kind": 1024, "children": [ - 53, - 52, - 51, - 50 + 50, + 49, + 48, + 47 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 181, + "line": 176, "character": 28 } ], @@ -772,7 +772,7 @@ { "type": "reflection", "declaration": { - "id": 54, + "id": 51, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -782,7 +782,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 181, + "line": 176, "character": 36 } ] @@ -791,7 +791,7 @@ { "type": "reflection", "declaration": { - "id": 55, + "id": 52, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -801,7 +801,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 181, + "line": 176, "character": 68 } ] @@ -811,12 +811,12 @@ "extendedBy": [ { "type": "reference", - "id": 56, + "id": 53, "name": "OptionsObject" }, { "type": "reference", - "id": 63, + "id": 60, "name": "SnackbarProviderProps" } ] @@ -921,6 +921,37 @@ }, "comment": {}, "children": [ + { + "id": 22, + "name": "ContentProps", + "kind": 1024, + "kindString": "Property", + "flags": { + "isExported": true, + "isOptional": true + }, + "comment": { + "shortText": "Properties applied to SnackbarContent component.\nIf `content` property is specified (i.e. you're passing a custom snackbar), it does nothing." + }, + "sources": [ + { + "fileName": "src/index.d.ts", + "line": 139, + "character": 16 + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "id": 126, + "name": "SnackbarContentProps" + } + ], + "name": "Partial" + } + }, { "id": 25, "name": "TransitionComponent", @@ -972,7 +1003,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 175, + "line": 170, "character": 19 } ], @@ -1053,7 +1084,7 @@ } }, { - "id": 44, + "id": 41, "name": "className", "kind": 1024, "kindString": "Property", @@ -1088,7 +1119,7 @@ } }, { - "id": 41, + "id": 39, "name": "classes", "kind": 1024, "kindString": "Property", @@ -1111,26 +1142,17 @@ "typeArguments": [ { "type": "reference", - "id": 88, + "id": 85, "typeArguments": [ { - "type": "reflection", - "declaration": { - "id": 40, - "name": "__type", - "kind": 65536, - "kindString": "Type literal", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 113, - "character": 53 - } - ] - } + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "HTMLDivElement" + } + ], + "name": "HTMLAttributes" } ], "name": "ClassNameMap" @@ -1140,7 +1162,7 @@ }, "inheritedFrom": { "type": "reference", - "id": 41, + "id": 39, "name": "StyledComponentProps.classes" } }, @@ -1188,7 +1210,7 @@ } }, { - "id": 42, + "id": 40, "name": "innerRef", "kind": 1024, "kindString": "Property", @@ -1215,12 +1237,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 42, + "id": 40, "name": "StyledComponentProps.innerRef" } }, { - "id": 45, + "id": 42, "name": "ref", "kind": 1024, "kindString": "Property", @@ -1244,7 +1266,7 @@ "extendsType": { "type": "reflection", "declaration": { - "id": 46, + "id": 43, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -1253,7 +1275,7 @@ }, "children": [ { - "id": 47, + "id": 44, "name": "ref", "kind": 32, "kindString": "Variable", @@ -1279,7 +1301,7 @@ "title": "Variables", "kind": 32, "children": [ - 47 + 44 ] } ], @@ -1353,7 +1375,7 @@ } }, { - "id": 48, + "id": 45, "name": "style", "kind": 1024, "kindString": "Property", @@ -1388,7 +1410,7 @@ "isOptional": true }, "comment": { - "shortText": "The duration for the transition, in milliseconds.\nYou may specify a single timeout for all transitions, or individually with an object\nin the following shape:\n```js\n timeout={500}\n```\nor individually:\n```js\ntimeout={{ enter: 300, exit: 500 }}\n```", + "shortText": "The duration for the transition, in milliseconds.\nYou may specify the duration with an object in the following shape:\n```js\ntransitionDuration={{ enter: 300, exit: 500 }}\n```", "tags": [ { "tag": "default", @@ -1399,7 +1421,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 171, + "line": 166, "character": 22 } ], @@ -1408,7 +1430,7 @@ "types": [ { "type": "intrinsic", - "name": "number" + "name": "undefined" }, { "type": "reflection", @@ -1433,8 +1455,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 171, - "character": 42 + "line": 166, + "character": 33 } ], "type": { @@ -1463,8 +1485,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 171, - "character": 58 + "line": 166, + "character": 49 } ], "type": { @@ -1493,8 +1515,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 171, - "character": 73 + "line": 166, + "character": 64 } ], "type": { @@ -1522,13 +1544,6 @@ 30 ] } - ], - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 171, - "character": 33 - } ] } } @@ -1541,17 +1556,18 @@ "title": "Properties", "kind": 1024, "children": [ + 22, 25, 31, 19, 20, - 44, 41, + 39, 23, + 40, 42, - 45, 24, - 48, + 45, 26 ] } @@ -1788,7 +1804,7 @@ ] }, { - "id": 63, + "id": 60, "name": "SnackbarProviderProps", "kind": 256, "kindString": "Interface", @@ -1800,7 +1816,7 @@ }, "children": [ { - "id": 74, + "id": 71, "name": "action", "kind": 1024, "kindString": "Property", @@ -1821,23 +1837,23 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 202, + "line": 197, "character": 10 } ], "type": { "type": "reference", - "id": 100, + "id": 97, "name": "SnackbarAction" }, "inheritedFrom": { "type": "reference", - "id": 53, + "id": 50, "name": "SharedProps.action" } }, { - "id": 64, + "id": 61, "name": "children", "kind": 1024, "kindString": "Property", @@ -1850,7 +1866,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 230, + "line": 225, "character": 12 } ], @@ -1872,7 +1888,7 @@ } }, { - "id": 69, + "id": 66, "name": "classes", "kind": 1024, "kindString": "Property", @@ -1886,7 +1902,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 253, + "line": 248, "character": 11 } ], @@ -1895,11 +1911,11 @@ "typeArguments": [ { "type": "reference", - "id": 88, + "id": 85, "typeArguments": [ { "type": "reference", - "id": 128, + "id": 125, "name": "CombinedClassKey" } ], @@ -1910,7 +1926,7 @@ } }, { - "id": 73, + "id": 70, "name": "content", "kind": 1024, "kindString": "Property", @@ -1931,23 +1947,23 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 197, + "line": 192, "character": 11 } ], "type": { "type": "reference", - "id": 104, + "id": 101, "name": "SnackbarContent" }, "inheritedFrom": { "type": "reference", - "id": 52, + "id": 49, "name": "SharedProps.content" } }, { - "id": 65, + "id": 62, "name": "dense", "kind": 1024, "kindString": "Property", @@ -1967,7 +1983,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 235, + "line": 230, "character": 9 } ], @@ -1990,7 +2006,7 @@ } }, { - "id": 68, + "id": 65, "name": "domRoot", "kind": 1024, "kindString": "Property", @@ -2004,7 +2020,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 249, + "line": 244, "character": 11 } ], @@ -2014,7 +2030,7 @@ } }, { - "id": 67, + "id": 64, "name": "hideIconVariant", "kind": 1024, "kindString": "Property", @@ -2034,7 +2050,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 245, + "line": 240, "character": 19 } ], @@ -2057,7 +2073,7 @@ } }, { - "id": 70, + "id": 67, "name": "iconVariant", "kind": 1024, "kindString": "Property", @@ -2071,7 +2087,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 257, + "line": 252, "character": 15 } ], @@ -2088,7 +2104,7 @@ } }, { - "id": 66, + "id": 63, "name": "maxSnack", "kind": 1024, "kindString": "Property", @@ -2108,7 +2124,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 240, + "line": 235, "character": 12 } ], @@ -2127,7 +2143,7 @@ } }, { - "id": 72, + "id": 69, "name": "preventDuplicate", "kind": 1024, "kindString": "Property", @@ -2147,7 +2163,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 192, + "line": 187, "character": 20 } ], @@ -2170,12 +2186,12 @@ }, "inheritedFrom": { "type": "reference", - "id": 51, + "id": 48, "name": "SharedProps.preventDuplicate" } }, { - "id": 71, + "id": 68, "name": "variant", "kind": 1024, "kindString": "Property", @@ -2195,18 +2211,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 187, + "line": 182, "character": 11 } ], "type": { "type": "reference", - "id": 97, + "id": 94, "name": "VariantType" }, "inheritedFrom": { "type": "reference", - "id": 50, + "id": 47, "name": "SharedProps.variant" } } @@ -2216,31 +2232,31 @@ "title": "Properties", "kind": 1024, "children": [ - 74, - 64, - 69, - 73, + 71, + 61, + 66, + 70, + 62, 65, - 68, + 64, 67, - 70, - 66, - 72, - 71 + 63, + 69, + 68 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 225, + "line": 220, "character": 38 } ], "extendedTypes": [ { "type": "reference", - "id": 49, + "id": 46, "name": "SharedProps" } ] @@ -2286,13 +2302,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 86, + "line": 84, "character": 11 } ], "type": { "type": "reference", - "id": 109, + "id": 106, "name": "TransitionCloseHandler" } }, @@ -2310,13 +2326,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 90, + "line": 88, "character": 11 } ], "type": { "type": "reference", - "id": 121, + "id": 118, "name": "TransitionHandler" } }, @@ -2334,13 +2350,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 98, + "line": 96, "character": 13 } ], "type": { "type": "reference", - "id": 115, + "id": 112, "name": "TransitionEnterHandler" } }, @@ -2358,13 +2374,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 94, + "line": 92, "character": 14 } ], "type": { "type": "reference", - "id": 121, + "id": 118, "name": "TransitionHandler" } }, @@ -2382,13 +2398,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 102, + "line": 100, "character": 10 } ], "type": { "type": "reference", - "id": 121, + "id": 118, "name": "TransitionHandler" } }, @@ -2406,13 +2422,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 110, + "line": 108, "character": 12 } ], "type": { "type": "reference", - "id": 121, + "id": 118, "name": "TransitionHandler" } }, @@ -2430,13 +2446,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 106, + "line": 104, "character": 13 } ], "type": { "type": "reference", - "id": 121, + "id": 118, "name": "TransitionHandler" } } @@ -2465,7 +2481,7 @@ ] }, { - "id": 88, + "id": 85, "name": "ClassNameMap", "kind": 4194304, "kindString": "Type alias", @@ -2474,7 +2490,7 @@ }, "typeParameter": [ { - "id": 89, + "id": 86, "name": "ClassKey", "kind": 131072, "kindString": "Type parameter", @@ -2490,7 +2506,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 12, + "line": 11, "character": 24 } ], @@ -2514,7 +2530,7 @@ } }, { - "id": 98, + "id": 95, "name": "CloseReason", "kind": 4194304, "kindString": "Type alias", @@ -2524,7 +2540,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 18, + "line": 17, "character": 23 } ], @@ -2551,7 +2567,7 @@ } }, { - "id": 128, + "id": 125, "name": "CombinedClassKey", "kind": 4194304, "kindString": "Type alias", @@ -2570,12 +2586,12 @@ "types": [ { "type": "reference", - "id": 127, + "id": 124, "name": "VariantClassKey" }, { "type": "reference", - "id": 126, + "id": 123, "name": "ContainerClassKey" }, { @@ -2586,7 +2602,7 @@ } }, { - "id": 126, + "id": 123, "name": "ContainerClassKey", "kind": 4194304, "kindString": "Type alias", @@ -2596,7 +2612,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 30, + "line": 29, "character": 29 } ], @@ -2635,7 +2651,7 @@ } }, { - "id": 93, + "id": 90, "name": "Modify", "kind": 4194304, "kindString": "Type alias", @@ -2644,7 +2660,7 @@ }, "typeParameter": [ { - "id": 94, + "id": 91, "name": "T", "kind": 131072, "kindString": "Type parameter", @@ -2653,7 +2669,7 @@ } }, { - "id": 95, + "id": 92, "name": "R", "kind": 131072, "kindString": "Type parameter", @@ -2665,7 +2681,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 14, + "line": 13, "character": 11 } ], @@ -2712,7 +2728,7 @@ } }, { - "id": 90, + "id": 87, "name": "Omit", "kind": 4194304, "kindString": "Type alias", @@ -2721,7 +2737,7 @@ }, "typeParameter": [ { - "id": 91, + "id": 88, "name": "T", "kind": 131072, "kindString": "Type parameter", @@ -2730,7 +2746,7 @@ } }, { - "id": 92, + "id": 89, "name": "K", "kind": 131072, "kindString": "Type parameter", @@ -2750,7 +2766,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 13, + "line": 12, "character": 9 } ], @@ -2792,7 +2808,7 @@ } }, { - "id": 85, + "id": 82, "name": "RequiredBy", "kind": 4194304, "kindString": "Type alias", @@ -2801,7 +2817,7 @@ }, "typeParameter": [ { - "id": 86, + "id": 83, "name": "T", "kind": 131072, "kindString": "Type parameter", @@ -2810,7 +2826,7 @@ } }, { - "id": 87, + "id": 84, "name": "K", "kind": 131072, "kindString": "Type parameter", @@ -2830,7 +2846,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 11, + "line": 10, "character": 22 } ], @@ -2839,7 +2855,7 @@ "types": [ { "type": "reference", - "id": 90, + "id": 87, "typeArguments": [ { "type": "typeParameter", @@ -2892,7 +2908,7 @@ } }, { - "id": 100, + "id": 97, "name": "SnackbarAction", "kind": 4194304, "kindString": "Type alias", @@ -2902,7 +2918,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 21, + "line": 20, "character": 26 } ], @@ -2916,7 +2932,7 @@ { "type": "reflection", "declaration": { - "id": 101, + "id": 98, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -2925,7 +2941,7 @@ }, "signatures": [ { - "id": 102, + "id": 99, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -2934,7 +2950,7 @@ }, "parameters": [ { - "id": 103, + "id": 100, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -2943,7 +2959,7 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -2957,7 +2973,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 21, + "line": 20, "character": 46 } ] @@ -2967,7 +2983,7 @@ } }, { - "id": 104, + "id": 101, "name": "SnackbarContent", "kind": 4194304, "kindString": "Type alias", @@ -2977,7 +2993,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 27 } ], @@ -2991,7 +3007,7 @@ { "type": "reflection", "declaration": { - "id": 105, + "id": 102, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -3000,7 +3016,7 @@ }, "signatures": [ { - "id": 106, + "id": 103, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -3009,7 +3025,7 @@ }, "parameters": [ { - "id": 107, + "id": 104, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -3018,12 +3034,12 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } }, { - "id": 108, + "id": 105, "name": "message", "kind": 32768, "kindString": "Parameter", @@ -3032,7 +3048,7 @@ }, "type": { "type": "reference", - "id": 99, + "id": 96, "name": "SnackbarMessage" } } @@ -3046,7 +3062,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 47 } ] @@ -3056,7 +3072,33 @@ } }, { - "id": 96, + "id": 126, + "name": "SnackbarContentProps", + "kind": 4194304, + "kindString": "Type alias", + "flags": { + "isExported": true + }, + "sources": [ + { + "fileName": "src/index.d.ts", + "line": 111, + "character": 32 + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "HTMLDivElement" + } + ], + "name": "HTMLAttributes" + } + }, + { + "id": 93, "name": "SnackbarKey", "kind": 4194304, "kindString": "Type alias", @@ -3066,7 +3108,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 16, + "line": 15, "character": 23 } ], @@ -3085,7 +3127,7 @@ } }, { - "id": 99, + "id": 96, "name": "SnackbarMessage", "kind": 4194304, "kindString": "Type alias", @@ -3095,7 +3137,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 20, + "line": 19, "character": 27 } ], @@ -3114,7 +3156,7 @@ } }, { - "id": 109, + "id": 106, "name": "TransitionCloseHandler", "kind": 4194304, "kindString": "Type alias", @@ -3124,14 +3166,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 26, + "line": 25, "character": 34 } ], "type": { "type": "reflection", "declaration": { - "id": 110, + "id": 107, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -3140,7 +3182,7 @@ }, "signatures": [ { - "id": 111, + "id": 108, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -3149,7 +3191,7 @@ }, "parameters": [ { - "id": 112, + "id": 109, "name": "event", "kind": 32768, "kindString": "Parameter", @@ -3177,7 +3219,7 @@ } }, { - "id": 113, + "id": 110, "name": "reason", "kind": 32768, "kindString": "Parameter", @@ -3186,12 +3228,12 @@ }, "type": { "type": "reference", - "id": 98, + "id": 95, "name": "CloseReason" } }, { - "id": 114, + "id": 111, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -3201,7 +3243,7 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -3215,7 +3257,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 26, + "line": 25, "character": 36 } ] @@ -3223,7 +3265,7 @@ } }, { - "id": 115, + "id": 112, "name": "TransitionEnterHandler", "kind": 4194304, "kindString": "Type alias", @@ -3233,14 +3275,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 34 } ], "type": { "type": "reflection", "declaration": { - "id": 116, + "id": 113, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -3249,7 +3291,7 @@ }, "signatures": [ { - "id": 117, + "id": 114, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -3258,7 +3300,7 @@ }, "parameters": [ { - "id": 118, + "id": 115, "name": "node", "kind": 32768, "kindString": "Parameter", @@ -3271,7 +3313,7 @@ } }, { - "id": 119, + "id": 116, "name": "isAppearing", "kind": 32768, "kindString": "Parameter", @@ -3284,7 +3326,7 @@ } }, { - "id": 120, + "id": 117, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -3293,7 +3335,7 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -3307,7 +3349,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 36 } ] @@ -3315,7 +3357,7 @@ } }, { - "id": 121, + "id": 118, "name": "TransitionHandler", "kind": 4194304, "kindString": "Type alias", @@ -3325,14 +3367,14 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 29 } ], "type": { "type": "reflection", "declaration": { - "id": 122, + "id": 119, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -3341,7 +3383,7 @@ }, "signatures": [ { - "id": 123, + "id": 120, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -3350,7 +3392,7 @@ }, "parameters": [ { - "id": 124, + "id": 121, "name": "node", "kind": 32768, "kindString": "Parameter", @@ -3363,7 +3405,7 @@ } }, { - "id": 125, + "id": 122, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -3372,7 +3414,7 @@ }, "type": { "type": "reference", - "id": 96, + "id": 93, "name": "SnackbarKey" } } @@ -3386,7 +3428,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 31 } ] @@ -3394,7 +3436,7 @@ } }, { - "id": 127, + "id": 124, "name": "VariantClassKey", "kind": 4194304, "kindString": "Type alias", @@ -3431,7 +3473,7 @@ } }, { - "id": 97, + "id": 94, "name": "VariantType", "kind": 4194304, "kindString": "Type alias", @@ -3441,7 +3483,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 17, + "line": 16, "character": 23 } ], @@ -3472,7 +3514,7 @@ } }, { - "id": 138, + "id": 136, "name": "WithSnackbarProps", "kind": 4194304, "kindString": "Type alias", @@ -3482,18 +3524,18 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 274, + "line": 269, "character": 29 } ], "type": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } }, { - "id": 129, + "id": 127, "name": "SnackbarProvider", "kind": 32, "kindString": "Variable", @@ -3504,7 +3546,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 260, + "line": 255, "character": 29 } ], @@ -3513,7 +3555,7 @@ "typeArguments": [ { "type": "reference", - "id": 63, + "id": 60, "name": "SnackbarProviderProps" } ], @@ -3521,7 +3563,7 @@ } }, { - "id": 136, + "id": 134, "name": "useSnackbar", "kind": 64, "kindString": "Function", @@ -3530,7 +3572,7 @@ }, "signatures": [ { - "id": 137, + "id": 135, "name": "useSnackbar", "kind": 4096, "kindString": "Call signature", @@ -3539,7 +3581,7 @@ }, "type": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } } @@ -3547,13 +3589,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 271, + "line": 266, "character": 27 } ] }, { - "id": 130, + "id": 128, "name": "withSnackbar", "kind": 64, "kindString": "Function", @@ -3562,7 +3604,7 @@ }, "signatures": [ { - "id": 131, + "id": 129, "name": "withSnackbar", "kind": 4096, "kindString": "Call signature", @@ -3571,7 +3613,7 @@ }, "typeParameter": [ { - "id": 132, + "id": 130, "name": "P", "kind": 131072, "kindString": "Type parameter", @@ -3580,14 +3622,14 @@ }, "type": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } } ], "parameters": [ { - "id": 133, + "id": 131, "name": "component", "kind": 32768, "kindString": "Parameter", @@ -3602,7 +3644,7 @@ "name": "P", "constraint": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } } @@ -3619,14 +3661,14 @@ "typeArguments": [ { "type": "reference", - "id": 90, + "id": 87, "typeArguments": [ { "type": "typeParameter", "name": "P", "constraint": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } }, @@ -3635,7 +3677,7 @@ "operator": "keyof", "target": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } } @@ -3648,7 +3690,7 @@ { "type": "reflection", "declaration": { - "id": 134, + "id": 132, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -3657,7 +3699,7 @@ }, "children": [ { - "id": 135, + "id": 133, "name": "WrappedComponent", "kind": 32, "kindString": "Variable", @@ -3667,7 +3709,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 268, + "line": 263, "character": 77 } ], @@ -3679,7 +3721,7 @@ "name": "P", "constraint": { "type": "reference", - "id": 75, + "id": 72, "name": "ProviderContext" } } @@ -3693,14 +3735,14 @@ "title": "Variables", "kind": 32, "children": [ - 135 + 133 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 268, + "line": 263, "character": 58 } ] @@ -3713,7 +3755,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 267, + "line": 262, "character": 28 } ] @@ -3725,39 +3767,39 @@ "kind": 256, "children": [ 4, - 56, - 75, - 49, + 53, + 72, + 46, 1, 18, - 63, + 60, 10 ], "categories": [ { "title": "Enqueue", "children": [ - 56 + 53 ] }, { "title": "Other", "children": [ 4, - 75, + 72, 1 ] }, { "title": "Provider", "children": [ - 63 + 60 ] }, { "title": "Shared", "children": [ - 49, + 46, 18, 10 ] @@ -3768,38 +3810,39 @@ "title": "Type aliases", "kind": 4194304, "children": [ - 88, - 98, - 128, + 85, + 95, + 125, + 123, + 90, + 87, + 82, + 97, + 101, 126, 93, - 90, - 85, - 100, - 104, 96, - 99, - 109, - 115, - 121, - 127, - 97, - 138 + 106, + 112, + 118, + 124, + 94, + 136 ] }, { "title": "Variables", "kind": 32, "children": [ - 129 + 127 ] }, { "title": "Functions", "kind": 64, "children": [ - 136, - 130 + 134, + 128 ] } ] From d191a512169b939ad3e27b4a051bc015fbe1e264 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Fri, 15 May 2020 03:55:43 +0100 Subject: [PATCH 16/23] Use transformer for container anchor origin --- src/SnackbarProvider.tsx | 6 +++--- src/utils/constants.ts | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index 05fc9f27..f88ae30f 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -2,11 +2,11 @@ import React, { Component } from 'react'; import { createPortal } from 'react-dom'; import clsx from 'clsx'; import SnackbarContext from './SnackbarContext'; -import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys, DEFAULTS, merge } from './utils/constants'; +import { MESSAGES, REASONS, originKeyExtractor, omitContainerKeys, DEFAULTS, merge, transformer } from './utils/constants'; import SnackbarItem from './SnackbarItem'; import SnackbarContainer from './SnackbarContainer'; import warning from './utils/warning'; -import { SnackbarProviderProps, ContainerClassKey, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps } from '.'; +import { SnackbarProviderProps, SnackbarKey, SnackbarMessage, OptionsObject, RequiredBy, ProviderContext, TransitionHandlerProps } from '.'; import createChainedFunction from './utils/createChainedFunction'; type Reducer = (state: State) => State; @@ -278,7 +278,7 @@ class SnackbarProvider extends Component { anchorOrigin={snacks[0].anchorOrigin} className={clsx( classes.containerRoot, - classes[`containerAnchorOrigin${origin}` as ContainerClassKey], + classes[transformer.toContainerAnchorOrigin(origin)], )} > {snacks.map(snack => ( diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 0417d008..a21388f5 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -72,10 +72,9 @@ export const REASONS: { [key: string]: CloseReason } = { INSTRUCTED: 'instructed', }; -/** - * Tranforms classes name - */ +/** Tranforms classes name */ export const transformer = { + toContainerAnchorOrigin: (origin: string) => `anchorOrigin${origin}` as ContainerClassKey, toAnchorOrigin: ({ vertical, horizontal }: SnackbarOrigin) => ( `anchorOrigin${capitalise(vertical)}${capitalise(horizontal)}` as SnackbarClassKey ), From 76d9cf45daf42400c6edfc7b1721d06b47eb0705 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Sat, 16 May 2020 21:28:51 +0100 Subject: [PATCH 17/23] Add comment --- src/SnackbarItem/SnackbarItem.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index e18efa8e..f0dfa134 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -181,6 +181,7 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { {/* // @ts-ignore */} Date: Sun, 23 Aug 2020 00:40:02 +0100 Subject: [PATCH 18/23] Update typedoc --- typedoc.json | 317 +++++++++++++++------------------------------------ 1 file changed, 89 insertions(+), 228 deletions(-) diff --git a/typedoc.json b/typedoc.json index 0f49a07b..073be762 100644 --- a/typedoc.json +++ b/typedoc.json @@ -28,7 +28,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 51, + "line": 50, "character": 11 } ], @@ -51,7 +51,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 55, + "line": 54, "character": 9 } ], @@ -74,7 +74,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 67, + "line": 66, "character": 8 } ], @@ -97,7 +97,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 59, + "line": 58, "character": 11 } ], @@ -120,7 +120,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 63, + "line": 62, "character": 11 } ], @@ -146,7 +146,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 47, + "line": 46, "character": 28 } ] @@ -183,7 +183,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 200, + "line": 196, "character": 10 } ], @@ -220,7 +220,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 195, + "line": 191, "character": 11 } ], @@ -256,7 +256,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 211, + "line": 207, "character": 7 } ], @@ -287,7 +287,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 216, + "line": 212, "character": 11 } ], @@ -330,7 +330,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 190, + "line": 186, "character": 20 } ], @@ -378,7 +378,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 185, + "line": 181, "character": 11 } ], @@ -411,7 +411,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 206, + "line": 202, "character": 30 } ], @@ -443,7 +443,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 258, "character": 17 } ], @@ -492,7 +492,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 258, "character": 18 } ] @@ -510,7 +510,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 261, + "line": 257, "character": 19 } ], @@ -574,7 +574,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 261, + "line": 257, "character": 20 } ] @@ -595,7 +595,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 260, + "line": 256, "character": 32 } ] @@ -632,7 +632,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 200, + "line": 196, "character": 10 } ], @@ -664,7 +664,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 195, + "line": 191, "character": 11 } ], @@ -695,7 +695,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 190, + "line": 186, "character": 20 } ], @@ -738,7 +738,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 185, + "line": 181, "character": 11 } ], @@ -764,7 +764,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 179, + "line": 175, "character": 28 } ], @@ -782,7 +782,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 179, + "line": 175, "character": 36 } ] @@ -801,7 +801,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 179, + "line": 175, "character": 68 } ] @@ -841,7 +841,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 44, + "line": 43, "character": 14 } ], @@ -874,7 +874,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 43, + "line": 42, "character": 12 } ], @@ -906,7 +906,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 42, + "line": 41, "character": 31 } ] @@ -921,37 +921,6 @@ }, "comment": {}, "children": [ - { - "id": 22, - "name": "ContentProps", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "comment": { - "shortText": "Properties applied to SnackbarContent component.\nIf `content` property is specified (i.e. you're passing a custom snackbar), it does nothing." - }, - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 139, - "character": 16 - } - ], - "type": { - "type": "reference", - "typeArguments": [ - { - "type": "reference", - "id": 126, - "name": "SnackbarContentProps" - } - ], - "name": "Partial" - } - }, { "id": 25, "name": "TransitionComponent", @@ -973,7 +942,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 155, + "line": 156, "character": 23 } ], @@ -1003,7 +972,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 173, + "line": 169, "character": 19 } ], @@ -1034,7 +1003,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 120, + "line": 121, "character": 16 } ], @@ -1059,7 +1028,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 137, + "line": 138, "character": 18 } ], @@ -1089,7 +1058,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 128, + "line": 129, "character": 20 } ], @@ -1211,7 +1180,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 142, + "line": 143, "character": 29 } ], @@ -1380,7 +1349,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 150, + "line": 151, "character": 22 } ], @@ -1445,7 +1414,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 169, + "line": 165, "character": 22 } ], @@ -1479,8 +1448,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 169, - "character": 42 + "line": 165, + "character": 33 } ], "type": { @@ -1509,8 +1478,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 169, - "character": 58 + "line": 165, + "character": 49 } ], "type": { @@ -1539,8 +1508,8 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 169, - "character": 73 + "line": 165, + "character": 64 } ], "type": { @@ -1568,13 +1537,6 @@ 30 ] } - ], - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 169, - "character": 33 - } ] } } @@ -1587,7 +1549,6 @@ "title": "Properties", "kind": 1024, "children": [ - 22, 25, 31, 19, @@ -1607,7 +1568,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 115, + "line": 116, "character": 30 } ], @@ -1869,7 +1830,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 200, + "line": 196, "character": 10 } ], @@ -1898,7 +1859,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 228, + "line": 224, "character": 12 } ], @@ -1934,7 +1895,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 251, + "line": 247, "character": 11 } ], @@ -1979,7 +1940,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 195, + "line": 191, "character": 11 } ], @@ -2015,7 +1976,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 233, + "line": 229, "character": 9 } ], @@ -2052,7 +2013,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 247, + "line": 243, "character": 11 } ], @@ -2082,7 +2043,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 243, + "line": 239, "character": 19 } ], @@ -2119,7 +2080,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 255, + "line": 251, "character": 15 } ], @@ -2156,7 +2117,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 238, + "line": 234, "character": 12 } ], @@ -2195,7 +2156,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 190, + "line": 186, "character": 20 } ], @@ -2243,7 +2204,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 185, + "line": 181, "character": 11 } ], @@ -2281,7 +2242,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 223, + "line": 219, "character": 38 } ], @@ -2334,7 +2295,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 85, + "line": 84, "character": 11 } ], @@ -2358,7 +2319,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 89, + "line": 88, "character": 11 } ], @@ -2382,7 +2343,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 97, + "line": 96, "character": 13 } ], @@ -2406,7 +2367,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 93, + "line": 92, "character": 14 } ], @@ -2430,7 +2391,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 101, + "line": 100, "character": 10 } ], @@ -2454,7 +2415,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 109, + "line": 108, "character": 12 } ], @@ -2478,7 +2439,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 105, + "line": 104, "character": 13 } ], @@ -2507,7 +2468,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 73, + "line": 72, "character": 39 } ] @@ -2538,7 +2499,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 12, + "line": 11, "character": 24 } ], @@ -2572,7 +2533,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 18, + "line": 17, "character": 23 } ], @@ -2609,7 +2570,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 40, + "line": 39, "character": 28 } ], @@ -2644,7 +2605,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 30, + "line": 29, "character": 29 } ], @@ -2713,7 +2674,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 14, + "line": 13, "character": 11 } ], @@ -2798,7 +2759,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 13, + "line": 12, "character": 9 } ], @@ -2882,106 +2843,6 @@ "character": 22 } ], - "type": { - "type": "intersection", - "types": [ - { - "type": "reference", - "id": 90, - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Omit" - }, - { - "type": "reference", - "typeArguments": [ - { - "type": "reference", - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Pick" - } - ], - "name": "Partial" - } - ] - } - }, - { - "id": 85, - "name": "RequiredBy", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "typeParameter": [ - { - "id": 86, - "name": "T", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - } - }, - { - "id": 87, - "name": "K", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - }, - "type": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 11, - "character": 22 - } - ], "type": { "type": "intersection", "types": [ @@ -3050,7 +2911,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 21, + "line": 20, "character": 26 } ], @@ -3105,7 +2966,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 21, + "line": 20, "character": 46 } ] @@ -3125,7 +2986,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 27 } ], @@ -3194,7 +3055,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 47 } ] @@ -3240,7 +3101,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 16, + "line": 15, "character": 23 } ], @@ -3269,7 +3130,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 20, + "line": 19, "character": 27 } ], @@ -3298,7 +3159,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 26, + "line": 25, "character": 34 } ], @@ -3389,7 +3250,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 26, + "line": 25, "character": 36 } ] @@ -3407,7 +3268,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 34 } ], @@ -3481,7 +3342,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 27, + "line": 26, "character": 36 } ] @@ -3499,7 +3360,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 29 } ], @@ -3560,7 +3421,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 28, + "line": 27, "character": 31 } ] @@ -3578,7 +3439,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 39, + "line": 38, "character": 27 } ], @@ -3615,7 +3476,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 17, + "line": 16, "character": 23 } ], @@ -3656,7 +3517,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 272, + "line": 268, "character": 29 } ], @@ -3678,7 +3539,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 258, + "line": 254, "character": 29 } ], @@ -3721,7 +3582,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 269, + "line": 265, "character": 27 } ] @@ -3841,7 +3702,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 266, + "line": 262, "character": 77 } ], @@ -3874,7 +3735,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 266, + "line": 262, "character": 58 } ] @@ -3887,7 +3748,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 265, + "line": 261, "character": 28 } ] From bd61e8e042cb634792984c0e816cc451907f4da3 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Tue, 24 Nov 2020 21:58:45 +0000 Subject: [PATCH 19/23] Attempt to stop spreading props --- src/SnackbarItem/SnackbarItem.tsx | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 98d270ea..89c4c3af 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -11,9 +11,9 @@ import createChainedFunction from '../utils/createChainedFunction'; import { Snack } from '../SnackbarProvider'; import Snackbar from './Snackbar'; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type const styles = (theme: Theme) => { - const backgroundColor = emphasize(theme.palette.background.default, theme.palette.type === 'light' ? 0.8 : 0.98); + const mode = theme.palette.mode || theme.palette.type; + const backgroundColor = emphasize(theme.palette.background.default, mode === 'light' ? 0.8 : 0.98); return createStyles({ ...allClasses.mui, lessPadding: { @@ -84,12 +84,10 @@ const styles = (theme: Theme) => { type RemovedProps = - /** the one received from Provider is processed and passed to snack prop */ - | 'variant' - /** same as above */ - | 'anchorOrigin' - /** the one recevied from enqueueSnackbar is processed in provider, therefore shouldn't be passed to SnackbarItem */ - | 'preventDuplicate' + | 'variant' // the one received from Provider is processed and passed to snack prop + | 'anchorOrigin' // same as above + | 'autoHideDuration' // same as above + | 'preventDuplicate' // the one recevied from enqueueSnackbar is processed in provider, therefore shouldn't be passed to SnackbarItem */ export interface SnackbarItemProps extends WithStyles, RequiredBy, 'onEntered' | 'onExited' | 'onClose'> { @@ -136,12 +134,19 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { TransitionComponent: otherTranComponent, TransitionProps: otherTranProps, transitionDuration: otherTranDuration, + onEnter: ignoredOnEnter, + onEntered: ignoredOnEntered, + onEntering: ignoredOnEntering, + onExit: ignoredOnExit, + onExited: ignoredOnExited, + onExiting: ignoredOnExiting, ...other } = props; const { persist, key, + open, entered, requestClose, className: singleClassName, @@ -154,6 +159,12 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { TransitionComponent: singleTranComponent, TransitionProps: singleTranProps, transitionDuration: singleTranDuration, + onEnter, + onEntered, + onEntering, + onExit, + onExited, + onExiting, ...singleSnackProps } = snack; @@ -201,10 +212,9 @@ const SnackbarItem: React.FC = ({ classes, ...props }) => { > {/* @ts-ignore */} = ({ classes, ...props }) => { {/* @ts-ignore */} = ({ classes, ...props }) => { )} - +
); }; From cb79587196e9cb36c381dcc05671d7383e0fb8bb Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Tue, 24 Nov 2020 22:01:48 +0000 Subject: [PATCH 20/23] TSDX transpileOnly --- package.json | 2 +- src/SnackbarItem/SnackbarItem.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d69fe4ac..c2b787f0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "type": "git" }, "scripts": { - "build": "tsdx build --entry ./src/index.js", + "build": "tsdx build --transpileOnly --entry ./src/index.js", "prebuild": "npm run docs", "prepublishOnly": "npm run build", "docs": "rimraf typedoc.json && typedoc --tsconfig", diff --git a/src/SnackbarItem/SnackbarItem.tsx b/src/SnackbarItem/SnackbarItem.tsx index 89c4c3af..41d3c9cf 100644 --- a/src/SnackbarItem/SnackbarItem.tsx +++ b/src/SnackbarItem/SnackbarItem.tsx @@ -12,6 +12,7 @@ import { Snack } from '../SnackbarProvider'; import Snackbar from './Snackbar'; const styles = (theme: Theme) => { + // @ts-ignore const mode = theme.palette.mode || theme.palette.type; const backgroundColor = emphasize(theme.palette.background.default, mode === 'light' ? 0.8 : 0.98); return createStyles({ From a81faed632d1cb42dd1bf7496908571e782f6ed0 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Tue, 24 Nov 2020 22:15:46 +0000 Subject: [PATCH 21/23] Credit mui snackbar --- src/SnackbarItem/Snackbar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SnackbarItem/Snackbar.js b/src/SnackbarItem/Snackbar.js index c8b7fae3..4525b884 100644 --- a/src/SnackbarItem/Snackbar.js +++ b/src/SnackbarItem/Snackbar.js @@ -1,3 +1,6 @@ +/** + * @link /~https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Snackbar/Snackbar.js + */ import * as React from 'react'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { REASONS } from '../utils/constants'; From 094c416770697635a8303f20acea0f4a153a0818 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Tue, 24 Nov 2020 22:15:54 +0000 Subject: [PATCH 22/23] Update docs --- typedoc.json | 364 ++++++++++++++++++++------------------------------- 1 file changed, 145 insertions(+), 219 deletions(-) diff --git a/typedoc.json b/typedoc.json index d494d91f..74ece5a1 100644 --- a/typedoc.json +++ b/typedoc.json @@ -208,7 +208,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 264, + "line": 260, "character": 17 } ], @@ -270,7 +270,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 263, + "line": 259, "character": 19 } ], @@ -1951,7 +1951,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 262, + "line": 258, "character": 29 } ], @@ -2153,7 +2153,7 @@ ], "type": { "type": "reference", - "id": 187, + "id": 184, "name": "SnackbarAction" }, "inheritedFrom": { @@ -2190,7 +2190,7 @@ ], "type": { "type": "reference", - "id": 191, + "id": 188, "name": "SnackbarContentCallback" }, "inheritedFrom": { @@ -2226,7 +2226,7 @@ ], "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } }, @@ -2348,7 +2348,7 @@ ], "type": { "type": "reference", - "id": 184, + "id": 181, "name": "VariantType" }, "inheritedFrom": { @@ -2407,7 +2407,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 269, + "line": 265, "character": 17 } ], @@ -2442,7 +2442,7 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -2456,7 +2456,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 269, + "line": 265, "character": 18 } ] @@ -2474,7 +2474,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 268, + "line": 264, "character": 19 } ], @@ -2508,7 +2508,7 @@ }, "type": { "type": "reference", - "id": 186, + "id": 183, "name": "SnackbarMessage" } }, @@ -2530,7 +2530,7 @@ ], "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -2538,7 +2538,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 268, + "line": 264, "character": 20 } ] @@ -2559,7 +2559,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 267, + "line": 263, "character": 32 } ] @@ -2602,7 +2602,7 @@ ], "type": { "type": "reference", - "id": 187, + "id": 184, "name": "SnackbarAction" } }, @@ -2634,7 +2634,7 @@ ], "type": { "type": "reference", - "id": 191, + "id": 188, "name": "SnackbarContentCallback" } }, @@ -2708,7 +2708,7 @@ ], "type": { "type": "reference", - "id": 184, + "id": 181, "name": "VariantType" } } @@ -3099,7 +3099,7 @@ "typeArguments": [ { "type": "reference", - "id": 175, + "id": 172, "typeArguments": [ { "type": "reference", @@ -3800,7 +3800,7 @@ ], "type": { "type": "reference", - "id": 187, + "id": 184, "name": "SnackbarAction" }, "inheritedFrom": { @@ -3868,11 +3868,11 @@ "typeArguments": [ { "type": "reference", - "id": 175, + "id": 172, "typeArguments": [ { "type": "reference", - "id": 215, + "id": 212, "name": "CombinedClassKey" } ], @@ -3910,7 +3910,7 @@ ], "type": { "type": "reference", - "id": 191, + "id": 188, "name": "SnackbarContentCallback" }, "inheritedFrom": { @@ -4162,7 +4162,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 259, + "line": 255, "character": 7 } ], @@ -4205,7 +4205,7 @@ ], "type": { "type": "reference", - "id": 184, + "id": 181, "name": "VariantType" }, "inheritedFrom": { @@ -4297,7 +4297,7 @@ ], "type": { "type": "reference", - "id": 196, + "id": 193, "name": "TransitionCloseHandler" } }, @@ -4321,7 +4321,7 @@ ], "type": { "type": "reference", - "id": 208, + "id": 205, "name": "TransitionHandler" } }, @@ -4345,7 +4345,7 @@ ], "type": { "type": "reference", - "id": 202, + "id": 199, "name": "TransitionEnterHandler" } }, @@ -4369,7 +4369,7 @@ ], "type": { "type": "reference", - "id": 208, + "id": 205, "name": "TransitionHandler" } }, @@ -4393,7 +4393,7 @@ ], "type": { "type": "reference", - "id": 208, + "id": 205, "name": "TransitionHandler" } }, @@ -4417,7 +4417,7 @@ ], "type": { "type": "reference", - "id": 208, + "id": 205, "name": "TransitionHandler" } }, @@ -4441,7 +4441,7 @@ ], "type": { "type": "reference", - "id": 208, + "id": 205, "name": "TransitionHandler" } } @@ -4470,7 +4470,7 @@ ] }, { - "id": 175, + "id": 172, "name": "ClassNameMap", "kind": 4194304, "kindString": "Type alias", @@ -4479,7 +4479,7 @@ }, "typeParameter": [ { - "id": 176, + "id": 173, "name": "ClassKey", "kind": 131072, "kindString": "Type parameter", @@ -4519,7 +4519,7 @@ } }, { - "id": 185, + "id": 182, "name": "CloseReason", "kind": 4194304, "kindString": "Type alias", @@ -4556,7 +4556,7 @@ } }, { - "id": 215, + "id": 212, "name": "CombinedClassKey", "kind": 4194304, "kindString": "Type alias", @@ -4575,12 +4575,12 @@ "types": [ { "type": "reference", - "id": 214, + "id": 211, "name": "VariantClassKey" }, { "type": "reference", - "id": 213, + "id": 210, "name": "ContainerClassKey" }, { @@ -4591,7 +4591,7 @@ } }, { - "id": 213, + "id": 210, "name": "ContainerClassKey", "kind": 4194304, "kindString": "Type alias", @@ -4640,7 +4640,7 @@ } }, { - "id": 180, + "id": 177, "name": "Modify", "kind": 4194304, "kindString": "Type alias", @@ -4649,7 +4649,7 @@ }, "typeParameter": [ { - "id": 181, + "id": 178, "name": "T", "kind": 131072, "kindString": "Type parameter", @@ -4658,7 +4658,7 @@ } }, { - "id": 182, + "id": 179, "name": "R", "kind": 131072, "kindString": "Type parameter", @@ -4717,7 +4717,7 @@ } }, { - "id": 177, + "id": 174, "name": "Omit", "kind": 4194304, "kindString": "Type alias", @@ -4726,7 +4726,7 @@ }, "typeParameter": [ { - "id": 178, + "id": 175, "name": "T", "kind": 131072, "kindString": "Type parameter", @@ -4735,7 +4735,7 @@ } }, { - "id": 179, + "id": 176, "name": "K", "kind": 131072, "kindString": "Type parameter", @@ -4798,7 +4798,7 @@ }, { "id": 169, - "name": "OptionalBy", + "name": "RequiredBy", "kind": 4194304, "kindString": "Type alias", "flags": { @@ -4844,107 +4844,7 @@ "types": [ { "type": "reference", - "id": 177, - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Omit" - }, - { - "type": "reference", - "typeArguments": [ - { - "type": "reference", - "typeArguments": [ - { - "type": "typeParameter", - "name": "T" - }, - { - "type": "typeParameter", - "name": "K", - "constraint": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "name": "Pick" - } - ], - "name": "Partial" - } - ] - } - }, - { - "id": 172, - "name": "RequiredBy", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "typeParameter": [ - { - "id": 173, - "name": "T", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - } - }, - { - "id": 174, - "name": "K", - "kind": 131072, - "kindString": "Type parameter", - "flags": { - "isExported": true - }, - "type": { - "type": "typeOperator", - "operator": "keyof", - "target": { - "type": "typeParameter", - "name": "T" - } - } - } - ], - "sources": [ - { - "fileName": "src/index.d.ts", - "line": 11, - "character": 22 - } - ], - "type": { - "type": "intersection", - "types": [ - { - "type": "reference", - "id": 177, + "id": 174, "typeArguments": [ { "type": "typeParameter", @@ -4997,7 +4897,7 @@ } }, { - "id": 187, + "id": 184, "name": "SnackbarAction", "kind": 4194304, "kindString": "Type alias", @@ -5021,7 +4921,7 @@ { "type": "reflection", "declaration": { - "id": 188, + "id": 185, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5030,7 +4930,7 @@ }, "signatures": [ { - "id": 189, + "id": 186, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -5039,7 +4939,7 @@ }, "parameters": [ { - "id": 190, + "id": 187, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -5048,7 +4948,7 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -5072,7 +4972,7 @@ } }, { - "id": 191, + "id": 188, "name": "SnackbarContentCallback", "kind": 4194304, "kindString": "Type alias", @@ -5082,7 +4982,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 35 } ], @@ -5096,7 +4996,7 @@ { "type": "reflection", "declaration": { - "id": 192, + "id": 189, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5105,7 +5005,7 @@ }, "signatures": [ { - "id": 193, + "id": 190, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -5114,7 +5014,7 @@ }, "parameters": [ { - "id": 194, + "id": 191, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -5123,12 +5023,12 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } }, { - "id": 195, + "id": 192, "name": "message", "kind": 32768, "kindString": "Parameter", @@ -5137,7 +5037,7 @@ }, "type": { "type": "reference", - "id": 186, + "id": 183, "name": "SnackbarMessage" } } @@ -5151,7 +5051,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 22, + "line": 21, "character": 55 } ] @@ -5161,7 +5061,33 @@ } }, { - "id": 183, + "id": 213, + "name": "SnackbarContentProps", + "kind": 4194304, + "kindString": "Type alias", + "flags": { + "isExported": true + }, + "sources": [ + { + "fileName": "src/index.d.ts", + "line": 111, + "character": 32 + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "HTMLDivElement" + } + ], + "name": "HTMLAttributes" + } + }, + { + "id": 180, "name": "SnackbarKey", "kind": 4194304, "kindString": "Type alias", @@ -5190,7 +5116,7 @@ } }, { - "id": 186, + "id": 183, "name": "SnackbarMessage", "kind": 4194304, "kindString": "Type alias", @@ -5219,7 +5145,7 @@ } }, { - "id": 196, + "id": 193, "name": "TransitionCloseHandler", "kind": 4194304, "kindString": "Type alias", @@ -5236,7 +5162,7 @@ "type": { "type": "reflection", "declaration": { - "id": 197, + "id": 194, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5245,7 +5171,7 @@ }, "signatures": [ { - "id": 198, + "id": 195, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -5254,7 +5180,7 @@ }, "parameters": [ { - "id": 199, + "id": 196, "name": "event", "kind": 32768, "kindString": "Parameter", @@ -5282,7 +5208,7 @@ } }, { - "id": 200, + "id": 197, "name": "reason", "kind": 32768, "kindString": "Parameter", @@ -5291,12 +5217,12 @@ }, "type": { "type": "reference", - "id": 185, + "id": 182, "name": "CloseReason" } }, { - "id": 201, + "id": 198, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -5306,7 +5232,7 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -5328,7 +5254,7 @@ } }, { - "id": 202, + "id": 199, "name": "TransitionEnterHandler", "kind": 4194304, "kindString": "Type alias", @@ -5345,7 +5271,7 @@ "type": { "type": "reflection", "declaration": { - "id": 203, + "id": 200, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5354,7 +5280,7 @@ }, "signatures": [ { - "id": 204, + "id": 201, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -5363,7 +5289,7 @@ }, "parameters": [ { - "id": 205, + "id": 202, "name": "node", "kind": 32768, "kindString": "Parameter", @@ -5376,7 +5302,7 @@ } }, { - "id": 206, + "id": 203, "name": "isAppearing", "kind": 32768, "kindString": "Parameter", @@ -5389,7 +5315,7 @@ } }, { - "id": 207, + "id": 204, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -5398,7 +5324,7 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -5420,7 +5346,7 @@ } }, { - "id": 208, + "id": 205, "name": "TransitionHandler", "kind": 4194304, "kindString": "Type alias", @@ -5437,7 +5363,7 @@ "type": { "type": "reflection", "declaration": { - "id": 209, + "id": 206, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5446,7 +5372,7 @@ }, "signatures": [ { - "id": 210, + "id": 207, "name": "__call", "kind": 4096, "kindString": "Call signature", @@ -5455,7 +5381,7 @@ }, "parameters": [ { - "id": 211, + "id": 208, "name": "node", "kind": 32768, "kindString": "Parameter", @@ -5468,7 +5394,7 @@ } }, { - "id": 212, + "id": 209, "name": "key", "kind": 32768, "kindString": "Parameter", @@ -5477,7 +5403,7 @@ }, "type": { "type": "reference", - "id": 183, + "id": 180, "name": "SnackbarKey" } } @@ -5499,7 +5425,7 @@ } }, { - "id": 214, + "id": 211, "name": "VariantClassKey", "kind": 4194304, "kindString": "Type alias", @@ -5536,7 +5462,7 @@ } }, { - "id": 184, + "id": 181, "name": "VariantType", "kind": 4194304, "kindString": "Type alias", @@ -5577,7 +5503,7 @@ } }, { - "id": 224, + "id": 222, "name": "WithSnackbarProps", "kind": 4194304, "kindString": "Type alias", @@ -5587,7 +5513,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 279, + "line": 275, "character": 29 } ], @@ -5598,7 +5524,7 @@ } }, { - "id": 222, + "id": 220, "name": "useSnackbar", "kind": 64, "kindString": "Function", @@ -5607,7 +5533,7 @@ }, "signatures": [ { - "id": 223, + "id": 221, "name": "useSnackbar", "kind": 4096, "kindString": "Call signature", @@ -5624,13 +5550,13 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 276, + "line": 272, "character": 27 } ] }, { - "id": 216, + "id": 214, "name": "withSnackbar", "kind": 64, "kindString": "Function", @@ -5639,7 +5565,7 @@ }, "signatures": [ { - "id": 217, + "id": 215, "name": "withSnackbar", "kind": 4096, "kindString": "Call signature", @@ -5648,7 +5574,7 @@ }, "typeParameter": [ { - "id": 218, + "id": 216, "name": "P", "kind": 131072, "kindString": "Type parameter", @@ -5664,7 +5590,7 @@ ], "parameters": [ { - "id": 219, + "id": 217, "name": "component", "kind": 32768, "kindString": "Parameter", @@ -5696,7 +5622,7 @@ "typeArguments": [ { "type": "reference", - "id": 177, + "id": 174, "typeArguments": [ { "type": "typeParameter", @@ -5725,7 +5651,7 @@ { "type": "reflection", "declaration": { - "id": 220, + "id": 218, "name": "__type", "kind": 65536, "kindString": "Type literal", @@ -5734,7 +5660,7 @@ }, "children": [ { - "id": 221, + "id": 219, "name": "WrappedComponent", "kind": 32, "kindString": "Variable", @@ -5744,7 +5670,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 273, + "line": 269, "character": 77 } ], @@ -5770,14 +5696,14 @@ "title": "Variables", "kind": 32, "children": [ - 221 + 219 ] } ], "sources": [ { "fileName": "src/index.d.ts", - "line": 273, + "line": 269, "character": 58 } ] @@ -5790,7 +5716,7 @@ "sources": [ { "fileName": "src/index.d.ts", - "line": 272, + "line": 268, "character": 28 } ] @@ -5852,32 +5778,32 @@ "title": "Type aliases", "kind": 4194304, "children": [ - 175, - 185, - 215, - 213, - 180, + 172, + 182, + 212, + 210, 177, + 174, 169, - 172, - 187, - 191, - 183, - 186, - 196, - 202, - 208, - 214, 184, - 224 + 188, + 213, + 180, + 183, + 193, + 199, + 205, + 211, + 181, + 222 ] }, { "title": "Functions", "kind": 64, "children": [ - 222, - 216 + 220, + 214 ] } ] From d1d190e1eedd2fbd9b9b5087cfbd876042484c96 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Thu, 26 Nov 2020 00:33:49 +0000 Subject: [PATCH 23/23] Update changelog --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b30865b8..cf4a776d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ Thanks to all contributers who improved notistack by opening an issue/PR. -### `notistack@1.0.2` +### `notistack@1.0.3` ###### to be published * **@pctestjfarz**: Add swipe to dismiss feature [#138](/~https://github.com/iamhosseindhv/notistack/issues/138) * **@molynerd**: Add support to update content of snackbar in place [#50](/~https://github.com/iamhosseindhv/notistack/issues/50) @@ -9,6 +9,14 @@ Thanks to all contributers who improved notistack by opening an issue/PR.
+### `notistack@1.0.2` +###### November 26, 2020 +* Add support MUI v5 [#333](/~https://github.com/iamhosseindhv/notistack/pull/333) + + +
+ + ### `notistack@1.0.1` ###### October 6, 2020 * **@thierrysantos**: EnqueueSnackbar supports snackbar with key zero [#318](/~https://github.com/iamhosseindhv/notistack/pull/318)