@form-engine-ts/mui 2.9.2 → 2.9.4

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 CHANGED
@@ -1,13 +1,45 @@
1
1
  # @form-engine-ts/mui
2
2
 
3
- Official Material UI v6/v7 adapters for `@form-engine-ts/react`.
3
+ Official Material UI v6/v7 integration layer for `@form-engine-ts/react`. `MuiFormBuilder` applies MUI controls and
4
+ layout slots together, disables the React builder CSS classes, and propagates common size and variant settings.
4
5
 
5
6
  ```tsx
6
- import { FormBuilder } from "@form-engine-ts/react";
7
- import { muiBuilderComponents } from "@form-engine-ts/mui";
7
+ import { MuiFormBuilder } from "@form-engine-ts/mui";
8
8
 
9
- <FormBuilder schema={schema} onChange={setSchema} components={muiBuilderComponents} />;
9
+ <MuiFormBuilder
10
+ schema={schema}
11
+ onChange={setSchema}
12
+ translator={translator}
13
+ translationAdapter={translationAdapter}
14
+ muiOptions={{
15
+ size: "small",
16
+ variant: "outlined",
17
+ dense: true,
18
+ getLocaleLabel: (locale) => localeNames[locale] ?? locale,
19
+ buttonVariants: { primary: "contained", secondary: "outlined", danger: "outlined" }
20
+ }}
21
+ layoutOptions={{
22
+ sectionOrder: ["basicSettings", "completionMessage", "questions", "addQuestion", "localization"]
23
+ }}
24
+ localizationOptions={{ collapsible: true, defaultExpanded: "when-configured" }}
25
+ muiSlotProps={{ card: { sx: { p: 2 } }, accordion: { elevation: 0 } }}
26
+ />;
10
27
  ```
11
28
 
12
29
  The package keeps MUI and Emotion as peer dependencies and exposes `createMuiBuilderComponents` for targeted component
13
30
  or icon overrides. Install `@mui/material`, `@mui/icons-material`, and Emotion alongside this package.
31
+
32
+ For low-level composition, `createMuiBuilderProps(options, overrides)` returns `components`, `slots`, and
33
+ `disableDefaultStyles: true` for a regular `FormBuilder`. Every primitive and slot is also exported individually, with
34
+ factories such as `createMuiTextInputAdapter`, `createMuiIconButtonAdapter`, `createMuiFieldEditorSlot`, and
35
+ `createMuiLocalizationSlot`.
36
+
37
+ All MUI builder slots use the `FormBuilder` translator for labels, actions, tooltips, and accessible names. Use
38
+ `getLocaleLabel` for application-specific locale names. The localization UI excludes `schema.defaultLocale` from its
39
+ translation tabs and follows `allowedLocales` and `maxLocales` from the builder policy.
40
+
41
+ `MuiAdapterOptions` defaults to `size: "medium"`, `variant: "outlined"`, `buttonVariant: "contained"`, and
42
+ `fullWidth: true`. Set `dense` to reduce section, editor, option, and toolbar spacing. `buttonVariants` can override the
43
+ MUI variant for `primary`, `secondary`, and `danger` actions independently. `layoutOptions`, `localizationOptions`, and
44
+ `muiSlotProps` are also accepted in `muiOptions` for low-level factories such as `createMuiBuilderSlots`; the dedicated
45
+ `MuiFormBuilder` props take precedence.