@graphcommerce/ecommerce-ui 6.2.0-canary.80 → 6.2.0-canary.82
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
|
@@ -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',
|
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.
|
|
5
|
+
"version": "6.2.0-canary.82",
|
|
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.2.0-canary.
|
|
16
|
-
"@graphcommerce/next-ui": "6.2.0-canary.
|
|
17
|
-
"@graphcommerce/react-hook-form": "6.2.0-canary.
|
|
15
|
+
"@graphcommerce/graphql": "6.2.0-canary.82",
|
|
16
|
+
"@graphcommerce/next-ui": "6.2.0-canary.82",
|
|
17
|
+
"@graphcommerce/react-hook-form": "6.2.0-canary.82"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@graphcommerce/eslint-config-pwa": "6.2.0-canary.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "6.2.0-canary.
|
|
20
|
+
"@graphcommerce/eslint-config-pwa": "6.2.0-canary.82",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.82",
|
|
22
|
+
"@graphcommerce/typescript-config-pwa": "6.2.0-canary.82"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@lingui/react": "^4.2.1",
|