Radio Button and Checkbox Created

This commit is contained in:
2025-07-30 23:10:17 -04:00
parent cb8c2c23be
commit f6f77c9d42
29 changed files with 892 additions and 18 deletions

View File

@@ -27,6 +27,7 @@ export const Route = createRootRoute({
{
navLinks.map((link) => (
<Link
key={link.to}
to={link.to}
>
{link.label}

View File

@@ -1,6 +1,6 @@
import { MattrixwvTabGroup } from "$/component/tab";
import type { TabGroupContent } from "$/types/Tab";
import { FileContent, SwitchContent, TextContent } from "@/util/InputUtils";
import { CheckboxContent, FileContent, RadioContent, SwitchContent, TextContent } from "@/util/InputUtils";
import { createFileRoute } from "@tanstack/react-router";
@@ -11,9 +11,11 @@ export const Route = createFileRoute('/input/')({
function InputPage(){
const tabs: TabGroupContent[] = [
{ tab: "Input", content: <FileContent/> },
{ tab: "Text", content: <TextContent/> },
{ tab: "Switch", content: <SwitchContent/> }
{ tab: "Checkbox", content: <CheckboxContent/>},
{ tab: "Radio", content: <RadioContent/> },
{ tab: "File", content: <FileContent/> },
{ tab: "Switch", content: <SwitchContent/> },
{ tab: "Text", content: <TextContent/> }
];
return (

View File

@@ -1,5 +1,28 @@
import { Button } from "$/component/button";
import { DragAndDropFileInput, FileInput, NumberInput, OptionInput, SelectInput, TextInput } from "$/component/input";
import DangerCheckbox from "$/component/input/checkbox/DangerCheckbox";
import DarkCheckbox from "$/component/input/checkbox/DarkCheckbox";
import InfoCheckbox from "$/component/input/checkbox/InfoCheckbox";
import LightCheckbox from "$/component/input/checkbox/LightCheckbox";
import MattrixwvCheckbox from "$/component/input/checkbox/MattrixwvCheckbox";
import MoltenCheckbox from "$/component/input/checkbox/MoltenCheckbox";
import PrimaryCheckbox from "$/component/input/checkbox/PrimaryCheckbox";
import SecondaryCheckbox from "$/component/input/checkbox/SecondaryCheckbox";
import SuccessCheckbox from "$/component/input/checkbox/SuccessCheckbox";
import TertiaryCheckbox from "$/component/input/checkbox/TertiaryCheckbox";
import WarningCheckbox from "$/component/input/checkbox/WarningCheckbox";
import DangerRadioButton from "$/component/input/radio/DangerRadioButton";
import DarkRadioButton from "$/component/input/radio/DarkRadioButton";
import InfoRadioButton from "$/component/input/radio/InfoRadioButton";
import LightRadioButton from "$/component/input/radio/LightRadioButton";
import MoltenRadioButton from "$/component/input/radio/MoltenRadioButton";
import PrimaryRadioButton from "$/component/input/radio/PrimaryRadioButton";
import RadioButton from "$/component/input/radio/RadioButton";
import RadioList from "$/component/input/radio/RadioList";
import SecondaryRadioButton from "$/component/input/radio/SecondaryRadioButton";
import SuccessRadioButton from "$/component/input/radio/SuccessRadioButton";
import TertiaryRadioButton from "$/component/input/radio/TertiaryRadioButton";
import WarningRadioButton from "$/component/input/radio/WarningRadioButton";
import ButtonSwitch from "$/component/input/switch/ButtonSwitch";
import DangerSwitch from "$/component/input/switch/DangerSwitch";
import DarkSwitch from "$/component/input/switch/DarkSwitch";
@@ -36,6 +59,7 @@ export function SwitchContent(): React.ReactNode{
className="bg-gray-400 data-checked:bg-blue-600"
knobClassName="bg-white"
size={size}
defaultChecked={true}
>
{size} Switch
</MattrixwvSwitch>
@@ -57,6 +81,7 @@ export function SwitchContent(): React.ReactNode{
wide={true}
offText={<span className="text-black">Off</span>}
onText="On"
defaultChecked={true}
>
{size} Switch
</MattrixwvSwitch>
@@ -73,6 +98,7 @@ export function SwitchContent(): React.ReactNode{
>
<PrimarySwitch
size={size}
defaultChecked={true}
>
{size} Switch
</PrimarySwitch>
@@ -110,6 +136,7 @@ export function SwitchContent(): React.ReactNode{
>
<SecondarySwitch
size={size}
defaultChecked={true}
>
{size} Switch
</SecondarySwitch>
@@ -147,6 +174,7 @@ export function SwitchContent(): React.ReactNode{
>
<TertiarySwitch
size={size}
defaultChecked={true}
>
{size} Switch
</TertiarySwitch>
@@ -184,6 +212,7 @@ export function SwitchContent(): React.ReactNode{
>
<SuccessSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</SuccessSwitch>
@@ -221,6 +250,7 @@ export function SwitchContent(): React.ReactNode{
>
<WarningSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</WarningSwitch>
@@ -258,6 +288,7 @@ export function SwitchContent(): React.ReactNode{
>
<DangerSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</DangerSwitch>
@@ -295,6 +326,7 @@ export function SwitchContent(): React.ReactNode{
>
<DarkSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</DarkSwitch>
@@ -332,6 +364,7 @@ export function SwitchContent(): React.ReactNode{
>
<LightSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</LightSwitch>
@@ -369,6 +402,7 @@ export function SwitchContent(): React.ReactNode{
>
<SuccessDangerSwitch
size={size}
defaultChecked={true}
>
{size} Switch
</SuccessDangerSwitch>
@@ -534,7 +568,14 @@ export function FileContent(){
/>
</FileDisplay>
<FileDisplay title="Drag and Drop File Input">
<DragAndDropFileInput/>
<DragAndDropFileInput
showFileName={true}
showSize={true}
maxSize={1024 * 1024}
minSize={1024}
>
Drag And Drop File Input
</DragAndDropFileInput>
</FileDisplay>
</div>
);
@@ -556,3 +597,149 @@ function FileDisplay({
</div>
);
}
export function CheckboxContent(){
return (
<div
className="flex flex-col items-center justify-center gap-y-8 mt-8 w-full"
>
<CheckboxDisplay title="Checkbox">
<div
className="flex flex-row items-center justify-center gap-x-8"
>
<MattrixwvCheckbox className="group-data-checked:stroke-white group-data-checked:bg-amber-400" defaultChecked={true}>Default</MattrixwvCheckbox>
<PrimaryCheckbox defaultChecked={true}>Primary</PrimaryCheckbox>
<SecondaryCheckbox defaultChecked={true}>Secondary</SecondaryCheckbox>
<TertiaryCheckbox defaultChecked={true}>Tertiary</TertiaryCheckbox>
<InfoCheckbox defaultChecked={true}>Info</InfoCheckbox>
<SuccessCheckbox defaultChecked={true}>Success</SuccessCheckbox>
<WarningCheckbox defaultChecked={true}>Warning</WarningCheckbox>
<DangerCheckbox defaultChecked={true}>Danger</DangerCheckbox>
<MoltenCheckbox defaultChecked={true}>Molten</MoltenCheckbox>
<LightCheckbox defaultChecked={true}>Light</LightCheckbox>
<DarkCheckbox defaultChecked={true}>Dark</DarkCheckbox>
</div>
</CheckboxDisplay>
<CheckboxDisplay title="Checks">
<div
className="flex flex-row items-center justify-center gap-x-8"
>
<MattrixwvCheckbox className="group-data-checked:stroke-amber-400 not-group-data-checked:stroke-white" defaultChecked={true} box={false}>Default</MattrixwvCheckbox>
<PrimaryCheckbox defaultChecked={true} box={false}>Primary</PrimaryCheckbox>
<SecondaryCheckbox defaultChecked={true} box={false}>Secondary</SecondaryCheckbox>
<TertiaryCheckbox defaultChecked={true} box={false}>Tertiary</TertiaryCheckbox>
<InfoCheckbox defaultChecked={true} box={false}>Info</InfoCheckbox>
<SuccessCheckbox defaultChecked={true} box={false}>Success</SuccessCheckbox>
<WarningCheckbox defaultChecked={true} box={false}>Warning</WarningCheckbox>
<DangerCheckbox defaultChecked={true} box={false}>Danger</DangerCheckbox>
<MoltenCheckbox defaultChecked={true} box={false}>Molten</MoltenCheckbox>
<LightCheckbox defaultChecked={true} box={false}>Light</LightCheckbox>
<DarkCheckbox defaultChecked={true} box={false}>Dark</DarkCheckbox>
</div>
</CheckboxDisplay>
</div>
);
}
function CheckboxDisplay({
title,
children
}:{
title: React.ReactNode;
children: React.ReactNode;
}){
return (
<div
className="flex flex-col items-center justify-center gap-y-2 w-full"
>
<h2 className="text-2xl">{title}</h2>
{children}
</div>
);
}
export function RadioContent(){
return (
<div
className="flex flex-col items-center justify-center gap-y-8 mt-8 w-full"
>
<RadioDisplay title="Sizes">
<RadioList
>
<PrimaryRadioButton size="xs" value="xs">Extra Small</PrimaryRadioButton>
<PrimaryRadioButton size="sm" value="sm">Small</PrimaryRadioButton>
<PrimaryRadioButton size="md" value="md">Medium</PrimaryRadioButton>
<PrimaryRadioButton size="lg" value="lg">Large</PrimaryRadioButton>
<PrimaryRadioButton size="xl" value="xl">Extra Large</PrimaryRadioButton>
</RadioList>
</RadioDisplay>
<RadioDisplay title="Radio Checked">
<div
className="flex flex-row items-center justify-center gap-x-8"
>
<RadioList value="Primary"><PrimaryRadioButton value="Primary">Primary</PrimaryRadioButton></RadioList>
<RadioList value="Secondary"><SecondaryRadioButton value="Secondary">Secondary</SecondaryRadioButton></RadioList>
<RadioList value="Tertiary"><TertiaryRadioButton value="Tertiary">Tertiary</TertiaryRadioButton></RadioList>
<RadioList value="Info"><InfoRadioButton value="Info">Info</InfoRadioButton></RadioList>
<RadioList value="Success"><SuccessRadioButton value="Success">Success</SuccessRadioButton></RadioList>
<RadioList value="warning"><WarningRadioButton value="warning">warning</WarningRadioButton></RadioList>
<RadioList value="Danger"><DangerRadioButton value="Danger">Danger</DangerRadioButton></RadioList>
<RadioList value="Molten"><MoltenRadioButton value="Molten">Molten</MoltenRadioButton></RadioList>
<RadioList value="Light"><LightRadioButton value="Light">Light</LightRadioButton></RadioList>
<RadioList value="Dark"><DarkRadioButton value="Dark">Dark</DarkRadioButton></RadioList>
</div>
</RadioDisplay>
<RadioDisplay title="Radio Horizontal">
<RadioList
direction="horizontal"
>
<RadioButton value="default" className="group-data-checked:bg-amber-500">Default</RadioButton>
<PrimaryRadioButton value="primary">Primary</PrimaryRadioButton>
<SecondaryRadioButton value="secondary">Secondary</SecondaryRadioButton>
<TertiaryRadioButton value="tertiary">Tertiary</TertiaryRadioButton>
<InfoRadioButton value="info">Info</InfoRadioButton>
<SuccessRadioButton value="success">Success</SuccessRadioButton>
<WarningRadioButton value="warning">Warning</WarningRadioButton>
<DangerRadioButton value="danger">Danger</DangerRadioButton>
<MoltenRadioButton value="molten">Molten</MoltenRadioButton>
<LightRadioButton value="light">Light</LightRadioButton>
<DarkRadioButton value="dark">Dark</DarkRadioButton>
</RadioList>
</RadioDisplay>
<RadioDisplay title="Radio Vertical">
<RadioList
direction="vertical"
>
<RadioButton value="default" className="group-data-checked:bg-amber-500">Default</RadioButton>
<PrimaryRadioButton value="primary">Primary</PrimaryRadioButton>
<SecondaryRadioButton value="secondary">Secondary</SecondaryRadioButton>
<TertiaryRadioButton value="tertiary">Tertiary</TertiaryRadioButton>
<InfoRadioButton value="info">Info</InfoRadioButton>
<SuccessRadioButton value="success">Success</SuccessRadioButton>
<WarningRadioButton value="warning">Warning</WarningRadioButton>
<DangerRadioButton value="danger">Danger</DangerRadioButton>
<MoltenRadioButton value="molten">Molten</MoltenRadioButton>
<LightRadioButton value="light">Light</LightRadioButton>
<DarkRadioButton value="dark">Dark</DarkRadioButton>
</RadioList>
</RadioDisplay>
</div>
);
}
function RadioDisplay({
title,
children
}:{
title: React.ReactNode;
children: React.ReactNode;
}){
return (
<div
className="flex flex-col items-center justify-center gap-y-2 w-full"
>
<h2 className="text-2xl">{title}</h2>
{children}
</div>
);
}