UNPKG

@bemit/consent-ui-formanta

Version:

© 2022 [bemit](https://bemit.eu)

97 lines (96 loc) 5.27 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 _ConsentUiBox = require("@bemit/consent-ui-formanta/ConsentUiBox"); var _jsxRuntime = require("react/jsx-runtime"); var _excluded = ["borderRadius", "maxHeight", "e2e", "slots"]; 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 s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(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 (e.includes(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 joinClassName = function joinClassName(baseClass, extraClass) { return baseClass + (extraClass ? ' ' + extraClass : ''); }; var ConsentUiBoxDialog = exports.ConsentUiBoxDialog = function ConsentUiBoxDialog(_ref) { var _ref$borderRadius = _ref.borderRadius, borderRadius = _ref$borderRadius === void 0 ? 6 : _ref$borderRadius, _ref$maxHeight = _ref.maxHeight, maxHeight = _ref$maxHeight === void 0 ? '92vh' : _ref$maxHeight, e2e = _ref.e2e, _ref$slots = _ref.slots, _ref$slots2 = _ref$slots === void 0 ? {} : _ref$slots, mask = _ref$slots2.mask, modal = _ref$slots2.modal, body = _ref$slots2.body, props = _objectWithoutProperties(_ref, _excluded); return (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, mask || {}), {}, { className: joinClassName('modal-mask', mask === null || mask === void 0 ? void 0 : mask.className), children: (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, modal || {}), {}, { className: joinClassName('modal', modal === null || modal === void 0 ? void 0 : modal.className), style: _objectSpread({ padding: 12 }, (modal === null || modal === void 0 ? void 0 : modal.style) || {}), children: (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, body || {}), {}, { "data-e2e-cc": e2e ? 'cc-dialog' : undefined, className: joinClassName('modal-body', body === null || body === void 0 ? void 0 : body.className), style: _objectSpread({ borderRadius: borderRadius, display: 'flex', flexDirection: 'column', overflow: 'auto', maxHeight: maxHeight, padding: 0 }, (body === null || body === void 0 ? void 0 : body.style) || {}), children: (0, _jsxRuntime.jsx)(_ConsentUiBox.ConsentUiBox, _objectSpread({ e2e: e2e }, props)) })) })) })); };