@saas-ui/forms 2.6.3 → 2.6.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/CHANGELOG.md +12 -5
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/base-field.tsx +9 -1
- package/src/types.ts +4 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@saas-ui/forms",
|
3
|
-
"version": "2.6.
|
3
|
+
"version": "2.6.4",
|
4
4
|
"description": "Fully functional forms for Chakra UI.",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"exports": {
|
@@ -104,7 +104,7 @@
|
|
104
104
|
"@chakra-ui/react-utils": "^2.0.12",
|
105
105
|
"@chakra-ui/utils": "^2.0.15",
|
106
106
|
"@hookform/resolvers": "^3.3.4",
|
107
|
-
"@saas-ui/core": "2.5.
|
107
|
+
"@saas-ui/core": "2.5.3",
|
108
108
|
"react-hook-form": "^7.50.1"
|
109
109
|
},
|
110
110
|
"peerDependencies": {
|
package/src/base-field.tsx
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
FormLabel,
|
8
8
|
FormHelperText,
|
9
9
|
FormErrorMessage,
|
10
|
+
useBreakpointValue,
|
10
11
|
} from '@chakra-ui/react'
|
11
12
|
|
12
13
|
import { splitProps } from '@saas-ui/core'
|
@@ -31,6 +32,7 @@ export const useBaseField = (props: BaseFieldProps) => {
|
|
31
32
|
|
32
33
|
const [controlProps] = splitProps(props, [
|
33
34
|
'id',
|
35
|
+
'direction',
|
34
36
|
'isDisabled',
|
35
37
|
'isInvalid',
|
36
38
|
'isReadOnly',
|
@@ -59,8 +61,14 @@ export const BaseField: React.FC<BaseFieldProps> = (props) => {
|
|
59
61
|
|
60
62
|
const isInvalid = !!error || controlProps.isInvalid
|
61
63
|
|
64
|
+
const { direction, ...rest } = controlProps
|
65
|
+
|
62
66
|
return (
|
63
|
-
<FormControl
|
67
|
+
<FormControl
|
68
|
+
{...rest}
|
69
|
+
isInvalid={isInvalid}
|
70
|
+
variant={direction === 'row' ? 'horizontal' : undefined}
|
71
|
+
>
|
64
72
|
{label && !hideLabel ? <FormLabel>{label}</FormLabel> : null}
|
65
73
|
<Box>
|
66
74
|
{props.children}
|
package/src/types.ts
CHANGED
@@ -77,6 +77,10 @@ export interface BaseFieldProps<
|
|
77
77
|
* The input placeholder
|
78
78
|
*/
|
79
79
|
placeholder?: string
|
80
|
+
/**
|
81
|
+
* Whether the label is positioned vertically or horizontally
|
82
|
+
*/
|
83
|
+
direction?: 'row' | 'column'
|
80
84
|
}
|
81
85
|
|
82
86
|
export type GetBaseField<TProps extends object = object> = () => {
|