@graphcommerce/ecommerce-ui 6.2.0-canary.8 → 6.2.0-canary.80

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
@@ -1,5 +1,157 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 6.2.0-canary.80
4
+
5
+ ## 6.2.0-canary.79
6
+
7
+ ## 6.2.0-canary.78
8
+
9
+ ## 6.2.0-canary.77
10
+
11
+ ## 6.2.0-canary.76
12
+
13
+ ## 6.2.0-canary.75
14
+
15
+ ## 6.2.0-canary.74
16
+
17
+ ## 6.2.0-canary.73
18
+
19
+ ## 6.2.0-canary.72
20
+
21
+ ## 6.2.0-canary.71
22
+
23
+ ## 6.2.0-canary.70
24
+
25
+ ## 6.2.0-canary.69
26
+
27
+ ## 6.2.0-canary.68
28
+
29
+ ## 6.2.0-canary.67
30
+
31
+ ## 6.2.0-canary.66
32
+
33
+ ## 6.2.0-canary.65
34
+
35
+ ## 6.2.0-canary.64
36
+
37
+ ## 6.2.0-canary.63
38
+
39
+ ## 6.2.0-canary.62
40
+
41
+ ## 6.2.0-canary.61
42
+
43
+ ## 6.2.0-canary.60
44
+
45
+ ## 6.2.0-canary.59
46
+
47
+ ## 6.2.0-canary.58
48
+
49
+ ## 6.2.0-canary.57
50
+
51
+ ## 6.2.0-canary.56
52
+
53
+ ## 6.2.0-canary.55
54
+
55
+ ## 6.2.0-canary.54
56
+
57
+ ## 6.2.0-canary.53
58
+
59
+ ## 6.2.0-canary.52
60
+
61
+ ## 6.2.0-canary.51
62
+
63
+ ## 6.2.0-canary.50
64
+
65
+ ### Minor Changes
66
+
67
+ - [`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))
68
+
69
+ ## 6.2.0-canary.49
70
+
71
+ ## 6.2.0-canary.48
72
+
73
+ ## 6.2.0-canary.47
74
+
75
+ ## 6.2.0-canary.46
76
+
77
+ ## 6.2.0-canary.45
78
+
79
+ ### Minor Changes
80
+
81
+ - [#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))
82
+
83
+ ## 6.2.0-canary.44
84
+
85
+ ## 6.2.0-canary.43
86
+
87
+ ## 6.2.0-canary.42
88
+
89
+ ## 6.2.0-canary.41
90
+
91
+ ## 6.2.0-canary.40
92
+
93
+ ## 6.2.0-canary.39
94
+
95
+ ## 6.2.0-canary.38
96
+
97
+ ## 6.2.0-canary.37
98
+
99
+ ## 6.2.0-canary.36
100
+
101
+ ## 6.2.0-canary.35
102
+
103
+ ## 6.2.0-canary.34
104
+
105
+ ## 6.2.0-canary.33
106
+
107
+ ## 6.2.0-canary.32
108
+
109
+ ## 6.2.0-canary.31
110
+
111
+ ## 6.2.0-canary.30
112
+
113
+ ## 6.2.0-canary.29
114
+
115
+ ## 6.2.0-canary.28
116
+
117
+ ## 6.2.0-canary.27
118
+
119
+ ## 6.2.0-canary.26
120
+
121
+ ## 6.2.0-canary.25
122
+
123
+ ## 6.2.0-canary.24
124
+
125
+ ## 6.2.0-canary.23
126
+
127
+ ## 6.2.0-canary.22
128
+
129
+ ## 6.2.0-canary.21
130
+
131
+ ## 6.2.0-canary.20
132
+
133
+ ## 6.2.0-canary.19
134
+
135
+ ## 6.2.0-canary.18
136
+
137
+ ## 6.2.0-canary.17
138
+
139
+ ## 6.2.0-canary.16
140
+
141
+ ## 6.2.0-canary.15
142
+
143
+ ## 6.2.0-canary.14
144
+
145
+ ## 6.2.0-canary.13
146
+
147
+ ## 6.2.0-canary.12
148
+
149
+ ## 6.2.0-canary.11
150
+
151
+ ## 6.2.0-canary.10
152
+
153
+ ## 6.2.0-canary.9
154
+
3
155
  ## 6.2.0-canary.8
4
156
 
5
157
  ## 6.2.0-canary.7
@@ -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
- iconColor,
13
- ...props
14
- }: PasswordElementProps<TFieldValues>): JSX.Element {
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
- {...props}
18
+ {...textFieldProps}
19
19
  InputProps={{
20
+ ...textFieldProps.InputProps,
20
21
  endAdornment: (
21
- <InputAdornment position='end'>
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
  }}
@@ -2,32 +2,28 @@ import { Controller, ControllerProps, FieldValues } from '@graphcommerce/react-h
2
2
  import { i18n } from '@lingui/core'
3
3
  import { MenuItem, TextField, TextFieldProps } from '@mui/material'
4
4
 
5
- export type SelectElementProps<T extends FieldValues> = Omit<
5
+ type OptionBase = { id: string | number; label: string | number }
6
+
7
+ export type SelectElementProps<T extends FieldValues, O extends OptionBase> = Omit<
6
8
  TextFieldProps,
7
9
  'name' | 'type' | 'onChange' | 'defaultValue'
8
10
  > & {
9
11
  validation?: ControllerProps<T>['rules']
10
- options?: { id: string | number; label: string | number }[] | any[]
11
- valueKey?: string
12
- labelKey?: string
12
+ options?: O[]
13
13
  type?: 'string' | 'number'
14
- objectOnChange?: boolean
15
- onChange?: (value: any) => void
14
+ onChange?: (value: string | number) => void
16
15
  } & Omit<ControllerProps<T>, 'render'>
17
16
 
18
- export function SelectElement<TFieldValues extends FieldValues>({
17
+ export function SelectElement<TFieldValues extends FieldValues, O extends OptionBase>({
19
18
  name,
20
19
  required,
21
- valueKey = 'id',
22
- labelKey = 'label',
23
20
  options = [],
24
21
  type,
25
- objectOnChange,
26
22
  validation = {},
27
23
  control,
28
24
  defaultValue,
29
25
  ...rest
30
- }: SelectElementProps<TFieldValues>): JSX.Element {
26
+ }: SelectElementProps<TFieldValues, O>): JSX.Element {
31
27
  const isNativeSelect = !!rest.SelectProps?.native
32
28
  const ChildComponent = isNativeSelect ? 'option' : MenuItem
33
29
 
@@ -55,17 +51,10 @@ export function SelectElement<TFieldValues extends FieldValues>({
55
51
  value={value ?? ''}
56
52
  onBlur={onBlur}
57
53
  onChange={(event) => {
58
- let item: number | string = event.target.value
59
- if (type === 'number') {
60
- item = Number(item)
61
- }
54
+ let item: number | string | O | undefined = event.target.value
55
+ if (type === 'number') item = Number(item)
56
+ rest.onChange?.(item)
62
57
  onChange(item)
63
- if (typeof rest.onChange === 'function') {
64
- if (objectOnChange) {
65
- item = options.find((i) => i[valueKey] === item)
66
- }
67
- rest.onChange(item)
68
- }
69
58
  }}
70
59
  select
71
60
  required={required}
@@ -73,9 +62,9 @@ export function SelectElement<TFieldValues extends FieldValues>({
73
62
  helperText={error ? error.message : rest.helperText}
74
63
  >
75
64
  {isNativeSelect && <option />}
76
- {options.map((item: any) => (
77
- <ChildComponent key={item[valueKey]} value={item[valueKey]}>
78
- {item[labelKey]}
65
+ {options.map((item) => (
66
+ <ChildComponent key={item.id} value={item.id}>
67
+ {item.label}
79
68
  </ChildComponent>
80
69
  ))}
81
70
  </TextField>
@@ -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
- parseError?: (error: FieldError) => string
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={!!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": "6.2.0-canary.8",
5
+ "version": "6.2.0-canary.80",
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": "6.2.0-canary.8",
16
- "@graphcommerce/next-ui": "6.2.0-canary.8",
17
- "@graphcommerce/react-hook-form": "6.2.0-canary.8"
15
+ "@graphcommerce/graphql": "6.2.0-canary.80",
16
+ "@graphcommerce/next-ui": "6.2.0-canary.80",
17
+ "@graphcommerce/react-hook-form": "6.2.0-canary.80"
18
18
  },
19
19
  "devDependencies": {
20
- "@graphcommerce/eslint-config-pwa": "6.2.0-canary.8",
21
- "@graphcommerce/prettier-config-pwa": "6.2.0-canary.8",
22
- "@graphcommerce/typescript-config-pwa": "6.2.0-canary.8"
20
+ "@graphcommerce/eslint-config-pwa": "6.2.0-canary.80",
21
+ "@graphcommerce/prettier-config-pwa": "6.2.0-canary.80",
22
+ "@graphcommerce/typescript-config-pwa": "6.2.0-canary.80"
23
23
  },
24
24
  "peerDependencies": {
25
- "@lingui/react": "^3.13.2",
26
- "@lingui/core": "^3.13.2",
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",