@parallelworks/ui 0.41.0 → 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.
Files changed (280) hide show
  1. package/README.md +25 -0
  2. package/dist/ai/components/AllocationSelector.d.ts +3 -4
  3. package/dist/ai/components/AllocationSelector.js +37 -33
  4. package/dist/ai/components/AttachmentManager.js +7 -7
  5. package/dist/ai/components/AttachmentUpload.js +5 -5
  6. package/dist/ai/components/BranchNavigator.js +1 -1
  7. package/dist/ai/components/ChatEmptyState.js +2 -2
  8. package/dist/ai/components/ChatInput.js +10 -8
  9. package/dist/ai/components/ChatLayout.js +4 -5
  10. package/dist/ai/components/ChatMessage.js +12 -12
  11. package/dist/ai/components/ChatMessageList.js +9 -9
  12. package/dist/ai/components/ChatSidebar.js +8 -9
  13. package/dist/ai/components/ChatThread.js +4 -4
  14. package/dist/ai/components/ComposerChrome.d.ts +2 -2
  15. package/dist/ai/components/ComposerChrome.js +3 -6
  16. package/dist/ai/components/DragOverlay.js +2 -2
  17. package/dist/ai/components/ModelSelector.d.ts +5 -3
  18. package/dist/ai/components/ModelSelector.js +102 -339
  19. package/dist/ai/components/PastedText.js +11 -11
  20. package/dist/ai/components/ProviderIssueBanner.d.ts +2 -0
  21. package/dist/ai/components/ProviderIssueBanner.js +34 -16
  22. package/dist/ai/components/Reasoning.js +4 -4
  23. package/dist/ai/components/ShareDialog.js +43 -35
  24. package/dist/ai/components/SlashMenu.d.ts +12 -2
  25. package/dist/ai/components/SlashMenu.js +29 -13
  26. package/dist/ai/components/agent/ActivityLine.js +3 -3
  27. package/dist/ai/components/agent/AgentMessageParts.js +20 -20
  28. package/dist/ai/components/agent/PermissionPicker.js +13 -11
  29. package/dist/ai/components/conversationActions.d.ts +4 -6
  30. package/dist/ai/components/conversationActions.js +9 -13
  31. package/dist/ai/core/ChatProvider.js +1 -1
  32. package/dist/ai/core/config.js +1 -1
  33. package/dist/ai/core/providerIssues.d.ts +7 -0
  34. package/dist/ai/core/providerIssues.js +9 -1
  35. package/dist/ai/core/useKeyboardShortcuts.d.ts +4 -0
  36. package/dist/ai/core/useKeyboardShortcuts.js +8 -2
  37. package/dist/ai/index.d.ts +0 -1
  38. package/dist/ai/index.js +1 -2
  39. package/dist/ai/strings.d.ts +19 -0
  40. package/dist/ai/strings.js +18 -1
  41. package/dist/ai/ui/Avatar.js +5 -5
  42. package/dist/ai/ui/ConversationSidebar.d.ts +0 -1
  43. package/dist/ai/ui/ConversationSidebar.js +6 -7
  44. package/dist/ai/ui/Markdown.js +3 -3
  45. package/dist/ai/ui/Notice.js +6 -6
  46. package/dist/ai/ui/chip.d.ts +4 -0
  47. package/dist/ai/ui/chip.js +8 -0
  48. package/dist/ai/ui/sidebar.d.ts +6 -5
  49. package/dist/ai/ui/sidebar.js +39 -43
  50. package/dist/components/ActionMenu.d.ts +13 -0
  51. package/dist/components/ActionMenu.js +30 -0
  52. package/dist/components/Avatar.js +6 -6
  53. package/dist/components/Breadcrumbs.js +1 -1
  54. package/dist/components/Button.js +10 -10
  55. package/dist/components/Callout.js +2 -2
  56. package/dist/components/Card.js +3 -3
  57. package/dist/components/Combobox.d.ts +66 -0
  58. package/dist/components/Combobox.js +393 -0
  59. package/dist/components/ConfirmModal.js +11 -11
  60. package/dist/components/ContextMenu.d.ts +23 -0
  61. package/dist/components/ContextMenu.js +89 -0
  62. package/dist/components/CopyToClipboard.js +2 -2
  63. package/dist/components/CreateModal.d.ts +17 -36
  64. package/dist/components/CreateModal.js +97 -259
  65. package/dist/components/DescriptionList.js +8 -8
  66. package/dist/components/Filter.js +2 -2
  67. package/dist/components/FilterPill.js +2 -2
  68. package/dist/components/HoverCard.d.ts +14 -0
  69. package/dist/components/HoverCard.js +33 -0
  70. package/dist/components/IconButton.d.ts +5 -5
  71. package/dist/components/IconButton.js +18 -22
  72. package/dist/components/InfoTip.d.ts +15 -0
  73. package/dist/components/InfoTip.js +60 -0
  74. package/dist/components/Input.js +5 -5
  75. package/dist/components/LetterBadge.js +2 -2
  76. package/dist/components/Loader.js +3 -3
  77. package/dist/components/Markdown.js +1 -1
  78. package/dist/components/MarkdownImpl.js +2 -2
  79. package/dist/components/Menu.d.ts +33 -0
  80. package/dist/components/Menu.js +86 -0
  81. package/dist/components/MenuEntries.d.ts +56 -0
  82. package/dist/components/MenuEntries.js +123 -0
  83. package/dist/components/Modal.d.ts +29 -0
  84. package/dist/components/Modal.js +47 -0
  85. package/dist/components/Overview.js +11 -10
  86. package/dist/components/PageHeader.d.ts +10 -16
  87. package/dist/components/PageHeader.js +69 -95
  88. package/dist/components/Pagination.js +5 -5
  89. package/dist/components/Provider.d.ts +5 -11
  90. package/dist/components/Provider.js +11 -14
  91. package/dist/components/Radio.d.ts +8 -0
  92. package/dist/components/Radio.js +16 -0
  93. package/dist/components/SectionHeader.js +2 -2
  94. package/dist/components/SegmentedControl.d.ts +6 -5
  95. package/dist/components/SegmentedControl.js +34 -30
  96. package/dist/components/Select.d.ts +27 -0
  97. package/dist/components/Select.js +78 -0
  98. package/dist/components/SettingModeOption.d.ts +5 -8
  99. package/dist/components/SettingModeOption.js +10 -12
  100. package/dist/components/SettingRow.js +4 -4
  101. package/dist/components/SettingsCard.js +4 -4
  102. package/dist/components/SettingsGroup.js +2 -2
  103. package/dist/components/Sort.js +1 -1
  104. package/dist/components/StatusBadge.js +7 -7
  105. package/dist/components/StatusIcons.js +4 -4
  106. package/dist/components/Switch.d.ts +22 -0
  107. package/dist/components/Switch.js +28 -0
  108. package/dist/components/Table.js +11 -11
  109. package/dist/components/Tooltip.d.ts +24 -20
  110. package/dist/components/Tooltip.js +58 -76
  111. package/dist/components/floating.d.ts +14 -0
  112. package/dist/components/floating.js +21 -0
  113. package/dist/components/search.d.ts +2 -0
  114. package/dist/components/search.js +14 -0
  115. package/dist/editor/Editor.js +1 -1
  116. package/dist/editor/EditorField.js +16 -21
  117. package/dist/editor/FormCodePanel.js +19 -19
  118. package/dist/editor/Monaco.js +3 -3
  119. package/dist/file-explorer/FileExplorer.js +77 -81
  120. package/dist/file-explorer/FileExplorerContext.js +2 -2
  121. package/dist/file-explorer/FilePreview/CodePreviewEditor.js +1 -1
  122. package/dist/file-explorer/FilePreview/Inline.js +1 -1
  123. package/dist/file-explorer/FilePreview/StreamedBadge.js +5 -6
  124. package/dist/file-explorer/FilePreview/Viewer.js +8 -8
  125. package/dist/file-explorer/FilePreview/index.d.ts +1 -1
  126. package/dist/file-explorer/FilePreview/index.js +49 -83
  127. package/dist/file-explorer/FileRow.d.ts +4 -3
  128. package/dist/file-explorer/FileRow.js +32 -38
  129. package/dist/file-explorer/FileRowsWindow.d.ts +3 -2
  130. package/dist/file-explorer/FileRowsWindow.js +4 -4
  131. package/dist/file-explorer/FileTable.d.ts +3 -2
  132. package/dist/file-explorer/FileTable.js +3 -3
  133. package/dist/file-explorer/LoadMoreRow.js +1 -1
  134. package/dist/file-explorer/TreeView.js +11 -16
  135. package/dist/file-explorer/helpers.js +11 -12
  136. package/dist/file-explorer/toasts.js +11 -11
  137. package/dist/form/FieldGroup.d.ts +11 -0
  138. package/dist/form/FieldGroup.js +36 -0
  139. package/dist/form/FieldWrapper.js +4 -4
  140. package/dist/form/Fields/BooleanField.js +23 -33
  141. package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
  142. package/dist/form/Fields/CheckboxGroupField.js +9 -13
  143. package/dist/form/Fields/ColorField.d.ts +1 -2
  144. package/dist/form/Fields/ColorField.js +6 -11
  145. package/dist/form/Fields/DropdownField.d.ts +3 -13
  146. package/dist/form/Fields/DropdownField.js +40 -27
  147. package/dist/form/Fields/DurationField.d.ts +1 -2
  148. package/dist/form/Fields/DurationField.js +25 -32
  149. package/dist/form/Fields/LabelField.js +2 -2
  150. package/dist/form/Fields/MultiDropdownField.d.ts +6 -12
  151. package/dist/form/Fields/MultiDropdownField.js +31 -22
  152. package/dist/form/Fields/NumberField.d.ts +1 -1
  153. package/dist/form/Fields/NumberField.js +65 -35
  154. package/dist/form/Fields/ObjectField.d.ts +1 -1
  155. package/dist/form/Fields/ObjectField.js +12 -43
  156. package/dist/form/Fields/RadioField.d.ts +1 -1
  157. package/dist/form/Fields/RadioField.js +30 -41
  158. package/dist/form/Fields/RangeField.d.ts +1 -2
  159. package/dist/form/Fields/RangeField.js +23 -16
  160. package/dist/form/Fields/StringField.d.ts +1 -2
  161. package/dist/form/Fields/StringField.js +58 -26
  162. package/dist/form/Fields/TextAreaField.js +12 -10
  163. package/dist/form/Form.d.ts +30 -48
  164. package/dist/form/Form.js +306 -412
  165. package/dist/form/FormLayout.js +9 -9
  166. package/dist/form/Wizard/WizardContainer.d.ts +1 -4
  167. package/dist/form/Wizard/WizardContainer.js +40 -56
  168. package/dist/form/Wizard/WizardNavigation.js +1 -1
  169. package/dist/form/Wizard/WizardStepContent.d.ts +1 -5
  170. package/dist/form/Wizard/WizardStepContent.js +11 -16
  171. package/dist/form/Wizard/WizardStepIndicator.js +6 -6
  172. package/dist/form/Wizard/types.d.ts +0 -14
  173. package/dist/form/fieldRegistry.d.ts +1 -1
  174. package/dist/form/fieldRegistry.js +6 -6
  175. package/dist/form/formEditing.js +1 -1
  176. package/dist/form/index.d.ts +5 -4
  177. package/dist/form/index.js +6 -7
  178. package/dist/form/types/fieldComponentTypes.d.ts +8 -10
  179. package/dist/form/useChoiceField.d.ts +20 -0
  180. package/dist/form/useChoiceField.js +49 -0
  181. package/dist/form/useFieldValue.d.ts +7 -0
  182. package/dist/form/useFieldValue.js +20 -0
  183. package/dist/form/useParsedOpts.d.ts +3 -1
  184. package/dist/form/useParsedOpts.js +12 -17
  185. package/dist/form/utils/dependentOptions.d.ts +8 -4
  186. package/dist/form/utils/dependentOptions.js +25 -17
  187. package/dist/form/utils/fieldItems.d.ts +10 -0
  188. package/dist/form/utils/fieldItems.js +11 -0
  189. package/dist/form/utils/fieldPath.d.ts +10 -0
  190. package/dist/form/utils/fieldPath.js +20 -0
  191. package/dist/form/utils/shareEqual.d.ts +6 -0
  192. package/dist/form/utils/shareEqual.js +38 -0
  193. package/dist/graph/AnnotationBanner.js +8 -8
  194. package/dist/graph/Collapse.d.ts +1 -0
  195. package/dist/graph/Collapse.js +6 -27
  196. package/dist/graph/Connectors.js +5 -5
  197. package/dist/graph/DependencyGraph.js +20 -19
  198. package/dist/graph/GraphEditor.js +30 -41
  199. package/dist/graph/GraphEditorDialogs.js +17 -17
  200. package/dist/graph/GraphNode.js +1 -1
  201. package/dist/graph/InputDialog.js +19 -22
  202. package/dist/graph/InputsEditor.js +58 -66
  203. package/dist/graph/JobSummary.js +42 -39
  204. package/dist/graph/MatrixGroup.js +1 -1
  205. package/dist/graph/ProblemsButton.js +18 -19
  206. package/dist/graph/Reveal.js +1 -1
  207. package/dist/graph/ShortcutsButton.js +15 -18
  208. package/dist/graph/SuggestionInput.d.ts +5 -10
  209. package/dist/graph/SuggestionInput.js +14 -18
  210. package/dist/graph/ToolbarPopover.d.ts +11 -6
  211. package/dist/graph/ToolbarPopover.js +35 -67
  212. package/dist/graph/TreeView.js +24 -37
  213. package/dist/graph/WorkflowSettingsDialog.js +4 -4
  214. package/dist/graph/editorChrome.js +13 -12
  215. package/dist/graph/editorFields.js +29 -29
  216. package/dist/graph/editorPrimitives.d.ts +1 -1
  217. package/dist/graph/editorPrimitives.js +10 -7
  218. package/dist/graph/editorRows.js +103 -97
  219. package/dist/graph/fieldProblems.js +2 -2
  220. package/dist/graph/graphEditorState.d.ts +4 -3
  221. package/dist/graph/inputRefs.js +9 -9
  222. package/dist/graph/settingsViews.js +6 -7
  223. package/dist/graph/stepWith.js +6 -6
  224. package/dist/index.d.ts +14 -15
  225. package/dist/index.js +15 -14
  226. package/dist/list/ActionToolbar.d.ts +6 -14
  227. package/dist/list/ActionToolbar.js +48 -96
  228. package/dist/list/ListPage.d.ts +6 -12
  229. package/dist/list/ListPage.js +46 -29
  230. package/dist/list/ListPager.js +4 -4
  231. package/dist/list/ListTable.js +5 -5
  232. package/dist/list/ListViewControls.d.ts +5 -4
  233. package/dist/list/ListViewControls.js +177 -267
  234. package/dist/list/UserHoverCard.d.ts +3 -17
  235. package/dist/list/UserHoverCard.js +21 -45
  236. package/dist/list/index.d.ts +3 -4
  237. package/dist/list/index.js +3 -4
  238. package/dist/list/listSearch.js +12 -11
  239. package/dist/list/rowMenu.d.ts +63 -0
  240. package/dist/list/rowMenu.js +134 -0
  241. package/dist/logviewer/LogViewer.js +26 -26
  242. package/dist/styles.css +1 -1
  243. package/package.json +7 -13
  244. package/dist/ai/ui/Dropdown.d.ts +0 -31
  245. package/dist/ai/ui/Dropdown.js +0 -110
  246. package/dist/components/AddMenu.d.ts +0 -18
  247. package/dist/components/AddMenu.js +0 -46
  248. package/dist/components/BareModal.d.ts +0 -17
  249. package/dist/components/BareModal.js +0 -77
  250. package/dist/components/CollapsiblePanel.d.ts +0 -27
  251. package/dist/components/CollapsiblePanel.js +0 -77
  252. package/dist/components/Dropdown.d.ts +0 -28
  253. package/dist/components/Dropdown.js +0 -355
  254. package/dist/components/Listbox.d.ts +0 -21
  255. package/dist/components/Listbox.js +0 -119
  256. package/dist/components/MultiSelect.d.ts +0 -22
  257. package/dist/components/MultiSelect.js +0 -168
  258. package/dist/components/SwitchToggle.d.ts +0 -15
  259. package/dist/components/SwitchToggle.js +0 -57
  260. package/dist/components/SwitchToggleSmall.d.ts +0 -6
  261. package/dist/components/SwitchToggleSmall.js +0 -14
  262. package/dist/components/Toggle.d.ts +0 -6
  263. package/dist/components/Toggle.js +0 -20
  264. package/dist/components/dropdownUtils.d.ts +0 -37
  265. package/dist/components/dropdownUtils.js +0 -99
  266. package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -25
  267. package/dist/form/SpecialTypes/DropdownWrapper.js +0 -28
  268. package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +0 -51
  269. package/dist/form/SpecialTypes/FormikCustomDropdown.js +0 -119
  270. package/dist/form/SpecialTypes/FormikCustomInput.d.ts +0 -19
  271. package/dist/form/SpecialTypes/FormikCustomInput.js +0 -121
  272. package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +0 -13
  273. package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +0 -31
  274. package/dist/form/SpecialTypes/FormikNumericInput.d.ts +0 -9
  275. package/dist/form/SpecialTypes/FormikNumericInput.js +0 -60
  276. package/dist/form/SpecialTypes/index.d.ts +0 -3
  277. package/dist/list/HoverCard.d.ts +0 -24
  278. package/dist/list/HoverCard.js +0 -73
  279. package/dist/list/RowContextMenu.d.ts +0 -127
  280. 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 FormikCustomInput from "../SpecialTypes/FormikCustomInput.js";
4
+ import { useFieldValue } from "../useFieldValue.js";
3
5
  import { getPlaceholder } from "../utils/getPlaceholder.js";
4
- import { memo } from "react";
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
- var StringField_default = memo(function StringField(props) {
8
- const { field, label, labelPosition, missing, disabled, onChange, tooltipComponent, spaceCompact, currentValue } = props;
9
- const fieldName = field.name ?? "";
10
- const value = field.prefillDefault ? currentValue : void 0;
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: /* @__PURE__ */ jsx(FormikCustomInput, {
19
- invalid: missing,
20
- name: fieldName,
21
- type: field.type,
22
- lowercase: field.lowercase,
23
- placeholder: field.type === "password" && field.placeholder === void 0 ? "•".repeat((field.default ?? "").toString().length > 0 ? 16 : 0) : getPlaceholder(field.placeholder, field.default),
24
- disabled,
25
- step: field.step,
26
- min: field.min,
27
- max: field.max,
28
- minLength: field.minLength,
29
- maxLength: field.maxLength,
30
- sanitize: field.sanitize,
31
- defaultValue: field.default,
32
- value,
33
- ...onChange && { onChange }
34
- }, field.name)
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 { StringField_default as default };
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 cx from "classnames";
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 fieldName = field.name ?? "";
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(Field, {
18
- className: cx("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"),
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: fieldName,
24
- type: "search",
22
+ name: field.name,
23
+ value: value ?? "",
25
24
  placeholder: getPlaceholder(field.placeholder, field.default),
26
25
  disabled,
27
- ...onChange && { onChange }
28
- }, field.name)
26
+ onChange: (e) => {
27
+ onChange?.(e.target.value);
28
+ change(e.target.value);
29
+ }
30
+ })
29
31
  });
30
32
  }
31
33
  //#endregion
@@ -1,5 +1,4 @@
1
- import { type FormikProps, type FormikValues } from 'formik';
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 Formik
27
- * form and hosts with their own store share one implementation. */
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 declare function GroupHeader({ children, open, setOpen, title, }: {
38
- children?: React.ReactNode;
39
- open: boolean;
40
- setOpen: React.Dispatch<SetStateAction<boolean>>;
41
- title: React.ReactNode;
42
- }): React.JSX.Element;
43
- export type TSetFormDirty = (dirty: boolean) => void;
44
- interface MultiSelectOption {
45
- label: string;
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
- export declare function MultiSelectionDropdown({ name, label, invalid, options: initialOptions, setFormDirty, onChange, parentValue, }: {
51
- name: string;
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
- values: Record<string, unknown>;
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
- /** Prevents deletion of hidden+ignored field values (workflow forms filter at submit time) */
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
- setValues?: (values: Record<string, unknown>) => void;
87
- formikRef?: React.RefObject<FormikProps<FormikValues> | null>;
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: Record<string, unknown>) => void) | undefined;
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
- export declare function DynamicForm({ formJSONs: options, reinitialize, initialValues, setValues, setFormDirty, formikRef, labelPosition, missingFields, spaceCompact, organizationVariables, remoteVars, needsOrganizationVariables, onSubmit, submitLabel, className, workflowForm, contextKey, skipValueParse, fields, allowLayoutCSS, }: DynamicFormProps): React.JSX.Element;
90
+ /** A form drawn from a workflow's schema. */
91
+ export declare function DynamicForm({ form, ...props }: DynamicFormProps): import("react").JSX.Element;
110
92
  export {};