@graphcommerce/react-hook-form 2.104.0 → 2.104.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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.104.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.104.0...@graphcommerce/react-hook-form@2.104.1) (2021-12-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * make the headerHeight properly configurable ([c39c942](https://github.com/ho-nl/m2-pwa/commit/c39c942a62a9bb9687ea553be28e37fb49a6b065))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.104.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.103.1...@graphcommerce/react-hook-form@2.104.0) (2021-11-12)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/react-hook-form",
3
- "version": "2.104.0",
3
+ "version": "2.104.4",
4
4
  "sideEffects": false,
5
5
  "engines": {
6
6
  "node": "14.x"
@@ -17,19 +17,18 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@graphcommerce/browserslist-config-pwa": "^3.0.2",
20
- "@graphcommerce/eslint-config-pwa": "^3.1.5",
20
+ "@graphcommerce/eslint-config-pwa": "^3.1.8",
21
21
  "@graphcommerce/prettier-config-pwa": "^3.0.4",
22
22
  "@graphcommerce/typescript-config-pwa": "^3.1.1",
23
- "@playwright/test": "^1.16.2"
23
+ "@playwright/test": "^1.17.1"
24
24
  },
25
25
  "dependencies": {
26
- "@apollo/client": "^3.4.16",
27
- "@lingui/macro": "^3.12.1",
28
- "graphql": "^15.6.1",
26
+ "@apollo/client": "^3.5.6",
27
+ "graphql": "^16.1.0",
29
28
  "react": "^17.0.2",
30
29
  "react-dom": "^17.0.2",
31
- "react-hook-form": "7.16.2",
32
- "type-fest": "^2.5.1"
30
+ "react-hook-form": "7.22.1",
31
+ "type-fest": "^2.8.0"
33
32
  },
34
- "gitHead": "6a39908a131938d9c3365cc937b92c1f1f8b33c6"
33
+ "gitHead": "a69bd94ffdcca6ca9487eec1cafe9ade3fcdffa3"
35
34
  }
@@ -1,4 +1,4 @@
1
- import React, { useReducer } from 'react'
1
+ import React, { useMemo, useReducer } from 'react'
2
2
  import { composedFormContext } from './context'
3
3
  import { composedFormReducer } from './reducer'
4
4
 
@@ -25,7 +25,7 @@ export default function ComposedForm(props: ComposedFormProps) {
25
25
  })
26
26
 
27
27
  return (
28
- <composedFormContext.Provider value={[state, dispatch]}>
28
+ <composedFormContext.Provider value={useMemo(() => [state, dispatch], [state])}>
29
29
  {children}
30
30
  </composedFormContext.Provider>
31
31
  )
@@ -46,9 +46,9 @@ export default function ComposedSubmit(props: ComposedSubmitProps) {
46
46
  * If we have forms that are have errors, we don't need to actually submit anything yet. We can
47
47
  * trigger the submission of the invalid forms and highlight the errors in those forms.
48
48
  */
49
- let formsToSubmit = formEntries.filter(([, f]) => {
50
- return Object.keys(f.form?.formState.errors ?? {}).length > 0
51
- })
49
+ let formsToSubmit = formEntries.filter(
50
+ ([, f]) => Object.keys(f.form?.formState.errors ?? {}).length > 0,
51
+ )
52
52
 
53
53
  // We have no errors and no invalid forms, this means we can submit everything.
54
54
  if (!formsToSubmit.length) formsToSubmit = formEntries
@@ -1,6 +1,4 @@
1
1
  import React from 'react'
2
2
  import { ComposedFormContext } from './types'
3
3
 
4
- export const composedFormContext = React.createContext(
5
- (undefined as unknown) as ComposedFormContext,
6
- )
4
+ export const composedFormContext = React.createContext(undefined as unknown as ComposedFormContext)
@@ -5,7 +5,6 @@ import {
5
5
  useApolloClient,
6
6
  MutationTuple,
7
7
  ApolloError,
8
- GraphQLRequest,
9
8
  } from '@apollo/client'
10
9
  import { UseFormProps, UseFormReturn, UnpackNestedValue, DeepPartial } from 'react-hook-form'
11
10
  import diff from './diff'
@@ -7,7 +7,7 @@ import {
7
7
  } from 'react-hook-form'
8
8
 
9
9
  export type UseMuiFormRegister<TFieldValues extends FieldValues> = <
10
- TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
10
+ TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
11
11
  >(
12
12
  name: TFieldName,
13
13
  options?: RegisterOptions<TFieldValues, TFieldName>,
@@ -42,7 +42,7 @@ export function useFormPersist<V>(options: UseFormPersistOptions<V>) {
42
42
  useEffect(() => {
43
43
  try {
44
44
  if (typeof window === 'undefined') return
45
- const storedFormStr = window[storage][name]
45
+ const storedFormStr = window[storage][name] as string
46
46
  if (!storedFormStr) return
47
47
 
48
48
  const storedValues = JSON.parse(storedFormStr) as FieldValues
@@ -9,9 +9,6 @@ import {
9
9
  VariableNode,
10
10
  VariableDefinitionNode,
11
11
  TypeNode,
12
- ListTypeNode,
13
- NamedTypeNode,
14
- NonNullTypeNode,
15
12
  OperationTypeNode,
16
13
  } from 'graphql'
17
14
  import { useMemo } from 'react'
@@ -16,6 +16,7 @@ export type LazyQueryTuple<Q, V> = [
16
16
 
17
17
  /**
18
18
  * Same API as useLazyQuery, except:
19
+ *
19
20
  * - The execute method is a promise that will return the eventual result
20
21
  */
21
22
  export function useLazyQueryPromise<Q, V>(
@@ -1,4 +1,6 @@
1
- export const emailPattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
2
- export const phonePattern = /^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/
1
+ export const emailPattern =
2
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
3
+ export const phonePattern =
4
+ /^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/
3
5
 
4
6
  export const houseNumberPattern = /^\d+([-\\/]\d+)*$/