@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.js CHANGED
@@ -52,7 +52,7 @@ function buildUrls(environment) {
52
52
  return {
53
53
  bffUrl: `https://${prefix}api.${domain}/bff/api/v1`,
54
54
  loginBffUrl: `https://${prefix}api.${domain}/login-bff/api/v1`,
55
- appUrl: `https://${prefix}app.${domain}`,
55
+ appUrl: environment === "prod" ? `https://${prefix}${domain}` : `https://${prefix}app.${domain}`,
56
56
  loginUrl: `https://${prefix}login.${domain}`,
57
57
  dashboardUrl: `https://${prefix}dashboard.${domain}`,
58
58
  adminUrl: `https://${prefix}admin.${domain}`,
@@ -34164,6 +34164,7 @@ function classNames(...args) {
34164
34164
  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";
34165
34165
  //#endregion
34166
34166
  //#region src/Cropper.tsx
34167
+ const RESIZE_EMIT_DEBOUNCE_TIME = 250;
34167
34168
  const MIN_ZOOM = 1;
34168
34169
  const MAX_ZOOM = 3;
34169
34170
  const KEYBOARD_STEP = 1;
@@ -34202,6 +34203,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34202
34203
  this.rafDragTimeout = null;
34203
34204
  this.rafPinchTimeout = null;
34204
34205
  this.wheelTimer = null;
34206
+ this.resizeEmitTimer = null;
34205
34207
  this.currentDoc = typeof document !== "undefined" ? document : null;
34206
34208
  this.currentWindow = typeof window !== "undefined" ? window : null;
34207
34209
  this.resizeObserver = null;
@@ -34220,10 +34222,13 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34220
34222
  isFirstResize = false;
34221
34223
  return;
34222
34224
  }
34223
- this.computeSizes();
34225
+ this.computeSizes({ isResizeTriggered: true });
34224
34226
  });
34225
34227
  this.resizeObserver.observe(this.containerRef);
34226
34228
  };
34229
+ this.onWindowResize = () => {
34230
+ this.computeSizes({ isResizeTriggered: true });
34231
+ };
34227
34232
  this.preventZoomSafari = (e) => e.preventDefault();
34228
34233
  this.cleanEvents = () => {
34229
34234
  if (!this.currentDoc) return;
@@ -34260,7 +34265,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34260
34265
  this.props.onZoomChange && this.props.onZoomChange(zoom);
34261
34266
  }
34262
34267
  };
34263
- this.computeSizes = () => {
34268
+ this.computeSizes = ({ isResizeTriggered = false } = {}) => {
34264
34269
  const mediaRef = this.imageRef.current || this.videoRef.current;
34265
34270
  if (mediaRef && this.containerRef) {
34266
34271
  var _this$imageRef$curren, _this$videoRef$curren, _this$imageRef$curren2, _this$videoRef$curren2, _this$state$cropSize, _this$state$cropSize2;
@@ -34307,7 +34312,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34307
34312
  if (this.props.setMediaSize) this.props.setMediaSize(this.mediaSize);
34308
34313
  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);
34309
34314
  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);
34310
- this.setState({ cropSize }, this.recomputeCropPosition);
34315
+ this.setState({ cropSize }, () => this.recomputeCropPosition({ isResizeTriggered }));
34311
34316
  if (this.props.setCropSize) this.props.setCropSize(cropSize);
34312
34317
  return cropSize;
34313
34318
  }
@@ -34456,6 +34461,10 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34456
34461
  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);
34457
34462
  };
34458
34463
  this.emitCropData = () => {
34464
+ if (this.resizeEmitTimer) {
34465
+ clearTimeout(this.resizeEmitTimer);
34466
+ this.resizeEmitTimer = null;
34467
+ }
34459
34468
  const cropData = this.getCropData();
34460
34469
  if (!cropData) return;
34461
34470
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
@@ -34468,7 +34477,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34468
34477
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
34469
34478
  if (this.props.onCropAreaChange) this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
34470
34479
  };
34471
- this.recomputeCropPosition = () => {
34480
+ this.recomputeCropPosition = ({ isResizeTriggered = false } = {}) => {
34472
34481
  var _this$previousCropSiz, _this$previousCropSiz2;
34473
34482
  if (!this.state.cropSize) return;
34474
34483
  let adjustedCrop = this.props.crop;
@@ -34485,7 +34494,15 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34485
34494
  const newPosition = this.props.restrictPosition ? restrictPosition(adjustedCrop, this.mediaSize, this.state.cropSize, this.props.zoom, this.props.rotation) : adjustedCrop;
34486
34495
  this.previousCropSize = this.state.cropSize;
34487
34496
  this.props.onCropChange(newPosition);
34488
- this.emitCropData();
34497
+ if (isResizeTriggered) this.debouncedEmitCropData();
34498
+ else this.emitCropData();
34499
+ };
34500
+ this.debouncedEmitCropData = () => {
34501
+ if (!this.currentWindow) return;
34502
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34503
+ this.resizeEmitTimer = this.currentWindow.setTimeout(() => {
34504
+ this.emitCropData();
34505
+ }, RESIZE_EMIT_DEBOUNCE_TIME);
34489
34506
  };
34490
34507
  this.onKeyDown = (event) => {
34491
34508
  const { crop, onCropChange, keyboardStep, zoom, rotation } = this.props;
@@ -34540,7 +34557,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34540
34557
  if (this.containerRef.ownerDocument) this.currentDoc = this.containerRef.ownerDocument;
34541
34558
  if (this.currentDoc.defaultView) this.currentWindow = this.currentDoc.defaultView;
34542
34559
  this.initResizeObserver();
34543
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.computeSizes);
34560
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.onWindowResize);
34544
34561
  this.props.zoomWithScroll && this.containerRef.addEventListener("wheel", this.onWheel, { passive: false });
34545
34562
  this.containerRef.addEventListener("gesturestart", this.onGestureStart);
34546
34563
  }
@@ -34560,8 +34577,9 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34560
34577
  componentWillUnmount() {
34561
34578
  var _this$resizeObserver;
34562
34579
  if (!this.currentDoc || !this.currentWindow) return;
34563
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.computeSizes);
34580
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.onWindowResize);
34564
34581
  (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
34582
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34565
34583
  if (this.containerRef) this.containerRef.removeEventListener("gesturestart", this.preventZoomSafari);
34566
34584
  if (this.styleRef) {
34567
34585
  var _this$styleRef$parent;