"use client";
import { jsxs as m, jsx as t } from "react/jsx-runtime";
import { L as f } from "./label-i1xbmg8y1n0tbtkx.js";
import { c as a } from "./vendor-styling-ofvnbcuht98q88oo.js";
import { O as u, P as p, aW as x, aX as d } from "./vendor-base-ui-elpbzr8xeffrz4h2.js";
function y(e) {
  if (e)
    return typeof e == "string" ? { message: e, match: !0 } : e;
}
const _ = {
  // Field currently has no variant options but structure is ready for future additions
}, L = {};
function g({
  controlFirst: e = !1
} = {}) {
  return a(
    // Base styles - vertical layout (default)
    "grid gap-2",
    // Horizontal layout for checkbox and switch
    // Default: Grid auto-reverses in RTL (desired)
    "has-[input[type=checkbox]]:grid-cols-[auto_1fr] has-[input[type=checkbox]]:items-center",
    "has-[[role=switch]]:grid-cols-[auto_1fr] has-[[role=switch]]:items-center",
    // Control first: use flexbox with row-reverse to flip visual order without affecting text direction
    // flex-row-reverse in LTR: Control→Label, in RTL: Label→Control (opposite of grid default)
    e && [
      "has-[input[type=checkbox]]:flex has-[input[type=checkbox]]:flex-row-reverse has-[input[type=checkbox]]:flex-wrap has-[input[type=checkbox]]:items-center",
      "has-[[role=switch]]:flex has-[[role=switch]]:flex-row-reverse has-[[role=switch]]:flex-wrap has-[[role=switch]]:items-center",
      "[&>label]:flex-1"
    ]
  );
}
function N({
  children: e,
  label: i,
  required: c,
  labelTooltip: n,
  error: s,
  description: l,
  controlFirst: o = !1,
  hideLabel: r = !1
}) {
  const h = c === !1;
  return /* @__PURE__ */ m(u, { className: g({ controlFirst: o }), children: [
    !r && /* @__PURE__ */ t(p, { className: "m-0 select-none text-base font-medium text-kumo-default", children: /* @__PURE__ */ t(f, { showOptional: h, tooltip: n, asContent: !0, children: i }) }),
    e,
    s ? /* @__PURE__ */ t(
      x,
      {
        className: a(
          "text-sm leading-snug text-kumo-danger",
          // Span full width in horizontal layout
          "col-span-full"
        ),
        match: s.match,
        children: s.message
      }
    ) : l && /* @__PURE__ */ t(
      d,
      {
        className: a(
          "text-sm leading-snug text-kumo-subtle",
          // Span full width in horizontal layout
          "col-span-full"
        ),
        children: l
      }
    )
  ] });
}
export {
  N as F,
  _ as K,
  L as a,
  g as f,
  y as n
};
//# sourceMappingURL=field-bmglk138wa8bf3ei.js.map
