Skip to content

Commit

Permalink
Expose disabled property in IColorCellProps (#28015)
Browse files Browse the repository at this point in the history
* expose disabled property draft

* added change file

* resolved comments

---------

Co-authored-by: Makoto Morimoto <[email protected]>
  • Loading branch information
jessie782 and khmakoto authored Jun 5, 2023
1 parent b8eb759 commit 713a02b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Exposed disabled property in IColorCellProps to allow customers to disable color cells.",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/react/etc/react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3547,6 +3547,7 @@ export interface IColor extends IRGB, IHSV {
// @public (undocumented)
export interface IColorCellProps {
color: string;
disabled?: boolean;
id: string;
index?: number;
label?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ export interface IColorCellProps {
* Index for this option
*/
index?: number;

/**
* Determines if this individual cell is disabled
*/
disabled?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const SwatchColorPickerBase: React.FunctionComponent<ISwatchColorPickerPr
*/
const onCellClick = React.useCallback(
(item: IColorCellProps, event?: React.MouseEvent<HTMLButtonElement>): void => {
if (disabled) {
if (disabled || item.disabled) {
return;
}

Expand Down Expand Up @@ -309,7 +309,7 @@ export const SwatchColorPickerBase: React.FunctionComponent<ISwatchColorPickerPr
idPrefix={id}
color={item.color}
styles={getColorGridCellStyles}
disabled={disabled}
disabled={disabled || item.disabled}
onClick={onCellClick}
onHover={onGridCellHovered}
onFocus={onGridCellFocused}
Expand Down

0 comments on commit 713a02b

Please sign in to comment.