@saas-ui/forms 2.6.3 → 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saas-ui/forms",
3
- "version": "2.6.3",
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.2",
107
+ "@saas-ui/core": "2.5.3",
108
108
  "react-hook-form": "^7.50.1"
109
109
  },
110
110
  "peerDependencies": {
@@ -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 {...controlProps} isInvalid={isInvalid}>
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> = () => {