fui-fancyui
Version:
FancyUI Libary
52 lines (51 loc) • 1.49 kB
JavaScript
"use client";
import { jsx as r, jsxs as i } from "react/jsx-runtime";
import l from "../../atoms/Typography/Typography.js";
import m from "../../organisms/FancyTextInput/FancyTextInput.js";
import { WrapperInputs as h, ContainerInputs as u } from "./ColorInputs.style.js";
import g from "./AdaptInput/AdaptInputs.js";
function y(s) {
const { currentColorObject: n, handler: c, themeType: o = "primary", layer: a = 1 } = s;
if (!n) return null;
const p = (t) => {
if (!t) return;
const e = {
inputLetter: t.target.name,
value: t.target.value ? t.target.value : "0"
};
c(e);
};
return /* @__PURE__ */ r(h, { children: typeof (n == null ? void 0 : n.color) == "string" ? /* @__PURE__ */ i(u, { children: [
/* @__PURE__ */ r(
m,
{
themeType: o,
layer: a,
name: "color",
value: n.color,
align: "center",
onChange: p
}
),
/* @__PURE__ */ r(l, { variant: "subTextFootnote", children: n.type })
] }) : (
// if the color is a object render a input field for each color value
Object.entries(n.color).map(([t, e]) => /* @__PURE__ */ i(u, { children: [
/* @__PURE__ */ r(
g,
{
themeType: o,
layer: a,
inputLetter: t,
value: e,
onChange: p,
ariaLabel: t
}
),
/* @__PURE__ */ r(l, { variant: "subTextFootnote", children: t })
] }, t))
) });
}
export {
y as default
};