Update new functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/Modal.js
|
||||
import { $html, $watch } from "../sigpro.js";
|
||||
import { Tag, Watch } from "../sigpro.js";
|
||||
import { ui } from "../core/utils.js";
|
||||
import { tt } from "../core/i18n.js";
|
||||
import { Button } from "./Button.js";
|
||||
@@ -28,13 +28,13 @@ export const Modal = (props, children) => {
|
||||
}
|
||||
};
|
||||
|
||||
$watch(() => handleOpen());
|
||||
Watch(() => handleOpen());
|
||||
|
||||
const close = () => {
|
||||
if (typeof open === "function") open(false);
|
||||
};
|
||||
|
||||
return $html("dialog", {
|
||||
return Tag("dialog", {
|
||||
...rest,
|
||||
ref: (el) => {
|
||||
dialogElement = el;
|
||||
@@ -44,22 +44,22 @@ export const Modal = (props, children) => {
|
||||
onclose: close,
|
||||
oncancel: close
|
||||
}, [
|
||||
$html("div", { class: "modal-box" }, [
|
||||
title ? $html("h3", { class: "text-lg font-bold mb-4" }, () =>
|
||||
Tag("div", { class: "modal-box" }, [
|
||||
title ? Tag("h3", { class: "text-lg font-bold mb-4" }, () =>
|
||||
typeof title === "function" ? title() : title
|
||||
) : null,
|
||||
$html("div", { class: "py-2" }, [
|
||||
Tag("div", { class: "py-2" }, [
|
||||
typeof children === "function" ? children() : children
|
||||
]),
|
||||
$html("div", { class: "modal-action" }, [
|
||||
$html("form", { method: "dialog", class: "flex gap-2" }, [
|
||||
Tag("div", { class: "modal-action" }, [
|
||||
Tag("form", { method: "dialog", class: "flex gap-2" }, [
|
||||
...(Array.isArray(buttons) ? buttons : [buttons]).filter(Boolean),
|
||||
Button({ type: "submit" }, tt("close")())
|
||||
])
|
||||
])
|
||||
]),
|
||||
$html("form", { method: "dialog", class: "modal-backdrop" }, [
|
||||
$html("button", {}, "close")
|
||||
Tag("form", { method: "dialog", class: "modal-backdrop" }, [
|
||||
Tag("button", {}, "close")
|
||||
])
|
||||
]);
|
||||
};
|
||||
Reference in New Issue
Block a user