react-spectrum
879cbbdd - Create HexColorField component (#986)

Commit
5 years ago
Create HexColorField component (#986) * Bootstrap @react-stately/color package * Fix lint of plop template * initial commit * initial files for hexcolorfield * update descriptions * added react-types * add stories and test files * starting files for docs site * added color interface * add hooks in aria and stately * update aria file names * start component from numberfield * initial work for useHexColorFieldState * update stately useHexColorFieldState * don't use optional textValue in stately * useHexColorFieldState increment * add tests for increment * added decrement with tests * validation for useHexColorFieldState * test updates * added tests for increment, decrement * initialization updates * test for setColorValue * fix lint errors * fix more lint errors * fix more lint errors * add test for controlled state * updated tests for controlled, uncontrolled * added docs for useHexColorFieldState * start react-aria useHexColorField * simpler HexColorField component * update aria and spectrum * add test for aria useHexColorField * update react-stately hook * fix lint errors * add keyboard events for increment/decrement * utils for parsing color * removed validation logic from useHexColorFieldState * added story for step * fix lint errors * stately updates * updated onblur and onchange for useHexColorField * added test for commitInputValue * fix lint errors * aria + stately updates * stately updates * fix test and lint errors * undo local jest update * added tests for color * added aria tests * onchange, onblur tests for aria * removed docs files * add back mergeProps again * move min/max value defaults to stately * fix lint errors * added role prop for aria * added story for placeholder * stately updates for invalid value props provided * comment updates * no text when no value or default value is provided * mouse wheel event support * story for min/max clamping * story as a popover * updated stories and stately * updated commitinputvalue * fix lint errors * update useHexColorField interface * test outline for spectrum component * initial tests for react-spectrum * second set of tests for react-spectrum * third batch of tests for react-spectrum * fourth set of tests for react-spectrum * remove screen from, add act to react-spectrum tests * use Omit for HexColorFieldState * new ref for every test in useHexColorField * updates for defaults test in HexColorField * added tests for controlled in accepted values * updated HexColorField tests with keyUp + keyDown pairs * updated HexColorField test for placeholder * added onChange assertions in HexColorField * fixed lint warnings * remove eslint-disable in useHexColorField * fix lint error, warning * fixed test error * used typeText for HexColorField tests * added story for controlled value * use let * fix lint error, update controlled story * merge entire spinbutton props * fix lint error * more lint fixes * add useColor hook * initial refactor to use useColor * useColor for useHexColorField and HexColorField stories * update increment, decrement for unnecessary onchange calls * HexColorField test updates for increment, decrement changes * updates to incrementToMax, decrementToMin for onChange calls * should not trigger onchange when color value is the same * fix lint errors * minor, rename variables * added onChangeSpy checks after onBlur * fix lint error * more generic clamp * clamp updates * clamp min and max values * tests for clamp min and max * fix lint error * valid hex characters only * lint error * fixe for incrementToMax, decrementToMin * fixes for decrement * add comment for disabled lines * update test to use hex number instead of int * useCallback for increment, decrement * storybook fix * fix lint error * wrap userEvent in act * use already calculated string for setInputValue in increment, decrement * forgot to save merge conflict fixes * change Color.toHexInt to hex number format * initial refactor for removing min/max props * useHexColorFieldState test updates for removing min/max props * added test for useColor * test update for useHexColorField * test updates for HexColorField, with min/max props removed * clear colorValue when input is cleared * test updates for new onChange behavior * fix for controlled story * do not import min and maxColor in test * rename minColor and maxColor to MIN_COLOR and MAX_COLOR * remove tests for PageUp, PageDown keys * update toHexInt * use constants for Math.pow * Apply suggestions from code review Co-authored-by: Daniel Lu <dlu@livefyre.com> * more resolve merge conflicts * update test for scroll * use onWheel prop for wheel events * don't export constants; don't use useCallback * added autoCorrect * use bitwise operators * update useColor * update regex for input * increment, decrement logic in one function * update for addColorValue * useEffect on stately * stately update * stately update * fix for setState warning + tests Co-authored-by: Devon Govett <devongovett@gmail.com> Co-authored-by: Emir Mercado <emir@ermercado.com> Co-authored-by: Danni <drobinson@livefyre.com> Co-authored-by: Daniel Lu <dlu@livefyre.com>
Author
Parents
Loading