@graphcommerce/ecommerce-ui 9.0.0-canary.101 → 9.0.0-canary.104

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +47 -1018
  2. package/components/ApolloError/ApolloErrorAlert.tsx +3 -3
  3. package/components/ApolloError/ApolloErrorFullPage.tsx +4 -3
  4. package/components/ApolloError/ApolloErrorSnackbar.tsx +3 -2
  5. package/components/ApolloError/maskNetworkError.tsx +1 -1
  6. package/components/ComposedSubmitButton/ComposedSubmitButton.tsx +3 -2
  7. package/components/ComposedSubmitButton/ComposedSubmitLinkOrButton.tsx +3 -2
  8. package/components/FormComponents/ActionCardListForm.tsx +6 -3
  9. package/components/FormComponents/AutoCompleteElement.tsx +8 -15
  10. package/components/FormComponents/CheckboxButtonGroup.tsx +11 -3
  11. package/components/FormComponents/CheckboxElement.tsx +4 -7
  12. package/components/FormComponents/EmailElement.tsx +4 -2
  13. package/components/FormComponents/MultiSelectElement.tsx +6 -3
  14. package/components/FormComponents/NumberFieldElement.tsx +8 -10
  15. package/components/FormComponents/PasswordElement.tsx +8 -5
  16. package/components/FormComponents/PasswordRepeatElement.tsx +4 -2
  17. package/components/FormComponents/RadioButtonGroup.tsx +6 -3
  18. package/components/FormComponents/SelectElement.tsx +5 -7
  19. package/components/FormComponents/SliderElement.tsx +4 -14
  20. package/components/FormComponents/SwitchElement.tsx +4 -2
  21. package/components/FormComponents/TelephoneElement.tsx +4 -2
  22. package/components/FormComponents/TextFieldElement.tsx +4 -7
  23. package/components/FormComponents/ToggleButtonGroup.tsx +6 -12
  24. package/components/PreviewMode/LightTooltip.tsx +1 -1
  25. package/components/PreviewMode/PreviewMode.tsx +2 -1
  26. package/components/PreviewMode/PreviewModeActions.tsx +2 -2
  27. package/components/PreviewMode/PreviewModeToolbar.tsx +1 -1
  28. package/components/PreviewMode/previewModeDefaults.ts +1 -1
  29. package/components/PreviewMode/usePreviewModeForm.ts +1 -1
  30. package/components/WaitForQueries/WaitForQueries.tsx +3 -6
  31. package/package.json +8 -8
  32. package/route/preview.ts +2 -2
@@ -1,7 +1,7 @@
1
- import { ApolloError } from '@graphcommerce/graphql'
1
+ import type { ApolloError } from '@graphcommerce/graphql'
2
2
  import { extendableComponent } from '@graphcommerce/next-ui/Styles/extendableComponent'
3
- import { Trans } from '@lingui/react'
4
- import { AlertProps, Alert, Box, SxProps, Theme } from '@mui/material'
3
+ import type { AlertProps, SxProps, Theme } from '@mui/material'
4
+ import { Alert, Box } from '@mui/material'
5
5
  import { maskNetworkError } from './maskNetworkError'
6
6
 
7
7
  const { classes, selectors } = extendableComponent('ApolloErrorAlert', ['root', 'alert'] as const)
@@ -1,7 +1,8 @@
1
- import { ApolloError } from '@graphcommerce/graphql'
2
- import { FullPageMessage, FullPageMessageProps } from '@graphcommerce/next-ui'
1
+ import type { ApolloError } from '@graphcommerce/graphql'
2
+ import type { FullPageMessageProps } from '@graphcommerce/next-ui'
3
+ import { FullPageMessage } from '@graphcommerce/next-ui'
3
4
  import { Trans } from '@lingui/react'
4
- import { AlertProps } from '@mui/material'
5
+ import type { AlertProps } from '@mui/material'
5
6
  import { ApolloErrorAlert } from './ApolloErrorAlert'
6
7
  import { maskNetworkError } from './maskNetworkError'
7
8
 
@@ -1,5 +1,6 @@
1
- import { ApolloError } from '@graphcommerce/graphql'
2
- import { ErrorSnackbar, ErrorSnackbarProps } from '@graphcommerce/next-ui'
1
+ import type { ApolloError } from '@graphcommerce/graphql'
2
+ import type { ErrorSnackbarProps } from '@graphcommerce/next-ui'
3
+ import { ErrorSnackbar } from '@graphcommerce/next-ui'
3
4
  import { maskNetworkError } from './maskNetworkError'
4
5
 
5
6
  export type ApolloErrorSnackbarProps = {
@@ -1,4 +1,4 @@
1
- import { ServerError, ServerParseError } from '@graphcommerce/graphql'
1
+ import type { ServerError, ServerParseError } from '@graphcommerce/graphql'
2
2
  import { Trans } from '@lingui/react'
3
3
 
4
4
  function isServerError(error: Error | ServerParseError | ServerError | null): error is ServerError {
@@ -1,5 +1,6 @@
1
- import { iconChevronRight, IconSvg, Button, ButtonProps } from '@graphcommerce/next-ui'
2
- import { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
1
+ import type { ButtonProps } from '@graphcommerce/next-ui'
2
+ import { Button, IconSvg, iconChevronRight } from '@graphcommerce/next-ui'
3
+ import type { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
3
4
  import { forwardRef } from 'react'
4
5
 
5
6
  type ComposedSubmitButtonProps = ComposedSubmitRenderComponentProps &
@@ -1,5 +1,6 @@
1
- import { iconChevronRight, LinkOrButton, LinkOrButtonProps, IconSvg } from '@graphcommerce/next-ui'
2
- import { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
1
+ import type { LinkOrButtonProps } from '@graphcommerce/next-ui'
2
+ import { IconSvg, LinkOrButton, iconChevronRight } from '@graphcommerce/next-ui'
3
+ import type { ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
3
4
  import { forwardRef } from 'react'
4
5
 
5
6
  type ComposedLinkOrButtonProps = ComposedSubmitRenderComponentProps &
@@ -1,6 +1,9 @@
1
- import { ActionCardList, ActionCardListProps, ActionCardProps } from '@graphcommerce/next-ui'
2
- import { ControllerProps, FieldValues, useController } from '@graphcommerce/react-hook-form'
3
- import React, { MouseEventHandler, useCallback } from 'react'
1
+ import type { ActionCardListProps, ActionCardProps } from '@graphcommerce/next-ui'
2
+ import { ActionCardList } from '@graphcommerce/next-ui'
3
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
4
+ import { useController } from '@graphcommerce/react-hook-form'
5
+ import type { MouseEventHandler } from 'react'
6
+ import React, { useCallback } from 'react'
4
7
 
5
8
  export type ActionCardItemBase = Pick<ActionCardProps, 'value'>
6
9
 
@@ -1,19 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-restricted-imports */
2
- import {
3
- Controller,
4
- ControllerProps,
5
- FieldValues,
6
- useController,
7
- } from '@graphcommerce/react-hook-form'
2
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
3
+ import { useController } from '@graphcommerce/react-hook-form'
8
4
  import { i18n } from '@lingui/core'
9
- import {
10
- Autocomplete,
11
- AutocompleteProps,
12
- Checkbox,
13
- TextField,
14
- TextFieldProps,
15
- CircularProgress,
16
- } from '@mui/material'
5
+ import type { AutocompleteProps, TextFieldProps } from '@mui/material'
6
+ import { Autocomplete, Checkbox, CircularProgress, TextField } from '@mui/material'
17
7
 
18
8
  export type AutocompleteElementProps<
19
9
  F extends FieldValues,
@@ -29,6 +19,7 @@ export type AutocompleteElementProps<
29
19
  label?: TextFieldProps['label']
30
20
  showCheckbox?: boolean
31
21
  autocompleteProps?: Omit<
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
23
  AutocompleteProps<T, M, D, any>,
33
24
  'name' | 'options' | 'loading' | 'renderInput'
34
25
  >
@@ -58,6 +49,7 @@ export function AutocompleteElement<TFieldValues extends FieldValues>({
58
49
  shouldUnregister,
59
50
  }: AutocompleteElementProps<
60
51
  TFieldValues,
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
53
  AutoDefault | string | any,
62
54
  boolean | undefined,
63
55
  boolean | undefined
@@ -85,7 +77,8 @@ export function AutocompleteElement<TFieldValues extends FieldValues>({
85
77
  let currentValue = multiple ? value || [] : value || null
86
78
  if (matchId) {
87
79
  currentValue = multiple
88
- ? values.map((i: any) => options.find((j) => (j.id || j) === i))
80
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ values.map((i: any) => options.find((j) => (j.id || j) === i))
89
82
  : options.find((i) => (i.id || i) === value) || null
90
83
  }
91
84
 
@@ -1,8 +1,9 @@
1
- import { useController, FieldValues, UseControllerProps } from '@graphcommerce/react-hook-form'
1
+ import type { FieldValues, UseControllerProps } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
2
3
  import { i18n } from '@lingui/core'
4
+ import type { CheckboxProps } from '@mui/material'
3
5
  import {
4
6
  Checkbox,
5
- CheckboxProps,
6
7
  FormControl,
7
8
  FormControlLabel,
8
9
  FormGroup,
@@ -12,12 +13,14 @@ import {
12
13
  } from '@mui/material'
13
14
 
14
15
  export type CheckboxButtonGroupProps<T extends FieldValues> = {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
17
  options: { id: string | number; label: string }[] | any[]
16
18
  helperText?: string
17
19
  required?: boolean
18
20
  label?: string
19
21
  labelKey?: string
20
22
  valueKey?: string
23
+ // eslint-disable-next-line @typescript-eslint/ban-types
21
24
  onChange?: Function
22
25
  returnObject?: boolean
23
26
  disabled?: boolean
@@ -62,13 +65,17 @@ export function CheckboxButtonGroup<TFieldValues extends FieldValues>(
62
65
  const parsedHelperText = error ? error.message : helperText
63
66
 
64
67
  const handleChange = (index: number | string) => {
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
69
  const newArray: (string | number)[] | any[] = [...value]
66
70
  const exists =
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
72
  value.findIndex((i: any) => (returnObject ? i[valueKey] === index : i === index)) === -1
68
73
  if (exists) {
74
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
69
75
  newArray.push(returnObject ? options.find((i) => i[valueKey] === index) : index)
70
76
  } else {
71
77
  newArray.splice(
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
79
  value.findIndex((i: any) => (returnObject ? i[valueKey] === index : i === index)),
73
80
  1,
74
81
  )
@@ -93,7 +100,7 @@ export function CheckboxButtonGroup<TFieldValues extends FieldValues>(
93
100
  )
94
101
  }
95
102
  const isChecked =
96
- value.findIndex((item: any) =>
103
+ value.findIndex((item) =>
97
104
  returnObject ? item[valueKey] === optionKey : item === optionKey,
98
105
  ) !== -1
99
106
  return (
@@ -107,6 +114,7 @@ export function CheckboxButtonGroup<TFieldValues extends FieldValues>(
107
114
  value={optionKey}
108
115
  checked={isChecked}
109
116
  disabled={disabled}
117
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
110
118
  onChange={() => handleChange(optionKey)}
111
119
  />
112
120
  }
@@ -1,17 +1,14 @@
1
- import { ControllerProps, FieldValues, useController } from '@graphcommerce/react-hook-form'
1
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
2
3
  import { i18n } from '@lingui/core'
3
- import {
4
- Checkbox,
4
+ import type {
5
5
  CheckboxProps,
6
- FormControl,
7
- FormControlLabel,
8
6
  FormControlLabelProps,
9
7
  FormControlProps,
10
- FormGroup,
11
- FormHelperText,
12
8
  SxProps,
13
9
  Theme,
14
10
  } from '@mui/material'
11
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@mui/material'
15
12
 
16
13
  export type CheckboxElementProps<T extends FieldValues> = Omit<CheckboxProps, 'name'> & {
17
14
  label?: FormControlLabelProps['label']
@@ -1,7 +1,9 @@
1
- import { emailPattern, FieldValues } from '@graphcommerce/react-hook-form'
1
+ import type { FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { emailPattern } from '@graphcommerce/react-hook-form'
2
3
  import { i18n } from '@lingui/core'
3
4
  import { Trans } from '@lingui/react'
4
- import { TextFieldElement, TextFieldElementProps } from './TextFieldElement'
5
+ import type { TextFieldElementProps } from './TextFieldElement'
6
+ import { TextFieldElement } from './TextFieldElement'
5
7
 
6
8
  export type EmailElementProps<T extends FieldValues> = TextFieldElementProps<T>
7
9
 
@@ -1,21 +1,22 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import { IconSvg, iconClose } from '@graphcommerce/next-ui'
3
- import { FieldValues, ControllerProps, useController } from '@graphcommerce/react-hook-form'
3
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
4
+ import { useController } from '@graphcommerce/react-hook-form'
4
5
  import { i18n } from '@lingui/core'
6
+ import type { FormControlProps, SelectProps } from '@mui/material'
5
7
  import {
6
8
  Checkbox,
7
9
  Chip,
8
10
  FormControl,
9
- FormControlProps,
10
11
  FormHelperText,
11
12
  InputLabel,
12
13
  ListItemText,
13
14
  MenuItem,
14
15
  Select,
15
- SelectProps,
16
16
  } from '@mui/material'
17
17
 
18
18
  export type MultiSelectElementProps<T extends FieldValues> = Omit<SelectProps, 'value'> & {
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
20
  options: { id: string | number; label: string }[] | any[]
20
21
  label?: string
21
22
  itemKey?: string
@@ -127,12 +128,14 @@ export function MultiSelectElement<TFieldValues extends FieldValues>(
127
128
  : showChips
128
129
  ? (selected) => (
129
130
  <div style={{ display: 'flex', flexWrap: 'wrap' }}>
131
+ {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
130
132
  {((selected as any[]) || []).map((selectedValue) => (
131
133
  <Chip
132
134
  key={selectedValue}
133
135
  label={selectedValue}
134
136
  style={{ display: 'flex', flexWrap: 'wrap' }}
135
137
  onDelete={() => {
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
139
  onChange(value.filter((i: any) => i !== selectedValue))
137
140
  // setValue(name, formValue.filter((i: any) => i !== value), { shouldValidate: true })
138
141
  }}
@@ -1,18 +1,15 @@
1
1
  import {
2
+ IconSvg,
2
3
  extendableComponent,
3
4
  iconMin,
4
5
  iconPlus,
5
- IconSvg,
6
6
  responsiveVal,
7
7
  } from '@graphcommerce/next-ui'
8
- import {
9
- Controller,
10
- ControllerProps,
11
- FieldValues,
12
- useController,
13
- } from '@graphcommerce/react-hook-form'
8
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
9
+ import { Controller, useController } from '@graphcommerce/react-hook-form'
14
10
  import { i18n } from '@lingui/core'
15
- import { IconButtonProps, SxProps, Theme, TextField, TextFieldProps, Fab } from '@mui/material'
11
+ import type { IconButtonProps, SxProps, TextFieldProps, Theme } from '@mui/material'
12
+ import { Fab, TextField } from '@mui/material'
16
13
 
17
14
  export type NumberFieldElementProps<T extends FieldValues = FieldValues> = Omit<
18
15
  TextFieldProps,
@@ -24,7 +21,7 @@ export type NumberFieldElementProps<T extends FieldValues = FieldValues> = Omit<
24
21
  } & Omit<ControllerProps<T>, 'render'>
25
22
 
26
23
  type OwnerState = { size?: 'small' | 'medium' }
27
- const componentName = 'TextInputNumber' as const
24
+ const componentName = 'TextInputNumber'
28
25
  const parts = ['quantity', 'quantityInput', 'button'] as const
29
26
  const { withState } = extendableComponent<OwnerState, typeof componentName, typeof parts>(
30
27
  componentName,
@@ -36,6 +33,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
36
33
  DownProps = {},
37
34
  UpProps = {},
38
35
  inputProps = {},
36
+ InputProps = {},
39
37
  sx = [],
40
38
  size = 'medium',
41
39
  control,
@@ -113,7 +111,7 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
113
111
  ]}
114
112
  autoComplete='off'
115
113
  InputProps={{
116
- ...textFieldProps.InputProps,
114
+ ...InputProps,
117
115
  startAdornment: (
118
116
  <Fab
119
117
  aria-label={i18n._(/* i18n */ 'Decrease')}
@@ -1,8 +1,11 @@
1
- import { iconEye, iconEyeCrossed, IconSvg } from '@graphcommerce/next-ui'
2
- import { FieldValues } from '@graphcommerce/react-hook-form'
3
- import { IconButton, IconButtonProps, InputAdornment } from '@mui/material'
4
- import { MouseEvent, useState } from 'react'
5
- import { TextFieldElement, TextFieldElementProps } from './TextFieldElement'
1
+ import { IconSvg, iconEye, iconEyeCrossed } from '@graphcommerce/next-ui'
2
+ import type { FieldValues } from '@graphcommerce/react-hook-form'
3
+ import type { IconButtonProps } from '@mui/material'
4
+ import { IconButton, InputAdornment } from '@mui/material'
5
+ import type { MouseEvent } from 'react'
6
+ import { useState } from 'react'
7
+ import type { TextFieldElementProps } from './TextFieldElement'
8
+ import { TextFieldElement } from './TextFieldElement'
6
9
 
7
10
  export type PasswordElementProps<T extends FieldValues> = TextFieldElementProps<T> & {
8
11
  iconColor?: IconButtonProps['color']
@@ -1,6 +1,8 @@
1
- import { useWatch, FieldValues } from '@graphcommerce/react-hook-form'
1
+ import type { FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { useWatch } from '@graphcommerce/react-hook-form'
2
3
  import { i18n } from '@lingui/core'
3
- import { PasswordElement, PasswordElementProps } from './PasswordElement'
4
+ import type { PasswordElementProps } from './PasswordElement'
5
+ import { PasswordElement } from './PasswordElement'
4
6
 
5
7
  export type PasswordRepeatElementProps<T extends FieldValues> = PasswordElementProps<T> & {
6
8
  passwordFieldName: PasswordElementProps<T>['name']
@@ -1,4 +1,5 @@
1
- import { useController, FieldValues, UseControllerProps } from '@graphcommerce/react-hook-form'
1
+ import type { FieldValues, UseControllerProps } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
2
3
  import { i18n } from '@lingui/core'
3
4
  import {
4
5
  FormControl,
@@ -9,9 +10,10 @@ import {
9
10
  RadioGroup,
10
11
  useTheme,
11
12
  } from '@mui/material'
12
- import { ChangeEvent } from 'react'
13
+ import type { ChangeEvent } from 'react'
13
14
 
14
15
  export type RadioButtonGroupProps<T extends FieldValues> = {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
17
  options: { label: string; id: string | number }[] | any[]
16
18
  helperText?: string
17
19
  required?: boolean
@@ -20,6 +22,7 @@ export type RadioButtonGroupProps<T extends FieldValues> = {
20
22
  valueKey?: string
21
23
  type?: 'number' | 'string'
22
24
  emptyOptionLabel?: 'string'
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
26
  onChange?: (value: any) => void
24
27
  returnObject?: boolean
25
28
  row?: boolean
@@ -95,7 +98,7 @@ export function RadioButtonGroup<TFieldValues extends FieldValues>(
95
98
  value=''
96
99
  />
97
100
  )}
98
- {options.map((option: any) => {
101
+ {options.map((option) => {
99
102
  const optionKey = option[valueKey]
100
103
  if (!optionKey) {
101
104
  console.error(
@@ -1,12 +1,9 @@
1
1
  import { InputCheckmark } from '@graphcommerce/next-ui'
2
- import {
3
- Controller,
4
- ControllerProps,
5
- FieldValues,
6
- useController,
7
- } from '@graphcommerce/react-hook-form'
2
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
3
+ import { useController } from '@graphcommerce/react-hook-form'
8
4
  import { i18n } from '@lingui/core'
9
- import { MenuItem, TextField, TextFieldProps } from '@mui/material'
5
+ import type { TextFieldProps } from '@mui/material'
6
+ import { MenuItem, TextField } from '@mui/material'
10
7
 
11
8
  type OptionBase = { id: string | number; label: string | number }
12
9
 
@@ -87,6 +84,7 @@ export function SelectElement<TFieldValues extends FieldValues, O extends Option
87
84
  ),
88
85
  }}
89
86
  >
87
+ {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
90
88
  {isNativeSelect && <option />}
91
89
  {options.map((item) => (
92
90
  <ChildComponent key={item.id} value={item.id}>
@@ -1,18 +1,8 @@
1
- import {
2
- ControllerProps,
3
- FieldError,
4
- FieldValues,
5
- useController,
6
- } from '@graphcommerce/react-hook-form'
1
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
7
3
  import { i18n } from '@lingui/core'
8
- import {
9
- FormControl,
10
- FormControlProps,
11
- FormHelperText,
12
- FormLabel,
13
- Slider,
14
- SliderProps,
15
- } from '@mui/material'
4
+ import type { FormControlProps, SliderProps } from '@mui/material'
5
+ import { FormControl, FormHelperText, FormLabel, Slider } from '@mui/material'
16
6
 
17
7
  export type SliderElementProps<T extends FieldValues> = Omit<SliderProps, 'control'> & {
18
8
  label?: string
@@ -1,5 +1,7 @@
1
- import { FieldValues, ControllerProps, useController } from '@graphcommerce/react-hook-form'
2
- import { FormControlLabel, FormControlLabelProps, Switch } from '@mui/material'
1
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
3
+ import type { FormControlLabelProps } from '@mui/material'
4
+ import { FormControlLabel, Switch } from '@mui/material'
3
5
 
4
6
  type IProps = Omit<FormControlLabelProps, 'control'>
5
7
 
@@ -1,6 +1,8 @@
1
- import { FieldValues, phonePattern } from '@graphcommerce/react-hook-form'
1
+ import type { FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { phonePattern } from '@graphcommerce/react-hook-form'
2
3
  import { Trans, t } from '@lingui/macro'
3
- import { TextFieldElement, TextFieldElementProps } from './TextFieldElement'
4
+ import type { TextFieldElementProps } from './TextFieldElement'
5
+ import { TextFieldElement } from './TextFieldElement'
4
6
 
5
7
  export type TelephoneElementProps<T extends FieldValues> = TextFieldElementProps<T>
6
8
 
@@ -1,13 +1,10 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import { InputCheckmark } from '@graphcommerce/next-ui'
3
- import {
4
- FieldValues,
5
- UseControllerProps,
6
- emailPattern,
7
- useController,
8
- } from '@graphcommerce/react-hook-form'
3
+ import type { FieldValues, UseControllerProps } from '@graphcommerce/react-hook-form'
4
+ import { emailPattern, useController } from '@graphcommerce/react-hook-form'
9
5
  import { i18n } from '@lingui/core'
10
- import { TextField, TextFieldProps } from '@mui/material'
6
+ import type { TextFieldProps } from '@mui/material'
7
+ import { TextField } from '@mui/material'
11
8
  import React, { useState } from 'react'
12
9
 
13
10
  export type TextFieldElementProps<T extends FieldValues = FieldValues> = Omit<
@@ -1,21 +1,15 @@
1
- import {
2
- ControllerProps,
3
- FieldError,
4
- FieldValues,
5
- useController,
6
- } from '@graphcommerce/react-hook-form'
1
+ import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
2
+ import { useController } from '@graphcommerce/react-hook-form'
7
3
  import { i18n } from '@lingui/core'
4
+ import type { FormLabelProps, ToggleButtonGroupProps, ToggleButtonProps } from '@mui/material'
8
5
  import {
9
6
  FormControl,
10
7
  FormHelperText,
11
8
  FormLabel,
12
- FormLabelProps,
13
9
  ToggleButton,
14
10
  ToggleButtonGroup,
15
- ToggleButtonGroupProps,
16
- ToggleButtonProps,
17
11
  } from '@mui/material'
18
- import { ReactNode } from 'react'
12
+ import type { ReactNode } from 'react'
19
13
 
20
14
  type SingleToggleButtonProps = Omit<ToggleButtonProps, 'value' | 'children'> & {
21
15
  id: number | string
@@ -87,9 +81,9 @@ export function ToggleButtonGroupElement<TFieldValues extends FieldValues = Fiel
87
81
  }
88
82
  }}
89
83
  >
90
- {options.map(({ label, id, ...toggleProps }) => (
84
+ {options.map(({ label: labelVal, id, ...toggleProps }) => (
91
85
  <ToggleButton value={id} {...toggleProps} key={id}>
92
- {label}
86
+ {labelVal}
93
87
  </ToggleButton>
94
88
  ))}
95
89
  </ToggleButtonGroup>
@@ -1,4 +1,4 @@
1
- import { styled, Tooltip, tooltipClasses } from '@mui/material'
1
+ import { Tooltip, styled, tooltipClasses } from '@mui/material'
2
2
 
3
3
  export const LightTooltip = styled<typeof Tooltip>(({ className, ...props }) => (
4
4
  <Tooltip {...props} classes={{ popper: className }} />
@@ -1,4 +1,4 @@
1
- import { PreviewData } from '@graphcommerce/graphql'
1
+ import type { PreviewData } from '@graphcommerce/graphql'
2
2
  import {
3
3
  IconSvg,
4
4
  MessageSnackbar,
@@ -47,6 +47,7 @@ function PreviewModeEnabled() {
47
47
  const revalidateHandler = form.handleSubmit((formValues) => {
48
48
  const url = getPreviewUrl()
49
49
  Object.entries(formValues).forEach(([key, value]) => {
50
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
50
51
  url.searchParams.append(key, `${value}`)
51
52
  })
52
53
  url.searchParams.append('action', 'revalidate')
@@ -1,6 +1,6 @@
1
1
  export type PreviewModeActionsProps = Record<string, unknown>
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
4
  export function PreviewModeActions(props: PreviewModeActionsProps) {
4
- const {} = props
5
- return <></>
5
+ return null
6
6
  }
@@ -1,6 +1,6 @@
1
1
  export type PreviewModeToolbarProps = Record<string, unknown>
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
4
  export function PreviewModeToolbar(props: PreviewModeToolbarProps) {
4
- const {} = props
5
5
  return null
6
6
  }
@@ -1,4 +1,4 @@
1
- import { PreviewData } from '@graphcommerce/graphql'
1
+ import type { PreviewData } from '@graphcommerce/graphql'
2
2
 
3
3
  export function previewModeDefaults(): PreviewData {
4
4
  return {}
@@ -1,4 +1,4 @@
1
- import { PreviewData } from '@graphcommerce/graphql'
1
+ import type { PreviewData } from '@graphcommerce/graphql'
2
2
  import { useFormContext } from '@graphcommerce/react-hook-form'
3
3
 
4
4
  export function usePreviewModeForm() {
@@ -1,19 +1,16 @@
1
- import { QueryResult } from '@graphcommerce/graphql'
1
+ import type { QueryResult } from '@graphcommerce/graphql'
2
2
  import { useIsSSR } from '@graphcommerce/next-ui'
3
3
  import React from 'react'
4
4
 
5
5
  export type WaitForQueriesProps = {
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
7
  waitFor: QueryResult<any, any> | boolean | (QueryResult<any, any> | boolean)[] | undefined
7
- /**
8
- * @deprecated Will be automatically correct.
9
- */
10
- noSsr?: boolean
11
8
  children: React.ReactNode
12
9
  fallback?: React.ReactNode
13
10
  }
14
11
 
15
12
  /** Shows the fallback during: SSR, Hydration and Query Loading. */
16
- export const WaitForQueries = (props: WaitForQueriesProps) => {
13
+ export function WaitForQueries(props: WaitForQueriesProps) {
17
14
  const { waitFor, fallback, children } = props
18
15
 
19
16
  const mounted = !useIsSSR()
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.101",
5
+ "version": "9.0.0-canary.104",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,17 +12,17 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.101",
16
- "@graphcommerce/graphql": "^9.0.0-canary.101",
17
- "@graphcommerce/next-ui": "^9.0.0-canary.101",
18
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.101",
19
- "@graphcommerce/react-hook-form": "^9.0.0-canary.101",
20
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.101",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.104",
16
+ "@graphcommerce/graphql": "^9.0.0-canary.104",
17
+ "@graphcommerce/next-ui": "^9.0.0-canary.104",
18
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.104",
19
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.104",
20
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.104",
21
21
  "@lingui/core": "^4.2.1",
22
22
  "@lingui/macro": "^4.2.1",
23
23
  "@lingui/react": "^4.2.1",
24
24
  "@mui/material": "^5.10.16",
25
- "framer-motion": "^10.0.0",
25
+ "framer-motion": "^11.0.0",
26
26
  "next": "*",
27
27
  "react": "^18.2.0",
28
28
  "react-dom": "^18.2.0"
package/route/preview.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PreviewData } from '@graphcommerce/graphql'
2
- import { NextApiRequest, NextApiResponse } from 'next'
1
+ import type { PreviewData } from '@graphcommerce/graphql'
2
+ import type { NextApiRequest, NextApiResponse } from 'next'
3
3
  import { previewModeDefaults } from '../components/PreviewMode/previewModeDefaults'
4
4
 
5
5
  export default async function handler(req: NextApiRequest, res: NextApiResponse) {