Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
[18000] Fix | Delete
switch (keyCode) {
[18001] Fix | Delete
case external_wp_keycodes_["UP"]:
[18002] Fix | Delete
pressUp(event);
[18003] Fix | Delete
break;
[18004] Fix | Delete
[18005] Fix | Delete
case external_wp_keycodes_["DOWN"]:
[18006] Fix | Delete
pressDown(event);
[18007] Fix | Delete
break;
[18008] Fix | Delete
[18009] Fix | Delete
case external_wp_keycodes_["ENTER"]:
[18010] Fix | Delete
pressEnter(event);
[18011] Fix | Delete
[18012] Fix | Delete
if (isPressEnterToChange) {
[18013] Fix | Delete
event.preventDefault();
[18014] Fix | Delete
handleOnCommit(event);
[18015] Fix | Delete
}
[18016] Fix | Delete
[18017] Fix | Delete
break;
[18018] Fix | Delete
}
[18019] Fix | Delete
};
[18020] Fix | Delete
[18021] Fix | Delete
var dragGestureProps = useDrag(function (dragProps) {
[18022] Fix | Delete
var distance = dragProps.distance,
[18023] Fix | Delete
dragging = dragProps.dragging,
[18024] Fix | Delete
event = dragProps.event;
[18025] Fix | Delete
if (!distance) return;
[18026] Fix | Delete
event.stopPropagation();
[18027] Fix | Delete
/**
[18028] Fix | Delete
* Quick return if no longer dragging.
[18029] Fix | Delete
* This prevents unnecessary value calculations.
[18030] Fix | Delete
*/
[18031] Fix | Delete
[18032] Fix | Delete
if (!dragging) {
[18033] Fix | Delete
onDragEnd(dragProps);
[18034] Fix | Delete
dragEnd(dragProps);
[18035] Fix | Delete
return;
[18036] Fix | Delete
}
[18037] Fix | Delete
[18038] Fix | Delete
onDrag(dragProps);
[18039] Fix | Delete
drag(dragProps);
[18040] Fix | Delete
[18041] Fix | Delete
if (!isDragging) {
[18042] Fix | Delete
onDragStart(dragProps);
[18043] Fix | Delete
dragStart(dragProps);
[18044] Fix | Delete
}
[18045] Fix | Delete
}, {
[18046] Fix | Delete
threshold: dragThreshold,
[18047] Fix | Delete
enabled: isDragEnabled
[18048] Fix | Delete
});
[18049] Fix | Delete
var dragProps = isDragEnabled ? dragGestureProps() : {};
[18050] Fix | Delete
return Object(external_wp_element_["createElement"])(input_control_styles_Input, Object(esm_extends["a" /* default */])({}, props, dragProps, {
[18051] Fix | Delete
className: "components-input-control__input",
[18052] Fix | Delete
disabled: disabled,
[18053] Fix | Delete
dragCursor: dragCursor,
[18054] Fix | Delete
isDragging: isDragging,
[18055] Fix | Delete
id: id,
[18056] Fix | Delete
onBlur: handleOnBlur,
[18057] Fix | Delete
onChange: handleOnChange,
[18058] Fix | Delete
onFocus: handleOnFocus,
[18059] Fix | Delete
onKeyDown: handleOnKeyDown,
[18060] Fix | Delete
ref: ref,
[18061] Fix | Delete
size: size,
[18062] Fix | Delete
value: value,
[18063] Fix | Delete
type: type
[18064] Fix | Delete
}));
[18065] Fix | Delete
}
[18066] Fix | Delete
[18067] Fix | Delete
var ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputField);
[18068] Fix | Delete
/* harmony default export */ var input_field = (ForwardedComponent);
[18069] Fix | Delete
[18070] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
[18071] Fix | Delete
[18072] Fix | Delete
[18073] Fix | Delete
[18074] Fix | Delete
[18075] Fix | Delete
[18076] Fix | Delete
/**
[18077] Fix | Delete
* External dependencies
[18078] Fix | Delete
*/
[18079] Fix | Delete
[18080] Fix | Delete
[18081] Fix | Delete
/**
[18082] Fix | Delete
* WordPress dependencies
[18083] Fix | Delete
*/
[18084] Fix | Delete
[18085] Fix | Delete
[18086] Fix | Delete
[18087] Fix | Delete
/**
[18088] Fix | Delete
* Internal dependencies
[18089] Fix | Delete
*/
[18090] Fix | Delete
[18091] Fix | Delete
[18092] Fix | Delete
[18093] Fix | Delete
[18094] Fix | Delete
function input_control_useUniqueId(idProp) {
[18095] Fix | Delete
var instanceId = Object(external_wp_compose_["useInstanceId"])(InputControl);
[18096] Fix | Delete
var id = "inspector-input-control-".concat(instanceId);
[18097] Fix | Delete
return idProp || id;
[18098] Fix | Delete
}
[18099] Fix | Delete
[18100] Fix | Delete
function InputControl(_ref, ref) {
[18101] Fix | Delete
var _ref$__unstableStateR = _ref.__unstableStateReducer,
[18102] Fix | Delete
stateReducer = _ref$__unstableStateR === void 0 ? function (state) {
[18103] Fix | Delete
return state;
[18104] Fix | Delete
} : _ref$__unstableStateR,
[18105] Fix | Delete
__unstableInputWidth = _ref.__unstableInputWidth,
[18106] Fix | Delete
className = _ref.className,
[18107] Fix | Delete
_ref$disabled = _ref.disabled,
[18108] Fix | Delete
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
[18109] Fix | Delete
_ref$hideLabelFromVis = _ref.hideLabelFromVision,
[18110] Fix | Delete
hideLabelFromVision = _ref$hideLabelFromVis === void 0 ? false : _ref$hideLabelFromVis,
[18111] Fix | Delete
idProp = _ref.id,
[18112] Fix | Delete
_ref$isPressEnterToCh = _ref.isPressEnterToChange,
[18113] Fix | Delete
isPressEnterToChange = _ref$isPressEnterToCh === void 0 ? false : _ref$isPressEnterToCh,
[18114] Fix | Delete
label = _ref.label,
[18115] Fix | Delete
_ref$labelPosition = _ref.labelPosition,
[18116] Fix | Delete
labelPosition = _ref$labelPosition === void 0 ? 'top' : _ref$labelPosition,
[18117] Fix | Delete
_ref$onChange = _ref.onChange,
[18118] Fix | Delete
onChange = _ref$onChange === void 0 ? external_lodash_["noop"] : _ref$onChange,
[18119] Fix | Delete
_ref$onValidate = _ref.onValidate,
[18120] Fix | Delete
onValidate = _ref$onValidate === void 0 ? external_lodash_["noop"] : _ref$onValidate,
[18121] Fix | Delete
_ref$onKeyDown = _ref.onKeyDown,
[18122] Fix | Delete
onKeyDown = _ref$onKeyDown === void 0 ? external_lodash_["noop"] : _ref$onKeyDown,
[18123] Fix | Delete
prefix = _ref.prefix,
[18124] Fix | Delete
_ref$size = _ref.size,
[18125] Fix | Delete
size = _ref$size === void 0 ? 'default' : _ref$size,
[18126] Fix | Delete
suffix = _ref.suffix,
[18127] Fix | Delete
value = _ref.value,
[18128] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["__unstableStateReducer", "__unstableInputWidth", "className", "disabled", "hideLabelFromVision", "id", "isPressEnterToChange", "label", "labelPosition", "onChange", "onValidate", "onKeyDown", "prefix", "size", "suffix", "value"]);
[18129] Fix | Delete
[18130] Fix | Delete
var _useState = Object(external_wp_element_["useState"])(false),
[18131] Fix | Delete
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
[18132] Fix | Delete
isFocused = _useState2[0],
[18133] Fix | Delete
setIsFocused = _useState2[1];
[18134] Fix | Delete
[18135] Fix | Delete
var id = input_control_useUniqueId(idProp);
[18136] Fix | Delete
var classes = classnames_default()('components-input-control', className);
[18137] Fix | Delete
return Object(external_wp_element_["createElement"])(input_base, {
[18138] Fix | Delete
__unstableInputWidth: __unstableInputWidth,
[18139] Fix | Delete
className: classes,
[18140] Fix | Delete
disabled: disabled,
[18141] Fix | Delete
gap: 3,
[18142] Fix | Delete
hideLabelFromVision: hideLabelFromVision,
[18143] Fix | Delete
id: id,
[18144] Fix | Delete
isFocused: isFocused,
[18145] Fix | Delete
justify: "left",
[18146] Fix | Delete
label: label,
[18147] Fix | Delete
labelPosition: labelPosition,
[18148] Fix | Delete
prefix: prefix,
[18149] Fix | Delete
size: size,
[18150] Fix | Delete
suffix: suffix
[18151] Fix | Delete
}, Object(external_wp_element_["createElement"])(input_field, Object(esm_extends["a" /* default */])({}, props, {
[18152] Fix | Delete
className: "components-input-control__input",
[18153] Fix | Delete
disabled: disabled,
[18154] Fix | Delete
id: id,
[18155] Fix | Delete
isFocused: isFocused,
[18156] Fix | Delete
isPressEnterToChange: isPressEnterToChange,
[18157] Fix | Delete
onChange: onChange,
[18158] Fix | Delete
onKeyDown: onKeyDown,
[18159] Fix | Delete
onValidate: onValidate,
[18160] Fix | Delete
ref: ref,
[18161] Fix | Delete
setIsFocused: setIsFocused,
[18162] Fix | Delete
size: size,
[18163] Fix | Delete
stateReducer: stateReducer,
[18164] Fix | Delete
value: value
[18165] Fix | Delete
})));
[18166] Fix | Delete
}
[18167] Fix | Delete
var input_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputControl);
[18168] Fix | Delete
/* harmony default export */ var input_control = (input_control_ForwardedComponent);
[18169] Fix | Delete
[18170] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
[18171] Fix | Delete
[18172] Fix | Delete
[18173] Fix | Delete
function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
[18174] Fix | Delete
[18175] Fix | Delete
/**
[18176] Fix | Delete
* External dependencies
[18177] Fix | Delete
*/
[18178] Fix | Delete
[18179] Fix | Delete
[18180] Fix | Delete
/**
[18181] Fix | Delete
* Internal dependencies
[18182] Fix | Delete
*/
[18183] Fix | Delete
[18184] Fix | Delete
[18185] Fix | Delete
var number_control_styles_ref = true ? {
[18186] Fix | Delete
name: "1b9wwt5",
[18187] Fix | Delete
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none !important;margin:0 !important;}"
[18188] Fix | Delete
} : undefined;
[18189] Fix | Delete
[18190] Fix | Delete
var htmlArrowStyles = function htmlArrowStyles(_ref2) {
[18191] Fix | Delete
var hideHTMLArrows = _ref2.hideHTMLArrows;
[18192] Fix | Delete
if (!hideHTMLArrows) return "";
[18193] Fix | Delete
return number_control_styles_ref;
[18194] Fix | Delete
};
[18195] Fix | Delete
[18196] Fix | Delete
var number_control_styles_Input = /*#__PURE__*/styled_base_browser_esm(input_control, {
[18197] Fix | Delete
target: "ep48uk90",
[18198] Fix | Delete
label: "Input"
[18199] Fix | Delete
})(htmlArrowStyles, ";" + ( true ? "" : undefined));
[18200] Fix | Delete
[18201] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
[18202] Fix | Delete
/**
[18203] Fix | Delete
* External dependencies
[18204] Fix | Delete
*/
[18205] Fix | Delete
[18206] Fix | Delete
/**
[18207] Fix | Delete
* Parses and retrieves a number value.
[18208] Fix | Delete
*
[18209] Fix | Delete
* @param {unknown} value The incoming value.
[18210] Fix | Delete
*
[18211] Fix | Delete
* @return {number} The parsed number value.
[18212] Fix | Delete
*/
[18213] Fix | Delete
[18214] Fix | Delete
function getNumber(value) {
[18215] Fix | Delete
var number = Number(value);
[18216] Fix | Delete
return isNaN(number) ? 0 : number;
[18217] Fix | Delete
}
[18218] Fix | Delete
/**
[18219] Fix | Delete
* Safely adds 2 values.
[18220] Fix | Delete
*
[18221] Fix | Delete
* @param {Array<number|string>} args Values to add together.
[18222] Fix | Delete
*
[18223] Fix | Delete
* @return {number} The sum of values.
[18224] Fix | Delete
*/
[18225] Fix | Delete
[18226] Fix | Delete
function add() {
[18227] Fix | Delete
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
[18228] Fix | Delete
args[_key] = arguments[_key];
[18229] Fix | Delete
}
[18230] Fix | Delete
[18231] Fix | Delete
return args.reduce(
[18232] Fix | Delete
/** @type {(sum:number, arg: number|string) => number} */
[18233] Fix | Delete
function (sum, arg) {
[18234] Fix | Delete
return sum + getNumber(arg);
[18235] Fix | Delete
}, 0);
[18236] Fix | Delete
}
[18237] Fix | Delete
/**
[18238] Fix | Delete
* Safely subtracts 2 values.
[18239] Fix | Delete
*
[18240] Fix | Delete
* @param {Array<number|string>} args Values to subtract together.
[18241] Fix | Delete
*
[18242] Fix | Delete
* @return {number} The difference of the values.
[18243] Fix | Delete
*/
[18244] Fix | Delete
[18245] Fix | Delete
function subtract() {
[18246] Fix | Delete
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
[18247] Fix | Delete
args[_key2] = arguments[_key2];
[18248] Fix | Delete
}
[18249] Fix | Delete
[18250] Fix | Delete
return args.reduce(
[18251] Fix | Delete
/** @type {(diff:number, arg: number|string, index:number) => number} */
[18252] Fix | Delete
function (diff, arg, index) {
[18253] Fix | Delete
var value = getNumber(arg);
[18254] Fix | Delete
return index === 0 ? value : diff - value;
[18255] Fix | Delete
}, 0);
[18256] Fix | Delete
}
[18257] Fix | Delete
/**
[18258] Fix | Delete
* Determines the decimal position of a number value.
[18259] Fix | Delete
*
[18260] Fix | Delete
* @param {number} value The number to evaluate.
[18261] Fix | Delete
*
[18262] Fix | Delete
* @return {number} The number of decimal places.
[18263] Fix | Delete
*/
[18264] Fix | Delete
[18265] Fix | Delete
function getPrecision(value) {
[18266] Fix | Delete
var split = (value + '').split('.');
[18267] Fix | Delete
return split[1] !== undefined ? split[1].length : 0;
[18268] Fix | Delete
}
[18269] Fix | Delete
/**
[18270] Fix | Delete
* Clamps a value based on a min/max range with rounding
[18271] Fix | Delete
*
[18272] Fix | Delete
* @param {number} value The value.
[18273] Fix | Delete
* @param {number} min The minimum range.
[18274] Fix | Delete
* @param {number} max The maximum range.
[18275] Fix | Delete
* @param {number} step A multiplier for the value.
[18276] Fix | Delete
*
[18277] Fix | Delete
* @return {number} The rounded and clamped value.
[18278] Fix | Delete
*/
[18279] Fix | Delete
[18280] Fix | Delete
[18281] Fix | Delete
function roundClamp() {
[18282] Fix | Delete
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
[18283] Fix | Delete
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
[18284] Fix | Delete
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
[18285] Fix | Delete
var step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
[18286] Fix | Delete
var baseValue = getNumber(value);
[18287] Fix | Delete
var stepValue = getNumber(step);
[18288] Fix | Delete
var precision = getPrecision(step);
[18289] Fix | Delete
var rounded = Math.round(baseValue / stepValue) * stepValue;
[18290] Fix | Delete
var clampedValue = Object(external_lodash_["clamp"])(rounded, min, max);
[18291] Fix | Delete
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
[18292] Fix | Delete
}
[18293] Fix | Delete
/**
[18294] Fix | Delete
* Clamps a value based on a min/max range with rounding.
[18295] Fix | Delete
* Returns a string.
[18296] Fix | Delete
*
[18297] Fix | Delete
* @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().
[18298] Fix | Delete
* @return {string} The rounded and clamped value.
[18299] Fix | Delete
*/
[18300] Fix | Delete
[18301] Fix | Delete
function roundClampString() {
[18302] Fix | Delete
return roundClamp.apply(void 0, arguments).toString();
[18303] Fix | Delete
}
[18304] Fix | Delete
[18305] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-jump-step.js
[18306] Fix | Delete
[18307] Fix | Delete
[18308] Fix | Delete
/**
[18309] Fix | Delete
* WordPress dependencies
[18310] Fix | Delete
*/
[18311] Fix | Delete
[18312] Fix | Delete
/**
[18313] Fix | Delete
* A custom hook that calculates a step value (used by elements like input
[18314] Fix | Delete
* [type="number"]). This value can be modified based on whether the Shift
[18315] Fix | Delete
* key is being held down.
[18316] Fix | Delete
*
[18317] Fix | Delete
* For example, a shiftStep of 10, and a step of 1...
[18318] Fix | Delete
* Starting from 10, the next incremented value will be 11.
[18319] Fix | Delete
*
[18320] Fix | Delete
* Holding down shift...
[18321] Fix | Delete
* Starting from 10, the next incremented value will be 20.
[18322] Fix | Delete
*
[18323] Fix | Delete
* @param {Object} props Properties for the hook.
[18324] Fix | Delete
* @param {boolean} [props.isShiftStepEnabled=true] Determines if jumping values with shift is enabled
[18325] Fix | Delete
* @param {number} [props.shiftStep=10] Multiplier to jump by, when holding shift key.
[18326] Fix | Delete
* @param {number} [props.step=1] Multiplier to jump by, when not-holding shift key.
[18327] Fix | Delete
*
[18328] Fix | Delete
* @return {number} The jump step value.
[18329] Fix | Delete
*/
[18330] Fix | Delete
[18331] Fix | Delete
function useJumpStep(_ref) {
[18332] Fix | Delete
var _ref$isShiftStepEnabl = _ref.isShiftStepEnabled,
[18333] Fix | Delete
isShiftStepEnabled = _ref$isShiftStepEnabl === void 0 ? true : _ref$isShiftStepEnabl,
[18334] Fix | Delete
_ref$shiftStep = _ref.shiftStep,
[18335] Fix | Delete
shiftStep = _ref$shiftStep === void 0 ? 10 : _ref$shiftStep,
[18336] Fix | Delete
_ref$step = _ref.step,
[18337] Fix | Delete
step = _ref$step === void 0 ? 1 : _ref$step;
[18338] Fix | Delete
[18339] Fix | Delete
var _useState = Object(external_wp_element_["useState"])(false),
[18340] Fix | Delete
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
[18341] Fix | Delete
isShiftKey = _useState2[0],
[18342] Fix | Delete
setIsShiftKey = _useState2[1];
[18343] Fix | Delete
[18344] Fix | Delete
Object(external_wp_element_["useEffect"])(function () {
[18345] Fix | Delete
/** @type {(event: KeyboardEvent)=>void} */
[18346] Fix | Delete
var handleShiftKeyToggle = function handleShiftKeyToggle(event) {
[18347] Fix | Delete
setIsShiftKey(event.shiftKey);
[18348] Fix | Delete
};
[18349] Fix | Delete
[18350] Fix | Delete
window.addEventListener('keydown', handleShiftKeyToggle);
[18351] Fix | Delete
window.addEventListener('keyup', handleShiftKeyToggle);
[18352] Fix | Delete
return function () {
[18353] Fix | Delete
window.removeEventListener('keydown', handleShiftKeyToggle);
[18354] Fix | Delete
window.removeEventListener('keyup', handleShiftKeyToggle);
[18355] Fix | Delete
};
[18356] Fix | Delete
}, []);
[18357] Fix | Delete
var isEnabled = isShiftStepEnabled && isShiftKey;
[18358] Fix | Delete
return isEnabled ? shiftStep * step : step;
[18359] Fix | Delete
}
[18360] Fix | Delete
[18361] Fix | Delete
/* harmony default export */ var use_jump_step = (useJumpStep);
[18362] Fix | Delete
[18363] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
[18364] Fix | Delete
[18365] Fix | Delete
[18366] Fix | Delete
[18367] Fix | Delete
[18368] Fix | Delete
[18369] Fix | Delete
/**
[18370] Fix | Delete
* External dependencies
[18371] Fix | Delete
*/
[18372] Fix | Delete
[18373] Fix | Delete
/**
[18374] Fix | Delete
* WordPress dependencies
[18375] Fix | Delete
*/
[18376] Fix | Delete
[18377] Fix | Delete
[18378] Fix | Delete
[18379] Fix | Delete
/**
[18380] Fix | Delete
* Internal dependencies
[18381] Fix | Delete
*/
[18382] Fix | Delete
[18383] Fix | Delete
[18384] Fix | Delete
[18385] Fix | Delete
[18386] Fix | Delete
[18387] Fix | Delete
[18388] Fix | Delete
function NumberControl(_ref, ref) {
[18389] Fix | Delete
var _ref$__unstableStateR = _ref.__unstableStateReducer,
[18390] Fix | Delete
stateReducer = _ref$__unstableStateR === void 0 ? function (state) {
[18391] Fix | Delete
return state;
[18392] Fix | Delete
} : _ref$__unstableStateR,
[18393] Fix | Delete
className = _ref.className,
[18394] Fix | Delete
_ref$dragDirection = _ref.dragDirection,
[18395] Fix | Delete
dragDirection = _ref$dragDirection === void 0 ? 'n' : _ref$dragDirection,
[18396] Fix | Delete
_ref$hideHTMLArrows = _ref.hideHTMLArrows,
[18397] Fix | Delete
hideHTMLArrows = _ref$hideHTMLArrows === void 0 ? false : _ref$hideHTMLArrows,
[18398] Fix | Delete
_ref$isDragEnabled = _ref.isDragEnabled,
[18399] Fix | Delete
isDragEnabled = _ref$isDragEnabled === void 0 ? true : _ref$isDragEnabled,
[18400] Fix | Delete
_ref$isShiftStepEnabl = _ref.isShiftStepEnabled,
[18401] Fix | Delete
isShiftStepEnabled = _ref$isShiftStepEnabl === void 0 ? true : _ref$isShiftStepEnabl,
[18402] Fix | Delete
label = _ref.label,
[18403] Fix | Delete
_ref$max = _ref.max,
[18404] Fix | Delete
max = _ref$max === void 0 ? Infinity : _ref$max,
[18405] Fix | Delete
_ref$min = _ref.min,
[18406] Fix | Delete
min = _ref$min === void 0 ? -Infinity : _ref$min,
[18407] Fix | Delete
_ref$shiftStep = _ref.shiftStep,
[18408] Fix | Delete
shiftStep = _ref$shiftStep === void 0 ? 10 : _ref$shiftStep,
[18409] Fix | Delete
_ref$step = _ref.step,
[18410] Fix | Delete
step = _ref$step === void 0 ? 1 : _ref$step,
[18411] Fix | Delete
_ref$type = _ref.type,
[18412] Fix | Delete
typeProp = _ref$type === void 0 ? 'number' : _ref$type,
[18413] Fix | Delete
valueProp = _ref.value,
[18414] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["__unstableStateReducer", "className", "dragDirection", "hideHTMLArrows", "isDragEnabled", "isShiftStepEnabled", "label", "max", "min", "shiftStep", "step", "type", "value"]);
[18415] Fix | Delete
[18416] Fix | Delete
var baseValue = roundClamp(0, min, max, step);
[18417] Fix | Delete
var jumpStep = use_jump_step({
[18418] Fix | Delete
step: step,
[18419] Fix | Delete
shiftStep: shiftStep,
[18420] Fix | Delete
isShiftStepEnabled: isShiftStepEnabled
[18421] Fix | Delete
});
[18422] Fix | Delete
var autoComplete = typeProp === 'number' ? 'off' : null;
[18423] Fix | Delete
var classes = classnames_default()('components-number-control', className);
[18424] Fix | Delete
/**
[18425] Fix | Delete
* "Middleware" function that intercepts updates from InputControl.
[18426] Fix | Delete
* This allows us to tap into actions to transform the (next) state for
[18427] Fix | Delete
* InputControl.
[18428] Fix | Delete
*
[18429] Fix | Delete
* @param {Object} state State from InputControl
[18430] Fix | Delete
* @param {Object} action Action triggering state change
[18431] Fix | Delete
* @return {Object} The updated state to apply to InputControl
[18432] Fix | Delete
*/
[18433] Fix | Delete
[18434] Fix | Delete
var numberControlStateReducer = function numberControlStateReducer(state, action) {
[18435] Fix | Delete
var type = action.type,
[18436] Fix | Delete
payload = action.payload;
[18437] Fix | Delete
var event = payload === null || payload === void 0 ? void 0 : payload.event;
[18438] Fix | Delete
var currentValue = state.value;
[18439] Fix | Delete
/**
[18440] Fix | Delete
* Handles custom UP and DOWN Keyboard events
[18441] Fix | Delete
*/
[18442] Fix | Delete
[18443] Fix | Delete
if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {
[18444] Fix | Delete
var enableShift = event.shiftKey && isShiftStepEnabled;
[18445] Fix | Delete
var incrementalValue = enableShift ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
[18446] Fix | Delete
var nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
[18447] Fix | Delete
[18448] Fix | Delete
if (event !== null && event !== void 0 && event.preventDefault) {
[18449] Fix | Delete
event.preventDefault();
[18450] Fix | Delete
}
[18451] Fix | Delete
[18452] Fix | Delete
if (type === inputControlActionTypes.PRESS_UP) {
[18453] Fix | Delete
nextValue = add(nextValue, incrementalValue);
[18454] Fix | Delete
}
[18455] Fix | Delete
[18456] Fix | Delete
if (type === inputControlActionTypes.PRESS_DOWN) {
[18457] Fix | Delete
nextValue = subtract(nextValue, incrementalValue);
[18458] Fix | Delete
}
[18459] Fix | Delete
[18460] Fix | Delete
nextValue = roundClamp(nextValue, min, max, incrementalValue);
[18461] Fix | Delete
state.value = nextValue;
[18462] Fix | Delete
}
[18463] Fix | Delete
/**
[18464] Fix | Delete
* Handles drag to update events
[18465] Fix | Delete
*/
[18466] Fix | Delete
[18467] Fix | Delete
[18468] Fix | Delete
if (type === inputControlActionTypes.DRAG && isDragEnabled) {
[18469] Fix | Delete
var delta = payload.delta,
[18470] Fix | Delete
shiftKey = payload.shiftKey;
[18471] Fix | Delete
[18472] Fix | Delete
var _delta = Object(slicedToArray["a" /* default */])(delta, 2),
[18473] Fix | Delete
x = _delta[0],
[18474] Fix | Delete
y = _delta[1];
[18475] Fix | Delete
[18476] Fix | Delete
var modifier = shiftKey ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
[18477] Fix | Delete
var directionModifier;
[18478] Fix | Delete
var directionBaseValue;
[18479] Fix | Delete
[18480] Fix | Delete
switch (dragDirection) {
[18481] Fix | Delete
case 'n':
[18482] Fix | Delete
directionBaseValue = y;
[18483] Fix | Delete
directionModifier = -1;
[18484] Fix | Delete
break;
[18485] Fix | Delete
[18486] Fix | Delete
case 'e':
[18487] Fix | Delete
directionBaseValue = x;
[18488] Fix | Delete
directionModifier = Object(external_wp_i18n_["isRTL"])() ? -1 : 1;
[18489] Fix | Delete
break;
[18490] Fix | Delete
[18491] Fix | Delete
case 's':
[18492] Fix | Delete
directionBaseValue = y;
[18493] Fix | Delete
directionModifier = 1;
[18494] Fix | Delete
break;
[18495] Fix | Delete
[18496] Fix | Delete
case 'w':
[18497] Fix | Delete
directionBaseValue = x;
[18498] Fix | Delete
directionModifier = Object(external_wp_i18n_["isRTL"])() ? 1 : -1;
[18499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function