Update new functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/Dropdown.js
|
||||
// import { $html, $for, $watch } from "../sigpro.js";
|
||||
// import { Tag, For, Watch } from "../sigpro.js";
|
||||
import { ui } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
@@ -28,11 +28,11 @@ if (typeof window !== 'undefined' && !window.__dropdownHandlerRegistered) {
|
||||
export const Dropdown = (props) => {
|
||||
const { class: className, label, icon, items, ...rest } = props;
|
||||
|
||||
return $html("details", {
|
||||
return Tag("details", {
|
||||
...rest,
|
||||
class: ui('dropdown', className),
|
||||
}, [
|
||||
$html("summary", {
|
||||
Tag("summary", {
|
||||
class: "btn m-1 flex items-center gap-2 list-none cursor-pointer",
|
||||
style: "display: inline-flex;",
|
||||
onclick: (e) => {
|
||||
@@ -48,15 +48,15 @@ export const Dropdown = (props) => {
|
||||
() => icon ? (typeof icon === "function" ? icon() : icon) : null,
|
||||
() => label ? (typeof label === "function" ? label() : label) : null
|
||||
]),
|
||||
$html("ul", {
|
||||
Tag("ul", {
|
||||
tabindex: "-1",
|
||||
class: "dropdown-content z-[50] menu p-2 shadow bg-base-100 rounded-box w-52 border border-base-300"
|
||||
}, [
|
||||
() => {
|
||||
const currentItems = typeof items === "function" ? items() : (items || []);
|
||||
return currentItems.map(item =>
|
||||
$html("li", {}, [
|
||||
$html("a", {
|
||||
Tag("li", {}, [
|
||||
Tag("a", {
|
||||
class: item.class || "",
|
||||
onclick: (e) => {
|
||||
if (item.onclick) item.onclick(e);
|
||||
@@ -67,8 +67,8 @@ export const Dropdown = (props) => {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
item.icon ? $html("span", {}, item.icon) : null,
|
||||
$html("span", {}, item.label)
|
||||
item.icon ? Tag("span", {}, item.icon) : null,
|
||||
Tag("span", {}, item.label)
|
||||
])
|
||||
])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user