@ews-admin/global-design-system 1.18.0 → 1.21.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,11 +34203,13 @@ 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;
34208
34210
  this.previousCropSize = null;
34209
34211
  this.isInitialized = false;
34212
+ this.dragInteractionSource = null;
34210
34213
  this.state = {
34211
34214
  cropSize: null,
34212
34215
  hasWheelJustStarted: false,
@@ -34220,10 +34223,13 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34220
34223
  isFirstResize = false;
34221
34224
  return;
34222
34225
  }
34223
- this.computeSizes();
34226
+ this.computeSizes({ isResizeTriggered: true });
34224
34227
  });
34225
34228
  this.resizeObserver.observe(this.containerRef);
34226
34229
  };
34230
+ this.onWindowResize = () => {
34231
+ this.computeSizes({ isResizeTriggered: true });
34232
+ };
34227
34233
  this.preventZoomSafari = (e) => e.preventDefault();
34228
34234
  this.cleanEvents = () => {
34229
34235
  if (!this.currentDoc) return;
@@ -34260,7 +34266,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34260
34266
  this.props.onZoomChange && this.props.onZoomChange(zoom);
34261
34267
  }
34262
34268
  };
34263
- this.computeSizes = () => {
34269
+ this.computeSizes = ({ isResizeTriggered = false } = {}) => {
34264
34270
  const mediaRef = this.imageRef.current || this.videoRef.current;
34265
34271
  if (mediaRef && this.containerRef) {
34266
34272
  var _this$imageRef$curren, _this$videoRef$curren, _this$imageRef$curren2, _this$videoRef$curren2, _this$state$cropSize, _this$state$cropSize2;
@@ -34307,7 +34313,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34307
34313
  if (this.props.setMediaSize) this.props.setMediaSize(this.mediaSize);
34308
34314
  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
34315
  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);
34316
+ this.setState({ cropSize }, () => this.recomputeCropPosition({ isResizeTriggered }));
34311
34317
  if (this.props.setCropSize) this.props.setCropSize(cropSize);
34312
34318
  return cropSize;
34313
34319
  }
@@ -34327,7 +34333,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34327
34333
  this.currentDoc.addEventListener("mousemove", this.onMouseMove);
34328
34334
  this.currentDoc.addEventListener("mouseup", this.onDragStopped);
34329
34335
  this.saveContainerPosition();
34330
- this.onDragStart(Cropper.getMousePoint(e));
34336
+ this.onDragStart(Cropper.getMousePoint(e), "mouse");
34331
34337
  };
34332
34338
  this.onMouseMove = (e) => this.onDrag(Cropper.getMousePoint(e));
34333
34339
  this.onScroll = (e) => {
@@ -34343,7 +34349,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34343
34349
  this.currentDoc.addEventListener("touchend", this.onDragStopped);
34344
34350
  this.saveContainerPosition();
34345
34351
  if (e.touches.length === 2) this.onPinchStart(e);
34346
- else if (e.touches.length === 1) this.onDragStart(Cropper.getTouchPoint(e.touches[0]));
34352
+ else if (e.touches.length === 1) this.onDragStart(Cropper.getTouchPoint(e.touches[0]), "touch");
34347
34353
  };
34348
34354
  this.onTouchMove = (e) => {
34349
34355
  e.preventDefault();
@@ -34372,14 +34378,15 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34372
34378
  this.onGestureEnd = (e) => {
34373
34379
  this.cleanEvents();
34374
34380
  };
34375
- this.onDragStart = ({ x, y }) => {
34381
+ this.onDragStart = ({ x, y }, source) => {
34376
34382
  var _this$props$onInterac, _this$props;
34377
34383
  this.dragStartPosition = {
34378
34384
  x,
34379
34385
  y
34380
34386
  };
34381
34387
  this.dragStartCrop = _objectSpread2({}, this.props.crop);
34382
- (_this$props$onInterac = (_this$props = this.props).onInteractionStart) === null || _this$props$onInterac === void 0 || _this$props$onInterac.call(_this$props);
34388
+ this.dragInteractionSource = source;
34389
+ (_this$props$onInterac = (_this$props = this.props).onInteractionStart) === null || _this$props$onInterac === void 0 || _this$props$onInterac.call(_this$props, { source });
34383
34390
  };
34384
34391
  this.onDrag = ({ x, y }) => {
34385
34392
  if (!this.currentWindow) return;
@@ -34398,11 +34405,12 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34398
34405
  });
34399
34406
  };
34400
34407
  this.onDragStopped = () => {
34401
- var _this$props$onInterac2, _this$props2;
34408
+ var _this$props$onInterac2, _this$props2, _this$dragInteraction;
34402
34409
  this.isTouching = false;
34403
34410
  this.cleanEvents();
34404
34411
  this.emitCropData();
34405
- (_this$props$onInterac2 = (_this$props2 = this.props).onInteractionEnd) === null || _this$props$onInterac2 === void 0 || _this$props$onInterac2.call(_this$props2);
34412
+ (_this$props$onInterac2 = (_this$props2 = this.props).onInteractionEnd) === null || _this$props$onInterac2 === void 0 || _this$props$onInterac2.call(_this$props2, { source: (_this$dragInteraction = this.dragInteractionSource) !== null && _this$dragInteraction !== void 0 ? _this$dragInteraction : "mouse" });
34413
+ this.dragInteractionSource = null;
34406
34414
  };
34407
34415
  this.onWheel = (e) => {
34408
34416
  if (!this.currentWindow) return;
@@ -34414,12 +34422,12 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34414
34422
  this.setNewZoom(newZoom, point, { shouldUpdatePosition: true });
34415
34423
  if (!this.state.hasWheelJustStarted) this.setState({ hasWheelJustStarted: true }, () => {
34416
34424
  var _this$props$onInterac3, _this$props3;
34417
- return (_this$props$onInterac3 = (_this$props3 = this.props).onInteractionStart) === null || _this$props$onInterac3 === void 0 ? void 0 : _this$props$onInterac3.call(_this$props3);
34425
+ return (_this$props$onInterac3 = (_this$props3 = this.props).onInteractionStart) === null || _this$props$onInterac3 === void 0 ? void 0 : _this$props$onInterac3.call(_this$props3, { source: "wheel" });
34418
34426
  });
34419
34427
  if (this.wheelTimer) clearTimeout(this.wheelTimer);
34420
34428
  this.wheelTimer = this.currentWindow.setTimeout(() => this.setState({ hasWheelJustStarted: false }, () => {
34421
34429
  var _this$props$onInterac4, _this$props4;
34422
- return (_this$props$onInterac4 = (_this$props4 = this.props).onInteractionEnd) === null || _this$props$onInterac4 === void 0 ? void 0 : _this$props$onInterac4.call(_this$props4);
34430
+ return (_this$props$onInterac4 = (_this$props4 = this.props).onInteractionEnd) === null || _this$props$onInterac4 === void 0 ? void 0 : _this$props$onInterac4.call(_this$props4, { source: "wheel" });
34423
34431
  }), 250);
34424
34432
  };
34425
34433
  this.getPointOnContainer = ({ x, y }, containerTopLeft) => {
@@ -34456,6 +34464,10 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34456
34464
  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
34465
  };
34458
34466
  this.emitCropData = () => {
34467
+ if (this.resizeEmitTimer) {
34468
+ clearTimeout(this.resizeEmitTimer);
34469
+ this.resizeEmitTimer = null;
34470
+ }
34459
34471
  const cropData = this.getCropData();
34460
34472
  if (!cropData) return;
34461
34473
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
@@ -34468,7 +34480,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34468
34480
  const { croppedAreaPercentages, croppedAreaPixels } = cropData;
34469
34481
  if (this.props.onCropAreaChange) this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
34470
34482
  };
34471
- this.recomputeCropPosition = () => {
34483
+ this.recomputeCropPosition = ({ isResizeTriggered = false } = {}) => {
34472
34484
  var _this$previousCropSiz, _this$previousCropSiz2;
34473
34485
  if (!this.state.cropSize) return;
34474
34486
  let adjustedCrop = this.props.crop;
@@ -34485,7 +34497,15 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34485
34497
  const newPosition = this.props.restrictPosition ? restrictPosition(adjustedCrop, this.mediaSize, this.state.cropSize, this.props.zoom, this.props.rotation) : adjustedCrop;
34486
34498
  this.previousCropSize = this.state.cropSize;
34487
34499
  this.props.onCropChange(newPosition);
34488
- this.emitCropData();
34500
+ if (isResizeTriggered) this.debouncedEmitCropData();
34501
+ else this.emitCropData();
34502
+ };
34503
+ this.debouncedEmitCropData = () => {
34504
+ if (!this.currentWindow) return;
34505
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34506
+ this.resizeEmitTimer = this.currentWindow.setTimeout(() => {
34507
+ this.emitCropData();
34508
+ }, RESIZE_EMIT_DEBOUNCE_TIME);
34489
34509
  };
34490
34510
  this.onKeyDown = (event) => {
34491
34511
  const { crop, onCropChange, keyboardStep, zoom, rotation } = this.props;
@@ -34515,7 +34535,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34515
34535
  if (this.props.restrictPosition) newCrop = restrictPosition(newCrop, this.mediaSize, this.state.cropSize, zoom, rotation);
34516
34536
  if (!event.repeat) {
34517
34537
  var _this$props$onInterac5, _this$props5;
34518
- (_this$props$onInterac5 = (_this$props5 = this.props).onInteractionStart) === null || _this$props$onInterac5 === void 0 || _this$props$onInterac5.call(_this$props5);
34538
+ (_this$props$onInterac5 = (_this$props5 = this.props).onInteractionStart) === null || _this$props$onInterac5 === void 0 || _this$props$onInterac5.call(_this$props5, { source: "keyboard" });
34519
34539
  }
34520
34540
  onCropChange(newCrop);
34521
34541
  };
@@ -34531,7 +34551,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34531
34551
  default: return;
34532
34552
  }
34533
34553
  this.emitCropData();
34534
- (_this$props$onInterac6 = (_this$props6 = this.props).onInteractionEnd) === null || _this$props$onInterac6 === void 0 || _this$props$onInterac6.call(_this$props6);
34554
+ (_this$props$onInterac6 = (_this$props6 = this.props).onInteractionEnd) === null || _this$props$onInterac6 === void 0 || _this$props$onInterac6.call(_this$props6, { source: "keyboard" });
34535
34555
  };
34536
34556
  }
34537
34557
  componentDidMount() {
@@ -34540,7 +34560,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34540
34560
  if (this.containerRef.ownerDocument) this.currentDoc = this.containerRef.ownerDocument;
34541
34561
  if (this.currentDoc.defaultView) this.currentWindow = this.currentDoc.defaultView;
34542
34562
  this.initResizeObserver();
34543
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.computeSizes);
34563
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.addEventListener("resize", this.onWindowResize);
34544
34564
  this.props.zoomWithScroll && this.containerRef.addEventListener("wheel", this.onWheel, { passive: false });
34545
34565
  this.containerRef.addEventListener("gesturestart", this.onGestureStart);
34546
34566
  }
@@ -34560,8 +34580,9 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34560
34580
  componentWillUnmount() {
34561
34581
  var _this$resizeObserver;
34562
34582
  if (!this.currentDoc || !this.currentWindow) return;
34563
- if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.computeSizes);
34583
+ if (typeof window.ResizeObserver === "undefined") this.currentWindow.removeEventListener("resize", this.onWindowResize);
34564
34584
  (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
34585
+ if (this.resizeEmitTimer) clearTimeout(this.resizeEmitTimer);
34565
34586
  if (this.containerRef) this.containerRef.removeEventListener("gesturestart", this.preventZoomSafari);
34566
34587
  if (this.styleRef) {
34567
34588
  var _this$styleRef$parent;
@@ -34610,7 +34631,7 @@ var Cropper$1 = class Cropper extends React__namespace.Component {
34610
34631
  const pointB = Cropper.getTouchPoint(e.touches[1]);
34611
34632
  this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB);
34612
34633
  this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB);
34613
- this.onDragStart(getCenter(pointA, pointB));
34634
+ this.onDragStart(getCenter(pointA, pointB), "touch");
34614
34635
  }
34615
34636
  onPinchMove(e) {
34616
34637
  if (!this.currentDoc || !this.currentWindow) return;
@@ -35129,6 +35150,12 @@ const TagList = ({ items, maxVisible = DEFAULT_MAX, showMoreLabel, showLessLabel
35129
35150
  return (jsxRuntime.jsxs("div", { className: cn("flex flex-wrap items-center gap-2", className), children: [visible.map((label, i) => renderTag ? (renderTag(label, i)) : (jsxRuntime.jsx(Tag, { label: label, variant: variant }, i))), hasMore && !expanded && (jsxRuntime.jsx("span", { className: "text-sm text-gray-400", children: "..." })), hasMore && (jsxRuntime.jsx("button", { onClick: handleToggle, className: "text-xs text-ews-primary hover:underline", children: expanded ? showLessLabel : showMoreLabel }))] }));
35130
35151
  };
35131
35152
 
35153
+ /**
35154
+ * Full-width payment reminder banner (red gradient) used above the app
35155
+ * content when a licence payment is due soon or overdue.
35156
+ */
35157
+ const PaymentDueBanner = ({ title, subtitle, warning, ctaLabel, onCtaClick, onDismiss, dismissLabel = "Close", }) => (jsxRuntime.jsx("div", { "data-testid": "payment-banner", className: "overflow-hidden bg-gradient-to-r from-red-600 to-red-700 shadow-lg", children: jsxRuntime.jsx("div", { className: "px-6 py-8 sm:px-8", children: jsxRuntime.jsxs("div", { className: "flex flex-col space-y-6 sm:flex-row sm:items-center sm:justify-between sm:space-y-0", children: [jsxRuntime.jsxs("div", { className: "flex items-center space-x-4", children: [jsxRuntime.jsx(TriangleAlert, { className: "w-8 h-8 text-white shrink-0" }), jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntime.jsx("h3", { className: "text-2xl font-bold text-white", children: title }), subtitle && (jsxRuntime.jsx("p", { className: "mt-2 text-base text-red-100", children: subtitle })), warning && (jsxRuntime.jsx("p", { className: "mt-1 text-sm font-medium text-red-200", children: warning }))] })] }), jsxRuntime.jsxs("div", { className: "flex flex-col flex-shrink-0 gap-3 sm:flex-row sm:gap-4 sm:items-center", children: [jsxRuntime.jsx("button", { onClick: onCtaClick, className: "w-full px-8 py-3 text-base font-semibold text-red-600 bg-white rounded-lg shadow-sm transition-all duration-200 sm:w-auto hover:bg-red-50 hover:shadow-md", children: ctaLabel }), onDismiss && (jsxRuntime.jsx("button", { onClick: onDismiss, className: "self-start p-2 rounded-full transition-colors bg-white/10 hover:bg-white/20 sm:self-auto", "aria-label": dismissLabel, children: jsxRuntime.jsx(X, { className: "w-5 h-5 text-white" }) }))] })] }) }) }));
35158
+
35132
35159
  const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesChange, specialties: availableSpecialties, placeholder = "Search and select medical specialties...", className = "", disabled = false, maxSelections, showSelectedCount = true, title = "Medical Specialties", label = "Select Specialties", getSelectedCountText, }) => {
35133
35160
  const [filteredSpecialties, setFilteredSpecialties] = React.useState([]);
35134
35161
  const [isLoading, setIsLoading] = React.useState(false);
@@ -39539,6 +39566,7 @@ exports.PauseOctagon = OctagonPause;
39539
39566
  exports.PauseOctagonIcon = OctagonPause;
39540
39567
  exports.PawPrint = PawPrint;
39541
39568
  exports.PawPrintIcon = PawPrint;
39569
+ exports.PaymentDueBanner = PaymentDueBanner;
39542
39570
  exports.PcCase = PcCase;
39543
39571
  exports.PcCaseIcon = PcCase;
39544
39572
  exports.Pen = Pen;