From 79966aaf03f6ef1cab12d565fa4c232e354a4d3d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 13 Nov 2024 17:10:02 +0100 Subject: [PATCH] Data: Add disableAlpha prop to CustomGradientPicker and GradientPicker components --- packages/components/src/custom-gradient-picker/index.tsx | 2 ++ packages/components/src/custom-gradient-picker/types.ts | 4 ++++ packages/components/src/gradient-picker/index.tsx | 2 ++ packages/components/src/gradient-picker/types.ts | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/packages/components/src/custom-gradient-picker/index.tsx b/packages/components/src/custom-gradient-picker/index.tsx index dd0659515234a6..b5dad67cb6b39e 100644 --- a/packages/components/src/custom-gradient-picker/index.tsx +++ b/packages/components/src/custom-gradient-picker/index.tsx @@ -140,6 +140,7 @@ const GradientTypePicker = ( { export function CustomGradientPicker( { value, onChange, + disableAlpha = false, __experimentalIsRenderedInSidebar = false, }: CustomGradientPickerProps ) { const { gradientAST, hasGradient } = getGradientAstWithDefault( value ); @@ -167,6 +168,7 @@ export function CustomGradientPicker( { __experimentalIsRenderedInSidebar={ __experimentalIsRenderedInSidebar } + disableAlpha={ disableAlpha } background={ background } hasGradient={ hasGradient } value={ controlPoints } diff --git a/packages/components/src/custom-gradient-picker/types.ts b/packages/components/src/custom-gradient-picker/types.ts index f9efb90799daf2..5c702069ae9e99 100644 --- a/packages/components/src/custom-gradient-picker/types.ts +++ b/packages/components/src/custom-gradient-picker/types.ts @@ -26,6 +26,10 @@ export type CustomGradientPickerProps = { * the `currentGradient` as an argument. */ onChange: ( currentGradient: string ) => void; + /** + * Whether to disable alpha transparency options in the picker. + */ + disableAlpha?: boolean; /** * Whether this is rendered in the sidebar. * diff --git a/packages/components/src/gradient-picker/index.tsx b/packages/components/src/gradient-picker/index.tsx index 8368279b8afd70..15244b78cbbde3 100644 --- a/packages/components/src/gradient-picker/index.tsx +++ b/packages/components/src/gradient-picker/index.tsx @@ -213,6 +213,7 @@ export function GradientPicker( { onChange, value, clearable = true, + disableAlpha = false, disableCustomGradients = false, __experimentalIsRenderedInSidebar, headingLevel = 2, @@ -230,6 +231,7 @@ export function GradientPicker( { __experimentalIsRenderedInSidebar={ __experimentalIsRenderedInSidebar } + disableAlpha={ disableAlpha } value={ value } onChange={ onChange } /> diff --git a/packages/components/src/gradient-picker/types.ts b/packages/components/src/gradient-picker/types.ts index b563653e33e4c4..7531a32320ed8c 100644 --- a/packages/components/src/gradient-picker/types.ts +++ b/packages/components/src/gradient-picker/types.ts @@ -56,6 +56,12 @@ type GradientPickerBaseProps = { * @default true */ loop?: boolean; + /** + * Whether to disable alpha transparency options in the picker. + * + * @default false + */ + disableAlpha?: boolean; } & ( | { /**