impact-nova 2.2.9 → 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 (154) hide show
  1. package/dist/components/data/ag-grid-react/headers/utils/filter-utils.js +9 -9
  2. package/dist/components/data-display/calendar/calendar-day-picker-components.js +69 -56
  3. package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -0
  4. package/dist/components/data-display/calendar/calendar-padding-week.utils.js +6 -0
  5. package/dist/components/data-display/calendar/calendar.types.d.ts +1 -1
  6. package/dist/components/forms/combobox/combobox.js +185 -160
  7. package/dist/components/forms/combobox/combobox.types.d.ts +2 -0
  8. package/dist/filter-shell/index.d.ts +12 -0
  9. package/dist/filter-shell/index.js +9 -0
  10. package/dist/filter-shell/utils/buildFilterFieldValidationRules.d.ts +1 -0
  11. package/dist/filter-shell/utils/validateVisibleRequiredFilterFields.d.ts +1 -0
  12. package/dist/filter-shell/utils/validationNavigation.utils.d.ts +26 -0
  13. package/dist/filter-shell/utils/validationNavigation.utils.js +38 -0
  14. package/dist/form-engine/field-dependency-graph.d.ts +17 -0
  15. package/dist/form-engine/field-dependency-graph.js +90 -0
  16. package/dist/form-engine/index.d.ts +9 -0
  17. package/dist/form-engine/index.js +16 -0
  18. package/dist/form-engine/is-empty-value.d.ts +1 -0
  19. package/dist/form-engine/is-empty-value.js +8 -0
  20. package/dist/form-engine/types.d.ts +17 -0
  21. package/dist/form-react/Fields/ButtonsGroupField.d.ts +3 -0
  22. package/dist/form-react/Fields/ButtonsGroupField.js +52 -0
  23. package/dist/form-react/Fields/CheckboxField.d.ts +3 -0
  24. package/dist/form-react/Fields/CheckboxField.js +46 -0
  25. package/dist/form-react/Fields/ChipsField.d.ts +3 -0
  26. package/dist/form-react/Fields/ChipsField.js +146 -0
  27. package/dist/form-react/Fields/DateInputField.d.ts +8 -0
  28. package/dist/form-react/Fields/DateInputField.js +134 -0
  29. package/dist/form-react/Fields/DateRangeField.d.ts +8 -0
  30. package/dist/form-react/Fields/DateRangeField.js +57 -0
  31. package/dist/form-react/Fields/DividerField.d.ts +3 -0
  32. package/dist/form-react/Fields/DividerField.js +9 -0
  33. package/dist/form-react/Fields/DividerWithLabelField.d.ts +3 -0
  34. package/dist/form-react/Fields/DividerWithLabelField.js +31 -0
  35. package/dist/form-react/Fields/FileUploadField.d.ts +3 -0
  36. package/dist/form-react/Fields/FileUploadField.js +42 -0
  37. package/dist/form-react/Fields/FillFormByFileUploadField.d.ts +3 -0
  38. package/dist/form-react/Fields/FillFormByFileUploadField.js +65 -0
  39. package/dist/form-react/Fields/FillFormByPasteField.d.ts +3 -0
  40. package/dist/form-react/Fields/FillFormByPasteField.js +106 -0
  41. package/dist/form-react/Fields/LabelField.d.ts +3 -0
  42. package/dist/form-react/Fields/LabelField.js +14 -0
  43. package/dist/form-react/Fields/MonthRangeField.d.ts +8 -0
  44. package/dist/form-react/Fields/MonthRangeField.js +72 -0
  45. package/dist/form-react/Fields/MultiMonthPickerField.d.ts +8 -0
  46. package/dist/form-react/Fields/MultiMonthPickerField.js +46 -0
  47. package/dist/form-react/Fields/MultiWeekPickerField.d.ts +8 -0
  48. package/dist/form-react/Fields/MultiWeekPickerField.js +47 -0
  49. package/dist/form-react/Fields/NumericComboboxField.d.ts +18 -0
  50. package/dist/form-react/Fields/NumericComboboxField.js +51 -0
  51. package/dist/form-react/Fields/RadioField.d.ts +3 -0
  52. package/dist/form-react/Fields/RadioField.js +68 -0
  53. package/dist/form-react/Fields/SelectField.d.ts +3 -0
  54. package/dist/form-react/Fields/SelectField.js +76 -0
  55. package/dist/form-react/Fields/SwitchField.d.ts +3 -0
  56. package/dist/form-react/Fields/SwitchField.js +47 -0
  57. package/dist/form-react/Fields/TextAreaField.d.ts +3 -0
  58. package/dist/form-react/Fields/TextAreaField.js +41 -0
  59. package/dist/form-react/Fields/TextField.d.ts +3 -0
  60. package/dist/form-react/Fields/TextField.js +75 -0
  61. package/dist/form-react/Fields/TextFieldWithBackendValidation.d.ts +3 -0
  62. package/dist/form-react/Fields/TextFieldWithBackendValidation.js +117 -0
  63. package/dist/form-react/Fields/WeekRangePicker.d.ts +8 -0
  64. package/dist/form-react/Fields/WeekRangePicker.js +71 -0
  65. package/dist/form-react/ReactHooksForm.d.ts +3 -0
  66. package/dist/form-react/ReactHooksForm.js +132 -0
  67. package/dist/form-react/components/ArrayFieldRenderer.d.ts +13 -0
  68. package/dist/form-react/components/ArrayFieldRenderer.js +90 -0
  69. package/dist/form-react/components/FieldRenderer.d.ts +16 -0
  70. package/dist/form-react/components/FieldRenderer.js +68 -0
  71. package/dist/form-react/components/FormFieldRow.d.ts +13 -0
  72. package/dist/form-react/components/FormFieldRow.js +47 -0
  73. package/dist/form-react/components/FormFileUploadWrapper.d.ts +22 -0
  74. package/dist/form-react/components/FormFileUploadWrapper.js +88 -0
  75. package/dist/form-react/components/ObjectFieldRenderer.d.ts +13 -0
  76. package/dist/form-react/components/ObjectFieldRenderer.js +46 -0
  77. package/dist/form-react/components/SetToEmptyWrapper.d.ts +16 -0
  78. package/dist/form-react/components/SetToEmptyWrapper.js +49 -0
  79. package/dist/form-react/fields.d.ts +23 -0
  80. package/dist/form-react/fields.js +40 -0
  81. package/dist/form-react/hooks/useCascadingForm.d.ts +17 -0
  82. package/dist/form-react/hooks/useCascadingForm.js +122 -0
  83. package/dist/form-react/hooks/useFieldVisibility.d.ts +14 -0
  84. package/dist/form-react/hooks/useFieldVisibility.js +60 -0
  85. package/dist/form-react/hooks/useFillFormByFileUpload.d.ts +33 -0
  86. package/dist/form-react/hooks/useFillFormByFileUpload.js +199 -0
  87. package/dist/form-react/hooks/useFillFormByPaste.d.ts +33 -0
  88. package/dist/form-react/hooks/useFillFormByPaste.js +104 -0
  89. package/dist/form-react/hooks/useFormFieldChangeSubscription.d.ts +13 -0
  90. package/dist/form-react/hooks/useFormFieldChangeSubscription.js +42 -0
  91. package/dist/form-react/hooks/useReactHookForm.d.ts +3 -0
  92. package/dist/form-react/hooks/useReactHookForm.js +161 -0
  93. package/dist/form-react/hooks/useSelectOptions.d.ts +8 -0
  94. package/dist/form-react/hooks/useSelectOptions.js +116 -0
  95. package/dist/form-react/index.d.ts +62 -0
  96. package/dist/form-react/index.js +97 -0
  97. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +2 -0
  98. package/dist/form-react/registry/defaultFieldRegistrations.js +30 -0
  99. package/dist/form-react/registry/fieldRegistry.d.ts +14 -0
  100. package/dist/form-react/registry/fieldRegistry.js +19 -0
  101. package/dist/form-react/registry/resolveFieldComponent.d.ts +10 -0
  102. package/dist/form-react/registry/resolveFieldComponent.js +137 -0
  103. package/dist/form-react/types/fields.types.d.ts +402 -0
  104. package/dist/form-react/types/fieldsOutput.types.d.ts +73 -0
  105. package/dist/form-react/types/reactHookForm.types.d.ts +196 -0
  106. package/dist/form-react/utils/batchFormFieldUpdates.d.ts +14 -0
  107. package/dist/form-react/utils/batchFormFieldUpdates.js +13 -0
  108. package/dist/form-react/utils/buildFieldValidationRules.d.ts +6 -0
  109. package/dist/form-react/utils/buildFieldValidationRules.js +13 -0
  110. package/dist/form-react/utils/buildSelectRemountKey.d.ts +14 -0
  111. package/dist/form-react/utils/buildSelectRemountKey.js +14 -0
  112. package/dist/form-react/utils/calendar-boundary.d.ts +3 -0
  113. package/dist/form-react/utils/calendar-boundary.js +33 -0
  114. package/dist/form-react/utils/date.utils.d.ts +31 -0
  115. package/dist/form-react/utils/date.utils.js +86 -0
  116. package/dist/form-react/utils/evaluateFieldValidation.d.ts +19 -0
  117. package/dist/form-react/utils/evaluateFieldValidation.js +53 -0
  118. package/dist/form-react/utils/fieldDefaults.utils.d.ts +6 -0
  119. package/dist/form-react/utils/fieldDefaults.utils.js +25 -0
  120. package/dist/form-react/utils/fieldPath.utils.d.ts +23 -0
  121. package/dist/form-react/utils/fieldPath.utils.js +26 -0
  122. package/dist/form-react/utils/fieldRangeValidation.utils.d.ts +3 -0
  123. package/dist/form-react/utils/fieldRangeValidation.utils.js +24 -0
  124. package/dist/form-react/utils/fieldRendererUtils.d.ts +10 -0
  125. package/dist/form-react/utils/fieldRendererUtils.js +47 -0
  126. package/dist/form-react/utils/fieldTestIds.d.ts +3 -0
  127. package/dist/form-react/utils/fieldTestIds.js +13 -0
  128. package/dist/form-react/utils/formDate.utils.d.ts +13 -0
  129. package/dist/form-react/utils/formDate.utils.js +9 -0
  130. package/dist/form-react/utils/formValidationFeedback.utils.d.ts +32 -0
  131. package/dist/form-react/utils/formValidationFeedback.utils.js +153 -0
  132. package/dist/form-react/utils/icons.d.ts +5 -0
  133. package/dist/form-react/utils/icons.js +10 -0
  134. package/dist/form-react/utils/optionFlag.d.ts +11 -0
  135. package/dist/form-react/utils/optionFlag.js +17 -0
  136. package/dist/form-react/utils/pastedValues.d.ts +1 -0
  137. package/dist/form-react/utils/resolveFormSubmittable.d.ts +18 -0
  138. package/dist/form-react/utils/resolveFormSubmittable.js +32 -0
  139. package/dist/form-react/utils/select-option-filter-values.d.ts +5 -0
  140. package/dist/form-react/utils/select-option-filter-values.js +30 -0
  141. package/dist/form-react/utils/serializeFormStateForQueryKey.d.ts +1 -0
  142. package/dist/form-react/utils/serializeFormStateForQueryKey.js +21 -0
  143. package/dist/form-react/utils/stableSerialize.d.ts +5 -0
  144. package/dist/form-react/utils/stableSerialize.js +11 -0
  145. package/dist/form-react/utils/validateVisibleRequiredFormFields.d.ts +21 -0
  146. package/dist/form-react/utils/validateVisibleRequiredFormFields.js +64 -0
  147. package/dist/form-react/utils/validationUtils.d.ts +3 -0
  148. package/dist/form-react/utils/validationUtils.js +77 -0
  149. package/dist/impact-nova.css +1 -1
  150. package/dist/lib/primitives/use-field-chrome.js +16 -16
  151. package/dist/llms/rules/installation.js +1 -1
  152. package/dist/llms/rules/real-world-patterns.js +1 -1
  153. package/dist/llms/rules/requirements.js +1 -1
  154. package/package.json +21 -2
@@ -0,0 +1,42 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Controller as a } from "react-hook-form";
4
+ import { FormFileUploadWrapper as m } from "../components/FormFileUploadWrapper.js";
5
+ const T = ({
6
+ field: r,
7
+ formHelpers: s,
8
+ validationRules: p,
9
+ isDisabled: i
10
+ }) => {
11
+ const e = r.fieldType === "file_upload" ? r : null;
12
+ return e ? /* @__PURE__ */ n(
13
+ a,
14
+ {
15
+ name: r.id,
16
+ control: s.form.control,
17
+ rules: p,
18
+ render: ({ field: o, fieldState: l }) => {
19
+ const t = o.value ?? [], u = !!l.error;
20
+ return /* @__PURE__ */ n(
21
+ m,
22
+ {
23
+ label: r.label,
24
+ isRequired: r.isRequired,
25
+ fileList: t,
26
+ isDisabled: i,
27
+ shouldShowError: u,
28
+ errorMessage: l?.error?.message,
29
+ helperText: r.helpText,
30
+ onChange: o.onChange,
31
+ onBlur: o.onBlur,
32
+ numberOfFiles: e.numberOfFiles,
33
+ validFileTypes: e.supportedFileTypes
34
+ }
35
+ );
36
+ }
37
+ }
38
+ ) : null;
39
+ };
40
+ export {
41
+ T as FileUploadField
42
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const FillFormByFileUploadField: FC<FormFieldProps>;
@@ -0,0 +1,65 @@
1
+ import { jsxs as d, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as c } from "react";
3
+ import { Alert as h, AlertTitle as f, AlertDescription as V } from "../../components/feedback/alert/alert.js";
4
+ import { FormFileUploadWrapper as g } from "../components/FormFileUploadWrapper.js";
5
+ import { useFillFormByFileUpload as x } from "../hooks/useFillFormByFileUpload.js";
6
+ import { getTestId as T, getFieldTestId as b } from "../utils/fieldTestIds.js";
7
+ const v = ({ validationResult: e }) => {
8
+ const r = c(() => e.validCount > 0 || e.invalidCount > 0 ? `${e.message} (${e.validCount} valid, ${e.invalidCount} invalid)` : e.message, [e]);
9
+ return /* @__PURE__ */ i("div", { className: "mt-4 w-full below-div-full", children: /* @__PURE__ */ d(h, { children: [
10
+ /* @__PURE__ */ i(f, { children: e.hasValidValues ? "Validated" : "Validation Failed" }),
11
+ /* @__PURE__ */ i(V, { children: r })
12
+ ] }) });
13
+ }, B = ({
14
+ field: e,
15
+ formHelpers: r,
16
+ isDisabled: o,
17
+ formConfig: n,
18
+ supportedValues: m
19
+ }) => {
20
+ const a = m?.[e.id], p = a?.disableDefaultTemplateFetch, {
21
+ fileList: u,
22
+ isValidating: s,
23
+ validationResult: l,
24
+ fillFormField: t,
25
+ handleFileChange: F
26
+ } = x({
27
+ field: e,
28
+ formHelpers: r,
29
+ formConfig: n,
30
+ fieldSupportedValues: a
31
+ });
32
+ return t ? /* @__PURE__ */ d("div", { "data-testid": b(e.id), children: [
33
+ /* @__PURE__ */ i(
34
+ g,
35
+ {
36
+ label: e.label,
37
+ isRequired: e.isRequired,
38
+ fileList: u,
39
+ isDisabled: o || s,
40
+ onChange: F,
41
+ onBlur: () => {
42
+ },
43
+ numberOfFiles: 1,
44
+ validFileTypes: t?.supportedFileTypes || [],
45
+ shouldShowError: !!l && !l.hasValidValues,
46
+ errorMessage: l && !l.hasValidValues ? l.message : void 0,
47
+ helperText: e.helpText,
48
+ maxFileSize: t?.maxFileSize,
49
+ disableDefaultTemplateFetch: p
50
+ }
51
+ ),
52
+ s && /* @__PURE__ */ i(
53
+ "p",
54
+ {
55
+ className: "text-content-secondary text-sm mt-1",
56
+ "data-testid": T("fill-form-file-upload", "validating"),
57
+ children: "Validating file..."
58
+ }
59
+ ),
60
+ l && /* @__PURE__ */ i(v, { validationResult: l })
61
+ ] }) : null;
62
+ };
63
+ export {
64
+ B as FillFormByFileUploadField
65
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const FillFormByPasteField: FC<FormFieldProps>;
@@ -0,0 +1,106 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { useMemo as C } from "react";
3
+ import { Button as F } from "../../components/primitives/button/button.js";
4
+ import { Alert as x, AlertTitle as v, AlertDescription as V } from "../../components/feedback/alert/alert.js";
5
+ import { Select as A } from "../../components/forms/select/select.js";
6
+ import { Textarea as P } from "../../components/forms/textarea/textarea.js";
7
+ import { useFillFormByPaste as T } from "../hooks/useFillFormByPaste.js";
8
+ import { getTestId as i, getFieldTestId as N } from "../utils/fieldTestIds.js";
9
+ const y = ({ validationResult: e }) => {
10
+ const r = C(() => e.validCount > 0 || e.invalidCount > 0 ? `${e.message} (${e.validCount} valid, ${e.invalidCount} invalid)` : e.message, [e]);
11
+ return /* @__PURE__ */ t("div", { className: "mt-4 w-full below-div-full", children: /* @__PURE__ */ s(x, { children: [
12
+ /* @__PURE__ */ t(v, { children: e.hasValidValues ? "Validated" : "Validation Failed" }),
13
+ /* @__PURE__ */ t(V, { children: r })
14
+ ] }) });
15
+ }, I = ({
16
+ field: e,
17
+ formHelpers: r,
18
+ isDisabled: d,
19
+ formConfig: m
20
+ }) => {
21
+ const {
22
+ selectedOption: o,
23
+ textareaValue: u,
24
+ isValidating: n,
25
+ validationResult: c,
26
+ copyPasteField: l,
27
+ handleSelectionChange: p,
28
+ handleTextareaChange: h,
29
+ handleValidate: f,
30
+ canValidate: g
31
+ } = T({
32
+ field: e,
33
+ formHelpers: r,
34
+ formConfig: m
35
+ });
36
+ return l ? /* @__PURE__ */ s("div", { "data-testid": N(e.id), children: [
37
+ e.label && /* @__PURE__ */ s(
38
+ "label",
39
+ {
40
+ className: "block text-sm font-medium mb-2",
41
+ "data-testid": i("field-label", e.id),
42
+ children: [
43
+ e.label,
44
+ e.isRequired && /* @__PURE__ */ t("span", { className: "text-destructive ml-1", children: "*" })
45
+ ]
46
+ }
47
+ ),
48
+ /* @__PURE__ */ t(
49
+ "div",
50
+ {
51
+ className: "mb-4",
52
+ "data-testid": i("fill-form-paste-select", e.id),
53
+ children: /* @__PURE__ */ t(
54
+ A,
55
+ {
56
+ id: l.id,
57
+ label: l?.selectFieldConfig?.selectFieldLabel || "Select Field",
58
+ placeholder: l?.selectFieldConfig?.selectFieldPlaceholder || "Choose a field to update",
59
+ options: l.selectFieldConfig.selectFieldOptions,
60
+ value: o?.[0] || null,
61
+ onChange: (a, b) => p(a ? [a] : null, b),
62
+ isSearchable: !1,
63
+ multiple: !1,
64
+ disabled: d,
65
+ required: !0,
66
+ labelOrientation: l?.selectFieldConfig?.labelOrientation || "top"
67
+ }
68
+ )
69
+ }
70
+ ),
71
+ /* @__PURE__ */ t(
72
+ P,
73
+ {
74
+ label: l?.textAreaConfig?.textAreaLabel || "Paste Values (comma-separated)",
75
+ value: u,
76
+ onChange: (a) => h(a.target.value),
77
+ placeholder: l?.textAreaConfig?.textAreaPlaceholder || "Enter comma-separated values...",
78
+ disabled: d || !o?.[0]?.value || n,
79
+ required: !0,
80
+ helperText: "Paste values up to 2000 characters",
81
+ error: !1,
82
+ characterLimit: 2e3
83
+ }
84
+ ),
85
+ /* @__PURE__ */ t(
86
+ "div",
87
+ {
88
+ className: "flex justify-end gap-4 mt-2",
89
+ "data-testid": i("fill-form-paste-actions", e.id),
90
+ children: /* @__PURE__ */ t(
91
+ F,
92
+ {
93
+ onClick: f,
94
+ disabled: d || !g,
95
+ "data-testid": i("button", "validate-paste"),
96
+ children: n ? "Validating..." : "Validate"
97
+ }
98
+ )
99
+ }
100
+ ),
101
+ c && /* @__PURE__ */ t(y, { validationResult: c })
102
+ ] }) : null;
103
+ };
104
+ export {
105
+ I as FillFormByPasteField
106
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const LabelField: FC<FormFieldProps>;
@@ -0,0 +1,14 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ const l = ({ field: e }) => /* @__PURE__ */ s(
3
+ "span",
4
+ {
5
+ className: e.className || "text-[#1F2B4D] font-manrope text-[14px] font-bold leading-[21px]",
6
+ children: [
7
+ e.label,
8
+ e.isRequired ? /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" }) : null
9
+ ]
10
+ }
11
+ );
12
+ export {
13
+ l as LabelField
14
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface MonthRangeFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ export declare const MonthRangeField: FC<MonthRangeFieldProps>;
8
+ export {};
@@ -0,0 +1,72 @@
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { Controller as v } from "react-hook-form";
3
+ import { MonthRangePicker as I } from "../../components/forms/date-picker/month-range-picker.js";
4
+ import { getFieldTestId as T } from "../utils/fieldTestIds.js";
5
+ import { toLocalDate as o } from "../utils/calendar-boundary.js";
6
+ const w = (t) => {
7
+ if (t.includes("/")) {
8
+ const [r, u] = t.split("/");
9
+ return { year: parseInt(u, 10), month: parseInt(r, 10) - 1 };
10
+ }
11
+ const [s, l] = t.split("-");
12
+ return { year: parseInt(s, 10), month: parseInt(l, 10) - 1 };
13
+ }, q = ({
14
+ field: t,
15
+ validationRules: s,
16
+ isDisabled: l,
17
+ formHelpers: r
18
+ }) => {
19
+ const u = r.form.control, e = t.fieldType === "month_range" ? t : null;
20
+ if (!e) return null;
21
+ const y = e.displayFormat || "MM/YYYY", i = e.minMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - e.minMonthsOffset, 1) : e.disablePastMonths ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1) : o(e.minDate), m = e.maxMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + e.maxMonthsOffset, 1) : o(e.maxDate);
22
+ return /* @__PURE__ */ h(
23
+ v,
24
+ {
25
+ name: t.id,
26
+ control: u,
27
+ defaultValue: e.defaultRange ? { start: e.defaultRange.start || null, end: e.defaultRange.end || null } : void 0,
28
+ rules: s,
29
+ render: ({ field: d, fieldState: c }) => {
30
+ const D = !!c.error, a = d.value, p = a?.start ? w(a.start) : null, M = a?.end ? w(a.end) : null, S = p && M;
31
+ return /* @__PURE__ */ h("div", { "data-testid": T(t.id), children: /* @__PURE__ */ h(
32
+ I,
33
+ {
34
+ label: t.label,
35
+ displayFormat: y,
36
+ ...S && {
37
+ value: {
38
+ from: p,
39
+ to: M
40
+ }
41
+ },
42
+ onChange: (n) => {
43
+ if (!n?.from || !n?.to) {
44
+ const f = { start: null, end: null };
45
+ d.onChange(f), r.setValue(t.id, f);
46
+ return;
47
+ }
48
+ const x = `${n.from.year}-${String(n.from.month + 1).padStart(2, "0")}-01`, F = new Date(n.to.year, n.to.month + 1, 0).getDate(), Y = `${n.to.year}-${String(n.to.month + 1).padStart(2, "0")}-${String(F).padStart(2, "0")}`, g = {
49
+ start: x,
50
+ end: Y
51
+ };
52
+ d.onChange(g), r.setValue(t.id, g);
53
+ },
54
+ placeholder: t.placeholder,
55
+ minDate: i,
56
+ maxDate: m,
57
+ startMonth: i || o(e.startMonth),
58
+ endMonth: m || o(e.endMonth),
59
+ required: t.isRequired,
60
+ disabled: l,
61
+ error: D,
62
+ helperText: D ? c.error?.message : t.helpText,
63
+ showFooter: !0
64
+ }
65
+ ) });
66
+ }
67
+ }
68
+ );
69
+ };
70
+ export {
71
+ q as MonthRangeField
72
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface MultiMonthPickerFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ export declare const MultiMonthPickerField: FC<MultiMonthPickerFieldProps>;
8
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Controller as d } from "react-hook-form";
3
+ import { MultiMonthPicker as p } from "../../components/forms/date-picker/multi-month-picker.js";
4
+ import { getFieldTestId as M } from "../utils/fieldTestIds.js";
5
+ import { toLocalDate as t } from "../utils/calendar-boundary.js";
6
+ const b = ({
7
+ field: r,
8
+ validationRules: m,
9
+ isDisabled: h,
10
+ formHelpers: s
11
+ }) => {
12
+ const u = s.form.control, e = r.fieldType === "multi_month_picker" ? r : null;
13
+ return e ? /* @__PURE__ */ o(
14
+ d,
15
+ {
16
+ name: r.id,
17
+ control: u,
18
+ rules: m,
19
+ render: ({ field: n, fieldState: a }) => {
20
+ const l = !!a.error, i = n.value;
21
+ return /* @__PURE__ */ o("div", { "data-testid": M(r.id), children: /* @__PURE__ */ o(
22
+ p,
23
+ {
24
+ label: r.label,
25
+ value: Array.isArray(i) ? i : void 0,
26
+ onChange: (c) => {
27
+ n.onChange(c ?? []);
28
+ },
29
+ placeholder: r.placeholder,
30
+ required: r.isRequired,
31
+ disabled: h,
32
+ error: l,
33
+ helperText: l ? a.error?.message : r.helpText,
34
+ minDate: t(e.minDate),
35
+ maxDate: t(e.maxDate),
36
+ startMonth: t(e.startMonth),
37
+ endMonth: t(e.endMonth)
38
+ }
39
+ ) });
40
+ }
41
+ }
42
+ ) : null;
43
+ };
44
+ export {
45
+ b as MultiMonthPickerField
46
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface MultiWeekPickerFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ export declare const MultiWeekPickerField: FC<MultiWeekPickerFieldProps>;
8
+ export {};
@@ -0,0 +1,47 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Controller as p } from "react-hook-form";
3
+ import { MultiWeekPicker as h } from "../../components/forms/date-picker/multi-week-picker.js";
4
+ import { getFieldTestId as k } from "../utils/fieldTestIds.js";
5
+ import { toLocalDate as i } from "../utils/calendar-boundary.js";
6
+ const v = ({
7
+ field: e,
8
+ validationRules: m,
9
+ isDisabled: s,
10
+ formHelpers: c
11
+ }) => {
12
+ const u = c.form.control, r = e.fieldType === "multi_week_picker" ? e : null;
13
+ return r ? /* @__PURE__ */ o(
14
+ p,
15
+ {
16
+ name: e.id,
17
+ control: u,
18
+ rules: m,
19
+ render: ({ field: t, fieldState: a }) => {
20
+ const l = !!a.error, n = t.value;
21
+ return /* @__PURE__ */ o("div", { "data-testid": k(e.id), children: /* @__PURE__ */ o(
22
+ h,
23
+ {
24
+ label: e.label,
25
+ value: Array.isArray(n) ? n : void 0,
26
+ onChange: (d) => {
27
+ t.onChange(d ?? []);
28
+ },
29
+ placeholder: e.placeholder,
30
+ required: e.isRequired,
31
+ disabled: s,
32
+ error: l,
33
+ helperText: l ? a.error?.message : e.helpText,
34
+ calendarType: r.calendarType,
35
+ fiscalMode: r.fiscalMode,
36
+ weekStartsOn: r.weekStartsOn,
37
+ minDate: i(r.minDate),
38
+ maxDate: i(r.maxDate)
39
+ }
40
+ ) });
41
+ }
42
+ }
43
+ ) : null;
44
+ };
45
+ export {
46
+ v as MultiWeekPickerField
47
+ };
@@ -0,0 +1,18 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface NumericComboboxFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ /**
8
+ * Stepper-style numeric combobox driven by `min`, `max`, `step`. Value is
9
+ * stored in form state as a `number`. The wrapped Impact Nova `Combobox`
10
+ * takes a string `value`, so the controller serialises on render and
11
+ * coerces back to a `Number` on change.
12
+ *
13
+ * When the field is disabled (e.g. via `disableDependency`) the displayed
14
+ * value is collapsed to `"0"` with a slight opacity, mirroring the
15
+ * legacy bespoke implementation in scenario-planning's bulk edit sheet.
16
+ */
17
+ export declare const NumericComboboxField: FC<NumericComboboxFieldProps>;
18
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { Controller as b } from "react-hook-form";
3
+ import { Combobox as h } from "../../components/forms/combobox/combobox.js";
4
+ const g = ({
5
+ field: r,
6
+ validationRules: i,
7
+ isDisabled: o,
8
+ formHelpers: s
9
+ }) => {
10
+ const e = r.fieldType === "numeric_combobox" ? r : null;
11
+ return e ? /* @__PURE__ */ m(
12
+ b,
13
+ {
14
+ name: r.id,
15
+ control: s.form.control,
16
+ rules: i,
17
+ render: ({ field: n, fieldState: t }) => {
18
+ const a = !!t.error, u = n.value, p = o ? "0" : u == null || u === "" ? "" : String(u);
19
+ return /* @__PURE__ */ m("div", { children: /* @__PURE__ */ m(
20
+ h,
21
+ {
22
+ label: r.label,
23
+ min: e.min,
24
+ max: e.max,
25
+ step: e.step,
26
+ isNumeric: !0,
27
+ clearable: !0,
28
+ value: p,
29
+ disabled: o,
30
+ className: o ? "opacity-60" : void 0,
31
+ placeholder: r.placeholder,
32
+ required: r.isRequired,
33
+ error: a,
34
+ helperText: a ? t.error?.message : r.helpText,
35
+ onChange: (l) => {
36
+ if (l === "" || l == null) {
37
+ n.onChange("");
38
+ return;
39
+ }
40
+ const c = Number(l);
41
+ n.onChange(Number.isFinite(c) ? c : "");
42
+ }
43
+ }
44
+ ) });
45
+ }
46
+ }
47
+ ) : null;
48
+ };
49
+ export {
50
+ g as NumericComboboxField
51
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const RadioField: FC<FormFieldProps>;
@@ -0,0 +1,68 @@
1
+ import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
+ import { useMemo as b } from "react";
3
+ import { Controller as h } from "react-hook-form";
4
+ import { RadioGroup as p, RadioGroupItem as v } from "../../components/forms/radio-group/radio-group.js";
5
+ import { getTestId as d, getFieldTestId as g } from "../utils/fieldTestIds.js";
6
+ const R = ({
7
+ field: e,
8
+ formHelpers: n,
9
+ validationRules: m,
10
+ isDisabled: c
11
+ }) => {
12
+ const l = e.fieldType === "radio" ? e : null, u = b(() => l ? l.options?.map((r) => ({
13
+ label: r.label,
14
+ value: r.value,
15
+ disabled: r.isDisabled ?? !1
16
+ })) || [] : [], [l]);
17
+ return l ? /* @__PURE__ */ a(
18
+ h,
19
+ {
20
+ name: e.id,
21
+ control: n.form.control,
22
+ rules: m,
23
+ render: ({ field: r, fieldState: i }) => {
24
+ const o = !!i.error, x = r.value;
25
+ return /* @__PURE__ */ s("div", { className: "flex flex-col gap-1", "data-testid": g(e.id), children: [
26
+ e.label && /* @__PURE__ */ s("label", { className: "block text-xs font-medium mb-2 text-[#60697d]", "data-testid": d("field-label", e.id), children: [
27
+ e.label,
28
+ e.isRequired && /* @__PURE__ */ a("span", { className: "text-destructive ml-1", children: "*" })
29
+ ] }),
30
+ /* @__PURE__ */ a("div", { "data-testid": d("radio-group", e.id), children: /* @__PURE__ */ a(
31
+ p,
32
+ {
33
+ orientation: l?.orientation === "row" ? "horizontal" : "vertical",
34
+ value: x,
35
+ onValueChange: (t) => {
36
+ r.onChange(t), r.onBlur();
37
+ },
38
+ disabled: c,
39
+ children: u.map((t) => /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
40
+ /* @__PURE__ */ a(
41
+ v,
42
+ {
43
+ value: t.value,
44
+ id: `${e.id}-${t.value}`,
45
+ disabled: t.disabled
46
+ }
47
+ ),
48
+ /* @__PURE__ */ a(
49
+ "label",
50
+ {
51
+ htmlFor: `${e.id}-${t.value}`,
52
+ className: `text-sm font-medium leading-[14px] cursor-pointer text-[#60697D] peer-data-[state=checked]:text-[#0D152C] ${t.disabled ? "text-disabled-text cursor-not-allowed peer-disabled:opacity-100" : ""}`,
53
+ children: t.label
54
+ }
55
+ )
56
+ ] }, t.value))
57
+ }
58
+ ) }),
59
+ o && /* @__PURE__ */ a("p", { className: "text-destructive text-sm mt-1", children: i?.error?.message }),
60
+ e.helpText && !o && /* @__PURE__ */ a("p", { className: "text-content-secondary text-sm mt-1", children: e.helpText })
61
+ ] });
62
+ }
63
+ }
64
+ ) : null;
65
+ };
66
+ export {
67
+ R as RadioField
68
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const SelectField: FC<FormFieldProps>;
@@ -0,0 +1,76 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useState as M } from "react";
3
+ import { Controller as f } from "react-hook-form";
4
+ import { Select as x } from "../../components/forms/select/select.js";
5
+ import { useSelectOptions as E } from "../hooks/useSelectOptions.js";
6
+ import { getFieldTestId as R } from "../utils/fieldTestIds.js";
7
+ import { isEmptyValue as T } from "../../form-engine/is-empty-value.js";
8
+ const F = ({
9
+ field: e,
10
+ validationRules: p,
11
+ isDisabled: m,
12
+ formHelpers: l,
13
+ formConfig: u,
14
+ supportedValues: d
15
+ }) => {
16
+ const t = e.fieldType === "select" ? e : null, [S, s] = M(!1), h = l.form.control, b = d?.[e.id], { options: g, isLoading: O, error: y, refetch: C } = E({
17
+ apiConfig: t?.apiConfig,
18
+ formHelpers: l,
19
+ formConfig: u,
20
+ initialOptions: t?.options,
21
+ id: e.id,
22
+ isEnabled: S,
23
+ getSelectOptionsName: t?.getSelectOptionsName,
24
+ fieldSupportedValues: b
25
+ });
26
+ return t ? /* @__PURE__ */ c(
27
+ f,
28
+ {
29
+ name: e.id,
30
+ control: h,
31
+ rules: p,
32
+ render: ({ field: o, fieldState: n }) => {
33
+ const a = !!n.error, i = o.value, A = t?.isMultiSelect ? e.id : `${e.id}-${T(i) ? "empty" : "has-value"}`;
34
+ return /* @__PURE__ */ c(
35
+ x,
36
+ {
37
+ id: e.id,
38
+ label: e.label,
39
+ placeholder: e?.placeholder,
40
+ required: e.isRequired,
41
+ isReadOnly: e.isFieldReadonly,
42
+ disabled: m,
43
+ options: g,
44
+ maxSelectableOptions: t?.maxSelectLimit,
45
+ value: t?.isMultiSelect ? i ?? [] : i?.[0],
46
+ onChange: (r) => {
47
+ t?.isMultiSelect ? o.onChange(
48
+ Array.isArray(r) ? r : []
49
+ ) : r == null ? o.onChange([]) : o.onChange(
50
+ Array.isArray(r) ? r : [r]
51
+ );
52
+ },
53
+ isSearchable: !t?.disableOptionSearch,
54
+ isClearable: !t?.disableClearAll,
55
+ multiple: t?.isMultiSelect,
56
+ isSelectAllEnabled: !t?.disableSelectAll,
57
+ labelOrientation: t?.labelOrientation || "top",
58
+ error: a,
59
+ helperText: a ? n.error?.message : e.helpText,
60
+ ignoreAccents: !0,
61
+ isLoading: O,
62
+ fetchError: y,
63
+ onRefetch: C,
64
+ onMenuOpen: () => s(!0),
65
+ onMenuClose: () => s(!1),
66
+ "data-testid": R(e.id)
67
+ },
68
+ A
69
+ );
70
+ }
71
+ }
72
+ ) : null;
73
+ };
74
+ export {
75
+ F as SelectField
76
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const SwitchField: FC<FormFieldProps>;