@saas-ui/forms 2.6.1 → 2.6.3

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.1",
3
+ "version": "2.6.3",
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.0",
107
+ "@saas-ui/core": "2.5.2",
108
108
  "react-hook-form": "^7.50.1"
109
109
  },
110
110
  "peerDependencies": {
@@ -57,8 +57,10 @@ export const useBaseField = (props: BaseFieldProps) => {
57
57
  export const BaseField: React.FC<BaseFieldProps> = (props) => {
58
58
  const { controlProps, label, help, hideLabel, error } = useBaseField(props)
59
59
 
60
+ const isInvalid = !!error || controlProps.isInvalid
61
+
60
62
  return (
61
- <FormControl {...controlProps} isInvalid={!!error}>
63
+ <FormControl {...controlProps} isInvalid={isInvalid}>
62
64
  {label && !hideLabel ? <FormLabel>{label}</FormLabel> : null}
63
65
  <Box>
64
66
  {props.children}
@@ -46,6 +46,7 @@ const _createField = (
46
46
  'isInvalid',
47
47
  'isReadOnly',
48
48
  'help',
49
+ 'hideLabel',
49
50
  ].concat(extraProps)
50
51
  )
51
52
 
package/src/layout.tsx CHANGED
@@ -5,11 +5,15 @@ import {
5
5
  omitThemingProps,
6
6
  SimpleGrid,
7
7
  SimpleGridProps,
8
+ ThemingProps,
9
+ useStyleConfig,
8
10
  useTheme,
9
11
  } from '@chakra-ui/react'
10
12
  import { cx } from '@chakra-ui/utils'
11
13
 
12
- export interface FormLayoutProps extends SimpleGridProps {}
14
+ export interface FormLayoutProps
15
+ extends ThemingProps<'SuiFormLayout'>,
16
+ SimpleGridProps {}
13
17
 
14
18
  interface FormLayoutItemProps {
15
19
  children: React.ReactNode
@@ -24,7 +28,6 @@ FormLayoutItem.displayName = 'FormLayoutItem'
24
28
  /**
25
29
  * Create consistent field spacing and positioning.
26
30
  *
27
- *
28
31
  * Renders form items in a `SimpleGrid`
29
32
  * @see https://chakra-ui.com/docs/layout/simple-grid
30
33
  *
@@ -37,6 +40,8 @@ export const FormLayout = ({ children, ...props }: FormLayoutProps) => {
37
40
  spacing: 4,
38
41
  }
39
42
 
43
+ const styles = useStyleConfig('SuiFormLayout', props)
44
+
40
45
  const gridProps = omitThemingProps({
41
46
  ...defaultProps,
42
47
  ...props,
@@ -46,6 +51,10 @@ export const FormLayout = ({ children, ...props }: FormLayoutProps) => {
46
51
  <SimpleGrid
47
52
  {...gridProps}
48
53
  className={cx('sui-form__layout', props.className)}
54
+ sx={{
55
+ ...styles,
56
+ ...props.sx,
57
+ }}
49
58
  >
50
59
  {children}
51
60
  </SimpleGrid>
@@ -3,4 +3,6 @@ import * as React from 'react'
3
3
  import { render, testStories } from '@saas-ui/test-utils'
4
4
  import * as stories from './number-input.stories'
5
5
 
6
- testStories<typeof stories>(stories)
6
+ testStories<typeof stories>(stories, {
7
+ a11y: false,
8
+ })
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react'
2
2
 
3
- import { render, testStories } from '@saas-ui/test-utils'
3
+ import { testStories } from '@saas-ui/test-utils'
4
4
  import * as stories from './select.stories'
5
5
 
6
6
  const { MaxHeight, ...rest } = stories
7
7
 
8
- testStories<typeof rest>(rest)
8
+ testStories(rest, {
9
+ a11y: false,
10
+ })