impact-nova 2.5.5 → 2.5.7

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 (93) hide show
  1. package/dist/components/data-display/calendar/calendar-apply-validation.js +45 -33
  2. package/dist/components/data-display/calendar/calendar-day-picker-components.js +62 -54
  3. package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +1 -1
  4. package/dist/components/data-display/calendar/calendar-day-picker-view.js +88 -85
  5. package/dist/components/data-display/calendar/calendar-week-utils.js +23 -22
  6. package/dist/components/data-display/calendar/use-calendar-state.d.ts +1 -1
  7. package/dist/components/data-display/calendar/use-calendar-state.js +47 -47
  8. package/dist/components/flows/guidance/guidance-error-boundary.js +22 -14
  9. package/dist/components/flows/guidance/guidance-layer.js +34 -32
  10. package/dist/components/flows/guidance/help-center/assets/whats-new-guide-icon.svg.js +4 -0
  11. package/dist/components/flows/guidance/help-center/filter-help-center-guides.js +10 -7
  12. package/dist/components/flows/guidance/help-center/guide-catalog-section.d.ts +7 -0
  13. package/dist/components/flows/guidance/help-center/guide-catalog-section.js +24 -0
  14. package/dist/components/flows/guidance/help-center/guide-catalog-utils.d.ts +3 -0
  15. package/dist/components/flows/guidance/help-center/guide-catalog-utils.js +19 -0
  16. package/dist/components/flows/guidance/help-center/guide-catalog.d.ts +1 -1
  17. package/dist/components/flows/guidance/help-center/guide-catalog.js +89 -79
  18. package/dist/components/flows/guidance/help-center/help-center-guide-labels.d.ts +6 -0
  19. package/dist/components/flows/guidance/help-center/help-center-guide-labels.js +33 -0
  20. package/dist/components/flows/guidance/help-center/help-center-guide-row.d.ts +12 -0
  21. package/dist/components/flows/guidance/help-center/help-center-guide-row.js +57 -0
  22. package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.d.ts +9 -0
  23. package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.js +114 -0
  24. package/dist/components/flows/guidance/help-center/help-center-header.d.ts +1 -1
  25. package/dist/components/flows/guidance/help-center/help-center-header.js +20 -16
  26. package/dist/components/flows/guidance/help-center/help-center.constants.d.ts +1 -1
  27. package/dist/components/flows/guidance/help-center/help-center.constants.js +1 -1
  28. package/dist/components/flows/guidance/help-center/help-center.d.ts +3 -1
  29. package/dist/components/flows/guidance/help-center/help-center.js +74 -51
  30. package/dist/components/flows/guidance/help-center/help-center.types.d.ts +9 -1
  31. package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.d.ts +4 -0
  32. package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.js +18 -0
  33. package/dist/components/flows/guidance/help-center.d.ts +4 -2
  34. package/dist/components/flows/guidance/help-center.js +23 -14
  35. package/dist/components/flows/guidance/hooks/useGuidanceOverlayGeometry.js +19 -17
  36. package/dist/components/flows/guidance/index.d.ts +1 -1
  37. package/dist/components/flows/guidance/renderers/announcement-renderer.d.ts +1 -1
  38. package/dist/components/flows/guidance/renderers/announcement-renderer.js +20 -12
  39. package/dist/components/flows/guidance/renderers/guidance-card-shared.d.ts +9 -11
  40. package/dist/components/flows/guidance/renderers/guidance-card-shared.js +124 -177
  41. package/dist/components/flows/guidance/renderers/guidance-renderer-shared.d.ts +1 -1
  42. package/dist/components/flows/guidance/renderers/guidance-renderer-shared.js +57 -72
  43. package/dist/components/flows/guidance/renderers/guidance-tour-overlay.js +23 -23
  44. package/dist/components/flows/wizard/wizard.js +41 -38
  45. package/dist/components/layout/horizontal-scroller/horizontal-scroller.js +35 -53
  46. package/dist/form-engine/field-dependency-graph.d.ts +1 -4
  47. package/dist/form-engine/field-dependency-graph.js +53 -57
  48. package/dist/form-engine/field-groups.d.ts +15 -0
  49. package/dist/form-engine/field-groups.js +60 -0
  50. package/dist/form-engine/index.d.ts +3 -2
  51. package/dist/form-engine/index.js +17 -14
  52. package/dist/form-engine/types.d.ts +17 -0
  53. package/dist/form-react/Fields/RichTextField.d.ts +3 -0
  54. package/dist/form-react/Fields/RichTextField.js +214 -0
  55. package/dist/form-react/Fields/SelectField.js +27 -28
  56. package/dist/form-react/Fields/SliderRangeField.d.ts +3 -0
  57. package/dist/form-react/Fields/SliderRangeField.js +69 -0
  58. package/dist/form-react/ReactHooksForm.js +149 -87
  59. package/dist/form-react/fields.d.ts +2 -0
  60. package/dist/form-react/fields.js +22 -18
  61. package/dist/form-react/hooks/useCascadingForm.d.ts +1 -2
  62. package/dist/form-react/hooks/useCascadingForm.js +59 -67
  63. package/dist/form-react/hooks/useFieldVisibility.d.ts +1 -2
  64. package/dist/form-react/hooks/useFieldVisibility.js +36 -43
  65. package/dist/form-react/hooks/useFormSteps.d.ts +29 -0
  66. package/dist/form-react/hooks/useFormSteps.js +96 -0
  67. package/dist/form-react/hooks/useReactHookForm.js +17 -18
  68. package/dist/form-react/hooks/useSelectOptions.d.ts +1 -1
  69. package/dist/form-react/hooks/useSelectOptions.js +80 -83
  70. package/dist/form-react/index.d.ts +5 -3
  71. package/dist/form-react/index.js +93 -88
  72. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +1 -1
  73. package/dist/form-react/registry/defaultFieldRegistrations.js +36 -26
  74. package/dist/form-react/types/fields.types.d.ts +34 -15
  75. package/dist/form-react/types/fieldsOutput.types.d.ts +5 -1
  76. package/dist/form-react/types/reactHookForm.types.d.ts +31 -2
  77. package/dist/form-react/utils/date.utils.d.ts +3 -1
  78. package/dist/form-react/utils/date.utils.js +84 -55
  79. package/dist/form-react/utils/fieldDefaults.utils.js +28 -13
  80. package/dist/i18n/defaultMessages.d.ts +10 -0
  81. package/dist/i18n/defaultMessages.js +17 -7
  82. package/dist/i18n/locales/de.js +13 -3
  83. package/dist/i18n/locales/es.js +13 -3
  84. package/dist/i18n/locales/hi.js +13 -3
  85. package/dist/i18n/locales/kn.js +13 -3
  86. package/dist/impact-nova.css +1 -1
  87. package/dist/lib/guidance/engine/guidance-engine.d.ts +7 -5
  88. package/dist/lib/guidance/engine/guidance-engine.js +115 -47
  89. package/dist/lib/guidance/triggers/trigger-registry.js +6 -6
  90. package/dist/lib/guidance/types/guidance.types.d.ts +11 -1
  91. package/dist/llms/rules/installation.js +1 -1
  92. package/dist/llms/rules/requirements.js +1 -1
  93. package/package.json +17 -2
@@ -0,0 +1,15 @@
1
+ import { FieldGroup, FieldVisibilityBase, FormStepConfig, FormValuesSnapshot } from './types';
2
+ /**
3
+ * Group fields by `fieldGroup`, preserving declaration order.
4
+ * Fields without `fieldGroup` are collected into a `'_default'` group.
5
+ * When `stepConfigs` is provided, groups are ordered to match and enriched with title/description.
6
+ */
7
+ export declare function buildFieldGroups(fields: FieldVisibilityBase[], stepConfigs?: FormStepConfig[]): FieldGroup[];
8
+ /**
9
+ * Check if all visible required fields in a step have non-empty values and no errors.
10
+ */
11
+ export declare function isStepComplete(stepFieldIds: string[], fields: FieldVisibilityBase[], formValues: FormValuesSnapshot, fieldErrors: Record<string, unknown>): boolean;
12
+ /**
13
+ * Return the index of the first incomplete step, or -1 if all steps are complete.
14
+ */
15
+ export declare function getFirstIncompleteStep(groups: FieldGroup[], fields: FieldVisibilityBase[], formValues: FormValuesSnapshot, fieldErrors: Record<string, unknown>): number;
@@ -0,0 +1,60 @@
1
+ import { isEmptyValue as s } from "./is-empty-value.js";
2
+ import { computeIsFieldVisible as u } from "./field-dependency-graph.js";
3
+ const l = "_default";
4
+ function g(d, r) {
5
+ const i = /* @__PURE__ */ new Map(), n = [];
6
+ for (const t of d) {
7
+ const o = t.fieldGroup || l;
8
+ i.has(o) || (i.set(o, []), n.push(o)), i.get(o).push(t.id);
9
+ }
10
+ if (r && r.length > 0) {
11
+ const t = new Map(r.map((e) => [e.groupId, e])), o = [];
12
+ for (const e of r) {
13
+ const f = i.get(e.groupId);
14
+ f && (o.push({
15
+ groupId: e.groupId,
16
+ title: e.title,
17
+ description: e.description,
18
+ fieldIds: f,
19
+ validateBeforeNext: e.validateBeforeNext ?? !0
20
+ }), i.delete(e.groupId));
21
+ }
22
+ for (const e of n) {
23
+ if (!i.has(e)) continue;
24
+ const f = t.get(e);
25
+ o.push({
26
+ groupId: e,
27
+ title: f?.title,
28
+ description: f?.description,
29
+ fieldIds: i.get(e),
30
+ validateBeforeNext: f?.validateBeforeNext ?? !0
31
+ });
32
+ }
33
+ return o;
34
+ }
35
+ return n.map((t) => ({
36
+ groupId: t,
37
+ title: void 0,
38
+ description: void 0,
39
+ fieldIds: i.get(t),
40
+ validateBeforeNext: !0
41
+ }));
42
+ }
43
+ function p(d, r, i, n) {
44
+ const t = new Set(d), o = r.filter((e) => t.has(e.id));
45
+ for (const e of o)
46
+ if (u(e, i) && (n[e.id] || e.isRequired && s(i[e.id])))
47
+ return !1;
48
+ return !0;
49
+ }
50
+ function I(d, r, i, n) {
51
+ for (let t = 0; t < d.length; t++)
52
+ if (!p(d[t].fieldIds, r, i, n))
53
+ return t;
54
+ return -1;
55
+ }
56
+ export {
57
+ g as buildFieldGroups,
58
+ I as getFirstIncompleteStep,
59
+ p as isStepComplete
60
+ };
@@ -5,5 +5,6 @@
5
5
  * @packageDocumentation
6
6
  */
7
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';
8
+ export type { FieldDependency, FieldGroup, FieldVisibilityBase, FormStepConfig, FormValuesSnapshot, } from './types';
9
+ export { buildCascadeParentFormState, collectFieldDependencyIds, collectFormWatchFieldIds, collectFilterSidebarWatchFieldIds, collectSectionWatchFieldIds, collectVisibleFieldIds, computeIsFieldDisabled, computeIsFieldVisible, getDependentFieldIds, hasVisibleFieldErrors, } from './field-dependency-graph';
10
+ export { buildFieldGroups, isStepComplete, getFirstIncompleteStep, } from './field-groups';
@@ -1,16 +1,19 @@
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";
1
+ import { isEmptyValue as t } from "./is-empty-value.js";
2
+ import { buildCascadeParentFormState as d, collectFieldDependencyIds as o, collectFilterSidebarWatchFieldIds as c, collectFormWatchFieldIds as s, collectSectionWatchFieldIds as r, collectVisibleFieldIds as F, computeIsFieldDisabled as p, computeIsFieldVisible as a, getDependentFieldIds as m, hasVisibleFieldErrors as I } from "./field-dependency-graph.js";
3
+ import { buildFieldGroups as n, getFirstIncompleteStep as u, isStepComplete as S } from "./field-groups.js";
3
4
  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
5
+ d as buildCascadeParentFormState,
6
+ n as buildFieldGroups,
7
+ o as collectFieldDependencyIds,
8
+ c as collectFilterSidebarWatchFieldIds,
9
+ s as collectFormWatchFieldIds,
10
+ r as collectSectionWatchFieldIds,
11
+ F as collectVisibleFieldIds,
12
+ p as computeIsFieldDisabled,
13
+ a as computeIsFieldVisible,
14
+ m as getDependentFieldIds,
15
+ u as getFirstIncompleteStep,
16
+ I as hasVisibleFieldErrors,
17
+ t as isEmptyValue,
18
+ S as isStepComplete
16
19
  };
@@ -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
+ };