@crystaldesign/diva-core 25.1.0-beta.38 → 25.1.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/{ModalsWrapper-cf28ae9c.js → ModalsWrapper-ae3b5a84.js} +27 -26
- package/build/esm/{index-539f9099.js → index-54e98e1b.js} +4 -4
- package/build/esm/{index-906407dd.js → index-88a09227.js} +1 -1
- package/build/esm/index.js +1 -1
- package/build/types/core/src/elements/Modal/index.d.ts.map +1 -1
- package/build/umd/969.diva-core.umd.min.js +1 -1
- package/build/umd/diva-core.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as styleInject, u as useDivaCoreContext } from './index-
|
|
1
|
+
import { i as styleInject, u as useDivaCoreContext } from './index-54e98e1b.js';
|
|
2
2
|
import { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import Button from '@mui/material/Button';
|
|
@@ -12,6 +12,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
12
12
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
13
13
|
import { IconButton } from '@mui/material';
|
|
14
14
|
import CloseIcon from '@mui/icons-material/Close';
|
|
15
|
+
import { toJS } from 'mobx';
|
|
15
16
|
import '@babel/runtime/helpers/classCallCheck';
|
|
16
17
|
import '@babel/runtime/helpers/createClass';
|
|
17
18
|
import '@babel/runtime/helpers/defineProperty';
|
|
@@ -25,7 +26,6 @@ import 'react-dom';
|
|
|
25
26
|
import '@babel/runtime/helpers/asyncToGenerator';
|
|
26
27
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
27
28
|
import '@babel/runtime/regenerator';
|
|
28
|
-
import 'mobx';
|
|
29
29
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
30
30
|
import 'mobile-detect';
|
|
31
31
|
import 'platform';
|
|
@@ -89,7 +89,7 @@ var Progress = function Progress(_ref) {
|
|
|
89
89
|
var Progress$1 = observer(Progress);
|
|
90
90
|
|
|
91
91
|
function Modal() {
|
|
92
|
-
var
|
|
92
|
+
var _pureModal$actions;
|
|
93
93
|
var _useDivaCoreContext = useDivaCoreContext(),
|
|
94
94
|
contentStore = _useDivaCoreContext.contentStore;
|
|
95
95
|
var _useTranslation = useTranslation(),
|
|
@@ -152,46 +152,47 @@ function Modal() {
|
|
|
152
152
|
}
|
|
153
153
|
}, []);
|
|
154
154
|
if (!contentStore.modal) return /*#__PURE__*/jsx(Fragment, {});
|
|
155
|
-
var
|
|
155
|
+
var pureModal = toJS(contentStore.modal);
|
|
156
|
+
var text = typeof pureModal.text == 'string' ? t(pureModal.text) : pureModal.text;
|
|
156
157
|
var children = /*#__PURE__*/jsxs(Fragment, {
|
|
157
158
|
children: [/*#__PURE__*/jsx(DialogContent, {
|
|
158
|
-
style:
|
|
159
|
-
maxWidth:
|
|
159
|
+
style: pureModal.maxWidth ? {
|
|
160
|
+
maxWidth: pureModal.maxWidth
|
|
160
161
|
} : undefined,
|
|
161
|
-
children:
|
|
162
|
-
link:
|
|
163
|
-
}) : typeof text == 'string' &&
|
|
162
|
+
children: pureModal.iFrame ? /*#__PURE__*/jsx(IFrame, {
|
|
163
|
+
link: pureModal.iFrame
|
|
164
|
+
}) : typeof text == 'string' && pureModal.content == undefined ? /*#__PURE__*/jsx(DialogContentText, {
|
|
164
165
|
component: "div",
|
|
165
166
|
dangerouslySetInnerHTML: {
|
|
166
167
|
__html: tryDecodeURIComponent(text)
|
|
167
168
|
}
|
|
168
169
|
}) : /*#__PURE__*/jsxs(DialogContentText, {
|
|
169
170
|
component: "div",
|
|
170
|
-
children: [text,
|
|
171
|
+
children: [text, pureModal.content && pureModal.content]
|
|
171
172
|
})
|
|
172
|
-
}), (
|
|
173
|
-
children: [
|
|
173
|
+
}), (pureModal.reject || pureModal.accept) && /*#__PURE__*/jsxs(DialogActions, {
|
|
174
|
+
children: [pureModal.reject && /*#__PURE__*/jsx(Button, {
|
|
174
175
|
color: "primary",
|
|
175
176
|
onClick: onReject,
|
|
176
|
-
children: typeof
|
|
177
|
-
}),
|
|
177
|
+
children: typeof pureModal.reject == 'string' ? t(pureModal.reject) : t('modal.reject')
|
|
178
|
+
}), pureModal.accept && /*#__PURE__*/jsx(Button, {
|
|
178
179
|
color: "primary",
|
|
179
180
|
type: "submit",
|
|
180
181
|
id: "diva-dialog-submitbtn",
|
|
181
|
-
children: typeof
|
|
182
|
+
children: typeof pureModal.accept == 'string' ? t(pureModal.accept) : t('modal.accept')
|
|
182
183
|
})]
|
|
183
184
|
}), /*#__PURE__*/jsxs("div", {
|
|
184
185
|
style: {
|
|
185
186
|
margin: 10
|
|
186
187
|
},
|
|
187
|
-
children: [
|
|
188
|
-
src:
|
|
188
|
+
children: [pureModal.image && /*#__PURE__*/jsx("img", {
|
|
189
|
+
src: pureModal.image,
|
|
189
190
|
style: {
|
|
190
191
|
maxWidth: 480
|
|
191
192
|
}
|
|
192
|
-
}),
|
|
193
|
-
progress:
|
|
194
|
-
}), (
|
|
193
|
+
}), pureModal.progress !== undefined && /*#__PURE__*/jsx(Progress$1, {
|
|
194
|
+
progress: pureModal.progress
|
|
195
|
+
}), (_pureModal$actions = pureModal.actions) === null || _pureModal$actions === void 0 ? void 0 : _pureModal$actions.map(function (a) {
|
|
195
196
|
var _a$variant;
|
|
196
197
|
return /*#__PURE__*/jsx(Button, {
|
|
197
198
|
fullWidth: true,
|
|
@@ -208,7 +209,7 @@ function Modal() {
|
|
|
208
209
|
})]
|
|
209
210
|
})]
|
|
210
211
|
});
|
|
211
|
-
var isFullscreen =
|
|
212
|
+
var isFullscreen = pureModal.fullscreen === true || pureModal.fullscreen == 'mobile' && contentStore.containerDimensions.isMobile;
|
|
212
213
|
return /*#__PURE__*/jsx("div", {
|
|
213
214
|
className: overlay,
|
|
214
215
|
id: "diva-dialog",
|
|
@@ -225,13 +226,13 @@ function Modal() {
|
|
|
225
226
|
fullScreen: isFullscreen,
|
|
226
227
|
PaperProps: {
|
|
227
228
|
style: {
|
|
228
|
-
width:
|
|
229
|
-
height:
|
|
229
|
+
width: pureModal.width,
|
|
230
|
+
height: pureModal.height
|
|
230
231
|
}
|
|
231
232
|
},
|
|
232
233
|
children: [/*#__PURE__*/jsx(DialogTitle, {
|
|
233
|
-
children: typeof
|
|
234
|
-
}),
|
|
234
|
+
children: typeof pureModal.title == 'string' ? t(pureModal.title) : pureModal.title
|
|
235
|
+
}), pureModal.rejectByIcon && /*#__PURE__*/jsx(IconButton, {
|
|
235
236
|
onClick: onReject,
|
|
236
237
|
style: {
|
|
237
238
|
position: 'absolute',
|
|
@@ -241,7 +242,7 @@ function Modal() {
|
|
|
241
242
|
},
|
|
242
243
|
size: "large",
|
|
243
244
|
children: /*#__PURE__*/jsx(CloseIcon, {})
|
|
244
|
-
}),
|
|
245
|
+
}), pureModal.dontRenderForm && children, !pureModal.dontRenderForm && /*#__PURE__*/jsx("form", {
|
|
245
246
|
id: "diva-modal-form",
|
|
246
247
|
autoComplete: "off",
|
|
247
248
|
onSubmit: function onSubmit(e) {
|
|
@@ -44,7 +44,7 @@ import { actions } from '@storybook/addon-actions';
|
|
|
44
44
|
import * as Styles from '@mui/styles';
|
|
45
45
|
|
|
46
46
|
(function() {
|
|
47
|
-
const env = {"STAGE":"production","VERSION":"25.1.0-beta.
|
|
47
|
+
const env = {"STAGE":"production","VERSION":"25.1.0-beta.39"};
|
|
48
48
|
try {
|
|
49
49
|
if (process) {
|
|
50
50
|
process.env = Object.assign({}, process.env);
|
|
@@ -9496,7 +9496,7 @@ var SideMenu$1 = observer(SideMenu);
|
|
|
9496
9496
|
function ownKeys$4(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; }
|
|
9497
9497
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9498
9498
|
var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
|
|
9499
|
-
return import('./ModalsWrapper-
|
|
9499
|
+
return import('./ModalsWrapper-ae3b5a84.js');
|
|
9500
9500
|
});
|
|
9501
9501
|
function Fullscreen() {
|
|
9502
9502
|
var _useDivaCoreContext = useDivaCoreContext(),
|
|
@@ -9944,10 +9944,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
9944
9944
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9945
9945
|
var LOG$2 = getLogger('Framework', 'Root');
|
|
9946
9946
|
var LazyAuth = /*#__PURE__*/React.lazy(function () {
|
|
9947
|
-
return import('./index-
|
|
9947
|
+
return import('./index-88a09227.js');
|
|
9948
9948
|
});
|
|
9949
9949
|
var LazyModals = /*#__PURE__*/React.lazy(function () {
|
|
9950
|
-
return import('./ModalsWrapper-
|
|
9950
|
+
return import('./ModalsWrapper-ae3b5a84.js');
|
|
9951
9951
|
});
|
|
9952
9952
|
function ContentComponent() {
|
|
9953
9953
|
var context = useDivaCoreContext();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as useDivaCoreContext, B as Button, s as socialButton, g as google, m as microsoft, a as getLogger, e as error, b as separator, I as Input, r as resetInput, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-
|
|
1
|
+
import { u as useDivaCoreContext, B as Button, s as socialButton, g as google, m as microsoft, a as getLogger, e as error, b as separator, I as Input, r as resetInput, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-54e98e1b.js';
|
|
2
2
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
3
3
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
package/build/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as AnalyticsHandler, A as AuthorizationHandler, o as ClientArticleHandler, C as Content, p as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, n as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, q as storyBookCoreMock, j as useDivaCore } from './index-
|
|
1
|
+
export { k as AnalyticsHandler, A as AuthorizationHandler, o as ClientArticleHandler, C as Content, p as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, n as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, q as storyBookCoreMock, j as useDivaCore } from './index-54e98e1b.js';
|
|
2
2
|
export { DivaError, default as DivaUtils } from '@crystaldesign/diva-utils';
|
|
3
3
|
export { Trans, useTranslation } from 'react-i18next';
|
|
4
4
|
export * from '@crystaldesign/basket-model';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAgBtD,iBAAS,KAAK,sBA0Kb;;;;AAED,wBAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 969.diva-core.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[969],{8969:(e,n,t)=>{t.r(n),t.d(n,{default:()=>ModalsWrapper});var
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[969],{8969:(e,n,t)=>{t.r(n),t.d(n,{default:()=>ModalsWrapper});var i=t(7363),o=t(9420),r=t(6308),a=t(1578),l=t(8204),d=t(9400),s=t(4415),c=t(1824),u=t(9763),m=t(3379),p=t.n(m),h=t(7795),v=t.n(h),f=t(569),x=t.n(f),g=t(3565),y=t.n(g),b=t(9216),j=t.n(b),k=t(4589),w=t.n(k),Z=t(5297),P={};P.styleTagTransform=w(),P.setAttributes=y(),P.insert=x().bind(null,"head"),P.domAPI=v(),P.insertStyleElement=j();p()(Z.Z,P);Z.Z&&Z.Z.locals&&Z.Z.locals;var C=t(789),E=t(4988),S=t(5054),I={};I.styleTagTransform=w(),I.setAttributes=y(),I.insert=x().bind(null,"head"),I.domAPI=v(),I.insertStyleElement=j();p()(S.ZP,I);S.ZP&&S.ZP.locals&&S.ZP.locals;var F=t(7514);const D=(0,o.Pi)((function Progress(e){var n=e.children,t=e.progress,o=(0,i.useState)(),r=(0,E.Z)(o,2),a=r[0],l=r[1];return(0,i.useEffect)((function(){l(t)}),[t]),(0,F.jsxs)("div",{className:S.YS,children:[!!n&&n,(0,F.jsx)("div",{className:S.l9,children:(0,F.jsx)("div",{className:S.YJ,style:{width:100*(null!=a?a:0)+"%"},children:(0,F.jsx)("div",{className:S.zn})})})]})}));var z=t(3697),A=t(1682),M=t(8623);const W=(0,o.Pi)((function Modal(){var e,n=(0,r.KH)().contentStore,t=(0,C.$G)().t,o=function onAccept(e){var t,i=n.modal;n.closeModal(),null==i||null===(t=i.callback)||void 0===t||t.call(i,!i.content||e)},m=function onReject(){var e,t=n.modal;n.closeModal(),null==t||null===(e=t.callback)||void 0===e||e.call(t,!1)},p=(0,i.useCallback)((function(e){n.modal&&"Escape"===e.key&&m()}),[]);(0,i.useEffect)((function(){return document.addEventListener("keydown",p,!1),function(){document.removeEventListener("keydown",p,!1)}}),[]),(0,i.useEffect)((function(){return document.addEventListener("keydown",h,!1),function(){document.removeEventListener("keydown",h,!1)}}),[]);var h=(0,i.useCallback)((function(e){if(n.modal)if("Enter"!==e.key||n.modal.doNotAcceptOnEnter)"ESC"!==e.key&&"Escape"!=e.key||(m(),e.preventDefault());else{var t=document.getElementById("diva-modal-form");if(!t)return;o(new FormData(t)),e.preventDefault()}}),[]);if(!n.modal)return(0,F.jsx)(F.Fragment,{});var v=(0,M.ZN)(n.modal),f="string"==typeof v.text?t(v.text):v.text,x=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(s.Z,{style:v.maxWidth?{maxWidth:v.maxWidth}:void 0,children:v.iFrame?(0,F.jsx)(IFrame,{link:v.iFrame}):"string"==typeof f&&null==v.content?(0,F.jsx)(c.Z,{component:"div",dangerouslySetInnerHTML:{__html:function tryDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(n){return e}}(f)}}):(0,F.jsxs)(c.Z,{component:"div",children:[f,v.content&&v.content]})}),(v.reject||v.accept)&&(0,F.jsxs)(d.Z,{children:[v.reject&&(0,F.jsx)(a.Z,{color:"primary",onClick:m,children:"string"==typeof v.reject?t(v.reject):t("modal.reject")}),v.accept&&(0,F.jsx)(a.Z,{color:"primary",type:"submit",id:"diva-dialog-submitbtn",children:"string"==typeof v.accept?t(v.accept):t("modal.accept")})]}),(0,F.jsxs)("div",{style:{margin:10},children:[v.image&&(0,F.jsx)("img",{src:v.image,style:{maxWidth:480}}),void 0!==v.progress&&(0,F.jsx)(D,{progress:v.progress}),null===(e=v.actions)||void 0===e?void 0:e.map((function(e){var i;return(0,F.jsx)(a.Z,{fullWidth:!0,style:{marginBottom:10},variant:null!==(i=e.variant)&&void 0!==i?i:"contained",color:"primary",onClick:function onClick(){return function onSelect(e,t){var i,o=n.modal;0!=t&&n.closeModal(),null==o||null===(i=o.callback)||void 0===i||i.call(o,e)}(e.id,e.closeable)},children:t(e.text)})}))]})]}),g=!0===v.fullscreen||"mobile"==v.fullscreen&&n.containerDimensions.isMobile;return(0,F.jsx)("div",{className:Z.I,id:"diva-dialog",children:(0,F.jsxs)(l.Z,{open:!0,disablePortal:!0,hideBackdrop:!0,disableEnforceFocus:!0,style:{position:"absolute",zIndex:0},maxWidth:"lg",fullScreen:g,PaperProps:{style:{width:v.width,height:v.height}},children:[(0,F.jsx)(u.Z,{children:"string"==typeof v.title?t(v.title):v.title}),v.rejectByIcon&&(0,F.jsx)(z.Z,{onClick:m,style:{position:"absolute",right:8,top:8,zIndex:1000001},size:"large",children:(0,F.jsx)(A.Z,{})}),v.dontRenderForm&&x,!v.dontRenderForm&&(0,F.jsx)("form",{id:"diva-modal-form",autoComplete:"off",onSubmit:function onSubmit(e){e.preventDefault(),o(new FormData(e.target))},children:x})]})})}));function IFrame(e){var n=e.link;return(0,F.jsx)("iframe",{style:{border:0,width:"100%",height:"99%"},src:n})}function ModalsWrapper(){return(0,F.jsx)(W,{})}},5297:(e,n,t)=>{t.d(n,{I:()=>l,Z:()=>d});var i=t(8081),o=t.n(i),r=t(3645),a=t.n(r)()(o());a.push([e.id,".index-module--AtOcs {\n height: 100%;\n width: 100%;\n display: flex;\n background-color: rgba(255, 255, 255, 0.6);\n z-index: 1001;\n justify-content: center;\n align-items: center;\n position: absolute;\n}\n",""]);var l="index-module--AtOcs";const d=a},5054:(e,n,t)=>{t.d(n,{YJ:()=>s,YS:()=>l,ZP:()=>u,l9:()=>d,zn:()=>c});var i=t(8081),o=t.n(i),r=t(3645),a=t.n(r)()(o());a.push([e.id,".index-module--Pww9z {\n display: flex;\n width: 100%;\n}\n\n.index-module--thPSh {\n height: 10px;\n position: relative;\n border-radius: 5px;\n width: 100%;\n}\n\n@keyframes index-module--_9_PO {\n from {\n background-position-x: 0;\n }\n to {\n background-position-x: 113px;\n }\n}\n\n.index-module--HhvXv {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n transition: width 0.4s ease-out;\n overflow: hidden;\n border-radius: 5px;\n}\n.index-module--f7imw {\n border-radius: 5px;\n height: 100%;\n background-color: var(--diva-theme-palette-primary-main);\n background-image: repeating-linear-gradient(\n 45deg,\n transparent,\n transparent 10px,\n var(--diva-theme-palette-secondary-dark) 10px,\n var(--diva-theme-palette-secondary-dark) 20px\n );\n animation: index-module--_9_PO 4s linear infinite;\n will-change: background-position;\n}\n",""]);var l="index-module--Pww9z",d="index-module--thPSh",s="index-module--HhvXv",c="index-module--f7imw";const u=a}}]);
|