Skip to content

Commit

Permalink
Data: Add disableAlpha prop to CustomGradientPicker and GradientPicke…
Browse files Browse the repository at this point in the history
…r components
  • Loading branch information
wwdes committed Nov 13, 2024
1 parent 5b52c63 commit 79966aa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/components/src/custom-gradient-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const GradientTypePicker = ( {
export function CustomGradientPicker( {
value,
onChange,
disableAlpha = false,
__experimentalIsRenderedInSidebar = false,
}: CustomGradientPickerProps ) {
const { gradientAST, hasGradient } = getGradientAstWithDefault( value );
Expand Down Expand Up @@ -167,6 +168,7 @@ export function CustomGradientPicker( {
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
disableAlpha={ disableAlpha }
background={ background }
hasGradient={ hasGradient }
value={ controlPoints }
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/custom-gradient-picker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/gradient-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export function GradientPicker( {
onChange,
value,
clearable = true,
disableAlpha = false,
disableCustomGradients = false,
__experimentalIsRenderedInSidebar,
headingLevel = 2,
Expand All @@ -230,6 +231,7 @@ export function GradientPicker( {
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
disableAlpha={ disableAlpha }
value={ value }
onChange={ onChange }
/>
Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/gradient-picker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ type GradientPickerBaseProps = {
* @default true
*/
loop?: boolean;
/**
* Whether to disable alpha transparency options in the picker.
*
* @default false
*/
disableAlpha?: boolean;
} & (
| {
/**
Expand Down

0 comments on commit 79966aa

Please sign in to comment.