You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
9.1 KiB
JavaScript
215 lines
9.1 KiB
JavaScript
"use strict";
|
|
'use client';
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
var _Popper = require("@mui/base/Popper");
|
|
var _system = require("@mui/system");
|
|
var _utils = require("@mui/utils");
|
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
var React = _interopRequireWildcard(require("react"));
|
|
var _styles = require("../styles");
|
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
const _excluded = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
|
|
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 PopperRoot = (0, _styles.styled)(_Popper.Popper, {
|
|
name: 'MuiPopper',
|
|
slot: 'Root',
|
|
overridesResolver: (props, styles) => styles.root
|
|
})({});
|
|
|
|
/**
|
|
*
|
|
* Demos:
|
|
*
|
|
* - [Autocomplete](https://mui.com/material-ui/react-autocomplete/)
|
|
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
* - [Popper](https://mui.com/material-ui/react-popper/)
|
|
*
|
|
* API:
|
|
*
|
|
* - [Popper API](https://mui.com/material-ui/api/popper/)
|
|
*/
|
|
const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
|
|
var _slots$root;
|
|
const theme = (0, _system.useThemeWithoutDefault)();
|
|
const props = (0, _styles.useThemeProps)({
|
|
props: inProps,
|
|
name: 'MuiPopper'
|
|
});
|
|
const {
|
|
anchorEl,
|
|
component,
|
|
components,
|
|
componentsProps,
|
|
container,
|
|
disablePortal,
|
|
keepMounted,
|
|
modifiers,
|
|
open,
|
|
placement,
|
|
popperOptions,
|
|
popperRef,
|
|
transition,
|
|
slots,
|
|
slotProps
|
|
} = props,
|
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
const RootComponent = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components == null ? void 0 : components.Root;
|
|
const otherProps = (0, _extends2.default)({
|
|
anchorEl,
|
|
container,
|
|
disablePortal,
|
|
keepMounted,
|
|
modifiers,
|
|
open,
|
|
placement,
|
|
popperOptions,
|
|
popperRef,
|
|
transition
|
|
}, other);
|
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PopperRoot, (0, _extends2.default)({
|
|
as: component,
|
|
direction: theme == null ? void 0 : theme.direction,
|
|
slots: {
|
|
root: RootComponent
|
|
},
|
|
slotProps: slotProps != null ? slotProps : componentsProps
|
|
}, otherProps, {
|
|
ref: ref
|
|
}));
|
|
});
|
|
process.env.NODE_ENV !== "production" ? Popper.propTypes /* remove-proptypes */ = {
|
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
/**
|
|
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
* or a function that returns either.
|
|
* It's used to set the position of the popper.
|
|
* The return value will passed as the reference object of the Popper instance.
|
|
*/
|
|
anchorEl: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_utils.HTMLElementType, _propTypes.default.object, _propTypes.default.func]),
|
|
/**
|
|
* Popper render function or node.
|
|
*/
|
|
children: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
/**
|
|
* The component used for the root node.
|
|
* Either a string to use a HTML element or a component.
|
|
*/
|
|
component: _propTypes.default.elementType,
|
|
/**
|
|
* The components used for each slot inside the Popper.
|
|
* Either a string to use a HTML element or a component.
|
|
* @default {}
|
|
*/
|
|
components: _propTypes.default.shape({
|
|
Root: _propTypes.default.elementType
|
|
}),
|
|
/**
|
|
* The props used for each slot inside the Popper.
|
|
* @default {}
|
|
*/
|
|
componentsProps: _propTypes.default.shape({
|
|
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
}),
|
|
/**
|
|
* An HTML element or function that returns one.
|
|
* The `container` will have the portal children appended to it.
|
|
*
|
|
* You can also provide a callback, which is called in a React layout effect.
|
|
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
*
|
|
* By default, it uses the body of the top-level document object,
|
|
* so it's simply `document.body` most of the time.
|
|
*/
|
|
container: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_utils.HTMLElementType, _propTypes.default.func]),
|
|
/**
|
|
* The `children` will be under the DOM hierarchy of the parent component.
|
|
* @default false
|
|
*/
|
|
disablePortal: _propTypes.default.bool,
|
|
/**
|
|
* Always keep the children in the DOM.
|
|
* This prop can be useful in SEO situation or
|
|
* when you want to maximize the responsiveness of the Popper.
|
|
* @default false
|
|
*/
|
|
keepMounted: _propTypes.default.bool,
|
|
/**
|
|
* Popper.js is based on a "plugin-like" architecture,
|
|
* most of its features are fully encapsulated "modifiers".
|
|
*
|
|
* A modifier is a function that is called each time Popper.js needs to
|
|
* compute the position of the popper.
|
|
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
*/
|
|
modifiers: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
data: _propTypes.default.object,
|
|
effect: _propTypes.default.func,
|
|
enabled: _propTypes.default.bool,
|
|
fn: _propTypes.default.func,
|
|
name: _propTypes.default.any,
|
|
options: _propTypes.default.object,
|
|
phase: _propTypes.default.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
requires: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
requiresIfExists: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
})),
|
|
/**
|
|
* If `true`, the component is shown.
|
|
*/
|
|
open: _propTypes.default.bool.isRequired,
|
|
/**
|
|
* Popper placement.
|
|
* @default 'bottom'
|
|
*/
|
|
placement: _propTypes.default.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
/**
|
|
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
* @default {}
|
|
*/
|
|
popperOptions: _propTypes.default.shape({
|
|
modifiers: _propTypes.default.array,
|
|
onFirstUpdate: _propTypes.default.func,
|
|
placement: _propTypes.default.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
strategy: _propTypes.default.oneOf(['absolute', 'fixed'])
|
|
}),
|
|
/**
|
|
* A ref that points to the used popper instance.
|
|
*/
|
|
popperRef: _utils.refType,
|
|
/**
|
|
* The props used for each slot inside the Popper.
|
|
* @default {}
|
|
*/
|
|
slotProps: _propTypes.default.shape({
|
|
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
}),
|
|
/**
|
|
* The components used for each slot inside the Popper.
|
|
* Either a string to use a HTML element or a component.
|
|
* @default {}
|
|
*/
|
|
slots: _propTypes.default.shape({
|
|
root: _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]),
|
|
/**
|
|
* Help supporting a react-transition-group/Transition component.
|
|
* @default false
|
|
*/
|
|
transition: _propTypes.default.bool
|
|
} : void 0;
|
|
var _default = exports.default = Popper; |