@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.
@@ -1,17 +1,34 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { R as RootStyled, F as FormContainerStyled, B as ButtonGroupStyled } from "./slots/FormContainerSlots.js";
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, buttonGroup } = props;
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
- buttonGroup && /* @__PURE__ */ jsx(ButtonGroupStyled, { children: buttonGroup })
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
- const ButtonGroupStyled = styled(ActionsContainer, {
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 'src/@types/augmentations';
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
- buttonGroup?: React.ReactNode;
7
+ className?: string;
8
8
  }
9
9
  export type FormContainerOwnerState = {};
10
10
  export type FormContainerSlotsType = keyof typeof FormContainerSlots;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.8-BE190825-beta.1",
3
+ "version": "9.3.8-BE210825-beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -7,7 +7,3 @@ type Story = StoryObj<typeof FormContainer>;
7
7
  * Componente FormContainer por defecto
8
8
  */
9
9
  export declare const Default: Story;
10
- /**
11
- * Componente FormContainer con skeleton
12
- */
13
- export declare const Skeleton: Story;