impact-nova 2.3.0 → 2.4.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 (147) hide show
  1. package/dist/filter-shell/index.d.ts +12 -0
  2. package/dist/filter-shell/index.js +9 -0
  3. package/dist/filter-shell/utils/buildFilterFieldValidationRules.d.ts +1 -0
  4. package/dist/filter-shell/utils/validateVisibleRequiredFilterFields.d.ts +1 -0
  5. package/dist/filter-shell/utils/validationNavigation.utils.d.ts +26 -0
  6. package/dist/filter-shell/utils/validationNavigation.utils.js +38 -0
  7. package/dist/form-engine/field-dependency-graph.d.ts +17 -0
  8. package/dist/form-engine/field-dependency-graph.js +90 -0
  9. package/dist/form-engine/index.d.ts +9 -0
  10. package/dist/form-engine/index.js +16 -0
  11. package/dist/form-engine/is-empty-value.d.ts +1 -0
  12. package/dist/form-engine/is-empty-value.js +8 -0
  13. package/dist/form-engine/types.d.ts +17 -0
  14. package/dist/form-react/Fields/ButtonsGroupField.d.ts +3 -0
  15. package/dist/form-react/Fields/ButtonsGroupField.js +52 -0
  16. package/dist/form-react/Fields/CheckboxField.d.ts +3 -0
  17. package/dist/form-react/Fields/CheckboxField.js +46 -0
  18. package/dist/form-react/Fields/ChipsField.d.ts +3 -0
  19. package/dist/form-react/Fields/ChipsField.js +146 -0
  20. package/dist/form-react/Fields/DateInputField.d.ts +8 -0
  21. package/dist/form-react/Fields/DateInputField.js +134 -0
  22. package/dist/form-react/Fields/DateRangeField.d.ts +8 -0
  23. package/dist/form-react/Fields/DateRangeField.js +57 -0
  24. package/dist/form-react/Fields/DividerField.d.ts +3 -0
  25. package/dist/form-react/Fields/DividerField.js +9 -0
  26. package/dist/form-react/Fields/DividerWithLabelField.d.ts +3 -0
  27. package/dist/form-react/Fields/DividerWithLabelField.js +31 -0
  28. package/dist/form-react/Fields/FileUploadField.d.ts +3 -0
  29. package/dist/form-react/Fields/FileUploadField.js +42 -0
  30. package/dist/form-react/Fields/FillFormByFileUploadField.d.ts +3 -0
  31. package/dist/form-react/Fields/FillFormByFileUploadField.js +65 -0
  32. package/dist/form-react/Fields/FillFormByPasteField.d.ts +3 -0
  33. package/dist/form-react/Fields/FillFormByPasteField.js +106 -0
  34. package/dist/form-react/Fields/LabelField.d.ts +3 -0
  35. package/dist/form-react/Fields/LabelField.js +14 -0
  36. package/dist/form-react/Fields/MonthRangeField.d.ts +8 -0
  37. package/dist/form-react/Fields/MonthRangeField.js +72 -0
  38. package/dist/form-react/Fields/MultiMonthPickerField.d.ts +8 -0
  39. package/dist/form-react/Fields/MultiMonthPickerField.js +46 -0
  40. package/dist/form-react/Fields/MultiWeekPickerField.d.ts +8 -0
  41. package/dist/form-react/Fields/MultiWeekPickerField.js +47 -0
  42. package/dist/form-react/Fields/NumericComboboxField.d.ts +18 -0
  43. package/dist/form-react/Fields/NumericComboboxField.js +51 -0
  44. package/dist/form-react/Fields/RadioField.d.ts +3 -0
  45. package/dist/form-react/Fields/RadioField.js +68 -0
  46. package/dist/form-react/Fields/SelectField.d.ts +3 -0
  47. package/dist/form-react/Fields/SelectField.js +76 -0
  48. package/dist/form-react/Fields/SwitchField.d.ts +3 -0
  49. package/dist/form-react/Fields/SwitchField.js +47 -0
  50. package/dist/form-react/Fields/TextAreaField.d.ts +3 -0
  51. package/dist/form-react/Fields/TextAreaField.js +41 -0
  52. package/dist/form-react/Fields/TextField.d.ts +3 -0
  53. package/dist/form-react/Fields/TextField.js +75 -0
  54. package/dist/form-react/Fields/TextFieldWithBackendValidation.d.ts +3 -0
  55. package/dist/form-react/Fields/TextFieldWithBackendValidation.js +117 -0
  56. package/dist/form-react/Fields/WeekRangePicker.d.ts +8 -0
  57. package/dist/form-react/Fields/WeekRangePicker.js +71 -0
  58. package/dist/form-react/ReactHooksForm.d.ts +3 -0
  59. package/dist/form-react/ReactHooksForm.js +132 -0
  60. package/dist/form-react/components/ArrayFieldRenderer.d.ts +13 -0
  61. package/dist/form-react/components/ArrayFieldRenderer.js +90 -0
  62. package/dist/form-react/components/FieldRenderer.d.ts +16 -0
  63. package/dist/form-react/components/FieldRenderer.js +68 -0
  64. package/dist/form-react/components/FormFieldRow.d.ts +13 -0
  65. package/dist/form-react/components/FormFieldRow.js +47 -0
  66. package/dist/form-react/components/FormFileUploadWrapper.d.ts +22 -0
  67. package/dist/form-react/components/FormFileUploadWrapper.js +88 -0
  68. package/dist/form-react/components/ObjectFieldRenderer.d.ts +13 -0
  69. package/dist/form-react/components/ObjectFieldRenderer.js +46 -0
  70. package/dist/form-react/components/SetToEmptyWrapper.d.ts +16 -0
  71. package/dist/form-react/components/SetToEmptyWrapper.js +49 -0
  72. package/dist/form-react/fields.d.ts +23 -0
  73. package/dist/form-react/fields.js +40 -0
  74. package/dist/form-react/hooks/useCascadingForm.d.ts +17 -0
  75. package/dist/form-react/hooks/useCascadingForm.js +122 -0
  76. package/dist/form-react/hooks/useFieldVisibility.d.ts +14 -0
  77. package/dist/form-react/hooks/useFieldVisibility.js +60 -0
  78. package/dist/form-react/hooks/useFillFormByFileUpload.d.ts +33 -0
  79. package/dist/form-react/hooks/useFillFormByFileUpload.js +199 -0
  80. package/dist/form-react/hooks/useFillFormByPaste.d.ts +33 -0
  81. package/dist/form-react/hooks/useFillFormByPaste.js +104 -0
  82. package/dist/form-react/hooks/useFormFieldChangeSubscription.d.ts +13 -0
  83. package/dist/form-react/hooks/useFormFieldChangeSubscription.js +42 -0
  84. package/dist/form-react/hooks/useReactHookForm.d.ts +3 -0
  85. package/dist/form-react/hooks/useReactHookForm.js +161 -0
  86. package/dist/form-react/hooks/useSelectOptions.d.ts +8 -0
  87. package/dist/form-react/hooks/useSelectOptions.js +116 -0
  88. package/dist/form-react/index.d.ts +62 -0
  89. package/dist/form-react/index.js +97 -0
  90. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +2 -0
  91. package/dist/form-react/registry/defaultFieldRegistrations.js +30 -0
  92. package/dist/form-react/registry/fieldRegistry.d.ts +14 -0
  93. package/dist/form-react/registry/fieldRegistry.js +19 -0
  94. package/dist/form-react/registry/resolveFieldComponent.d.ts +10 -0
  95. package/dist/form-react/registry/resolveFieldComponent.js +137 -0
  96. package/dist/form-react/types/fields.types.d.ts +402 -0
  97. package/dist/form-react/types/fieldsOutput.types.d.ts +73 -0
  98. package/dist/form-react/types/reactHookForm.types.d.ts +196 -0
  99. package/dist/form-react/utils/batchFormFieldUpdates.d.ts +14 -0
  100. package/dist/form-react/utils/batchFormFieldUpdates.js +13 -0
  101. package/dist/form-react/utils/buildFieldValidationRules.d.ts +6 -0
  102. package/dist/form-react/utils/buildFieldValidationRules.js +13 -0
  103. package/dist/form-react/utils/buildSelectRemountKey.d.ts +14 -0
  104. package/dist/form-react/utils/buildSelectRemountKey.js +14 -0
  105. package/dist/form-react/utils/calendar-boundary.d.ts +3 -0
  106. package/dist/form-react/utils/calendar-boundary.js +33 -0
  107. package/dist/form-react/utils/date.utils.d.ts +31 -0
  108. package/dist/form-react/utils/date.utils.js +86 -0
  109. package/dist/form-react/utils/evaluateFieldValidation.d.ts +19 -0
  110. package/dist/form-react/utils/evaluateFieldValidation.js +53 -0
  111. package/dist/form-react/utils/fieldDefaults.utils.d.ts +6 -0
  112. package/dist/form-react/utils/fieldDefaults.utils.js +25 -0
  113. package/dist/form-react/utils/fieldPath.utils.d.ts +23 -0
  114. package/dist/form-react/utils/fieldPath.utils.js +26 -0
  115. package/dist/form-react/utils/fieldRangeValidation.utils.d.ts +3 -0
  116. package/dist/form-react/utils/fieldRangeValidation.utils.js +24 -0
  117. package/dist/form-react/utils/fieldRendererUtils.d.ts +10 -0
  118. package/dist/form-react/utils/fieldRendererUtils.js +47 -0
  119. package/dist/form-react/utils/fieldTestIds.d.ts +3 -0
  120. package/dist/form-react/utils/fieldTestIds.js +13 -0
  121. package/dist/form-react/utils/formDate.utils.d.ts +13 -0
  122. package/dist/form-react/utils/formDate.utils.js +9 -0
  123. package/dist/form-react/utils/formValidationFeedback.utils.d.ts +32 -0
  124. package/dist/form-react/utils/formValidationFeedback.utils.js +153 -0
  125. package/dist/form-react/utils/icons.d.ts +5 -0
  126. package/dist/form-react/utils/icons.js +10 -0
  127. package/dist/form-react/utils/optionFlag.d.ts +11 -0
  128. package/dist/form-react/utils/optionFlag.js +17 -0
  129. package/dist/form-react/utils/pastedValues.d.ts +1 -0
  130. package/dist/form-react/utils/resolveFormSubmittable.d.ts +18 -0
  131. package/dist/form-react/utils/resolveFormSubmittable.js +32 -0
  132. package/dist/form-react/utils/select-option-filter-values.d.ts +5 -0
  133. package/dist/form-react/utils/select-option-filter-values.js +30 -0
  134. package/dist/form-react/utils/serializeFormStateForQueryKey.d.ts +1 -0
  135. package/dist/form-react/utils/serializeFormStateForQueryKey.js +21 -0
  136. package/dist/form-react/utils/stableSerialize.d.ts +5 -0
  137. package/dist/form-react/utils/stableSerialize.js +11 -0
  138. package/dist/form-react/utils/validateVisibleRequiredFormFields.d.ts +21 -0
  139. package/dist/form-react/utils/validateVisibleRequiredFormFields.js +64 -0
  140. package/dist/form-react/utils/validationUtils.d.ts +3 -0
  141. package/dist/form-react/utils/validationUtils.js +77 -0
  142. package/dist/impact-nova.css +1 -1
  143. package/dist/lib/primitives/use-field-chrome.js +16 -16
  144. package/dist/llms/rules/installation.js +1 -1
  145. package/dist/llms/rules/real-world-patterns.js +1 -1
  146. package/dist/llms/rules/requirements.js +1 -1
  147. package/package.json +21 -2
@@ -0,0 +1,90 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { useFieldArray as C } from "react-hook-form";
3
+ import { Button as a } from "../../components/primitives/button/button.js";
4
+ import { FormFieldRow as F } from "./FormFieldRow.js";
5
+ import { buildFieldPath as M } from "../utils/fieldPath.utils.js";
6
+ import { GRID_COLS_MAP as _, GAP_X_MAP as k, GAP_Y_MAP as x } from "../utils/fieldRendererUtils.js";
7
+ const z = ({
8
+ field: e,
9
+ fieldPathPrefix: p,
10
+ formHelpers: m,
11
+ formConfig: n,
12
+ supportedValues: u
13
+ }) => {
14
+ const i = M(e.id, p), { fields: o, append: v, remove: b, move: c } = C({
15
+ control: m.form.control,
16
+ // RHF FieldArrayPath resolves to `never` for Record<string, unknown>
17
+ name: i
18
+ }), h = e.itemColumns ?? n.columns ?? 1, l = n.gapBetweenFields ?? 6, y = `grid ${_[h]} ${k[l] ?? "gap-x-6"} ${x[l] ?? "gap-y-6"}`, A = !e.maxItems || o.length < e.maxItems, P = !e.minItems || o.length > e.minItems;
19
+ return /* @__PURE__ */ s("div", { className: e.className, children: [
20
+ e.label && /* @__PURE__ */ r("div", { className: "mb-2 text-sm font-medium text-content-primary", children: e.label }),
21
+ o.map((g, t) => {
22
+ const N = `${i}.${t}`;
23
+ return /* @__PURE__ */ s(
24
+ "div",
25
+ {
26
+ className: "relative mb-4 rounded-md border border-stroke-secondary p-4",
27
+ children: [
28
+ /* @__PURE__ */ r("div", { className: y, children: e.itemFields.map((d) => /* @__PURE__ */ r(
29
+ F,
30
+ {
31
+ field: d,
32
+ fieldPathPrefix: N,
33
+ forcedDisabled: e.isDisabled,
34
+ formHelpers: m,
35
+ formConfig: n,
36
+ supportedValues: u
37
+ },
38
+ d.id
39
+ )) }),
40
+ /* @__PURE__ */ s("div", { className: "mt-2 flex items-center gap-2", children: [
41
+ e.orderable && t > 0 && /* @__PURE__ */ r(
42
+ a,
43
+ {
44
+ type: "button",
45
+ variant: "outline",
46
+ size: "sm",
47
+ onClick: () => c(t, t - 1),
48
+ children: "Move Up"
49
+ }
50
+ ),
51
+ e.orderable && t < o.length - 1 && /* @__PURE__ */ r(
52
+ a,
53
+ {
54
+ type: "button",
55
+ variant: "outline",
56
+ size: "sm",
57
+ onClick: () => c(t, t + 1),
58
+ children: "Move Down"
59
+ }
60
+ ),
61
+ P && /* @__PURE__ */ r(
62
+ a,
63
+ {
64
+ type: "button",
65
+ variant: "destructive",
66
+ size: "sm",
67
+ onClick: () => b(t),
68
+ children: e.removeButtonLabel || "Remove"
69
+ }
70
+ )
71
+ ] })
72
+ ]
73
+ },
74
+ g.id
75
+ );
76
+ }),
77
+ A && /* @__PURE__ */ r(
78
+ a,
79
+ {
80
+ type: "button",
81
+ variant: "outline",
82
+ onClick: () => v(e.defaultItemValue ?? {}),
83
+ children: e.addButtonLabel || "Add"
84
+ }
85
+ )
86
+ ] });
87
+ };
88
+ export {
89
+ z as ArrayFieldRenderer
90
+ };
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ import { IFormConfig, SupportedValuesMap } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ import { IField } from '../types/fields.types';
5
+ export interface FieldRendererProps {
6
+ field: IField;
7
+ formHelpers: UseReactHookFormReturn;
8
+ isVisible: boolean;
9
+ disabled: boolean;
10
+ formConfig: IFormConfig;
11
+ supportedValues?: SupportedValuesMap;
12
+ fieldPathPrefix?: string;
13
+ }
14
+ /** @deprecated Use {@link FieldRendererProps}. */
15
+ export type FilterFieldComponentProps = FieldRendererProps;
16
+ export declare const FieldRenderer: FC<FieldRendererProps>;
@@ -0,0 +1,68 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useMemo as c } from "react";
3
+ import { SetToEmptyWrapper as u } from "./SetToEmptyWrapper.js";
4
+ import { ObjectFieldRenderer as T } from "./ObjectFieldRenderer.js";
5
+ import { ArrayFieldRenderer as b } from "./ArrayFieldRenderer.js";
6
+ import { buildFieldPath as v } from "../utils/fieldPath.utils.js";
7
+ import { renderRegisteredField as E } from "../registry/resolveFieldComponent.js";
8
+ import { registerDefaultFieldTypes as R } from "../registry/defaultFieldRegistrations.js";
9
+ import { buildFieldValidationRules as S } from "../utils/buildFieldValidationRules.js";
10
+ import { buildEvaluateFieldValidationOptions as j } from "../utils/evaluateFieldValidation.js";
11
+ R();
12
+ const g = ({
13
+ field: e,
14
+ formHelpers: o,
15
+ isVisible: s,
16
+ disabled: p,
17
+ formConfig: d,
18
+ supportedValues: n,
19
+ fieldPathPrefix: i
20
+ }) => {
21
+ const t = c(
22
+ () => i ? { ...e, id: v(e.id, i) } : e,
23
+ [e, i]
24
+ ), a = c(() => S(
25
+ t,
26
+ j(o, t.id)
27
+ ), [t, o]);
28
+ if (!s)
29
+ return null;
30
+ if (e.fieldType === "object")
31
+ return /* @__PURE__ */ r(
32
+ T,
33
+ {
34
+ field: e,
35
+ fieldPathPrefix: i,
36
+ formHelpers: o,
37
+ formConfig: d,
38
+ supportedValues: n
39
+ }
40
+ );
41
+ if (e.fieldType === "array")
42
+ return /* @__PURE__ */ r(
43
+ b,
44
+ {
45
+ field: e,
46
+ fieldPathPrefix: i,
47
+ formHelpers: o,
48
+ formConfig: d,
49
+ supportedValues: n
50
+ }
51
+ );
52
+ const l = !!t.allowSetToEmpty && o.setToEmptyFields.has(t.id), y = p || l, F = {
53
+ field: l ? { ...t, placeholder: "Set to empty" } : t,
54
+ formHelpers: o,
55
+ validationRules: a,
56
+ isDisabled: y,
57
+ formConfig: d,
58
+ supportedValues: n
59
+ }, m = E(
60
+ e.fieldType,
61
+ F,
62
+ o.formContext?.customFieldTypes
63
+ );
64
+ return /* @__PURE__ */ r("div", { className: `col-span-${t.colSpan || 1}`, children: t.allowSetToEmpty ? /* @__PURE__ */ r(u, { fieldId: t.id, formHelpers: o, children: m }) : m });
65
+ };
66
+ export {
67
+ g as FieldRenderer
68
+ };
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { IField } from '../types/fields.types';
3
+ import { IFormConfig, SupportedValuesMap, UseReactHookFormReturn } from '../types/reactHookForm.types';
4
+ interface FormFieldRowProps {
5
+ field: IField;
6
+ formHelpers: UseReactHookFormReturn;
7
+ formConfig: IFormConfig;
8
+ supportedValues?: SupportedValuesMap;
9
+ fieldPathPrefix?: string;
10
+ forcedDisabled?: boolean;
11
+ }
12
+ export declare const FormFieldRow: FC<FormFieldRowProps>;
13
+ export {};
@@ -0,0 +1,47 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as d } from "react";
3
+ import { useWatch as p } from "react-hook-form";
4
+ import { FieldRenderer as F } from "./FieldRenderer.js";
5
+ import { collectFieldDependencyIds as u } from "../../form-engine/field-dependency-graph.js";
6
+ import { getFieldTestId as b } from "../utils/fieldTestIds.js";
7
+ const w = ({
8
+ field: o,
9
+ formHelpers: n,
10
+ formConfig: c,
11
+ supportedValues: i,
12
+ fieldPathPrefix: r,
13
+ forcedDisabled: a = !1
14
+ }) => {
15
+ const t = d(
16
+ () => u(o),
17
+ [o]
18
+ ), l = t.length > 0 ? t : [o.id];
19
+ p({
20
+ control: n.form.control,
21
+ name: l
22
+ });
23
+ const s = n.isFieldVisible(o), m = a || n.isFieldDisabled(o);
24
+ return s ? /* @__PURE__ */ e(
25
+ "div",
26
+ {
27
+ className: `col-span-${o.colSpan || 1}`,
28
+ "data-testid": b(o.id),
29
+ style: o.colSpan ? { gridColumn: `span ${o.colSpan} / span ${o.colSpan}` } : {},
30
+ children: /* @__PURE__ */ e(
31
+ F,
32
+ {
33
+ field: o,
34
+ fieldPathPrefix: r,
35
+ isVisible: s,
36
+ disabled: m,
37
+ formHelpers: n,
38
+ formConfig: c,
39
+ supportedValues: i
40
+ }
41
+ )
42
+ }
43
+ ) : null;
44
+ };
45
+ export {
46
+ w as FormFieldRow
47
+ };
@@ -0,0 +1,22 @@
1
+ import { FC } from 'react';
2
+ interface FormFileUploadWrapperProps {
3
+ label?: string;
4
+ isRequired?: boolean;
5
+ fileList?: File[];
6
+ isDisabled?: boolean;
7
+ onChange: (fileList: File[]) => void;
8
+ onBlur: () => void;
9
+ numberOfFiles: number;
10
+ validFileTypes: Array<{
11
+ fileType: string;
12
+ templateUrl: string;
13
+ typeOverride: boolean;
14
+ }>;
15
+ maxFileSize?: number;
16
+ shouldShowError?: boolean;
17
+ errorMessage?: string;
18
+ helperText?: string;
19
+ disableDefaultTemplateFetch?: boolean;
20
+ }
21
+ export declare const FormFileUploadWrapper: FC<FormFileUploadWrapperProps>;
22
+ export {};
@@ -0,0 +1,88 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { FileUpload as g, FileUploadContent as v, FileUploadDropZone as w, FileUploadList as y, FileUploadItem as z } from "../../components/forms/file-upload/file-upload.js";
3
+ import { Button as E } from "../../components/primitives/button/button.js";
4
+ import { useState as k, useCallback as S } from "react";
5
+ const _ = 10 * 1024 * 1024, A = ({
6
+ label: r,
7
+ isRequired: f,
8
+ fileList: l,
9
+ isDisabled: n,
10
+ shouldShowError: m,
11
+ helperText: c,
12
+ numberOfFiles: N,
13
+ validFileTypes: d,
14
+ maxFileSize: o,
15
+ onChange: p,
16
+ onBlur: x
17
+ }) => {
18
+ const [s, u] = k(null), h = d.map((e) => e.fileType), F = d.find(
19
+ (e) => e.templateUrl
20
+ )?.templateUrl, $ = (e) => {
21
+ if (o && e.length > 0 && e.filter((i) => i.size > o).length > 0) {
22
+ const i = (o / _).toFixed(2);
23
+ u(`File size exceeds ${i}MB limit`), p([]), x();
24
+ return;
25
+ }
26
+ u(null), p(e), x();
27
+ }, b = S((e) => {
28
+ window?.open?.(e, "_blank");
29
+ }, []);
30
+ return /* @__PURE__ */ a("div", { children: [
31
+ r && /* @__PURE__ */ a(
32
+ "label",
33
+ {
34
+ className: `text-sm font-medium leading-[18px] mb-2 block ${n ? "opacity-70" : ""} ${m ? "text-destructive" : ""}`,
35
+ children: [
36
+ r,
37
+ " ",
38
+ f && /* @__PURE__ */ t("span", { className: "text-destructive", children: "*" })
39
+ ]
40
+ }
41
+ ),
42
+ /* @__PURE__ */ t(
43
+ g,
44
+ {
45
+ value: l || [],
46
+ onFilesChange: $,
47
+ maxFiles: N,
48
+ accept: h,
49
+ disabled: n,
50
+ className: "w-full max-w-full",
51
+ children: /* @__PURE__ */ a(v, { className: "min-h-[200px]", children: [
52
+ /* @__PURE__ */ t(
53
+ w,
54
+ {
55
+ subLabel: `Supported formats: ${h.join(", ")}`
56
+ }
57
+ ),
58
+ l && l.length > 0 && /* @__PURE__ */ t(y, { children: l.map((e, U) => /* @__PURE__ */ t(
59
+ z,
60
+ {
61
+ file: e
62
+ },
63
+ `${e.name}-${e.size}-${e.lastModified}-${U}`
64
+ )) }),
65
+ F && /* @__PURE__ */ a("p", { className: "text-sm text-gray-600 mt-3", children: [
66
+ "Simplify your upload!",
67
+ " ",
68
+ /* @__PURE__ */ t(
69
+ E,
70
+ {
71
+ variant: "link",
72
+ onClick: () => b(F),
73
+ disabled: n,
74
+ className: "text-sm p-0 h-auto inline",
75
+ children: "Download template"
76
+ }
77
+ )
78
+ ] })
79
+ ] })
80
+ }
81
+ ),
82
+ s && /* @__PURE__ */ t("p", { className: "text-destructive text-sm mt-1", children: s }),
83
+ c && !m && !s && /* @__PURE__ */ t("p", { className: "text-content-secondary text-sm mt-1", children: c })
84
+ ] });
85
+ };
86
+ export {
87
+ A as FormFileUploadWrapper
88
+ };
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { ObjectFieldConfig } from '../types/fields.types';
3
+ import { IFormConfig } from '../types/reactHookForm.types';
4
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
5
+ interface ObjectFieldRendererProps {
6
+ field: ObjectFieldConfig;
7
+ fieldPathPrefix?: string;
8
+ formHelpers: UseReactHookFormReturn;
9
+ formConfig: IFormConfig;
10
+ supportedValues?: Record<string, unknown>;
11
+ }
12
+ export declare const ObjectFieldRenderer: FC<ObjectFieldRendererProps>;
13
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { useState as P } from "react";
3
+ import { FormFieldRow as N } from "./FormFieldRow.js";
4
+ import { buildFieldPath as h } from "../utils/fieldPath.utils.js";
5
+ import { GRID_COLS_MAP as g, GAP_X_MAP as _, GAP_Y_MAP as A } from "../utils/fieldRendererUtils.js";
6
+ const $ = ({
7
+ field: e,
8
+ fieldPathPrefix: n,
9
+ formHelpers: c,
10
+ formConfig: a,
11
+ supportedValues: m
12
+ }) => {
13
+ const d = h(e.id, n), [o, i] = P(e.defaultCollapsed ?? !1), p = e.columns ?? a.columns ?? 1, r = a.gapBetweenFields ?? 6, b = `grid ${g[p]} ${_[r] ?? "gap-x-6"} ${A[r] ?? "gap-y-6"}`, u = [
14
+ e.bordered ? "rounded-md border border-stroke-secondary p-4" : "",
15
+ e.className ?? ""
16
+ ].filter(Boolean).join(" "), x = /* @__PURE__ */ t("div", { className: b, children: e.fields.map((s) => /* @__PURE__ */ t(
17
+ N,
18
+ {
19
+ field: s,
20
+ fieldPathPrefix: d,
21
+ forcedDisabled: e.isDisabled,
22
+ formHelpers: c,
23
+ formConfig: a,
24
+ supportedValues: m
25
+ },
26
+ s.id
27
+ )) });
28
+ return /* @__PURE__ */ l("fieldset", { className: u, children: [
29
+ e.label && /* @__PURE__ */ t("legend", { className: "mb-2 text-sm font-medium text-content-primary", children: e.collapsible ? /* @__PURE__ */ l(
30
+ "button",
31
+ {
32
+ type: "button",
33
+ className: "flex items-center gap-1",
34
+ onClick: () => i((s) => !s),
35
+ children: [
36
+ /* @__PURE__ */ t("span", { className: `transition-transform ${o ? "-rotate-90" : ""}`, children: "▾" }),
37
+ e.label
38
+ ]
39
+ }
40
+ ) : e.label }),
41
+ !o && x
42
+ ] });
43
+ };
44
+ export {
45
+ $ as ObjectFieldRenderer
46
+ };
@@ -0,0 +1,16 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
3
+ interface SetToEmptyWrapperProps {
4
+ fieldId: string;
5
+ formHelpers: UseReactHookFormReturn;
6
+ children: ReactNode;
7
+ }
8
+ /**
9
+ * Wraps a form field to add a "Set To Empty" / "Undo" action link.
10
+ *
11
+ * - Normal state: renders a "Set To Empty" link (right-aligned above the field).
12
+ * - Empty state: field is disabled, link reads "Undo", and an info message is shown below.
13
+ * - When the user clicks the disabled field, the "Undo" button flashes once (AG Grid style).
14
+ */
15
+ export declare const SetToEmptyWrapper: FC<SetToEmptyWrapperProps>;
16
+ export {};
@@ -0,0 +1,49 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { useState as m, useCallback as c } from "react";
3
+ import { Button as u } from "../../components/primitives/button/button.js";
4
+ import { Info as d } from "impact-nova-icons";
5
+ const b = ({
6
+ fieldId: o,
7
+ formHelpers: a,
8
+ children: n
9
+ }) => {
10
+ const t = a.setToEmptyFields.has(o), [s, r] = m(0), p = c(() => {
11
+ t && r((l) => l + 1);
12
+ }, [t]);
13
+ return /* @__PURE__ */ i("div", { className: "relative pb-5 mb-0", children: [
14
+ /* @__PURE__ */ e(
15
+ u,
16
+ {
17
+ variant: "link",
18
+ type: "button",
19
+ className: `absolute top-0 right-0 text-xs font-medium p-0 h-auto leading-[18px] z-[1] whitespace-nowrap rounded px-1 -mr-1 ${s > 0 ? "animate-flash-undo" : ""}`,
20
+ onClick: () => {
21
+ t ? a.undoSetToEmpty(o) : a.markFieldAsEmpty(o);
22
+ },
23
+ children: t ? "Undo" : "Set To Empty"
24
+ },
25
+ s
26
+ ),
27
+ /* @__PURE__ */ e(
28
+ "div",
29
+ {
30
+ className: "[&_label:first-of-type]:pr-[90px]",
31
+ onClickCapture: t ? p : void 0,
32
+ children: n
33
+ }
34
+ ),
35
+ /* @__PURE__ */ i(
36
+ "div",
37
+ {
38
+ className: `absolute bottom-0 left-0 flex items-center gap-1 text-[12px] text-[#60697d] transition-opacity duration-150 ${t ? "opacity-100" : "opacity-0 pointer-events-none"}`,
39
+ children: [
40
+ /* @__PURE__ */ e(d, { size: 12, className: "shrink-0" }),
41
+ /* @__PURE__ */ e("span", { children: "The value is set to empty" })
42
+ ]
43
+ }
44
+ )
45
+ ] });
46
+ };
47
+ export {
48
+ b as SetToEmptyWrapper
49
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Field component value exports — use this subpath when importing React field components.
3
+ * Config types (`WeekRangeField`, `TextField`, etc.) live on `impact-nova/form-react`.
4
+ */
5
+ export { TextField } from './Fields/TextField';
6
+ export { TextAreaField } from './Fields/TextAreaField';
7
+ export { ButtonsGroupField } from './Fields/ButtonsGroupField';
8
+ export { RadioField } from './Fields/RadioField';
9
+ export { DateRangeField } from './Fields/DateRangeField';
10
+ export { WeekRangeField } from './Fields/WeekRangePicker';
11
+ export { MonthRangeField } from './Fields/MonthRangeField';
12
+ export { FileUploadField } from './Fields/FileUploadField';
13
+ export { SelectField } from './Fields/SelectField';
14
+ export { CheckboxField } from './Fields/CheckboxField';
15
+ export { SwitchField } from './Fields/SwitchField';
16
+ export { ChipsField } from './Fields/ChipsField';
17
+ export { DateInputField } from './Fields/DateInputField';
18
+ export { FillFormByPasteField } from './Fields/FillFormByPasteField';
19
+ export { FillFormByFileUploadField } from './Fields/FillFormByFileUploadField';
20
+ export { NumericComboboxField } from './Fields/NumericComboboxField';
21
+ export { MultiMonthPickerField } from './Fields/MultiMonthPickerField';
22
+ export { MultiWeekPickerField } from './Fields/MultiWeekPickerField';
23
+ export { TextFieldWithBackendValidation } from './Fields/TextFieldWithBackendValidation';
@@ -0,0 +1,40 @@
1
+ import { TextField as r } from "./Fields/TextField.js";
2
+ import { TextAreaField as i } from "./Fields/TextAreaField.js";
3
+ import { ButtonsGroupField as F } from "./Fields/ButtonsGroupField.js";
4
+ import { RadioField as p } from "./Fields/RadioField.js";
5
+ import { DateRangeField as m } from "./Fields/DateRangeField.js";
6
+ import { WeekRangeField as a } from "./Fields/WeekRangePicker.js";
7
+ import { MonthRangeField as c } from "./Fields/MonthRangeField.js";
8
+ import { FileUploadField as k } from "./Fields/FileUploadField.js";
9
+ import { SelectField as B } from "./Fields/SelectField.js";
10
+ import { CheckboxField as R } from "./Fields/CheckboxField.js";
11
+ import { SwitchField as g } from "./Fields/SwitchField.js";
12
+ import { ChipsField as C } from "./Fields/ChipsField.js";
13
+ import { DateInputField as T } from "./Fields/DateInputField.js";
14
+ import { FillFormByPasteField as y } from "./Fields/FillFormByPasteField.js";
15
+ import { FillFormByFileUploadField as S } from "./Fields/FillFormByFileUploadField.js";
16
+ import { NumericComboboxField as w } from "./Fields/NumericComboboxField.js";
17
+ import { MultiMonthPickerField as G } from "./Fields/MultiMonthPickerField.js";
18
+ import { MultiWeekPickerField as N } from "./Fields/MultiWeekPickerField.js";
19
+ import { TextFieldWithBackendValidation as j } from "./Fields/TextFieldWithBackendValidation.js";
20
+ export {
21
+ F as ButtonsGroupField,
22
+ R as CheckboxField,
23
+ C as ChipsField,
24
+ T as DateInputField,
25
+ m as DateRangeField,
26
+ k as FileUploadField,
27
+ S as FillFormByFileUploadField,
28
+ y as FillFormByPasteField,
29
+ c as MonthRangeField,
30
+ G as MultiMonthPickerField,
31
+ N as MultiWeekPickerField,
32
+ w as NumericComboboxField,
33
+ p as RadioField,
34
+ B as SelectField,
35
+ g as SwitchField,
36
+ i as TextAreaField,
37
+ r as TextField,
38
+ j as TextFieldWithBackendValidation,
39
+ a as WeekRangeField
40
+ };
@@ -0,0 +1,17 @@
1
+ import { UseFormReturn } from 'react-hook-form';
2
+ import { IField } from '../types/fields.types';
3
+ import { IFormConfig, FieldVisibilityBase } from '../types/reactHookForm.types';
4
+ import { ReactHookFormState } from './useReactHookForm';
5
+ import { EvaluateFieldValidationOptions } from '../utils/evaluateFieldValidation';
6
+ export interface UseCascadingFormConfig {
7
+ getFieldDefaultValue: (field: IField) => unknown;
8
+ resolveFieldValidationEvaluationOptions?: (fieldId: string) => EvaluateFieldValidationOptions | undefined;
9
+ }
10
+ export interface UseCascadingFormReturn {
11
+ areEarlierMandatoryFieldsFilled: (field: IField) => boolean;
12
+ clearSubsequentFields: (fieldName: string) => void;
13
+ getEarlierFieldsIds: (currentFieldId: string, onlyMandatory?: boolean) => string[];
14
+ setValueWithCascading: (fieldName: string, value: unknown) => void;
15
+ isCascadingDisabled: (field: FieldVisibilityBase) => boolean;
16
+ }
17
+ export declare const useCascadingForm: (form: UseFormReturn<ReactHookFormState>, formConfig: IFormConfig, cascadingFormConfig: UseCascadingFormConfig) => UseCascadingFormReturn;
@@ -0,0 +1,122 @@
1
+ import { useCallback as r, useEffect as g } from "react";
2
+ import { isEmptyValue as V } from "../../form-engine/is-empty-value.js";
3
+ import { getDependentFieldIds as v, computeIsCascadingDisabled as x } from "../../form-engine/field-dependency-graph.js";
4
+ import { batchSetFormFieldValues as D } from "../utils/batchFormFieldUpdates.js";
5
+ import { isFieldValueValid as S } from "../utils/buildFieldValidationRules.js";
6
+ import { findFieldByPath as T } from "../utils/fieldPath.utils.js";
7
+ const B = (a, s, h) => {
8
+ const { getFieldDefaultValue: c, resolveFieldValidationEvaluationOptions: F } = h, p = r(
9
+ () => s.fields.filter((e) => e.isRequired),
10
+ [s.fields]
11
+ ), y = r(
12
+ (e) => {
13
+ if (!s.isCascading)
14
+ return !0;
15
+ const n = a.getValues(), d = p(), i = d.findIndex(
16
+ (t) => t.id === e.id
17
+ );
18
+ if (i === -1)
19
+ return d.every(
20
+ (t) => !V(n[t.id])
21
+ );
22
+ for (let t = 0; t < i; t += 1) {
23
+ const l = d[t];
24
+ if (V(n[l.id]))
25
+ return !1;
26
+ }
27
+ return !0;
28
+ },
29
+ [a, s.isCascading, p]
30
+ ), I = r(
31
+ (e, n = !1) => {
32
+ let i = s.fields.filter(
33
+ (l) => l.fieldType !== "label" && l.fieldType !== "divider"
34
+ );
35
+ n && (i = i.filter((l) => l.isRequired));
36
+ const t = i.findIndex(
37
+ (l) => l.id === e
38
+ );
39
+ return t === -1 ? [] : i.slice(0, t).map((l) => l.id);
40
+ },
41
+ [s.fields]
42
+ ), o = r(
43
+ (e) => {
44
+ const n = v(
45
+ s.fields,
46
+ e
47
+ ), d = new Set(n);
48
+ return s.fields.filter(
49
+ (i) => d.has(i.id)
50
+ );
51
+ },
52
+ [s.fields]
53
+ ), u = r(
54
+ (e) => {
55
+ if (!s.isCascading)
56
+ return;
57
+ const n = o(e), d = a.getValues(), i = n.map((t) => {
58
+ const l = c(t);
59
+ return d[t.id] === l ? null : {
60
+ fieldName: t.id,
61
+ value: l
62
+ };
63
+ }).filter(
64
+ (t) => t !== null
65
+ );
66
+ D(a, i, {
67
+ shouldDirty: !0,
68
+ shouldValidate: !1
69
+ });
70
+ },
71
+ [a, s.isCascading, o, c]
72
+ );
73
+ g(() => {
74
+ if (!s.isCascading)
75
+ return;
76
+ const e = a.watch((n, { name: d, type: i }) => {
77
+ d && i === "change" && u(d);
78
+ });
79
+ return () => e.unsubscribe();
80
+ }, [a, s.isCascading, u]);
81
+ const b = r(
82
+ (e, n) => {
83
+ a.setValue(e, n, {
84
+ shouldValidate: !0,
85
+ shouldDirty: !0
86
+ });
87
+ const d = T(s.fields, e);
88
+ if (d) {
89
+ const i = F?.(e);
90
+ S(
91
+ d,
92
+ n,
93
+ i
94
+ ) && a.clearErrors(e);
95
+ }
96
+ u(e);
97
+ },
98
+ [
99
+ a,
100
+ s.fields,
101
+ u,
102
+ F
103
+ ]
104
+ ), E = r(
105
+ (e) => x(
106
+ e,
107
+ a.getValues(),
108
+ !!s.isCascading
109
+ ),
110
+ [a, s.isCascading]
111
+ );
112
+ return {
113
+ areEarlierMandatoryFieldsFilled: y,
114
+ clearSubsequentFields: u,
115
+ getEarlierFieldsIds: I,
116
+ setValueWithCascading: b,
117
+ isCascadingDisabled: E
118
+ };
119
+ };
120
+ export {
121
+ B as useCascadingForm
122
+ };