@payfit/unity-components
Version:
35 lines (34 loc) • 1.25 kB
JavaScript
import { checkbox as e } from "./Checkbox.variants.js";
import { CheckboxIndicator as t } from "./parts/CheckboxIndicator.js";
import { forwardRef as n } from "react";
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
import { useId as o } from "react-aria/useId";
import { CheckboxButton as s, CheckboxField as c } from "react-aria-components/Checkbox";
//#region src/components/checkbox/CheckboxStandalone.tsx
var l = n(({ children: n, ...l }, u) => {
let d = o(), { isDisabled: f, isReadOnly: p, isInvalid: m } = l, { base: h, wrapper: g } = e({
isDisabled: f,
isReadOnly: p,
isInvalid: m
}), _ = [l["aria-labelledby"], `${d}-label`].filter(Boolean), v = _.length > 0 ? _.join(" ") : void 0;
return /* @__PURE__ */ i("div", {
className: h(),
children: /* @__PURE__ */ i(c, {
...l,
className: "uy:contents",
"aria-labelledby": v,
children: /* @__PURE__ */ i(s, {
ref: u,
className: g(),
children: (e) => /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(t, { ...e }), /* @__PURE__ */ i("span", {
id: `${d}-label`,
className: "uy:sr-only",
children: n
})] })
})
})
});
});
l.displayName = "CheckboxStandalone";
//#endregion
export { l as CheckboxStandalone };