"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = TextDecorationControl;
var _clsx = _interopRequireDefault(require("clsx"));
var _icons = require("@wordpress/icons");
var _i18n = require("@wordpress/i18n");
var _segmentedTextControl = _interopRequireDefault(require("../segmented-text-control"));
var _jsxRuntime = require("react/jsx-runtime");
/**
 * External dependencies
 */

/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const TEXT_DECORATIONS = [{
  label: (0, _i18n.__)('None'),
  value: 'none',
  icon: _icons.reset
}, {
  label: (0, _i18n.__)('Underline'),
  value: 'underline',
  icon: _icons.formatUnderline
}, {
  label: (0, _i18n.__)('Strikethrough'),
  value: 'line-through',
  icon: _icons.formatStrikethrough
}];

/**
 * Control to facilitate text decoration selections.
 *
 * @param {Object}   props           Component props.
 * @param {string}   props.value     Currently selected text decoration.
 * @param {Function} props.onChange  Handles change in text decoration selection.
 * @param {string}   props.className Additional class name to apply.
 *
 * @return {Element} Text decoration control.
 */
function TextDecorationControl({
  value,
  onChange,
  className
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_segmentedTextControl.default, {
    label: (0, _i18n.__)('Decoration'),
    options: TEXT_DECORATIONS,
    className: (0, _clsx.default)('block-editor-text-decoration-control', className),
    value: value,
    onChange: newValue => {
      onChange(newValue === value ? undefined : newValue);
    }
  });
}
//# sourceMappingURL=index.js.map