import { useSlotId as s, mergeProps as f, useId as t, useLabels as p } from "../../utils/dist/module.es.js";
function c(r) {
  let { id: a, label: d, "aria-labelledby": e, "aria-label": b, labelElementType: o = "label" } = r;
  a = t(a);
  let l = t(), i = {};
  d ? (e = e ? `${e} ${l}` : l, i = {
    id: l,
    htmlFor: o === "label" ? a : void 0
  }) : !e && !b && console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
  let n = p({
    id: a,
    "aria-label": b,
    "aria-labelledby": e
  });
  return {
    labelProps: i,
    fieldProps: n
  };
}
function u(r) {
  let { description: a, errorMessage: d, validationState: e } = r, { labelProps: b, fieldProps: o } = c(r), l = s([
    Boolean(a),
    Boolean(d),
    e
  ]), i = s([
    Boolean(a),
    Boolean(d),
    e
  ]);
  return o = f(o, {
    "aria-describedby": [
      l,
      i,
      r["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  }), {
    labelProps: b,
    fieldProps: o,
    descriptionProps: {
      id: l
    },
    errorMessageProps: {
      id: i
    }
  };
}
export {
  u as useField,
  c as useLabel
};
//# sourceMappingURL=module.es.js.map
