impact-nova 2.5.4 → 2.5.6

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 (39) hide show
  1. package/dist/components/data/ag-grid-react/index.js +64 -64
  2. package/dist/components/data/data-table/data-table-column-state.d.ts +7 -0
  3. package/dist/components/data/data-table/data-table-column-state.js +48 -23
  4. package/dist/form-engine/field-dependency-graph.d.ts +1 -4
  5. package/dist/form-engine/field-dependency-graph.js +53 -57
  6. package/dist/form-engine/field-groups.d.ts +15 -0
  7. package/dist/form-engine/field-groups.js +60 -0
  8. package/dist/form-engine/index.d.ts +3 -2
  9. package/dist/form-engine/index.js +17 -14
  10. package/dist/form-engine/types.d.ts +17 -0
  11. package/dist/form-react/Fields/RichTextField.d.ts +3 -0
  12. package/dist/form-react/Fields/RichTextField.js +214 -0
  13. package/dist/form-react/Fields/SelectField.js +27 -28
  14. package/dist/form-react/Fields/SliderRangeField.d.ts +3 -0
  15. package/dist/form-react/Fields/SliderRangeField.js +69 -0
  16. package/dist/form-react/ReactHooksForm.js +149 -87
  17. package/dist/form-react/fields.d.ts +2 -0
  18. package/dist/form-react/fields.js +22 -18
  19. package/dist/form-react/hooks/useCascadingForm.d.ts +1 -2
  20. package/dist/form-react/hooks/useCascadingForm.js +59 -67
  21. package/dist/form-react/hooks/useFieldVisibility.d.ts +1 -2
  22. package/dist/form-react/hooks/useFieldVisibility.js +36 -43
  23. package/dist/form-react/hooks/useFormSteps.d.ts +29 -0
  24. package/dist/form-react/hooks/useFormSteps.js +96 -0
  25. package/dist/form-react/hooks/useReactHookForm.js +17 -18
  26. package/dist/form-react/hooks/useSelectOptions.d.ts +1 -1
  27. package/dist/form-react/hooks/useSelectOptions.js +80 -83
  28. package/dist/form-react/index.d.ts +5 -3
  29. package/dist/form-react/index.js +93 -88
  30. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +1 -1
  31. package/dist/form-react/registry/defaultFieldRegistrations.js +11 -9
  32. package/dist/form-react/types/fields.types.d.ts +31 -12
  33. package/dist/form-react/types/fieldsOutput.types.d.ts +5 -1
  34. package/dist/form-react/types/reactHookForm.types.d.ts +31 -2
  35. package/dist/form-react/utils/fieldDefaults.utils.js +28 -13
  36. package/dist/impact-nova.css +1 -1
  37. package/dist/llms/rules/installation.js +1 -1
  38. package/dist/llms/rules/requirements.js +1 -1
  39. package/package.json +17 -2
@@ -14,4 +14,21 @@ export type FieldVisibilityBase = {
14
14
  cascadingDependency?: FieldDependency[];
15
15
  isDisabled?: boolean;
16
16
  doNotIncludeInSubmit?: boolean;
17
+ fieldGroup?: string;
18
+ };
19
+ /** Step/group metadata provided via `IFormConfig.steps`. */
20
+ export type FormStepConfig = {
21
+ groupId: string;
22
+ title?: string;
23
+ description?: string;
24
+ /** When true, all required fields in this step must be valid before proceeding. Default: true. */
25
+ validateBeforeNext?: boolean;
26
+ };
27
+ /** Resolved field group produced by `buildFieldGroups`. */
28
+ export type FieldGroup = {
29
+ groupId: string;
30
+ title?: string;
31
+ description?: string;
32
+ fieldIds: string[];
33
+ validateBeforeNext: boolean;
17
34
  };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const RichTextField: FC<FormFieldProps>;
@@ -0,0 +1,214 @@
1
+ import { jsx as n, jsxs as u } from "react/jsx-runtime";
2
+ import { useMemo as b, useCallback as T, useRef as v, useEffect as D } from "react";
3
+ import { Controller as L } from "react-hook-form";
4
+ import { LexicalComposer as O } from "@lexical/react/LexicalComposer";
5
+ import { RichTextPlugin as M } from "@lexical/react/LexicalRichTextPlugin";
6
+ import { ContentEditable as k } from "@lexical/react/LexicalContentEditable";
7
+ import { HistoryPlugin as _ } from "@lexical/react/LexicalHistoryPlugin";
8
+ import { OnChangePlugin as S } from "@lexical/react/LexicalOnChangePlugin";
9
+ import { ListPlugin as y } from "@lexical/react/LexicalListPlugin";
10
+ import { LinkPlugin as $ } from "@lexical/react/LexicalLinkPlugin";
11
+ import { LexicalErrorBoundary as H } from "@lexical/react/LexicalErrorBoundary";
12
+ import { useLexicalComposerContext as N } from "@lexical/react/LexicalComposerContext";
13
+ import { $generateHtmlFromNodes as I, $generateNodesFromDOM as w } from "@lexical/html";
14
+ import { ListNode as A, ListItemNode as B, INSERT_UNORDERED_LIST_COMMAND as P, INSERT_ORDERED_LIST_COMMAND as q } from "@lexical/list";
15
+ import { LinkNode as U, $toggleLink as F } from "@lexical/link";
16
+ import { HeadingNode as j, QuoteNode as Q, $createHeadingNode as z, $createQuoteNode as X } from "@lexical/rich-text";
17
+ import { $getRoot as G, UNDO_COMMAND as J, REDO_COMMAND as K, FORMAT_TEXT_COMMAND as m, $getSelection as g, $isRangeSelection as f } from "lexical";
18
+ import { $setBlocksType as x } from "@lexical/selection";
19
+ const V = {
20
+ paragraph: "rt-paragraph",
21
+ heading: { h2: "rt-h2", h3: "rt-h3" },
22
+ text: {
23
+ bold: "rt-bold",
24
+ italic: "rt-italic",
25
+ underline: "rt-underline"
26
+ },
27
+ list: {
28
+ ul: "rt-ul",
29
+ ol: "rt-ol",
30
+ listitem: "rt-li"
31
+ },
32
+ link: "rt-link",
33
+ quote: "rt-quote"
34
+ }, W = [
35
+ "undo",
36
+ "redo",
37
+ "bold",
38
+ "italic",
39
+ "underline",
40
+ "strikethrough",
41
+ "heading",
42
+ "quote",
43
+ "link",
44
+ "bulletedList",
45
+ "numberedList"
46
+ ], Y = [j, Q, A, B, U];
47
+ function Z({ items: o }) {
48
+ const [e] = N(), i = b(() => new Set(o), [o]), r = (t, l, s, a) => i.has(l) ? /* @__PURE__ */ n(
49
+ "button",
50
+ {
51
+ type: "button",
52
+ className: "inline-flex h-7 w-7 items-center justify-center rounded text-xs hover:bg-muted",
53
+ title: a ?? t,
54
+ onMouseDown: (d) => {
55
+ d.preventDefault(), s();
56
+ },
57
+ children: t
58
+ },
59
+ l
60
+ ) : null;
61
+ return /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-0.5 border-b px-1 py-0.5", children: [
62
+ r("↩", "undo", () => e.dispatchCommand(J, void 0), "Undo"),
63
+ r("↪", "redo", () => e.dispatchCommand(K, void 0), "Redo"),
64
+ (i.has("undo") || i.has("redo")) && i.size > 2 && /* @__PURE__ */ n("span", { className: "mx-0.5 h-4 w-px bg-border" }),
65
+ r("B", "bold", () => e.dispatchCommand(m, "bold"), "Bold"),
66
+ r("I", "italic", () => e.dispatchCommand(m, "italic"), "Italic"),
67
+ r("U", "underline", () => e.dispatchCommand(m, "underline"), "Underline"),
68
+ r("S", "strikethrough", () => e.dispatchCommand(m, "strikethrough"), "Strikethrough"),
69
+ r("H", "heading", () => {
70
+ e.update(() => {
71
+ const t = g();
72
+ f(t) && x(t, () => z("h2"));
73
+ });
74
+ }, "Heading"),
75
+ r("❝", "quote", () => {
76
+ e.update(() => {
77
+ const t = g();
78
+ f(t) && x(t, () => X());
79
+ });
80
+ }, "Block quote"),
81
+ r("🔗", "link", () => {
82
+ const t = prompt("URL:");
83
+ t && e.update(() => {
84
+ F(t);
85
+ });
86
+ }, "Insert link"),
87
+ r("•", "bulletedList", () => e.dispatchCommand(P, void 0), "Bulleted list"),
88
+ r("1.", "numberedList", () => e.dispatchCommand(q, void 0), "Numbered list")
89
+ ] });
90
+ }
91
+ function ee({ html: o }) {
92
+ const [e] = N(), i = v(!1);
93
+ return D(() => {
94
+ i.current || !o || (i.current = !0, e.update(() => {
95
+ const t = new DOMParser().parseFromString(o, "text/html"), l = w(e, t), s = G();
96
+ s.clear(), s.append(...l);
97
+ }));
98
+ }, [e, o]), null;
99
+ }
100
+ const Ce = ({
101
+ field: o,
102
+ validationRules: e,
103
+ isDisabled: i,
104
+ formHelpers: r
105
+ }) => {
106
+ const t = o.fieldType === "rich_text" ? o : null;
107
+ if (!t) return null;
108
+ const l = t.toolbar ?? W, s = t.minHeight ?? 150;
109
+ return /* @__PURE__ */ n(
110
+ L,
111
+ {
112
+ name: o.id,
113
+ control: r.form.control,
114
+ rules: e,
115
+ render: ({ field: a, fieldState: d }) => {
116
+ const c = !!d.error;
117
+ return /* @__PURE__ */ n(
118
+ te,
119
+ {
120
+ initialHtml: a.value ?? "",
121
+ onChange: a.onChange,
122
+ disabled: i,
123
+ toolbar: l,
124
+ minHeight: s,
125
+ label: o.label,
126
+ isRequired: o.isRequired,
127
+ helpText: o.helpText,
128
+ error: c ? d.error?.message : void 0,
129
+ fieldId: o.id
130
+ }
131
+ );
132
+ }
133
+ }
134
+ );
135
+ };
136
+ function te({
137
+ initialHtml: o,
138
+ onChange: e,
139
+ disabled: i,
140
+ toolbar: r,
141
+ minHeight: t,
142
+ label: l,
143
+ isRequired: s,
144
+ helpText: a,
145
+ error: d,
146
+ fieldId: c
147
+ }) {
148
+ const C = b(
149
+ () => ({
150
+ namespace: `rich-text-${c}`,
151
+ nodes: Y,
152
+ theme: V,
153
+ editable: !i,
154
+ onError: (p) => console.error("[RichTextField]", p)
155
+ }),
156
+ // ponytail: intentionally only fieldId — LexicalComposer reads initialConfig once
157
+ // eslint-disable-next-line react-hooks/exhaustive-deps
158
+ [c]
159
+ ), E = T(
160
+ (p, h) => {
161
+ h.read(() => {
162
+ const R = I(h);
163
+ e(R);
164
+ });
165
+ },
166
+ [e]
167
+ );
168
+ return /* @__PURE__ */ u("div", { children: [
169
+ l && /* @__PURE__ */ u("label", { className: "mb-2 block text-xs font-medium text-content-muted", children: [
170
+ l,
171
+ s && /* @__PURE__ */ n("span", { className: "ml-1 text-destructive", children: "*" })
172
+ ] }),
173
+ /* @__PURE__ */ n(
174
+ "div",
175
+ {
176
+ className: "overflow-hidden rounded-md border",
177
+ style: i ? { opacity: 0.5, pointerEvents: "none" } : void 0,
178
+ children: /* @__PURE__ */ u(O, { initialConfig: C, children: [
179
+ /* @__PURE__ */ n(Z, { items: r }),
180
+ /* @__PURE__ */ n(
181
+ M,
182
+ {
183
+ contentEditable: /* @__PURE__ */ n(
184
+ k,
185
+ {
186
+ className: "outline-none px-3 py-2",
187
+ style: { minHeight: t },
188
+ "aria-placeholder": l ?? c,
189
+ placeholder: /* @__PURE__ */ n("div", { className: "pointer-events-none absolute left-3 top-2 text-xs text-content-muted", children: "Start typing…" })
190
+ }
191
+ ),
192
+ ErrorBoundary: H
193
+ }
194
+ ),
195
+ /* @__PURE__ */ n(_, {}),
196
+ /* @__PURE__ */ n(y, {}),
197
+ /* @__PURE__ */ n($, {}),
198
+ /* @__PURE__ */ n(S, { onChange: E }),
199
+ o && /* @__PURE__ */ n(ee, { html: o })
200
+ ] })
201
+ }
202
+ ),
203
+ (d || a) && /* @__PURE__ */ n(
204
+ "p",
205
+ {
206
+ className: `mt-1 text-xs ${d ? "text-destructive" : "text-content-muted"}`,
207
+ children: d ?? a
208
+ }
209
+ )
210
+ ] });
211
+ }
212
+ export {
213
+ Ce as RichTextField
214
+ };
@@ -1,38 +1,37 @@
1
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 = ({
2
+ import { useState as A } from "react";
3
+ import { Controller as M } from "react-hook-form";
4
+ import { Select as f } from "../../components/forms/select/select.js";
5
+ import { useSelectOptions as x } from "../hooks/useSelectOptions.js";
6
+ import { getFieldTestId as E } from "../utils/fieldTestIds.js";
7
+ import { isEmptyValue as R } from "../../form-engine/is-empty-value.js";
8
+ const $ = ({
9
9
  field: e,
10
10
  validationRules: p,
11
11
  isDisabled: m,
12
- formHelpers: l,
13
- formConfig: u,
14
- supportedValues: d
12
+ formHelpers: s,
13
+ supportedValues: u
15
14
  }) => {
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({
15
+ const t = e.fieldType === "select" ? e : null, [d, n] = A(!1), S = s.form.control, h = u?.[e.id], { options: g, isLoading: b, error: y, refetch: O } = x({
17
16
  apiConfig: t?.apiConfig,
18
- formHelpers: l,
19
- formConfig: u,
17
+ formHelpers: s,
20
18
  initialOptions: t?.options,
21
19
  id: e.id,
22
- isEnabled: S,
20
+ isEnabled: d,
23
21
  getSelectOptionsName: t?.getSelectOptionsName,
24
- fieldSupportedValues: b
22
+ fieldSupportedValues: h,
23
+ cascadingDependency: e.cascadingDependency
25
24
  });
26
25
  return t ? /* @__PURE__ */ c(
27
- f,
26
+ M,
28
27
  {
29
28
  name: e.id,
30
- control: h,
29
+ control: S,
31
30
  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"}`;
31
+ render: ({ field: o, fieldState: l }) => {
32
+ const a = !!l.error, i = o.value, C = t?.isMultiSelect ? e.id : `${e.id}-${R(i) ? "empty" : "has-value"}`;
34
33
  return /* @__PURE__ */ c(
35
- x,
34
+ f,
36
35
  {
37
36
  id: e.id,
38
37
  label: e.label,
@@ -56,21 +55,21 @@ const F = ({
56
55
  isSelectAllEnabled: !t?.disableSelectAll,
57
56
  labelOrientation: t?.labelOrientation || "top",
58
57
  error: a,
59
- helperText: a ? n.error?.message : e.helpText,
58
+ helperText: a ? l.error?.message : e.helpText,
60
59
  ignoreAccents: !0,
61
- isLoading: O,
60
+ isLoading: b,
62
61
  fetchError: y,
63
- onRefetch: C,
64
- onMenuOpen: () => s(!0),
65
- onMenuClose: () => s(!1),
66
- "data-testid": R(e.id)
62
+ onRefetch: O,
63
+ onMenuOpen: () => n(!0),
64
+ onMenuClose: () => n(!1),
65
+ "data-testid": E(e.id)
67
66
  },
68
- A
67
+ C
69
68
  );
70
69
  }
71
70
  }
72
71
  ) : null;
73
72
  };
74
73
  export {
75
- F as SelectField
74
+ $ as SelectField
76
75
  };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormFieldProps } from '../types/reactHookForm.types';
3
+ export declare const SliderRangeField: FC<FormFieldProps>;
@@ -0,0 +1,69 @@
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { Controller as g } from "react-hook-form";
3
+ import { Slider as v } from "../../components/forms/slider/slider.js";
4
+ const y = {
5
+ opacity: 0.4,
6
+ pointerEvents: "none"
7
+ }, N = "bg-muted", A = ({
8
+ field: e,
9
+ validationRules: x,
10
+ isDisabled: o,
11
+ formHelpers: h
12
+ }) => {
13
+ const r = e.fieldType === "slider_range" ? e : null;
14
+ if (!r) return null;
15
+ const s = r.min ?? 0, c = r.max ?? 100, p = r.step ?? 1, m = r.showValue ?? !0;
16
+ return /* @__PURE__ */ t(
17
+ g,
18
+ {
19
+ name: e.id,
20
+ control: h.form.control,
21
+ rules: x,
22
+ render: ({ field: i, fieldState: u }) => {
23
+ const d = i.value, n = Array.isArray(d) ? d : [s], a = !!u.error;
24
+ return /* @__PURE__ */ l("div", { style: o ? y : void 0, children: [
25
+ e.label ? /* @__PURE__ */ l("label", { className: "mb-2 block text-xs font-medium text-content-muted", children: [
26
+ e.label,
27
+ e.isRequired && /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" })
28
+ ] }) : null,
29
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
30
+ /* @__PURE__ */ t("span", { className: "min-w-[2rem] text-right text-xs tabular-nums text-content-muted", children: m ? n[0] : s }),
31
+ /* @__PURE__ */ t(
32
+ w,
33
+ {
34
+ "aria-label": e.label ?? e.id,
35
+ value: n,
36
+ min: s,
37
+ max: c,
38
+ step: p,
39
+ disabled: o,
40
+ onValueChange: (b) => {
41
+ i.onChange(b);
42
+ }
43
+ }
44
+ ),
45
+ /* @__PURE__ */ t("span", { className: "min-w-[2rem] text-xs tabular-nums text-content-muted", children: m && n.length > 1 ? n[n.length - 1] : c })
46
+ ] }),
47
+ (a || e.helpText) && /* @__PURE__ */ t(
48
+ "p",
49
+ {
50
+ className: `mt-1 text-xs ${a ? "text-destructive" : "text-content-muted"}`,
51
+ children: a ? u.error?.message : e.helpText
52
+ }
53
+ )
54
+ ] });
55
+ }
56
+ }
57
+ );
58
+ }, w = (e) => /* @__PURE__ */ l("div", { className: "relative w-full isolate", children: [
59
+ /* @__PURE__ */ t(
60
+ "div",
61
+ {
62
+ className: `absolute left-0 right-0 top-1/2 h-1.5 -translate-y-1/2 rounded-full ${N}`
63
+ }
64
+ ),
65
+ /* @__PURE__ */ t(v, { ...e })
66
+ ] });
67
+ export {
68
+ A as SliderRangeField
69
+ };