daily-toolset
Version:
A lightweight, versatile collection of TypeScript utility functions for everyday development needs. Simplify and streamline your Node.js, React, and Next.js projects with a powerful suite of well-organized helpers for strings, arrays, dates, objects, and
33 lines (32 loc) • 2.31 kB
JavaScript
"use client";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = Button;
exports.ButtonAdd = ButtonAdd;
const jsx_runtime_1 = require("react/jsx-runtime");
const bs_1 = require("react-icons/bs");
const hi_1 = require("react-icons/hi");
const button_1 = require("../../components/ui/button");
const Spinner_1 = require("../../components/Spinner");
const lu_1 = require("react-icons/lu");
function Button({ children, icon, type = "button", variant = "default", size = "default", isDisabled = false, loading = false, ...rest }) {
return ((0, jsx_runtime_1.jsxs)(button_1.Button, { type: type, size: size, disabled: isDisabled, variant: variant, ...rest, children: [loading && (0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { color: "blue" }), icon && (0, jsx_runtime_1.jsx)("span", { children: icon }), children] }));
}
Button.Add = function Add({ children = "Add New", variant = "green", size = "sm", ...rest }) {
return ((0, jsx_runtime_1.jsx)(Button, { icon: (0, jsx_runtime_1.jsx)(bs_1.BsPlusLg, {}), size: size, variant: variant, ...rest, children: children }));
};
Button.Remove = function Remove({ children = "Remove", variant = "destructive", size = "icon", ...rest }) {
return ((0, jsx_runtime_1.jsx)(Button, { size: size, variant: variant, ...rest, children: (0, jsx_runtime_1.jsx)(lu_1.LuMinus, {}) }));
};
function ButtonAdd({ ...rest }) {
return (0, jsx_runtime_1.jsx)(Button.Add, { ...rest });
}
Button.Submit = function Submit({ children = "Submit", isDisabled = false, size = "default", loading, ...rest }) {
return ((0, jsx_runtime_1.jsx)(Button, { type: "submit", icon: (0, jsx_runtime_1.jsx)(hi_1.HiOutlineSaveAs, {}), isDisabled: loading || isDisabled, loading: loading, variant: "teal", ...rest, children: children }));
};
Button.Search = function Search({ children = "Search", variant = "secondary", ...rest }) {
return ((0, jsx_runtime_1.jsx)(Button.Submit, { icon: (0, jsx_runtime_1.jsx)(bs_1.BsSearch, {}), variant: variant, ...rest, children: children }));
};
Button.Close = function Close({ children = "Close", variant = "destructive", size, ...rest }) {
return ((0, jsx_runtime_1.jsx)(Button, { type: "button", icon: (0, jsx_runtime_1.jsx)(bs_1.BsXLg, {}), size: size, variant: variant, ...rest, children: children }));
};
;