Files
metabuilder/packages/ui_dialogs/seed/scripts/confirm.lua
JohnDoe6345789 bf1401fe34 Enhance module definitions and add type annotations across various packages
- Added type annotations and class definitions in the dashboard layout, stats, and data table modules for improved type safety and documentation.
- Introduced new classes for UI components, props, and configuration in the form builder, navigation menu, notification center, and UI dialogs packages.
- Implemented detailed type definitions for actions, fields, and pagination components to streamline usage and enhance clarity.
- Updated initialization functions in multiple packages to include versioning and installation context.
- Improved structure and readability of the codebase by organizing and documenting component properties and methods.
2025-12-30 10:21:33 +00:00

41 lines
1.1 KiB
Lua

---@class Confirm
local M = {}
---@class ConfirmProps
---@field open boolean
---@field title? string
---@field message string
---@field confirmText? string
---@field destructive? boolean
---@class UIComponent
---@field type string
---@field props? table
---@field children? table
---@param props ConfirmProps
---@return UIComponent
function M.render(props)
return {
type = "Dialog",
props = { open = props.open },
children = {
{
type = "DialogContent",
children = {
{ type = "DialogHeader", children = {
{ type = "DialogTitle", props = { text = props.title or "Confirm" } },
{ type = "DialogDescription", props = { text = props.message } }
}},
{ type = "DialogFooter", children = {
{ type = "Button", props = { variant = "outline", text = "Cancel", onClick = "onCancel" } },
{ type = "Button", props = { variant = props.destructive and "destructive" or "default", text = props.confirmText or "Confirm", onClick = "onConfirm" } }
}}
}
}
}
}
end
return M