// components/Label.js import { $, Tag } from "../sigpro.js"; import { ui, val } from "../core/utils.js"; /** * Label component * * daisyUI classes used: * - label * - floating-label */ export const Label = (props) => { const { children, value, floating = false, error, required, class: className, ...rest } = props; if (floating) { return Tag("label", { class: ui("floating-label w-full", className), ...rest }, () => [ value ? Tag("span", {}, value) : null, children, error ? Tag("span", { class: "text-error text-xs" }, val(error)) : null, ]); } return Tag("label", { class: ui("input w-full", className), ...rest }, () => [ value ? Tag("span", { class: "label" }, value) : null, children, error ? Tag("span", { class: "text-error text-xs" }, val(error)) : null, ]); };