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,8 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface DateRangeFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ export declare const DateRangeField: FC<DateRangeFieldProps>;
8
+ export {};
@@ -0,0 +1,57 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Controller as M } from "react-hook-form";
4
+ import { DateRangePicker as S } from "../../components/forms/date-picker/date-range-picker.js";
5
+ import { toLocalDate as n } from "../utils/calendar-boundary.js";
6
+ import { handleMinMaxProp as v } from "../utils/date.utils.js";
7
+ const T = ({
8
+ field: t,
9
+ validationRules: i,
10
+ isDisabled: l,
11
+ formHelpers: d
12
+ }) => {
13
+ const r = t.fieldType === "date_range" ? t : null;
14
+ if (!r) return null;
15
+ const m = d.form.control, { minDate: c, maxDate: u } = v(r);
16
+ return /* @__PURE__ */ a(
17
+ M,
18
+ {
19
+ name: t.id,
20
+ control: m,
21
+ disabled: l,
22
+ rules: i,
23
+ render: ({ field: p, fieldState: s }) => {
24
+ const h = !!s.error, e = p.value;
25
+ return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
26
+ S,
27
+ {
28
+ label: t.label,
29
+ minDate: c,
30
+ maxDate: u,
31
+ startMonth: r.startMonth ? n(r.startMonth) : void 0,
32
+ endMonth: r.endMonth ? n(r.endMonth) : void 0,
33
+ value: {
34
+ from: e?.start ? n(e.start) : void 0,
35
+ to: e?.end ? n(e.end) : void 0
36
+ },
37
+ onChange: (o) => {
38
+ const g = o?.from ? `${o.from.getFullYear()}-${String(o.from.getMonth() + 1).padStart(2, "0")}-${String(o.from.getDate()).padStart(2, "0")}` : null, D = o?.to ? `${o.to.getFullYear()}-${String(o.to.getMonth() + 1).padStart(2, "0")}-${String(o.to.getDate()).padStart(2, "0")}` : null;
39
+ d.setValue(t.id, { start: g, end: D });
40
+ },
41
+ startPlaceholder: r.startPlaceholder || "Start Date",
42
+ endPlaceholder: r.endPlaceholder || "End Date",
43
+ placeholder: t.placeholder,
44
+ required: t.isRequired,
45
+ disabled: l,
46
+ error: h,
47
+ helperText: h ? s.error?.message : t.helpText,
48
+ showFooter: !0
49
+ }
50
+ ) });
51
+ }
52
+ }
53
+ );
54
+ };
55
+ export {
56
+ T as DateRangeField
57
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const DividerField: FC<FormFieldProps>;
@@ -0,0 +1,9 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
+ const n = ({ field: r }) => {
4
+ const e = r.fieldType === "divider" ? r : null;
5
+ return e ? /* @__PURE__ */ i("hr", { className: l(e.className ?? "my-2", "border-stroke-hairline") }) : null;
6
+ };
7
+ export {
8
+ n as DividerField
9
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const DividerWithLabelField: FC<FormFieldProps>;
@@ -0,0 +1,31 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
+ const n = ({ field: i }) => {
4
+ const e = i.fieldType === "divider_with_label" ? i : null;
5
+ return e ? /* @__PURE__ */ s(
6
+ "div",
7
+ {
8
+ className: l(
9
+ "my-4 flex items-center gap-3",
10
+ e.dividerClassName
11
+ ),
12
+ children: [
13
+ /* @__PURE__ */ r("hr", { className: "flex-1 border-stroke-hairline" }),
14
+ /* @__PURE__ */ r(
15
+ "span",
16
+ {
17
+ className: l(
18
+ "text-xs font-medium text-content-icon uppercase shrink-0",
19
+ e.labelClassName
20
+ ),
21
+ children: e.label
22
+ }
23
+ ),
24
+ /* @__PURE__ */ r("hr", { className: "flex-1 border-stroke-hairline" })
25
+ ]
26
+ }
27
+ ) : null;
28
+ };
29
+ export {
30
+ n as DividerWithLabelField
31
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const FileUploadField: FC<FormFieldProps>;
@@ -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>;