@form-engine-ts/mui 2.9.6 → 3.1.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 CHANGED
@@ -25,13 +25,24 @@ import { MuiFormBuilder } from "@form-engine-ts/mui";
25
25
  sectionOrder: ["basicSettings", "completionMessage", "questions", "addQuestion", "localization"]
26
26
  }}
27
27
  localizationOptions={{
28
+ availableLocales: [
29
+ { value: "ja", label: "日本語" },
30
+ { value: "en", label: "English" }
31
+ ],
32
+ placement: "afterQuestions",
28
33
  collapsible: true,
29
34
  defaultExpanded: "when-configured",
30
35
  showSummary: true,
31
36
  emptyStateMessage: "No translation locales have been added yet.",
32
37
  defaultLocaleControl: "readOnly"
33
38
  }}
34
- muiSlotProps={{ card: { sx: { p: 2 } }, accordion: { elevation: 0 } }}
39
+ muiSlotProps={{
40
+ card: { sx: { p: 2 } },
41
+ accordion: { elevation: 0 },
42
+ textField: { "data-testid": "builder-input" },
43
+ select: { variant: "filled" },
44
+ selectMenu: { PaperProps: { elevation: 4 } }
45
+ }}
35
46
  />;
36
47
  ```
37
48
 
@@ -56,12 +67,21 @@ slots as it does for the standard builder.
56
67
  width options. `fieldEditorOptions.description` and `localizationOptions.defaultLocaleControl` independently make those
57
68
  controls editable, read-only, or hidden. Set `dense` to reduce section, editor, option, and toolbar spacing.
58
69
  `buttonVariants` can override the MUI variant for `primary`, `secondary`, and `danger` actions independently.
59
- `localizationOptions.showSummary` adds a locale summary badge to the localization heading, and
60
- `localizationOptions.emptyStateMessage` customizes the guidance shown before a translation locale is added. The
61
- `defaultExpanded` option also accepts `"always"`.
70
+ `localizationOptions.availableLocales` supplies display-ready locale candidates independently from the policy; when
71
+ both are present, only candidates allowed by `allowedLocales` are shown. `placement` supports `top`,
72
+ `beforeQuestions`, `afterQuestions`, and `bottom` section presets. `showSummary` renders a status alert, while
73
+ `renderSummary` can provide a custom summary. `emptyStateMessage` customizes the guidance shown before a translation
74
+ locale is added. `defaultExpanded` also accepts `"always"`; `autoFocusNewTab` focuses a newly added locale tab by
75
+ default.
62
76
  `layoutOptions`, `localizationOptions`, and `muiSlotProps` are also accepted in `muiOptions` for low-level factories such
63
77
  as `createMuiBuilderSlots`; the dedicated `MuiFormBuilder` props take precedence.
64
78
 
79
+ Select options in the MUI adapter support icons, descriptions, custom metadata, and custom `renderOption`/`renderValue`
80
+ callbacks. Without a custom renderer, icons appear beside labels in the menu and in the selected value. The standard
81
+ MUI field editor supplies icons for every field type and accepts `slots.fieldTypeSelect` and `slots.fieldEditorHeader`
82
+ for focused customization. `muiSlotProps` also supports `textField`, `select`, `selectMenu`, `checkbox`, `button`, and
83
+ `iconButton` MUI props in addition to the layout props.
84
+
65
85
  `MuiFormBuilder` supplies options through `MuiFormBuilderContext` to module-stable adapter and slot component types.
66
86
  Controlled schema updates therefore preserve input focus and uncontrolled MUI state such as an open localization
67
87
  accordion even when the parent passes inline option objects.