@m4l/components 9.3.8-BE190825-beta.1 → 9.3.8-BE210825-beta.1
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/components/FormContainer/FormContainer.js +22 -5
- package/components/FormContainer/slots/FormContainerSlots.js +1 -2
- package/components/FormContainer/types.d.ts +2 -2
- package/package.json +1 -1
- package/storybook/components/FormContainer/FormContainer.stories.d.ts +0 -4
- /package/storybook/components/{paperForm → PaperForm}/PaperForm.stories.d.ts +0 -0
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { R as RootStyled, F as FormContainerStyled
|
|
2
|
+
import { R as RootStyled, F as FormContainerStyled } from "./slots/FormContainerSlots.js";
|
|
3
3
|
import { F as FORM_CONTAINER_CLASSES } from "./constants.js";
|
|
4
|
+
import React, { useMemo } from "react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { A as ActionsContainer } from "../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
4
7
|
const FormContainer = (props) => {
|
|
5
|
-
const { children,
|
|
8
|
+
const { children, className } = props;
|
|
9
|
+
const { fields, footer } = useMemo(() => {
|
|
10
|
+
const fields2 = [];
|
|
11
|
+
let footer2 = null;
|
|
12
|
+
React.Children.forEach(children, (child) => {
|
|
13
|
+
if (React.isValidElement(child)) {
|
|
14
|
+
if (child.type === ActionsContainer) {
|
|
15
|
+
footer2 = child;
|
|
16
|
+
} else {
|
|
17
|
+
fields2.push(child);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return { fields: fields2, footer: footer2 };
|
|
22
|
+
}, [children]);
|
|
6
23
|
return /* @__PURE__ */ jsxs(
|
|
7
24
|
RootStyled,
|
|
8
25
|
{
|
|
9
26
|
role: "region",
|
|
10
27
|
"aria-label": "formContainer",
|
|
11
|
-
className: FORM_CONTAINER_CLASSES.root,
|
|
28
|
+
className: clsx(FORM_CONTAINER_CLASSES.root, className),
|
|
12
29
|
children: [
|
|
13
|
-
/* @__PURE__ */ jsx(FormContainerStyled, { children }),
|
|
14
|
-
|
|
30
|
+
/* @__PURE__ */ jsx(FormContainerStyled, { children: fields }),
|
|
31
|
+
footer
|
|
15
32
|
]
|
|
16
33
|
}
|
|
17
34
|
);
|
|
@@ -11,12 +11,11 @@ const FormContainerStyled = styled("div", {
|
|
|
11
11
|
name: FORM_CONTAINER_COMPONENT_KEY,
|
|
12
12
|
slot: FormContainerSlots.formContainer
|
|
13
13
|
})(formContainerStyles?.formContainer);
|
|
14
|
-
|
|
14
|
+
styled(ActionsContainer, {
|
|
15
15
|
name: FORM_CONTAINER_COMPONENT_KEY,
|
|
16
16
|
slot: FormContainerSlots.buttonGroup
|
|
17
17
|
})(formContainerStyles?.buttonGroup);
|
|
18
18
|
export {
|
|
19
|
-
ButtonGroupStyled as B,
|
|
20
19
|
FormContainerStyled as F,
|
|
21
20
|
RootStyled as R
|
|
22
21
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M4LOverridesStyleRules } from '
|
|
1
|
+
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
2
2
|
import { FormContainerSlots } from './slots/FormContainerEnum';
|
|
3
3
|
import { FORM_CONTAINER_COMPONENT_KEY } from './constants';
|
|
4
4
|
import { Theme } from '@mui/material/styles';
|
|
5
5
|
export interface FormContainerProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
className?: string;
|
|
8
8
|
}
|
|
9
9
|
export type FormContainerOwnerState = {};
|
|
10
10
|
export type FormContainerSlotsType = keyof typeof FormContainerSlots;
|
package/package.json
CHANGED
|
File without changes
|