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,12 @@
1
+ /**
2
+ * Optional headless validation helpers for filter-panel UIs.
3
+ * Does not include filter orchestration, saved filters, or network I/O.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ export { buildFilterFieldValidationRules, isFilterFieldValueValid, } from './utils/buildFilterFieldValidationRules';
8
+ export type { FilterFieldValidationShape } from './utils/buildFilterFieldValidationRules';
9
+ export { validateVisibleRequiredFilterFields, } from './utils/validateVisibleRequiredFilterFields';
10
+ export type { FilterFormValues, ValidateVisibleRequiredFilterFieldsResult, } from './utils/validateVisibleRequiredFilterFields';
11
+ export { navigateToFirstFilterValidationError } from './utils/validationNavigation.utils';
12
+ export type { FilterValidationNavigationConfig, FilterValidationNavigationOptions, } from './utils/validationNavigation.utils';
@@ -0,0 +1,9 @@
1
+ import { navigateToFirstFilterValidationError as l } from "./utils/validationNavigation.utils.js";
2
+ import { buildFieldValidationRules as d, isFieldValueValid as r } from "../form-react/utils/buildFieldValidationRules.js";
3
+ import { validateVisibleRequiredFormFields as o } from "../form-react/utils/validateVisibleRequiredFormFields.js";
4
+ export {
5
+ d as buildFilterFieldValidationRules,
6
+ r as isFilterFieldValueValid,
7
+ l as navigateToFirstFilterValidationError,
8
+ o as validateVisibleRequiredFilterFields
9
+ };
@@ -0,0 +1 @@
1
+ export { buildFieldValidationRules as buildFilterFieldValidationRules, isFieldValueValid as isFilterFieldValueValid, type FieldValidationShape as FilterFieldValidationShape, } from '../../form-react/utils/buildFieldValidationRules';
@@ -0,0 +1 @@
1
+ export { validateVisibleRequiredFormFields as validateVisibleRequiredFilterFields, type ValidateVisibleRequiredFormFieldsResult as ValidateVisibleRequiredFilterFieldsResult, type FormValidationValues as FilterFormValues, } from '../../form-react/utils/validateVisibleRequiredFormFields';
@@ -0,0 +1,26 @@
1
+ export interface FilterValidationNavigationConfig {
2
+ dimensions: Array<{
3
+ id: string;
4
+ label?: string;
5
+ sections: Array<{
6
+ id: string;
7
+ label?: string;
8
+ fields: Array<{
9
+ id: string;
10
+ label?: string;
11
+ }>;
12
+ }>;
13
+ }>;
14
+ }
15
+ export interface FilterValidationNavigationOptions {
16
+ filterConfig: FilterValidationNavigationConfig;
17
+ errorFieldIds: string[];
18
+ getFieldTestId: (fieldId: string) => string;
19
+ onNavigateToDimension?: (dimensionId: string) => void;
20
+ buildValidationToastMessage?: (params: {
21
+ errorFieldLabels: string[];
22
+ dimensionLabel?: string;
23
+ }) => string;
24
+ showToast?: (message: string) => void;
25
+ }
26
+ export declare function navigateToFirstFilterValidationError({ filterConfig, errorFieldIds, getFieldTestId, onNavigateToDimension, buildValidationToastMessage, showToast, }: FilterValidationNavigationOptions): void;
@@ -0,0 +1,38 @@
1
+ function b({
2
+ filterConfig: f,
3
+ errorFieldIds: i,
4
+ getFieldTestId: s,
5
+ onNavigateToDimension: d,
6
+ buildValidationToastMessage: t,
7
+ showToast: o
8
+ }) {
9
+ if (i.length === 0)
10
+ return;
11
+ const r = i[0];
12
+ for (const n of f.dimensions)
13
+ for (const l of n.sections)
14
+ if (l.fields.find(
15
+ (e) => e.id === r
16
+ )) {
17
+ if (d?.(n.id), t && o) {
18
+ const e = i.map((c) => l.fields.find(
19
+ (a) => a.id === c
20
+ )?.label || c).filter(Boolean);
21
+ o(
22
+ t({
23
+ errorFieldLabels: e,
24
+ dimensionLabel: n.label
25
+ })
26
+ );
27
+ }
28
+ requestAnimationFrame(() => {
29
+ document.querySelector(
30
+ `[data-testid="${s(r)}"]`
31
+ )?.scrollIntoView({ behavior: "smooth", block: "center" });
32
+ });
33
+ return;
34
+ }
35
+ }
36
+ export {
37
+ b as navigateToFirstFilterValidationError
38
+ };
@@ -0,0 +1,17 @@
1
+ import { FieldDependency, FieldVisibilityBase, FormValuesSnapshot } from './types';
2
+ export declare function collectFieldDependencyIds(field: FieldVisibilityBase): string[];
3
+ export declare function computeIsFieldVisible(field: FieldVisibilityBase, formValues: FormValuesSnapshot): boolean;
4
+ export declare function computeIsFieldDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, options?: {
5
+ isCascadingDisabled?: (field: FieldVisibilityBase) => boolean;
6
+ }): boolean;
7
+ export declare function computeIsCascadingDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, isCascadingEnabled: boolean): boolean;
8
+ export declare function getDependentFieldIds(allFields: FieldVisibilityBase[], changedFieldName: string): string[];
9
+ export declare function buildCascadeParentFormState(cascadingDependency: FieldDependency[] | undefined, formValues: FormValuesSnapshot): Record<string, unknown> | null;
10
+ export declare function collectFormWatchFieldIds(fields: FieldVisibilityBase[]): string[];
11
+ /**
12
+ * @deprecated Use {@link collectFormWatchFieldIds}. Kept for backwards compatibility.
13
+ */
14
+ export declare function collectFilterSidebarWatchFieldIds(fields: FieldVisibilityBase[]): string[];
15
+ export declare function collectSectionWatchFieldIds(fields: FieldVisibilityBase[]): string[];
16
+ export declare function hasVisibleFieldErrors(fields: FieldVisibilityBase[], formErrors: Record<string, unknown>, formValues: FormValuesSnapshot): boolean;
17
+ export declare function collectVisibleFieldIds(fields: FieldVisibilityBase[], formValues: FormValuesSnapshot): string[];
@@ -0,0 +1,90 @@
1
+ import { isEmptyValue as l } from "./is-empty-value.js";
2
+ function a(e) {
3
+ const t = /* @__PURE__ */ new Set();
4
+ return e.visibilityDependency?.forEach((n) => {
5
+ t.add(n.fieldId);
6
+ }), e.disableDependency?.forEach((n) => {
7
+ t.add(n.fieldId);
8
+ }), e.cascadingDependency?.forEach((n) => {
9
+ t.add(n.fieldId);
10
+ }), Array.from(t);
11
+ }
12
+ function d(e, t) {
13
+ return !e.visibilityDependency || e.visibilityDependency.length === 0 ? !0 : e.visibilityDependency.every((n) => t[n.fieldId] === n.value);
14
+ }
15
+ function u(e, t) {
16
+ const n = t[e.fieldId];
17
+ return e.value === null ? !l(n) : e.value === "__empty__" ? l(n) : typeof n == "boolean" ? n === (e.value === "true") : Array.isArray(n) ? n.some((r) => typeof r == "object" && r?.value === e.value ? !0 : typeof r == "string" && r === e.value) : typeof n == "object" && n !== null && "value" in n ? n.value === e.value : n === e.value;
18
+ }
19
+ function s(e, t, n) {
20
+ return !!(!d(e, t) || e.isDisabled || e.disableDependency && e.disableDependency.length > 0 && (e.disableDependencyMode === "every" ? e.disableDependency.every(
21
+ (i) => u(i, t)
22
+ ) : e.disableDependency.some(
23
+ (i) => u(i, t)
24
+ )) || n?.isCascadingDisabled?.(e));
25
+ }
26
+ function f(e, t, n) {
27
+ return !n || !e.cascadingDependency || e.cascadingDependency.length === 0 ? !1 : e.cascadingDependency.some((r) => {
28
+ const i = t[r.fieldId];
29
+ return r.value === null || r.value === void 0 ? l(i) : i === r.value;
30
+ });
31
+ }
32
+ function y(e, t) {
33
+ return e.filter(
34
+ (n) => n.cascadingDependency?.some(
35
+ (r) => r.fieldId === t
36
+ )
37
+ ).map((n) => n.id);
38
+ }
39
+ function p(e, t) {
40
+ if (!e || e.length === 0)
41
+ return null;
42
+ const n = {};
43
+ for (const r of e) {
44
+ const i = t[r.fieldId];
45
+ i == null || i === "" || Array.isArray(i) && i.length === 0 || (n[r.fieldId] = i);
46
+ }
47
+ return Object.keys(n).length > 0 ? n : null;
48
+ }
49
+ function o(e) {
50
+ const t = /* @__PURE__ */ new Set();
51
+ for (const n of e) {
52
+ n.doNotIncludeInSubmit || t.add(n.id);
53
+ for (const r of a(n))
54
+ t.add(r);
55
+ }
56
+ return Array.from(t);
57
+ }
58
+ function b(e) {
59
+ return o(e);
60
+ }
61
+ function v(e) {
62
+ const t = /* @__PURE__ */ new Set();
63
+ for (const n of e) {
64
+ t.add(n.id);
65
+ for (const r of a(n))
66
+ t.add(r);
67
+ }
68
+ return Array.from(t);
69
+ }
70
+ function D(e, t, n) {
71
+ return e.some(
72
+ (r) => !!t[r.id] && d(r, n)
73
+ );
74
+ }
75
+ function I(e, t) {
76
+ return e.filter((n) => d(n, t)).map((n) => n.id);
77
+ }
78
+ export {
79
+ p as buildCascadeParentFormState,
80
+ a as collectFieldDependencyIds,
81
+ b as collectFilterSidebarWatchFieldIds,
82
+ o as collectFormWatchFieldIds,
83
+ v as collectSectionWatchFieldIds,
84
+ I as collectVisibleFieldIds,
85
+ f as computeIsCascadingDisabled,
86
+ s as computeIsFieldDisabled,
87
+ d as computeIsFieldVisible,
88
+ y as getDependentFieldIds,
89
+ D as hasVisibleFieldErrors
90
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Headless dynamic form dependency engine.
3
+ * Pure functions — no React, no network, no DOM.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ export { isEmptyValue } from './is-empty-value';
8
+ export type { FieldDependency, FieldVisibilityBase, FormValuesSnapshot, } from './types';
9
+ export { buildCascadeParentFormState, collectFieldDependencyIds, collectFormWatchFieldIds, collectFilterSidebarWatchFieldIds, collectSectionWatchFieldIds, collectVisibleFieldIds, computeIsCascadingDisabled, computeIsFieldDisabled, computeIsFieldVisible, getDependentFieldIds, hasVisibleFieldErrors, } from './field-dependency-graph';
@@ -0,0 +1,16 @@
1
+ import { isEmptyValue as d } from "./is-empty-value.js";
2
+ import { buildCascadeParentFormState as t, collectFieldDependencyIds as c, collectFilterSidebarWatchFieldIds as s, collectFormWatchFieldIds as o, collectSectionWatchFieldIds as a, collectVisibleFieldIds as r, computeIsCascadingDisabled as F, computeIsFieldDisabled as I, computeIsFieldVisible as m, getDependentFieldIds as p, hasVisibleFieldErrors as b } from "./field-dependency-graph.js";
3
+ export {
4
+ t as buildCascadeParentFormState,
5
+ c as collectFieldDependencyIds,
6
+ s as collectFilterSidebarWatchFieldIds,
7
+ o as collectFormWatchFieldIds,
8
+ a as collectSectionWatchFieldIds,
9
+ r as collectVisibleFieldIds,
10
+ F as computeIsCascadingDisabled,
11
+ I as computeIsFieldDisabled,
12
+ m as computeIsFieldVisible,
13
+ p as getDependentFieldIds,
14
+ b as hasVisibleFieldErrors,
15
+ d as isEmptyValue
16
+ };
@@ -0,0 +1 @@
1
+ export declare function isEmptyValue(value: unknown): boolean;
@@ -0,0 +1,8 @@
1
+ function e(r) {
2
+ return !!(r == null || typeof r == "string" && r.trim() === "" || Array.isArray(r) && (r.length === 0 || r.every((t) => t == null)) || typeof r == "object" && !Array.isArray(r) && (Object.keys(r).length === 0 || Object.values(r).every(
3
+ (t) => t == null
4
+ )));
5
+ }
6
+ export {
7
+ e as isEmptyValue
8
+ };
@@ -0,0 +1,17 @@
1
+ export type FormValuesSnapshot = Record<string, unknown>;
2
+ export type FieldDependency = {
3
+ fieldId: string;
4
+ value: unknown;
5
+ };
6
+ /** Minimal field shape for dependency / visibility evaluation. */
7
+ export type FieldVisibilityBase = {
8
+ id: string;
9
+ label?: string;
10
+ isRequired?: boolean;
11
+ visibilityDependency?: FieldDependency[];
12
+ disableDependency?: FieldDependency[];
13
+ disableDependencyMode?: 'some' | 'every';
14
+ cascadingDependency?: FieldDependency[];
15
+ isDisabled?: boolean;
16
+ doNotIncludeInSubmit?: boolean;
17
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const ButtonsGroupField: FC<FormFieldProps>;
@@ -0,0 +1,52 @@
1
+ import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Controller as p } from "react-hook-form";
4
+ import { Button as v } from "../../components/primitives/button/button.js";
5
+ import { getAppIcon as b } from "../utils/icons.js";
6
+ import { ButtonGroup as d } from "../../components/primitives/button-group/button-group.js";
7
+ const T = ({
8
+ field: e,
9
+ formHelpers: t,
10
+ validationRules: a,
11
+ isDisabled: i
12
+ }) => {
13
+ const l = e.fieldType === "button_group" ? e : null;
14
+ if (!l) return null;
15
+ const m = l.options?.map((r) => ({
16
+ label: r.label,
17
+ value: r.value,
18
+ icon: r.icon ? typeof r.icon == "string" ? b(r.icon, { className: "mr-1" }) : r.icon : void 0
19
+ }));
20
+ return /* @__PURE__ */ n(
21
+ p,
22
+ {
23
+ name: e.id,
24
+ control: t.form.control,
25
+ rules: a,
26
+ render: ({ field: r, fieldState: u }) => {
27
+ const s = r.value;
28
+ return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
29
+ d,
30
+ {
31
+ label: e.label,
32
+ required: e.isRequired,
33
+ value: s ?? void 0,
34
+ disabled: i,
35
+ onValueChange: (o) => {
36
+ r.onChange(o), r.onBlur();
37
+ },
38
+ error: !!u.error,
39
+ helperText: u.error?.message || e.helpText,
40
+ children: m.map((o) => /* @__PURE__ */ c(v, { value: o.value, children: [
41
+ o.icon,
42
+ o.label
43
+ ] }, o.value))
44
+ }
45
+ ) });
46
+ }
47
+ }
48
+ );
49
+ };
50
+ export {
51
+ T as ButtonsGroupField
52
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const CheckboxField: FC<FormFieldProps>;
@@ -0,0 +1,46 @@
1
+ import { jsx as r, jsxs as n } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Controller as m } from "react-hook-form";
4
+ import { Checkbox as i } from "../../components/forms/checkbox/checkbox.js";
5
+ const p = ({
6
+ field: e,
7
+ validationRules: c,
8
+ isDisabled: l,
9
+ formHelpers: a
10
+ }) => (e.fieldType === "checkbox" ? e : null) ? /* @__PURE__ */ r(
11
+ m,
12
+ {
13
+ name: e.id,
14
+ control: a.form.control,
15
+ rules: c,
16
+ render: ({ field: o }) => {
17
+ const t = !!(o.value ?? !1);
18
+ return /* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
19
+ /* @__PURE__ */ r(
20
+ i,
21
+ {
22
+ checked: t,
23
+ onCheckedChange: (s) => {
24
+ o.onChange(s === !0);
25
+ },
26
+ disabled: l
27
+ }
28
+ ),
29
+ e.label && /* @__PURE__ */ n(
30
+ "label",
31
+ {
32
+ className: "text-sm font-medium text-content cursor-pointer",
33
+ onClick: () => o.onChange(!t),
34
+ children: [
35
+ e.label,
36
+ e.isRequired && /* @__PURE__ */ r("span", { className: "text-destructive ml-1", children: "*" })
37
+ ]
38
+ }
39
+ )
40
+ ] });
41
+ }
42
+ }
43
+ ) : null;
44
+ export {
45
+ p as CheckboxField
46
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const ChipsField: FC<FormFieldProps>;
@@ -0,0 +1,146 @@
1
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Controller as w } from "react-hook-form";
4
+ import { Info as T } from "impact-nova-icons";
5
+ import { Chip as f } from "../../components/primitives/chips/chips.js";
6
+ import { Checkbox as z } from "../../components/forms/checkbox/checkbox.js";
7
+ import { cn as i } from "../../lib/utils.js";
8
+ import { getFieldTestId as V } from "../utils/fieldTestIds.js";
9
+ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertiary", G = ({
10
+ field: s,
11
+ validationRules: h,
12
+ isDisabled: n,
13
+ formHelpers: v
14
+ }) => {
15
+ if (s.fieldType !== "chips") return null;
16
+ const u = s, d = u.options ?? [], g = u.chipsType ?? "single", b = u.allowDeselect === !0, C = v.form.control, N = s.id;
17
+ return /* @__PURE__ */ t(
18
+ w,
19
+ {
20
+ name: N,
21
+ control: C,
22
+ disabled: n,
23
+ rules: h,
24
+ render: ({ field: a, fieldState: p }) => {
25
+ const c = a.value, k = typeof c == "string" ? c : "", m = Array.isArray(c) ? c : [], l = !!p.error, x = l ? p.error?.message : s.helpText;
26
+ return /* @__PURE__ */ o("div", { "data-testid": V(s.id), children: [
27
+ s.label ? /* @__PURE__ */ o(
28
+ "div",
29
+ {
30
+ className: i(
31
+ j,
32
+ l && "text-destructive"
33
+ ),
34
+ children: [
35
+ s.label,
36
+ s.isRequired ? /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" }) : null
37
+ ]
38
+ }
39
+ ) : null,
40
+ g === "single" ? /* @__PURE__ */ t(
41
+ "div",
42
+ {
43
+ role: "radiogroup",
44
+ "aria-label": s.label,
45
+ "aria-invalid": l,
46
+ className: "mb-2 flex w-full flex-wrap items-center gap-3",
47
+ children: d.map((e) => {
48
+ const r = k === e.value;
49
+ return /* @__PURE__ */ t(
50
+ f,
51
+ {
52
+ variant: "outline",
53
+ shape: "rounded",
54
+ size: "lg",
55
+ selectionMode: "single",
56
+ selected: r,
57
+ disabled: n,
58
+ className: i(
59
+ "cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
60
+ l && !r && "!border-destructive !text-destructive"
61
+ ),
62
+ onClick: () => {
63
+ if (!n) {
64
+ if (r && b) {
65
+ a.onChange("");
66
+ return;
67
+ }
68
+ r || a.onChange(e.value);
69
+ }
70
+ },
71
+ children: /* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
72
+ },
73
+ e.value
74
+ );
75
+ })
76
+ }
77
+ ) : /* @__PURE__ */ t("div", { className: "mb-2 flex w-full flex-wrap gap-3", children: d.map((e) => {
78
+ const r = m.includes(e.value);
79
+ return /* @__PURE__ */ o(
80
+ f,
81
+ {
82
+ variant: "outline",
83
+ shape: "rounded",
84
+ size: "lg",
85
+ selected: r,
86
+ className: i(
87
+ "cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
88
+ l && !r && "!border-destructive !text-destructive"
89
+ ),
90
+ onClick: () => {
91
+ n || (r ? a.onChange(
92
+ m.filter(
93
+ (y) => y !== e.value
94
+ )
95
+ ) : a.onChange([
96
+ ...m,
97
+ e.value
98
+ ]));
99
+ },
100
+ children: [
101
+ /* @__PURE__ */ t(z, { checked: r, disabled: n }),
102
+ /* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
103
+ ]
104
+ },
105
+ e.value
106
+ );
107
+ }) }),
108
+ x ? /* @__PURE__ */ o(
109
+ "div",
110
+ {
111
+ className: i(
112
+ "mt-1 flex items-center gap-1",
113
+ l && "text-destructive"
114
+ ),
115
+ children: [
116
+ /* @__PURE__ */ t(
117
+ T,
118
+ {
119
+ size: "xs",
120
+ className: i(
121
+ "shrink-0",
122
+ l ? "text-destructive" : "text-content-icon"
123
+ )
124
+ }
125
+ ),
126
+ /* @__PURE__ */ t(
127
+ "p",
128
+ {
129
+ className: i(
130
+ "text-[12px] font-medium leading-[18px] text-navigation-muted",
131
+ l && "text-destructive"
132
+ ),
133
+ children: x
134
+ }
135
+ )
136
+ ]
137
+ }
138
+ ) : null
139
+ ] });
140
+ }
141
+ }
142
+ );
143
+ };
144
+ export {
145
+ G as ChipsField
146
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
4
+ interface DateInputFieldProps extends FormFieldProps {
5
+ formHelpers: UseReactHookFormReturn;
6
+ }
7
+ export declare const DateInputField: FC<DateInputFieldProps>;
8
+ export {};
@@ -0,0 +1,134 @@
1
+ import { jsx as F, jsxs as N } from "react/jsx-runtime";
2
+ import { useMemo as I, useRef as q, useEffect as O } from "react";
3
+ import { useWatch as S, Controller as K } from "react-hook-form";
4
+ import { DatePicker as M } from "../../components/forms/date-picker/date-picker.js";
5
+ import { getEffectiveMinOffsetDaysFromToday as Y } from "../utils/formDate.utils.js";
6
+ import { startOfDayDate as v, addDaysDate as y, handleDateFnsFormat as L } from "../utils/date.utils.js";
7
+ import { parseYmdString as f, formatYmd as $ } from "../utils/calendar-boundary.js";
8
+ const B = "__dateInputPairedSentinel__", H = ({
9
+ field: a,
10
+ validationRules: E,
11
+ isDisabled: u,
12
+ formHelpers: h
13
+ }) => {
14
+ const m = a.fieldType === "date", e = m ? a : null, g = h.form.control, A = h.form.trigger, T = h.getValues, i = I(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), s = I(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), P = i.length > 0 ? i : [B], p = S({
15
+ control: g,
16
+ name: P,
17
+ disabled: !m || i.length === 0
18
+ }), _ = s.length > 0 ? s : [B], D = S({
19
+ control: g,
20
+ name: _,
21
+ disabled: !m || s.length === 0
22
+ }), W = i.length > 0 || s.length > 0, b = q(!0), C = i.length > 0 ? p.join("|") : "", R = s.length > 0 ? D.join("|") : "";
23
+ O(() => {
24
+ if (!e || !W) return;
25
+ if (b.current) {
26
+ b.current = !1;
27
+ return;
28
+ }
29
+ const r = T()[e.id];
30
+ r != null && String(r).trim() !== "" && A(e.id);
31
+ }, [
32
+ C,
33
+ R,
34
+ e,
35
+ T,
36
+ W,
37
+ A
38
+ ]);
39
+ const { minDate: V, maxDate: j } = I(() => {
40
+ if (!e)
41
+ return {
42
+ minDate: void 0,
43
+ maxDate: void 0
44
+ };
45
+ const r = [], l = Y(e);
46
+ if (l != null && l >= 0 && r.push(v(y(/* @__PURE__ */ new Date(), l))), e.minDate) {
47
+ const t = f(e.minDate);
48
+ t && r.push(t);
49
+ }
50
+ if (i.length > 0) {
51
+ const t = i.length > 0 ? p : [];
52
+ for (const n of t) {
53
+ if (!n) continue;
54
+ const c = f(String(n));
55
+ if (c) {
56
+ const x = e.dateAfterFieldIdInclusive ? 0 : 1;
57
+ r.push(v(y(c, x)));
58
+ }
59
+ }
60
+ }
61
+ let d;
62
+ r.length > 0 && (d = r.reduce(
63
+ (t, n) => t.getTime() >= n.getTime() ? t : n
64
+ ));
65
+ let o;
66
+ if (e.maxDate) {
67
+ const t = f(e.maxDate);
68
+ t && (o = t);
69
+ }
70
+ if (s.length > 0) {
71
+ const t = s.length > 0 ? D : [];
72
+ for (const n of t) {
73
+ if (!n) continue;
74
+ const c = f(String(n));
75
+ if (c) {
76
+ const x = e.dateBeforeFieldIdInclusive ? 0 : -1, w = v(y(c, x));
77
+ o = o == null || w.getTime() < o.getTime() ? w : o;
78
+ }
79
+ }
80
+ }
81
+ return { minDate: d, maxDate: o };
82
+ }, [e, i, s, p, D]);
83
+ if (!m || !e) return null;
84
+ const k = L(e.dateFormat);
85
+ return /* @__PURE__ */ F(
86
+ K,
87
+ {
88
+ name: a.id,
89
+ control: g,
90
+ disabled: u,
91
+ rules: E,
92
+ render: ({ field: r, fieldState: l }) => {
93
+ const d = !!l.error, o = r.value, t = o ? f(String(o)) : void 0;
94
+ return /* @__PURE__ */ N("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
95
+ /* @__PURE__ */ N(
96
+ "label",
97
+ {
98
+ htmlFor: a.id,
99
+ className: `text-[12px] font-medium leading-[18px] text-[#60697d]${u ? " opacity-70" : ""}`,
100
+ children: [
101
+ a.label,
102
+ " ",
103
+ a.isRequired ? /* @__PURE__ */ F("span", { className: "text-[red]", children: "*" }) : null
104
+ ]
105
+ }
106
+ ),
107
+ /* @__PURE__ */ F(
108
+ M,
109
+ {
110
+ id: a.id,
111
+ label: void 0,
112
+ format: k,
113
+ minDate: V,
114
+ maxDate: j,
115
+ value: t,
116
+ onChange: (n) => {
117
+ r.onChange(n ? $(n) : "");
118
+ },
119
+ placeholder: a.placeholder,
120
+ required: a.isRequired,
121
+ disabled: u,
122
+ error: d,
123
+ helperText: d ? l.error?.message : a.helpText,
124
+ showFooter: e.showFooter
125
+ }
126
+ )
127
+ ] });
128
+ }
129
+ }
130
+ );
131
+ };
132
+ export {
133
+ H as DateInputField
134
+ };