// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/tooltip.js
function tooltip_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function tooltip_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { tooltip_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { tooltip_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var TOOLTIP_OFFSET_HEIGHT = 32;
function SimpleTooltip(_ref) {
var className = _ref.className,
inputRef = _ref.inputRef,
_ref$position = _ref.position,
positionProp = _ref$position === void 0 ? 'auto' : _ref$position,
show = _ref$show === void 0 ? false : _ref$show,
style = _ref$style === void 0 ? {} : _ref$style,
value = _ref$value === void 0 ? 0 : _ref$value,
_ref$renderTooltipCon = _ref.renderTooltipContent,
renderTooltipContent = _ref$renderTooltipCon === void 0 ? function (v) {
} : _ref$renderTooltipCon,
_ref$zIndex = _ref.zIndex,
zIndex = _ref$zIndex === void 0 ? 100 : _ref$zIndex,
restProps = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "inputRef", "position", "show", "style", "value", "renderTooltipContent", "zIndex"]);
var position = useTooltipPosition({
var classes = classnames_default()('components-simple-tooltip', className);
var styles = tooltip_objectSpread(tooltip_objectSpread({}, style), {}, {
return Object(external_wp_element_["createElement"])(range_control_styles_Tooltip, Object(esm_extends["a" /* default */])({}, restProps, {
}), renderTooltipContent(value));
function useTooltipPosition(_ref2) {
var inputRef = _ref2.inputRef,
positionProp = _ref2.position;
var _useState = Object(external_wp_element_["useState"])('top'),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
position = _useState2[0],
setPosition = _useState2[1];
var calculatePosition = Object(external_wp_element_["useCallback"])(function () {
if (inputRef && inputRef.current) {
var nextPosition = positionProp;
if (positionProp === 'auto') {
var _inputRef$current$get = inputRef.current.getBoundingClientRect(),
top = _inputRef$current$get.top;
var isOffscreenTop = top - TOOLTIP_OFFSET_HEIGHT < 0;
nextPosition = isOffscreenTop ? 'bottom' : 'top';
setPosition(nextPosition);
Object(external_wp_element_["useEffect"])(function () {
Object(external_wp_element_["useEffect"])(function () {
window.addEventListener('resize', calculatePosition);
window.removeEventListener('resize', calculatePosition);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/index.js
function RangeControl(_ref, ref) {
var afterIcon = _ref.afterIcon,
_ref$allowReset = _ref.allowReset,
allowReset = _ref$allowReset === void 0 ? false : _ref$allowReset,
beforeIcon = _ref.beforeIcon,
className = _ref.className,
currentInput = _ref.currentInput,
colorProp = _ref$color === void 0 ? colors_color('ui.theme') : _ref$color,
_ref$disabled = _ref.disabled,
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
initialPosition = _ref.initialPosition,
_ref$isShiftStepEnabl = _ref.isShiftStepEnabled,
isShiftStepEnabled = _ref$isShiftStepEnabl === void 0 ? true : _ref$isShiftStepEnabl,
marks = _ref$marks === void 0 ? false : _ref$marks,
max = _ref$max === void 0 ? 100 : _ref$max,
min = _ref$min === void 0 ? 0 : _ref$min,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? external_lodash_["noop"] : _ref$onBlur,
_ref$onChange = _ref.onChange,
onChange = _ref$onChange === void 0 ? external_lodash_["noop"] : _ref$onChange,
_ref$onFocus = _ref.onFocus,
onFocus = _ref$onFocus === void 0 ? external_lodash_["noop"] : _ref$onFocus,
_ref$onMouseMove = _ref.onMouseMove,
onMouseMove = _ref$onMouseMove === void 0 ? external_lodash_["noop"] : _ref$onMouseMove,
_ref$onMouseLeave = _ref.onMouseLeave,
onMouseLeave = _ref$onMouseLeave === void 0 ? external_lodash_["noop"] : _ref$onMouseLeave,
railColor = _ref.railColor,
resetFallbackValue = _ref.resetFallbackValue,
_ref$renderTooltipCon = _ref.renderTooltipContent,
renderTooltipContent = _ref$renderTooltipCon === void 0 ? function (v) {
} : _ref$renderTooltipCon,
showTooltipProp = _ref.showTooltip,
_ref$shiftStep = _ref.shiftStep,
shiftStep = _ref$shiftStep === void 0 ? 10 : _ref$shiftStep,
step = _ref$step === void 0 ? 1 : _ref$step,
trackColor = _ref.trackColor,
_ref$withInputField = _ref.withInputField,
withInputField = _ref$withInputField === void 0 ? true : _ref$withInputField,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["afterIcon", "allowReset", "beforeIcon", "className", "currentInput", "color", "disabled", "help", "initialPosition", "isShiftStepEnabled", "label", "marks", "max", "min", "onBlur", "onChange", "onFocus", "onMouseMove", "onMouseLeave", "railColor", "resetFallbackValue", "renderTooltipContent", "showTooltip", "shiftStep", "step", "trackColor", "value", "withInputField"]);
var _useControlledRangeVa = useControlledRangeValue({
_useControlledRangeVa2 = Object(slicedToArray["a" /* default */])(_useControlledRangeVa, 2),
value = _useControlledRangeVa2[0],
setValue = _useControlledRangeVa2[1];
var isResetPendent = Object(external_wp_element_["useRef"])(false);
var _useState = Object(external_wp_element_["useState"])(showTooltipProp),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
showTooltip = _useState2[0],
setShowTooltip = _useState2[1];
var _useState3 = Object(external_wp_element_["useState"])(false),
_useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2),
isFocused = _useState4[0],
setIsFocused = _useState4[1];
var inputRef = Object(external_wp_element_["useRef"])();
var setRef = function setRef(nodeRef) {
inputRef.current = nodeRef;
var isCurrentlyFocused = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.matches(':focus');
var isThumbFocused = !disabled && isFocused;
var isValueReset = value === null;
var currentValue = value !== undefined ? value : currentInput;
var inputSliderValue = isValueReset ? '' : currentValue;
var rangeFillValue = isValueReset ? (max - min) / 2 + min : value;
var calculatedFillValue = (value - min) / (max - min) * 100;
var fillValue = isValueReset ? 50 : calculatedFillValue;
var fillValueOffset = "".concat(Object(external_lodash_["clamp"])(fillValue, 0, 100), "%");
var classes = classnames_default()('components-range-control', className);
var wrapperClasses = classnames_default()('components-range-control__wrapper', !!marks && 'is-marked');
var id = Object(external_wp_compose_["useInstanceId"])(RangeControl, 'inspector-range-control');
var describedBy = !!help ? "".concat(id, "__help") : undefined;
var enableTooltip = showTooltipProp !== false && Object(external_lodash_["isFinite"])(value);
var handleOnRangeChange = function handleOnRangeChange(event) {
var nextValue = parseFloat(event.target.value);
var handleOnChange = function handleOnChange(nextValue) {
nextValue = parseFloat(nextValue);
* Calls onChange only when nextValue is numeric
* otherwise may queue a reset for the blur event.
if (nextValue < min || nextValue > max) {
nextValue = floatClamp(nextValue, min, max);
isResetPendent.current = false;
isResetPendent.current = true;
var handleOnInputNumberBlur = function handleOnInputNumberBlur() {
if (isResetPendent.current) {
isResetPendent.current = false;
var handleOnReset = function handleOnReset() {
var resetValue = parseFloat(resetFallbackValue);
var onChangeResetValue = resetValue;
onChangeResetValue = undefined;
* Previously, this callback would always receive undefined as
* an argument. This behavior is unexpected, specifically
* when resetFallbackValue is defined.
* The value of undefined is not ideal. Passing it through
* to internal <input /> elements would change it from a
* controlled component to an uncontrolled component.
* For now, to minimize unexpected regressions, we're going to
* preserve the undefined callback argument, except when a
* resetFallbackValue is defined.
onChange(onChangeResetValue);
var handleShowTooltip = function handleShowTooltip() {
return setShowTooltip(true);
var handleHideTooltip = function handleHideTooltip() {
return setShowTooltip(false);
var handleOnBlur = function handleOnBlur(event) {
var handleOnFocus = function handleOnFocus(event) {
var offsetStyle = Object(esm_defineProperty["a" /* default */])({}, Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left', fillValueOffset);
return Object(external_wp_element_["createElement"])(base_control, {
}, Object(external_wp_element_["createElement"])(range_control_styles_Root, {
className: "components-range-control__root"
}, beforeIcon && Object(external_wp_element_["createElement"])(BeforeIconWrapper, null, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
})), Object(external_wp_element_["createElement"])(range_control_styles_Wrapper, {
className: wrapperClasses,
}, Object(external_wp_element_["createElement"])(input_range, Object(esm_extends["a" /* default */])({}, props, {
className: "components-range-control__slider",
describedBy: describedBy,
isShiftStepEnabled: isShiftStepEnabled,
onChange: handleOnRangeChange,
onMouseMove: onMouseMove,
onMouseLeave: onMouseLeave,
})), Object(external_wp_element_["createElement"])(RangeRail, {
}), Object(external_wp_element_["createElement"])(Track, {
className: "components-range-control__track",
}), Object(external_wp_element_["createElement"])(ThumbWrapper, {
}, Object(external_wp_element_["createElement"])(Thumb, {
isFocused: isThumbFocused
})), enableTooltip && Object(external_wp_element_["createElement"])(SimpleTooltip, {
className: "components-range-control__tooltip",
renderTooltipContent: renderTooltipContent,
show: isCurrentlyFocused || showTooltip,
})), afterIcon && Object(external_wp_element_["createElement"])(AfterIconWrapper, null, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
})), withInputField && Object(external_wp_element_["createElement"])(InputNumber, {
className: "components-range-control__number",
isShiftStepEnabled: isShiftStepEnabled,
onBlur: handleOnInputNumberBlur,
onChange: handleOnChange,
}), allowReset && Object(external_wp_element_["createElement"])(ActionRightWrapper, null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-range-control__reset",
disabled: disabled || value === undefined,
}, Object(external_wp_i18n_["__"])('Reset')))));
var range_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(RangeControl);
/* harmony default export */ var range_control = (range_control_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/next.js
var FontSizePicker = false ? undefined : undefined;
function next_withNextComponent(current) {
return withNext(current, FontSizePicker, 'WPComponentsFontSizePicker');
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/index.js
var DEFAULT_FONT_SIZE = 'default';
var CUSTOM_FONT_SIZE = 'custom';
var MAX_FONT_SIZE_DISPLAY = '25px';
function getSelectValueFromFontSize(fontSizes, value) {
var fontSizeValue = fontSizes.find(function (font) {
return font.size === value;
return fontSizeValue ? fontSizeValue.slug : CUSTOM_FONT_SIZE;
return DEFAULT_FONT_SIZE;
function getSelectOptions(optionsArray, disableCustomFontSizes) {
if (disableCustomFontSizes && !optionsArray.length) {
name: Object(external_wp_i18n_["__"])('Default')
}].concat(Object(toConsumableArray["a" /* default */])(optionsArray), Object(toConsumableArray["a" /* default */])(disableCustomFontSizes ? [] : [{
name: Object(external_wp_i18n_["__"])('Custom')
return optionsArray.map(function (option) {
fontSize: "min( ".concat(option.size, ", ").concat(MAX_FONT_SIZE_DISPLAY, " )")
function font_size_picker_FontSizePicker(_ref, ref) {
var fallbackFontSize = _ref.fallbackFontSize,
_ref$fontSizes = _ref.fontSizes,
fontSizes = _ref$fontSizes === void 0 ? [] : _ref$fontSizes,
_ref$disableCustomFon = _ref.disableCustomFontSizes,
disableCustomFontSizes = _ref$disableCustomFon === void 0 ? false : _ref$disableCustomFon,
_onChange = _ref.onChange,
_ref$withSlider = _ref.withSlider,
withSlider = _ref$withSlider === void 0 ? false : _ref$withSlider;
var hasUnits = Object(external_lodash_["isString"])(value) || fontSizes[0] && Object(external_lodash_["isString"])(fontSizes[0].size);
noUnitsValue = parseInt(value);
var isPixelValue = Object(external_lodash_["isNumber"])(value) || Object(external_lodash_["isString"])(value) && value.endsWith('px');