@graphcommerce/ecommerce-ui 7.0.0-canary.21 → 7.0.0
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 +183 -1
- package/components/FormComponents/AutoCompleteElement.tsx +2 -1
- package/components/FormComponents/CheckboxButtonGroup.tsx +1 -0
- package/components/FormComponents/NumberFieldElement.tsx +41 -9
- package/components/FormComponents/PasswordElement.tsx +11 -6
- package/components/FormComponents/TextFieldElement.tsx +3 -11
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,188 @@
|
|
|
1
1
|
# @graphcommerce/ecommerce-ui
|
|
2
2
|
|
|
3
|
-
## 7.0.0
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`e55d8c390`](https://github.com/graphcommerce-org/graphcommerce/commit/e55d8c390d90b4bb7bab11c6a99027ac72bd7e3e) - Created a new sidebar layout system, can be configured with productFiltersLayout in the graphcommerce.config.js ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#1905](https://github.com/graphcommerce-org/graphcommerce/pull/1905) [`b6adbe1c3`](https://github.com/graphcommerce-org/graphcommerce/commit/b6adbe1c304c83c67c9e63f9a95d55ff64718725) - FormComponent elements validation message wasn't translated ([@carlocarels90](https://github.com/carlocarels90))
|
|
16
|
+
|
|
17
|
+
- [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
|
|
18
|
+
|
|
19
|
+
## 6.2.0-canary.98
|
|
20
|
+
|
|
21
|
+
## 6.2.0-canary.97
|
|
22
|
+
|
|
23
|
+
## 6.2.0-canary.96
|
|
24
|
+
|
|
25
|
+
## 6.2.0-canary.95
|
|
26
|
+
|
|
27
|
+
## 6.2.0-canary.94
|
|
28
|
+
|
|
29
|
+
## 6.2.0-canary.93
|
|
30
|
+
|
|
31
|
+
## 6.2.0-canary.92
|
|
32
|
+
|
|
33
|
+
## 6.2.0-canary.91
|
|
34
|
+
|
|
35
|
+
## 6.2.0-canary.90
|
|
36
|
+
|
|
37
|
+
## 6.2.0-canary.89
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
|
|
42
|
+
|
|
43
|
+
## 6.2.0-canary.88
|
|
44
|
+
|
|
45
|
+
## 6.2.0-canary.87
|
|
46
|
+
|
|
47
|
+
## 6.2.0-canary.86
|
|
48
|
+
|
|
49
|
+
## 6.2.0-canary.85
|
|
50
|
+
|
|
51
|
+
## 6.2.0-canary.84
|
|
52
|
+
|
|
53
|
+
## 6.2.0-canary.83
|
|
54
|
+
|
|
55
|
+
## 6.2.0-canary.82
|
|
56
|
+
|
|
57
|
+
## 6.2.0-canary.81
|
|
58
|
+
|
|
59
|
+
## 6.2.0-canary.80
|
|
60
|
+
|
|
61
|
+
## 6.2.0-canary.79
|
|
62
|
+
|
|
63
|
+
## 6.2.0-canary.78
|
|
64
|
+
|
|
65
|
+
## 6.2.0-canary.77
|
|
66
|
+
|
|
67
|
+
## 6.2.0-canary.76
|
|
68
|
+
|
|
69
|
+
## 6.2.0-canary.75
|
|
70
|
+
|
|
71
|
+
## 6.2.0-canary.74
|
|
72
|
+
|
|
73
|
+
## 6.2.0-canary.73
|
|
74
|
+
|
|
75
|
+
## 6.2.0-canary.72
|
|
76
|
+
|
|
77
|
+
## 6.2.0-canary.71
|
|
78
|
+
|
|
79
|
+
## 6.2.0-canary.70
|
|
80
|
+
|
|
81
|
+
## 6.2.0-canary.69
|
|
82
|
+
|
|
83
|
+
## 6.2.0-canary.68
|
|
84
|
+
|
|
85
|
+
## 6.2.0-canary.67
|
|
86
|
+
|
|
87
|
+
## 6.2.0-canary.66
|
|
88
|
+
|
|
89
|
+
## 6.2.0-canary.65
|
|
90
|
+
|
|
91
|
+
## 6.2.0-canary.64
|
|
92
|
+
|
|
93
|
+
## 6.2.0-canary.63
|
|
94
|
+
|
|
95
|
+
## 6.2.0-canary.62
|
|
96
|
+
|
|
97
|
+
## 6.2.0-canary.61
|
|
98
|
+
|
|
99
|
+
## 6.2.0-canary.60
|
|
100
|
+
|
|
101
|
+
## 6.2.0-canary.59
|
|
102
|
+
|
|
103
|
+
## 6.2.0-canary.58
|
|
104
|
+
|
|
105
|
+
## 6.2.0-canary.57
|
|
106
|
+
|
|
107
|
+
## 6.2.0-canary.56
|
|
108
|
+
|
|
109
|
+
## 6.2.0-canary.55
|
|
110
|
+
|
|
111
|
+
## 6.2.0-canary.54
|
|
112
|
+
|
|
113
|
+
## 6.2.0-canary.53
|
|
114
|
+
|
|
115
|
+
## 6.2.0-canary.52
|
|
116
|
+
|
|
117
|
+
## 6.2.0-canary.51
|
|
118
|
+
|
|
119
|
+
## 6.2.0-canary.50
|
|
120
|
+
|
|
121
|
+
### Minor Changes
|
|
122
|
+
|
|
123
|
+
- [`e55d8c390`](https://github.com/graphcommerce-org/graphcommerce/commit/e55d8c390d90b4bb7bab11c6a99027ac72bd7e3e) - Created a new sidebar layout system, can be configured with productFiltersLayout in the graphcommerce.config.js ([@paales](https://github.com/paales))
|
|
124
|
+
|
|
125
|
+
## 6.2.0-canary.49
|
|
126
|
+
|
|
127
|
+
## 6.2.0-canary.48
|
|
128
|
+
|
|
129
|
+
## 6.2.0-canary.47
|
|
130
|
+
|
|
131
|
+
## 6.2.0-canary.46
|
|
132
|
+
|
|
133
|
+
## 6.2.0-canary.45
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
|
|
138
|
+
|
|
139
|
+
## 6.2.0-canary.44
|
|
140
|
+
|
|
141
|
+
## 6.2.0-canary.43
|
|
142
|
+
|
|
143
|
+
## 6.2.0-canary.42
|
|
144
|
+
|
|
145
|
+
## 6.2.0-canary.41
|
|
146
|
+
|
|
147
|
+
## 6.2.0-canary.40
|
|
148
|
+
|
|
149
|
+
## 6.2.0-canary.39
|
|
150
|
+
|
|
151
|
+
## 6.2.0-canary.38
|
|
152
|
+
|
|
153
|
+
## 6.2.0-canary.37
|
|
154
|
+
|
|
155
|
+
## 6.2.0-canary.36
|
|
156
|
+
|
|
157
|
+
## 6.2.0-canary.35
|
|
158
|
+
|
|
159
|
+
## 6.2.0-canary.34
|
|
160
|
+
|
|
161
|
+
## 6.2.0-canary.33
|
|
162
|
+
|
|
163
|
+
## 6.2.0-canary.32
|
|
164
|
+
|
|
165
|
+
## 6.2.0-canary.31
|
|
166
|
+
|
|
167
|
+
## 6.2.0-canary.30
|
|
168
|
+
|
|
169
|
+
## 6.2.0-canary.29
|
|
170
|
+
|
|
171
|
+
## 6.2.0-canary.28
|
|
172
|
+
|
|
173
|
+
## 6.2.0-canary.27
|
|
174
|
+
|
|
175
|
+
## 6.2.0-canary.26
|
|
176
|
+
|
|
177
|
+
## 6.2.0-canary.25
|
|
178
|
+
|
|
179
|
+
## 6.2.0-canary.24
|
|
180
|
+
|
|
181
|
+
## 6.2.0-canary.23
|
|
182
|
+
|
|
183
|
+
## 6.2.0-canary.22
|
|
184
|
+
|
|
185
|
+
## 6.2.0-canary.21
|
|
4
186
|
|
|
5
187
|
## 6.2.0-canary.20
|
|
6
188
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
|
1
2
|
import { Controller, ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
|
|
2
3
|
import { i18n } from '@lingui/core'
|
|
3
4
|
import {
|
|
@@ -87,7 +88,7 @@ export function AutocompleteElement<TFieldValues extends FieldValues>({
|
|
|
87
88
|
isOptionEqualToValue={
|
|
88
89
|
autocompleteProps?.isOptionEqualToValue
|
|
89
90
|
? autocompleteProps.isOptionEqualToValue
|
|
90
|
-
: (option,
|
|
91
|
+
: (option, v) => (v ? option.id === (v?.id || v) : false)
|
|
91
92
|
}
|
|
92
93
|
getOptionLabel={
|
|
93
94
|
autocompleteProps?.getOptionLabel
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
Theme,
|
|
15
15
|
TextField,
|
|
16
16
|
TextFieldProps,
|
|
17
|
+
Fab,
|
|
17
18
|
} from '@mui/material'
|
|
18
19
|
|
|
19
20
|
export type NumberFieldElementProps<T extends FieldValues = FieldValues> = Omit<
|
|
@@ -45,6 +46,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
45
46
|
rules = {},
|
|
46
47
|
required,
|
|
47
48
|
defaultValue,
|
|
49
|
+
variant = 'outlined',
|
|
48
50
|
...textFieldProps
|
|
49
51
|
} = props
|
|
50
52
|
|
|
@@ -66,6 +68,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
66
68
|
return (
|
|
67
69
|
<TextField
|
|
68
70
|
{...textFieldProps}
|
|
71
|
+
variant={variant}
|
|
69
72
|
name={name}
|
|
70
73
|
value={value ?? ''}
|
|
71
74
|
onChange={(ev) => {
|
|
@@ -80,43 +83,71 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
80
83
|
size={size}
|
|
81
84
|
type='number'
|
|
82
85
|
className={`${textFieldProps.className ?? ''} ${classes.quantity}`}
|
|
83
|
-
sx={[
|
|
86
|
+
sx={[
|
|
87
|
+
{
|
|
88
|
+
width: responsiveVal(90, 120),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
'& .MuiOutlinedInput-root': {
|
|
92
|
+
px: '2px',
|
|
93
|
+
display: 'grid',
|
|
94
|
+
gridTemplateColumns: '1fr auto 1fr',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
variant === 'standard' && {
|
|
98
|
+
'& .MuiOutlinedInput-input': {
|
|
99
|
+
padding: 0,
|
|
100
|
+
},
|
|
101
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
102
|
+
display: 'none',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
106
|
+
]}
|
|
84
107
|
autoComplete='off'
|
|
85
108
|
InputProps={{
|
|
86
109
|
...textFieldProps.InputProps,
|
|
87
110
|
startAdornment: (
|
|
88
|
-
<
|
|
111
|
+
<Fab
|
|
89
112
|
aria-label={i18n._(/* i18n */ 'Decrease')}
|
|
90
|
-
size='
|
|
91
|
-
edge='start'
|
|
113
|
+
size='smaller'
|
|
92
114
|
onClick={() => {
|
|
93
115
|
if ((valueAsNumber || Infinity) <= inputProps.min) return
|
|
94
116
|
onChange(value - 1)
|
|
95
117
|
}}
|
|
118
|
+
sx={{
|
|
119
|
+
boxShadow: variant === 'standard' ? 4 : 0,
|
|
120
|
+
minHeight: '30px',
|
|
121
|
+
minWidth: '30px',
|
|
122
|
+
}}
|
|
96
123
|
tabIndex={-1}
|
|
97
124
|
color='inherit'
|
|
98
125
|
{...DownProps}
|
|
99
126
|
className={`${classes.button} ${DownProps.className ?? ''}`}
|
|
100
127
|
>
|
|
101
128
|
{DownProps.children ?? <IconSvg src={iconMin} size='small' />}
|
|
102
|
-
</
|
|
129
|
+
</Fab>
|
|
103
130
|
),
|
|
104
131
|
endAdornment: (
|
|
105
|
-
<
|
|
132
|
+
<Fab
|
|
106
133
|
aria-label={i18n._(/* i18n */ 'Increase')}
|
|
107
|
-
size='
|
|
108
|
-
edge='end'
|
|
134
|
+
size='smaller'
|
|
109
135
|
onClick={() => {
|
|
110
136
|
if (valueAsNumber >= (inputProps.max ?? Infinity)) return
|
|
111
137
|
onChange(valueAsNumber + 1)
|
|
112
138
|
}}
|
|
139
|
+
sx={{
|
|
140
|
+
boxShadow: variant === 'standard' ? 4 : 0,
|
|
141
|
+
minHeight: '30px',
|
|
142
|
+
minWidth: '30px',
|
|
143
|
+
}}
|
|
113
144
|
tabIndex={-1}
|
|
114
145
|
color='inherit'
|
|
115
146
|
{...UpProps}
|
|
116
147
|
className={`${classes.button} ${UpProps.className ?? ''}`}
|
|
117
148
|
>
|
|
118
149
|
{UpProps.children ?? <IconSvg src={iconPlus} size='small' />}
|
|
119
|
-
</
|
|
150
|
+
</Fab>
|
|
120
151
|
),
|
|
121
152
|
}}
|
|
122
153
|
inputProps={{
|
|
@@ -124,6 +155,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
124
155
|
'aria-label': i18n._(/* i18n */ 'Number'),
|
|
125
156
|
className: `${inputProps?.className ?? ''} ${classes.quantityInput}`,
|
|
126
157
|
sx: {
|
|
158
|
+
typography: 'body1',
|
|
127
159
|
textAlign: 'center',
|
|
128
160
|
'&::-webkit-inner-spin-button,&::-webkit-outer-spin-button': {
|
|
129
161
|
appearance: 'none',
|
|
@@ -8,17 +8,21 @@ export type PasswordElementProps<T extends FieldValues> = TextFieldElementProps<
|
|
|
8
8
|
iconColor?: IconButtonProps['color']
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function PasswordElement<TFieldValues extends FieldValues>(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
11
|
+
export function PasswordElement<TFieldValues extends FieldValues>(
|
|
12
|
+
props: PasswordElementProps<TFieldValues>,
|
|
13
|
+
): JSX.Element {
|
|
14
|
+
const { iconColor, ...textFieldProps } = props
|
|
15
15
|
const [password, setPassword] = useState<boolean>(true)
|
|
16
16
|
return (
|
|
17
17
|
<TextFieldElement
|
|
18
|
-
{...
|
|
18
|
+
{...textFieldProps}
|
|
19
19
|
InputProps={{
|
|
20
|
+
...textFieldProps.InputProps,
|
|
20
21
|
endAdornment: (
|
|
21
|
-
<InputAdornment
|
|
22
|
+
<InputAdornment
|
|
23
|
+
position='end'
|
|
24
|
+
sx={(theme) => ({ display: 'flex', columnGap: theme.spacings.xxs })}
|
|
25
|
+
>
|
|
22
26
|
<IconButton
|
|
23
27
|
onMouseDown={(e: MouseEvent<HTMLButtonElement>) => e.preventDefault()}
|
|
24
28
|
onClick={() => setPassword(!password)}
|
|
@@ -27,6 +31,7 @@ export function PasswordElement<TFieldValues extends FieldValues>({
|
|
|
27
31
|
>
|
|
28
32
|
<IconSvg src={password ? iconEyeCrossed : iconEye} size='medium' />
|
|
29
33
|
</IconButton>
|
|
34
|
+
{textFieldProps.InputProps?.endAdornment}
|
|
30
35
|
</InputAdornment>
|
|
31
36
|
),
|
|
32
37
|
}}
|
|
@@ -13,12 +13,10 @@ export type TextFieldElementProps<T extends FieldValues = FieldValues> = Omit<
|
|
|
13
13
|
'name' | 'defaultValue'
|
|
14
14
|
> & {
|
|
15
15
|
validation?: UseControllerProps<T>['rules']
|
|
16
|
-
|
|
17
|
-
} & UseControllerProps<T>
|
|
16
|
+
} & Omit<UseControllerProps<T>, 'rules'>
|
|
18
17
|
|
|
19
18
|
export function TextFieldElement<TFieldValues extends FieldValues>({
|
|
20
19
|
validation = {},
|
|
21
|
-
parseError,
|
|
22
20
|
type,
|
|
23
21
|
required,
|
|
24
22
|
name,
|
|
@@ -59,14 +57,8 @@ export function TextFieldElement<TFieldValues extends FieldValues>({
|
|
|
59
57
|
onBlur={onBlur}
|
|
60
58
|
required={required}
|
|
61
59
|
type={type}
|
|
62
|
-
error={
|
|
63
|
-
helperText={
|
|
64
|
-
error
|
|
65
|
-
? typeof parseError === 'function'
|
|
66
|
-
? parseError(error)
|
|
67
|
-
: error.message
|
|
68
|
-
: rest.helperText
|
|
69
|
-
}
|
|
60
|
+
error={Boolean(error) || rest.error}
|
|
61
|
+
helperText={error ? error.message : rest.helperText}
|
|
70
62
|
inputRef={ref}
|
|
71
63
|
/>
|
|
72
64
|
)}
|
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": "7.0.0
|
|
5
|
+
"version": "7.0.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,18 +12,19 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@graphcommerce/graphql": "7.0.0
|
|
16
|
-
"@graphcommerce/next-ui": "7.0.0
|
|
17
|
-
"@graphcommerce/react-hook-form": "7.0.0
|
|
15
|
+
"@graphcommerce/graphql": "7.0.0",
|
|
16
|
+
"@graphcommerce/next-ui": "7.0.0",
|
|
17
|
+
"@graphcommerce/react-hook-form": "7.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@graphcommerce/eslint-config-pwa": "7.0.0
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "7.0.0
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "7.0.0
|
|
20
|
+
"@graphcommerce/eslint-config-pwa": "7.0.0",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "7.0.0",
|
|
22
|
+
"@graphcommerce/typescript-config-pwa": "7.0.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@lingui/react": "^
|
|
26
|
-
"@lingui/core": "^
|
|
25
|
+
"@lingui/react": "^4.2.1",
|
|
26
|
+
"@lingui/core": "^4.2.1",
|
|
27
|
+
"@lingui/macro": "^4.2.1",
|
|
27
28
|
"@mui/material": "^5.10.16",
|
|
28
29
|
"framer-motion": "^10.0.0",
|
|
29
30
|
"next": "^13.2.0",
|