@parallelworks/ui 0.1.0 → 0.2.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/assets/editor.worker-CuBRIwi-.js +14776 -0
- package/dist/assets/json.worker-8ytS02vz.js +22161 -0
- package/dist/assets/yaml.worker-DJC-VUcv.js +48367 -0
- package/dist/chunks/Indicator-fF8AVbjQ.js +158 -0
- package/dist/chunks/Loader-DQiZ75fa.js +25 -0
- package/dist/chunks/MarkdownImpl-Bq4QhrtA.js +33 -0
- package/dist/chunks/Monaco-CP_cL9gp.js +745 -0
- package/dist/chunks/Provider-C2VtPnh5.js +151 -0
- package/dist/chunks/SwitchToggleSmall-FcsaYSTs.js +14 -0
- package/dist/chunks/Table-DWuRINhu.js +855 -0
- package/dist/chunks/Tooltip-WgbiC_nd.js +71 -0
- package/dist/chunks/lib-DTgL8klR.js +191 -0
- package/dist/chunks/workers-Cjfjb8E7.js +119 -0
- package/dist/components/CollapsiblePanel.d.ts +27 -0
- package/dist/components/CopyToClipboard.d.ts +17 -0
- package/dist/components/Dropdown.d.ts +24 -0
- package/dist/components/Indicator.d.ts +4 -0
- package/dist/components/Listbox.d.ts +18 -0
- package/dist/components/Markdown.d.ts +7 -0
- package/dist/components/MarkdownImpl.d.ts +2 -0
- package/dist/components/MultiSelect.d.ts +19 -0
- package/dist/components/Overview.d.ts +12 -0
- package/dist/components/Provider.d.ts +145 -0
- package/dist/components/SectionHeader.d.ts +6 -0
- package/dist/components/SwitchToggle.d.ts +12 -0
- package/dist/components/SwitchToggleSmall.d.ts +6 -0
- package/dist/components/dropdownUtils.d.ts +18 -0
- package/dist/editor/Editor.d.ts +2 -0
- package/dist/editor/EditorField.d.ts +11 -0
- package/dist/editor/FormCodePanel.d.ts +8 -0
- package/dist/editor/Monaco.d.ts +31 -0
- package/dist/editor/index.d.ts +6 -0
- package/dist/editor/index.js +219 -0
- package/dist/editor/themes.d.ts +4 -0
- package/dist/editor/workers.d.ts +6 -0
- package/dist/form/FieldWrapper.d.ts +10 -0
- package/dist/form/Fields/BooleanField.d.ts +12 -0
- package/dist/form/Fields/BucketReadOnlyField.d.ts +7 -0
- package/dist/form/Fields/CheckboxGroupField.d.ts +18 -0
- package/dist/form/Fields/ColorField.d.ts +8 -0
- package/dist/form/Fields/DropdownField.d.ts +24 -0
- package/dist/form/Fields/DurationField.d.ts +13 -0
- package/dist/form/Fields/LabelField.d.ts +9 -0
- package/dist/form/Fields/MultiDropdownField.d.ts +18 -0
- package/dist/form/Fields/NumberField.d.ts +13 -0
- package/dist/form/Fields/ObjectField.d.ts +8 -0
- package/dist/form/Fields/RadioField.d.ts +9 -0
- package/dist/form/Fields/RangeField.d.ts +11 -0
- package/dist/form/Fields/ResourceOptionIcon.d.ts +11 -0
- package/dist/form/Fields/StepField.d.ts +3 -0
- package/dist/form/Fields/StringField.d.ts +17 -0
- package/dist/form/Fields/TextAreaField.d.ts +8 -0
- package/dist/form/Fields/durationValidity.d.ts +2 -0
- package/dist/form/Form.d.ts +105 -0
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +14 -0
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +53 -0
- package/dist/form/SpecialTypes/FormikCustomInput.d.ts +17 -0
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +13 -0
- package/dist/form/SpecialTypes/FormikNumericInput.d.ts +9 -0
- package/dist/form/SpecialTypes/index.d.ts +3 -0
- package/dist/form/Wizard/WizardContainer.d.ts +5 -0
- package/dist/form/Wizard/WizardNavigation.d.ts +2 -0
- package/dist/form/Wizard/WizardStepContent.d.ts +8 -0
- package/dist/form/Wizard/WizardStepIndicator.d.ts +2 -0
- package/dist/form/Wizard/types.d.ts +171 -0
- package/dist/form/Wizard/useWizardState.d.ts +28 -0
- package/dist/form/Wizard/utils.d.ts +2 -0
- package/dist/form/fieldRegistry.d.ts +7 -0
- package/dist/form/index.d.ts +16 -0
- package/dist/form/index.js +2317 -0
- package/dist/form/lib.d.ts +15 -0
- package/dist/form/types/fieldComponentTypes.d.ts +32 -0
- package/dist/form/types/fieldTypes.d.ts +80 -0
- package/dist/form/types/workflow-schema.d.ts +1107 -0
- package/dist/form/useParsedOpts.d.ts +5 -0
- package/dist/form/usePrevious.d.ts +1 -0
- package/dist/form/utils/checkShowIfObject.d.ts +1 -0
- package/dist/form/utils/getParentValue.d.ts +1 -0
- package/dist/form/utils/getPlaceholder.d.ts +2 -0
- package/dist/form/utils/getValueUsingPath.d.ts +1 -0
- package/dist/form/utils/pwResolver.d.ts +18 -0
- package/dist/form/utils/secondaryField.d.ts +8 -0
- package/dist/form/utils/slurmDuration.d.ts +15 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +2 -2
- package/dist/index.d.ts +17 -0
- package/dist/index.js +107 -323
- package/dist/logviewer/LogViewer.d.ts +18 -0
- package/dist/logviewer/index.d.ts +1 -0
- package/dist/logviewer/index.js +534 -0
- package/dist/logviewer/logviewer.css +70 -0
- package/dist/styles.css +1 -1
- package/dist/workflow/AnnotationBanner.d.ts +5 -0
- package/dist/workflow/Collapse.d.ts +6 -0
- package/dist/workflow/DependencyGraph.d.ts +15 -0
- package/dist/workflow/JobSummary.d.ts +38 -0
- package/dist/workflow/MatrixGroup.d.ts +41 -0
- package/dist/workflow/Reveal.d.ts +7 -0
- package/dist/workflow/TreeView.d.ts +42 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +2330 -0
- package/package.json +60 -6
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { CancelIcon, FailIcon, NotRunningIcon, RunningIcon, SkipIcon, SuccessIcon } from "../icons.js";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
//#region src/components/Modal.tsx
|
|
7
|
+
var FOCUSABLE = "a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])";
|
|
8
|
+
var noop = () => {};
|
|
9
|
+
var actionClasses = {
|
|
10
|
+
destructive: "bg-red-600 text-white hover:bg-red-700",
|
|
11
|
+
warning: "bg-yellow-500 text-white hover:bg-yellow-700",
|
|
12
|
+
info: "bg-(--theme-element,#06354f) text-(--theme-element-text,#ffffff) hover:opacity-90"
|
|
13
|
+
};
|
|
14
|
+
function Modal({ isOpen, close, cancelAction = noop, children, title = "", text = "", actionLabel = "", cancelLabel = "Cancel", action, closeAfterAction = true, type = "destructive", className = "", showButtons = true, disableAction = false, loading = false, padding = true, fitWidth = false, dimScreen = true, ignoreOutsideClickClose = false }) {
|
|
15
|
+
const [pending, setPending] = useState(false);
|
|
16
|
+
const actionFiredRef = useRef(false);
|
|
17
|
+
const panelRef = useRef(null);
|
|
18
|
+
const titleId = useId();
|
|
19
|
+
const inFlight = loading || pending;
|
|
20
|
+
const inFlightRef = useRef(inFlight);
|
|
21
|
+
inFlightRef.current = inFlight;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isOpen) actionFiredRef.current = false;
|
|
24
|
+
}, [isOpen]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!isOpen) return;
|
|
27
|
+
const previouslyFocused = document.activeElement;
|
|
28
|
+
const previousOverflow = document.body.style.overflow;
|
|
29
|
+
document.body.style.overflow = "hidden";
|
|
30
|
+
panelRef.current?.focus();
|
|
31
|
+
return () => {
|
|
32
|
+
document.body.style.overflow = previousOverflow;
|
|
33
|
+
previouslyFocused?.focus?.();
|
|
34
|
+
};
|
|
35
|
+
}, [isOpen]);
|
|
36
|
+
const trapFocus = useCallback((e) => {
|
|
37
|
+
if (e.key !== "Tab" || !panelRef.current) return;
|
|
38
|
+
const focusable = panelRef.current.querySelectorAll(FOCUSABLE);
|
|
39
|
+
if (focusable.length === 0) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const first = focusable[0];
|
|
44
|
+
const last = focusable[focusable.length - 1];
|
|
45
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
last.focus();
|
|
48
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
first.focus();
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
const closeRef = useRef(close);
|
|
54
|
+
closeRef.current = close;
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!isOpen) return;
|
|
57
|
+
const onKey = (e) => {
|
|
58
|
+
if (e.key === "Escape" && !inFlightRef.current) closeRef.current();
|
|
59
|
+
};
|
|
60
|
+
window.addEventListener("keydown", onKey);
|
|
61
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
62
|
+
}, [isOpen]);
|
|
63
|
+
const runAction = useCallback(async () => {
|
|
64
|
+
if (actionFiredRef.current) return;
|
|
65
|
+
actionFiredRef.current = true;
|
|
66
|
+
setPending(true);
|
|
67
|
+
try {
|
|
68
|
+
await action?.();
|
|
69
|
+
if (closeAfterAction) closeRef.current();
|
|
70
|
+
else actionFiredRef.current = false;
|
|
71
|
+
} finally {
|
|
72
|
+
setPending(false);
|
|
73
|
+
}
|
|
74
|
+
}, [action, closeAfterAction]);
|
|
75
|
+
if (!isOpen) return null;
|
|
76
|
+
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
77
|
+
className: "fixed z-250 inset-0 flex w-screen items-center justify-center p-4",
|
|
78
|
+
role: "dialog",
|
|
79
|
+
"aria-modal": "true",
|
|
80
|
+
...title ? { "aria-labelledby": titleId } : {},
|
|
81
|
+
onKeyDown: trapFocus,
|
|
82
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: cx("fixed inset-0", dimScreen && "bg-gray-500/75"),
|
|
84
|
+
onClick: inFlight || ignoreOutsideClickClose ? void 0 : close
|
|
85
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
86
|
+
ref: panelRef,
|
|
87
|
+
tabIndex: -1,
|
|
88
|
+
className: cx(className, "relative inline-block align-bottom rounded-lg text-left shadow-xl z-50 sm:my-8 sm:align-middle max-h-full overflow-y-auto", "bg-(--theme-panel-bg,#ffffff) text-(--theme-panel,#000000)", padding && "px-4 pt-5 pb-4 sm:p-6", fitWidth ? "sm:w-min-[32rem]" : "sm:max-w-lg sm:w-full"),
|
|
89
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [title && /* @__PURE__ */ jsx("h3", {
|
|
90
|
+
id: titleId,
|
|
91
|
+
className: "text-center text-xl leading-6 font-semibold",
|
|
92
|
+
children: title
|
|
93
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: cx(title.length !== 0 && "mt-2"),
|
|
95
|
+
children: [text && /* @__PURE__ */ jsx("p", {
|
|
96
|
+
className: "text-sm text-center",
|
|
97
|
+
children: text
|
|
98
|
+
}), children]
|
|
99
|
+
})] }), showButtons && /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: "mt-5 sm:mt-6 grid grid-cols-2 gap-3 grid-flow-row-dense",
|
|
101
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
102
|
+
type: "button",
|
|
103
|
+
className: cx("self-center cursor-pointer px-3 py-1.5 rounded-md text-xs font-medium whitespace-nowrap flex items-center justify-center", "border border-(--theme-border,#d1d5db) hover:bg-(--theme-hover,#f3f4f6)", inFlight && "cursor-wait"),
|
|
104
|
+
onClick: () => {
|
|
105
|
+
cancelAction();
|
|
106
|
+
close();
|
|
107
|
+
},
|
|
108
|
+
disabled: inFlight,
|
|
109
|
+
children: cancelLabel
|
|
110
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
className: cx("self-center cursor-pointer px-3 py-1.5 rounded-md text-xs font-medium whitespace-nowrap flex items-center justify-center", "disabled:opacity-50 disabled:cursor-not-allowed", actionClasses[type], loading && "cursor-wait"),
|
|
113
|
+
onClick: runAction,
|
|
114
|
+
disabled: disableAction || inFlight,
|
|
115
|
+
children: actionLabel
|
|
116
|
+
})]
|
|
117
|
+
})]
|
|
118
|
+
})]
|
|
119
|
+
}), document.body);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/components/Indicator.tsx
|
|
123
|
+
function Indicator({ status }) {
|
|
124
|
+
return /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "h-2 flex items-center text-(--theme-panel-bg)",
|
|
126
|
+
children: status === "started" || status === "running" ? /* @__PURE__ */ jsx(RunningIcon, {
|
|
127
|
+
className: "rounded-full text-[#FFCF00] animate-spin",
|
|
128
|
+
"data-testid": "running-indicator"
|
|
129
|
+
}) : status === "completed" ? /* @__PURE__ */ jsx(SuccessIcon, {
|
|
130
|
+
className: "text-[#6FBF5A]",
|
|
131
|
+
style: { transform: "scale(1.25)" },
|
|
132
|
+
"data-testid": "completed-indicator"
|
|
133
|
+
}) : status === "failed" || status === "error" ? /* @__PURE__ */ jsx(FailIcon, {
|
|
134
|
+
className: "text-red-500",
|
|
135
|
+
style: { transform: "scale(1.25)" },
|
|
136
|
+
"data-testid": "failed-indicator"
|
|
137
|
+
}) : status === "skipped" || status === "skipped-failed" ? /* @__PURE__ */ jsx(SkipIcon, {
|
|
138
|
+
className: "text-gray-400",
|
|
139
|
+
style: { transform: "scale(1.25)" },
|
|
140
|
+
"data-testid": "skipped-indicator"
|
|
141
|
+
}) : status === "canceled" ? /* @__PURE__ */ jsx(CancelIcon, {
|
|
142
|
+
className: "text-[#3B82F6]",
|
|
143
|
+
style: { transform: "scale(1.5)" },
|
|
144
|
+
"data-testid": "canceled-indicator"
|
|
145
|
+
}) : status === "faulted" ? /* @__PURE__ */ jsx(RunningIcon, {
|
|
146
|
+
className: "rounded-full text-[#EF4444] animate-spin",
|
|
147
|
+
"data-testid": "faulted-indicator"
|
|
148
|
+
}) : status === "canceling" ? /* @__PURE__ */ jsx(RunningIcon, {
|
|
149
|
+
className: "rounded-full text-[#3B82F6] animate-spin",
|
|
150
|
+
"data-testid": "canceling-indicator"
|
|
151
|
+
}) : /* @__PURE__ */ jsx(NotRunningIcon, {
|
|
152
|
+
className: "rounded-full text-[#AAAAAA]",
|
|
153
|
+
"data-testid": "not-running-indicator"
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
158
|
+
export { Modal as n, Indicator as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LoaderIcon } from "../icons.js";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Loader.tsx
|
|
5
|
+
function Loader({ size = 48, text, textSize = 12, full = true, color = "", loaderStyle = {} }) {
|
|
6
|
+
const loaderColor = color || "text-(--theme-element,#3b82f6)";
|
|
7
|
+
const fontSize = typeof size === "number" ? `${size}px` : size;
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
9
|
+
className: cx(full && "w-full", "flex flex-col flex-wrap justify-center items-center gap-y-1"),
|
|
10
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: cx("w-full flex justify-center items-center", loaderColor),
|
|
12
|
+
style: loaderStyle,
|
|
13
|
+
children: /* @__PURE__ */ jsx(LoaderIcon, {
|
|
14
|
+
className: "animate-spin",
|
|
15
|
+
style: { fontSize }
|
|
16
|
+
})
|
|
17
|
+
}), text && /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: "text-center italic",
|
|
19
|
+
style: { fontSize: `${textSize}px` },
|
|
20
|
+
children: text
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Loader as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Streamdown } from "streamdown";
|
|
4
|
+
import { code } from "@streamdown/code";
|
|
5
|
+
import { math } from "@streamdown/math";
|
|
6
|
+
//#region src/components/MarkdownImpl.tsx
|
|
7
|
+
var plugins = {
|
|
8
|
+
code,
|
|
9
|
+
math
|
|
10
|
+
};
|
|
11
|
+
var shikiTheme = ["github-light", "github-dark"];
|
|
12
|
+
function Markdown({ children, isStreaming, controls }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
className: "markdown whitespace-normal text-start w-full",
|
|
15
|
+
children: /* @__PURE__ */ jsx(Streamdown, {
|
|
16
|
+
mode: isStreaming ? "streaming" : "static",
|
|
17
|
+
isAnimating: isStreaming ?? false,
|
|
18
|
+
...isStreaming ? { caret: "block" } : {},
|
|
19
|
+
...controls ? { controls } : {},
|
|
20
|
+
plugins,
|
|
21
|
+
shikiTheme,
|
|
22
|
+
components: { a: ({ node, ...props }) => /* @__PURE__ */ jsx("a", {
|
|
23
|
+
...props,
|
|
24
|
+
className: cx("link wrap-break-word", props.className),
|
|
25
|
+
target: "_blank",
|
|
26
|
+
rel: "noopener noreferrer"
|
|
27
|
+
}) },
|
|
28
|
+
children: children || ""
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Markdown as default };
|