material-ui-color
material-ui-color copied to clipboard
feat: add a disable prop that disables both textfield and popover
Is your feature request related to a problem? Please describe.
Tried to implement ColorPicker with the condition of only allowing the popover to open under specific circumstances. I noticed there wasn't a clear way to prevent users from opening the popover.
Describe the solution you'd like I'd like to push up a PR with changes that include:
- adding a
disabledprop with typebooleanforColorPicker; and - adding a guard clause to
handleClickinColorPickerto prevent the opening of the popover
const handleClick = () => {
if (disabled) return;
const b = Boolean(refPicker.current);
setOpen(b);
if (onOpen) onOpen(b);
};
This is a minimal and straightforward fix to the aforementioned problem.
Already wrote the solution, the tests, and added to storybook locally.