Skip to content

Provide ColorField input (CMEM-7327)#374

Open
haschek wants to merge 12 commits intodevelopfrom
feature/colorWheelInput-CMEM-7327
Open

Provide ColorField input (CMEM-7327)#374
haschek wants to merge 12 commits intodevelopfrom
feature/colorWheelInput-CMEM-7327

Conversation

@haschek
Copy link
Member

@haschek haschek commented Mar 3, 2026

  • replace native picker
  • provide palette colors

@haschek haschek marked this pull request as ready for review March 9, 2026 11:01
disabled = (!disableNativePicker && !allowCustomColor) || otherTextFieldProps.disabled;
};
updateConfig();
React.useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd suggest to memo the computation here. useEffect is for side effects.

*/
ColorField.calculateColorHashValue = (
text: string,
options: calculateColorHashValueProps = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same values as the as in the Color'Field props default, define them only once.

}, [allowCustomColor, includeColorWeight, includePaletteGroup, otherTextFieldProps]);

React.useEffect(() => {
setColorValue(defaultValue || value || "#000000");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forwardOnChange(e);
}}
>
<Tooltip key={idx} content={color[0].replace(`${eccgui}-color-palette-`, "")}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, why idx is used here, an not on the parent RadioButton

setColorValue(defaultValue || value || "#000000");
}, [defaultValue, value]);

const forwardOnChange = (forwardedEvent: React.ChangeEvent<HTMLInputElement>) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor remark: this could be inlined

}

const getEnabledColorsFromPaletteCache = new Map<string, Color[]>();
const getEnabledColorPropertiesFromPaletteCache = new Map<string, string[][]>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string[][] is there perhaps a better type for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants