"use strict";
var import_Nameplate = require("../Nameplate.css");
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const kit_Icon = require("./Icon.cjs");
const kit_Theme_UI = require("./Theme/UI.cjs");
require("./Theme/themeUtils.cjs");
require("./Theme/themes.cjs");
const kit_Typography = require("../Typography-g8d4JFSj.cjs");
const kit_internal_useResize = require("./internal/useResize.cjs");
const base = "Nameplate_base_cb328";
const icon = "Nameplate_icon_cb328";
const text = "Nameplate_text_cb328";
const alias = "Nameplate_alias_cb328";
const compact = "Nameplate_compact_cb328";
const css = {
  base,
  icon,
  text,
  alias,
  compact
};
const Nameplate = ({ alias: alias2, compact: compact2, icon: icon2, iconSize, name }) => {
  const { size, refCallback } = kit_internal_useResize();
  const [tooltip, setTooltip] = React.useState(true);
  const {
    themeSettings: { className: themeClass }
  } = kit_Theme_UI.useTheme();
  const classnames = [css.base, themeClass];
  if (compact2)
    classnames.push(css.compact);
  const iconComponent = React.useMemo(() => {
    if (typeof icon2 === "string") {
      return /* @__PURE__ */ jsxRuntime.jsx(kit_Icon.default, { decorative: true, name: icon2, size: iconSize });
    } else
      return icon2;
  }, [icon2, iconSize]);
  React.useLayoutEffect(() => {
    setTooltip(false);
    const timer = setTimeout(() => {
      setTooltip(true);
    }, 5);
    return () => clearTimeout(timer);
  }, [size]);
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classnames.join(" "), ref: refCallback, children: [
    /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.icon, children: iconComponent }),
    /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.text, children: [
      alias2 && /* @__PURE__ */ jsxRuntime.jsx(kit_Typography.Body, { truncate: { rows: 1, tooltip }, children: alias2 }),
      /* @__PURE__ */ jsxRuntime.jsx(kit_Typography.Body, { truncate: { rows: 1, tooltip }, children: name })
    ] })
  ] });
};
module.exports = Nameplate;
