Update switches
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user