synapse-react-client 2.1.5 → 2.1.6

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.
@@ -40298,7 +40298,14 @@ var SRC = (() => {
40298
40298
  };
40299
40299
  var Typography_default2 = Typography3;
40300
40300
 
40301
+ // src/lib/utils/functions/TooltipUtils.ts
40302
+ var rebuildTooltip = debounce_default(() => index_es_default.rebuild(), 200, {
40303
+ leading: false,
40304
+ trailing: true
40305
+ });
40306
+
40301
40307
  // src/lib/containers/FullWidthAlert.tsx
40308
+ var FULL_WIDTH_ALERT_TOOLTIP_ID = "FullWidthAlertTooltip";
40302
40309
  function getIcon(variant) {
40303
40310
  switch (variant) {
40304
40311
  case "warning":
@@ -40325,14 +40332,36 @@ var SRC = (() => {
40325
40332
  return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null);
40326
40333
  }
40327
40334
  }
40335
+ function ButtonFromConfig(props) {
40336
+ const { config: config2, variant, className } = props;
40337
+ if (config2) {
40338
+ return /* @__PURE__ */ import_react12.default.createElement("span", {
40339
+ "data-tip": config2.tooltipText,
40340
+ "data-for": FULL_WIDTH_ALERT_TOOLTIP_ID,
40341
+ "data-tip-disable": false
40342
+ }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap.Button, {
40343
+ variant,
40344
+ className,
40345
+ disabled: config2.isDisabled,
40346
+ onClick: (e3) => {
40347
+ if ("onClick" in config2) {
40348
+ e3.preventDefault();
40349
+ config2.onClick(e3);
40350
+ } else if ("href" in config2) {
40351
+ e3.preventDefault();
40352
+ window.open(config2.href, "_blank", "noopener");
40353
+ }
40354
+ }
40355
+ }, config2.text));
40356
+ }
40357
+ return null;
40358
+ }
40328
40359
  function FullWidthAlert(props) {
40329
40360
  const {
40330
40361
  title,
40331
40362
  description,
40332
- secondaryButtonText,
40333
- onSecondaryButtonClickOrHref,
40334
- primaryButtonText,
40335
- onPrimaryButtonClick,
40363
+ primaryButtonConfig,
40364
+ secondaryButtonConfig,
40336
40365
  show,
40337
40366
  onClose,
40338
40367
  autoCloseAfterDelayInSeconds,
@@ -40341,7 +40370,10 @@ var SRC = (() => {
40341
40370
  isGlobal = true
40342
40371
  } = props;
40343
40372
  const iconContent = getIcon(variant);
40344
- const hasActions = primaryButtonText && onPrimaryButtonClick || secondaryButtonText && onSecondaryButtonClickOrHref;
40373
+ const hasActions = primaryButtonConfig || secondaryButtonConfig;
40374
+ (0, import_react12.useEffect)(() => {
40375
+ rebuildTooltip();
40376
+ }, [primaryButtonConfig, secondaryButtonConfig]);
40345
40377
  (0, import_react12.useEffect)(() => {
40346
40378
  let timer;
40347
40379
  if (onClose && autoCloseAfterDelayInSeconds) {
@@ -40360,7 +40392,11 @@ var SRC = (() => {
40360
40392
  dismissible: false,
40361
40393
  transition: transition2,
40362
40394
  className: `FullWidthAlert bootstrap-4-backport ${isGlobal ? "global" : ""} ${additionalAlertVariantClass}`
40363
- }, /* @__PURE__ */ import_react12.default.createElement("div", {
40395
+ }, /* @__PURE__ */ import_react12.default.createElement(index_es_default, {
40396
+ id: FULL_WIDTH_ALERT_TOOLTIP_ID,
40397
+ delayShow: 300,
40398
+ effect: "solid"
40399
+ }), /* @__PURE__ */ import_react12.default.createElement("div", {
40364
40400
  className: `gridContainer ${hasActions ? "" : "noActions"} ${onClose ? "hasCloseButton" : ""}`
40365
40401
  }, /* @__PURE__ */ import_react12.default.createElement("span", {
40366
40402
  className: "iconArea"
@@ -40370,20 +40406,15 @@ var SRC = (() => {
40370
40406
  variant: "headline3"
40371
40407
  }, title), /* @__PURE__ */ import_react12.default.createElement(Typography_default2, {
40372
40408
  variant: "body1"
40373
- }, description)), secondaryButtonText && onSecondaryButtonClickOrHref && /* @__PURE__ */ import_react12.default.createElement("a", {
40374
- className: "secondaryButton",
40375
- target: "_blank",
40376
- rel: "noopener noreferrer",
40377
- onClick: typeof onSecondaryButtonClickOrHref === "function" ? (e3) => {
40378
- e3.preventDefault();
40379
- onSecondaryButtonClickOrHref();
40380
- } : void 0,
40381
- href: typeof onSecondaryButtonClickOrHref === "string" ? onSecondaryButtonClickOrHref : "#"
40382
- }, " ", secondaryButtonText), primaryButtonText && onPrimaryButtonClick && /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap.Button, {
40383
- className: "primaryButton",
40409
+ }, description)), /* @__PURE__ */ import_react12.default.createElement(ButtonFromConfig, {
40410
+ config: secondaryButtonConfig,
40411
+ variant: "tertiary",
40412
+ className: "secondaryButton"
40413
+ }), /* @__PURE__ */ import_react12.default.createElement(ButtonFromConfig, {
40414
+ config: primaryButtonConfig,
40384
40415
  variant: "secondary",
40385
- onClick: onPrimaryButtonClick
40386
- }, primaryButtonText), onClose && /* @__PURE__ */ import_react12.default.createElement("button", {
40416
+ className: "primaryButton"
40417
+ }), onClose && /* @__PURE__ */ import_react12.default.createElement("button", {
40387
40418
  className: "closeAlert",
40388
40419
  onClick: onClose
40389
40420
  }, /* @__PURE__ */ import_react12.default.createElement(Clear_default, {
@@ -40423,32 +40454,24 @@ var SRC = (() => {
40423
40454
  };
40424
40455
  const {
40425
40456
  title = void 0,
40426
- primaryButtonText = void 0,
40427
- secondaryButtonText = void 0,
40457
+ primaryButtonConfig = void 0,
40458
+ secondaryButtonConfig = void 0,
40428
40459
  dismissOnPrimaryButtonClick = false,
40429
40460
  dismissOnSecondaryButtonClick = false
40430
40461
  } = toastMessageOptions;
40431
- let onPrimaryButtonClick;
40432
- if (toastMessageOptions.onPrimaryButtonClick) {
40433
- if (dismissOnPrimaryButtonClick) {
40434
- onPrimaryButtonClick = () => {
40435
- toastMessageOptions.onPrimaryButtonClick();
40436
- onClose();
40437
- };
40438
- } else {
40439
- onPrimaryButtonClick = toastMessageOptions.onPrimaryButtonClick;
40440
- }
40462
+ if (primaryButtonConfig && "onClick" in primaryButtonConfig && dismissOnPrimaryButtonClick) {
40463
+ const onClick = primaryButtonConfig.onClick;
40464
+ primaryButtonConfig.onClick = (e3) => {
40465
+ onClick(e3);
40466
+ onClose();
40467
+ };
40441
40468
  }
40442
- let onSecondaryButtonClickOrHref;
40443
- if (toastMessageOptions.onSecondaryButtonClickOrHref) {
40444
- if (dismissOnSecondaryButtonClick && typeof toastMessageOptions.onSecondaryButtonClickOrHref === "function") {
40445
- onSecondaryButtonClickOrHref = () => {
40446
- toastMessageOptions.onSecondaryButtonClickOrHref();
40447
- onClose();
40448
- };
40449
- } else {
40450
- onSecondaryButtonClickOrHref = toastMessageOptions.onSecondaryButtonClickOrHref;
40451
- }
40469
+ if (secondaryButtonConfig && "onClick" in secondaryButtonConfig && dismissOnSecondaryButtonClick) {
40470
+ const onClick = secondaryButtonConfig.onClick;
40471
+ secondaryButtonConfig.onClick = (e3) => {
40472
+ onClick(e3);
40473
+ onClose();
40474
+ };
40452
40475
  }
40453
40476
  let { autoCloseInMs = 15e3 } = toastMessageOptions;
40454
40477
  if (autoCloseInMs === 0) {
@@ -40461,10 +40484,8 @@ var SRC = (() => {
40461
40484
  show: true,
40462
40485
  title,
40463
40486
  description: message,
40464
- primaryButtonText,
40465
- onPrimaryButtonClick,
40466
- secondaryButtonText,
40467
- onSecondaryButtonClickOrHref
40487
+ primaryButtonConfig,
40488
+ secondaryButtonConfig
40468
40489
  }), {
40469
40490
  id: id2,
40470
40491
  className: "SynapseToastMessage",
@@ -80634,12 +80655,6 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
80634
80655
  var import_react208 = __toModule(require_react());
80635
80656
  var import_react_bootstrap52 = __toModule(require_react_bootstrap());
80636
80657
 
80637
- // src/lib/utils/functions/TooltipUtils.ts
80638
- var rebuildTooltip = debounce_default(() => index_es_default.rebuild(), 200, {
80639
- leading: false,
80640
- trailing: true
80641
- });
80642
-
80643
80658
  // src/lib/containers/EntityLink.tsx
80644
80659
  var import_react207 = __toModule(require_react());
80645
80660
  var EntityLink = (props) => {
@@ -82808,8 +82823,10 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82808
82823
  };
82809
82824
  yield SynapseClient_exports.addFilesToDownloadListV2(req, token2);
82810
82825
  displayToast("File(s) were successfully added to your Download List.", "success", {
82811
- primaryButtonText: "View Download List",
82812
- onPrimaryButtonClick: goToDownloadListFn
82826
+ primaryButtonConfig: {
82827
+ text: "View Download List",
82828
+ onClick: goToDownloadListFn
82829
+ }
82813
82830
  });
82814
82831
  closeConfirmationFn();
82815
82832
  return [0 /* LOADING_INFO */, ""];
@@ -82859,9 +82876,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82859
82876
  fileCount: 0,
82860
82877
  fileSize: 0
82861
82878
  });
82862
- const {
82863
- refetch
82864
- } = useGetDownloadListStatistics();
82879
+ const { refetch } = useGetDownloadListStatistics();
82865
82880
  const lastQueryRequest = getLastQueryRequest();
82866
82881
  const [showDownloadList, setShowDownloadList] = (0, import_react224.useState)(false);
82867
82882
  const updateStats = (0, import_react224.useCallback)((count2, bytes) => __async(void 0, null, function* () {
@@ -82879,10 +82894,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82879
82894
  });
82880
82895
  }
82881
82896
  }), [accessToken]);
82882
- const {
82883
- data: entityChildrenData,
82884
- isSuccess
82885
- } = useGetEntityChildren({
82897
+ const { data: entityChildrenData, isSuccess } = useGetEntityChildren({
82886
82898
  parentId: folderId,
82887
82899
  includeSumFileSizes: true,
82888
82900
  includeTotalChildCount: true,
@@ -82924,7 +82936,11 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82924
82936
  setState(__spreadProps(__spreadValues({}, state), { errorMessage: result[1] }));
82925
82937
  }
82926
82938
  });
82927
- const getContent = ({ fileCount, fileSize, errorMessage }) => {
82939
+ const getContent = ({
82940
+ fileCount,
82941
+ fileSize,
82942
+ errorMessage
82943
+ }) => {
82928
82944
  switch (status) {
82929
82945
  case 0 /* LOADING_INFO */:
82930
82946
  case 1 /* PROCESSING */:
@@ -83477,8 +83493,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83477
83493
  if (error.status === 412) {
83478
83494
  displayToast("Re-retrieve the dataset to get the latest changes. Your current changes will be lost.", "warning", {
83479
83495
  title: "Dataset Updated since Last Fetched",
83480
- primaryButtonText: "Retrieve Dataset",
83481
- onPrimaryButtonClick: refetch
83496
+ primaryButtonConfig: { text: "Retrieve Dataset", onClick: refetch }
83482
83497
  });
83483
83498
  } else {
83484
83499
  displayToast(error.reason, "danger", {
@@ -83805,7 +83820,8 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83805
83820
  HelpPopover,
83806
83821
  ProgrammaticTableDownload: ProgrammaticTableDownload_default,
83807
83822
  DirectProgrammaticDownload: DirectProgrammaticDownload_default,
83808
- ProgrammaticInstructionsModal
83823
+ ProgrammaticInstructionsModal,
83824
+ SkeletonButton
83809
83825
  };
83810
83826
  return umd_index_exports;
83811
83827
  })();