@graphcommerce/ecommerce-ui 10.0.0-canary.66 → 10.0.0-canary.68
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 +10 -0
- package/components/FormComponents/CheckboxButtonGroup.tsx +10 -1
- package/components/FormComponents/CheckboxElement.tsx +2 -4
- package/components/FormComponents/MultiSelectElement.tsx +10 -5
- package/components/FormComponents/NumberFieldElement.tsx +88 -76
- package/components/FormComponents/RadioButtonGroup.tsx +19 -6
- package/components/FormComponents/TextFieldElement.tsx +13 -10
- package/components/PreviewMode/LightTooltip.tsx +2 -2
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @graphcommerce/ecommerce-ui
|
|
2
2
|
|
|
3
|
+
## 10.0.0-canary.68
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
|
|
8
|
+
|
|
9
|
+
This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
|
|
10
|
+
|
|
11
|
+
## 10.0.0-canary.67
|
|
12
|
+
|
|
3
13
|
## 10.0.0-canary.66
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sxx } from '@graphcommerce/next-ui'
|
|
1
2
|
import type { FieldValues } from '@graphcommerce/react-hook-form'
|
|
2
3
|
import { useController } from '@graphcommerce/react-hook-form'
|
|
3
4
|
import { t } from '@lingui/core/macro'
|
|
@@ -95,7 +96,15 @@ function CheckboxButtonGroupBase(props: CheckboxButtonGroupProps) {
|
|
|
95
96
|
<FormControlLabel
|
|
96
97
|
control={
|
|
97
98
|
<Checkbox
|
|
98
|
-
sx={
|
|
99
|
+
sx={sxx(
|
|
100
|
+
invalid
|
|
101
|
+
? {
|
|
102
|
+
color: theme.vars.palette.error.main,
|
|
103
|
+
}
|
|
104
|
+
: {
|
|
105
|
+
color: null,
|
|
106
|
+
},
|
|
107
|
+
)}
|
|
99
108
|
color={checkboxColor || 'primary'}
|
|
100
109
|
value={optionKey}
|
|
101
110
|
checked={isChecked}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sxx } from '@graphcommerce/next-ui'
|
|
1
2
|
import type { FieldValues } from '@graphcommerce/react-hook-form'
|
|
2
3
|
import { useController } from '@graphcommerce/react-hook-form'
|
|
3
4
|
import { t } from '@lingui/core/macro'
|
|
@@ -76,10 +77,7 @@ function CheckboxElementBase(props: CheckboxElementProps): React.ReactNode {
|
|
|
76
77
|
name={name}
|
|
77
78
|
inputRef={useForkRef(ref, rest.inputRef)}
|
|
78
79
|
color={rest.color || 'primary'}
|
|
79
|
-
sx={{
|
|
80
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
81
|
-
color: invalid ? 'error.main' : undefined,
|
|
82
|
-
}}
|
|
80
|
+
sx={sxx(sx, invalid && { color: 'error.main' })}
|
|
83
81
|
value={value}
|
|
84
82
|
checked={!!value}
|
|
85
83
|
onChange={() => onChange(!value)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import { iconClose, IconSvg } from '@graphcommerce/next-ui'
|
|
2
|
+
import { iconClose, IconSvg, sxx } from '@graphcommerce/next-ui'
|
|
3
3
|
import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
|
|
4
4
|
import { useController } from '@graphcommerce/react-hook-form'
|
|
5
5
|
import { t } from '@lingui/core/macro'
|
|
@@ -153,10 +153,15 @@ export function MultiSelectElement<TFieldValues extends FieldValues>(
|
|
|
153
153
|
<MenuItem
|
|
154
154
|
key={val}
|
|
155
155
|
value={val}
|
|
156
|
-
sx={
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
sx={sxx(
|
|
157
|
+
isChecked
|
|
158
|
+
? {
|
|
159
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
160
|
+
}
|
|
161
|
+
: {
|
|
162
|
+
fontWeight: theme.typography.fontWeightRegular,
|
|
163
|
+
},
|
|
164
|
+
)}
|
|
160
165
|
>
|
|
161
166
|
{showCheckbox && <Checkbox checked={isChecked} />}
|
|
162
167
|
<ListItemText primary={item[itemLabel] || item} />
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
iconPlus,
|
|
5
5
|
IconSvg,
|
|
6
6
|
responsiveVal,
|
|
7
|
+
sxx,
|
|
7
8
|
} from '@graphcommerce/next-ui'
|
|
8
9
|
import type { FieldValues } from '@graphcommerce/react-hook-form'
|
|
9
10
|
import { useController } from '@graphcommerce/react-hook-form'
|
|
@@ -104,14 +105,10 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
|
|
|
104
105
|
size={size}
|
|
105
106
|
type='number'
|
|
106
107
|
className={`${rest.className ?? ''} ${classes.quantity}`}
|
|
107
|
-
sx={
|
|
108
|
+
sx={sxx(
|
|
108
109
|
{
|
|
109
110
|
width: responsiveVal(90, 120),
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
'& input[type=number]': {
|
|
113
|
-
MozAppearance: 'textfield',
|
|
114
|
-
},
|
|
111
|
+
'& input[type=number]': { MozAppearance: 'textfield' },
|
|
115
112
|
'& .MuiOutlinedInput-root': {
|
|
116
113
|
px: '2px',
|
|
117
114
|
display: 'grid',
|
|
@@ -119,78 +116,93 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
|
|
|
119
116
|
},
|
|
120
117
|
},
|
|
121
118
|
variant === 'standard' && {
|
|
122
|
-
'& .MuiOutlinedInput-input': {
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
'& .MuiOutlinedInput-notchedOutline': {
|
|
126
|
-
display: 'none',
|
|
127
|
-
},
|
|
119
|
+
'& .MuiOutlinedInput-input': { padding: 0 },
|
|
120
|
+
'& .MuiOutlinedInput-notchedOutline': { display: 'none' },
|
|
128
121
|
},
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
sx,
|
|
123
|
+
)}
|
|
131
124
|
autoComplete='off'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
125
|
+
slotProps={{
|
|
126
|
+
input: {
|
|
127
|
+
...InputPropsFiltered,
|
|
128
|
+
startAdornment: (
|
|
129
|
+
<Fab
|
|
130
|
+
aria-label={t`Decrease`}
|
|
131
|
+
size='smaller'
|
|
132
|
+
onClick={() => {
|
|
133
|
+
if (
|
|
134
|
+
(valueAsNumber ?? Infinity) <= inputProps.min ||
|
|
135
|
+
(inputProps.min === 0 && valueAsNumber <= inputProps.min)
|
|
136
|
+
)
|
|
137
|
+
return
|
|
138
|
+
// Round to nearest step with precision fix
|
|
139
|
+
const newValue = roundToPrecision(Math.round((valueAsNumber - step) / step) * step)
|
|
140
|
+
onChange(newValue)
|
|
141
|
+
}}
|
|
142
|
+
sx={sxx(
|
|
143
|
+
{
|
|
144
|
+
minHeight: '30px',
|
|
145
|
+
minWidth: '30px',
|
|
146
|
+
},
|
|
147
|
+
variant === 'standard'
|
|
148
|
+
? {
|
|
149
|
+
boxShadow: 4,
|
|
150
|
+
}
|
|
151
|
+
: {
|
|
152
|
+
boxShadow: 0,
|
|
153
|
+
},
|
|
154
|
+
)}
|
|
155
|
+
tabIndex={-1}
|
|
156
|
+
color='inherit'
|
|
157
|
+
{...DownProps}
|
|
158
|
+
className={`${classes.button} ${DownProps.className ?? ''}`}
|
|
159
|
+
>
|
|
160
|
+
{DownProps.children ?? <IconSvg src={iconMin} size='small' />}
|
|
161
|
+
</Fab>
|
|
162
|
+
),
|
|
163
|
+
endAdornment: (
|
|
164
|
+
<Fab
|
|
165
|
+
aria-label={t`Increase`}
|
|
166
|
+
size='smaller'
|
|
167
|
+
onClick={() => {
|
|
168
|
+
if (valueAsNumber >= (inputProps.max ?? Infinity)) return
|
|
169
|
+
// Round to nearest step with precision fix
|
|
170
|
+
const newValue = roundToPrecision(Math.round((valueAsNumber - step) / step) * step)
|
|
171
|
+
onChange(newValue)
|
|
172
|
+
}}
|
|
173
|
+
sx={sxx(
|
|
174
|
+
{
|
|
175
|
+
minHeight: '30px',
|
|
176
|
+
minWidth: '30px',
|
|
177
|
+
},
|
|
178
|
+
variant === 'standard'
|
|
179
|
+
? {
|
|
180
|
+
boxShadow: 4,
|
|
181
|
+
}
|
|
182
|
+
: {
|
|
183
|
+
boxShadow: 0,
|
|
184
|
+
},
|
|
185
|
+
)}
|
|
186
|
+
tabIndex={-1}
|
|
187
|
+
color='inherit'
|
|
188
|
+
{...UpProps}
|
|
189
|
+
className={`${classes.button} ${UpProps.className ?? ''}`}
|
|
190
|
+
>
|
|
191
|
+
{UpProps.children ?? <IconSvg src={iconPlus} size='small' />}
|
|
192
|
+
</Fab>
|
|
193
|
+
),
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
htmlInput: {
|
|
197
|
+
'aria-label': t`Number`,
|
|
198
|
+
...inputProps,
|
|
199
|
+
className: `${inputProps?.className ?? ''} ${classes.quantityInput}`,
|
|
200
|
+
sx: {
|
|
201
|
+
typography: 'body1',
|
|
202
|
+
textAlign: 'center',
|
|
203
|
+
'&::-webkit-inner-spin-button,&::-webkit-outer-spin-button': {
|
|
204
|
+
appearance: 'none',
|
|
205
|
+
},
|
|
194
206
|
},
|
|
195
207
|
},
|
|
196
208
|
}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sxx } from '@graphcommerce/next-ui'
|
|
1
2
|
import type { FieldValues } from '@graphcommerce/react-hook-form'
|
|
2
3
|
import { useController } from '@graphcommerce/react-hook-form'
|
|
3
4
|
import { t } from '@lingui/core/macro'
|
|
@@ -90,9 +91,15 @@ function RadioButtonGroupBase(props: RadioButtonGroupProps): React.ReactNode {
|
|
|
90
91
|
<FormControlLabel
|
|
91
92
|
control={
|
|
92
93
|
<Radio
|
|
93
|
-
sx={
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
sx={sxx(
|
|
95
|
+
invalid
|
|
96
|
+
? {
|
|
97
|
+
color: theme.vars.palette.error.main,
|
|
98
|
+
}
|
|
99
|
+
: {
|
|
100
|
+
color: null,
|
|
101
|
+
},
|
|
102
|
+
)}
|
|
96
103
|
checked={!value}
|
|
97
104
|
/>
|
|
98
105
|
}
|
|
@@ -107,9 +114,15 @@ function RadioButtonGroupBase(props: RadioButtonGroupProps): React.ReactNode {
|
|
|
107
114
|
control={
|
|
108
115
|
<Radio
|
|
109
116
|
disabled={disabled}
|
|
110
|
-
sx={
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
sx={sxx(
|
|
118
|
+
invalid
|
|
119
|
+
? {
|
|
120
|
+
color: theme.vars.palette.error.main,
|
|
121
|
+
}
|
|
122
|
+
: {
|
|
123
|
+
color: null,
|
|
124
|
+
},
|
|
125
|
+
)}
|
|
113
126
|
checked={value === optionKey}
|
|
114
127
|
/>
|
|
115
128
|
}
|
|
@@ -100,7 +100,6 @@ function TextFieldElementBase(props: TextFieldElementProps): React.ReactNode {
|
|
|
100
100
|
onBlur={onBlur}
|
|
101
101
|
name={name}
|
|
102
102
|
value={toValue(value, type)}
|
|
103
|
-
inputProps={{ ...rest.inputProps, onAnimationStart }}
|
|
104
103
|
onChange={(ev) => {
|
|
105
104
|
let changeValue: string | number | Date = ev.target.value
|
|
106
105
|
|
|
@@ -126,15 +125,19 @@ function TextFieldElementBase(props: TextFieldElementProps): React.ReactNode {
|
|
|
126
125
|
type={type}
|
|
127
126
|
error={Boolean(error) || rest.error}
|
|
128
127
|
helperText={error ? error.message : rest.helperText}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
slotProps={{
|
|
129
|
+
input: {
|
|
130
|
+
...rest.InputProps,
|
|
131
|
+
endAdornment:
|
|
132
|
+
showValid && Boolean(value) && !error ? (
|
|
133
|
+
<InputCheckmark show={!error} />
|
|
134
|
+
) : (
|
|
135
|
+
rest.InputProps?.endAdornment
|
|
136
|
+
),
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
htmlInput: { ...rest.inputProps, onAnimationStart },
|
|
140
|
+
inputLabel: { ...rest.InputLabelProps, shrink },
|
|
138
141
|
}}
|
|
139
142
|
/>
|
|
140
143
|
)
|
|
@@ -4,8 +4,8 @@ export const LightTooltip = styled<typeof Tooltip>(({ className, ...props }) =>
|
|
|
4
4
|
<Tooltip {...props} classes={{ popper: className }} />
|
|
5
5
|
))(({ theme }) => ({
|
|
6
6
|
[`& .${tooltipClasses.tooltip}`]: {
|
|
7
|
-
backgroundColor: theme.palette.common.white,
|
|
8
|
-
color: theme.palette.text.primary,
|
|
7
|
+
backgroundColor: theme.vars.palette.common.white,
|
|
8
|
+
color: theme.vars.palette.text.primary,
|
|
9
9
|
boxShadow: theme.shadows[1],
|
|
10
10
|
},
|
|
11
11
|
}))
|
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": "10.0.0-canary.
|
|
5
|
+
"version": "10.0.0-canary.68",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.
|
|
16
|
-
"@graphcommerce/graphql": "^10.0.0-canary.
|
|
17
|
-
"@graphcommerce/next-ui": "^10.0.0-canary.
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^10.0.0-canary.
|
|
19
|
-
"@graphcommerce/react-hook-form": "^10.0.0-canary.
|
|
20
|
-
"@graphcommerce/typescript-config-pwa": "^10.0.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
|
|
16
|
+
"@graphcommerce/graphql": "^10.0.0-canary.68",
|
|
17
|
+
"@graphcommerce/next-ui": "^10.0.0-canary.68",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
|
|
19
|
+
"@graphcommerce/react-hook-form": "^10.0.0-canary.68",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
|
|
21
21
|
"@lingui/core": "^5",
|
|
22
22
|
"@lingui/macro": "^5",
|
|
23
23
|
"@lingui/react": "^5",
|
|
24
|
-
"@mui/material": "^
|
|
24
|
+
"@mui/material": "^7.0.0",
|
|
25
25
|
"framer-motion": "^11.0.0",
|
|
26
26
|
"next": "*",
|
|
27
27
|
"react": "^19.2.0",
|