worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
182
node_modules/@mui/material/Snackbar/Snackbar.d.ts
generated
vendored
Normal file
182
node_modules/@mui/material/Snackbar/Snackbar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
import * as React from 'react';
|
||||
import { SxProps } from '@mui/system';
|
||||
import ClickAwayListener, { ClickAwayListenerProps } from "../ClickAwayListener/index.js";
|
||||
import { Theme } from "../styles/index.js";
|
||||
import { InternalStandardProps as StandardProps } from "../internal/index.js";
|
||||
import { SnackbarContentProps } from "../SnackbarContent/index.js";
|
||||
import { TransitionProps } from "../transitions/transition.js";
|
||||
import { SnackbarClasses } from "./snackbarClasses.js";
|
||||
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.js";
|
||||
export interface SnackbarSlots {
|
||||
/**
|
||||
* The component that renders the root slot.
|
||||
* @default 'div'
|
||||
*/
|
||||
root: React.ElementType;
|
||||
/**
|
||||
* The component that renders the content slot.
|
||||
* @default SnackbarContent
|
||||
*/
|
||||
content: React.ElementType;
|
||||
/**
|
||||
* The component that renders the clickAwayListener slot.
|
||||
* @default ClickAwayListener
|
||||
*/
|
||||
clickAwayListener: React.ElementType;
|
||||
/**
|
||||
* The component that renders the transition.
|
||||
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
||||
* @default Grow
|
||||
*/
|
||||
transition: React.ElementType;
|
||||
}
|
||||
export interface SnackbarRootSlotPropsOverrides {}
|
||||
export interface SnackbarContentSlotPropsOverrides {}
|
||||
export interface SnackbarClickAwayListenerSlotPropsOverrides {}
|
||||
export interface SnackbarTransitionSlotPropsOverrides {}
|
||||
export type SnackbarSlotsAndSlotProps = CreateSlotsAndSlotProps<SnackbarSlots, {
|
||||
/**
|
||||
* Props forwarded to the root slot.
|
||||
* By default, the avaible props are based on the div element.
|
||||
*/
|
||||
root: SlotProps<'div', SnackbarRootSlotPropsOverrides, SnackbarOwnerState>;
|
||||
/**
|
||||
* Props forwarded to the content slot.
|
||||
* By default, the avaible props are based on the [SnackbarContent](https://mui.com/material-ui/api/snackbar-content/#props) component.
|
||||
*/
|
||||
content: SlotProps<React.ElementType<SnackbarContentProps>, SnackbarContentSlotPropsOverrides, SnackbarOwnerState>;
|
||||
/**
|
||||
* Props forwarded to the clickAwayListener slot.
|
||||
* By default, the avaible props are based on the [ClickAwayListener](https://mui.com/material-ui/api/click-away-listener/#props) component.
|
||||
*/
|
||||
clickAwayListener: SlotComponentProps<typeof ClickAwayListener, SnackbarClickAwayListenerSlotPropsOverrides, SnackbarOwnerState>;
|
||||
/**
|
||||
* Props applied to the transition element.
|
||||
* By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
|
||||
*/
|
||||
transition: SlotComponentProps<React.ElementType, TransitionProps & SnackbarTransitionSlotPropsOverrides, SnackbarOwnerState>;
|
||||
}>;
|
||||
export interface SnackbarOrigin {
|
||||
vertical: 'top' | 'bottom';
|
||||
horizontal: 'left' | 'center' | 'right';
|
||||
}
|
||||
export type SnackbarCloseReason = 'timeout' | 'clickaway' | 'escapeKeyDown';
|
||||
export interface SnackbarProps extends Omit<StandardProps<React.HTMLAttributes<HTMLDivElement>>, 'slots' | 'slotProps'>, SnackbarSlotsAndSlotProps {
|
||||
/**
|
||||
* The action to display. It renders after the message, at the end of the snackbar.
|
||||
*/
|
||||
action?: SnackbarContentProps['action'];
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
* On smaller screens, the component grows to occupy all the available width,
|
||||
* the horizontal alignment is ignored.
|
||||
* @default { vertical: 'bottom', horizontal: 'left' }
|
||||
*/
|
||||
anchorOrigin?: SnackbarOrigin;
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically calling the
|
||||
* `onClose` function. `onClose` should then set the state of the `open`
|
||||
* prop to hide the Snackbar. This behavior is disabled by default with
|
||||
* the `null` value.
|
||||
* @default null
|
||||
*/
|
||||
autoHideDuration?: number | null;
|
||||
/**
|
||||
* Replace the `SnackbarContent` component.
|
||||
*/
|
||||
children?: React.ReactElement<unknown, any>;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<SnackbarClasses>;
|
||||
/**
|
||||
* Props applied to the `ClickAwayListener` element.
|
||||
* @deprecated Use `slotProps.clickAwayListener` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
ClickAwayListenerProps?: Partial<ClickAwayListenerProps>;
|
||||
/**
|
||||
* Props applied to the [`SnackbarContent`](https://mui.com/material-ui/api/snackbar-content/) element.
|
||||
* @deprecated Use `slotProps.content` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
ContentProps?: Partial<SnackbarContentProps>;
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
* @default false
|
||||
*/
|
||||
disableWindowBlurListener?: boolean;
|
||||
/**
|
||||
* When displaying multiple consecutive snackbars using a single parent-rendered
|
||||
* `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
|
||||
* For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
|
||||
* in place, and features like `autoHideDuration` could be affected.
|
||||
*/
|
||||
key?: any;
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message?: SnackbarContentProps['message'];
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Typically `onClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
||||
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
||||
*/
|
||||
onClose?: (event: React.SyntheticEvent<any> | Event, reason: SnackbarCloseReason) => void;
|
||||
/**
|
||||
* If `true`, the component is shown.
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` prop isn't specified, it does nothing.
|
||||
* If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration?: number;
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx?: SxProps<Theme>;
|
||||
/**
|
||||
* The component used for the transition.
|
||||
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
||||
* @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
* @default Grow
|
||||
*/
|
||||
TransitionComponent?: React.JSXElementConstructor<TransitionProps & {
|
||||
children: React.ReactElement<unknown, any>;
|
||||
}>;
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
* @default {
|
||||
* enter: theme.transitions.duration.enteringScreen,
|
||||
* exit: theme.transitions.duration.leavingScreen,
|
||||
* }
|
||||
*/
|
||||
transitionDuration?: TransitionProps['timeout'];
|
||||
/**
|
||||
* Props applied to the transition element.
|
||||
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
||||
* @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
* @default {}
|
||||
*/
|
||||
TransitionProps?: TransitionProps;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Snackbar](https://mui.com/material-ui/react-snackbar/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [Snackbar API](https://mui.com/material-ui/api/snackbar/)
|
||||
*/
|
||||
export default function Snackbar(props: SnackbarProps): React.JSX.Element;
|
||||
export interface SnackbarOwnerState extends Omit<SnackbarProps, 'slots' | 'slotProps'> {}
|
||||
431
node_modules/@mui/material/Snackbar/Snackbar.js
generated
vendored
Normal file
431
node_modules/@mui/material/Snackbar/Snackbar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,431 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _useSnackbar = _interopRequireDefault(require("./useSnackbar"));
|
||||
var _ClickAwayListener = _interopRequireDefault(require("../ClickAwayListener"));
|
||||
var _zeroStyled = require("../zero-styled");
|
||||
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
||||
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
||||
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
||||
var _Grow = _interopRequireDefault(require("../Grow"));
|
||||
var _SnackbarContent = _interopRequireDefault(require("../SnackbarContent"));
|
||||
var _snackbarClasses = require("./snackbarClasses");
|
||||
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const useUtilityClasses = ownerState => {
|
||||
const {
|
||||
classes,
|
||||
anchorOrigin
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', `anchorOrigin${(0, _capitalize.default)(anchorOrigin.vertical)}${(0, _capitalize.default)(anchorOrigin.horizontal)}`]
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _snackbarClasses.getSnackbarUtilityClass, classes);
|
||||
};
|
||||
const SnackbarRoot = (0, _zeroStyled.styled)('div', {
|
||||
name: 'MuiSnackbar',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => {
|
||||
const {
|
||||
ownerState
|
||||
} = props;
|
||||
return [styles.root, styles[`anchorOrigin${(0, _capitalize.default)(ownerState.anchorOrigin.vertical)}${(0, _capitalize.default)(ownerState.anchorOrigin.horizontal)}`]];
|
||||
}
|
||||
})((0, _memoTheme.default)(({
|
||||
theme
|
||||
}) => ({
|
||||
zIndex: (theme.vars || theme).zIndex.snackbar,
|
||||
position: 'fixed',
|
||||
display: 'flex',
|
||||
left: 8,
|
||||
right: 8,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
variants: [{
|
||||
props: ({
|
||||
ownerState
|
||||
}) => ownerState.anchorOrigin.vertical === 'top',
|
||||
style: {
|
||||
top: 8,
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
top: 24
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: ({
|
||||
ownerState
|
||||
}) => ownerState.anchorOrigin.vertical !== 'top',
|
||||
style: {
|
||||
bottom: 8,
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
bottom: 24
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: ({
|
||||
ownerState
|
||||
}) => ownerState.anchorOrigin.horizontal === 'left',
|
||||
style: {
|
||||
justifyContent: 'flex-start',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
left: 24,
|
||||
right: 'auto'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: ({
|
||||
ownerState
|
||||
}) => ownerState.anchorOrigin.horizontal === 'right',
|
||||
style: {
|
||||
justifyContent: 'flex-end',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
right: 24,
|
||||
left: 'auto'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: ({
|
||||
ownerState
|
||||
}) => ownerState.anchorOrigin.horizontal === 'center',
|
||||
style: {
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
left: '50%',
|
||||
right: 'auto',
|
||||
transform: 'translateX(-50%)'
|
||||
}
|
||||
}
|
||||
}]
|
||||
})));
|
||||
const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
||||
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
||||
props: inProps,
|
||||
name: 'MuiSnackbar'
|
||||
});
|
||||
const theme = (0, _zeroStyled.useTheme)();
|
||||
const defaultTransitionDuration = {
|
||||
enter: theme.transitions.duration.enteringScreen,
|
||||
exit: theme.transitions.duration.leavingScreen
|
||||
};
|
||||
const {
|
||||
action,
|
||||
anchorOrigin: {
|
||||
vertical,
|
||||
horizontal
|
||||
} = {
|
||||
vertical: 'bottom',
|
||||
horizontal: 'left'
|
||||
},
|
||||
autoHideDuration = null,
|
||||
children,
|
||||
className,
|
||||
ClickAwayListenerProps: ClickAwayListenerPropsProp,
|
||||
ContentProps: ContentPropsProp,
|
||||
disableWindowBlurListener = false,
|
||||
message,
|
||||
onBlur,
|
||||
onClose,
|
||||
onFocus,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
open,
|
||||
resumeHideDuration,
|
||||
slots = {},
|
||||
slotProps = {},
|
||||
TransitionComponent: TransitionComponentProp,
|
||||
transitionDuration = defaultTransitionDuration,
|
||||
TransitionProps: {
|
||||
onEnter,
|
||||
onExited,
|
||||
...TransitionPropsProp
|
||||
} = {},
|
||||
...other
|
||||
} = props;
|
||||
const ownerState = {
|
||||
...props,
|
||||
anchorOrigin: {
|
||||
vertical,
|
||||
horizontal
|
||||
},
|
||||
autoHideDuration,
|
||||
disableWindowBlurListener,
|
||||
TransitionComponent: TransitionComponentProp,
|
||||
transitionDuration
|
||||
};
|
||||
const classes = useUtilityClasses(ownerState);
|
||||
const {
|
||||
getRootProps,
|
||||
onClickAway
|
||||
} = (0, _useSnackbar.default)({
|
||||
...ownerState
|
||||
});
|
||||
const [exited, setExited] = React.useState(true);
|
||||
const handleExited = node => {
|
||||
setExited(true);
|
||||
if (onExited) {
|
||||
onExited(node);
|
||||
}
|
||||
};
|
||||
const handleEnter = (node, isAppearing) => {
|
||||
setExited(false);
|
||||
if (onEnter) {
|
||||
onEnter(node, isAppearing);
|
||||
}
|
||||
};
|
||||
const externalForwardedProps = {
|
||||
slots: {
|
||||
transition: TransitionComponentProp,
|
||||
...slots
|
||||
},
|
||||
slotProps: {
|
||||
content: ContentPropsProp,
|
||||
clickAwayListener: ClickAwayListenerPropsProp,
|
||||
transition: TransitionPropsProp,
|
||||
...slotProps
|
||||
}
|
||||
};
|
||||
const [Root, rootProps] = (0, _useSlot.default)('root', {
|
||||
ref,
|
||||
className: [classes.root, className],
|
||||
elementType: SnackbarRoot,
|
||||
getSlotProps: getRootProps,
|
||||
externalForwardedProps: {
|
||||
...externalForwardedProps,
|
||||
...other
|
||||
},
|
||||
ownerState
|
||||
});
|
||||
const [ClickAwaySlot, {
|
||||
ownerState: clickAwayOwnerStateProp,
|
||||
...clickAwayListenerProps
|
||||
}] = (0, _useSlot.default)('clickAwayListener', {
|
||||
elementType: _ClickAwayListener.default,
|
||||
externalForwardedProps,
|
||||
getSlotProps: handlers => ({
|
||||
onClickAway: (...params) => {
|
||||
const event = params[0];
|
||||
handlers.onClickAway?.(...params);
|
||||
if (event?.defaultMuiPrevented) {
|
||||
return;
|
||||
}
|
||||
onClickAway(...params);
|
||||
}
|
||||
}),
|
||||
ownerState
|
||||
});
|
||||
const [ContentSlot, contentSlotProps] = (0, _useSlot.default)('content', {
|
||||
elementType: _SnackbarContent.default,
|
||||
shouldForwardComponentProp: true,
|
||||
externalForwardedProps,
|
||||
additionalProps: {
|
||||
message,
|
||||
action
|
||||
},
|
||||
ownerState
|
||||
});
|
||||
const [TransitionSlot, transitionProps] = (0, _useSlot.default)('transition', {
|
||||
elementType: _Grow.default,
|
||||
externalForwardedProps,
|
||||
getSlotProps: handlers => ({
|
||||
onEnter: (...params) => {
|
||||
handlers.onEnter?.(...params);
|
||||
handleEnter(...params);
|
||||
},
|
||||
onExited: (...params) => {
|
||||
handlers.onExited?.(...params);
|
||||
handleExited(...params);
|
||||
}
|
||||
}),
|
||||
additionalProps: {
|
||||
appear: true,
|
||||
in: open,
|
||||
timeout: transitionDuration,
|
||||
direction: vertical === 'top' ? 'down' : 'up'
|
||||
},
|
||||
ownerState
|
||||
});
|
||||
|
||||
// So we only render active snackbars.
|
||||
if (!open && exited) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ClickAwaySlot, {
|
||||
...clickAwayListenerProps,
|
||||
...(slots.clickAwayListener && {
|
||||
ownerState: clickAwayOwnerStateProp
|
||||
}),
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
|
||||
...rootProps,
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionSlot, {
|
||||
...transitionProps,
|
||||
children: children || /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentSlot, {
|
||||
...contentSlotProps
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The action to display. It renders after the message, at the end of the snackbar.
|
||||
*/
|
||||
action: _propTypes.default.node,
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
* On smaller screens, the component grows to occupy all the available width,
|
||||
* the horizontal alignment is ignored.
|
||||
* @default { vertical: 'bottom', horizontal: 'left' }
|
||||
*/
|
||||
anchorOrigin: _propTypes.default.shape({
|
||||
horizontal: _propTypes.default.oneOf(['center', 'left', 'right']).isRequired,
|
||||
vertical: _propTypes.default.oneOf(['bottom', 'top']).isRequired
|
||||
}),
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically calling the
|
||||
* `onClose` function. `onClose` should then set the state of the `open`
|
||||
* prop to hide the Snackbar. This behavior is disabled by default with
|
||||
* the `null` value.
|
||||
* @default null
|
||||
*/
|
||||
autoHideDuration: _propTypes.default.number,
|
||||
/**
|
||||
* Replace the `SnackbarContent` component.
|
||||
*/
|
||||
children: _propTypes.default.element,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* Props applied to the `ClickAwayListener` element.
|
||||
* @deprecated Use `slotProps.clickAwayListener` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
ClickAwayListenerProps: _propTypes.default.object,
|
||||
/**
|
||||
* Props applied to the [`SnackbarContent`](https://mui.com/material-ui/api/snackbar-content/) element.
|
||||
* @deprecated Use `slotProps.content` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
ContentProps: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
* @default false
|
||||
*/
|
||||
disableWindowBlurListener: _propTypes.default.bool,
|
||||
/**
|
||||
* When displaying multiple consecutive snackbars using a single parent-rendered
|
||||
* `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
|
||||
* For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
|
||||
* in place, and features like `autoHideDuration` could be affected.
|
||||
*/
|
||||
key: () => null,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: _propTypes.default.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onBlur: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Typically `onClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
||||
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onFocus: _propTypes.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseEnter: _propTypes.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseLeave: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, the component is shown.
|
||||
*/
|
||||
open: _propTypes.default.bool,
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` prop isn't specified, it does nothing.
|
||||
* If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration: _propTypes.default.number,
|
||||
/**
|
||||
* The props used for each slot inside.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default /* @typescript-to-proptypes-ignore */.shape({
|
||||
clickAwayListener: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
||||
content: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
||||
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
||||
transition: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.shape({
|
||||
clickAwayListener: _propTypes.default.elementType,
|
||||
content: _propTypes.default.elementType,
|
||||
root: _propTypes.default.elementType,
|
||||
transition: _propTypes.default.elementType
|
||||
}),
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* The component used for the transition.
|
||||
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
||||
* @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
* @default Grow
|
||||
*/
|
||||
TransitionComponent: _propTypes.default.elementType,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
* @default {
|
||||
* enter: theme.transitions.duration.enteringScreen,
|
||||
* exit: theme.transitions.duration.leavingScreen,
|
||||
* }
|
||||
*/
|
||||
transitionDuration: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
||||
appear: _propTypes.default.number,
|
||||
enter: _propTypes.default.number,
|
||||
exit: _propTypes.default.number
|
||||
})]),
|
||||
/**
|
||||
* Props applied to the transition element.
|
||||
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
||||
* @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
* @default {}
|
||||
*/
|
||||
TransitionProps: _propTypes.default.object
|
||||
} : void 0;
|
||||
var _default = exports.default = Snackbar;
|
||||
4
node_modules/@mui/material/Snackbar/index.d.ts
generated
vendored
Normal file
4
node_modules/@mui/material/Snackbar/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export { default } from "./Snackbar.js";
|
||||
export * from "./Snackbar.js";
|
||||
export { default as snackbarClasses } from "./snackbarClasses.js";
|
||||
export * from "./snackbarClasses.js";
|
||||
35
node_modules/@mui/material/Snackbar/index.js
generated
vendored
Normal file
35
node_modules/@mui/material/Snackbar/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
snackbarClasses: true
|
||||
};
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Snackbar.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "snackbarClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _snackbarClasses.default;
|
||||
}
|
||||
});
|
||||
var _Snackbar = _interopRequireDefault(require("./Snackbar"));
|
||||
var _snackbarClasses = _interopRequireWildcard(require("./snackbarClasses"));
|
||||
Object.keys(_snackbarClasses).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _snackbarClasses[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _snackbarClasses[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
20
node_modules/@mui/material/Snackbar/snackbarClasses.d.ts
generated
vendored
Normal file
20
node_modules/@mui/material/Snackbar/snackbarClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export interface SnackbarClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */
|
||||
anchorOriginTopCenter: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */
|
||||
anchorOriginBottomCenter: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */
|
||||
anchorOriginTopRight: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */
|
||||
anchorOriginBottomRight: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */
|
||||
anchorOriginTopLeft: string;
|
||||
/** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */
|
||||
anchorOriginBottomLeft: string;
|
||||
}
|
||||
export type SnackbarClassKey = keyof SnackbarClasses;
|
||||
export declare function getSnackbarUtilityClass(slot: string): string;
|
||||
declare const snackbarClasses: SnackbarClasses;
|
||||
export default snackbarClasses;
|
||||
15
node_modules/@mui/material/Snackbar/snackbarClasses.js
generated
vendored
Normal file
15
node_modules/@mui/material/Snackbar/snackbarClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports.getSnackbarUtilityClass = getSnackbarUtilityClass;
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
function getSnackbarUtilityClass(slot) {
|
||||
return (0, _generateUtilityClass.default)('MuiSnackbar', slot);
|
||||
}
|
||||
const snackbarClasses = (0, _generateUtilityClasses.default)('MuiSnackbar', ['root', 'anchorOriginTopCenter', 'anchorOriginBottomCenter', 'anchorOriginTopRight', 'anchorOriginBottomRight', 'anchorOriginTopLeft', 'anchorOriginBottomLeft']);
|
||||
var _default = exports.default = snackbarClasses;
|
||||
3
node_modules/@mui/material/Snackbar/useSnackbar.d.ts
generated
vendored
Normal file
3
node_modules/@mui/material/Snackbar/useSnackbar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { UseSnackbarParameters, UseSnackbarReturnValue } from "./useSnackbar.types.js";
|
||||
declare function useSnackbar(parameters?: UseSnackbarParameters): UseSnackbarReturnValue;
|
||||
export default useSnackbar;
|
||||
130
node_modules/@mui/material/Snackbar/useSnackbar.js
generated
vendored
Normal file
130
node_modules/@mui/material/Snackbar/useSnackbar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
||||
var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
|
||||
var _extractEventHandlers = _interopRequireDefault(require("@mui/utils/extractEventHandlers"));
|
||||
function useSnackbar(parameters = {}) {
|
||||
const {
|
||||
autoHideDuration = null,
|
||||
disableWindowBlurListener = false,
|
||||
onClose,
|
||||
open,
|
||||
resumeHideDuration
|
||||
} = parameters;
|
||||
const timerAutoHide = (0, _useTimeout.default)();
|
||||
React.useEffect(() => {
|
||||
if (!open) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {KeyboardEvent} nativeEvent
|
||||
*/
|
||||
function handleKeyDown(nativeEvent) {
|
||||
if (!nativeEvent.defaultPrevented) {
|
||||
if (nativeEvent.key === 'Escape') {
|
||||
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
||||
onClose?.(nativeEvent, 'escapeKeyDown');
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
return () => {
|
||||
document.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, [open, onClose]);
|
||||
const handleClose = (0, _useEventCallback.default)((event, reason) => {
|
||||
onClose?.(event, reason);
|
||||
});
|
||||
const setAutoHideTimer = (0, _useEventCallback.default)(autoHideDurationParam => {
|
||||
if (!onClose || autoHideDurationParam == null) {
|
||||
return;
|
||||
}
|
||||
timerAutoHide.start(autoHideDurationParam, () => {
|
||||
handleClose(null, 'timeout');
|
||||
});
|
||||
});
|
||||
React.useEffect(() => {
|
||||
if (open) {
|
||||
setAutoHideTimer(autoHideDuration);
|
||||
}
|
||||
return timerAutoHide.clear;
|
||||
}, [open, autoHideDuration, setAutoHideTimer, timerAutoHide]);
|
||||
const handleClickAway = event => {
|
||||
onClose?.(event, 'clickaway');
|
||||
};
|
||||
|
||||
// Pause the timer when the user is interacting with the Snackbar
|
||||
// or when the user hide the window.
|
||||
const handlePause = timerAutoHide.clear;
|
||||
|
||||
// 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 createHandleBlur = otherHandlers => event => {
|
||||
const onBlurCallback = otherHandlers.onBlur;
|
||||
onBlurCallback?.(event);
|
||||
handleResume();
|
||||
};
|
||||
const createHandleFocus = otherHandlers => event => {
|
||||
const onFocusCallback = otherHandlers.onFocus;
|
||||
onFocusCallback?.(event);
|
||||
handlePause();
|
||||
};
|
||||
const createMouseEnter = otherHandlers => event => {
|
||||
const onMouseEnterCallback = otherHandlers.onMouseEnter;
|
||||
onMouseEnterCallback?.(event);
|
||||
handlePause();
|
||||
};
|
||||
const createMouseLeave = otherHandlers => event => {
|
||||
const onMouseLeaveCallback = otherHandlers.onMouseLeave;
|
||||
onMouseLeaveCallback?.(event);
|
||||
handleResume();
|
||||
};
|
||||
React.useEffect(() => {
|
||||
// TODO: window global should be refactored here
|
||||
if (!disableWindowBlurListener && open) {
|
||||
window.addEventListener('focus', handleResume);
|
||||
window.addEventListener('blur', handlePause);
|
||||
return () => {
|
||||
window.removeEventListener('focus', handleResume);
|
||||
window.removeEventListener('blur', handlePause);
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}, [disableWindowBlurListener, open, handleResume, handlePause]);
|
||||
const getRootProps = (externalProps = {}) => {
|
||||
const externalEventHandlers = {
|
||||
...(0, _extractEventHandlers.default)(parameters),
|
||||
...(0, _extractEventHandlers.default)(externalProps)
|
||||
};
|
||||
return {
|
||||
// ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
|
||||
// See https://github.com/mui/material-ui/issues/29080
|
||||
role: 'presentation',
|
||||
...externalProps,
|
||||
...externalEventHandlers,
|
||||
onBlur: createHandleBlur(externalEventHandlers),
|
||||
onFocus: createHandleFocus(externalEventHandlers),
|
||||
onMouseEnter: createMouseEnter(externalEventHandlers),
|
||||
onMouseLeave: createMouseLeave(externalEventHandlers)
|
||||
};
|
||||
};
|
||||
return {
|
||||
getRootProps,
|
||||
onClickAway: handleClickAway
|
||||
};
|
||||
}
|
||||
var _default = exports.default = useSnackbar;
|
||||
59
node_modules/@mui/material/Snackbar/useSnackbar.types.d.ts
generated
vendored
Normal file
59
node_modules/@mui/material/Snackbar/useSnackbar.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
export type SnackbarCloseReason = 'timeout' | 'clickaway' | 'escapeKeyDown';
|
||||
export interface UseSnackbarParameters {
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically calling the
|
||||
* `onClose` function. `onClose` should then set the state of the `open`
|
||||
* prop to hide the Snackbar. This behavior is disabled by default with
|
||||
* the `null` value.
|
||||
* @default null
|
||||
*/
|
||||
autoHideDuration?: number | null;
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
* @default false
|
||||
*/
|
||||
disableWindowBlurListener?: boolean;
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Typically `onClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
||||
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
||||
*/
|
||||
onClose?: (event: React.SyntheticEvent<any> | Event | null, reason: SnackbarCloseReason) => void;
|
||||
/**
|
||||
* If `true`, the component is shown.
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` prop isn't specified, it does nothing.
|
||||
* If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration?: number;
|
||||
}
|
||||
export type UseSnackbarRootSlotProps<ExternalProps = {}> = ExternalProps & UseSnackbarRootSlotOwnProps;
|
||||
export interface UseSnackbarRootSlotOwnProps {
|
||||
onBlur: React.FocusEventHandler;
|
||||
onFocus: React.FocusEventHandler;
|
||||
onMouseEnter: React.MouseEventHandler;
|
||||
onMouseLeave: React.MouseEventHandler;
|
||||
ref?: React.RefCallback<Element>;
|
||||
role: React.AriaRole;
|
||||
}
|
||||
export interface UseSnackbarReturnValue {
|
||||
/**
|
||||
* Resolver for the root slot's props.
|
||||
* @param externalProps props for the root slot
|
||||
* @returns props that should be spread on the root slot
|
||||
*/
|
||||
getRootProps: <ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseSnackbarRootSlotProps<ExternalProps>;
|
||||
/**
|
||||
* Callback fired when a "click away" event is detected.
|
||||
*/
|
||||
onClickAway: (event: React.SyntheticEvent<any> | Event) => void;
|
||||
}
|
||||
5
node_modules/@mui/material/Snackbar/useSnackbar.types.js
generated
vendored
Normal file
5
node_modules/@mui/material/Snackbar/useSnackbar.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue