"use strict";

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

/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const TEXT_TRANSFORMS = [{
  label: (0, _i18n.__)('None'),
  value: 'none',
  icon: _icons.reset
}, {
  label: (0, _i18n.__)('Uppercase'),
  value: 'uppercase',
  icon: _icons.formatUppercase
}, {
  label: (0, _i18n.__)('Lowercase'),
  value: 'lowercase',
  icon: _icons.formatLowercase
}, {
  label: (0, _i18n.__)('Capitalize'),
  value: 'capitalize',
  icon: _icons.formatCapitalize
}];

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