dynamic-mui 2.0.26 → 2.2.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.
- package/README.md +218 -37
- package/dist/AxisSharedComponents-BbsKw1BT.js +3 -0
- package/dist/AxisSharedComponents-xLtpOLH_.mjs +605 -0
- package/dist/ChartsAxis-CANvBdY9.mjs +47 -0
- package/dist/ChartsAxis-EZ7m_KrU.js +1 -0
- package/dist/ChartsGrid-BCRTvNTr.js +3 -0
- package/dist/ChartsGrid-C_HT7qpL.mjs +381 -0
- package/dist/ChartsWrapper-CM7EDyAK.js +5 -0
- package/dist/ChartsWrapper-CO5_Z6BD.mjs +1878 -0
- package/dist/ChartsXAxis-CPmuCRhq.mjs +487 -0
- package/dist/ChartsXAxis-DFFY1sPg.js +3 -0
- package/dist/ChartsYAxis-DLUMr9vG.mjs +392 -0
- package/dist/ChartsYAxis-fpevi1sP.js +1 -0
- package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +237 -0
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +1 -0
- package/dist/ai/client.d.ts +2 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/mapping.d.ts +14 -0
- package/dist/ai/react/AIFill.d.ts +25 -0
- package/dist/ai/react/AIForm.d.ts +29 -0
- package/dist/ai/react/AIFormGenerator.d.ts +20 -0
- package/dist/ai/react/AISchemaReview.d.ts +18 -0
- package/dist/ai/react/AITextAssist.d.ts +35 -0
- package/dist/ai/react/AIVisionImport.d.ts +21 -0
- package/dist/ai/react/index.d.ts +6 -0
- package/dist/ai/types.d.ts +107 -0
- package/dist/clampAngle-BvZjnf53.mjs +11 -0
- package/dist/clampAngle-DpAsDoeT.js +1 -0
- package/dist/components/FormGenerator.d.ts +46 -1
- package/dist/components/controls/AddressField/addressfield.d.ts +2 -0
- package/dist/components/controls/Alert/alert.d.ts +3 -0
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +9 -0
- package/dist/components/controls/Button/button.d.ts +3 -0
- package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +3 -0
- package/dist/components/controls/ColorPicker/colorpicker.d.ts +3 -0
- package/dist/components/controls/Computed/computed.d.ts +7 -0
- package/dist/components/controls/ConsentField/consentfield.d.ts +3 -0
- package/dist/components/controls/CurrencyField/currencyfield.d.ts +2 -0
- package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +3 -0
- package/dist/components/controls/EditableTable/editabletable.d.ts +2 -0
- package/dist/components/controls/FileUpload/fileupload.d.ts +3 -0
- package/dist/components/controls/FormWizard/formwizard.d.ts +2 -0
- package/dist/components/controls/GeoField/geofield.d.ts +6 -0
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -0
- package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -0
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +3 -0
- package/dist/components/controls/MatrixField/matrixfield.d.ts +3 -0
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +3 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +1 -1
- package/dist/components/controls/NumberStepper/numberstepper.d.ts +2 -0
- package/dist/components/controls/OtpField/otpfield.d.ts +2 -0
- package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -0
- package/dist/components/controls/PhoneField/phonefield.d.ts +2 -0
- package/dist/components/controls/Radio/radio.d.ts +1 -1
- package/dist/components/controls/Rating/rating.d.ts +3 -0
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +3 -0
- package/dist/components/controls/Select/select.d.ts +1 -1
- package/dist/components/controls/Slider/slider.d.ts +3 -0
- package/dist/components/controls/SummaryField/summaryfield.d.ts +7 -0
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/TagsInput/tagsinput.d.ts +3 -0
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +3 -0
- package/dist/components/controls/index.d.ts +60 -0
- package/dist/createSelector-B-9FwV16.mjs +430 -0
- package/dist/createSelector-f0oqn8Lr.js +7 -0
- package/dist/date-utils-CFUUt6NL.js +4 -0
- package/dist/date-utils-pGzaKb0p.mjs +477 -0
- package/dist/dynamic-mui.cjs.js +1 -1
- package/dist/dynamic-mui.es.js +19 -6
- package/dist/index--8Zky9Oh.js +299 -0
- package/dist/index-6WTs1Xy_.js +1 -0
- package/dist/index-B1R1akM2.js +1 -0
- package/dist/index-BW8_rRff.js +7 -0
- package/dist/index-BXFVK_GX.js +1 -0
- package/dist/index-B_KNUTjy.js +1 -0
- package/dist/index-BhaKvHkU.mjs +62051 -0
- package/dist/index-Bif92ima.js +1 -0
- package/dist/index-BnZOu8CL.js +1 -0
- package/dist/index-CDxpgRlR.mjs +7 -0
- package/dist/index-CThMfvtJ.mjs +2555 -0
- package/dist/index-CVqLvm8B.js +1 -0
- package/dist/index-CodJBIn6.mjs +1665 -0
- package/dist/index-Cr6Wp_S-.mjs +3141 -0
- package/dist/index-CslPwsrf.mjs +4 -0
- package/dist/index-CuV0MQzZ.mjs +1173 -0
- package/dist/{index-BGfWFaIb.mjs → index-DA0XouZs.mjs} +16 -16
- package/dist/index-DKS5Sz9e.js +14 -0
- package/dist/index-DSkYYZuW.mjs +4 -0
- package/dist/index-DU78_FiA.js +1 -0
- package/dist/index-D_mYhgJ0.js +10 -0
- package/dist/index-DcWfyXJp.mjs +92 -0
- package/dist/index-Dlimbnxj.mjs +2965 -0
- package/dist/index-MllWgTJ5.mjs +9372 -0
- package/dist/index-in5z9hUb.js +133 -0
- package/dist/index-qUW7FnZ-.mjs +20540 -0
- package/dist/index.browser-BSu11T_q.mjs +363 -0
- package/dist/index.browser-By7-GABP.js +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/isDeepEqual-BHfPvf9U.mjs +393 -0
- package/dist/isDeepEqual-CqxZGVRk.js +1 -0
- package/dist/loadCognitoIdentity-DtYTy-DW.js +1 -0
- package/dist/loadCognitoIdentity-DzdR91GB.mjs +872 -0
- package/dist/loadSts-Cic6UToN.mjs +593 -0
- package/dist/loadSts-csbFP6zX.js +1 -0
- package/dist/noAuth-B8ui2kBg.mjs +71 -0
- package/dist/noAuth-JPA2o4dt.js +1 -0
- package/dist/playground/AIContext.d.ts +18 -0
- package/dist/playground/AIPanel.d.ts +10 -0
- package/dist/playground/DemoGallery.d.ts +6 -0
- package/dist/playground/Sidebar.d.ts +9 -1
- package/dist/playground/demoForms.d.ts +3 -0
- package/dist/playground/demoRecipes.d.ts +15 -0
- package/dist/playground/demoVariants.d.ts +11 -0
- package/dist/schema.d.ts +404 -0
- package/dist/theme/theme.d.ts +5 -0
- package/dist/types.d.ts +97 -10
- package/dist/useAxis-DSbfEtO7.js +3 -0
- package/dist/useAxis-SiNBMMWq.mjs +3010 -0
- package/dist/useChartContainerProps-Bl3hO-r1.mjs +5418 -0
- package/dist/useChartContainerProps-C_C_PZoi.js +12 -0
- package/dist/useItemHighlightedGetter-9CIwqsGj.js +1 -0
- package/dist/useItemHighlightedGetter-CTISrNdV.mjs +88 -0
- package/dist/util/helper.d.ts +2 -30
- package/dist/util/premiumStyles.d.ts +27 -0
- package/dist/util/rules.d.ts +35 -0
- package/package.json +2 -2
- package/dist/index-BHROoqH4.js +0 -1
- package/dist/index-S6BQaF_5.js +0 -465
- package/dist/index-Wtsz8Yiv.mjs +0 -102315
- package/dist/loadCognitoIdentity-CiUaDv6q.mjs +0 -935
- package/dist/loadCognitoIdentity-DN_MCNUl.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AIClient, ExtractionField } from '../types';
|
|
3
|
+
import { FormField } from '../../types';
|
|
4
|
+
/** A field descriptor understood by `AIClient.extractToFields`. */
|
|
5
|
+
export type AIFillField = ExtractionField;
|
|
6
|
+
export interface AIFillProps {
|
|
7
|
+
/** Injected, provider-agnostic AI client. This component never calls the network directly. */
|
|
8
|
+
client: AIClient;
|
|
9
|
+
/** Full form schema; field descriptors are derived from it when `fields` is omitted. */
|
|
10
|
+
schema?: FormField[];
|
|
11
|
+
/** Explicit field descriptors. Takes precedence over `schema`. */
|
|
12
|
+
fields?: AIFillField[];
|
|
13
|
+
/** Called with the extracted values (always called, even with `{}`). */
|
|
14
|
+
onFill: (values: Record<string, any>) => void;
|
|
15
|
+
/** Placeholder for the paste box. */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Label for the paste box. */
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* "Paste to autofill": the user pastes free text, and the injected `AIClient`
|
|
22
|
+
* extracts values for the form's fields.
|
|
23
|
+
*/
|
|
24
|
+
export declare const AIFill: React.FC<AIFillProps>;
|
|
25
|
+
export default AIFill;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormField } from '../../types';
|
|
2
|
+
import { AIClient } from '../types';
|
|
3
|
+
import { FormGeneratorProps } from '../../components/FormGenerator';
|
|
4
|
+
export interface AIFormProps {
|
|
5
|
+
/** Injected, provider-agnostic AI client. */
|
|
6
|
+
client: AIClient;
|
|
7
|
+
/** The form schema (JSON). Used as the initial schema; AI edits update it internally. */
|
|
8
|
+
data: FormField[];
|
|
9
|
+
guid: string;
|
|
10
|
+
/** Initial field values. */
|
|
11
|
+
patch?: Record<string, any>;
|
|
12
|
+
onSubmit?: FormGeneratorProps['onSubmit'];
|
|
13
|
+
onChange?: FormGeneratorProps['onChange'];
|
|
14
|
+
/** Called whenever AI (generate / review) changes the schema. */
|
|
15
|
+
onSchemaChange?: (fields: FormField[]) => void;
|
|
16
|
+
/** Toolbar toggles. */
|
|
17
|
+
enableFill?: boolean;
|
|
18
|
+
enableReview?: boolean;
|
|
19
|
+
enableGenerate?: boolean;
|
|
20
|
+
formRef?: FormGeneratorProps['formRef'];
|
|
21
|
+
/** Extra props forwarded to the inner FormGenerator. */
|
|
22
|
+
formProps?: Partial<FormGeneratorProps>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Drop-in form + AI. Renders a `FormGenerator` from `data` and a small AI toolbar
|
|
26
|
+
* that can generate/edit the schema, review it, and paste-to-fill the values —
|
|
27
|
+
* all wired to the internal schema/patch state. One line to add AI to any form.
|
|
28
|
+
*/
|
|
29
|
+
export default function AIForm({ client, data, guid, patch, onSubmit, onChange, onSchemaChange, enableFill, enableReview, enableGenerate, formRef, formProps, }: AIFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AIClient } from '../types';
|
|
2
|
+
import { FormField } from '../../types';
|
|
3
|
+
export interface AIFormGeneratorProps {
|
|
4
|
+
/** Provider-agnostic AI client (injected). Never calls the network directly. */
|
|
5
|
+
client: AIClient;
|
|
6
|
+
/** When provided and non-empty, the component edits this form instead of generating a new one. */
|
|
7
|
+
current?: FormField[];
|
|
8
|
+
/** Called with the generated (or edited) form schema. */
|
|
9
|
+
onGenerate: (fields: FormField[]) => void;
|
|
10
|
+
/** Placeholder text for the prompt input. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Label for the prompt input. */
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A small, self-contained UI that turns a natural-language prompt into a
|
|
17
|
+
* renderable form schema via an injected `AIClient`. When `current` is a
|
|
18
|
+
* non-empty array it applies the prompt as an edit to that form instead.
|
|
19
|
+
*/
|
|
20
|
+
export default function AIFormGenerator({ client, current, onGenerate, placeholder, label, }: AIFormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AIClient } from '../types';
|
|
2
|
+
import { FormField } from '../../types';
|
|
3
|
+
export interface AISchemaReviewProps {
|
|
4
|
+
/** Provider-agnostic AI client (injected). Never calls the network directly. */
|
|
5
|
+
client: AIClient;
|
|
6
|
+
/** The form schema to audit. */
|
|
7
|
+
schema: FormField[];
|
|
8
|
+
/** Called with `result.improved` when the user applies the AI's improvements. */
|
|
9
|
+
onApply?: (fields: FormField[]) => void;
|
|
10
|
+
/** Label for the review button. */
|
|
11
|
+
buttonLabel?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Audits a form schema through an injected `AIClient` and presents the returned
|
|
15
|
+
* issues as a tidy list. When the client returns an improved schema and an
|
|
16
|
+
* `onApply` handler is provided, the user can apply it wholesale.
|
|
17
|
+
*/
|
|
18
|
+
export default function AISchemaReview({ client, schema, onApply, buttonLabel, }: AISchemaReviewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AIClient, AssistAction } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Return value of {@link useAIAssist}. `run` invokes the injected client's
|
|
4
|
+
* `assistText`, tracking `loading`/`error` and resolving with the result text.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseAIAssist {
|
|
7
|
+
run: (text: string, action: AssistAction, targetLanguage?: string) => Promise<string>;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Headless hook around an injected {@link AIClient}. Never calls the network
|
|
13
|
+
* directly — it delegates to `client.assistText` and surfaces loading/error.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useAIAssist(client: AIClient): UseAIAssist;
|
|
16
|
+
export interface AITextAssistProps {
|
|
17
|
+
/** Provider-agnostic AI client (injected). Never calls the network directly. */
|
|
18
|
+
client: AIClient;
|
|
19
|
+
/** The text the selected action operates on. */
|
|
20
|
+
text: string;
|
|
21
|
+
/** Which assist actions to offer. Defaults to all seven. */
|
|
22
|
+
actions?: AssistAction[];
|
|
23
|
+
/** Called with the transformed text once an action resolves. */
|
|
24
|
+
onResult: (text: string) => void;
|
|
25
|
+
/** Target language, forwarded for the `translate` action. */
|
|
26
|
+
targetLanguage?: string;
|
|
27
|
+
/** Size of the trigger icon button. */
|
|
28
|
+
size?: 'small' | 'medium';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A compact "AI assist" trigger: an icon button that opens a menu of text
|
|
32
|
+
* transformations (improve, summarize, translate, …). Selecting one runs it
|
|
33
|
+
* through the injected {@link AIClient} and hands the result to `onResult`.
|
|
34
|
+
*/
|
|
35
|
+
export default function AITextAssist({ client, text, actions, onResult, targetLanguage, size, }: AITextAssistProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AIClient } from '../types';
|
|
2
|
+
import { FormField } from '../../types';
|
|
3
|
+
export interface AIVisionImportProps {
|
|
4
|
+
client: AIClient;
|
|
5
|
+
/** 'generate' → digitize a form image into a schema; 'fill' → read a document into fields. */
|
|
6
|
+
mode?: 'generate' | 'fill';
|
|
7
|
+
/** For 'fill' mode: the form to populate (fields are derived from it). */
|
|
8
|
+
schema?: FormField[];
|
|
9
|
+
/** For 'fill' mode: explicit field list (overrides schema). */
|
|
10
|
+
fields?: {
|
|
11
|
+
id: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
}[];
|
|
15
|
+
onGenerate?: (fields: FormField[]) => void;
|
|
16
|
+
onFill?: (values: Record<string, any>) => void;
|
|
17
|
+
label?: string;
|
|
18
|
+
accept?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Upload a document/photo and let AI (vision) either build a form from it or fill fields. */
|
|
21
|
+
export default function AIVisionImport({ client, mode, schema, fields, onGenerate, onFill, label, accept, }: AIVisionImportProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as AIFormGenerator } from './AIFormGenerator';
|
|
2
|
+
export { default as AIFill } from './AIFill';
|
|
3
|
+
export { default as AITextAssist, useAIAssist } from './AITextAssist';
|
|
4
|
+
export { default as AISchemaReview } from './AISchemaReview';
|
|
5
|
+
export { default as AIVisionImport } from './AIVisionImport';
|
|
6
|
+
export { default as AIForm } from './AIForm';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { FormField } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A simplified, LLM-friendly field description. The AI works in terms of these
|
|
4
|
+
* (flat, easy to reason about) and the mapping layer converts them to/from the
|
|
5
|
+
* library's richer `FormField` schema.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimpleField {
|
|
8
|
+
/** Semantic control kind (see mapping for the supported set + aliases). */
|
|
9
|
+
type: string;
|
|
10
|
+
/** Stable field id. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Human label. */
|
|
13
|
+
label: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
helperText?: string;
|
|
17
|
+
/** Options for choice fields (select/radio/chipselect/togglebuttons). */
|
|
18
|
+
options?: string[];
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
/** Layout width hint. */
|
|
21
|
+
width?: 'full' | 'half' | 'third';
|
|
22
|
+
/** Arithmetic formula for computed fields, e.g. "qty * price". */
|
|
23
|
+
formula?: string;
|
|
24
|
+
/** Simple conditional-visibility hint. */
|
|
25
|
+
visibleWhen?: {
|
|
26
|
+
field: string;
|
|
27
|
+
op?: string;
|
|
28
|
+
value?: any;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export type AssistAction = 'improve' | 'summarize' | 'expand' | 'shorten' | 'fix-grammar' | 'professional' | 'translate';
|
|
32
|
+
/** A field descriptor the AI uses when extracting values into a form. */
|
|
33
|
+
export interface ExtractionField {
|
|
34
|
+
id: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
/** Valid option values (for select/radio/chip/etc.) so the model returns a real one. */
|
|
38
|
+
options?: string[];
|
|
39
|
+
/** Date/number format hint, e.g. "MM/DD/YYYY". */
|
|
40
|
+
format?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ReviewIssue {
|
|
43
|
+
/** Field id the issue relates to (omitted for form-wide issues). */
|
|
44
|
+
field?: string;
|
|
45
|
+
/** Category of suggestion. */
|
|
46
|
+
kind: 'label' | 'validation' | 'logic' | 'type' | 'accessibility' | 'other';
|
|
47
|
+
severity: 'info' | 'suggestion' | 'warning';
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ReviewResult {
|
|
51
|
+
issues: ReviewIssue[];
|
|
52
|
+
/** An improved version of the whole form the user can apply wholesale. */
|
|
53
|
+
improved?: FormField[];
|
|
54
|
+
}
|
|
55
|
+
/** OpenAI content part — text or an image (for vision requests). */
|
|
56
|
+
export type ContentPart = {
|
|
57
|
+
type: 'text';
|
|
58
|
+
text: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'image_url';
|
|
61
|
+
image_url: {
|
|
62
|
+
url: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/** Low-level OpenAI-style chat payload sent to the (user-hosted) proxy. */
|
|
66
|
+
export interface ChatRequest {
|
|
67
|
+
messages: {
|
|
68
|
+
role: 'system' | 'user' | 'assistant';
|
|
69
|
+
content: string | ContentPart[];
|
|
70
|
+
}[];
|
|
71
|
+
/** When true, ask the model for a JSON object and parse the response. */
|
|
72
|
+
json?: boolean;
|
|
73
|
+
temperature?: number;
|
|
74
|
+
model?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface AIClientConfig {
|
|
77
|
+
/** URL of YOUR backend proxy that injects the OpenAI key server-side. */
|
|
78
|
+
endpoint: string;
|
|
79
|
+
/** Extra headers (e.g. auth) sent to your proxy. */
|
|
80
|
+
headers?: Record<string, string>;
|
|
81
|
+
/** Default model (your proxy may override/ignore). Default 'gpt-4o-mini'. */
|
|
82
|
+
model?: string;
|
|
83
|
+
/** Injectable fetch (for tests / non-browser envs). Defaults to global fetch. */
|
|
84
|
+
fetchImpl?: typeof fetch;
|
|
85
|
+
}
|
|
86
|
+
export interface GenerateOptions {
|
|
87
|
+
/** Restrict generation to these control types (defaults to a curated set). */
|
|
88
|
+
allowedTypes?: string[];
|
|
89
|
+
}
|
|
90
|
+
export interface AIClient {
|
|
91
|
+
/** Low-level escape hatch — send a chat request to your proxy. */
|
|
92
|
+
chat(req: ChatRequest): Promise<any>;
|
|
93
|
+
/** Natural-language prompt → a renderable form schema. */
|
|
94
|
+
generateForm(prompt: string, opts?: GenerateOptions): Promise<FormField[]>;
|
|
95
|
+
/** Apply a natural-language edit to an existing form. */
|
|
96
|
+
editForm(current: FormField[], instruction: string): Promise<FormField[]>;
|
|
97
|
+
/** Audit a form and suggest improvements (+ an optional improved version). */
|
|
98
|
+
reviewForm(current: FormField[]): Promise<ReviewResult>;
|
|
99
|
+
/** Extract values from free text/paste into the given fields. */
|
|
100
|
+
extractToFields(text: string, fields: ExtractionField[]): Promise<Record<string, any>>;
|
|
101
|
+
/** Transform a piece of text (rewrite/summarize/translate/…). */
|
|
102
|
+
assistText(text: string, action: AssistAction, targetLanguage?: string): Promise<string>;
|
|
103
|
+
/** Vision: digitize a document/photo of a form into a renderable schema. */
|
|
104
|
+
generateFormFromImage(images: string | string[], prompt?: string, opts?: GenerateOptions): Promise<FormField[]>;
|
|
105
|
+
/** Vision: read a document/photo (receipt, ID, invoice…) into the given fields. */
|
|
106
|
+
extractFromImage(images: string | string[], fields: ExtractionField[]): Promise<Record<string, any>>;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function l(n){return(n%360+360)%360}const c=2*Math.PI;function t(n){return(n%c+c)%c}exports.clampAngle=l;exports.clampAngleRad=t;
|
|
@@ -3,6 +3,11 @@ import { GridProps } from '@mui/material';
|
|
|
3
3
|
import { FormField } from '../util/helper';
|
|
4
4
|
export declare const FormData: (id?: string) => any;
|
|
5
5
|
export declare const ClearFormData: (id?: string) => void;
|
|
6
|
+
/** Convenience accessor for a form's stored values (imperative; pairs with `guid`). */
|
|
7
|
+
export declare const useForm: (guid: string) => {
|
|
8
|
+
getValues: () => any;
|
|
9
|
+
clear: () => void;
|
|
10
|
+
};
|
|
6
11
|
export interface FormGeneratorProps {
|
|
7
12
|
/** Component unique identifier */
|
|
8
13
|
guid: string;
|
|
@@ -33,5 +38,45 @@ export interface FormGeneratorProps {
|
|
|
33
38
|
onFieldDoubleClick?: (field: FormField) => void;
|
|
34
39
|
/** On Field Context Menu (Internal/Builder) */
|
|
35
40
|
onFieldContextMenu?: (event: React.MouseEvent, field: FormField) => void;
|
|
41
|
+
/**
|
|
42
|
+
* By default a form's stored data is removed from the shared store when the
|
|
43
|
+
* component unmounts, preventing the store from growing unbounded across
|
|
44
|
+
* mount/unmount cycles. Set to `true` to keep the data available via
|
|
45
|
+
* `FormData(guid)` after the form has unmounted.
|
|
46
|
+
*/
|
|
47
|
+
persistOnUnmount?: boolean;
|
|
48
|
+
/** Persist form data to browser storage and restore it on mount (draft/auto-save). */
|
|
49
|
+
autoSave?: boolean;
|
|
50
|
+
/** Storage key for auto-save (defaults to `dynamic-mui:<guid>`). */
|
|
51
|
+
autoSaveKey?: string;
|
|
52
|
+
/** Which browser storage to use for auto-save (default 'local'). */
|
|
53
|
+
autoSaveStorage?: 'local' | 'session';
|
|
54
|
+
/** Imperative API — getValues/getErrors/validate/reset/setValues/submit. */
|
|
55
|
+
apiRef?: React.Ref<FormApi>;
|
|
56
|
+
/** Localizable default messages (e.g. { required: 'Champ obligatoire' }). */
|
|
57
|
+
messages?: FormMessages;
|
|
58
|
+
/** Show a visible validation summary above the form after a failed submit. */
|
|
59
|
+
validationSummary?: boolean;
|
|
36
60
|
}
|
|
37
|
-
|
|
61
|
+
/** Localizable built-in strings. */
|
|
62
|
+
export interface FormMessages {
|
|
63
|
+
required?: string;
|
|
64
|
+
/** "{n} error(s) found" summary prefix; `{n}` is replaced with the count. */
|
|
65
|
+
errorSummary?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Imperative handle exposed via `apiRef`. */
|
|
68
|
+
export interface FormApi {
|
|
69
|
+
/** Current values for this form. */
|
|
70
|
+
getValues: () => Record<string, any>;
|
|
71
|
+
/** Run validation now and return the errors (also displays them). */
|
|
72
|
+
getErrors: () => any[];
|
|
73
|
+
/** Alias of getErrors that returns whether the form is valid. */
|
|
74
|
+
validate: () => boolean;
|
|
75
|
+
/** Merge values into the form and re-render. */
|
|
76
|
+
setValues: (values: Record<string, any>) => void;
|
|
77
|
+
/** Clear this form's stored values. */
|
|
78
|
+
reset: () => void;
|
|
79
|
+
/** Programmatically submit (runs the same flow as the submit button). */
|
|
80
|
+
submit: () => void;
|
|
81
|
+
}
|
|
82
|
+
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, persistOnUnmount, autoSave, autoSaveKey, autoSaveStorage, apiRef, messages, validationSummary, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* AsyncAutocomplete — an MUI `Autocomplete` whose options are loaded
|
|
4
|
+
* asynchronously as the user types (server-side search). Client-side filtering
|
|
5
|
+
* is disabled; options come from `loadOptions(query)` or by fetching
|
|
6
|
+
* `optionsUrl` with a `q` query param. Requests are debounced and guarded
|
|
7
|
+
* against out-of-order responses.
|
|
8
|
+
*/
|
|
9
|
+
export default function AsyncAutocomplete({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Playground Component */
|
|
3
|
-
export default function CheckBox({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function CheckBox({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Read-only display for a computed / formula field. The value is derived and
|
|
4
|
+
* supplied by FormGenerator's rule engine (via the field's `formula`); this
|
|
5
|
+
* control just presents it, optionally number-formatted, with a prefix/suffix.
|
|
6
|
+
*/
|
|
7
|
+
export default function Computed({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Latitude + longitude coordinate picker with an "Open in Maps" link and an
|
|
4
|
+
* optional OpenStreetMap embed (opt-in via `showMap`).
|
|
5
|
+
*/
|
|
6
|
+
export default function GeoField({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function LocationField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function LocationField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function MultiTextbox({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function MultiTextbox({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/** NpsScale Component — a horizontal 0..N rating scale (Net Promoter Score style). */
|
|
3
|
+
export default function NpsScale({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function NumberField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function NumberField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Radio Component */
|
|
3
|
-
export default function Radio({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Radio({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function Select({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function Select({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Read-only review panel that lists the current form's values as
|
|
4
|
+
* label -> value rows. Reads live values from the shared FormGenerator store
|
|
5
|
+
* via `guid`, or from an explicit `data` object (which takes precedence).
|
|
6
|
+
*/
|
|
7
|
+
export default function SummaryField({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Switch Component */
|
|
3
|
-
export default function Switch({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Switch({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function TextField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function TextField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|