@ews-admin/global-design-system 1.18.0 → 1.19.0

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/dist/index.esm.js CHANGED
@@ -32,7 +32,7 @@ function buildUrls(environment) {
32
32
  return {
33
33
  bffUrl: `https://${prefix}api.${domain}/bff/api/v1`,
34
34
  loginBffUrl: `https://${prefix}api.${domain}/login-bff/api/v1`,
35
- appUrl: `https://${prefix}app.${domain}`,
35
+ appUrl: environment === "prod" ? `https://${prefix}${domain}` : `https://${prefix}app.${domain}`,
36
36
  loginUrl: `https://${prefix}login.${domain}`,
37
37
  dashboardUrl: `https://${prefix}dashboard.${domain}`,
38
38
  adminUrl: `https://${prefix}admin.${domain}`,
@@ -34144,6 +34144,7 @@ function classNames(...args) {
34144
34144
  var styles_default = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n";
34145
34145
  //#endregion
34146
34146
  //#region src/Cropper.tsx
34147
+ const RESIZE_EMIT_DEBOUNCE_TIME = 250;
34147
34148
  const MIN_ZOOM = 1;
34148
34149
  const MAX_ZOOM = 3;
34149
34150
  const KEYBOARD_STEP = 1;
@@ -34182,6 +34183,7 @@ var Cropper$1 = class Cropper extends React.Component {
34182
34183
  this.rafDragTimeout = null;
34183
34184
  this.rafPinchTimeout = null;
34184
34185
  this.wheelTimer = null;
34186
+ this.resizeEmitTimer = null;
34185
34187
  this.currentDoc = typeof document !== "undefined" ? document : null;
34186
34188
  this.currentWindow = typeof window !== "undefined" ? window : null;
34187
34189
  this.resizeObserver = null;
@@ -34200,10 +34202,13 @@ var Cropper$1 = class Cropper extends React.Component {
34200
34202
  isFirstResize = false;
34201
34203
  return;
34202
34204
  }
34203
- this.computeSizes();
34205
+ this.computeSizes({ isResizeTriggered: true });
34204
34206
  });
34205
34207
  this.resizeObserver.observe(this.containerRef);
34206
34208
  };
34209
+ this.onWindowResize = () => {
34210
+ this.computeSizes({ isResizeTriggered: true });
34211
+ };
34207
34212
  this.preventZoomSafari = (e) => e.preventDefault();
34208
34213
  this.cleanEvents = () => {
34209
34214
  if (!this.currentDoc) return;
@@ -34240,7 +34245,7 @@ var Cropper$1 = class Cropper extends React.Component {
34240
34245
  this.props.onZoomChange && this.props.onZoomChange(zoom);
34241
34246
  }
34242
34247
  };
34243
- this.computeSizes = () => {
34248
+ this.computeSizes = ({ isResizeTriggered = false } = {}) => {
34244
34249
  const mediaRef = this.imageRef.current || this.videoRef.current;
34245
34250
  if (mediaRef && this.containerRef) {
34246
34251
  var _this$imageRef$curren, _this$videoRef$curren, _this$imageRef$curren2, _this$videoRef$curren2, _this$state$cropSize, _this$state$cropSize2;
@@ -34287,7 +34292,7 @@ var Cropper$1 = class Cropper extends React.Component {
34287
34292
  if (this.props.setMediaSize) this.props.setMediaSize(this.mediaSize);
34288
34293
  const cropSize = this.props.cropSize ? this.props.cropSize : getCropSize(this.mediaSize.width, this.mediaSize.height, this.containerRect.width, this.containerRect.height, this.props.aspect, this.props.rotation);
34289
34294
  if (((_this$state$cropSize = this.state.cropSize) === null || _this$state$cropSize === void 0 ? void 0 : _this$state$cropSize.height) !== cropSize.height || ((_this$state$cropSize2 = this.state.cropSize) === null || _this$state$cropSize2 === void 0 ? void 0 : _this$state$cropSize2.width) !== cropSize.width) this.props.onCropSizeChange && this.props.onCropSizeChange(cropSize);
34290
- this.setState({ cropSize }, this.recomputeCropPosition);
34295
+ this.setState({ cropSize }, () => this.recomputeCropPosition({ isResizeTriggered }));
34291
34296
  if (this.props.setCropSize) this.props.setCropSize(cropSize);
34292
34297
  return cropSize;
34293
34298
  }
@@ -34436,6 +34441,10 @@ var Cropper$1 = class Cropper extends React.Component {
34436
34441
  return computeCroppedArea(this.props.restrictPosition ? restrictPosition(this.props.crop, this.mediaSize, this.state.cropSize, this.props.zoom, this.props.rotation) : this.props.crop, this.mediaSize, this.state.cropSize, this.getAspect(), this.props.zoom, this.props.rotation, this.props.restrictPosition);
34437
34442
  };
34438
34443
  this.emitCropData = () => {
34444
+ if (this.resizeEmitTimer) {
34445
+ clearTimeout(this.resizeEmitTimer);
34446
+ this.resizeEmitTimer = null;
34447
+ }
34439
34448
  const cropData = this.getCropData();
34440
34449
  if (!cropData) return;
34441
34450
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
@@ -34448,7 +34457,7 @@ var Cropper$1 = class Cropper extends React.Component {
34448
34457
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
34449
34458
  if (this.props.onCropAreaChange) this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
34450
34459
  };
34451
- this.recomputeCropPosition = () => {
34460
+ this.recomputeCropPosition = ({ isResizeTriggered = false } = {}) => {
34452
34461
  var _this$previousCropSiz, _this$previousCropSiz2;
34453
34462
  if (!this.state.cropSize) return;
34454
34463
  let adjustedCrop = this.props.crop;
@@ -34465,7 +34474,15 @@ var Cropper$1 = class Cropper extends React.Component {
34465
34474
  const newPosition = this.props.restrictPosition ? restrictPosition(adjustedCrop, this.mediaSize, this.state.cropSize, this.props.zoom, this.props.rotation) : adjustedCrop;
34466
34475
  this.previousCropSize = this.state.cropSize;
34467
34476
  this.props.onCropChange(newPosition);
34468
- this.emitCropData();
34477
+ if (isResizeTriggered) this.debouncedEmitCropData();
34478
+ else this.emitCropData();
34479
+ };
34480
+ this.debouncedEmitCropData = () => {
34481
+ if (!this.currentWindow) return;
34482
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34483
+ this.resizeEmitTimer = this.currentWindow.setTimeout(() => {
34484
+ this.emitCropData();
34485
+ }, RESIZE_EMIT_DEBOUNCE_TIME);
34469
34486
  };
34470
34487
  this.onKeyDown = (event) => {
34471
34488
  const { crop, onCropChange, keyboardStep, zoom, rotation } = this.props;
@@ -34520,7 +34537,7 @@ var Cropper$1 = class Cropper extends React.Component {
34520
34537
  if (this.containerRef.ownerDocument) this.currentDoc = this.containerRef.ownerDocument;
34521
34538
  if (this.currentDoc.defaultView) this.currentWindow = this.currentDoc.defaultView;
34522
34539
  this.initResizeObserver();
34523
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.computeSizes);
34540
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.onWindowResize);
34524
34541
  this.props.zoomWithScroll && this.containerRef.addEventListener("wheel", this.onWheel, { passive: false });
34525
34542
  this.containerRef.addEventListener("gesturestart", this.onGestureStart);
34526
34543
  }
@@ -34540,8 +34557,9 @@ var Cropper$1 = class Cropper extends React.Component {
34540
34557
  componentWillUnmount() {
34541
34558
  var _this$resizeObserver;
34542
34559
  if (!this.currentDoc || !this.currentWindow) return;
34543
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.computeSizes);
34560
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.onWindowResize);
34544
34561
  (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
34562
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34545
34563
  if (this.containerRef) this.containerRef.removeEventListener("gesturestart", this.preventZoomSafari);
34546
34564
  if (this.styleRef) {
34547
34565
  var _this$styleRef$parent;