Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
});
[19000] Fix | Delete
Object(external_wp_element_["useLayoutEffect"])(function () {
[19001] Fix | Delete
onChangeOptions(items);
[19002] Fix | Delete
}, [items]);
[19003] Fix | Delete
[19004] Fix | Delete
if (!items.length > 0) {
[19005] Fix | Delete
return null;
[19006] Fix | Delete
}
[19007] Fix | Delete
[19008] Fix | Delete
return Object(external_wp_element_["createElement"])(popover["a" /* default */], {
[19009] Fix | Delete
focusOnMount: false,
[19010] Fix | Delete
onClose: onReset,
[19011] Fix | Delete
position: "top right",
[19012] Fix | Delete
className: "components-autocomplete__popover",
[19013] Fix | Delete
anchorRef: anchorRef
[19014] Fix | Delete
}, Object(external_wp_element_["createElement"])("div", {
[19015] Fix | Delete
id: listBoxId,
[19016] Fix | Delete
role: "listbox",
[19017] Fix | Delete
className: "components-autocomplete__results"
[19018] Fix | Delete
}, Object(external_lodash_["map"])(items, function (option, index) {
[19019] Fix | Delete
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
[19020] Fix | Delete
key: option.key,
[19021] Fix | Delete
id: "components-autocomplete-item-".concat(instanceId, "-").concat(option.key),
[19022] Fix | Delete
role: "option",
[19023] Fix | Delete
"aria-selected": index === selectedIndex,
[19024] Fix | Delete
disabled: option.isDisabled,
[19025] Fix | Delete
className: classnames_default()('components-autocomplete__result', className, {
[19026] Fix | Delete
'is-selected': index === selectedIndex
[19027] Fix | Delete
}),
[19028] Fix | Delete
onClick: function onClick() {
[19029] Fix | Delete
return onSelect(option);
[19030] Fix | Delete
}
[19031] Fix | Delete
}, option.label);
[19032] Fix | Delete
})));
[19033] Fix | Delete
}
[19034] Fix | Delete
[19035] Fix | Delete
return AutocompleterUI;
[19036] Fix | Delete
};
[19037] Fix | Delete
[19038] Fix | Delete
function Autocomplete(_ref2) {
[19039] Fix | Delete
var children = _ref2.children,
[19040] Fix | Delete
isSelected = _ref2.isSelected,
[19041] Fix | Delete
record = _ref2.record,
[19042] Fix | Delete
onChange = _ref2.onChange,
[19043] Fix | Delete
onReplace = _ref2.onReplace,
[19044] Fix | Delete
completers = _ref2.completers,
[19045] Fix | Delete
debouncedSpeak = _ref2.debouncedSpeak,
[19046] Fix | Delete
contentRef = _ref2.contentRef;
[19047] Fix | Delete
var instanceId = Object(external_wp_compose_["useInstanceId"])(Autocomplete);
[19048] Fix | Delete
[19049] Fix | Delete
var _useState3 = Object(external_wp_element_["useState"])(0),
[19050] Fix | Delete
_useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2),
[19051] Fix | Delete
selectedIndex = _useState4[0],
[19052] Fix | Delete
setSelectedIndex = _useState4[1];
[19053] Fix | Delete
[19054] Fix | Delete
var _useState5 = Object(external_wp_element_["useState"])([]),
[19055] Fix | Delete
_useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2),
[19056] Fix | Delete
filteredOptions = _useState6[0],
[19057] Fix | Delete
setFilteredOptions = _useState6[1];
[19058] Fix | Delete
[19059] Fix | Delete
var _useState7 = Object(external_wp_element_["useState"])(''),
[19060] Fix | Delete
_useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2),
[19061] Fix | Delete
filterValue = _useState8[0],
[19062] Fix | Delete
setFilterValue = _useState8[1];
[19063] Fix | Delete
[19064] Fix | Delete
var _useState9 = Object(external_wp_element_["useState"])(null),
[19065] Fix | Delete
_useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2),
[19066] Fix | Delete
autocompleter = _useState10[0],
[19067] Fix | Delete
setAutocompleter = _useState10[1];
[19068] Fix | Delete
[19069] Fix | Delete
var _useState11 = Object(external_wp_element_["useState"])(null),
[19070] Fix | Delete
_useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2),
[19071] Fix | Delete
AutocompleterUI = _useState12[0],
[19072] Fix | Delete
setAutocompleterUI = _useState12[1];
[19073] Fix | Delete
[19074] Fix | Delete
function insertCompletion(replacement) {
[19075] Fix | Delete
var end = record.start;
[19076] Fix | Delete
var start = end - autocompleter.triggerPrefix.length - filterValue.length;
[19077] Fix | Delete
var toInsert = Object(external_wp_richText_["create"])({
[19078] Fix | Delete
html: Object(external_wp_element_["renderToString"])(replacement)
[19079] Fix | Delete
});
[19080] Fix | Delete
onChange(Object(external_wp_richText_["insert"])(record, toInsert, start, end));
[19081] Fix | Delete
}
[19082] Fix | Delete
[19083] Fix | Delete
function select(option) {
[19084] Fix | Delete
var _ref3 = autocompleter || {},
[19085] Fix | Delete
getOptionCompletion = _ref3.getOptionCompletion;
[19086] Fix | Delete
[19087] Fix | Delete
if (option.isDisabled) {
[19088] Fix | Delete
return;
[19089] Fix | Delete
}
[19090] Fix | Delete
[19091] Fix | Delete
if (getOptionCompletion) {
[19092] Fix | Delete
var completion = getOptionCompletion(option.value, filterValue);
[19093] Fix | Delete
[19094] Fix | Delete
var _ref4 = undefined === completion.action || undefined === completion.value ? {
[19095] Fix | Delete
action: 'insert-at-caret',
[19096] Fix | Delete
value: completion
[19097] Fix | Delete
} : completion,
[19098] Fix | Delete
action = _ref4.action,
[19099] Fix | Delete
value = _ref4.value;
[19100] Fix | Delete
[19101] Fix | Delete
if ('replace' === action) {
[19102] Fix | Delete
onReplace([value]);
[19103] Fix | Delete
} else if ('insert-at-caret' === action) {
[19104] Fix | Delete
insertCompletion(value);
[19105] Fix | Delete
}
[19106] Fix | Delete
} // Reset autocomplete state after insertion rather than before
[19107] Fix | Delete
// so insertion events don't cause the completion menu to redisplay.
[19108] Fix | Delete
[19109] Fix | Delete
[19110] Fix | Delete
reset();
[19111] Fix | Delete
}
[19112] Fix | Delete
[19113] Fix | Delete
function reset() {
[19114] Fix | Delete
setSelectedIndex(0);
[19115] Fix | Delete
setFilteredOptions([]);
[19116] Fix | Delete
setFilterValue('');
[19117] Fix | Delete
setAutocompleter(null);
[19118] Fix | Delete
setAutocompleterUI(null);
[19119] Fix | Delete
}
[19120] Fix | Delete
[19121] Fix | Delete
function announce(options) {
[19122] Fix | Delete
if (!debouncedSpeak) {
[19123] Fix | Delete
return;
[19124] Fix | Delete
}
[19125] Fix | Delete
[19126] Fix | Delete
if (!!options.length) {
[19127] Fix | Delete
debouncedSpeak(Object(external_wp_i18n_["sprintf"])(
[19128] Fix | Delete
/* translators: %d: number of results. */
[19129] Fix | Delete
Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
[19130] Fix | Delete
} else {
[19131] Fix | Delete
debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive');
[19132] Fix | Delete
}
[19133] Fix | Delete
}
[19134] Fix | Delete
/**
[19135] Fix | Delete
* Load options for an autocompleter.
[19136] Fix | Delete
*
[19137] Fix | Delete
* @param {Array} options
[19138] Fix | Delete
*/
[19139] Fix | Delete
[19140] Fix | Delete
[19141] Fix | Delete
function onChangeOptions(options) {
[19142] Fix | Delete
setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
[19143] Fix | Delete
setFilteredOptions(options);
[19144] Fix | Delete
announce(options);
[19145] Fix | Delete
}
[19146] Fix | Delete
[19147] Fix | Delete
function handleKeyDown(event) {
[19148] Fix | Delete
if (!autocompleter) {
[19149] Fix | Delete
return;
[19150] Fix | Delete
}
[19151] Fix | Delete
[19152] Fix | Delete
if (filteredOptions.length === 0) {
[19153] Fix | Delete
return;
[19154] Fix | Delete
}
[19155] Fix | Delete
[19156] Fix | Delete
switch (event.keyCode) {
[19157] Fix | Delete
case external_wp_keycodes_["UP"]:
[19158] Fix | Delete
setSelectedIndex((selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1);
[19159] Fix | Delete
break;
[19160] Fix | Delete
[19161] Fix | Delete
case external_wp_keycodes_["DOWN"]:
[19162] Fix | Delete
setSelectedIndex((selectedIndex + 1) % filteredOptions.length);
[19163] Fix | Delete
break;
[19164] Fix | Delete
[19165] Fix | Delete
case external_wp_keycodes_["ESCAPE"]:
[19166] Fix | Delete
setAutocompleter(null);
[19167] Fix | Delete
setAutocompleterUI(null);
[19168] Fix | Delete
break;
[19169] Fix | Delete
[19170] Fix | Delete
case external_wp_keycodes_["ENTER"]:
[19171] Fix | Delete
select(filteredOptions[selectedIndex]);
[19172] Fix | Delete
break;
[19173] Fix | Delete
[19174] Fix | Delete
case external_wp_keycodes_["LEFT"]:
[19175] Fix | Delete
case external_wp_keycodes_["RIGHT"]:
[19176] Fix | Delete
reset();
[19177] Fix | Delete
return;
[19178] Fix | Delete
[19179] Fix | Delete
default:
[19180] Fix | Delete
return;
[19181] Fix | Delete
} // Any handled keycode should prevent original behavior. This relies on
[19182] Fix | Delete
// the early return in the default case.
[19183] Fix | Delete
[19184] Fix | Delete
[19185] Fix | Delete
event.preventDefault();
[19186] Fix | Delete
event.stopPropagation();
[19187] Fix | Delete
}
[19188] Fix | Delete
[19189] Fix | Delete
var textContent;
[19190] Fix | Delete
[19191] Fix | Delete
if (Object(external_wp_richText_["isCollapsed"])(record)) {
[19192] Fix | Delete
textContent = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, 0));
[19193] Fix | Delete
}
[19194] Fix | Delete
[19195] Fix | Delete
Object(external_wp_element_["useEffect"])(function () {
[19196] Fix | Delete
if (!textContent) {
[19197] Fix | Delete
return;
[19198] Fix | Delete
}
[19199] Fix | Delete
[19200] Fix | Delete
var text = Object(external_lodash_["deburr"])(textContent);
[19201] Fix | Delete
var textAfterSelection = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, undefined, Object(external_wp_richText_["getTextContent"])(record).length));
[19202] Fix | Delete
var completer = Object(external_lodash_["find"])(completers, function (_ref5) {
[19203] Fix | Delete
var triggerPrefix = _ref5.triggerPrefix,
[19204] Fix | Delete
allowContext = _ref5.allowContext;
[19205] Fix | Delete
var index = text.lastIndexOf(triggerPrefix);
[19206] Fix | Delete
[19207] Fix | Delete
if (index === -1) {
[19208] Fix | Delete
return false;
[19209] Fix | Delete
}
[19210] Fix | Delete
[19211] Fix | Delete
if (allowContext && !allowContext(text.slice(0, index), textAfterSelection)) {
[19212] Fix | Delete
return false;
[19213] Fix | Delete
}
[19214] Fix | Delete
[19215] Fix | Delete
return /^\S*$/.test(text.slice(index + triggerPrefix.length));
[19216] Fix | Delete
});
[19217] Fix | Delete
[19218] Fix | Delete
if (!completer) {
[19219] Fix | Delete
reset();
[19220] Fix | Delete
return;
[19221] Fix | Delete
}
[19222] Fix | Delete
[19223] Fix | Delete
var safeTrigger = Object(external_lodash_["escapeRegExp"])(completer.triggerPrefix);
[19224] Fix | Delete
var match = text.match(new RegExp("".concat(safeTrigger, "(\\S*)$")));
[19225] Fix | Delete
var query = match && match[1];
[19226] Fix | Delete
setAutocompleter(completer);
[19227] Fix | Delete
setAutocompleterUI(function () {
[19228] Fix | Delete
return completer !== autocompleter ? autocomplete_getAutoCompleterUI(completer) : AutocompleterUI;
[19229] Fix | Delete
});
[19230] Fix | Delete
setFilterValue(query);
[19231] Fix | Delete
}, [textContent]);
[19232] Fix | Delete
[19233] Fix | Delete
var _ref6 = filteredOptions[selectedIndex] || {},
[19234] Fix | Delete
_ref6$key = _ref6.key,
[19235] Fix | Delete
selectedKey = _ref6$key === void 0 ? '' : _ref6$key;
[19236] Fix | Delete
[19237] Fix | Delete
var _ref7 = autocompleter || {},
[19238] Fix | Delete
className = _ref7.className;
[19239] Fix | Delete
[19240] Fix | Delete
var isExpanded = !!autocompleter && filteredOptions.length > 0;
[19241] Fix | Delete
var listBoxId = isExpanded ? "components-autocomplete-listbox-".concat(instanceId) : null;
[19242] Fix | Delete
var activeId = isExpanded ? "components-autocomplete-item-".concat(instanceId, "-").concat(selectedKey) : null;
[19243] Fix | Delete
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, children({
[19244] Fix | Delete
isExpanded: isExpanded,
[19245] Fix | Delete
listBoxId: listBoxId,
[19246] Fix | Delete
activeId: activeId,
[19247] Fix | Delete
onKeyDown: handleKeyDown
[19248] Fix | Delete
}), isSelected && AutocompleterUI && Object(external_wp_element_["createElement"])(AutocompleterUI, {
[19249] Fix | Delete
className: className,
[19250] Fix | Delete
filterValue: filterValue,
[19251] Fix | Delete
instanceId: instanceId,
[19252] Fix | Delete
listBoxId: listBoxId,
[19253] Fix | Delete
selectedIndex: selectedIndex,
[19254] Fix | Delete
onChangeOptions: onChangeOptions,
[19255] Fix | Delete
onSelect: select,
[19256] Fix | Delete
value: record,
[19257] Fix | Delete
contentRef: contentRef
[19258] Fix | Delete
}));
[19259] Fix | Delete
}
[19260] Fix | Delete
[19261] Fix | Delete
/* harmony default export */ var autocomplete = (with_spoken_messages(Autocomplete));
[19262] Fix | Delete
[19263] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
[19264] Fix | Delete
[19265] Fix | Delete
[19266] Fix | Delete
function unit_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)."; }
[19267] Fix | Delete
[19268] Fix | Delete
/**
[19269] Fix | Delete
* External dependencies
[19270] Fix | Delete
*/
[19271] Fix | Delete
[19272] Fix | Delete
[19273] Fix | Delete
/**
[19274] Fix | Delete
* Internal dependencies
[19275] Fix | Delete
*/
[19276] Fix | Delete
[19277] Fix | Delete
[19278] Fix | Delete
var unit_control_styles_Root = styled_base_browser_esm("div", {
[19279] Fix | Delete
target: "e1agakv00",
[19280] Fix | Delete
label: "Root"
[19281] Fix | Delete
})( true ? {
[19282] Fix | Delete
name: "1bt0omd",
[19283] Fix | Delete
styles: "box-sizing:border-box;position:relative;"
[19284] Fix | Delete
} : undefined);
[19285] Fix | Delete
[19286] Fix | Delete
var unit_control_styles_paddingStyles = function paddingStyles(_ref2) {
[19287] Fix | Delete
var disableUnits = _ref2.disableUnits;
[19288] Fix | Delete
var value = disableUnits ? 3 : 24;
[19289] Fix | Delete
return /*#__PURE__*/Object(core_browser_esm["b" /* css */])(rtl_rtl({
[19290] Fix | Delete
paddingRight: value
[19291] Fix | Delete
})(), ";" + ( true ? "" : undefined));
[19292] Fix | Delete
};
[19293] Fix | Delete
[19294] Fix | Delete
var unit_control_styles_ref = true ? {
[19295] Fix | Delete
name: "1y65o8",
[19296] Fix | Delete
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"
[19297] Fix | Delete
} : undefined;
[19298] Fix | Delete
[19299] Fix | Delete
var arrowStyles = function arrowStyles(_ref3) {
[19300] Fix | Delete
var disableUnits = _ref3.disableUnits;
[19301] Fix | Delete
if (disableUnits) return '';
[19302] Fix | Delete
return unit_control_styles_ref;
[19303] Fix | Delete
}; // TODO: Resolve need to use &&& to increase specificity
[19304] Fix | Delete
// https://github.com/WordPress/gutenberg/issues/18483
[19305] Fix | Delete
[19306] Fix | Delete
[19307] Fix | Delete
var ValueInput = /*#__PURE__*/styled_base_browser_esm(number_control, {
[19308] Fix | Delete
target: "e1agakv01",
[19309] Fix | Delete
label: "ValueInput"
[19310] Fix | Delete
})("&&&{input{appearance:none;-moz-appearance:textfield;display:block;width:100%;", arrowStyles, ";", unit_control_styles_paddingStyles, ";}}" + ( true ? "" : undefined));
[19311] Fix | Delete
[19312] Fix | Delete
var unit_control_styles_unitSizeStyles = function unitSizeStyles(_ref4) {
[19313] Fix | Delete
var size = _ref4.size;
[19314] Fix | Delete
var sizes = {
[19315] Fix | Delete
default: {
[19316] Fix | Delete
height: 28,
[19317] Fix | Delete
lineHeight: '24px',
[19318] Fix | Delete
minHeight: 28,
[19319] Fix | Delete
top: 1
[19320] Fix | Delete
},
[19321] Fix | Delete
small: {
[19322] Fix | Delete
height: 22,
[19323] Fix | Delete
lineHeight: '18px',
[19324] Fix | Delete
minHeight: 22,
[19325] Fix | Delete
top: 1
[19326] Fix | Delete
}
[19327] Fix | Delete
};
[19328] Fix | Delete
return /*#__PURE__*/Object(core_browser_esm["b" /* css */])(sizes[size], true ? "" : undefined);
[19329] Fix | Delete
};
[19330] Fix | Delete
[19331] Fix | Delete
var unit_control_styles_baseUnitLabelStyles = function baseUnitLabelStyles(props) {
[19332] Fix | Delete
return /*#__PURE__*/Object(core_browser_esm["b" /* css */])("appearance:none;background:transparent;border-radius:2px;border:none;box-sizing:border-box;color:", colors_color('darkGray.500'), ";display:block;font-size:8px;line-height:1;letter-spacing:-0.5px;outline:none;padding:2px 1px;position:absolute;text-align-last:center;text-transform:uppercase;width:20px;", rtl_rtl({
[19333] Fix | Delete
borderTopLeftRadius: 0,
[19334] Fix | Delete
borderBottomLeftRadius: 0
[19335] Fix | Delete
})(), " ", rtl_rtl({
[19336] Fix | Delete
right: 0
[19337] Fix | Delete
})(), " ", unit_control_styles_unitSizeStyles(props), true ? "" : undefined);
[19338] Fix | Delete
};
[19339] Fix | Delete
[19340] Fix | Delete
var UnitLabel = styled_base_browser_esm("div", {
[19341] Fix | Delete
target: "e1agakv02",
[19342] Fix | Delete
label: "UnitLabel"
[19343] Fix | Delete
})("&&&{pointer-events:none;", unit_control_styles_baseUnitLabelStyles, ";}" + ( true ? "" : undefined));
[19344] Fix | Delete
var UnitSelect = styled_base_browser_esm("select", {
[19345] Fix | Delete
target: "e1agakv03",
[19346] Fix | Delete
label: "UnitSelect"
[19347] Fix | Delete
})("&&&{", unit_control_styles_baseUnitLabelStyles, ";cursor:pointer;border:1px solid transparent;&:hover{background-color:", colors_color('lightGray.300'), ";}&:focus{border-color:", colors_color('ui.borderFocus'), ";outline:2px solid transparent;outline-offset:0;}&:disabled{cursor:initial;&:hover{background-color:transparent;}}}" + ( true ? "" : undefined));
[19348] Fix | Delete
[19349] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
[19350] Fix | Delete
[19351] Fix | Delete
[19352] Fix | Delete
/**
[19353] Fix | Delete
* External dependencies
[19354] Fix | Delete
*/
[19355] Fix | Delete
[19356] Fix | Delete
var CSS_UNITS = [{
[19357] Fix | Delete
value: 'px',
[19358] Fix | Delete
label: 'px',
[19359] Fix | Delete
default: 0
[19360] Fix | Delete
}, {
[19361] Fix | Delete
value: '%',
[19362] Fix | Delete
label: '%',
[19363] Fix | Delete
default: 10
[19364] Fix | Delete
}, {
[19365] Fix | Delete
value: 'em',
[19366] Fix | Delete
label: 'em',
[19367] Fix | Delete
default: 0
[19368] Fix | Delete
}, {
[19369] Fix | Delete
value: 'rem',
[19370] Fix | Delete
label: 'rem',
[19371] Fix | Delete
default: 0
[19372] Fix | Delete
}, {
[19373] Fix | Delete
value: 'vw',
[19374] Fix | Delete
label: 'vw',
[19375] Fix | Delete
default: 10
[19376] Fix | Delete
}, {
[19377] Fix | Delete
value: 'vh',
[19378] Fix | Delete
label: 'vh',
[19379] Fix | Delete
default: 10
[19380] Fix | Delete
}];
[19381] Fix | Delete
var DEFAULT_UNIT = CSS_UNITS[0];
[19382] Fix | Delete
/**
[19383] Fix | Delete
* Handles legacy value + unit handling.
[19384] Fix | Delete
* This component use to manage both incoming value and units separately.
[19385] Fix | Delete
*
[19386] Fix | Delete
* Moving forward, ideally the value should be a string that contains both
[19387] Fix | Delete
* the value and unit, example: '10px'
[19388] Fix | Delete
*
[19389] Fix | Delete
* @param {number|string} value Value
[19390] Fix | Delete
* @param {string} unit Unit value
[19391] Fix | Delete
* @param {Array<Object>} units Units to derive from.
[19392] Fix | Delete
* @return {Array<number, string>} The extracted number and unit.
[19393] Fix | Delete
*/
[19394] Fix | Delete
[19395] Fix | Delete
function getParsedValue(value, unit, units) {
[19396] Fix | Delete
var initialValue = unit ? "".concat(value).concat(unit) : value;
[19397] Fix | Delete
return parseUnit(initialValue, units);
[19398] Fix | Delete
}
[19399] Fix | Delete
/**
[19400] Fix | Delete
* Checks if units are defined.
[19401] Fix | Delete
*
[19402] Fix | Delete
* @param {any} units Units to check.
[19403] Fix | Delete
* @return {boolean} Whether units are defined.
[19404] Fix | Delete
*/
[19405] Fix | Delete
[19406] Fix | Delete
function utils_hasUnits(units) {
[19407] Fix | Delete
return !Object(external_lodash_["isEmpty"])(units) && units.length > 1 && units !== false;
[19408] Fix | Delete
}
[19409] Fix | Delete
/**
[19410] Fix | Delete
* Parses a number and unit from a value.
[19411] Fix | Delete
*
[19412] Fix | Delete
* @param {string} initialValue Value to parse
[19413] Fix | Delete
* @param {Array<Object>} units Units to derive from.
[19414] Fix | Delete
* @return {Array<number, string>} The extracted number and unit.
[19415] Fix | Delete
*/
[19416] Fix | Delete
[19417] Fix | Delete
function parseUnit(initialValue) {
[19418] Fix | Delete
var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CSS_UNITS;
[19419] Fix | Delete
var value = String(initialValue).trim();
[19420] Fix | Delete
var num = parseFloat(value, 10);
[19421] Fix | Delete
num = isNaN(num) ? '' : num;
[19422] Fix | Delete
var unitMatch = value.match(/[\d.\-\+]*\s*(.*)/)[1];
[19423] Fix | Delete
var unit = unitMatch !== undefined ? unitMatch : '';
[19424] Fix | Delete
unit = unit.toLowerCase();
[19425] Fix | Delete
[19426] Fix | Delete
if (utils_hasUnits(units)) {
[19427] Fix | Delete
var match = units.find(function (item) {
[19428] Fix | Delete
return item.value === unit;
[19429] Fix | Delete
});
[19430] Fix | Delete
unit = match === null || match === void 0 ? void 0 : match.value;
[19431] Fix | Delete
} else {
[19432] Fix | Delete
unit = DEFAULT_UNIT.value;
[19433] Fix | Delete
}
[19434] Fix | Delete
[19435] Fix | Delete
return [num, unit];
[19436] Fix | Delete
}
[19437] Fix | Delete
/**
[19438] Fix | Delete
* Parses a number and unit from a value. Validates parsed value, using fallback
[19439] Fix | Delete
* value if invalid.
[19440] Fix | Delete
*
[19441] Fix | Delete
* @param {number|string} next The next value.
[19442] Fix | Delete
* @param {Array<Object>} units Units to derive from.
[19443] Fix | Delete
* @param {number|string} fallbackValue The fallback value.
[19444] Fix | Delete
* @param {string} fallbackUnit The fallback value.
[19445] Fix | Delete
* @return {Array<number, string>} The extracted number and unit.
[19446] Fix | Delete
*/
[19447] Fix | Delete
[19448] Fix | Delete
function getValidParsedUnit(next, units, fallbackValue, fallbackUnit) {
[19449] Fix | Delete
var _parseUnit = parseUnit(next, units),
[19450] Fix | Delete
_parseUnit2 = Object(slicedToArray["a" /* default */])(_parseUnit, 2),
[19451] Fix | Delete
parsedValue = _parseUnit2[0],
[19452] Fix | Delete
parsedUnit = _parseUnit2[1];
[19453] Fix | Delete
[19454] Fix | Delete
var baseValue = parsedValue;
[19455] Fix | Delete
var baseUnit;
[19456] Fix | Delete
[19457] Fix | Delete
if (isNaN(parsedValue) || parsedValue === '') {
[19458] Fix | Delete
baseValue = fallbackValue;
[19459] Fix | Delete
}
[19460] Fix | Delete
[19461] Fix | Delete
baseUnit = parsedUnit || fallbackUnit;
[19462] Fix | Delete
/**
[19463] Fix | Delete
* If no unit is found, attempt to use the first value from the collection
[19464] Fix | Delete
* of units as a default fallback.
[19465] Fix | Delete
*/
[19466] Fix | Delete
[19467] Fix | Delete
if (utils_hasUnits(units) && !baseUnit) {
[19468] Fix | Delete
var _units$;
[19469] Fix | Delete
[19470] Fix | Delete
baseUnit = (_units$ = units[0]) === null || _units$ === void 0 ? void 0 : _units$.value;
[19471] Fix | Delete
}
[19472] Fix | Delete
[19473] Fix | Delete
return [baseValue, baseUnit];
[19474] Fix | Delete
}
[19475] Fix | Delete
[19476] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
[19477] Fix | Delete
[19478] Fix | Delete
[19479] Fix | Delete
[19480] Fix | Delete
[19481] Fix | Delete
/**
[19482] Fix | Delete
* External dependencies
[19483] Fix | Delete
*/
[19484] Fix | Delete
[19485] Fix | Delete
[19486] Fix | Delete
/**
[19487] Fix | Delete
* Internal dependencies
[19488] Fix | Delete
*/
[19489] Fix | Delete
[19490] Fix | Delete
[19491] Fix | Delete
[19492] Fix | Delete
/**
[19493] Fix | Delete
* Renders a `select` if there are multiple units.
[19494] Fix | Delete
* Otherwise, renders a non-selectable label.
[19495] Fix | Delete
*
[19496] Fix | Delete
* @param {Object} props Component props.
[19497] Fix | Delete
* @param {string} [props.className] Class to set on the `select` element.
[19498] Fix | Delete
* @param {boolean} [props.isTabbable=true] Whether the control can be focused via keyboard navigation.
[19499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function