pre-installations and preparations
This commit is contained in:
1 parent
3e5a0329cb
commit
201d621ac3
6977 files changed
+742826
No files matched your search
+171
@@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Snackbar = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _ClickAwayListener = require("../ClickAwayListener");
|
||||
var _composeClasses = require("../composeClasses");
|
||||
var _snackbarClasses = require("./snackbarClasses");
|
||||
var _useSnackbar = require("../useSnackbar");
|
||||
var _utils = require("../utils");
|
||||
var _ClassNameConfigurator = require("../utils/ClassNameConfigurator");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["autoHideDuration", "children", "disableWindowBlurListener", "exited", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "slotProps", "slots"];
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
const useUtilityClasses = () => {
|
||||
const slots = {
|
||||
root: ['root']
|
||||
};
|
||||
return (0, _composeClasses.unstable_composeClasses)(slots, (0, _ClassNameConfigurator.useClassNamesOverride)(_snackbarClasses.getSnackbarUtilityClass));
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Snackbar](https://mui.com/base-ui/react-snackbar/)
|
||||
* - [Snackbar](https://mui.com/joy-ui/react-snackbar/)
|
||||
* - [Snackbar](https://mui.com/material-ui/react-snackbar/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [Snackbar API](https://mui.com/base-ui/react-snackbar/components-api/#snackbar)
|
||||
*/
|
||||
const Snackbar = exports.Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(props, forwardedRef) {
|
||||
const {
|
||||
autoHideDuration = null,
|
||||
children,
|
||||
disableWindowBlurListener = false,
|
||||
exited = true,
|
||||
onClose,
|
||||
open,
|
||||
resumeHideDuration,
|
||||
slotProps = {},
|
||||
slots = {}
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
const classes = useUtilityClasses();
|
||||
const {
|
||||
getRootProps,
|
||||
onClickAway
|
||||
} = (0, _useSnackbar.useSnackbar)((0, _extends2.default)({}, props, {
|
||||
autoHideDuration,
|
||||
disableWindowBlurListener,
|
||||
onClose,
|
||||
open,
|
||||
resumeHideDuration
|
||||
}));
|
||||
const ownerState = props;
|
||||
const Root = slots.root || 'div';
|
||||
const rootProps = (0, _utils.useSlotProps)({
|
||||
elementType: Root,
|
||||
getSlotProps: getRootProps,
|
||||
externalForwardedProps: other,
|
||||
externalSlotProps: slotProps.root,
|
||||
additionalProps: {
|
||||
ref: forwardedRef
|
||||
},
|
||||
ownerState,
|
||||
className: classes.root
|
||||
});
|
||||
const clickAwayListenerProps = (0, _utils.useSlotProps)({
|
||||
elementType: _ClickAwayListener.ClickAwayListener,
|
||||
externalSlotProps: slotProps.clickAwayListener,
|
||||
additionalProps: {
|
||||
onClickAway
|
||||
},
|
||||
ownerState
|
||||
});
|
||||
|
||||
// ClickAwayListener doesn't support ownerState
|
||||
delete clickAwayListenerProps.ownerState;
|
||||
|
||||
// So that we only render active snackbars.
|
||||
if (!open && exited) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayListener.ClickAwayListener, (0, _extends2.default)({}, clickAwayListenerProps, {
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({}, rootProps, {
|
||||
children: children
|
||||
}))
|
||||
}));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: _propTypes.default.node,
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
* @default false
|
||||
*/
|
||||
disableWindowBlurListener: _propTypes.default.bool,
|
||||
/**
|
||||
* The prop used to handle exited transition and unmount the component.
|
||||
* @default true
|
||||
*/
|
||||
exited: _propTypes.default.bool,
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* 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 the Snackbar.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.shape({
|
||||
clickAwayListener: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
||||
children: _propTypes.default.element.isRequired,
|
||||
disableReactTree: _propTypes.default.bool,
|
||||
mouseEvent: _propTypes.default.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
|
||||
onClickAway: _propTypes.default.func,
|
||||
touchEvent: _propTypes.default.oneOf(['onTouchEnd', 'onTouchStart', false])
|
||||
})]),
|
||||
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside the Snackbar.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.shape({
|
||||
root: _propTypes.default.elementType
|
||||
})
|
||||
} : void 0;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
'use client';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
Snackbar: true
|
||||
};
|
||||
Object.defineProperty(exports, "Snackbar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Snackbar.Snackbar;
|
||||
}
|
||||
});
|
||||
var _Snackbar = require("./Snackbar");
|
||||
var _Snackbar2 = require("./Snackbar.types");
|
||||
Object.keys(_Snackbar2).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _Snackbar2[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Snackbar2[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _snackbarClasses = 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];
|
||||
}
|
||||
});
|
||||
});
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getSnackbarUtilityClass = getSnackbarUtilityClass;
|
||||
exports.snackbarClasses = void 0;
|
||||
var _generateUtilityClass = require("../generateUtilityClass");
|
||||
var _generateUtilityClasses = require("../generateUtilityClasses");
|
||||
const COMPONENT_NAME = 'Snackbar';
|
||||
function getSnackbarUtilityClass(slot) {
|
||||
return (0, _generateUtilityClass.generateUtilityClass)(COMPONENT_NAME, slot);
|
||||
}
|
||||
const snackbarClasses = exports.snackbarClasses = (0, _generateUtilityClasses.generateUtilityClasses)(COMPONENT_NAME, ['root']);
|
||||
Reference in new issue
Block a user