Update switches

This commit is contained in:
2026-02-14 17:04:16 -05:00
parent 1743ed6ce4
commit 31c44d3d92
13 changed files with 39 additions and 117 deletions

View File

@@ -1,9 +1,8 @@
import type { MattrixwvButtonSwitchProps } from "$/types/InputTypes";
import { Switch } from "@headlessui/react";
import { forwardRef } from "react";
const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>(({
export default function ButtonSwitch({
id,
className,
name,
@@ -14,7 +13,7 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
disabled,
onNode,
offNode
}, ref ) => {
}: Readonly<MattrixwvButtonSwitchProps>){
return (
<Switch
id={id}
@@ -25,7 +24,6 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
checked={checked}
onChange={onChange}
disabled={disabled}
ref={ref}
>
{({ checked }) => (
<>
@@ -34,8 +32,4 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
)}
</Switch>
);
});
ButtonSwitch.displayName = "ButtonSwitch";
export default ButtonSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const DangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function DangerSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const DangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
DangerSwitch.displayName = "DangerSwitch";
export default DangerSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const DarkSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function DarkSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const DarkSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
DarkSwitch.displayName = "DarkSwitch";
export default DarkSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const InfoSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function InfoSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const InfoSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
InfoSwitch.displayName = "InfoSwitch";
export default InfoSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const LightSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function LightSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const LightSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
LightSwitch.displayName = "LightSwitch";
export default LightSwitch;
}

View File

@@ -1,11 +1,10 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import { Field, Label, Switch } from "@headlessui/react";
import clsx from "clsx";
import { forwardRef } from "react";
import { Fragment } from "react/jsx-runtime";
const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function MattrixwvSwitch({
id,
className,
knobClassName,
@@ -20,7 +19,7 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
children,
offText,
onText
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<Field as={Fragment}>
<Switch
@@ -54,7 +53,6 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
checked={checked}
onChange={onChange}
disabled={disabled}
ref={ref}
>
{
offText &&
@@ -107,8 +105,4 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
</Label>
</Field>
);
});
MattrixwvSwitch.displayName = "MattrixwvSwitch";
export default MattrixwvSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const MoltenSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function MoltenSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const MoltenSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
MoltenSwitch.displayName = "MoltenSwitch";
export default MoltenSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const PrimarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function PrimarySwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const PrimarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
PrimarySwitch.displayName = "PrimarySwitch";
export default PrimarySwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const SecondarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function SecondarySwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const SecondarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
SecondarySwitch.displayName = "SecondarySwitch";
export default SecondarySwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const SuccessDangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function SuccessDangerSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -27,12 +26,7 @@ const SuccessDangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
SuccessDangerSwitch.displayName = "SuccessDangerSwitch";
export default SuccessDangerSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const SuccessSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function SuccessSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const SuccessSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
SuccessSwitch.displayName = "SuccessSwitch";
export default SuccessSwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const TertiarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function TertiarySwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const TertiarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
TertiarySwitch.displayName = "TertiarySwitch";
export default TertiarySwitch;
}

View File

@@ -1,15 +1,14 @@
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import MattrixwvSwitch from "./MattrixwvSwitch";
const WarningSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
export default function WarningSwitch({
className,
knobClassName,
disabled,
...props
}, ref ) => {
}: Readonly<MattrixwvSwitchProps>){
return (
<MattrixwvSwitch
className={clsx(
@@ -28,12 +27,7 @@ const WarningSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
}
)}
disabled={disabled}
ref={ref}
{...props}
/>
);
});
WarningSwitch.displayName = "WarningSwitch";
export default WarningSwitch;
}