Update new functions

This commit is contained in:
2026-04-06 03:19:15 +02:00
parent f9095332eb
commit 294547fc56
139 changed files with 2249 additions and 2109 deletions

View File

@@ -1,4 +1,4 @@
import { $html, $for } from "sigpro";
import { Tag, For } from "sigpro";
import { val } from "../core/utils.js";
export const Dropdown = (props, children) => {
@@ -7,28 +7,28 @@ export const Dropdown = (props, children) => {
const renderContent = () => {
if (items) {
const source = typeof items === "function" ? items : () => items;
return $html("ul", {
return Tag("ul", {
tabindex: 0,
class: "dropdown-content z-[50] menu p-2 shadow bg-base-100 rounded-box w-52 border border-base-300"
}, [
$for(source, (item) =>
$html("li", {}, [
$html("a", {
For(source, (item) =>
Tag("li", {}, [
Tag("a", {
class: item.class || "",
onclick: (e) => {
if (item.onclick) item.onclick(e);
if (document.activeElement) document.activeElement.blur();
}
}, [
item.icon ? $html("span", {}, item.icon) : null,
$html("span", {}, item.label)
item.icon ? Tag("span", {}, item.icon) : null,
Tag("span", {}, item.label)
])
])
)
]);
}
return $html("div", {
return Tag("div", {
tabindex: 0,
class: "dropdown-content z-[50] p-2 shadow bg-base-100 rounded-box min-w-max border border-base-300"
}, [
@@ -36,11 +36,11 @@ export const Dropdown = (props, children) => {
]);
};
return $html("div", {
return Tag("div", {
...rest,
class: () => `dropdown ${val(props.class) || ""}`,
}, [
$html("div", {
Tag("div", {
tabindex: 0,
role: "button",
class: "btn m-1 flex items-center gap-2",