Skip to content

Commit b24faf6

Browse files
authored
Rename commitInputValue to commit (#1538)
1 parent be92ac0 commit b24faf6

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

packages/@react-aria/color/src/useHexColorField.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function useHexColorField(
4141
colorValue,
4242
inputValue,
4343
setInputValue,
44-
commitInputValue,
44+
commit,
4545
increment,
4646
decrement,
4747
incrementToMax,
@@ -94,7 +94,7 @@ export function useHexColorField(
9494
'aria-valuenow': null,
9595
'aria-valuetext': null,
9696
autoCorrect: 'off',
97-
onBlur: commitInputValue,
97+
onBlur: commit,
9898
onWheel
9999
})
100100
};

packages/@react-aria/numberfield/src/useNumberField.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
7777
decrement,
7878
decrementToMin,
7979
numberValue,
80-
commitInputValue
80+
commit
8181
} = state;
8282

8383
const formatMessage = useMessageFormatter(intlMessages);
@@ -87,7 +87,7 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
8787
let {focusProps} = useFocus({
8888
onBlur: () => {
8989
// Set input value to normalized valid value
90-
commitInputValue();
90+
commit();
9191
}
9292
});
9393

packages/@react-spectrum/color/test/HexColorField.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('HexColorField', function () {
102102
let hexColorField = getByLabelText('Primary Color');
103103
expect(hexColorField.value).toBe('');
104104

105-
// call commitInputValue to re-verify that a colorValue is not set in state
105+
// call commit to re-verify that a colorValue is not set in state
106106
act(() => {hexColorField.focus();});
107107
act(() => {hexColorField.blur();});
108108
expect(hexColorField.value).toBe('');

packages/@react-stately/color/src/useHexColorFieldState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ export function useHexColorFieldState(
8585
}
8686
};
8787

88-
let commitInputValue = () => {
88+
let commit = () => {
8989
setInputValue(colorValue ? colorValue.toString('hex') : '');
9090
};
9191

9292
return {
9393
colorValue,
9494
inputValue,
9595
setInputValue: setFieldInputValue,
96-
commitInputValue,
96+
commit,
9797
increment,
9898
incrementToMax,
9999
decrement,

packages/@react-stately/color/test/useHexColorFieldState.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('useHexColorFieldState tests', function () {
9797
act(() => result.current.setInputValue('ab'));
9898
expect(result.current.inputValue).toBe('ab');
9999

100-
act(() => result.current.commitInputValue());
100+
act(() => result.current.commit());
101101
expect(result.current.inputValue).toBe('#AABBCC');
102102
expect(onChangeSpy).not.toHaveBeenCalled();
103103
});

packages/@react-stately/numberfield/src/useNumberFieldState.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface NumberFieldState {
2323
decrementToMin: () => void,
2424
canIncrement: boolean,
2525
canDecrement: boolean,
26-
commitInputValue: () => void,
26+
commit: () => void,
2727
minValue: number,
2828
maxValue: number,
2929
numberValue: number,
@@ -76,7 +76,7 @@ export function useNumberFieldState(
7676
let parsed = useRef(0);
7777
parsed.current = parsedValue;
7878

79-
let commitInputValue = () => {
79+
let commit = () => {
8080
// Set to empty state if input value is empty
8181
if (!inputValue.length) {
8282
setNumberValue(NaN);
@@ -207,7 +207,7 @@ export function useNumberFieldState(
207207
numberValue: parsedValue,
208208
setInputValue,
209209
inputValue,
210-
commitInputValue
210+
commit
211211
};
212212
}
213213

0 commit comments

Comments
 (0)