diff --git a/app/components/Dialog.tsx b/app/components/Dialog.tsx index 98dc1fb..bff04c5 100644 --- a/app/components/Dialog.tsx +++ b/app/components/Dialog.tsx @@ -14,19 +14,13 @@ import { useOverlayTriggerState, } from "react-stately"; -import Button, { ButtonProps } from "~/components/Button"; -import IconButton, { IconButtonProps } from "~/components/IconButton"; -import Text from "~/components/Text"; -import Title from "~/components/Title"; +import Button, { ButtonProps } from "~/components/button"; import cn from "~/utils/cn"; import { useLiveData } from "~/utils/live-data"; export interface DialogProps extends OverlayTriggerProps { children: - | [ - React.ReactElement | React.ReactElement, - React.ReactElement, - ] + | [React.ReactElement, React.ReactElement] | React.ReactElement; } @@ -179,10 +173,5 @@ function DModal(props: DModalProps) { ); } -export default Object.assign(Dialog, { - Button, - IconButton, - Panel, - Title, - Text, -}); +export { Panel as DialogPanel }; +export default Dialog; diff --git a/app/components/IconButton.tsx b/app/components/IconButton.tsx deleted file mode 100644 index 996325d..0000000 --- a/app/components/IconButton.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React, { useRef } from "react"; -import { type AriaButtonOptions, useButton } from "react-aria"; - -import cn from "~/utils/cn"; - -export interface IconButtonProps extends AriaButtonOptions<"button"> { - variant?: "heavy" | "light"; - className?: string; - children: React.ReactNode; - label: string; - ref?: React.RefObject; -} - -export default function IconButton({ variant = "light", ...props }: IconButtonProps) { - // In case the button is used as a trigger ref - const ref = props.ref ?? useRef(null); - const { buttonProps } = useButton(props, ref); - - return ( - - ); -} diff --git a/app/components/NumberInput.tsx b/app/components/NumberInput.tsx index 31746a7..416303f 100644 --- a/app/components/NumberInput.tsx +++ b/app/components/NumberInput.tsx @@ -3,7 +3,7 @@ import { useRef } from "react"; import { type AriaNumberFieldProps, useId, useLocale, useNumberField } from "react-aria"; import { useNumberFieldState } from "react-stately"; -import IconButton from "~/components/IconButton"; +import Button from "~/components/button"; import cn from "~/utils/cn"; export interface InputProps extends AriaNumberFieldProps { @@ -57,12 +57,20 @@ export default function NumberInput(props: InputProps) { className="w-full rounded-l-md bg-transparent py-2 pl-3 focus:outline-hidden" /> - - - - - - + + {props.description && (
{ - label: string; - className?: string; -} - -function Options({ label, className, ...props }: OptionsProps) { - const state = useTabListState(props); - const ref = useRef(null); - - const { tabListProps } = useTabList(props, state, ref); - return ( -
-
- {[...state.collection].map((item) => ( -
- -
- ); -} - -export interface OptionsOptionProps { - item: Node; - state: TabListState; -} - -function Option({ item, state }: OptionsOptionProps) { - const { key, rendered } = item; - const ref = useRef(null); - - const { tabProps } = useTab({ key }, state, ref); - return ( -
- {rendered} -
- ); -} - -export interface OptionsPanelProps extends AriaTabPanelProps { - state: TabListState; -} - -function OptionsPanel({ state, ...props }: OptionsPanelProps) { - const ref = useRef(null); - const { tabPanelProps } = useTabPanel(props, state, ref); - return ( -
- {state.selectedItem?.props.children} -
- ); -} - -export default Object.assign(Options, { Item }); diff --git a/app/components/Spinner.tsx b/app/components/Spinner.tsx deleted file mode 100644 index f40688b..0000000 --- a/app/components/Spinner.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import clsx from 'clsx'; - -interface Props { - className?: string; -} - -export default function Spinner({ className }: Props) { - return ( -
-
- Loading... -
-
- ); -} diff --git a/app/components/ToastProvider.tsx b/app/components/ToastProvider.tsx index b80eab5..6cb9745 100644 --- a/app/components/ToastProvider.tsx +++ b/app/components/ToastProvider.tsx @@ -3,7 +3,7 @@ import { ToastQueue, ToastState, useToastQueue } from "@react-stately/toast"; import { X } from "lucide-react"; import React, { useRef } from "react"; -import IconButton from "~/components/IconButton"; +import Button from "~/components/button"; import cn from "~/utils/cn"; interface ToastProps extends AriaToastProps { @@ -27,16 +27,17 @@ function Toast({ state, ...props }: ToastProps) {
{props.toast.content}
- - - + + ); } diff --git a/app/components/Button.tsx b/app/components/button.tsx similarity index 92% rename from app/components/Button.tsx rename to app/components/button.tsx index a743549..ef9ecce 100644 --- a/app/components/Button.tsx +++ b/app/components/button.tsx @@ -7,6 +7,7 @@ export interface ButtonProps extends AriaButtonOptions<"button"> { variant?: "heavy" | "light" | "danger" | "ghost"; className?: string; children?: React.ReactNode; + "aria-label"?: string; ref?: React.RefObject; } @@ -19,8 +20,9 @@ export default function Button({ variant = "light", ...props }: ButtonProps) {