@ttoss/forms 0.16.2 → 0.16.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/dist/esm/index.js +17 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -12
- package/package.json +3 -3
- package/src/FormGroup.tsx +17 -13
package/dist/esm/index.js
CHANGED
|
@@ -402,7 +402,12 @@ var useFormGroup = () => {
|
|
|
402
402
|
levelsLength
|
|
403
403
|
};
|
|
404
404
|
};
|
|
405
|
-
var FormGroupWrapper =
|
|
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
|
|
418
|
-
flexDirection:
|
|
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
|
-
|
|
427
|
-
|
|
431
|
+
marginTop: level === 0 ? "none" : "lg",
|
|
432
|
+
marginBottom: "lg",
|
|
433
|
+
...boxProps.sx
|
|
428
434
|
},
|
|
429
|
-
children: [
|
|
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:
|
|
444
|
+
children: title
|
|
439
445
|
})
|
|
440
446
|
}), /* @__PURE__ */jsx9(Flex6, {
|
|
441
|
-
|
|
442
|
-
|
|
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
|
-
} &
|
|
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 =
|
|
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
|
|
469
|
-
flexDirection:
|
|
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
|
-
|
|
478
|
-
|
|
482
|
+
marginTop: level === 0 ? "none" : "lg",
|
|
483
|
+
marginBottom: "lg",
|
|
484
|
+
...boxProps.sx
|
|
479
485
|
},
|
|
480
|
-
children: [
|
|
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:
|
|
495
|
+
children: title
|
|
490
496
|
})
|
|
491
497
|
}), /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Flex, {
|
|
492
|
-
|
|
493
|
-
|
|
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.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@ttoss/config": "^1.30.0",
|
|
33
33
|
"@ttoss/test-utils": "^1.22.0",
|
|
34
|
-
"@ttoss/ui": "^1.35.
|
|
34
|
+
"@ttoss/ui": "^1.35.2",
|
|
35
35
|
"@types/jest": "^29.5.1",
|
|
36
36
|
"@types/react": "^18.2.0",
|
|
37
37
|
"jest": "^29.5.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "c0c2571b4949c0b555f8f21ac6f0c5eec7489f25"
|
|
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
|
-
} &
|
|
61
|
+
} & BoxProps;
|
|
62
62
|
|
|
63
|
-
const FormGroupWrapper = (
|
|
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
|
|
79
|
-
flexDirection:
|
|
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
|
-
|
|
90
|
-
|
|
94
|
+
marginTop: level === 0 ? 'none' : 'lg',
|
|
95
|
+
marginBottom: 'lg',
|
|
96
|
+
...boxProps.sx,
|
|
91
97
|
}}
|
|
92
98
|
>
|
|
93
|
-
{
|
|
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
|
-
{
|
|
107
|
+
{title}
|
|
102
108
|
</Text>
|
|
103
109
|
</Box>
|
|
104
110
|
)}
|
|
105
|
-
<Flex
|
|
106
|
-
{props.children}
|
|
107
|
-
</Flex>
|
|
111
|
+
<Flex sx={childrenContainerSx}>{children}</Flex>
|
|
108
112
|
</Box>
|
|
109
113
|
);
|
|
110
114
|
};
|