Include label in Input

This commit is contained in:
2026-04-06 22:22:11 +02:00
parent ebc4dc2d3b
commit c08f001a80
46 changed files with 219 additions and 17247 deletions

View File

@@ -1,28 +1,18 @@
// 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;
const { children, value, floating = false, 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("floating-label", className), ...rest }, () => [
typeof children === 'function' ? children() : children,
value ? Tag("span", {}, val(value)) : 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,
return Tag("label", { class: ui("label", className), ...rest }, () => [
value ? Tag("span", { class: "label-text" }, val(value)) : null,
typeof children === 'function' ? children() : children
]);
};