"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = FontFamilyControl;
var _components = require("@wordpress/components");
var _i18n = require("@wordpress/i18n");
var _useSettings = require("../use-settings");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

function FontFamilyControl({
  value = '',
  onChange,
  fontFamilies,
  ...props
}) {
  const [blockLevelFontFamilies] = (0, _useSettings.useSettings)('typography.fontFamilies');
  if (!fontFamilies) {
    fontFamilies = blockLevelFontFamilies;
  }
  if (!fontFamilies || fontFamilies.length === 0) {
    return null;
  }
  const options = [{
    value: '',
    label: (0, _i18n.__)('Default')
  }, ...fontFamilies.map(({
    fontFamily,
    name
  }) => {
    return {
      value: fontFamily,
      label: name || fontFamily
    };
  })];
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
    label: (0, _i18n.__)('Font'),
    options: options,
    value: value,
    onChange: onChange,
    labelPosition: "top",
    ...props
  });
}
//# sourceMappingURL=index.js.map