UNPKG

@bemit/consent-ui-mui

Version:

104 lines (103 loc) 5.25 kB
"use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.dialogPositions = exports.ConsentUiBoxDialog = void 0; var _react = _interopRequireDefault(require("react")); var _Dialog = _interopRequireDefault(require("@mui/material/Dialog")); var _ConsentUiBox = require("@bemit/consent-ui-mui/ConsentUiBox"); var _jsxRuntime = require("react/jsx-runtime"); var _excluded = ["open", "fullWidth", "minWidth", "borderRadius", "maxHeight", "maxWidth", "variant", "maxWidthDetails", "fullWidthDetails", "dialogPosition", "showDetails", "setShowDetails", "e2e"]; function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } var dialogPositions = exports.dialogPositions = { center: { alignItems: 'center', justifyContent: 'center' }, top: { alignItems: 'flex-start', justifyContent: 'center' }, bottom: { alignItems: 'flex-end', justifyContent: 'center' }, bottomLeft: { alignItems: 'flex-end', justifyContent: 'flex-start' }, bottomRight: { alignItems: 'flex-end', justifyContent: 'flex-end' }, topLeft: { alignItems: 'flex-start', justifyContent: 'flex-start' }, topRight: { alignItems: 'flex-start', justifyContent: 'flex-end' }, centerLeft: { alignItems: 'center', justifyContent: 'flex-start' }, centerRight: { alignItems: 'center', justifyContent: 'flex-end' } }; var ConsentUiBoxDialog = exports.ConsentUiBoxDialog = function ConsentUiBoxDialog(_ref) { var open = _ref.open, fullWidth = _ref.fullWidth, _ref$minWidth = _ref.minWidth, minWidth = _ref$minWidth === void 0 ? 280 : _ref$minWidth, _ref$borderRadius = _ref.borderRadius, borderRadius = _ref$borderRadius === void 0 ? 6 : _ref$borderRadius, _ref$maxHeight = _ref.maxHeight, maxHeight = _ref$maxHeight === void 0 ? '92vh' : _ref$maxHeight, maxWidth = _ref.maxWidth, variant = _ref.variant, maxWidthDetails = _ref.maxWidthDetails, fullWidthDetails = _ref.fullWidthDetails, dialogPosition = _ref.dialogPosition, showDetails = _ref.showDetails, setShowDetails = _ref.setShowDetails, e2e = _ref.e2e, props = _objectWithoutProperties(_ref, _excluded); return (0, _jsxRuntime.jsx)(_Dialog["default"], { open: open, maxWidth: showDetails && typeof maxWidthDetails !== 'undefined' ? maxWidthDetails : maxWidth, fullWidth: showDetails && typeof fullWidthDetails !== 'undefined' ? fullWidthDetails : fullWidth, TransitionProps: { unmountOnExit: true, style: _objectSpread({ minWidth: minWidth }, dialogPosition || {}) }, "data-e2e-cc": e2e ? 'cc-dialog' : undefined, PaperProps: { variant: variant, style: { borderRadius: borderRadius, display: 'flex', flexDirection: 'column', overflow: 'auto', maxHeight: maxHeight } }, children: (0, _jsxRuntime.jsx)(_ConsentUiBox.ConsentUiBox, _objectSpread({ showDetails: showDetails, setShowDetails: setShowDetails, e2e: e2e }, props)) }); };