diff --git a/lib/component/modal/Modal.tsx b/lib/component/modal/Modal.tsx index 3c40541..fb06d63 100644 --- a/lib/component/modal/Modal.tsx +++ b/lib/component/modal/Modal.tsx @@ -3,17 +3,14 @@ import { Dialog, DialogBackdrop, DialogPanel } from "@headlessui/react"; import clsx from "clsx"; -export default function Modal(props: ModalProps){ - const { - display, - onClose, - className, - backgroundType = "blur", - top, - children - } = props; - - +export default function Modal({ + display, + onClose, + className, + backgroundType = "blur", + top, + children +}: Readonly){ return ( ){ return (
{children}
diff --git a/lib/component/modal/ModalFooter.tsx b/lib/component/modal/ModalFooter.tsx index a85fcb2..a81c321 100644 --- a/lib/component/modal/ModalFooter.tsx +++ b/lib/component/modal/ModalFooter.tsx @@ -2,19 +2,18 @@ import type { ModalFooterProps } from "$/types/ModalTypes"; import clsx from "clsx"; -export default function ModalFooter(props: ModalFooterProps){ - const { - className, - children - } = props; - - +export default function ModalFooter({ + className, + children, + ...props +}: Readonly){ return (
){ return (
{ onClose && -
-
+ }
); diff --git a/lib/component/nav/DarkModeSwitch.tsx b/lib/component/nav/DarkModeSwitch.tsx index 5aef88e..c2ab836 100644 --- a/lib/component/nav/DarkModeSwitch.tsx +++ b/lib/component/nav/DarkModeSwitch.tsx @@ -8,7 +8,7 @@ export default function DarkModeSwitch(){ const updateTheme = () => { if(theme === "system"){ - if(window.document.documentElement.classList.contains("dark")){ + if(globalThis.document.documentElement.classList.contains("dark")){ setTheme("light"); } else{ diff --git a/lib/component/nav/NavBar.tsx b/lib/component/nav/NavBar.tsx index 10f1744..44239b7 100644 --- a/lib/component/nav/NavBar.tsx +++ b/lib/component/nav/NavBar.tsx @@ -2,13 +2,11 @@ import type { NavBarProps } from "$/types/NavTypes"; import clsx from "clsx"; -export default function NavBar(props: NavBarProps){ - const { - className, - children - } = props; - - +export default function NavBar({ + className, + children, + ...props +}: Readonly){ return ( diff --git a/lib/component/nav/PopoverMenu.tsx b/lib/component/nav/PopoverMenu.tsx index 7068ef4..baa973d 100644 --- a/lib/component/nav/PopoverMenu.tsx +++ b/lib/component/nav/PopoverMenu.tsx @@ -3,14 +3,11 @@ import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react"; import clsx from "clsx"; import { RiArrowRightSLine } from "react-icons/ri"; -export default function PopoverMenu(props: PopoverMenuProps){ - const { - buttonContent, - anchor, - children - } = props; - - +export default function PopoverMenu({ + buttonContent, + anchor, + children +}: Readonly){ return ( ){ return ( ){ return ( { tabs.map((tab, index) => ( - + {tab.tab} )) @@ -35,9 +30,7 @@ export default function MattrixwvTabGroup(props: MattrixwvTabGroupProps){ { tabs.map((tab, index) => ( - + {tab.content} )) diff --git a/lib/component/tab/MattrixwvTabList.tsx b/lib/component/tab/MattrixwvTabList.tsx index c2dd3c9..749e77d 100644 --- a/lib/component/tab/MattrixwvTabList.tsx +++ b/lib/component/tab/MattrixwvTabList.tsx @@ -2,16 +2,11 @@ import type { MattrixwvTabListProps } from "$/types/TabTypes"; import { TabList } from "@headlessui/react"; -export default function MattrixwvTabList(props: MattrixwvTabListProps){ - const { - children - } = props; - - +export default function MattrixwvTabList({ + children +}: Readonly){ return ( - + {children} ); diff --git a/lib/component/tab/MattrixwvTabPanel.tsx b/lib/component/tab/MattrixwvTabPanel.tsx index da9a8ed..ea42a55 100644 --- a/lib/component/tab/MattrixwvTabPanel.tsx +++ b/lib/component/tab/MattrixwvTabPanel.tsx @@ -2,16 +2,11 @@ import type { MattrixwvTabPanelProps } from "$/types/TabTypes"; import { TabPanel } from "@headlessui/react"; -export default function MattrixwvTabPanel(props: MattrixwvTabPanelProps){ - const { - children - } = props; - - +export default function MattrixwvTabPanel({ + children +}: Readonly){ return ( - + {children} ); diff --git a/lib/component/tab/MattrixwvTabPanels.tsx b/lib/component/tab/MattrixwvTabPanels.tsx index 9e4f37f..b5cb09e 100644 --- a/lib/component/tab/MattrixwvTabPanels.tsx +++ b/lib/component/tab/MattrixwvTabPanels.tsx @@ -2,16 +2,11 @@ import type { MattrixwvTabPanelsProps } from "$/types/TabTypes"; import { TabPanels } from "@headlessui/react"; -export default function MattrixwvTabPanels(props: MattrixwvTabPanelsProps){ - const { - children - } = props; - - +export default function MattrixwvTabPanels({ + children +}: Readonly){ return ( - + {children} ); diff --git a/lib/component/toaster/Toaster.tsx b/lib/component/toaster/Toaster.tsx index 1ea3980..323d439 100644 --- a/lib/component/toaster/Toaster.tsx +++ b/lib/component/toaster/Toaster.tsx @@ -6,7 +6,7 @@ import clsx from "clsx"; export default function Toaster({ toast, className -}: ToasterProps){ +}: Readonly){ return ( 1 || (toast.length === 1 && toast[0].hideTime > new Date())} diff --git a/lib/providers/theme/ThemeProvider.tsx b/lib/providers/theme/ThemeProvider.tsx index 36e736a..cf49ca0 100644 --- a/lib/providers/theme/ThemeProvider.tsx +++ b/lib/providers/theme/ThemeProvider.tsx @@ -10,7 +10,7 @@ const themeInitialState: ThemeProviderState = { const ThemeProviderContext = createContext(themeInitialState); -export default function ThemeProvider(props: ThemeProviderProps){ +export default function ThemeProvider(props: Readonly){ const { children, defaultTheme = "system", @@ -20,12 +20,12 @@ export default function ThemeProvider(props: ThemeProviderProps){ const [ theme, setTheme ] = useState((localStorage.getItem(storageKey) as Theme) || defaultTheme); useEffect(() => { - const root = window.document.documentElement; + const root = globalThis.document.documentElement; root.classList.remove("light", "dark"); if(theme === "system"){ - const systemTheme = window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; + const systemTheme = globalThis.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; root.classList.add(systemTheme); } diff --git a/lib/providers/toaster/ToasterProvider.tsx b/lib/providers/toaster/ToasterProvider.tsx index 908c1c7..f488488 100644 --- a/lib/providers/toaster/ToasterProvider.tsx +++ b/lib/providers/toaster/ToasterProvider.tsx @@ -19,7 +19,7 @@ const ToasterProviderContext = createContext(toastInitialSta export default function ToasterProvider({ className, children -}: ToastProviderProps){ +}: Readonly){ const [ toast, setToast ] = useState([]); diff --git a/lib/types/ButtonTypes.ts b/lib/types/ButtonTypes.ts index 96ba797..35a88f4 100644 --- a/lib/types/ButtonTypes.ts +++ b/lib/types/ButtonTypes.ts @@ -1,4 +1,4 @@ -import type { ButtonHTMLAttributes } from "react"; +import type { ComponentProps } from "react"; export type ButtonRounding = "none" | "sm" | "md" | "lg" | "full"; @@ -7,7 +7,7 @@ export type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl"; export type ButtonVariant = "standard" | "outline" | "ghost" | "outline-ghost" | "icon"; -export interface ButtonProps extends Omit, "size" | "type"> { +export interface ButtonProps extends Omit, "size" | "type"> { type?: "button" | "submit" | "reset"; rounding?: ButtonRounding; shape?: ButtonShape; diff --git a/lib/types/InputTypes.ts b/lib/types/InputTypes.ts index 9518792..06b5c73 100644 --- a/lib/types/InputTypes.ts +++ b/lib/types/InputTypes.ts @@ -1,5 +1,5 @@ import type React from "react"; -import type { ChangeEventHandler, InputHTMLAttributes } from "react"; +import type { ChangeEventHandler, ComponentProps } from "react"; export interface TextInputProps { @@ -167,7 +167,7 @@ export interface RadioListProps { } -export interface DateInputProps extends Omit, "value" | "onChange" | "step">{ +export interface DateInputProps extends Omit, "value" | "onChange" | "step">{ step?: number; value: Date | undefined; onChange: (newValue: Date | undefined) => void; diff --git a/lib/types/MessageTypes.ts b/lib/types/MessageTypes.ts index 36a9e61..f336639 100644 --- a/lib/types/MessageTypes.ts +++ b/lib/types/MessageTypes.ts @@ -1,7 +1,7 @@ -import type { HTMLProps } from "react"; +import type { ComponentProps } from "react"; -export interface MessageBlockProps extends HTMLProps { +export interface MessageBlockProps extends ComponentProps<"div"> { outline?: "none" | "sm" | "md" | "lg"; rounded?: "none" | "xs" | "sm" | "md" | "lg" | "xl"; } diff --git a/lib/types/ModalTypes.ts b/lib/types/ModalTypes.ts index 6984e12..d828589 100644 --- a/lib/types/ModalTypes.ts +++ b/lib/types/ModalTypes.ts @@ -1,18 +1,21 @@ +import type { ComponentProps } from "react"; + + export type ModalBackgroundType = "darken" | "lighten" | "blur" | "darken-blur" | "lighten-blur" | "darken-blur-radial" | "lighten-blur-radial" | "transparent" | "none"; -export interface ModalHeaderProps { +export interface ModalHeaderProps extends ComponentProps<"div"> { onClose?: () => void; className?: string; children: React.ReactNode; } -export interface ModalFooterProps { +export interface ModalFooterProps extends ComponentProps<"div"> { className?: string; children: React.ReactNode; } -export interface ModalBodyProps { +export interface ModalBodyProps extends ComponentProps<"div"> { className?: string; children: React.ReactNode; } diff --git a/lib/types/NavTypes.ts b/lib/types/NavTypes.ts index b4f2289..c4511a2 100644 --- a/lib/types/NavTypes.ts +++ b/lib/types/NavTypes.ts @@ -1,3 +1,6 @@ +import type { ComponentProps } from "react"; + + export type Align = "start" | "end"; export type Placement = "top" | "bottom" | "left" | "right"; export type AnchorTo = `${Placement}` | `${Placement} ${Align}`; @@ -9,7 +12,7 @@ export interface PopoverMenuProps { children: React.ReactNode; } -export interface NavBarProps { +export interface NavBarProps extends ComponentProps<"nav"> { className?: string; children: React.ReactNode; }