@parallelworks/ui 0.40.1 → 0.42.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 +25 -0
- package/dist/ai/adapter/memoryStore.js +7 -0
- package/dist/ai/adapter/mock/mockAdapter.js +52 -17
- package/dist/ai/adapter/openai/createOpenAIStream.js +1 -1
- package/dist/ai/adapter/openai/index.d.ts +1 -1
- package/dist/ai/adapter/openai/sse.d.ts +8 -2
- package/dist/ai/adapter/openai/sse.js +40 -4
- package/dist/ai/adapter/openai/wire.d.ts +6 -0
- package/dist/ai/components/AllocationSelector.d.ts +3 -4
- package/dist/ai/components/AllocationSelector.js +37 -33
- package/dist/ai/components/AttachmentManager.js +7 -7
- package/dist/ai/components/AttachmentUpload.js +5 -5
- package/dist/ai/components/BranchNavigator.js +1 -1
- package/dist/ai/components/ChatEmptyState.js +2 -2
- package/dist/ai/components/ChatInput.js +10 -8
- package/dist/ai/components/ChatLayout.js +4 -5
- package/dist/ai/components/ChatMessage.js +12 -12
- package/dist/ai/components/ChatMessageList.js +9 -9
- package/dist/ai/components/ChatSidebar.js +8 -9
- package/dist/ai/components/ChatThread.js +4 -4
- package/dist/ai/components/ComposerChrome.d.ts +2 -2
- package/dist/ai/components/ComposerChrome.js +3 -6
- package/dist/ai/components/DragOverlay.js +2 -2
- package/dist/ai/components/ModelSelector.d.ts +5 -3
- package/dist/ai/components/ModelSelector.js +102 -339
- package/dist/ai/components/PastedText.js +11 -11
- package/dist/ai/components/ProviderIssueBanner.d.ts +2 -0
- package/dist/ai/components/ProviderIssueBanner.js +34 -16
- package/dist/ai/components/Reasoning.js +4 -4
- package/dist/ai/components/ShareDialog.js +43 -35
- package/dist/ai/components/SlashMenu.d.ts +12 -2
- package/dist/ai/components/SlashMenu.js +29 -13
- package/dist/ai/components/agent/ActivityLine.js +3 -3
- package/dist/ai/components/agent/AgentMessageParts.js +20 -20
- package/dist/ai/components/agent/PermissionPicker.js +13 -11
- package/dist/ai/components/conversationActions.d.ts +4 -6
- package/dist/ai/components/conversationActions.js +9 -13
- package/dist/ai/core/ChatProvider.js +4 -4
- package/dist/ai/core/config.js +1 -1
- package/dist/ai/core/parts.d.ts +5 -0
- package/dist/ai/core/parts.js +28 -1
- package/dist/ai/core/providerIssues.d.ts +7 -0
- package/dist/ai/core/providerIssues.js +9 -1
- package/dist/ai/core/useKeyboardShortcuts.d.ts +4 -0
- package/dist/ai/core/useKeyboardShortcuts.js +8 -2
- package/dist/ai/index.d.ts +0 -1
- package/dist/ai/index.js +1 -2
- package/dist/ai/strings.d.ts +19 -0
- package/dist/ai/strings.js +18 -1
- package/dist/ai/ui/Avatar.js +5 -5
- package/dist/ai/ui/ConversationSidebar.d.ts +0 -1
- package/dist/ai/ui/ConversationSidebar.js +6 -7
- package/dist/ai/ui/Markdown.js +3 -3
- package/dist/ai/ui/Notice.js +6 -6
- package/dist/ai/ui/chip.d.ts +4 -0
- package/dist/ai/ui/chip.js +8 -0
- package/dist/ai/ui/sidebar.d.ts +6 -5
- package/dist/ai/ui/sidebar.js +39 -43
- package/dist/components/ActionMenu.d.ts +13 -0
- package/dist/components/ActionMenu.js +30 -0
- package/dist/components/Avatar.js +6 -6
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Button.js +10 -10
- package/dist/components/Callout.js +2 -2
- package/dist/components/Card.js +3 -3
- package/dist/components/Combobox.d.ts +66 -0
- package/dist/components/Combobox.js +393 -0
- package/dist/components/ConfirmModal.js +11 -11
- package/dist/components/ContextMenu.d.ts +23 -0
- package/dist/components/ContextMenu.js +89 -0
- package/dist/components/CopyToClipboard.js +2 -2
- package/dist/components/CreateModal.d.ts +17 -36
- package/dist/components/CreateModal.js +97 -259
- package/dist/components/DescriptionList.js +8 -8
- package/dist/components/Filter.js +2 -2
- package/dist/components/FilterPill.js +2 -2
- package/dist/components/HoverCard.d.ts +14 -0
- package/dist/components/HoverCard.js +33 -0
- package/dist/components/IconButton.d.ts +5 -5
- package/dist/components/IconButton.js +18 -22
- package/dist/components/InfoTip.d.ts +15 -0
- package/dist/components/InfoTip.js +60 -0
- package/dist/components/Input.js +5 -5
- package/dist/components/LetterBadge.js +2 -2
- package/dist/components/Loader.js +3 -3
- package/dist/components/Markdown.js +1 -1
- package/dist/components/MarkdownImpl.js +2 -2
- package/dist/components/Menu.d.ts +33 -0
- package/dist/components/Menu.js +86 -0
- package/dist/components/MenuEntries.d.ts +56 -0
- package/dist/components/MenuEntries.js +123 -0
- package/dist/components/Modal.d.ts +29 -0
- package/dist/components/Modal.js +47 -0
- package/dist/components/Overview.js +11 -10
- package/dist/components/PageHeader.d.ts +10 -16
- package/dist/components/PageHeader.js +69 -95
- package/dist/components/Pagination.js +5 -5
- package/dist/components/Provider.d.ts +5 -11
- package/dist/components/Provider.js +11 -14
- package/dist/components/Radio.d.ts +8 -0
- package/dist/components/Radio.js +16 -0
- package/dist/components/SectionHeader.js +2 -2
- package/dist/components/SegmentedControl.d.ts +6 -5
- package/dist/components/SegmentedControl.js +34 -30
- package/dist/components/Select.d.ts +27 -0
- package/dist/components/Select.js +78 -0
- package/dist/components/SettingModeOption.d.ts +5 -8
- package/dist/components/SettingModeOption.js +10 -12
- package/dist/components/SettingRow.js +4 -4
- package/dist/components/SettingsCard.js +4 -4
- package/dist/components/SettingsGroup.js +2 -2
- package/dist/components/Sort.js +1 -1
- package/dist/components/StatusBadge.js +7 -7
- package/dist/components/StatusIcons.js +4 -4
- package/dist/components/Switch.d.ts +22 -0
- package/dist/components/Switch.js +28 -0
- package/dist/components/Table.js +11 -11
- package/dist/components/Tooltip.d.ts +24 -20
- package/dist/components/Tooltip.js +58 -76
- package/dist/components/floating.d.ts +14 -0
- package/dist/components/floating.js +21 -0
- package/dist/components/search.d.ts +2 -0
- package/dist/components/search.js +14 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/EditorField.js +16 -21
- package/dist/editor/FormCodePanel.js +19 -19
- package/dist/editor/Monaco.js +3 -3
- package/dist/file-explorer/FileExplorer.js +77 -81
- package/dist/file-explorer/FileExplorerContext.js +2 -2
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +1 -1
- package/dist/file-explorer/FilePreview/Inline.js +1 -1
- package/dist/file-explorer/FilePreview/StreamedBadge.js +5 -6
- package/dist/file-explorer/FilePreview/Viewer.js +8 -8
- package/dist/file-explorer/FilePreview/index.d.ts +1 -1
- package/dist/file-explorer/FilePreview/index.js +49 -83
- package/dist/file-explorer/FileRow.d.ts +4 -3
- package/dist/file-explorer/FileRow.js +32 -38
- package/dist/file-explorer/FileRowsWindow.d.ts +3 -2
- package/dist/file-explorer/FileRowsWindow.js +4 -4
- package/dist/file-explorer/FileTable.d.ts +3 -2
- package/dist/file-explorer/FileTable.js +3 -3
- package/dist/file-explorer/LoadMoreRow.js +1 -1
- package/dist/file-explorer/TreeView.js +11 -16
- package/dist/file-explorer/helpers.js +11 -12
- package/dist/file-explorer/toasts.js +11 -11
- package/dist/form/FieldGroup.d.ts +11 -0
- package/dist/form/FieldGroup.js +36 -0
- package/dist/form/FieldWrapper.js +4 -4
- package/dist/form/Fields/BooleanField.js +23 -33
- package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
- package/dist/form/Fields/CheckboxGroupField.js +9 -13
- package/dist/form/Fields/ColorField.d.ts +1 -2
- package/dist/form/Fields/ColorField.js +6 -11
- package/dist/form/Fields/DropdownField.d.ts +3 -13
- package/dist/form/Fields/DropdownField.js +40 -27
- package/dist/form/Fields/DurationField.d.ts +1 -2
- package/dist/form/Fields/DurationField.js +25 -32
- package/dist/form/Fields/LabelField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.d.ts +6 -12
- package/dist/form/Fields/MultiDropdownField.js +31 -22
- package/dist/form/Fields/NumberField.d.ts +1 -1
- package/dist/form/Fields/NumberField.js +65 -35
- package/dist/form/Fields/ObjectField.d.ts +1 -1
- package/dist/form/Fields/ObjectField.js +12 -43
- package/dist/form/Fields/RadioField.d.ts +1 -1
- package/dist/form/Fields/RadioField.js +30 -41
- package/dist/form/Fields/RangeField.d.ts +1 -2
- package/dist/form/Fields/RangeField.js +23 -16
- package/dist/form/Fields/StringField.d.ts +1 -2
- package/dist/form/Fields/StringField.js +58 -26
- package/dist/form/Fields/TextAreaField.js +12 -10
- package/dist/form/Form.d.ts +30 -48
- package/dist/form/Form.js +306 -412
- package/dist/form/FormLayout.js +9 -9
- package/dist/form/Wizard/WizardContainer.d.ts +1 -4
- package/dist/form/Wizard/WizardContainer.js +40 -56
- package/dist/form/Wizard/WizardNavigation.js +1 -1
- package/dist/form/Wizard/WizardStepContent.d.ts +1 -5
- package/dist/form/Wizard/WizardStepContent.js +11 -16
- package/dist/form/Wizard/WizardStepIndicator.js +6 -6
- package/dist/form/Wizard/types.d.ts +0 -14
- package/dist/form/fieldRegistry.d.ts +1 -1
- package/dist/form/fieldRegistry.js +6 -6
- package/dist/form/formEditing.js +1 -1
- package/dist/form/index.d.ts +5 -4
- package/dist/form/index.js +6 -7
- package/dist/form/types/fieldComponentTypes.d.ts +8 -10
- package/dist/form/useChoiceField.d.ts +20 -0
- package/dist/form/useChoiceField.js +49 -0
- package/dist/form/useFieldValue.d.ts +7 -0
- package/dist/form/useFieldValue.js +20 -0
- package/dist/form/useParsedOpts.d.ts +3 -1
- package/dist/form/useParsedOpts.js +12 -17
- package/dist/form/utils/dependentOptions.d.ts +8 -4
- package/dist/form/utils/dependentOptions.js +25 -17
- package/dist/form/utils/fieldItems.d.ts +10 -0
- package/dist/form/utils/fieldItems.js +11 -0
- package/dist/form/utils/fieldPath.d.ts +10 -0
- package/dist/form/utils/fieldPath.js +20 -0
- package/dist/form/utils/shareEqual.d.ts +6 -0
- package/dist/form/utils/shareEqual.js +38 -0
- package/dist/graph/AnnotationBanner.js +8 -8
- package/dist/graph/Collapse.d.ts +1 -0
- package/dist/graph/Collapse.js +6 -27
- package/dist/graph/Connectors.js +5 -5
- package/dist/graph/DependencyGraph.js +20 -19
- package/dist/graph/GraphEditor.js +30 -41
- package/dist/graph/GraphEditorDialogs.js +17 -17
- package/dist/graph/GraphNode.js +1 -1
- package/dist/graph/InputDialog.js +19 -22
- package/dist/graph/InputsEditor.js +58 -66
- package/dist/graph/JobSummary.js +42 -39
- package/dist/graph/MatrixGroup.js +1 -1
- package/dist/graph/ProblemsButton.js +18 -19
- package/dist/graph/Reveal.js +1 -1
- package/dist/graph/ShortcutsButton.js +15 -18
- package/dist/graph/SuggestionInput.d.ts +5 -10
- package/dist/graph/SuggestionInput.js +14 -18
- package/dist/graph/ToolbarPopover.d.ts +11 -6
- package/dist/graph/ToolbarPopover.js +35 -67
- package/dist/graph/TreeView.js +24 -37
- package/dist/graph/WorkflowSettingsDialog.js +4 -4
- package/dist/graph/editorChrome.js +13 -12
- package/dist/graph/editorFields.js +29 -29
- package/dist/graph/editorPrimitives.d.ts +1 -1
- package/dist/graph/editorPrimitives.js +10 -7
- package/dist/graph/editorRows.js +103 -97
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/graphEditorState.d.ts +4 -3
- package/dist/graph/inputRefs.js +9 -9
- package/dist/graph/settingsViews.js +6 -7
- package/dist/graph/stepWith.js +6 -6
- package/dist/index.d.ts +14 -15
- package/dist/index.js +15 -14
- package/dist/list/ActionToolbar.d.ts +6 -14
- package/dist/list/ActionToolbar.js +48 -96
- package/dist/list/ListPage.d.ts +6 -12
- package/dist/list/ListPage.js +46 -29
- package/dist/list/ListPager.js +4 -4
- package/dist/list/ListTable.js +5 -5
- package/dist/list/ListViewControls.d.ts +5 -4
- package/dist/list/ListViewControls.js +177 -267
- package/dist/list/UserHoverCard.d.ts +3 -17
- package/dist/list/UserHoverCard.js +21 -45
- package/dist/list/index.d.ts +3 -4
- package/dist/list/index.js +3 -4
- package/dist/list/listSearch.js +12 -11
- package/dist/list/rowMenu.d.ts +63 -0
- package/dist/list/rowMenu.js +134 -0
- package/dist/logviewer/LogViewer.js +26 -26
- package/dist/styles.css +1 -1
- package/package.json +7 -13
- package/dist/ai/ui/Dropdown.d.ts +0 -31
- package/dist/ai/ui/Dropdown.js +0 -110
- package/dist/components/AddMenu.d.ts +0 -18
- package/dist/components/AddMenu.js +0 -46
- package/dist/components/BareModal.d.ts +0 -17
- package/dist/components/BareModal.js +0 -77
- package/dist/components/CollapsiblePanel.d.ts +0 -27
- package/dist/components/CollapsiblePanel.js +0 -77
- package/dist/components/Dropdown.d.ts +0 -28
- package/dist/components/Dropdown.js +0 -355
- package/dist/components/Listbox.d.ts +0 -21
- package/dist/components/Listbox.js +0 -119
- package/dist/components/MultiSelect.d.ts +0 -22
- package/dist/components/MultiSelect.js +0 -168
- package/dist/components/SwitchToggle.d.ts +0 -15
- package/dist/components/SwitchToggle.js +0 -57
- package/dist/components/SwitchToggleSmall.d.ts +0 -6
- package/dist/components/SwitchToggleSmall.js +0 -14
- package/dist/components/Toggle.d.ts +0 -6
- package/dist/components/Toggle.js +0 -20
- package/dist/components/dropdownUtils.d.ts +0 -37
- package/dist/components/dropdownUtils.js +0 -99
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -25
- package/dist/form/SpecialTypes/DropdownWrapper.js +0 -28
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +0 -51
- package/dist/form/SpecialTypes/FormikCustomDropdown.js +0 -119
- package/dist/form/SpecialTypes/FormikCustomInput.d.ts +0 -19
- package/dist/form/SpecialTypes/FormikCustomInput.js +0 -121
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +0 -13
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +0 -31
- package/dist/form/SpecialTypes/FormikNumericInput.d.ts +0 -9
- package/dist/form/SpecialTypes/FormikNumericInput.js +0 -60
- package/dist/form/SpecialTypes/index.d.ts +0 -3
- package/dist/list/HoverCard.d.ts +0 -24
- package/dist/list/HoverCard.js +0 -73
- package/dist/list/RowContextMenu.d.ts +0 -127
- package/dist/list/RowContextMenu.js +0 -515
|
@@ -1,13 +1,33 @@
|
|
|
1
|
+
import { LuEye } from "../../icons/lu/LuEye.js";
|
|
2
|
+
import { LuEyeOff } from "../../icons/lu/LuEyeOff.js";
|
|
1
3
|
import { FieldWrapper } from "../FieldWrapper.js";
|
|
2
|
-
import
|
|
4
|
+
import { useFieldValue } from "../useFieldValue.js";
|
|
3
5
|
import { getPlaceholder } from "../utils/getPlaceholder.js";
|
|
4
|
-
import {
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useMemo, useState } from "react";
|
|
6
9
|
//#region src/form/Fields/StringField.tsx
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
10
|
+
function StringField({ field, label, labelPosition, missing, disabled, onChange, tooltipComponent, spaceCompact }) {
|
|
11
|
+
const [value, change] = useFieldValue(field.name ?? "");
|
|
12
|
+
const [revealed, setRevealed] = useState(false);
|
|
13
|
+
const password = field.type === "password";
|
|
14
|
+
const fallback = field.default ?? "";
|
|
15
|
+
const disallowed = useMemo(() => {
|
|
16
|
+
if (field.sanitize === void 0) return;
|
|
17
|
+
try {
|
|
18
|
+
return new RegExp(field.sanitize, "g");
|
|
19
|
+
} catch {
|
|
20
|
+
console.error("Invalid regex for sanitization:", field.sanitize);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}, [field.sanitize]);
|
|
24
|
+
const handleChange = (e) => {
|
|
25
|
+
const cased = field.lowercase ? e.target.value.toLowerCase() : e.target.value;
|
|
26
|
+
const text = disallowed ? cased.replace(disallowed, "") : cased;
|
|
27
|
+
const next = password && text === "" ? fallback : text;
|
|
28
|
+
onChange?.(next);
|
|
29
|
+
change(next);
|
|
30
|
+
};
|
|
11
31
|
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
12
32
|
optional: field.optional,
|
|
13
33
|
label,
|
|
@@ -15,24 +35,36 @@ var StringField_default = memo(function StringField(props) {
|
|
|
15
35
|
description: field.description,
|
|
16
36
|
labelPosition,
|
|
17
37
|
spaceCompact,
|
|
18
|
-
children:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
children: ({ id, describedBy }) => {
|
|
39
|
+
const input = /* @__PURE__ */ jsx("input", {
|
|
40
|
+
id,
|
|
41
|
+
"aria-describedby": describedBy,
|
|
42
|
+
"data-1p-ignore": true,
|
|
43
|
+
className: clsx("w-full", disabled && "disabled", missing && "invalid", password && "pr-8"),
|
|
44
|
+
name: field.name,
|
|
45
|
+
value: password && value === fallback ? "" : value ?? "",
|
|
46
|
+
type: password && !revealed ? "password" : "text",
|
|
47
|
+
"aria-required": field.optional ? void 0 : true,
|
|
48
|
+
disabled,
|
|
49
|
+
placeholder: password && field.placeholder === void 0 ? "•".repeat(fallback.toString().length > 0 ? 16 : 0) : getPlaceholder(field.placeholder, field.default),
|
|
50
|
+
minLength: field.minLength,
|
|
51
|
+
maxLength: field.maxLength,
|
|
52
|
+
onChange: handleChange
|
|
53
|
+
});
|
|
54
|
+
return password ? /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "relative w-full",
|
|
56
|
+
children: [input, /* @__PURE__ */ jsx("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 theme-muted-text",
|
|
59
|
+
onClick: () => setRevealed((shown) => !shown),
|
|
60
|
+
disabled,
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
"aria-label": revealed ? "Hide value" : "Show value",
|
|
63
|
+
children: revealed ? /* @__PURE__ */ jsx(LuEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(LuEye, { className: "h-4 w-4" })
|
|
64
|
+
})]
|
|
65
|
+
}) : input;
|
|
66
|
+
}
|
|
35
67
|
});
|
|
36
|
-
}
|
|
68
|
+
}
|
|
37
69
|
//#endregion
|
|
38
|
-
export {
|
|
70
|
+
export { StringField as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FieldWrapper } from "../FieldWrapper.js";
|
|
2
|
+
import { useFieldValue } from "../useFieldValue.js";
|
|
2
3
|
import { getPlaceholder } from "../utils/getPlaceholder.js";
|
|
3
|
-
import
|
|
4
|
+
import { clsx } from "clsx";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Field } from "formik";
|
|
6
6
|
//#region src/form/Fields/TextAreaField.tsx
|
|
7
7
|
function TextAreaField(props) {
|
|
8
8
|
const { field, label, labelPosition, missing, disabled, onChange, tooltipComponent, spaceCompact } = props;
|
|
9
|
-
const
|
|
9
|
+
const [value, change] = useFieldValue(field.name ?? "");
|
|
10
10
|
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
11
11
|
optional: field.optional,
|
|
12
12
|
label,
|
|
@@ -14,18 +14,20 @@ function TextAreaField(props) {
|
|
|
14
14
|
description: field.description,
|
|
15
15
|
labelPosition,
|
|
16
16
|
spaceCompact,
|
|
17
|
-
children: ({ id, describedBy }) => /* @__PURE__ */ jsx(
|
|
18
|
-
className:
|
|
19
|
-
as: "textarea",
|
|
17
|
+
children: ({ id, describedBy }) => /* @__PURE__ */ jsx("textarea", {
|
|
18
|
+
className: clsx("theme-input h-[82px] w-full rounded leading-4 overflow-y-scroll", disabled && "disabled", missing && "border-red-600 focus:border-red-600 focus:ring-red-500"),
|
|
20
19
|
id,
|
|
21
20
|
"aria-describedby": describedBy,
|
|
22
21
|
"aria-required": field.optional ? void 0 : true,
|
|
23
|
-
name:
|
|
24
|
-
|
|
22
|
+
name: field.name,
|
|
23
|
+
value: value ?? "",
|
|
25
24
|
placeholder: getPlaceholder(field.placeholder, field.default),
|
|
26
25
|
disabled,
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
onChange: (e) => {
|
|
27
|
+
onChange?.(e.target.value);
|
|
28
|
+
change(e.target.value);
|
|
29
|
+
}
|
|
30
|
+
})
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
//#endregion
|
package/dist/form/Form.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import React, { type SetStateAction } from 'react';
|
|
1
|
+
import { type UseFormReturn } from 'react-hook-form';
|
|
3
2
|
import type { WorkflowVariables } from '../engine.js';
|
|
4
3
|
import { type FieldComponent } from './fieldRegistry.js';
|
|
5
4
|
interface FormMeta {
|
|
@@ -15,7 +14,8 @@ export declare function resolveMetaOverrides(options: {
|
|
|
15
14
|
};
|
|
16
15
|
/** Cheap signature of every list's length; gates the expensive collect walk. */
|
|
17
16
|
export declare function listLengthsSignature(options: Record<string, unknown>, values?: Record<string, unknown>, prefix?: string): string;
|
|
18
|
-
/** Collects every field with a `default` for the form-level sync to track
|
|
17
|
+
/** Collects every field with a `default` for the form-level sync to track, named as the form store
|
|
18
|
+
* names it: a row's fields by `list.0.field`. */
|
|
19
19
|
export declare function collectFieldsWithDefaults(options: Record<string, unknown>, values?: Record<string, unknown>, prefix?: string): Array<{
|
|
20
20
|
name: string;
|
|
21
21
|
defaultValue: unknown;
|
|
@@ -23,8 +23,8 @@ export declare function collectFieldsWithDefaults(options: Record<string, unknow
|
|
|
23
23
|
}>;
|
|
24
24
|
export declare function defaultReferencesField(defaultValue: unknown, fieldPath: string): boolean;
|
|
25
25
|
export declare function findSelfReferencingFieldNames(schema: Record<string, unknown>, values?: Record<string, unknown>): string[];
|
|
26
|
-
/** Resolves schema defaults into form values as dependencies change. Store-agnostic so the
|
|
27
|
-
*
|
|
26
|
+
/** Resolves schema defaults into form values as dependencies change. Store-agnostic so the form and
|
|
27
|
+
* hosts with their own store share one implementation. */
|
|
28
28
|
export declare function useDynamicDefaultsSync({ options, values, setValue, isTouched, }: {
|
|
29
29
|
options: Record<string, unknown>;
|
|
30
30
|
values: Record<string, unknown>;
|
|
@@ -34,65 +34,46 @@ export declare function useDynamicDefaultsSync({ options, values, setValue, isTo
|
|
|
34
34
|
export declare function DynamicDefaultsSync({ options }: {
|
|
35
35
|
options: Record<string, unknown>;
|
|
36
36
|
}): null;
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
secondaryLabel?: string;
|
|
47
|
-
value: string | boolean | number;
|
|
48
|
-
selected?: boolean;
|
|
37
|
+
export type FormValues = Record<string, unknown>;
|
|
38
|
+
/** Called by a field marked `one_must_be_true` in a list's row, so the list can keep one row on. */
|
|
39
|
+
type RowFlagChange = (fieldName: string, index: number, changeOtherValuesTo?: string | boolean, keepOneValueOf?: string | boolean, currentValue?: string | boolean) => void;
|
|
40
|
+
/** Where fields that are part of another field, as an object's or a list row's, keep their values. */
|
|
41
|
+
export interface ParentInfo {
|
|
42
|
+
computeOn?: boolean | undefined;
|
|
43
|
+
fieldNamePrefix: string;
|
|
44
|
+
arrayIndex?: number | undefined;
|
|
45
|
+
onChange?: RowFlagChange | undefined;
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
label: string;
|
|
53
|
-
invalid?: boolean;
|
|
54
|
-
options?: (string | MultiSelectOption)[];
|
|
55
|
-
setFormDirty: TSetFormDirty;
|
|
56
|
-
onChange?: ((val: unknown) => void) | undefined;
|
|
57
|
-
parentValue?: unknown;
|
|
58
|
-
}): React.JSX.Element;
|
|
59
|
-
export declare function FieldsFromOptions({ options, values, setFormDirty, setFieldValue, setFieldTouched, parentInfo, labelPosition, missingFields, spaceCompact, workflowForm, }: {
|
|
47
|
+
/** Renders a schema's fields. Inside another field, `parentInfo` says where their values sit. */
|
|
48
|
+
export declare function FieldsFromOptions({ options, parentInfo, labelPosition, spaceCompact, }: {
|
|
60
49
|
options: Record<string, unknown>;
|
|
61
|
-
|
|
62
|
-
setFormDirty: TSetFormDirty;
|
|
63
|
-
setFieldValue: (field: string, value: unknown, shouldValidate?: boolean) => void;
|
|
64
|
-
setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean) => void;
|
|
65
|
-
/** If fields are part of other field, this is the info needed*/
|
|
66
|
-
parentInfo?: {
|
|
67
|
-
computeOn?: boolean | undefined;
|
|
68
|
-
parentName: string;
|
|
69
|
-
fieldNamePrefix: string;
|
|
70
|
-
arrayIndex?: number | undefined;
|
|
71
|
-
onChange?: (fieldName: string, index: number, changeOtherValuesTo?: string | boolean, keepOneValueOf?: string | boolean, currentValue?: string | boolean) => void;
|
|
72
|
-
} | undefined;
|
|
50
|
+
parentInfo?: ParentInfo | undefined;
|
|
73
51
|
labelPosition?: 'left' | 'top' | undefined;
|
|
74
|
-
missingFields?: string[];
|
|
75
52
|
spaceCompact?: boolean;
|
|
76
|
-
|
|
77
|
-
workflowForm?: boolean | undefined;
|
|
78
|
-
}): React.JSX.Element;
|
|
53
|
+
}): import("react").JSX.Element;
|
|
79
54
|
export interface DynamicFormProps {
|
|
55
|
+
/**
|
|
56
|
+
* The form to render into, from the host's own `useForm()`, which then reads and drives it:
|
|
57
|
+
* `formState.isDirty`, `getValues`, `reset`, `trigger`. Without one, the form keeps its own.
|
|
58
|
+
*/
|
|
59
|
+
form?: UseFormReturn<FormValues>;
|
|
80
60
|
/** Enables validated layout-only CSS declarations on authored layout nodes. */
|
|
81
61
|
allowLayoutCSS?: boolean;
|
|
82
62
|
formJSONs: Record<string, unknown>;
|
|
63
|
+
/** Loads `initialValues` again whenever they change, as Formik's `enableReinitialize` did. */
|
|
83
64
|
reinitialize?: boolean;
|
|
84
|
-
setFormDirty?: (dirty: boolean) => void;
|
|
85
65
|
initialValues: object;
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
/** Every change to the form's values, as it happens. */
|
|
67
|
+
onValuesChange?: (values: FormValues) => void;
|
|
88
68
|
labelPosition?: 'left' | 'top';
|
|
69
|
+
/** Fields to mark as missing a value, by name; the form sets them as `required` errors. */
|
|
89
70
|
missingFields?: string[] | undefined;
|
|
90
71
|
spaceCompact?: boolean;
|
|
91
72
|
organizationVariables?: WorkflowVariables | undefined;
|
|
92
73
|
/** A remote workflow's repo/branch/yaml, so `${{ remote.* }}` resolves the same here as it does on the run. */
|
|
93
74
|
remoteVars?: Record<string, string | undefined> | undefined;
|
|
94
75
|
needsOrganizationVariables?: boolean;
|
|
95
|
-
onSubmit?: ((values:
|
|
76
|
+
onSubmit?: ((values: FormValues) => void) | undefined;
|
|
96
77
|
submitLabel?: string;
|
|
97
78
|
className?: string;
|
|
98
79
|
/** Prevents deletion of hidden+ignored field values (workflow forms filter at submit time). */
|
|
@@ -106,5 +87,6 @@ export interface DynamicFormProps {
|
|
|
106
87
|
/** Host-supplied field components, merged over the core registry by type. */
|
|
107
88
|
fields?: Record<string, FieldComponent>;
|
|
108
89
|
}
|
|
109
|
-
|
|
90
|
+
/** A form drawn from a workflow's schema. */
|
|
91
|
+
export declare function DynamicForm({ form, ...props }: DynamicFormProps): import("react").JSX.Element;
|
|
110
92
|
export {};
|