@graphcommerce/ecommerce-ui 6.1.1-canary.0 → 6.1.1-canary.2
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 +8 -0
- package/components/FormComponents/AutoCompleteElement.tsx +2 -1
- package/components/FormComponents/CheckboxButtonGroup.tsx +2 -1
- package/components/FormComponents/CheckboxElement.tsx +2 -1
- package/components/FormComponents/MultiSelectElement.tsx +2 -1
- package/components/FormComponents/RadioButtonGroup.tsx +2 -1
- package/components/FormComponents/SliderElement.tsx +2 -1
- package/components/FormComponents/TextFieldElement.tsx +1 -2
- package/components/FormComponents/ToggleButtonGroup.tsx +2 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @graphcommerce/ecommerce-ui
|
|
2
2
|
|
|
3
|
+
## 6.1.1-canary.2
|
|
4
|
+
|
|
5
|
+
## 6.1.1-canary.1
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#1905](https://github.com/graphcommerce-org/graphcommerce/pull/1905) [`b6adbe1c3`](https://github.com/graphcommerce-org/graphcommerce/commit/b6adbe1c304c83c67c9e63f9a95d55ff64718725) - make the FormComponent elements validation message translatable. ([@carlocarels90](https://github.com/carlocarels90))
|
|
10
|
+
|
|
3
11
|
## 6.1.1-canary.0
|
|
4
12
|
|
|
5
13
|
## 6.1.0
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Controller, ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
|
|
2
|
+
import { i18n } from '@lingui/core'
|
|
2
3
|
import {
|
|
3
4
|
Autocomplete,
|
|
4
5
|
AutocompleteProps,
|
|
@@ -55,7 +56,7 @@ export function AutocompleteElement<TFieldValues extends FieldValues>({
|
|
|
55
56
|
const validationRules: ControllerProps<TFieldValues>['rules'] = {
|
|
56
57
|
...rules,
|
|
57
58
|
...(required && {
|
|
58
|
-
required: rules?.required || 'This field is required',
|
|
59
|
+
required: rules?.required || i18n._(/* i18n */ 'This field is required'),
|
|
59
60
|
}),
|
|
60
61
|
}
|
|
61
62
|
return (
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FieldValues,
|
|
5
5
|
UseControllerProps,
|
|
6
6
|
} from '@graphcommerce/react-hook-form'
|
|
7
|
+
import { i18n } from '@lingui/core'
|
|
7
8
|
import {
|
|
8
9
|
Checkbox,
|
|
9
10
|
CheckboxProps,
|
|
@@ -52,7 +53,7 @@ export function CheckboxButtonGroup<TFieldValues extends FieldValues>({
|
|
|
52
53
|
fieldState: { invalid, error },
|
|
53
54
|
} = useController({
|
|
54
55
|
name,
|
|
55
|
-
rules: required ? { required: 'This field is required' } : undefined,
|
|
56
|
+
rules: required ? { required: i18n._(/* i18n */ 'This field is required') } : undefined,
|
|
56
57
|
control,
|
|
57
58
|
})
|
|
58
59
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FieldError,
|
|
5
5
|
FieldValues,
|
|
6
6
|
} from '@graphcommerce/react-hook-form'
|
|
7
|
+
import { i18n } from '@lingui/core'
|
|
7
8
|
import {
|
|
8
9
|
Checkbox,
|
|
9
10
|
CheckboxProps,
|
|
@@ -38,7 +39,7 @@ export function CheckboxElement<TFieldValues extends FieldValues>({
|
|
|
38
39
|
...rest
|
|
39
40
|
}: CheckboxElementProps<TFieldValues>): JSX.Element {
|
|
40
41
|
if (required && !rules.required) {
|
|
41
|
-
rules.required = 'This field is required'
|
|
42
|
+
rules.required = i18n._(/* i18n */ 'This field is required')
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
return (
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
FieldValues,
|
|
7
7
|
ControllerProps,
|
|
8
8
|
} from '@graphcommerce/react-hook-form'
|
|
9
|
+
import { i18n } from '@lingui/core'
|
|
9
10
|
import {
|
|
10
11
|
Checkbox,
|
|
11
12
|
Chip,
|
|
@@ -63,7 +64,7 @@ export function MultiSelectElement<TFieldValues extends FieldValues>(
|
|
|
63
64
|
...rest
|
|
64
65
|
} = props
|
|
65
66
|
if (required && !rules.required) {
|
|
66
|
-
rules.required = 'This field is required'
|
|
67
|
+
rules.required = i18n._(/* i18n */ 'This field is required')
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
return (
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FieldValues,
|
|
5
5
|
UseControllerProps,
|
|
6
6
|
} from '@graphcommerce/react-hook-form'
|
|
7
|
+
import { i18n } from '@lingui/core'
|
|
7
8
|
import {
|
|
8
9
|
FormControl,
|
|
9
10
|
FormControlLabel,
|
|
@@ -51,7 +52,7 @@ export function RadioButtonGroup<TFieldValues extends FieldValues>({
|
|
|
51
52
|
fieldState: { invalid, error },
|
|
52
53
|
} = useController({
|
|
53
54
|
name,
|
|
54
|
-
rules: required ? { required: 'This field is required' } : undefined,
|
|
55
|
+
rules: required ? { required: i18n._(/* i18n */ 'This field is required') } : undefined,
|
|
55
56
|
control,
|
|
56
57
|
})
|
|
57
58
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FieldError,
|
|
5
5
|
FieldValues,
|
|
6
6
|
} from '@graphcommerce/react-hook-form'
|
|
7
|
+
import { i18n } from '@lingui/core'
|
|
7
8
|
import {
|
|
8
9
|
FormControl,
|
|
9
10
|
FormControlProps,
|
|
@@ -31,7 +32,7 @@ export function SliderElement<TFieldValues extends FieldValues>({
|
|
|
31
32
|
...other
|
|
32
33
|
}: SliderElementProps<TFieldValues>) {
|
|
33
34
|
if (required && !rules.required) {
|
|
34
|
-
rules.required = 'This field is required'
|
|
35
|
+
rules.required = i18n._(/* i18n */ 'This field is required')
|
|
35
36
|
}
|
|
36
37
|
return (
|
|
37
38
|
<Controller
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
2
|
import {
|
|
3
3
|
Controller,
|
|
4
|
-
ControllerProps,
|
|
5
4
|
FieldError,
|
|
6
5
|
FieldValues,
|
|
7
6
|
UseControllerProps,
|
|
@@ -36,7 +35,7 @@ export function TextFieldElement<TFieldValues extends FieldValues>({
|
|
|
36
35
|
// eslint-disable-next-line no-useless-escape
|
|
37
36
|
value:
|
|
38
37
|
/^(([^<>()\[\]\\.,;:\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,}))$/,
|
|
39
|
-
message: 'Please enter a valid email address',
|
|
38
|
+
message: i18n._(/* i18n */ 'Please enter a valid email address'),
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FieldError,
|
|
5
5
|
FieldValues,
|
|
6
6
|
} from '@graphcommerce/react-hook-form'
|
|
7
|
+
import { i18n } from '@lingui/core'
|
|
7
8
|
import {
|
|
8
9
|
FormControl,
|
|
9
10
|
FormHelperText,
|
|
@@ -43,7 +44,7 @@ export function ToggleButtonGroupElement<TFieldValues extends FieldValues = Fiel
|
|
|
43
44
|
...toggleButtonGroupProps
|
|
44
45
|
}: ToggleButtonGroupElementProps<TFieldValues>) {
|
|
45
46
|
if (required && !rules.required) {
|
|
46
|
-
rules.required = 'This field is required'
|
|
47
|
+
rules.required = i18n._(/* i18n */ 'This field is required')
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
const isRequired = required || !!rules?.required
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/ecommerce-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "6.1.1-canary.
|
|
5
|
+
"version": "6.1.1-canary.2",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@graphcommerce/graphql": "6.1.1-canary.
|
|
16
|
-
"@graphcommerce/next-ui": "6.1.1-canary.
|
|
17
|
-
"@graphcommerce/react-hook-form": "6.1.1-canary.
|
|
15
|
+
"@graphcommerce/graphql": "6.1.1-canary.2",
|
|
16
|
+
"@graphcommerce/next-ui": "6.1.1-canary.2",
|
|
17
|
+
"@graphcommerce/react-hook-form": "6.1.1-canary.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@graphcommerce/eslint-config-pwa": "6.1.1-canary.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "6.1.1-canary.
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "6.1.1-canary.
|
|
20
|
+
"@graphcommerce/eslint-config-pwa": "6.1.1-canary.2",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "6.1.1-canary.2",
|
|
22
|
+
"@graphcommerce/typescript-config-pwa": "6.1.1-canary.2"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@lingui/react": "^3.13.2",
|