"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Kbd = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _useTheme = require("../theme/use-theme.js");
var _index = require("../typography/index.js");
var _tokens = require("../styles/tokens.js");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const SIZE_CONFIG = {
  sm: {
    minWidth: 18,
    height: 18,
    fontSize: 11,
    paddingHorizontal: 4
  },
  md: {
    minWidth: 22,
    height: 22,
    fontSize: 12,
    paddingHorizontal: 6
  }
};

/**
 * A small keyboard-key chip. Bordered, monospace via the Bloom mono font
 * token, themed for light/dark. Used to surface shortcuts (e.g. `⌘K`,
 * `Esc`) inside menus, command palettes and tooltips.
 */
const KbdComponent = function Kbd({
  children,
  size = 'md',
  style,
  textStyle,
  testID
}) {
  const theme = (0, _useTheme.useTheme)();
  const cfg = SIZE_CONFIG[size];
  const monoFamily = _reactNative.Platform.OS === 'web' ? {
    fontFamily: 'var(--bloom-font-mono)'
  } : {
    fontFamily: 'Geist Mono'
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    testID: testID,
    style: [styles.container, {
      minWidth: cfg.minWidth,
      height: cfg.height,
      paddingHorizontal: cfg.paddingHorizontal,
      backgroundColor: theme.colors.backgroundSecondary,
      borderColor: theme.colors.border
    }, style],
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Text, {
      numberOfLines: 1,
      style: [monoFamily, {
        fontSize: cfg.fontSize,
        lineHeight: cfg.height,
        color: theme.colors.textSecondary,
        textAlign: 'center'
      }, textStyle],
      children: children
    })
  });
};
const styles = _reactNative.StyleSheet.create({
  container: {
    borderWidth: 1,
    borderRadius: _tokens.borderRadius.xs,
    alignItems: 'center',
    justifyContent: 'center'
  }
});
const Kbd = exports.Kbd = /*#__PURE__*/(0, _react.memo)(KbdComponent);
Kbd.displayName = 'Kbd';
//# sourceMappingURL=Kbd.js.map