"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = WritingModeControl;
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 WRITING_MODES = [{
  label: (0, _i18n.__)('Horizontal'),
  value: 'horizontal-tb',
  icon: _icons.textHorizontal
}, {
  label: (0, _i18n.__)('Vertical'),
  value: (0, _i18n.isRTL)() ? 'vertical-lr' : 'vertical-rl',
  icon: _icons.textVertical
}];

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