Skip to content

Commit 7efefe1

Browse files
committed
Rename shiftKey to applyMultiplier
1 parent 25062b2 commit 7efefe1

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

packages/mui-base/src/unstable_useNumberInput/numberInputAction.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ interface NumberInputInputChangeAction {
1919

2020
interface NumberInputIncrementAction {
2121
type: typeof NumberInputActionTypes.increment;
22-
shiftKey: boolean;
22+
applyMultiplier: boolean;
2323
}
2424

2525
interface NumberInputDecrementAction {
2626
type: typeof NumberInputActionTypes.decrement;
27-
shiftKey: boolean;
27+
applyMultiplier: boolean;
2828
}
2929

3030
interface NumberInputIncrementToMaxAction {

packages/mui-base/src/unstable_useNumberInput/numberInputReducer.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe('numberInputReducer', () => {
210210

211211
const action: NumberInputReducerAction = {
212212
type: NumberInputActionTypes.increment,
213-
shiftKey: false,
213+
applyMultiplier: false,
214214
context: {
215215
getInputValueAsString: defaultGetInputValueAsString,
216216
shiftMultiplier: 10,
@@ -231,7 +231,7 @@ describe('numberInputReducer', () => {
231231

232232
const action: NumberInputReducerAction = {
233233
type: NumberInputActionTypes.increment,
234-
shiftKey: false,
234+
applyMultiplier: false,
235235
context: {
236236
getInputValueAsString: defaultGetInputValueAsString,
237237
shiftMultiplier: 10,
@@ -253,7 +253,7 @@ describe('numberInputReducer', () => {
253253

254254
const action: NumberInputReducerAction = {
255255
type: NumberInputActionTypes.increment,
256-
shiftKey: true,
256+
applyMultiplier: true,
257257
context: {
258258
getInputValueAsString: defaultGetInputValueAsString,
259259
shiftMultiplier: 10,
@@ -277,7 +277,7 @@ describe('numberInputReducer', () => {
277277

278278
const action: NumberInputReducerAction = {
279279
type: NumberInputActionTypes.decrement,
280-
shiftKey: false,
280+
applyMultiplier: false,
281281
context: {
282282
getInputValueAsString: defaultGetInputValueAsString,
283283
shiftMultiplier: 10,
@@ -298,7 +298,7 @@ describe('numberInputReducer', () => {
298298

299299
const action: NumberInputReducerAction = {
300300
type: NumberInputActionTypes.decrement,
301-
shiftKey: false,
301+
applyMultiplier: false,
302302
context: {
303303
getInputValueAsString: defaultGetInputValueAsString,
304304
shiftMultiplier: 10,
@@ -320,7 +320,7 @@ describe('numberInputReducer', () => {
320320

321321
const action: NumberInputReducerAction = {
322322
type: NumberInputActionTypes.decrement,
323-
shiftKey: true,
323+
applyMultiplier: true,
324324
context: {
325325
getInputValueAsString: defaultGetInputValueAsString,
326326
shiftMultiplier: 10,

packages/mui-base/src/unstable_useNumberInput/numberInputReducer.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ function handleInputChange<State extends NumberInputState>(
9292
}
9393

9494
// use this for ArrowUp, ArrowDown
95-
// use this with shiftKey: true for PageUp, PageDown
95+
// use this with applyMultiplier: true for PageUp, PageDown
9696
function handleStep<State extends NumberInputState>(
9797
state: State,
9898
context: NumberInputActionContext,
99-
shiftKey: boolean,
99+
applyMultiplier: boolean,
100100
direction: StepDirection,
101101
) {
102-
const multiplier = shiftKey ? context.shiftMultiplier : 1;
102+
const multiplier = applyMultiplier ? context.shiftMultiplier : 1;
103103

104104
const newValue = stepValue(state, context, direction, multiplier);
105105

@@ -141,9 +141,9 @@ export function numberInputReducer(
141141
case NumberInputActionTypes.inputChange:
142142
return handleInputChange(state, context, action.inputValue);
143143
case NumberInputActionTypes.increment:
144-
return handleStep(state, context, action.shiftKey, 'up');
144+
return handleStep(state, context, action.applyMultiplier, 'up');
145145
case NumberInputActionTypes.decrement:
146-
return handleStep(state, context, action.shiftKey, 'down');
146+
return handleStep(state, context, action.applyMultiplier, 'down');
147147
case NumberInputActionTypes.incrementToMax:
148148
return handleToMinOrMax(state, context, 'max');
149149
case NumberInputActionTypes.decrementToMin:

0 commit comments

Comments
 (0)