@parallelworks/ui 0.19.1 → 0.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/README.md +1 -1
- package/dist/ai/adapter/openai/createOpenAIStream.js +3 -2
- package/dist/ai/agent/diff.d.ts +0 -1
- package/dist/ai/agent/diff.js +3 -2
- package/dist/ai/agent/toolfmt.js +2 -3
- package/dist/ai/ai.css +5 -0
- package/dist/ai/components/AllocationSelector.js +3 -2
- package/dist/ai/components/AttachmentManager.js +5 -2
- package/dist/ai/components/BranchNavigator.js +4 -2
- package/dist/ai/components/ChatInput.d.ts +2 -5
- package/dist/ai/components/ChatInput.js +10 -7
- package/dist/ai/components/ChatMessage.js +11 -8
- package/dist/ai/components/ChatSidebar.d.ts +0 -1
- package/dist/ai/components/ChatSidebar.js +4 -6
- package/dist/ai/components/ChatThread.js +5 -8
- package/dist/ai/components/ModelSelector.js +3 -2
- package/dist/ai/components/ShareDialog.js +6 -3
- package/dist/ai/components/SlashMenu.d.ts +0 -1
- package/dist/ai/components/agent/ActivityLine.d.ts +0 -1
- package/dist/ai/components/agent/ActivityLine.js +2 -2
- package/dist/ai/components/agent/AgentMessageParts.d.ts +1 -26
- package/dist/ai/components/agent/AgentMessageParts.js +4 -5
- package/dist/ai/core/ChatProvider.d.ts +2 -6
- package/dist/ai/core/ChatProvider.js +42 -67
- package/dist/ai/core/KeyboardShortcutsProvider.js +1 -1
- package/dist/ai/core/chatReducer.d.ts +0 -6
- package/dist/ai/core/chatReducer.js +1 -15
- package/dist/ai/core/config.js +2 -1
- package/dist/ai/core/useKeyboardShortcuts.d.ts +3 -1
- package/dist/ai/core/useKeyboardShortcuts.js +9 -11
- package/dist/ai/core/useSSEStream.d.ts +0 -1
- package/dist/ai/core/useSSEStream.js +5 -17
- package/dist/ai/strings.d.ts +0 -1
- package/dist/ai/strings.js +0 -1
- package/dist/ai/types.d.ts +1 -1
- package/dist/ai/ui/Avatar.d.ts +1 -2
- package/dist/ai/ui/Avatar.js +7 -18
- package/dist/ai/ui/Markdown.d.ts +1 -3
- package/dist/ai/ui/Markdown.js +1 -2
- package/dist/ai/ui/sidebar.d.ts +0 -1
- package/dist/ai/ui/sidebar.js +3 -1
- package/dist/ai/utils.js +1 -1
- package/dist/assets/editor.worker-DfmPPyOL.js +60 -0
- package/dist/assets/json.worker-Dqgjpq9F.js +92 -0
- package/dist/assets/yaml.worker-DLx0whrM.js +1441 -0
- package/dist/components/Avatar.js +4 -2
- package/dist/components/BareModal.js +1 -5
- package/dist/components/Breadcrumbs.js +21 -14
- package/dist/components/CollapsiblePanel.d.ts +1 -3
- package/dist/components/CollapsiblePanel.js +5 -5
- package/dist/components/Dropdown.d.ts +0 -4
- package/dist/components/Dropdown.js +5 -6
- package/dist/components/Listbox.js +14 -18
- package/dist/components/MultiSelect.js +5 -8
- package/dist/components/Pagination.js +1 -1
- package/dist/components/Provider.d.ts +0 -8
- package/dist/components/Provider.js +12 -4
- package/dist/components/SwitchToggle.js +3 -5
- package/dist/components/Table.d.ts +1 -3
- package/dist/components/dropdownUtils.js +5 -6
- package/dist/components/relativeTime.d.ts +0 -7
- package/dist/components/relativeTime.js +1 -1
- package/dist/duration.js +1 -1
- package/dist/editor/Editor.d.ts +1 -1
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/EditorField.d.ts +0 -1
- package/dist/editor/EditorField.js +8 -8
- package/dist/editor/FormCodePanel.js +14 -20
- package/dist/editor/Monaco.js +2 -25
- package/dist/editor/workers.d.ts +5 -0
- package/dist/editor/workers.js +14 -8
- package/dist/editor/yaml.d.ts +9 -1
- package/dist/editor/yaml.worker.d.ts +1 -0
- package/dist/editor/yamlLanguage.d.ts +6 -0
- package/dist/editor/yamlLanguage.js +312 -0
- package/dist/file-explorer/FileExplorer.js +60 -60
- package/dist/file-explorer/FileExplorerContext.d.ts +1 -2
- package/dist/file-explorer/FileExplorerContext.js +92 -125
- package/dist/file-explorer/FilePreview/Inline.d.ts +1 -2
- package/dist/file-explorer/FilePreview/Inline.js +2 -2
- package/dist/file-explorer/FilePreview/Viewer.js +0 -4
- package/dist/file-explorer/FilePreview/index.d.ts +1 -2
- package/dist/file-explorer/FilePreview/index.js +3 -3
- package/dist/file-explorer/FilePreview/parse.d.ts +2 -1
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.d.ts +5 -4
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.js +23 -36
- package/dist/file-explorer/FilePreview/useObjectText.d.ts +1 -2
- package/dist/file-explorer/FilePreview/useObjectText.js +5 -7
- package/dist/file-explorer/FileRow.js +1 -1
- package/dist/file-explorer/FileRowsWindow.d.ts +5 -12
- package/dist/file-explorer/FileTable.d.ts +2 -6
- package/dist/file-explorer/LoadMoreRow.d.ts +8 -0
- package/dist/file-explorer/TreeView.d.ts +0 -1
- package/dist/file-explorer/TreeView.js +6 -6
- package/dist/file-explorer/helpers.js +2 -4
- package/dist/file-explorer/lib/fileExplorer.d.ts +0 -2
- package/dist/file-explorer/lib/types.d.ts +0 -1
- package/dist/file-explorer/lib/utils.js +15 -20
- package/dist/file-explorer/toasts.js +36 -34
- package/dist/form/Fields/BooleanField.js +5 -4
- package/dist/form/Fields/CheckboxGroupField.js +5 -4
- package/dist/form/Fields/ColorField.js +5 -4
- package/dist/form/Fields/DropdownField.d.ts +0 -1
- package/dist/form/Fields/DropdownField.js +10 -13
- package/dist/form/Fields/DurationField.js +2 -2
- package/dist/form/Fields/LabelField.js +5 -5
- package/dist/form/Fields/MultiDropdownField.d.ts +1 -1
- package/dist/form/Fields/MultiDropdownField.js +8 -11
- package/dist/form/Fields/NumberField.js +6 -5
- package/dist/form/Fields/ObjectField.d.ts +1 -2
- package/dist/form/Fields/ObjectField.js +22 -21
- package/dist/form/Fields/RadioField.js +4 -3
- package/dist/form/Fields/RangeField.js +7 -6
- package/dist/form/Fields/StringField.js +2 -1
- package/dist/form/Fields/TextAreaField.js +2 -1
- package/dist/form/Form.d.ts +7 -8
- package/dist/form/Form.js +52 -78
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -2
- package/dist/form/SpecialTypes/DropdownWrapper.js +1 -3
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +1 -3
- package/dist/form/SpecialTypes/FormikCustomDropdown.js +4 -7
- package/dist/form/SpecialTypes/FormikCustomInput.js +13 -11
- package/dist/form/Wizard/WizardContainer.js +8 -25
- package/dist/form/Wizard/WizardNavigation.d.ts +1 -1
- package/dist/form/Wizard/WizardNavigation.js +5 -6
- package/dist/form/Wizard/WizardStepContent.d.ts +1 -1
- package/dist/form/Wizard/WizardStepContent.js +2 -2
- package/dist/form/Wizard/WizardStepIndicator.js +7 -17
- package/dist/form/Wizard/types.d.ts +4 -46
- package/dist/form/Wizard/useWizardState.d.ts +2 -10
- package/dist/form/Wizard/useWizardState.js +42 -92
- package/dist/form/Wizard/utils.js +6 -11
- package/dist/form/lib.js +28 -54
- package/dist/form/types/fieldTypes.d.ts +4 -5
- package/dist/form/utils/dependentOptions.d.ts +6 -0
- package/dist/form/utils/dependentOptions.js +21 -0
- package/dist/form/utils/getParentValue.d.ts +2 -1
- package/dist/form/utils/getParentValue.js +10 -15
- package/dist/form/utils/getValueUsingPath.js +1 -1
- package/dist/graph/AnnotationBanner.d.ts +1 -1
- package/dist/graph/AnnotationBanner.js +1 -1
- package/dist/graph/Collapse.d.ts +3 -3
- package/dist/graph/Collapse.js +3 -8
- package/dist/graph/DependencyGraph.d.ts +5 -4
- package/dist/graph/DependencyGraph.js +172 -222
- package/dist/graph/JobSummary.d.ts +10 -8
- package/dist/graph/JobSummary.js +13 -13
- package/dist/graph/MatrixGroup.d.ts +5 -17
- package/dist/graph/MatrixGroup.js +11 -22
- package/dist/graph/TreeView.d.ts +1 -3
- package/dist/graph/TreeView.js +104 -491
- package/dist/graph/types.d.ts +3 -2
- package/dist/graph/util.d.ts +5 -0
- package/dist/graph/util.js +18 -0
- package/dist/icons.d.ts +5 -5
- package/dist/icons.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/list/ListViewControls.js +17 -35
- package/dist/list/RowContextMenu.js +9 -8
- package/dist/list/UserHoverCard.js +5 -5
- package/dist/logviewer/LogViewer.js +7 -9
- package/dist/logviewer/segments.js +2 -2
- package/dist/safeUrl.d.ts +6 -0
- package/dist/safeUrl.js +22 -0
- package/dist/styles/theme.css +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme/index.js +5 -5
- package/package.json +33 -37
- package/dist/ai/ui/buttons.d.ts +0 -1
- package/dist/assets/editor.worker-BmHUIVG4.js +0 -14807
- package/dist/assets/json.worker-D8bJ92nw.js +0 -22207
- package/dist/assets/yaml.worker-C4gyGAko.js +0 -50201
package/dist/form/Form.js
CHANGED
|
@@ -8,10 +8,10 @@ import SectionHeader from "../components/SectionHeader.js";
|
|
|
8
8
|
import { Table } from "../components/Table.js";
|
|
9
9
|
import { useFieldControlProps, useFieldRequired } from "./fieldContext.js";
|
|
10
10
|
import { resolvedFlag } from "./lib.js";
|
|
11
|
+
import { getValueUsingPath } from "./utils/getValueUsingPath.js";
|
|
11
12
|
import { FieldRegistryContext, Registry } from "./fieldRegistry.js";
|
|
12
13
|
import { useParsedOpts } from "./useParsedOpts.js";
|
|
13
14
|
import { usePrevious } from "./usePrevious.js";
|
|
14
|
-
import { getValueUsingPath } from "./utils/getValueUsingPath.js";
|
|
15
15
|
import { getParentValue } from "./utils/getParentValue.js";
|
|
16
16
|
import { parseWizardConfig } from "./Wizard/utils.js";
|
|
17
17
|
import { WizardContainer } from "./Wizard/WizardContainer.js";
|
|
@@ -71,8 +71,7 @@ function collectFieldsWithDefaults(options, values = {}, prefix = "") {
|
|
|
71
71
|
if (!options || typeof options !== "object") return result;
|
|
72
72
|
for (const [fieldName, rawField] of Object.entries(options)) {
|
|
73
73
|
const field = asSchemaField(rawField);
|
|
74
|
-
if (!field) continue;
|
|
75
|
-
if (fieldName === "$meta") continue;
|
|
74
|
+
if (fieldName === "$meta" || !field) continue;
|
|
76
75
|
const fullName = prefix ? `${prefix}${fieldName}` : fieldName;
|
|
77
76
|
if (field.type === "group") {
|
|
78
77
|
const groupItems = field.items || field.options;
|
|
@@ -200,7 +199,7 @@ function GroupHeader({ children, open, setOpen, title }) {
|
|
|
200
199
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
201
200
|
type: "button",
|
|
202
201
|
"aria-expanded": open,
|
|
203
|
-
className:
|
|
202
|
+
className: "w-full flex items-center text-left transform ease-in transition cursor-pointer",
|
|
204
203
|
onClick: () => setOpen((open) => !open),
|
|
205
204
|
children: [/* @__PURE__ */ jsx(AngleRightIcon, { className: cx(open && "transform rotate-90 ", "px-1 text-[1.25rem] transition ease-in ") }), /* @__PURE__ */ jsx("span", { children: title })]
|
|
206
205
|
}), children]
|
|
@@ -224,7 +223,7 @@ function getClosestParentIndex(parentPath) {
|
|
|
224
223
|
for (let i = parentPath.length - 1; i >= 0; i--) if (parentPath[i] === "]") {
|
|
225
224
|
let j = i - 1;
|
|
226
225
|
while (j >= 0 && parentPath[j] !== "[") j--;
|
|
227
|
-
return parseInt(parentPath.slice(j + 1, i));
|
|
226
|
+
return parseInt(parentPath.slice(j + 1, i), 10);
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
229
|
function MultiSelectionDropdown({ name, label = "", invalid = false, options: initialOptions = [], setFormDirty, onChange, parentValue }) {
|
|
@@ -232,30 +231,25 @@ function MultiSelectionDropdown({ name, label = "", invalid = false, options: in
|
|
|
232
231
|
const required = useFieldRequired();
|
|
233
232
|
const controlProps = useFieldControlProps();
|
|
234
233
|
const { setFieldValue } = useFormikContext();
|
|
235
|
-
const options = useMemo(() => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}, [initialOptions, field.value]);
|
|
234
|
+
const options = useMemo(() => initialOptions.map((option) => {
|
|
235
|
+
const op = typeof option === "string" ? {
|
|
236
|
+
label: option,
|
|
237
|
+
value: option
|
|
238
|
+
} : option;
|
|
239
|
+
return {
|
|
240
|
+
...op,
|
|
241
|
+
selected: !!field.value?.includes(op.value) || !!op.selected
|
|
242
|
+
};
|
|
243
|
+
}), [initialOptions, field.value]);
|
|
246
244
|
const handleOptionSelected = (selectedValue) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
selected.push(selectedValue);
|
|
250
|
-
setFieldValue(name, selected);
|
|
251
|
-
if (onChange) onChange(options);
|
|
245
|
+
setFieldValue(name, [...field.value ?? [], selectedValue]);
|
|
246
|
+
onChange?.(options);
|
|
252
247
|
setFormDirty(true);
|
|
253
248
|
};
|
|
254
249
|
const t = useStrings().common;
|
|
255
250
|
const handleRemoveOption = (key) => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (onChange) onChange(options);
|
|
251
|
+
setFieldValue(name, field.value.filter((item) => item !== key));
|
|
252
|
+
onChange?.(options);
|
|
259
253
|
setFormDirty(true);
|
|
260
254
|
};
|
|
261
255
|
const prevParent = usePrevious(parentValue);
|
|
@@ -279,7 +273,7 @@ function MultiSelectionDropdown({ name, label = "", invalid = false, options: in
|
|
|
279
273
|
}), /* @__PURE__ */ jsx(Table, { children: field.value && field.value.length > 0 ? options.filter((option) => option.selected).map((option) => {
|
|
280
274
|
return /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx(Table.Item, {
|
|
281
275
|
className: "w-full",
|
|
282
|
-
children: option
|
|
276
|
+
children: option.label
|
|
283
277
|
}), /* @__PURE__ */ jsx(Table.Item, { children: /* @__PURE__ */ jsx("button", {
|
|
284
278
|
type: "button",
|
|
285
279
|
"aria-label": t.remove,
|
|
@@ -296,9 +290,8 @@ function MultiSelectionDropdown({ name, label = "", invalid = false, options: in
|
|
|
296
290
|
var InputField = React.memo(function InputField({ label, field, setFormDirty, onChange, disabled = false, labelPosition = "left", missingFields = [], computeOn, spaceCompact = false, workflowForm = false, setFieldValue, setFieldTouched, values, currentValue }) {
|
|
297
291
|
const prevField = useRef(field);
|
|
298
292
|
const fieldObj = useMemo(() => {
|
|
299
|
-
if (deepEqual(prevField.current, field))
|
|
300
|
-
prevField.current
|
|
301
|
-
return { ...field };
|
|
293
|
+
if (!deepEqual(prevField.current, field)) prevField.current = field;
|
|
294
|
+
return prevField.current;
|
|
302
295
|
}, [field]);
|
|
303
296
|
const tooltipComponent = useMemo(() => {
|
|
304
297
|
if (!fieldObj.tooltip) return null;
|
|
@@ -340,7 +333,7 @@ function FormikStateBridge({ onChange }) {
|
|
|
340
333
|
const prevEmitted = useRef(null);
|
|
341
334
|
useEffect(() => {
|
|
342
335
|
const { editorKeyPostfix: _, ...next } = values;
|
|
343
|
-
if (prevEmitted.current !== null &&
|
|
336
|
+
if (prevEmitted.current !== null && deepEqual(prevEmitted.current, next)) return;
|
|
344
337
|
prevEmitted.current = next;
|
|
345
338
|
onChange(next);
|
|
346
339
|
}, [values, onChange]);
|
|
@@ -374,18 +367,8 @@ function useFieldParse(optionsField, values, arrayIndex) {
|
|
|
374
367
|
c.result = null;
|
|
375
368
|
}
|
|
376
369
|
if (!c.hasExpressions) return optionsField;
|
|
377
|
-
if (c.inputDeps.size === 0) {
|
|
378
|
-
if (c.result !== null) return c.result;
|
|
379
|
-
}
|
|
380
370
|
if (c.result !== null) {
|
|
381
|
-
|
|
382
|
-
if (!changed) {
|
|
383
|
-
for (const key of c.inputDeps) if (!deepEqual(values[key], c.lastRelevant[key])) {
|
|
384
|
-
changed = true;
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (!changed) return c.result;
|
|
371
|
+
if (c.inputDeps.size === 0 || arrayIndex === c.lastIndex && [...c.inputDeps].every((key) => deepEqual(values[key], c.lastRelevant[key]))) return c.result;
|
|
389
372
|
}
|
|
390
373
|
c.result = engine.evaluate({
|
|
391
374
|
inputs: values,
|
|
@@ -398,7 +381,7 @@ function useFieldParse(optionsField, values, arrayIndex) {
|
|
|
398
381
|
for (const key of c.inputDeps) c.lastRelevant[key] = values[key];
|
|
399
382
|
return c.result;
|
|
400
383
|
}
|
|
401
|
-
var FormField = React.memo(function FormField({
|
|
384
|
+
var FormField = React.memo(function FormField({ optionsField, fieldName, values, setFormDirty, setFieldValue, setFieldTouched, parentInfo, labelPosition = "left", missingFields = [], spaceCompact = false, workflowForm = false }) {
|
|
402
385
|
const parsedField = useFieldParse(optionsField, values, parentInfo?.arrayIndex);
|
|
403
386
|
const field = asSchemaField(parentInfo ? parsedField : optionsField);
|
|
404
387
|
if (field === null) return null;
|
|
@@ -409,41 +392,34 @@ var FormField = React.memo(function FormField({ id, optionsField, fieldName, val
|
|
|
409
392
|
name: fieldNamePrefix + fieldName,
|
|
410
393
|
optional: resolvedFlag(field.optional) ?? field.default !== void 0
|
|
411
394
|
};
|
|
412
|
-
if (!fieldObj
|
|
395
|
+
if (!fieldObj.name || fieldName === "v3") return null;
|
|
413
396
|
if (field.hidden === true || !field.type) {
|
|
414
|
-
if (resolvedFlag(field.ignore) && !workflowForm) deleteFieldByPath(values, fieldObj
|
|
397
|
+
if (resolvedFlag(field.ignore) && !workflowForm) deleteFieldByPath(values, fieldObj.name);
|
|
415
398
|
return null;
|
|
416
399
|
}
|
|
417
|
-
if (!field.type && field.options) fieldObj["type"] = "dropdown";
|
|
418
400
|
let onChange;
|
|
419
401
|
if (field.one_must_be_true && parentInfo?.onChange) {
|
|
420
402
|
const parentOnChange = parentInfo.onChange;
|
|
421
403
|
const parentArrayIndex = parentInfo.arrayIndex ?? 0;
|
|
422
|
-
const fieldOptions = fieldObj
|
|
404
|
+
const fieldOptions = fieldObj.options;
|
|
423
405
|
onChange = (val) => parentOnChange(fieldName, parentArrayIndex, flagValue(fieldOptions?.["offOption"], false), flagValue(fieldOptions?.["onOption"], true), val);
|
|
424
406
|
}
|
|
425
407
|
if (field.show_if !== void 0 || field.show_if_not !== void 0) {
|
|
426
|
-
|
|
427
|
-
if (parentInfo) {
|
|
428
|
-
if (!parentInfo?.arrayIndex) index = getClosestParentIndex(parentInfo.fieldNamePrefix);
|
|
429
|
-
else index = parentInfo.arrayIndex;
|
|
430
|
-
}
|
|
408
|
+
const index = parentInfo ? parentInfo.arrayIndex || getClosestParentIndex(parentInfo.fieldNamePrefix) : void 0;
|
|
431
409
|
let shouldShowField = true;
|
|
432
|
-
if (field.show_if !== void 0) shouldShowField = !!getParentValue(index, field.show_if, values,
|
|
433
|
-
if (shouldShowField && field.show_if_not !== void 0) shouldShowField = !getParentValue(index, field.show_if_not, values,
|
|
410
|
+
if (field.show_if !== void 0) shouldShowField = !!getParentValue(index, field.show_if, values, field);
|
|
411
|
+
if (shouldShowField && field.show_if_not !== void 0) shouldShowField = !getParentValue(index, field.show_if_not, values, field);
|
|
434
412
|
if (!shouldShowField) {
|
|
435
|
-
if (!workflowForm) deleteFieldByPath(values, fieldObj
|
|
413
|
+
if (!workflowForm) deleteFieldByPath(values, fieldObj.name);
|
|
436
414
|
return null;
|
|
437
415
|
}
|
|
438
416
|
}
|
|
439
|
-
if (field.depends_on) {
|
|
440
|
-
if (parentInfo?.arrayIndex !== void 0) fieldObj["depends_on"] = field.depends_on.replace("[index]", `[${parentInfo.arrayIndex}]`);
|
|
441
|
-
}
|
|
417
|
+
if (field.depends_on && parentInfo?.arrayIndex !== void 0) fieldObj.depends_on = field.depends_on.replace("[index]", `[${parentInfo.arrayIndex}]`);
|
|
442
418
|
if (field.enable_if && field.disabled === false) {
|
|
443
419
|
if (typeof field.enable_if === "string") {
|
|
444
420
|
let path = field.enable_if;
|
|
445
421
|
if (parentInfo?.arrayIndex !== void 0) path = field.enable_if.replace("[index]", `[${parentInfo.arrayIndex}]`);
|
|
446
|
-
if (getValueUsingPath(values, path) === false) fieldObj
|
|
422
|
+
if (getValueUsingPath(values, path) === false) fieldObj.disabled = true;
|
|
447
423
|
}
|
|
448
424
|
}
|
|
449
425
|
if (field.type === "group") {
|
|
@@ -477,51 +453,51 @@ var FormField = React.memo(function FormField({ id, optionsField, fieldName, val
|
|
|
477
453
|
})
|
|
478
454
|
})
|
|
479
455
|
})
|
|
480
|
-
}
|
|
456
|
+
});
|
|
481
457
|
}
|
|
482
458
|
if (typeof field.type === "object" && field.depends_on) {
|
|
483
459
|
const parentValue = getValueUsingPath(values, field.depends_on);
|
|
484
460
|
const resolvedType = field.type[String(parentValue)];
|
|
485
461
|
if (!resolvedType) return null;
|
|
486
|
-
fieldObj
|
|
462
|
+
fieldObj.type = resolvedType;
|
|
487
463
|
}
|
|
488
464
|
if (field.type === "range" && field.depends_on) {
|
|
489
465
|
const parentValue = getValueUsingPath(values, field.depends_on);
|
|
490
466
|
const { min, max } = field;
|
|
491
467
|
if (typeof min === "object" && typeof max === "object") {
|
|
492
|
-
fieldObj
|
|
493
|
-
fieldObj
|
|
468
|
+
fieldObj.min = min[String(parentValue)];
|
|
469
|
+
fieldObj.max = max[String(parentValue)];
|
|
494
470
|
}
|
|
495
471
|
}
|
|
496
472
|
if (field.resetOnChange) {
|
|
497
473
|
const parentValue = getValueUsingPath(values, field.resetOnChange);
|
|
498
474
|
const prevParentValue = field.prevParentValue;
|
|
499
|
-
if (prevParentValue !== void 0 && prevParentValue !== parentValue) deleteFieldByPath(values, fieldObj
|
|
475
|
+
if (prevParentValue !== void 0 && prevParentValue !== parentValue) deleteFieldByPath(values, fieldObj.name);
|
|
500
476
|
field.prevParentValue = parentValue;
|
|
501
477
|
}
|
|
502
478
|
if (field.secondaryField) {
|
|
503
|
-
if (Array.isArray(field.secondaryField)) fieldObj
|
|
504
|
-
else fieldObj
|
|
479
|
+
if (Array.isArray(field.secondaryField)) fieldObj.secondaryField = field.secondaryField.map((secondaryField) => fieldNamePrefix + secondaryField);
|
|
480
|
+
else fieldObj.secondaryField = fieldNamePrefix + field.secondaryField;
|
|
505
481
|
}
|
|
506
482
|
return /* @__PURE__ */ jsx("div", {
|
|
507
483
|
className: cx("flex w-full", labelPosition === "left" ? "mb-[15px]" : "mb-[5px]"),
|
|
508
484
|
children: /* @__PURE__ */ jsx(InputField, {
|
|
509
485
|
field: fieldObj,
|
|
510
|
-
label: fieldObj
|
|
486
|
+
label: fieldObj.label,
|
|
511
487
|
setFormDirty,
|
|
512
488
|
setFieldValue,
|
|
513
489
|
setFieldTouched,
|
|
514
490
|
values,
|
|
515
|
-
currentValue: getValueUsingPath(values, fieldObj
|
|
491
|
+
currentValue: getValueUsingPath(values, fieldObj.name),
|
|
516
492
|
onChange,
|
|
517
|
-
disabled: Boolean(fieldObj
|
|
518
|
-
computeOn: parentInfo?.computeOn || fieldObj
|
|
493
|
+
disabled: Boolean(fieldObj.disabled),
|
|
494
|
+
computeOn: parentInfo?.computeOn || fieldObj.computeOn,
|
|
519
495
|
labelPosition,
|
|
520
496
|
missingFields,
|
|
521
497
|
spaceCompact,
|
|
522
498
|
workflowForm
|
|
523
499
|
})
|
|
524
|
-
}
|
|
500
|
+
});
|
|
525
501
|
}, (prev, next) => {
|
|
526
502
|
if (!deepEqual(prev.optionsField, next.optionsField)) return false;
|
|
527
503
|
if (prev.values !== next.values) return false;
|
|
@@ -533,8 +509,7 @@ var FormField = React.memo(function FormField({ id, optionsField, fieldName, val
|
|
|
533
509
|
return true;
|
|
534
510
|
});
|
|
535
511
|
function FieldsFromOptions({ options = {}, values, setFormDirty, setFieldValue, setFieldTouched, parentInfo, labelPosition = "left", missingFields = [], spaceCompact = false, workflowForm = false }) {
|
|
536
|
-
return Object.keys(options).map((fieldName
|
|
537
|
-
id: idx,
|
|
512
|
+
return Object.keys(options).map((fieldName) => /* @__PURE__ */ jsx(FormField, {
|
|
538
513
|
optionsField: options[fieldName],
|
|
539
514
|
fieldName,
|
|
540
515
|
values,
|
|
@@ -552,27 +527,26 @@ var noop = () => {};
|
|
|
552
527
|
function DynamicFormContent({ options, setValues, setFormDirty, labelPosition, missingFields, spaceCompact, organizationVariables, remoteVars, workflowForm, onSubmit, submitLabel, values, contextKey }) {
|
|
553
528
|
const { setFieldValue, setFieldTouched } = useFormikContext();
|
|
554
529
|
const opts = useParsedOpts(options, values, organizationVariables, void 0, void 0, remoteVars);
|
|
555
|
-
const handleChange = useCallback((state) =>
|
|
556
|
-
if (setValues) setValues(state);
|
|
557
|
-
}, [setValues]);
|
|
530
|
+
const handleChange = useCallback((state) => setValues?.(state), [setValues]);
|
|
558
531
|
const wizardConfig = parseWizardConfig(opts);
|
|
532
|
+
const meta = resolveMetaOverrides(options, labelPosition, spaceCompact);
|
|
559
533
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
560
534
|
/* @__PURE__ */ jsx(DirtyStateBridge, { setFormDirty }),
|
|
561
535
|
/* @__PURE__ */ jsx(FormikStateBridge, { onChange: handleChange }),
|
|
562
536
|
/* @__PURE__ */ jsx(DynamicDefaultsSync, { options: opts }, contextKey ?? ""),
|
|
563
|
-
wizardConfig
|
|
537
|
+
wizardConfig ? /* @__PURE__ */ jsx(WizardContainer, {
|
|
564
538
|
wizardConfig,
|
|
565
539
|
values,
|
|
566
540
|
onChange: handleChange,
|
|
567
541
|
onSubmit,
|
|
568
542
|
className: "w-full",
|
|
569
|
-
...
|
|
543
|
+
...meta,
|
|
570
544
|
missingFields,
|
|
571
545
|
workflowForm,
|
|
572
546
|
setFieldValue,
|
|
573
547
|
setFieldTouched
|
|
574
548
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FieldsFromOptions, {
|
|
575
|
-
...
|
|
549
|
+
...meta,
|
|
576
550
|
options: opts,
|
|
577
551
|
values,
|
|
578
552
|
setFormDirty,
|
|
@@ -591,7 +565,7 @@ function DynamicFormContent({ options, setValues, setFormDirty, labelPosition, m
|
|
|
591
565
|
] });
|
|
592
566
|
}
|
|
593
567
|
var NO_FIELDS = {};
|
|
594
|
-
function DynamicForm({ formJSONs: options = {}, reinitialize = false, initialValues, setValues, setFormDirty = noop, formikRef, labelPosition = "left", missingFields = [], spaceCompact = false, organizationVariables, remoteVars, needsOrganizationVariables = false, onSubmit
|
|
568
|
+
function DynamicForm({ formJSONs: options = {}, reinitialize = false, initialValues, setValues, setFormDirty = noop, formikRef, labelPosition = "left", missingFields = [], spaceCompact = false, organizationVariables, remoteVars, needsOrganizationVariables = false, onSubmit, submitLabel = "Submit", className = "w-full", workflowForm = false, contextKey, skipValueParse = false, fields = NO_FIELDS }) {
|
|
595
569
|
const engine = useWorkflowEngine();
|
|
596
570
|
const [parseReady, setParseReady] = useState(() => engine.isReady());
|
|
597
571
|
useEffect(() => {
|
|
@@ -8,9 +8,7 @@ export default function DropdownWrapper({ options, onChange, fieldObj, setFormDi
|
|
|
8
8
|
disabled?: boolean | string | undefined;
|
|
9
9
|
placeholder?: string | undefined;
|
|
10
10
|
default?: unknown;
|
|
11
|
-
parentValue?: unknown;
|
|
12
11
|
secondaryField?: string | string[] | undefined;
|
|
13
|
-
resetOnChange?: string | boolean | undefined;
|
|
14
12
|
value?: string | undefined;
|
|
15
13
|
autoselect?: boolean | string | Record<string, unknown> | undefined;
|
|
16
14
|
allowCustomValue?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import FormikCustomDropdown_default from "./FormikCustomDropdown.js";
|
|
|
2
2
|
import { getPlaceholder } from "../utils/getPlaceholder.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/form/SpecialTypes/DropdownWrapper.tsx
|
|
5
|
-
function DropdownWrapper({ options, onChange, fieldObj, setFormDirty, invalid = false, loading = false, disabled
|
|
5
|
+
function DropdownWrapper({ options, onChange, fieldObj, setFormDirty, invalid = false, loading = false, disabled, allowCustomValue, currentValue, setFieldValue, setFieldTouched }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(FormikCustomDropdown_default, {
|
|
7
7
|
invalid,
|
|
8
8
|
className: "w-full",
|
|
@@ -14,9 +14,7 @@ function DropdownWrapper({ options, onChange, fieldObj, setFormDirty, invalid =
|
|
|
14
14
|
placeholder: getPlaceholder(fieldObj.placeholder, typeof fieldObj.default === "string" ? fieldObj.default : void 0),
|
|
15
15
|
name: fieldObj.name ?? "",
|
|
16
16
|
ariaLabel: fieldObj.label,
|
|
17
|
-
parentValue: fieldObj.parentValue,
|
|
18
17
|
secondaryField: fieldObj.secondaryField,
|
|
19
|
-
resetOnChange: fieldObj.resetOnChange,
|
|
20
18
|
value: fieldObj.value,
|
|
21
19
|
autoselect: fieldObj.autoselect === void 0 ? void 0 : Boolean(fieldObj.autoselect),
|
|
22
20
|
allowCustomValue: allowCustomValue ?? fieldObj.allowCustomValue,
|
|
@@ -30,11 +30,9 @@ type FormikCustomDropdownProps = {
|
|
|
30
30
|
options: React.ComponentProps<typeof Dropdown>['options'];
|
|
31
31
|
setFormDirty: TSetFormDirty;
|
|
32
32
|
onChange?: ((val: string) => void) | undefined;
|
|
33
|
-
parentValue?: unknown;
|
|
34
33
|
className?: string;
|
|
35
34
|
secondaryField?: string | string[] | undefined;
|
|
36
35
|
disabled?: boolean;
|
|
37
|
-
resetOnChange?: string | boolean | undefined;
|
|
38
36
|
loading?: boolean;
|
|
39
37
|
invalid?: boolean;
|
|
40
38
|
autoselect?: boolean | undefined;
|
|
@@ -46,7 +44,7 @@ type FormikCustomDropdownProps = {
|
|
|
46
44
|
setFieldValue: (field: string, value: unknown, shouldValidate?: boolean) => void;
|
|
47
45
|
setFieldTouched: (field: string, isTouched?: boolean, shouldValidate?: boolean) => void;
|
|
48
46
|
};
|
|
49
|
-
declare const _default: import("react").MemoExoticComponent<({ name, ariaLabel, options, setFormDirty, onChange,
|
|
47
|
+
declare const _default: import("react").MemoExoticComponent<({ name, ariaLabel, options, setFormDirty, onChange, className, secondaryField, disabled, loading, invalid, autoselect, value, allowCustomValue, customValueLabel, placeholder, currentValue, setFieldValue, setFieldTouched, }: FormikCustomDropdownProps) => import("react").JSX.Element>;
|
|
50
48
|
export default _default;
|
|
51
49
|
export declare const Testables: {
|
|
52
50
|
toComparableOptions: typeof toComparableOptions;
|
|
@@ -41,23 +41,19 @@ function arePropsEqual(prev, next) {
|
|
|
41
41
|
} else if (prev[key] !== next[key]) return false;
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
|
-
var FormikCustomDropdown_default = memo(function FormikCustomDropdown({ name, ariaLabel, options, setFormDirty, onChange,
|
|
44
|
+
var FormikCustomDropdown_default = memo(function FormikCustomDropdown({ name, ariaLabel, options, setFormDirty, onChange, className, secondaryField, disabled = false, loading = false, invalid = false, autoselect, value, allowCustomValue = false, customValueLabel, placeholder, currentValue, setFieldValue, setFieldTouched }) {
|
|
45
45
|
const required = useFieldRequired();
|
|
46
46
|
const controlProps = useFieldControlProps();
|
|
47
|
-
const prevParentRef = useRef(parentValue);
|
|
48
47
|
const handleChange = (val) => {
|
|
49
48
|
if (secondaryField && typeof options[0] !== "string") {
|
|
50
49
|
const option = findSecondaryOption(options, val);
|
|
51
50
|
if (option) applySecondaryField(secondaryField, option.secondaryValue, setFieldValue);
|
|
52
51
|
}
|
|
53
|
-
|
|
52
|
+
onChange?.(val);
|
|
54
53
|
setFieldValue(name, val);
|
|
55
54
|
setFieldTouched(name, true);
|
|
56
55
|
setFormDirty(true);
|
|
57
56
|
};
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
prevParentRef.current = parentValue;
|
|
60
|
-
});
|
|
61
57
|
const prevOptions = useRef(null);
|
|
62
58
|
const syncAutoselect = useEffectEvent((options, autoselect) => {
|
|
63
59
|
if (deepEqual(prevOptions.current, toComparableOptions(options))) return;
|
|
@@ -68,7 +64,8 @@ var FormikCustomDropdown_default = memo(function FormikCustomDropdown({ name, ar
|
|
|
68
64
|
prevOptions.current = toComparableOptions(options);
|
|
69
65
|
if (autoselect === false || !options?.length) return;
|
|
70
66
|
if (autoselect === void 0) {
|
|
71
|
-
|
|
67
|
+
const [first] = options;
|
|
68
|
+
if (first && isCategory(first)) {
|
|
72
69
|
let optionCount = 0;
|
|
73
70
|
for (const category of options) {
|
|
74
71
|
if (isCategory(category)) optionCount += category.options.length;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EyeIcon, EyeOffIcon } from "../../icons.js";
|
|
2
2
|
import { useFieldControlProps, useFieldRequired } from "../fieldContext.js";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useField, useFormikContext } from "formik";
|
|
7
7
|
//#region src/form/SpecialTypes/FormikCustomInput.tsx
|
|
@@ -19,19 +19,21 @@ function FormikCustomInput({ name, type, step, placeholder, onChange, disabled,
|
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
if (!isFocused.current) setLocalValue(value ?? field.value);
|
|
21
21
|
}, [field.value, value]);
|
|
22
|
-
const
|
|
23
|
-
if (sanitize === void 0) return
|
|
22
|
+
const sanitizeRegexp = useMemo(() => {
|
|
23
|
+
if (sanitize === void 0) return;
|
|
24
24
|
try {
|
|
25
|
-
|
|
26
|
-
if (lowercase) val = val.toLowerCase();
|
|
27
|
-
return val.replace(regexp, "");
|
|
25
|
+
return new RegExp(sanitize, "g");
|
|
28
26
|
} catch {
|
|
29
27
|
console.error("Invalid regex for sanitization:", sanitize);
|
|
28
|
+
return;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
}, [sanitize]);
|
|
31
|
+
const sanitizeName = useCallback((val) => {
|
|
32
|
+
const cased = lowercase ? val.toLowerCase() : val;
|
|
33
|
+
return sanitizeRegexp ? cased.replace(sanitizeRegexp, "") : cased;
|
|
34
|
+
}, [sanitizeRegexp, lowercase]);
|
|
33
35
|
const flushToFormik = useCallback((val) => {
|
|
34
|
-
|
|
36
|
+
onChange?.(val);
|
|
35
37
|
setFieldTouched(name, true);
|
|
36
38
|
setFieldValue(name, val);
|
|
37
39
|
}, [
|
|
@@ -41,11 +43,11 @@ function FormikCustomInput({ name, type, step, placeholder, onChange, disabled,
|
|
|
41
43
|
setFieldValue
|
|
42
44
|
]);
|
|
43
45
|
const handleChange = (e) => {
|
|
44
|
-
const text =
|
|
46
|
+
const text = sanitizeName(e.target.value);
|
|
45
47
|
let val = text;
|
|
46
48
|
if (type === "number") {
|
|
47
49
|
const parsed = parseFloat(text);
|
|
48
|
-
val = isNaN(parsed) ? void 0 : parsed;
|
|
50
|
+
val = Number.isNaN(parsed) ? void 0 : parsed;
|
|
49
51
|
}
|
|
50
52
|
if (type === "password" && val === "") val = defaultValue;
|
|
51
53
|
setLocalValue(val);
|
|
@@ -20,10 +20,7 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
20
20
|
const errors = await validateForm();
|
|
21
21
|
const hasStepErrors = shouldFlatten ? stepFieldNames.some((fieldName) => errors[fieldName]) : stepFieldNames.some((fieldName) => hasNestedError(errors[stepKey], fieldName));
|
|
22
22
|
if (hasStepErrors) {
|
|
23
|
-
const touchedFields = stepFieldNames.
|
|
24
|
-
acc[fieldName] = true;
|
|
25
|
-
return acc;
|
|
26
|
-
}, {});
|
|
23
|
+
const touchedFields = Object.fromEntries(stepFieldNames.map((name) => [name, true]));
|
|
27
24
|
if (shouldFlatten) setTouched({
|
|
28
25
|
...touched,
|
|
29
26
|
...touchedFields
|
|
@@ -47,7 +44,7 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
47
44
|
validateStep: validateCurrentStep
|
|
48
45
|
});
|
|
49
46
|
const currentStepConfig = steps[currentStep];
|
|
50
|
-
const
|
|
47
|
+
const navigation = config.navigation ?? {};
|
|
51
48
|
const handleGoToNext = useCallback(async () => {
|
|
52
49
|
const success = await goToNext();
|
|
53
50
|
if (success) onChange?.(values);
|
|
@@ -57,22 +54,11 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
57
54
|
values,
|
|
58
55
|
onChange
|
|
59
56
|
]);
|
|
60
|
-
const handleJumpToStep = useCallback((stepKey) => {
|
|
61
|
-
if (!config_.allowJump || !visitedSteps.has(stepKey)) return false;
|
|
62
|
-
return jumpToStep(stepKey);
|
|
63
|
-
}, [
|
|
64
|
-
jumpToStep,
|
|
65
|
-
config_.allowJump,
|
|
66
|
-
visitedSteps
|
|
67
|
-
]);
|
|
68
57
|
const handleSubmit = useCallback(async () => {
|
|
69
58
|
if (!isLastStep) return;
|
|
70
59
|
const errors = await validateForm();
|
|
71
60
|
if (Object.keys(errors).length > 0) {
|
|
72
|
-
const touchedFields = Object.keys(values).
|
|
73
|
-
acc[fieldName] = true;
|
|
74
|
-
return acc;
|
|
75
|
-
}, {});
|
|
61
|
+
const touchedFields = Object.fromEntries(Object.keys(values).map((name) => [name, true]));
|
|
76
62
|
setTouched({
|
|
77
63
|
...touched,
|
|
78
64
|
...touchedFields
|
|
@@ -91,15 +77,15 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
91
77
|
return /* @__PURE__ */ jsxs("div", {
|
|
92
78
|
className,
|
|
93
79
|
children: [
|
|
94
|
-
|
|
80
|
+
navigation.showSteps !== false && /* @__PURE__ */ jsx(WizardStepIndicator, {
|
|
95
81
|
stepOrder,
|
|
96
82
|
currentStep,
|
|
97
83
|
steps,
|
|
98
84
|
visitedSteps,
|
|
99
85
|
invalidSteps,
|
|
100
|
-
onStepClick:
|
|
101
|
-
allowJump:
|
|
102
|
-
hideStepNumbers:
|
|
86
|
+
onStepClick: jumpToStep,
|
|
87
|
+
allowJump: navigation.allowJump,
|
|
88
|
+
hideStepNumbers: navigation.hideStepNumbers
|
|
103
89
|
}),
|
|
104
90
|
currentStepConfig && /* @__PURE__ */ jsx("div", {
|
|
105
91
|
className: "mb-4",
|
|
@@ -108,7 +94,6 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
108
94
|
stepConfig: currentStepConfig,
|
|
109
95
|
flatten: config.flatten,
|
|
110
96
|
values,
|
|
111
|
-
onValuesChange: onChange,
|
|
112
97
|
labelPosition,
|
|
113
98
|
missingFields,
|
|
114
99
|
spaceCompact,
|
|
@@ -119,9 +104,7 @@ function WizardContainer({ wizardConfig, values, onChange, onSubmit, className =
|
|
|
119
104
|
})
|
|
120
105
|
}),
|
|
121
106
|
/* @__PURE__ */ jsx(WizardNavigation, {
|
|
122
|
-
|
|
123
|
-
stepOrder,
|
|
124
|
-
canGoToNext: !isLastStep,
|
|
107
|
+
isLastStep,
|
|
125
108
|
canGoBack,
|
|
126
109
|
isCurrentStepValid: !invalidSteps.has(currentStep),
|
|
127
110
|
nextLabel: currentStepConfig?.nextLabel,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { WizardNavigationProps } from './types.js';
|
|
2
|
-
export declare function WizardNavigation({
|
|
2
|
+
export declare function WizardNavigation({ isLastStep, canGoBack, isCurrentStepValid, nextLabel, prevLabel, submitLabel, onNext, onPrevious, onSubmit, }: WizardNavigationProps): import("react").JSX.Element;
|
|
@@ -2,10 +2,9 @@ import Loader from "../../components/Loader.js";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/form/Wizard/WizardNavigation.tsx
|
|
5
|
-
function WizardNavigation({
|
|
5
|
+
function WizardNavigation({ isLastStep, canGoBack, isCurrentStepValid, nextLabel, prevLabel, submitLabel = "Submit", onNext, onPrevious, onSubmit }) {
|
|
6
6
|
const [isLoading, setIsLoading] = useState(false);
|
|
7
7
|
const [error, setError] = useState(null);
|
|
8
|
-
const isLastStep = stepOrder.indexOf(currentStep) === stepOrder.length - 1;
|
|
9
8
|
const handleNext = async () => {
|
|
10
9
|
setIsLoading(true);
|
|
11
10
|
setError(null);
|
|
@@ -44,7 +43,7 @@ function WizardNavigation({ currentStep, stepOrder, canGoToNext, canGoBack, isCu
|
|
|
44
43
|
backgroundColor: "var(--theme-app-bg)"
|
|
45
44
|
},
|
|
46
45
|
onMouseEnter: (e) => {
|
|
47
|
-
if (
|
|
46
|
+
if (canGoBack && !isLoading) e.currentTarget.style.backgroundColor = "var(--theme-hover)";
|
|
48
47
|
},
|
|
49
48
|
onMouseLeave: (e) => {
|
|
50
49
|
e.currentTarget.style.backgroundColor = "var(--theme-app-bg)";
|
|
@@ -58,7 +57,7 @@ function WizardNavigation({ currentStep, stepOrder, canGoToNext, canGoBack, isCu
|
|
|
58
57
|
className: "px-8 py-3 rounded-lg font-medium transition-all duration-200 text-white flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed shadow-md hover:shadow-lg",
|
|
59
58
|
style: { backgroundColor: "var(--theme-element)" },
|
|
60
59
|
onMouseEnter: (e) => {
|
|
61
|
-
if (
|
|
60
|
+
if (isCurrentStepValid && !isLoading) e.currentTarget.style.filter = "brightness(0.9)";
|
|
62
61
|
},
|
|
63
62
|
onMouseLeave: (e) => {
|
|
64
63
|
e.currentTarget.style.filter = "brightness(1)";
|
|
@@ -71,11 +70,11 @@ function WizardNavigation({ currentStep, stepOrder, canGoToNext, canGoBack, isCu
|
|
|
71
70
|
}) : /* @__PURE__ */ jsxs("button", {
|
|
72
71
|
type: "button",
|
|
73
72
|
onClick: handleNext,
|
|
74
|
-
disabled:
|
|
73
|
+
disabled: isLoading,
|
|
75
74
|
className: "px-8 py-3 rounded-lg font-medium transition-all duration-200 text-white flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed shadow-md hover:shadow-lg",
|
|
76
75
|
style: { backgroundColor: "var(--theme-element)" },
|
|
77
76
|
onMouseEnter: (e) => {
|
|
78
|
-
if (!
|
|
77
|
+
if (!isLoading) e.currentTarget.style.filter = "brightness(0.9)";
|
|
79
78
|
},
|
|
80
79
|
onMouseLeave: (e) => {
|
|
81
80
|
e.currentTarget.style.filter = "brightness(1)";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSetFormDirty } from '../Form.js';
|
|
2
2
|
import type { WizardStepContentProps } from './types.js';
|
|
3
|
-
export declare function WizardStepContent({ currentStep, stepConfig, flatten, values,
|
|
3
|
+
export declare function WizardStepContent({ currentStep, stepConfig, flatten, values, setFormDirty, setFieldValue, setFieldTouched, ...fieldsProps }: WizardStepContentProps & {
|
|
4
4
|
setFormDirty: TSetFormDirty;
|
|
5
5
|
setFieldValue: (field: string, value: unknown, shouldValidate?: boolean) => void;
|
|
6
6
|
setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FieldsFromOptions } from "../Form.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/form/Wizard/WizardStepContent.tsx
|
|
4
|
-
function WizardStepContent({ currentStep, stepConfig, flatten = true, values,
|
|
5
|
-
if (!stepConfig
|
|
4
|
+
function WizardStepContent({ currentStep, stepConfig, flatten = true, values, setFormDirty, setFieldValue, setFieldTouched, ...fieldsProps }) {
|
|
5
|
+
if (!stepConfig.options) return null;
|
|
6
6
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
7
|
className: "mb-4 w-full",
|
|
8
8
|
children: [
|