pollination-react-io 1.51.1 → 1.52.1

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.
@@ -1,10 +1,16 @@
1
1
  import React from 'react';
2
2
  import './Card.scss';
3
+ import { APIClient } from '../../hooks';
3
4
  export interface FileCardProps {
5
+ projectOwner?: string;
6
+ projectName?: string;
7
+ client?: APIClient;
8
+ studyId?: string;
9
+ runId?: string;
4
10
  label: string;
5
11
  path: string;
6
12
  description: string;
7
- file?: Blob | File | string;
13
+ file?: Blob | File | string | undefined;
8
14
  onClicked?: (card: FileCardProps) => any;
9
15
  }
10
16
  export declare const FileCard: React.FC<FileCardProps>;
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  export declare enum Action {
2
3
  add = "add",
3
4
  delete = "delete",
@@ -17,5 +18,6 @@ export interface SendGeometryProps {
17
18
  };
18
19
  buttonLabel?: string;
19
20
  geometryOptions?: GeometryOptions;
21
+ style?: CSSProperties;
20
22
  }
21
23
  export {};
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  export declare enum Action {
2
3
  add = "add",
3
4
  delete = "delete",
@@ -13,4 +14,5 @@ export interface SendModelProps {
13
14
  [index in Action]: boolean;
14
15
  };
15
16
  buttonLabel?: string;
17
+ style?: CSSProperties;
16
18
  }
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { XOR } from '../ts-utils';
2
3
  export declare enum Action {
3
4
  add = "add",
@@ -18,5 +19,6 @@ export interface SendResultsProps {
18
19
  };
19
20
  buttonLabel?: string;
20
21
  geometryOptions?: ResultsOptions;
22
+ style?: CSSProperties;
21
23
  }
22
24
  export {};
@@ -1,7 +1,7 @@
1
- import React, { FC, ReactNode } from 'react';
1
+ import React, { CSSProperties, FC, ReactNode } from 'react';
2
2
  import { OptionGroup } from '../Dropdown/Dropdown';
3
3
  export interface SettingsButtonProps {
4
- onClick: () => void;
4
+ onClick: (e?: any) => void;
5
5
  label: string | ReactNode;
6
6
  options?: OptionGroup[];
7
7
  asButtons?: boolean;
@@ -9,6 +9,7 @@ export interface SettingsButtonProps {
9
9
  triggerIcon?: React.ReactNode;
10
10
  helpText?: string;
11
11
  icon?: ReactNode;
12
+ style?: CSSProperties;
12
13
  }
13
14
  export declare const SettingsButton: FC<SettingsButtonProps>;
14
15
  export default SettingsButton;
@@ -3186,7 +3186,7 @@ var Button = function (_a) {
3186
3186
  children));
3187
3187
  };
3188
3188
 
3189
- var css_248z$n = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --primary3: #000;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.btn-group {\n width: fit-content;\n display: flex;\n border-radius: 4px;\n box-sizing: border-box;\n}\n\n.btn-group:hover {\n box-shadow: 0 1px 2px 0 rgba(26, 115, 232, 0.45), 0 1px 3px 1px rgba(26, 115, 232, 0.3);\n}\n\n.btn-group-disabled:hover {\n box-shadow: none;\n}\n\n.btn-group input {\n width: 100%;\n}\n\n.btn-group input::placeholder {\n color: var(--primary1);\n}\n\n.btn-group-disabled input::placeholder {\n color: var(--slate9);\n}\n\n.btn-group * {\n background-color: var(--primary);\n color: white;\n transition: background-color 0.125s ease-in-out;\n}\n\n.btn-group-disabled * {\n background-color: var(--slate5);\n border-color: var(--slate11) !important;\n color: var(--slate11);\n cursor: default !important;\n}\n\n.btn-group i,\n.btn-group svg {\n background-color: rgba(0, 0, 0, 0);\n}\n\n.btn-group button,\n.btn-group input {\n display: flex;\n padding: 8px 10px;\n cursor: pointer;\n float: left;\n z-index: 10;\n align-items: center;\n gap: 8px;\n border: 1px solid var(--primary);\n border-left-color: #096dd9;\n transition: box-shadow 0.125s ease-in-out;\n line-height: 1.5rem;\n}\n\n.btn-group button:active {\n box-shadow: inset 0px 0px 14px 14px #096dd9;\n}\n\n.btn-group button:first-child,\n.btn-group input:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n border-left-color: var(--primary);\n}\n\n.btn-group button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n}\n\n.btn-group button:not(:last-child),\n.btn-group input:not(:last-child) {\n border-right: none;\n}\n\n.btn-group button:focus-visible,\n.btn-group input:focus-visible {\n outline: none;\n}\n\n.btn-group button:focus,\n.btn-group input:focus {\n outline: none;\n}\n\n/* Clear floats (clearfix hack) */\n.btn-group:after {\n content: \"\";\n clear: both;\n display: table;\n}\n\n.btn-group button:hover,\n.btn-group input:hover {\n background-color: var(--primary2);\n z-index: 11;\n}\n\n.btn-group-disabled:hover button:hover {\n box-shadow: none;\n}\n\n.btn-group-disabled:hover button:hover,\n.btn-group-disabled:hover input:hover {\n background-color: var(--slate5);\n}\n\n.options-content {\n font-size: clamp(0.65rem, 8vw - 0.75rem, 0.85rem);\n}";
3189
+ var css_248z$n = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --primary3: #000;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.btn-group {\n width: fit-content;\n display: flex;\n border-radius: 4px;\n box-sizing: border-box;\n}\n\n.btn-group:hover {\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 2px -2px, rgba(0, 0, 0, 0.12) 0px 2px 4px 0px, rgba(0, 0, 0, 0.09) 0px 3px 8px 3px;\n}\n\n.btn-group-disabled:hover {\n box-shadow: none;\n}\n\n.btn-group input {\n width: 100%;\n}\n\n.btn-group input::placeholder {\n color: var(--primary1);\n}\n\n.btn-group-disabled input::placeholder {\n color: var(--slate9);\n}\n\n.btn-group * {\n background-color: var(--primary);\n color: white;\n transition: background-color 0.125s ease-in-out;\n}\n\n.btn-group-disabled * {\n background-color: var(--slate5);\n border-color: var(--slate11) !important;\n color: var(--slate11);\n cursor: default !important;\n}\n\n.btn-group i,\n.btn-group svg {\n background-color: rgba(0, 0, 0, 0);\n}\n\n.btn-group button,\n.btn-group input {\n display: flex;\n padding: 8px 10px;\n cursor: pointer;\n float: left;\n z-index: 10;\n align-items: center;\n gap: 8px;\n border: 1px solid var(--primary);\n border-left-color: var(--primary2);\n transition: box-shadow 0.125s ease-in-out;\n line-height: 1.5rem;\n}\n\n.btn-group button:active {\n box-shadow: inset 0px 0px 7px 7px var(--primary2);\n}\n\n.btn-group button:first-child,\n.btn-group input:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n border-left-color: var(--primary);\n}\n\n.btn-group button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n}\n\n.btn-group button:not(:last-child),\n.btn-group input:not(:last-child) {\n border-right: none;\n}\n\n.btn-group button:focus-visible,\n.btn-group input:focus-visible {\n outline: none;\n}\n\n.btn-group button:focus,\n.btn-group input:focus {\n outline: none;\n}\n\n/* Clear floats (clearfix hack) */\n.btn-group:after {\n content: \"\";\n clear: both;\n display: table;\n}\n\n.btn-group button:hover,\n.btn-group input:hover {\n background-color: var(--primary2);\n z-index: 11;\n}\n\n.btn-group-disabled:hover button:hover {\n box-shadow: none;\n}\n\n.btn-group-disabled:hover button:hover,\n.btn-group-disabled:hover input:hover {\n background-color: var(--slate5);\n}\n\n.options-content {\n font-size: clamp(0.65rem, 8vw - 0.75rem, 0.85rem);\n}";
3190
3190
  styleInject(css_248z$n);
3191
3191
 
3192
3192
  var ButtonGroup = function (_a) {
@@ -13385,7 +13385,10 @@ var Dropdown = function (_a) {
13385
13385
  var _a;
13386
13386
  switch (o.type) {
13387
13387
  case 'checkbox':
13388
- return (React__default.createElement($d08ef79370b62062$export$16ce288f89fa631c, __assign({ key: o.id, className: "poll-select-item", onSelect: function () { return o.onSelect && o.onSelect(o); }, checked: o.checked, disabled: o.disabled }, itemProps),
13388
+ return (React__default.createElement($d08ef79370b62062$export$16ce288f89fa631c, __assign({ key: o.id, className: "poll-select-item", onSelect: function (e) {
13389
+ e.stopPropagation();
13390
+ o.onSelect && o.onSelect(o);
13391
+ }, checked: o.checked, disabled: o.disabled }, itemProps),
13389
13392
  React__default.createElement($d08ef79370b62062$export$c3468e2714d175fa, { style: {
13390
13393
  position: 'absolute',
13391
13394
  display: 'inline-flex',
@@ -13400,7 +13403,10 @@ var Dropdown = function (_a) {
13400
13403
  } }, o.icon),
13401
13404
  o.label));
13402
13405
  case 'radio':
13403
- return (React__default.createElement($d08ef79370b62062$export$371ab307eab489c0, __assign({ key: o.id, className: "poll-select-item", onSelect: function () { return o.onSelect && o.onSelect(o); }, textValue: o.label, value: o.id, disabled: o.disabled }, itemProps),
13406
+ return (React__default.createElement($d08ef79370b62062$export$371ab307eab489c0, __assign({ key: o.id, className: "poll-select-item", onSelect: function (e) {
13407
+ e.stopPropagation();
13408
+ o.onSelect && o.onSelect(o);
13409
+ }, textValue: o.label, value: o.id, disabled: o.disabled }, itemProps),
13404
13410
  React__default.createElement($d08ef79370b62062$export$c3468e2714d175fa, { style: {
13405
13411
  position: 'absolute',
13406
13412
  display: 'inline-flex',
@@ -13412,7 +13418,10 @@ var Dropdown = function (_a) {
13412
13418
  return (React__default.createElement($d08ef79370b62062$export$b04be29aa201d4f5, { key: o.id }, o.label));
13413
13419
  case 'link':
13414
13420
  return (React__default.createElement("a", { href: (_a = o.to) !== null && _a !== void 0 ? _a : '/', key: o.id, style: { color: 'unset' } },
13415
- React__default.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, __assign({ className: "poll-select-item", onSelect: function () { return o.onSelect && o.onSelect(o); } }, itemProps),
13421
+ React__default.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, __assign({ className: "poll-select-item", onSelect: function (e) {
13422
+ e.stopPropagation();
13423
+ o.onSelect && o.onSelect(o);
13424
+ } }, itemProps),
13416
13425
  React__default.createElement("div", { style: {
13417
13426
  position: 'absolute',
13418
13427
  display: 'inline-flex',
@@ -13420,7 +13429,10 @@ var Dropdown = function (_a) {
13420
13429
  } }, o.icon),
13421
13430
  o.label)));
13422
13431
  default:
13423
- return (React__default.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, __assign({ key: o.id, className: "poll-select-item", onSelect: function () { return o.onSelect && o.onSelect(o); }, disabled: o.disabled }, itemProps),
13432
+ return (React__default.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, __assign({ key: o.id, className: "poll-select-item", onSelect: function (e) {
13433
+ e.stopPropagation();
13434
+ o.onSelect && o.onSelect(o);
13435
+ }, disabled: o.disabled }, itemProps),
13424
13436
  React__default.createElement("div", { style: {
13425
13437
  position: 'absolute',
13426
13438
  display: 'inline-flex',
@@ -15712,21 +15724,21 @@ var RadioList = function (_a) {
15712
15724
  };
15713
15725
 
15714
15726
  var SettingsButton = function (_a) {
15715
- var onClick = _a.onClick, label = _a.label, options = _a.options, asButtons = _a.asButtons, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.triggerIcon, triggerIcon = _c === void 0 ? React__default.createElement(CaretDownFill$1, null) : _c, helpText = _a.helpText, _d = _a.icon, icon = _d === void 0 ? React__default.createElement(Logo, null) : _d;
15727
+ var onClick = _a.onClick, label = _a.label, options = _a.options, asButtons = _a.asButtons, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.triggerIcon, triggerIcon = _c === void 0 ? React__default.createElement(CaretDownFill$1, null) : _c, helpText = _a.helpText, _d = _a.icon, icon = _d === void 0 ? React__default.createElement(Logo, null) : _d, _e = _a.style, style = _e === void 0 ? {} : _e;
15716
15728
  return (React__default.createElement(ConditionalWrapper, { condition: typeof helpText !== 'undefined' || disabled, wrapper: function (children) { return React__default.createElement(InputDescription, { helpText: disabled ? 'Enabled in Pollination CAD plugins.' : helpText }, children); } },
15717
15729
  React__default.createElement(ButtonGroup, { disabled: disabled },
15718
- React__default.createElement("button", { type: 'button', onClick: onClick, disabled: disabled, style: {
15719
- flex: 1,
15720
- } },
15730
+ React__default.createElement("button", { type: 'button', onClick: onClick, disabled: disabled, style: __assign(__assign({}, style), { flex: 1 }) },
15721
15731
  icon,
15722
15732
  label),
15723
15733
  options && options.length
15724
15734
  && React__default.createElement(React__default.Fragment, null, asButtons ?
15725
15735
  React__default.createElement(React__default.Fragment, null, options.reduce(function (p, c) { return __spreadArray(__spreadArray([], p, true), c.options, true); }, []).map(function (o) {
15726
15736
  var _a;
15727
- return React__default.createElement("button", { type: 'button', key: o.id, style: {
15728
- boxShadow: !disabled && o.checked ? 'inset 0px 0px 9px 4px #096dd9' : undefined
15729
- }, onClick: function (e) { return o.onSelect && o.onSelect(o); } }, (_a = o.icon) !== null && _a !== void 0 ? _a : o.label);
15737
+ return React__default.createElement("button", { type: 'button', key: o.id, style: __assign(__assign({}, style), { boxShadow: !disabled && o.checked
15738
+ ? style && style['highlight']
15739
+ ? "inset 0px 0px 9px 4px ".concat(style['highlight'])
15740
+ : 'inset 0px 0px 9px 4px #096dd9'
15741
+ : undefined }), onClick: function (e) { return o.onSelect && o.onSelect(o); } }, (_a = o.icon) !== null && _a !== void 0 ? _a : o.label);
15730
15742
  }))
15731
15743
  :
15732
15744
  React__default.createElement(Dropdown, { trigger: (React__default.createElement("button", { type: 'button' }, triggerIcon)), optionGroups: options, contentProps: {
@@ -44291,9 +44303,9 @@ var getAction$2 = function (key) {
44291
44303
  }
44292
44304
  };
44293
44305
  var SendResults = function (_a) {
44294
- var results = _a.results, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Results' : _b, geometryOptions = _a.geometryOptions;
44295
- var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$2.preview), selOpt = _c[0], setSelOpt = _c[1];
44296
- var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
44306
+ var results = _a.results, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Results' : _b, geometryOptions = _a.geometryOptions, _c = _a.style, style = _c === void 0 ? {} : _c;
44307
+ var _d = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$2.preview), selOpt = _d[0], setSelOpt = _d[1];
44308
+ var _e = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _e[0], setKey = _e[1];
44297
44309
  var sendMessage = useSendMessage().sendMessage;
44298
44310
  var disabled = useMemo(function () {
44299
44311
  return !checkPollinationPanel();
@@ -44323,7 +44335,8 @@ var SendResults = function (_a) {
44323
44335
  });
44324
44336
  };
44325
44337
  }, [disabled, geometryOptions, key, results, selOpt, sendMessage]);
44326
- return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
44338
+ return (React__default.createElement(SettingsButton, { style: style, disabled: disabled, onClick: function (e) {
44339
+ e.stopPropagation();
44327
44340
  if (disabled)
44328
44341
  return;
44329
44342
  sendMessage(getAction$2(selOpt), {
@@ -44341,7 +44354,7 @@ var SendResults = function (_a) {
44341
44354
  id: Action$2.preview,
44342
44355
  label: 'Preview',
44343
44356
  checked: selOpt === Action$2.preview,
44344
- icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
44357
+ icon: React__default.createElement(Eyeglasses$1, { size: 16, color: style && style['color'] }),
44345
44358
  disabled: disabled,
44346
44359
  onSelect: function () {
44347
44360
  setSelOpt(function (state) { return (state === Action$2.preview ? undefined : Action$2.preview); });
@@ -44352,7 +44365,7 @@ var SendResults = function (_a) {
44352
44365
  id: Action$2.add,
44353
44366
  label: 'Add',
44354
44367
  checked: selOpt === Action$2.add,
44355
- icon: React__default.createElement(Building$1, { size: 16 }),
44368
+ icon: React__default.createElement(Building$1, { size: 16, color: style && style['color'] }),
44356
44369
  disabled: disabled,
44357
44370
  onSelect: function () {
44358
44371
  setSelOpt(function (state) { return (state === Action$2.add ? undefined : Action$2.add); });
@@ -44363,7 +44376,7 @@ var SendResults = function (_a) {
44363
44376
  id: Action$2.delete,
44364
44377
  label: 'Delete',
44365
44378
  checked: selOpt === Action$2.delete,
44366
- icon: React__default.createElement(Trash$1, { size: 16 }),
44379
+ icon: React__default.createElement(Trash$1, { size: 16, color: style && style['color'] }),
44367
44380
  disabled: disabled,
44368
44381
  onSelect: function () {
44369
44382
  setSelOpt(function (state) { return (state === Action$2.delete ? undefined : Action$2.delete); });
@@ -44374,7 +44387,7 @@ var SendResults = function (_a) {
44374
44387
  id: Action$2.clear,
44375
44388
  label: 'Clear',
44376
44389
  checked: selOpt === Action$2.clear,
44377
- icon: React__default.createElement(Recycle$1, { size: 16 }),
44390
+ icon: React__default.createElement(Recycle$1, { size: 16, color: style && style['color'] }),
44378
44391
  disabled: disabled,
44379
44392
  onSelect: function () {
44380
44393
  setSelOpt(function (state) { return (state === Action$2.clear ? undefined : Action$2.clear); });
@@ -44385,7 +44398,7 @@ var SendResults = function (_a) {
44385
44398
  id: Action$2.subscribePreview,
44386
44399
  label: 'Subscribe Preview',
44387
44400
  checked: selOpt === Action$2.subscribePreview,
44388
- icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
44401
+ icon: React__default.createElement(ArrowRepeat$1, { size: 16, color: style && style['color'] }),
44389
44402
  disabled: disabled,
44390
44403
  onSelect: function () {
44391
44404
  setSelOpt(function (state) { return (state === Action$2.subscribePreview ? undefined : Action$2.subscribePreview); });
@@ -46796,7 +46809,7 @@ var getAction$1 = function (key) {
46796
46809
  }
46797
46810
  };
46798
46811
  var SendGeometry = function (_a) {
46799
- var geometry = _a.geometry, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Geometry' : _b, geometryOptions = _a.geometryOptions;
46812
+ var geometry = _a.geometry, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Geometry' : _b, geometryOptions = _a.geometryOptions, style = _a.style;
46800
46813
  var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$1.preview), selOpt = _c[0], setSelOpt = _c[1];
46801
46814
  var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
46802
46815
  var sendMessage = useSendMessage().sendMessage;
@@ -46825,7 +46838,8 @@ var SendGeometry = function (_a) {
46825
46838
  });
46826
46839
  };
46827
46840
  }, [disabled, geometry, geometryOptions, key, selOpt, sendMessage]);
46828
- return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
46841
+ return (React__default.createElement(SettingsButton, { style: style, disabled: disabled, onClick: function (e) {
46842
+ e.stopPropagation();
46829
46843
  if (disabled)
46830
46844
  return;
46831
46845
  sendMessage(getAction$1(selOpt), {
@@ -46843,7 +46857,7 @@ var SendGeometry = function (_a) {
46843
46857
  id: Action$1.preview,
46844
46858
  label: 'Preview',
46845
46859
  checked: selOpt === Action$1.preview,
46846
- icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
46860
+ icon: React__default.createElement(Eyeglasses$1, { size: 16, color: style && style['color'] }),
46847
46861
  disabled: disabled,
46848
46862
  onSelect: function () {
46849
46863
  setSelOpt(function (state) { return (state === Action$1.preview ? undefined : Action$1.preview); });
@@ -46854,7 +46868,7 @@ var SendGeometry = function (_a) {
46854
46868
  id: Action$1.add,
46855
46869
  label: 'Add',
46856
46870
  checked: selOpt === Action$1.add,
46857
- icon: React__default.createElement(Building$1, { size: 16 }),
46871
+ icon: React__default.createElement(Building$1, { size: 16, color: style && style['color'] }),
46858
46872
  disabled: disabled,
46859
46873
  onSelect: function () {
46860
46874
  setSelOpt(function (state) { return (state === Action$1.add ? undefined : Action$1.add); });
@@ -46865,7 +46879,7 @@ var SendGeometry = function (_a) {
46865
46879
  id: Action$1.delete,
46866
46880
  label: 'Delete',
46867
46881
  checked: selOpt === Action$1.delete,
46868
- icon: React__default.createElement(Trash$1, { size: 16 }),
46882
+ icon: React__default.createElement(Trash$1, { size: 16, color: style && style['color'] }),
46869
46883
  disabled: disabled,
46870
46884
  onSelect: function () {
46871
46885
  setSelOpt(function (state) { return (state === Action$1.delete ? undefined : Action$1.delete); });
@@ -46876,7 +46890,7 @@ var SendGeometry = function (_a) {
46876
46890
  id: Action$1.clear,
46877
46891
  label: 'Clear',
46878
46892
  checked: selOpt === Action$1.clear,
46879
- icon: React__default.createElement(Recycle$1, { size: 16 }),
46893
+ icon: React__default.createElement(Recycle$1, { size: 16, color: style && style['color'] }),
46880
46894
  disabled: disabled,
46881
46895
  onSelect: function () {
46882
46896
  setSelOpt(function (state) { return (state === Action$1.clear ? undefined : Action$1.clear); });
@@ -46887,7 +46901,7 @@ var SendGeometry = function (_a) {
46887
46901
  id: Action$1.subscribePreview,
46888
46902
  label: 'Subscribe Preview',
46889
46903
  checked: selOpt === Action$1.subscribePreview,
46890
- icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
46904
+ icon: React__default.createElement(ArrowRepeat$1, { size: 16, color: style && style['color'] }),
46891
46905
  disabled: disabled,
46892
46906
  onSelect: function () {
46893
46907
  setSelOpt(function (state) { return (state === Action$1.subscribePreview ? undefined : Action$1.subscribePreview); });
@@ -46923,9 +46937,9 @@ var getAction = function (key) {
46923
46937
  }
46924
46938
  };
46925
46939
  var SendModel = function (_a) {
46926
- var hbjson = _a.hbjson, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Model' : _b;
46927
- var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action.preview), selOpt = _c[0], setSelOpt = _c[1];
46928
- var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
46940
+ var hbjson = _a.hbjson, defaultAction = _a.defaultAction, defaultKey = _a.defaultKey, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Send Model' : _b, _c = _a.style, style = _c === void 0 ? {} : _c;
46941
+ var _d = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action.preview), selOpt = _d[0], setSelOpt = _d[1];
46942
+ var _e = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _e[0], setKey = _e[1];
46929
46943
  var sendHbjson = useSendHbjson().sendHbjson;
46930
46944
  var disabled = useMemo(function () {
46931
46945
  return !checkPollinationPanel();
@@ -46958,7 +46972,8 @@ var SendModel = function (_a) {
46958
46972
  });
46959
46973
  };
46960
46974
  }, [disabled, hbjson, key, selOpt, sendHbjson]);
46961
- return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
46975
+ return (React__default.createElement(SettingsButton, { style: style, disabled: disabled, onClick: function (e) {
46976
+ e.stopPropagation();
46962
46977
  if (disabled)
46963
46978
  return;
46964
46979
  sendHbjson(getAction(selOpt), {
@@ -46979,7 +46994,7 @@ var SendModel = function (_a) {
46979
46994
  id: Action.preview,
46980
46995
  label: 'Preview',
46981
46996
  checked: selOpt === Action.preview,
46982
- icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
46997
+ icon: React__default.createElement(Eyeglasses$1, { size: 16, color: style && style['color'] }),
46983
46998
  disabled: disabled,
46984
46999
  onSelect: function () {
46985
47000
  setSelOpt(function (state) { return (state === Action.preview ? undefined : Action.preview); });
@@ -46990,7 +47005,7 @@ var SendModel = function (_a) {
46990
47005
  id: Action.add,
46991
47006
  label: 'Add',
46992
47007
  checked: selOpt === Action.add,
46993
- icon: React__default.createElement(Building$1, { size: 16 }),
47008
+ icon: React__default.createElement(Building$1, { size: 16, color: style && style['color'] }),
46994
47009
  disabled: disabled,
46995
47010
  onSelect: function () {
46996
47011
  setSelOpt(function (state) { return (state === Action.add ? undefined : Action.add); });
@@ -47001,7 +47016,7 @@ var SendModel = function (_a) {
47001
47016
  id: Action.clear,
47002
47017
  label: 'Clear',
47003
47018
  checked: selOpt === Action.clear,
47004
- icon: React__default.createElement(Recycle$1, { size: 16 }),
47019
+ icon: React__default.createElement(Recycle$1, { size: 16, color: style && style['color'] }),
47005
47020
  disabled: disabled,
47006
47021
  onSelect: function () {
47007
47022
  setSelOpt(function (state) { return (state === Action.clear ? undefined : Action.clear); });
@@ -47012,7 +47027,7 @@ var SendModel = function (_a) {
47012
47027
  id: Action.subscribePreview,
47013
47028
  label: 'Subscribe Preview',
47014
47029
  checked: selOpt === Action.subscribePreview,
47015
- icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
47030
+ icon: React__default.createElement(ArrowRepeat$1, { size: 16, color: style && style['color'] }),
47016
47031
  disabled: disabled,
47017
47032
  onSelect: function () {
47018
47033
  setSelOpt(function (state) { return (state === Action.subscribePreview ? undefined : Action.subscribePreview); });
@@ -49168,26 +49183,132 @@ var getFileIcon = function (size, type) {
49168
49183
  }
49169
49184
  };
49170
49185
 
49186
+ var CADtypeEnum;
49187
+ (function (CADtypeEnum) {
49188
+ CADtypeEnum[CADtypeEnum["HBJSON"] = 0] = "HBJSON";
49189
+ CADtypeEnum[CADtypeEnum["VSF"] = 1] = "VSF";
49190
+ })(CADtypeEnum || (CADtypeEnum = {}));
49171
49191
  var FileCard = function (_a) {
49172
49192
  var _b, _c;
49173
- var label = _a.label, path = _a.path, file = _a.file, description = _a.description, onClicked = _a.onClicked;
49193
+ var projectOwner = _a.projectOwner, projectName = _a.projectName, client = _a.client, studyId = _a.studyId, runId = _a.runId, label = _a.label, path = _a.path, file = _a.file, description = _a.description, onClicked = _a.onClicked;
49194
+ var host = getHost();
49174
49195
  var _d = useState(false), open = _d[0], setOpen = _d[1];
49175
49196
  var _e = useState(false), over = _e[0], setOver = _e[1];
49197
+ var _f = useState(true), isLoading = _f[0], setIsLoading = _f[1];
49198
+ // Data to use for CAD injections
49199
+ var _g = useState(), CADdata = _g[0], setCADdata = _g[1];
49200
+ // File to send to parent
49201
+ var _h = useState(), currFile = _h[0], setCurrFile = _h[1];
49202
+ /**
49203
+ * Check if run id is a valid UUID or file path (Local sim)
49204
+ * @param str run id
49205
+ * @returns true or false
49206
+ */
49207
+ var checkIfValidUUID = function (str) {
49208
+ var regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;
49209
+ return regexExp.test(str);
49210
+ };
49211
+ var isCloud = useMemo(function () { return checkIfValidUUID(runId); }, [runId]);
49212
+ var downloadArtifact = useArtifacts(projectOwner, projectName, client).downloadArtifact;
49213
+ var setCADintegration = useCallback(function (file) {
49214
+ if (!file)
49215
+ return;
49216
+ if (host !== 'rhino')
49217
+ return;
49218
+ if (path.endsWith('hbjson')) {
49219
+ var reader_1 = new FileReader();
49220
+ reader_1.readAsText(file);
49221
+ reader_1.onload = function () {
49222
+ var res = reader_1 === null || reader_1 === void 0 ? void 0 : reader_1.result;
49223
+ setCADdata({
49224
+ data: JSON.parse(res),
49225
+ id: path,
49226
+ type: CADtypeEnum.HBJSON
49227
+ });
49228
+ };
49229
+ }
49230
+ else if (path.endsWith('vsf')) {
49231
+ var reader_2 = new FileReader();
49232
+ reader_2.readAsText(file);
49233
+ reader_2.onload = function () {
49234
+ var res = reader_2 === null || reader_2 === void 0 ? void 0 : reader_2.result;
49235
+ setCADdata({
49236
+ data: JSON.parse(res),
49237
+ id: path,
49238
+ type: CADtypeEnum.VSF
49239
+ });
49240
+ };
49241
+ }
49242
+ }, [file]);
49243
+ /**
49244
+ * Fetch file from cloud
49245
+ */
49246
+ var fetchAndSet = function (url) {
49247
+ fetch(url)
49248
+ .then(function (response) { return response.blob()
49249
+ .then(function (blob) {
49250
+ setCurrFile(blob);
49251
+ setCADintegration(blob);
49252
+ }); })
49253
+ .catch(function () { })
49254
+ .finally(function () { return setIsLoading(false); });
49255
+ };
49256
+ useEffect(function () {
49257
+ if (isCloud) {
49258
+ // Generate Blob on click
49259
+ studyId && downloadArtifact(path, studyId)
49260
+ .then(function (url) { return fetchAndSet(url); })
49261
+ .catch(function () { return onClicked({ label: label, path: path, file: undefined, description: description, runId: runId }); });
49262
+ }
49263
+ else {
49264
+ // TODO: Local later...
49265
+ onClicked({ label: label, path: path, file: currFile, description: description, runId: runId });
49266
+ }
49267
+ }, [studyId, runId, label, path]);
49176
49268
  return React__default.createElement("div", { className: 'card-param card-folder', tabIndex: 0, role: 'button', key: label, onClick: function (event) {
49177
49269
  event.stopPropagation();
49178
- onClicked({ label: label, path: path, file: file, description: description });
49270
+ onClicked({ label: label, path: path, file: currFile, description: description });
49179
49271
  } },
49180
49272
  React__default.createElement("div", { className: 'title-param' },
49181
- React__default.createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } },
49273
+ React__default.createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default.createElement("div", null,
49182
49274
  React__default.createElement("span", { style: { margin: '0 8px 0 0' } }, getFileIcon(18, ((_c = (_b = path.split('/')
49183
49275
  .reverse()[0]) === null || _b === void 0 ? void 0 : _b.split('.')) === null || _c === void 0 ? void 0 : _c.pop()) || '')),
49184
- label),
49276
+ label)
49277
+ : React__default.createElement(LoadingIcon, { size: 14 })),
49185
49278
  React__default.createElement("div", { style: { textAlign: 'right' } },
49186
49279
  React__default.createElement("button", { style: { all: 'unset', margin: '0 0 0 8px' }, onMouseOver: function () { return setOver(true); }, onMouseLeave: function () { return setOver(false); }, onClick: function (event) {
49187
49280
  event.stopPropagation();
49188
49281
  setOpen(function (prev) { return !prev; });
49189
49282
  } },
49190
49283
  React__default.createElement(InfoCircle$1, { size: 14, style: over ? { color: '#40a9ff' } : {} })))),
49284
+ CADdata && React__default.createElement("hr", null),
49285
+ React__default.createElement("div", { className: 'value-param' },
49286
+ CADdata && CADdata.type === CADtypeEnum.HBJSON && React__default.createElement(SendModel, { style: {
49287
+ backgroundColor: '#fff',
49288
+ color: 'var(--primary3)',
49289
+ border: '1px solid var(--slate9)',
49290
+ // @ts-ignore
49291
+ highlight: 'var(--slate7)'
49292
+ }, hbjson: CADdata.data, buttonLabel: 'Model', defaultAction: Action.add, optionsConfig: {
49293
+ add: true,
49294
+ delete: false,
49295
+ 'subscribe-preview': false,
49296
+ clear: true,
49297
+ preview: true
49298
+ }, key: CADdata.id, defaultKey: CADdata.id }),
49299
+ CADdata && CADdata.type === CADtypeEnum.VSF && React__default.createElement(SendResults, { style: {
49300
+ backgroundColor: '#fff',
49301
+ color: 'var(--primary3)',
49302
+ border: '1px solid var(--slate9)',
49303
+ // @ts-ignore
49304
+ highlight: 'var(--slate7)'
49305
+ }, results: CADdata.data, buttonLabel: 'Results', defaultAction: Action.add, optionsConfig: {
49306
+ add: true,
49307
+ delete: false,
49308
+ 'subscribe-preview': false,
49309
+ clear: true,
49310
+ preview: true
49311
+ }, key: CADdata.id, defaultKey: CADdata.id })),
49191
49312
  open && React__default.createElement("div", { className: 'card-description' }, description));
49192
49313
  };
49193
49314
 
@@ -49218,16 +49339,6 @@ styleInject(css_248z$2);
49218
49339
 
49219
49340
  var RunContent = function (_a) {
49220
49341
  var inputData = _a.inputData, projectOwner = _a.projectOwner, projectName = _a.projectName, studyId = _a.studyId, runId = _a.runId, client = _a.client, title = _a.title, style = _a.style, getFileCard = _a.getFileCard, getFolderCard = _a.getFolderCard;
49221
- var downloadArtifact = useArtifacts(projectOwner, projectName, client).downloadArtifact;
49222
- var fetchAndSet = function (url, card) {
49223
- fetch(url)
49224
- .then(function (response) { return response.blob()
49225
- .then(function (blob) {
49226
- blob.type;
49227
- getFileCard(__assign(__assign({}, card), { file: blob }));
49228
- }); })
49229
- .catch(function () { });
49230
- };
49231
49342
  var _b = useState([]), currData = _b[0], setCurrData = _b[1];
49232
49343
  var _c = useState([]), currParams = _c[0], setCurrParams = _c[1];
49233
49344
  var _d = useState([]), currFiles = _d[0], setCurrFiles = _d[1];
@@ -49243,7 +49354,7 @@ var RunContent = function (_a) {
49243
49354
  switch (i.type) {
49244
49355
  case 'StepFileInput':
49245
49356
  case 'StepFileOutput':
49246
- files.push({ label: i.name,
49357
+ files.push({ runId: runId, label: i.name,
49247
49358
  path: i.source.path, description: i.description });
49248
49359
  break;
49249
49360
  case 'StepFolderInput':
@@ -49271,16 +49382,7 @@ var RunContent = function (_a) {
49271
49382
  * @param card File card props
49272
49383
  */
49273
49384
  var onFileClicked = function (card) {
49274
- if (isCloud) {
49275
- // Generate Blob on click
49276
- studyId && downloadArtifact(card.path, studyId)
49277
- .then(function (url) { return fetchAndSet(url, card); })
49278
- .catch(function () { return getFileCard(__assign(__assign({}, card), { file: undefined })); });
49279
- }
49280
- else {
49281
- // TODO: Local later...
49282
- getFileCard(__assign(__assign({}, card), { file: card.path }));
49283
- }
49385
+ getFileCard(card);
49284
49386
  };
49285
49387
  /**
49286
49388
  * Click event handler of the folder card
@@ -49288,21 +49390,21 @@ var RunContent = function (_a) {
49288
49390
  */
49289
49391
  var onFolderClicked = function (card) {
49290
49392
  if (isCloud) {
49291
- getFolderCard(__assign({}, card));
49393
+ getFolderCard(card);
49292
49394
  // window.location.href = `/${projectOwner}/projects/${projectName}/studies/${studyId}/runs/${runId}/workspace?path=${card.path}`
49293
49395
  }
49294
49396
  else {
49295
49397
  // TODO: Fix it later when Local is ready
49296
- getFolderCard(__assign({}, card));
49398
+ getFolderCard(card);
49297
49399
  // alert(runId.concat('/').concat(card.path))
49298
49400
  }
49299
49401
  };
49300
49402
  return React__default.createElement("div", { className: 'cards-container', style: __assign({}, style) },
49301
49403
  React__default.createElement("h5", { className: 'cards-container-title' }, title || 'Something'),
49302
- currFiles.length > 0 && React__default.createElement("div", { style: { padding: '20px' } },
49404
+ currFiles.length > 0 && projectOwner && projectName && client && runId && React__default.createElement("div", { style: { padding: '20px' } },
49303
49405
  React__default.createElement("div", { className: 'cards' }, currFiles.map(function (_a, index) {
49304
49406
  var label = _a.label, path = _a.path, description = _a.description;
49305
- return React__default.createElement(FileCard, { key: "filecard-".concat(index), label: label, path: path, description: description, onClicked: onFileClicked });
49407
+ return React__default.createElement(FileCard, { projectOwner: projectOwner, projectName: projectName, studyId: studyId, runId: runId, client: client, key: "filecard-".concat(index), label: label, path: path, description: description, onClicked: onFileClicked });
49306
49408
  }))),
49307
49409
  currFolders.length > 0 && React__default.createElement("div", { style: { padding: '20px' } },
49308
49410
  React__default.createElement("div", { className: 'cards' }, currFolders.map(function (_a, index) {