@graphcommerce/ecommerce-ui 9.0.0-canary.106 → 9.0.0-canary.108

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,21 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 9.0.0-canary.108
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2424](https://github.com/graphcommerce-org/graphcommerce/pull/2424) [`66b4188`](https://github.com/graphcommerce-org/graphcommerce/commit/66b418809ad4db2a465c4112ff9850ce0cfe611c) - Omit disableUnderline prop for ‘outlined’ variant, because its not supported. ([@carlocarels90](https://github.com/carlocarels90))
8
+
9
+ - [#2438](https://github.com/graphcommerce-org/graphcommerce/pull/2438) [`cb8d2f0`](https://github.com/graphcommerce-org/graphcommerce/commit/cb8d2f0059d64242260e30ce34655868f204ef4c) - Made all component prop types exported ([@bramvanderholst](https://github.com/bramvanderholst))
10
+
11
+ - [#2438](https://github.com/graphcommerce-org/graphcommerce/pull/2438) [`49937fd`](https://github.com/graphcommerce-org/graphcommerce/commit/49937fd765338e25899d427ee4d799fa7978faeb) - Allow changing various props for internal components ([@bramvanderholst](https://github.com/bramvanderholst))
12
+
13
+ ## 9.0.0-canary.107
14
+
15
+ ### Patch Changes
16
+
17
+ - [#2436](https://github.com/graphcommerce-org/graphcommerce/pull/2436) [`55f94c5`](https://github.com/graphcommerce-org/graphcommerce/commit/55f94c5dd70e88b8fbfb46e75b500db296937c33) - Added ref forwarding for the inputRef ([@paales](https://github.com/paales))
18
+
3
19
  ## 9.0.0-canary.106
4
20
 
5
21
  ## 9.0.0-canary.105
@@ -8,7 +8,7 @@ export type ApolloErrorSnackbarProps = {
8
8
  } & Pick<ErrorSnackbarProps, 'action' | 'onClose'>
9
9
 
10
10
  export function ApolloErrorSnackbar(props: ApolloErrorSnackbarProps) {
11
- const { error, action, ...passedProps } = props
11
+ const { error, ...passedProps } = props
12
12
 
13
13
  if (!error) return null
14
14
 
@@ -3,7 +3,7 @@ import { Button, IconSvg, iconChevronRight } from '@graphcommerce/next-ui'
3
3
  import type { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
4
4
  import { forwardRef } from 'react'
5
5
 
6
- type ComposedSubmitButtonProps = ComposedSubmitRenderComponentProps &
6
+ export type ComposedSubmitButtonProps = ComposedSubmitRenderComponentProps &
7
7
  Omit<ButtonProps, 'loading' | 'onSubmit'>
8
8
 
9
9
  /** Makes a ComposedSubmitRenderComponent rendered as a LinkOrButton */
@@ -3,7 +3,7 @@ import { IconSvg, LinkOrButton, iconChevronRight } from '@graphcommerce/next-ui'
3
3
  import type { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
4
4
  import { forwardRef } from 'react'
5
5
 
6
- type ComposedLinkOrButtonProps = ComposedSubmitRenderComponentProps &
6
+ export type ComposedLinkOrButtonProps = ComposedSubmitRenderComponentProps &
7
7
  Omit<LinkOrButtonProps, 'loading'>
8
8
 
9
9
  /** Makes a ComposedSubmitRenderComponent rendered as a LinkOrButton */
@@ -8,7 +8,14 @@ import type {
8
8
  SxProps,
9
9
  Theme,
10
10
  } from '@mui/material'
11
- import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@mui/material'
11
+ import {
12
+ Checkbox,
13
+ FormControl,
14
+ FormControlLabel,
15
+ FormGroup,
16
+ FormHelperText,
17
+ useForkRef,
18
+ } from '@mui/material'
12
19
 
13
20
  export type CheckboxElementProps<T extends FieldValues> = Omit<CheckboxProps, 'name'> & {
14
21
  label?: FormControlLabelProps['label']
@@ -62,7 +69,7 @@ export function CheckboxElement<TFieldValues extends FieldValues>(
62
69
  <Checkbox
63
70
  {...rest}
64
71
  {...field}
65
- inputRef={ref}
72
+ inputRef={useForkRef(ref, rest.inputRef)}
66
73
  color={rest.color || 'primary'}
67
74
  sx={{
68
75
  ...(Array.isArray(sx) ? sx : [sx]),
@@ -1,15 +1,15 @@
1
1
  import {
2
- IconSvg,
3
2
  extendableComponent,
4
3
  iconMin,
5
4
  iconPlus,
5
+ IconSvg,
6
6
  responsiveVal,
7
7
  } from '@graphcommerce/next-ui'
8
8
  import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
9
9
  import { Controller, useController } from '@graphcommerce/react-hook-form'
10
10
  import { i18n } from '@lingui/core'
11
11
  import type { IconButtonProps, SxProps, TextFieldProps, Theme } from '@mui/material'
12
- import { Fab, TextField } from '@mui/material'
12
+ import { Fab, TextField, useForkRef } from '@mui/material'
13
13
 
14
14
  export type NumberFieldElementProps<T extends FieldValues = FieldValues> = Omit<
15
15
  TextFieldProps,
@@ -44,11 +44,18 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
44
44
  variant = 'outlined',
45
45
  disabled,
46
46
  shouldUnregister,
47
- ...textFieldProps
47
+ ...rest
48
48
  } = props
49
49
 
50
50
  const classes = withState({ size })
51
51
 
52
+ let InputPropsFiltered = InputProps
53
+
54
+ if (variant === 'outlined' && 'disableUnderline' in InputPropsFiltered) {
55
+ const { disableUnderline, ...filteredInputProps } = InputPropsFiltered
56
+ InputPropsFiltered = filteredInputProps
57
+ }
58
+
52
59
  if (required && !rules.required) {
53
60
  rules.required = i18n._(/* i18n */ 'This field is required')
54
61
  }
@@ -69,22 +76,22 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
69
76
 
70
77
  return (
71
78
  <TextField
72
- {...textFieldProps}
79
+ {...rest}
73
80
  {...field}
74
- inputRef={ref}
81
+ inputRef={useForkRef(ref, rest.inputRef)}
75
82
  value={value ?? ''}
76
83
  onChange={(ev) => {
77
84
  const newValue = (ev.target as HTMLInputElement).valueAsNumber
78
85
  onChange(Number.isNaN(newValue) ? '' : newValue)
79
- textFieldProps.onChange?.(ev)
86
+ rest.onChange?.(ev)
80
87
  }}
81
88
  variant={variant}
82
89
  required={required}
83
90
  error={invalid}
84
- helperText={error ? error.message : textFieldProps.helperText}
91
+ helperText={error ? error.message : rest.helperText}
85
92
  size={size}
86
93
  type='number'
87
- className={`${textFieldProps.className ?? ''} ${classes.quantity}`}
94
+ className={`${rest.className ?? ''} ${classes.quantity}`}
88
95
  sx={[
89
96
  {
90
97
  width: responsiveVal(90, 120),
@@ -111,7 +118,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
111
118
  ]}
112
119
  autoComplete='off'
113
120
  InputProps={{
114
- ...InputProps,
121
+ ...InputPropsFiltered,
115
122
  startAdornment: (
116
123
  <Fab
117
124
  aria-label={i18n._(/* i18n */ 'Decrease')}
@@ -3,7 +3,7 @@ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-for
3
3
  import { useController } from '@graphcommerce/react-hook-form'
4
4
  import { i18n } from '@lingui/core'
5
5
  import type { TextFieldProps } from '@mui/material'
6
- import { MenuItem, TextField } from '@mui/material'
6
+ import { MenuItem, TextField, useForkRef } from '@mui/material'
7
7
 
8
8
  type OptionBase = { id: string | number; label: string | number }
9
9
 
@@ -63,7 +63,7 @@ export function SelectElement<TFieldValues extends FieldValues, O extends Option
63
63
  {...rest}
64
64
  value={value ?? ''}
65
65
  {...field}
66
- inputRef={ref}
66
+ inputRef={useForkRef(ref, rest.inputRef)}
67
67
  onChange={(event) => {
68
68
  let item: number | string | O | undefined = event.target.value
69
69
  if (type === 'number') item = Number(item)
@@ -4,7 +4,7 @@ import type { FieldValues, UseControllerProps } from '@graphcommerce/react-hook-
4
4
  import { emailPattern, useController } from '@graphcommerce/react-hook-form'
5
5
  import { i18n } from '@lingui/core'
6
6
  import type { TextFieldProps } from '@mui/material'
7
- import { TextField } from '@mui/material'
7
+ import { TextField, useForkRef } from '@mui/material'
8
8
  import React, { useState } from 'react'
9
9
 
10
10
  export type TextFieldElementProps<T extends FieldValues = FieldValues> = Omit<
@@ -68,7 +68,7 @@ export function TextFieldElement<TFieldValues extends FieldValues>({
68
68
  onChange(type === 'number' && ev.target.value ? Number(ev.target.value) : ev.target.value)
69
69
  rest.onChange?.(ev)
70
70
  }}
71
- inputRef={ref}
71
+ inputRef={useForkRef(ref, rest.inputRef)}
72
72
  required={required}
73
73
  type={type}
74
74
  error={Boolean(error) || rest.error}
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": "9.0.0-canary.106",
5
+ "version": "9.0.0-canary.108",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,12 +12,12 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.106",
16
- "@graphcommerce/graphql": "^9.0.0-canary.106",
17
- "@graphcommerce/next-ui": "^9.0.0-canary.106",
18
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.106",
19
- "@graphcommerce/react-hook-form": "^9.0.0-canary.106",
20
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.106",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.108",
16
+ "@graphcommerce/graphql": "^9.0.0-canary.108",
17
+ "@graphcommerce/next-ui": "^9.0.0-canary.108",
18
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.108",
19
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.108",
20
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.108",
21
21
  "@lingui/core": "^4.2.1",
22
22
  "@lingui/macro": "^4.2.1",
23
23
  "@lingui/react": "^4.2.1",