@ttoss/forms 0.16.2 → 0.16.3

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/dist/esm/index.js CHANGED
@@ -402,7 +402,12 @@ var useFormGroup = () => {
402
402
  levelsLength
403
403
  };
404
404
  };
405
- var FormGroupWrapper = props => {
405
+ var FormGroupWrapper = ({
406
+ title,
407
+ direction,
408
+ children,
409
+ ...boxProps
410
+ }) => {
406
411
  const {
407
412
  level
408
413
  } = useFormGroup();
@@ -414,19 +419,20 @@ var FormGroupWrapper = props => {
414
419
  registerChild(level);
415
420
  }
416
421
  }, [level, registerChild]);
417
- const sx = {
418
- flexDirection: props.direction || "column",
422
+ const childrenContainerSx = {
423
+ flexDirection: direction || "column",
419
424
  gap: "md",
420
- width: "100%",
421
- ...props.sx
425
+ width: "100%"
422
426
  };
423
427
  return /* @__PURE__ */jsxs6(Box3, {
424
428
  "aria-level": level,
429
+ ...boxProps,
425
430
  sx: {
426
- marginBottom: "2xl",
427
- marginX: level === 0 ? "none" : "md"
431
+ marginTop: level === 0 ? "none" : "lg",
432
+ marginBottom: "lg",
433
+ ...boxProps.sx
428
434
  },
429
- children: [props.title && /* @__PURE__ */jsx9(Box3, {
435
+ children: [title && /* @__PURE__ */jsx9(Box3, {
430
436
  sx: {
431
437
  marginBottom: "md"
432
438
  },
@@ -435,12 +441,11 @@ var FormGroupWrapper = props => {
435
441
  fontSize: "2xl",
436
442
  fontWeight: "bold"
437
443
  },
438
- children: props.title
444
+ children: title
439
445
  })
440
446
  }), /* @__PURE__ */jsx9(Flex6, {
441
- ...props,
442
- sx,
443
- children: props.children
447
+ sx: childrenContainerSx,
448
+ children
444
449
  })]
445
450
  });
446
451
  };
package/dist/index.d.ts CHANGED
@@ -71,7 +71,7 @@ declare const useFormGroup: () => {
71
71
  type FormGroupProps = {
72
72
  title?: string;
73
73
  direction?: 'column' | 'row';
74
- } & FlexProps;
74
+ } & BoxProps;
75
75
  declare const FormGroup: (props: FormGroupProps) => JSX.Element;
76
76
 
77
77
  export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useFormGroup };
package/dist/index.js CHANGED
@@ -453,7 +453,12 @@ var useFormGroup = () => {
453
453
  levelsLength
454
454
  };
455
455
  };
456
- var FormGroupWrapper = props => {
456
+ var FormGroupWrapper = ({
457
+ title,
458
+ direction,
459
+ children,
460
+ ...boxProps
461
+ }) => {
457
462
  const {
458
463
  level
459
464
  } = useFormGroup();
@@ -465,19 +470,20 @@ var FormGroupWrapper = props => {
465
470
  registerChild(level);
466
471
  }
467
472
  }, [level, registerChild]);
468
- const sx = {
469
- flexDirection: props.direction || "column",
473
+ const childrenContainerSx = {
474
+ flexDirection: direction || "column",
470
475
  gap: "md",
471
- width: "100%",
472
- ...props.sx
476
+ width: "100%"
473
477
  };
474
478
  return /* @__PURE__ */(0, import_jsx_runtime9.jsxs)(import_ui9.Box, {
475
479
  "aria-level": level,
480
+ ...boxProps,
476
481
  sx: {
477
- marginBottom: "2xl",
478
- marginX: level === 0 ? "none" : "md"
482
+ marginTop: level === 0 ? "none" : "lg",
483
+ marginBottom: "lg",
484
+ ...boxProps.sx
479
485
  },
480
- children: [props.title && /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Box, {
486
+ children: [title && /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Box, {
481
487
  sx: {
482
488
  marginBottom: "md"
483
489
  },
@@ -486,12 +492,11 @@ var FormGroupWrapper = props => {
486
492
  fontSize: "2xl",
487
493
  fontWeight: "bold"
488
494
  },
489
- children: props.title
495
+ children: title
490
496
  })
491
497
  }), /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Flex, {
492
- ...props,
493
- sx,
494
- children: props.children
498
+ sx: childrenContainerSx,
499
+ children
495
500
  })]
496
501
  });
497
502
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "3b5fa98e8b9445d00d44fcc0788f65c7ff22d6ca"
47
+ "gitHead": "4db2b08b38e864b64c2652d20d1ea705768beb75"
48
48
  }
package/src/FormGroup.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Box, Flex, FlexProps, Text } from '@ttoss/ui';
2
+ import { Box, BoxProps, Flex, FlexProps, Text } from '@ttoss/ui';
3
3
 
4
4
  type FormGroupLevelsManagerContextType = {
5
5
  levelsLength: number;
@@ -58,9 +58,14 @@ export const useFormGroup = () => {
58
58
  type FormGroupProps = {
59
59
  title?: string;
60
60
  direction?: 'column' | 'row';
61
- } & FlexProps;
61
+ } & BoxProps;
62
62
 
63
- const FormGroupWrapper = (props: FormGroupProps) => {
63
+ const FormGroupWrapper = ({
64
+ title,
65
+ direction,
66
+ children,
67
+ ...boxProps
68
+ }: FormGroupProps) => {
64
69
  const { level } = useFormGroup();
65
70
 
66
71
  const { registerChild } = React.useContext(FormGroupLevelsManagerContext);
@@ -75,22 +80,23 @@ const FormGroupWrapper = (props: FormGroupProps) => {
75
80
  }
76
81
  }, [level, registerChild]);
77
82
 
78
- const sx: FlexProps['sx'] = {
79
- flexDirection: props.direction || 'column',
83
+ const childrenContainerSx: FlexProps['sx'] = {
84
+ flexDirection: direction || 'column',
80
85
  gap: 'md',
81
86
  width: '100%',
82
- ...props.sx,
83
87
  };
84
88
 
85
89
  return (
86
90
  <Box
87
91
  aria-level={level}
92
+ {...boxProps}
88
93
  sx={{
89
- marginBottom: '2xl',
90
- marginX: level === 0 ? 'none' : 'md',
94
+ marginTop: level === 0 ? 'none' : 'lg',
95
+ marginBottom: 'lg',
96
+ ...boxProps.sx,
91
97
  }}
92
98
  >
93
- {props.title && (
99
+ {title && (
94
100
  <Box sx={{ marginBottom: 'md' }}>
95
101
  <Text
96
102
  sx={{
@@ -98,13 +104,11 @@ const FormGroupWrapper = (props: FormGroupProps) => {
98
104
  fontWeight: 'bold',
99
105
  }}
100
106
  >
101
- {props.title}
107
+ {title}
102
108
  </Text>
103
109
  </Box>
104
110
  )}
105
- <Flex {...props} sx={sx}>
106
- {props.children}
107
- </Flex>
111
+ <Flex sx={childrenContainerSx}>{children}</Flex>
108
112
  </Box>
109
113
  );
110
114
  };