import CHECK_ICON from "@material-symbols/svg-700/outlined/check.svg"; import ERROR_ICON from "@material-symbols/svg-700/outlined/error.svg"; import PROGRESS_ACTIVITY_ICON from "@material-symbols/svg-700/outlined/progress_activity.svg"; import clsx from "clsx"; import { createSignal, type ParentProps } from "solid-js"; import UKIcon from "../icon/UKIcon.tsx"; import type { ButtonShape } from "./lib/shape.ts"; import type { ButtonSize } from "./lib/size.ts"; import styles from "./UKButton.module.scss"; export enum AffirmativeButtonState { Success, Error, InProgress, Unset, } interface BaseButtonProps { class?: string; disabled?: boolean; size?: ButtonSize; shape?: ButtonShape; type?: "normal" | "toggle"; leadingIcon?: string; trailingIcon?: string; } interface NonAffirmativeButtonProps extends BaseButtonProps { color?: "elevated" | "filled" | "tonal" | "outlined" | "standard"; onClick: ( event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element; }, ) => void | Promise; } interface AffirmativeButtonProps extends BaseButtonProps { affirmative: true; color?: "elevated" | "filled" | "tonal" | "outlined"; onClick: ( event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element; }, ) => Promise<{ state: AffirmativeButtonState; cb?: () => void | Promise }>; onSuccess?: () => void; onError?: () => void; } const AFFIRMATIVE_BUTTON_HOLD_TIME = 1000; const UKButton = (props: ParentProps) => { const [isSelected, setIsSelected] = createSignal(false); const [affirmativeState, setAffirmativeState] = createSignal(AffirmativeButtonState.Unset); if (props.color === "standard" && props.type === "toggle") { alert("You cannot have a standard color button be toggle-able"); } return ( ); }; export default UKButton;