@graphcommerce/ecommerce-ui 9.0.0-canary.88 → 9.0.0-canary.92

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,17 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 9.0.0-canary.92
4
+
5
+ ## 9.0.0-canary.91
6
+
7
+ ## 9.0.0-canary.90
8
+
9
+ ### Patch Changes
10
+
11
+ - [#2397](https://github.com/graphcommerce-org/graphcommerce/pull/2397) [`d4d5a98`](https://github.com/graphcommerce-org/graphcommerce/commit/d4d5a983dea6d034dcbdeed9cf30fb33133dde39) - Add requireOptionSelection boolean to prevent users from deselecting configurable options ([@carlocarels90](https://github.com/carlocarels90))
12
+
13
+ ## 9.0.0-canary.89
14
+
3
15
  ## 9.0.0-canary.88
4
16
 
5
17
  ## 9.0.0-canary.87
@@ -4,6 +4,8 @@ import React, { MouseEventHandler } from 'react'
4
4
 
5
5
  export type ActionCardItemBase = Pick<ActionCardProps, 'value'>
6
6
 
7
+ export type ActionCardRequireOptionSelection = { requireOptionSelection?: boolean }
8
+
7
9
  export type ActionCardItemRenderProps<T> = ActionCardProps & {
8
10
  onReset: MouseEventHandler<HTMLElement>
9
11
  } & T
@@ -15,7 +17,7 @@ export type ActionCardListFormProps<A, F extends FieldValues = FieldValues> = Om
15
17
  Omit<ControllerProps<F>, 'render'> & {
16
18
  items: A[]
17
19
  render: React.FC<ActionCardItemRenderProps<A>>
18
- }
20
+ } & ActionCardRequireOptionSelection
19
21
 
20
22
  export function ActionCardListForm<
21
23
  T extends ActionCardItemBase,
@@ -33,6 +35,7 @@ export function ActionCardListForm<
33
35
  multiple,
34
36
  disabled,
35
37
  shouldUnregister,
38
+ requireOptionSelection,
36
39
  ...other
37
40
  } = props
38
41
  const RenderItem = render as React.FC<ActionCardItemRenderProps<ActionCardItemBase>>
@@ -76,7 +79,7 @@ export function ActionCardListForm<
76
79
  selected={onSelect(item.value, value)}
77
80
  onReset={(e) => {
78
81
  e.preventDefault()
79
- onChange(null)
82
+ if (!requireOptionSelection) onChange(null)
80
83
  }}
81
84
  />
82
85
  ))}
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.88",
5
+ "version": "9.0.0-canary.92",
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.88",
16
- "@graphcommerce/graphql": "^9.0.0-canary.88",
17
- "@graphcommerce/next-ui": "^9.0.0-canary.88",
18
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.88",
19
- "@graphcommerce/react-hook-form": "^9.0.0-canary.88",
20
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.88",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.92",
16
+ "@graphcommerce/graphql": "^9.0.0-canary.92",
17
+ "@graphcommerce/next-ui": "^9.0.0-canary.92",
18
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.92",
19
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.92",
20
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.92",
21
21
  "@lingui/core": "^4.2.1",
22
22
  "@lingui/macro": "^4.2.1",
23
23
  "@lingui/react": "^4.2.1",