@dndbuilder.com/react
Version:
Drag and drop builder for React
57 lines (56 loc) • 1.49 kB
JavaScript
"use client";
import { jsxs as c, jsx as p } from "react/jsx-runtime";
import { useSettings as $ } from "../../hooks/use-settings.js";
import { Label as S } from "../shared/label.js";
import { Switch as j } from "../shared/switch.js";
import { classNames as w } from "../../../../../utils.js";
import { useAppSelector as B } from "../../hooks/use-app-selector.js";
import { getCurrentBreakpoint as y } from "../../../../../store/selectors.js";
import { BreakpointSelector as b } from "../shared/breakpoint-selector.js";
const E = ({
type: f,
className: l,
onCheckedChange: o,
defaultChecked: n,
defaultValue: u,
fieldName: t,
label: e,
responsive: s = !1,
mode: r
}) => {
const m = B(y), [x, a] = $(
s && r ? `${t}.${m}.${r}` : s ? `${t}.${m}` : r ? `${t}.${r}` : t,
f
);
return /* @__PURE__ */ c(
S,
{
className: w(
"mt-4 flex items-center justify-between text-xs text-gray-800",
l
),
children: [
e && /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
e,
" ",
s && /* @__PURE__ */ p(b, {})
] }),
/* @__PURE__ */ p(
j,
{
checked: x,
defaultChecked: n,
defaultValue: u,
onCheckedChange: (i) => {
a(i), o == null || o(i);
}
}
)
]
}
);
};
export {
E as SwitchControl
};
//# sourceMappingURL=switch.control.js.map