Compare commits
8 Commits
f40845723d
...
da0db483aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
da0db483aa
|
|||
|
61cceb41ba
|
|||
|
bcc5de6d7e
|
|||
|
31c44d3d92
|
|||
|
1743ed6ce4
|
|||
|
6c86fdd58b
|
|||
|
f224f3fa2c
|
|||
|
aaa15b1cfc
|
@@ -1,26 +0,0 @@
|
|||||||
import Button from "./button/Button";
|
|
||||||
import DangerButton from "./button/DangerButton";
|
|
||||||
import DarkButton from "./button/DarkButton";
|
|
||||||
import InfoButton from "./button/InfoButton";
|
|
||||||
import LightButton from "./button/LightButton";
|
|
||||||
import MoltenButton from "./button/MoltenButton";
|
|
||||||
import PrimaryButton from "./button/PrimaryButton";
|
|
||||||
import SecondaryButton from "./button/SecondaryButton";
|
|
||||||
import SuccessButton from "./button/SuccessButton";
|
|
||||||
import TertiaryButton from "./button/TertiaryButton";
|
|
||||||
import WarningButton from "./button/WarningButton";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
Button,
|
|
||||||
DangerButton,
|
|
||||||
DarkButton,
|
|
||||||
InfoButton,
|
|
||||||
LightButton,
|
|
||||||
MoltenButton,
|
|
||||||
PrimaryButton,
|
|
||||||
SecondaryButton,
|
|
||||||
SuccessButton,
|
|
||||||
TertiaryButton,
|
|
||||||
WarningButton
|
|
||||||
};
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Button = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function Button({
|
||||||
className,
|
className,
|
||||||
type="button",
|
type="button",
|
||||||
rounding = "lg",
|
rounding = "lg",
|
||||||
@@ -13,11 +12,10 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref ) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
data-testid="mattrixwv-button"
|
data-testid="mattrixwv-button"
|
||||||
ref={ref}
|
|
||||||
type={type}
|
type={type}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -59,8 +57,4 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
Button.displayName = "Button";
|
|
||||||
|
|
||||||
export default Button;
|
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const DangerButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function DangerButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-danger-button"
|
data-testid="mattrixwv-danger-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -44,8 +42,4 @@ const DangerButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerButton.displayName = "DangerButton";
|
|
||||||
|
|
||||||
export default DangerButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const DarkButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function DarkButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-dark-button"
|
data-testid="mattrixwv-dark-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const DarkButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkButton.displayName = "DarkButton";
|
|
||||||
|
|
||||||
export default DarkButton;
|
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const InfoButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function InfoButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-info-button"
|
data-testid="mattrixwv-info-button"
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"transition duration-300",
|
"transition duration-300",
|
||||||
className,
|
className,
|
||||||
@@ -43,8 +41,4 @@ const InfoButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoButton.displayName = "InfoButton";
|
|
||||||
|
|
||||||
export default InfoButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const LightButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function LightButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-light-button"
|
data-testid="mattrixwv-light-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const LightButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightButton.displayName = "LightButton";
|
|
||||||
|
|
||||||
export default LightButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const MoltenButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function MoltenButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-molten-button"
|
data-testid="mattrixwv-molten-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const MoltenButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenButton.displayName = "MoltenButton";
|
|
||||||
|
|
||||||
export default MoltenButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const PrimaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function PrimaryButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-primary-button"
|
data-testid="mattrixwv-primary-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const PrimaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimaryButton.displayName = "PrimaryButton";
|
|
||||||
|
|
||||||
export default PrimaryButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const SecondaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function SecondaryButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-secondary-button"
|
data-testid="mattrixwv-secondary-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const SecondaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondaryButton.displayName = "SecondaryButton";
|
|
||||||
|
|
||||||
export default SecondaryButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const SuccessButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function SuccessButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-success-button"
|
data-testid="mattrixwv-success-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const SuccessButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessButton.displayName = "SuccessButton";
|
|
||||||
|
|
||||||
export default SuccessButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const TertiaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function TertiaryButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-tertiary-button"
|
data-testid="mattrixwv-tertiary-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const TertiaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiaryButton.displayName = "TertiaryButton";
|
|
||||||
|
|
||||||
export default TertiaryButton;
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
|
||||||
|
|
||||||
const WarningButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
export default function WarningButton({
|
||||||
className,
|
className,
|
||||||
variant = "standard",
|
variant = "standard",
|
||||||
disabled,
|
disabled,
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}, ref) => {
|
}: Readonly<ButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid="mattrixwv-warning-button"
|
data-testid="mattrixwv-warning-button"
|
||||||
ref={ref}
|
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -43,8 +41,4 @@ const WarningButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
|||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningButton.displayName = "WarningButton";
|
|
||||||
|
|
||||||
export default WarningButton;
|
|
||||||
|
|||||||
12
lib/component/button/index.ts
Normal file
12
lib/component/button/index.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export { default as Button } from "./Button";
|
||||||
|
export { default as DangerButton } from "./DangerButton";
|
||||||
|
export { default as DarkButton } from "./DarkButton";
|
||||||
|
export { default as InfoButton } from "./InfoButton";
|
||||||
|
export { default as LightButton } from "./LightButton";
|
||||||
|
export { default as MoltenButton } from "./MoltenButton";
|
||||||
|
export { default as PrimaryButton } from "./PrimaryButton";
|
||||||
|
export { default as SecondaryButton } from "./SecondaryButton";
|
||||||
|
export { default as SuccessButton } from "./SuccessButton";
|
||||||
|
export { default as TertiaryButton } from "./TertiaryButton";
|
||||||
|
export { default as WarningButton } from "./WarningButton";
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import DangerCheckbox from "./input/checkbox/DangerCheckbox";
|
|
||||||
import DarkCheckbox from "./input/checkbox/DarkCheckbox";
|
|
||||||
import InfoCheckbox from "./input/checkbox/InfoCheckbox";
|
|
||||||
import LightCheckbox from "./input/checkbox/LightCheckbox";
|
|
||||||
import MattrixwvCheckbox from "./input/checkbox/MattrixwvCheckbox";
|
|
||||||
import MoltenCheckbox from "./input/checkbox/MoltenCheckbox";
|
|
||||||
import PrimaryCheckbox from "./input/checkbox/PrimaryCheckbox";
|
|
||||||
import SecondaryCheckbox from "./input/checkbox/SecondaryCheckbox";
|
|
||||||
import SuccessCheckbox from "./input/checkbox/SuccessCheckbox";
|
|
||||||
import TertiaryCheckbox from "./input/checkbox/TertiaryCheckbox";
|
|
||||||
import WarningCheckbox from "./input/checkbox/WarningCheckbox";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DangerCheckbox,
|
|
||||||
DarkCheckbox,
|
|
||||||
InfoCheckbox,
|
|
||||||
LightCheckbox,
|
|
||||||
MattrixwvCheckbox,
|
|
||||||
MoltenCheckbox,
|
|
||||||
PrimaryCheckbox,
|
|
||||||
SecondaryCheckbox,
|
|
||||||
SuccessCheckbox,
|
|
||||||
TertiaryCheckbox,
|
|
||||||
WarningCheckbox
|
|
||||||
};
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import DateInput from "./input/date/DateInput";
|
|
||||||
import DateTimeInput from "./input/date/DateTimeInput";
|
|
||||||
import TimeInput from "./input/date/TimeInput";
|
|
||||||
import DragAndDropFileInput from "./input/file/DragAndDropFileInput";
|
|
||||||
import FileInput from "./input/file/FileInput";
|
|
||||||
import NumberInput from "./input/number/NumberInput";
|
|
||||||
import OptionInput from "./input/text/OptionInput";
|
|
||||||
import SelectInput from "./input/text/SelectInput";
|
|
||||||
import TextArea from "./input/text/TextArea";
|
|
||||||
import TextInput from "./input/text/TextInput";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DateInput,
|
|
||||||
DateTimeInput,
|
|
||||||
DragAndDropFileInput,
|
|
||||||
FileInput,
|
|
||||||
NumberInput,
|
|
||||||
//NumberSlider,
|
|
||||||
OptionInput,
|
|
||||||
SelectInput,
|
|
||||||
TextArea,
|
|
||||||
TextInput,
|
|
||||||
TimeInput
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const DangerCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function DangerCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const DangerCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerCheckbox.displayName = "DangerCheckbox";
|
|
||||||
|
|
||||||
export default DangerCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const DarkCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function DarkCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const DarkCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkCheckbox.displayName = "DarkCheckbox";
|
|
||||||
|
|
||||||
export default DarkCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const InfoCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function InfoCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const InfoCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoCheckbox.displayName = "InfoCheckbox";
|
|
||||||
|
|
||||||
export default InfoCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const LightCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function LightCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const LightCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightCheckbox.displayName = "LightCheckbox";
|
|
||||||
|
|
||||||
export default LightCheckbox;
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import { Checkbox } from "@headlessui/react";
|
import { Checkbox } from "@headlessui/react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
const MattrixwvCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function MattrixwvCheckbox({
|
||||||
id = crypto.randomUUID().replaceAll("-", ""),
|
id = crypto.randomUUID().replaceAll("-", ""),
|
||||||
className,
|
className,
|
||||||
labelClassName,
|
labelClassName,
|
||||||
@@ -18,7 +17,7 @@ const MattrixwvCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
value,
|
value,
|
||||||
disabled,
|
disabled,
|
||||||
children
|
children
|
||||||
}, ref ) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id={id}
|
id={id}
|
||||||
@@ -38,7 +37,6 @@ const MattrixwvCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
aria-labelledby={`${id}Label`}
|
aria-labelledby={`${id}Label`}
|
||||||
ref={ref}
|
|
||||||
>
|
>
|
||||||
{/* Checkbox */}
|
{/* Checkbox */}
|
||||||
<div
|
<div
|
||||||
@@ -82,8 +80,4 @@ const MattrixwvCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MattrixwvCheckbox.displayName = "MattrixwvCheckbox";
|
|
||||||
|
|
||||||
export default MattrixwvCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const MoltenCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function MoltenCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const MoltenCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenCheckbox.displayName = "MoltenCheckbox";
|
|
||||||
|
|
||||||
export default MoltenCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const PrimaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function PrimaryCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const PrimaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimaryCheckbox.displayName = "PrimaryCheckbox";
|
|
||||||
|
|
||||||
export default PrimaryCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const SecondaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function SecondaryCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const SecondaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondaryCheckbox.displayName = "SecondaryCheckbox";
|
|
||||||
|
|
||||||
export default SecondaryCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const SuccessCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function SuccessCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const SuccessCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessCheckbox.displayName = "SuccessCheckbox";
|
|
||||||
|
|
||||||
export default SuccessCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const TertiaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function TertiaryCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const TertiaryCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiaryCheckbox.displayName = "TertiaryCheckbox";
|
|
||||||
|
|
||||||
export default TertiaryCheckbox;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { CheckboxProps } from "$/types/InputTypes";
|
import type { CheckboxProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
import MattrixwvCheckbox from "./MattrixwvCheckbox";
|
||||||
|
|
||||||
|
|
||||||
const WarningCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
export default function WarningCheckbox({
|
||||||
className,
|
className,
|
||||||
showBox = true,
|
showBox = true,
|
||||||
...props
|
...props
|
||||||
}, ref) => {
|
}: Readonly<CheckboxProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvCheckbox
|
<MattrixwvCheckbox
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -19,12 +18,7 @@ const WarningCheckbox = forwardRef<HTMLInputElement, CheckboxProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
showBox={showBox}
|
showBox={showBox}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningCheckbox.displayName = "WarningCheckbox";
|
|
||||||
|
|
||||||
export default WarningCheckbox;
|
|
||||||
|
|||||||
@@ -1,26 +1,47 @@
|
|||||||
import type { DateInputProps } from "$/types/InputTypes";
|
import type { DateInputProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import moment from "moment";
|
import { type ChangeEvent } from "react";
|
||||||
|
|
||||||
|
|
||||||
export default function DateInput({
|
export default function DateInput({
|
||||||
id,
|
|
||||||
className,
|
className,
|
||||||
defaultValue,
|
|
||||||
value,
|
value,
|
||||||
onChange
|
onChange,
|
||||||
}: DateInputProps){
|
...inputProps
|
||||||
|
}: Readonly<DateInputProps>){
|
||||||
|
//Used to translate the string from the input to a date for onChange
|
||||||
|
const changeDate = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const [ year, month, day ] = e.target.value.split("-").map(Number);
|
||||||
|
const newDate = new Date(year, month - 1, day);
|
||||||
|
|
||||||
|
onChange(Number.isNaN(newDate.getTime()) ? undefined : newDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
id={id}
|
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"border rounded-lg px-2 py-1",
|
"border rounded-lg px-2 py-1",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
defaultValue={defaultValue ? moment(defaultValue).format("YYYY-MM-DD") : undefined}
|
value={formatDate(value)}
|
||||||
value={value ? moment(value).format("YYYY-MM-DD") : undefined}
|
onChange={changeDate}
|
||||||
onChange={(e) => onChange?.(new Date(moment(e.target.value, "YYYY-MM-DD").toDate()))}
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Used to translate the date to a string for the input
|
||||||
|
function formatDate(date: Date | undefined): string{
|
||||||
|
if(!date || Number.isNaN(date.getTime())){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||||
|
const day = String(date.getDate()).padStart(2, "0");
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,38 @@
|
|||||||
import type { DateInputProps } from "$/types/InputTypes";
|
import type { DateInputProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import moment from "moment";
|
import type { ChangeEvent } from "react";
|
||||||
|
|
||||||
|
|
||||||
export default function DateTimeInput({
|
export default function DateTimeInput({
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
defaultValue,
|
step = 60,
|
||||||
value,
|
value,
|
||||||
onChange
|
onChange,
|
||||||
}: DateInputProps){
|
...inputProps
|
||||||
|
}: Readonly<DateInputProps>){
|
||||||
|
const changeDateTime = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const match = new RegExp(/^(\d+)-(\d+)-(\d+)T(\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?$/).exec(e.target.value);
|
||||||
|
|
||||||
|
if(!match){
|
||||||
|
onChange(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [ ,
|
||||||
|
y, mo, d,
|
||||||
|
h, mi, s = "0", ms = "0"
|
||||||
|
] = match;
|
||||||
|
|
||||||
|
const date = new Date(
|
||||||
|
Number(y), Number(mo) - 1, Number(d),
|
||||||
|
Number(h), Number(mi), Number(s), Number(ms)
|
||||||
|
);
|
||||||
|
|
||||||
|
onChange(Number.isNaN(date.getTime()) ? undefined : date);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -18,9 +41,28 @@ export default function DateTimeInput({
|
|||||||
"border rounded-lg px-2 py-1 outline-none",
|
"border rounded-lg px-2 py-1 outline-none",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
defaultValue={defaultValue ? moment(defaultValue).format("YYYY-MM-DDTHH:mm") : undefined}
|
value={formatDateTime(value)}
|
||||||
value={value ? moment(value).format("YYYY-MM-DDTHH:mm") : undefined}
|
onChange={changeDateTime}
|
||||||
onChange={(e) => onChange?.(new Date(moment(e.target.value, "YYYY-MM-DDTHH:mm").toDate()))}
|
step={step}
|
||||||
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatDateTime(date: Date | undefined){
|
||||||
|
if(!date || Number.isNaN(date.getTime())){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const y = date.getFullYear();
|
||||||
|
const mo = String(date.getMonth() + 1).padStart(2, "0");
|
||||||
|
const d = String(date.getDate()).padStart(2, "0");
|
||||||
|
|
||||||
|
const h = String(date.getHours()).padStart(2, "0");
|
||||||
|
const mi = String(date.getMinutes()).padStart(2, "0");
|
||||||
|
const s = String(date.getSeconds()).padStart(2, "0");
|
||||||
|
const ms = String(date.getMilliseconds()).padStart(2, "0");
|
||||||
|
|
||||||
|
return `${y}-${mo}-${d}T${h}:${mi}:${s}.${ms}`;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,33 @@
|
|||||||
import type { DateInputProps } from "$/types/InputTypes";
|
import type { DateInputProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import moment from "moment";
|
import type { ChangeEvent } from "react";
|
||||||
|
|
||||||
|
|
||||||
export default function TimeInput({
|
export default function TimeInput({
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
defaultValue,
|
step = 60,
|
||||||
value,
|
value,
|
||||||
onChange
|
onChange,
|
||||||
}: DateInputProps){
|
...inputProps
|
||||||
|
}: Readonly<DateInputProps>){
|
||||||
|
const changeTime = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const match = new RegExp(/^(\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?$/).exec(e.target.value);
|
||||||
|
|
||||||
|
if(!match){
|
||||||
|
onChange(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [ , h, m, s = "0", ms = "0"] = match;
|
||||||
|
|
||||||
|
const newDate = new Date();
|
||||||
|
newDate.setHours(Number(h), Number(m), Number(s), Number(ms));
|
||||||
|
|
||||||
|
onChange(Number.isNaN(newDate) ? undefined : newDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type="time"
|
type="time"
|
||||||
@@ -18,9 +36,32 @@ export default function TimeInput({
|
|||||||
"border rounded-lg px-2 py-1 outline-none",
|
"border rounded-lg px-2 py-1 outline-none",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
defaultValue={defaultValue ? moment(defaultValue).format("YYYY-MM-DDTHH:mm") : undefined}
|
value={formatTime(value, step)}
|
||||||
value={value ? moment(value).format("YYYY-MM-DDTHH:mm") : undefined}
|
onChange={changeTime}
|
||||||
onChange={(e) => onChange?.(new Date(moment(e.target.value, "YYYY-MM-DDTHH:mm").toDate()))}
|
step={step}
|
||||||
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatTime(date: Date | undefined, step: number){
|
||||||
|
if(!date || Number.isNaN(date.getTime())){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const h = String(date.getHours()).padStart(2, "0");
|
||||||
|
const m = String(date.getMinutes()).padStart(2, "0");
|
||||||
|
const s = String(date.getSeconds()).padStart(2, "0");
|
||||||
|
const ms = String(date.getMilliseconds()).padStart(3, "0");
|
||||||
|
|
||||||
|
let time = `${h}:${m}`;
|
||||||
|
if(step < 60){
|
||||||
|
time += `:${s}`;
|
||||||
|
}
|
||||||
|
if(step < 1){
|
||||||
|
time += `.${ms}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|||||||
53
lib/component/input/index.ts
Normal file
53
lib/component/input/index.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
//? Checkboxes
|
||||||
|
export { default as DangerCheckbox } from "./checkbox/DangerCheckbox";
|
||||||
|
export { default as DarkCheckbox } from "./checkbox/DarkCheckbox";
|
||||||
|
export { default as InfoCheckbox } from "./checkbox/InfoCheckbox";
|
||||||
|
export { default as LightCheckbox } from "./checkbox/LightCheckbox";
|
||||||
|
export { default as MattrixwvCheckbox } from "./checkbox/MattrixwvCheckbox";
|
||||||
|
export { default as MoltenCheckbox } from "./checkbox/MoltenCheckbox";
|
||||||
|
export { default as PrimaryCheckbox } from "./checkbox/PrimaryCheckbox";
|
||||||
|
export { default as SecondaryCheckbox } from "./checkbox/SecondaryCheckbox";
|
||||||
|
export { default as SuccessCheckbox } from "./checkbox/SuccessCheckbox";
|
||||||
|
export { default as TertiaryCheckbox } from "./checkbox/TertiaryCheckbox";
|
||||||
|
export { default as WarningCheckbox } from "./checkbox/WarningCheckbox";
|
||||||
|
|
||||||
|
//? Radio Buttons
|
||||||
|
export { default as DangerRadioButton } from "./radio/DangerRadioButton";
|
||||||
|
export { default as DarkRadioButton } from "./radio/DarkRadioButton";
|
||||||
|
export { default as InfoRadioButton } from "./radio/InfoRadioButton";
|
||||||
|
export { default as LightRadioButton } from "./radio/LightRadioButton";
|
||||||
|
export { default as MoltenRadioButton } from "./radio/MoltenRadioButton";
|
||||||
|
export { default as PrimaryRadioButton } from "./radio/PrimaryRadioButton";
|
||||||
|
export { default as RadioButton } from "./radio/RadioButton";
|
||||||
|
export { default as RadioList } from "./radio/RadioList";
|
||||||
|
export { default as SecondaryRadioButton } from "./radio/SecondaryRadioButton";
|
||||||
|
export { default as SuccessRadioButton } from "./radio/SuccessRadioButton";
|
||||||
|
export { default as TertiaryRadioButton } from "./radio/TertiaryRadioButton";
|
||||||
|
export { default as WarningRadioButton } from "./radio/WarningRadioButton";
|
||||||
|
|
||||||
|
//? Switches
|
||||||
|
export { default as ButtonSwitch } from "./switch/ButtonSwitch";
|
||||||
|
export { default as DangerSwitch } from "./switch/DangerSwitch";
|
||||||
|
export { default as DarkSwitch } from "./switch/DarkSwitch";
|
||||||
|
export { default as LightSwitch } from "./switch/LightSwitch";
|
||||||
|
export { default as MattrixwvSwitch } from "./switch/MattrixwvSwitch";
|
||||||
|
export { default as PrimarySwitch } from "./switch/PrimarySwitch";
|
||||||
|
export { default as SecondarySwitch } from "./switch/SecondarySwitch";
|
||||||
|
export { default as SuccessDangerSwitch } from "./switch/SuccessDangerSwitch";
|
||||||
|
export { default as SuccessSwitch } from "./switch/SuccessSwitch";
|
||||||
|
export { default as TertiarySwitch } from "./switch/TertiarySwitch";
|
||||||
|
export { default as WarningSwitch } from "./switch/WarningSwitch";
|
||||||
|
|
||||||
|
|
||||||
|
//? Other imports
|
||||||
|
export { default as DateInput } from "./date/DateInput";
|
||||||
|
export { default as DateTimeInput } from "./date/DateTimeInput";
|
||||||
|
export { default as TimeInput } from "./date/TimeInput";
|
||||||
|
export { default as DragAndDropFileInput } from "./file/DragAndDropFileInput";
|
||||||
|
export { default as FileInput } from "./file/FileInput";
|
||||||
|
export { default as NumberInput } from "./number/NumberInput";
|
||||||
|
export { default as OptionInput } from "./text/OptionInput";
|
||||||
|
export { default as SelectInput } from "./text/SelectInput";
|
||||||
|
export { default as TextArea } from "./text/TextArea";
|
||||||
|
export { default as TextInput } from "./text/TextInput";
|
||||||
|
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const DangerRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function DangerRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-danger",
|
"group-data-checked:bg-danger",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerRadioButton.displayName = "DangerRadioButton";
|
|
||||||
|
|
||||||
export default DangerRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const DarkRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function DarkRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-dark",
|
"group-data-checked:bg-dark",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkRadioButton.displayName = "DarkRadioButton";
|
|
||||||
|
|
||||||
export default DarkRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const InfoRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function InfoRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-cyan-500",
|
"group-data-checked:bg-cyan-500",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoRadioButton.displayName = "InfoRadioButton";
|
|
||||||
|
|
||||||
export default InfoRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const LightRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function LightRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-light",
|
"group-data-checked:bg-light",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightRadioButton.displayName = "LightRadioButton";
|
|
||||||
|
|
||||||
export default LightRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const MoltenRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function MoltenRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-molten",
|
"group-data-checked:bg-molten",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenRadioButton.displayName = "MoltenRadioButton";
|
|
||||||
|
|
||||||
export default MoltenRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const PrimaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function PrimaryRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-primary",
|
"group-data-checked:bg-primary",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimaryRadioButton.displayName = "PrimaryRadioButton";
|
|
||||||
|
|
||||||
export default PrimaryRadioButton;
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import { Radio } from "@headlessui/react";
|
import { Radio } from "@headlessui/react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function RadioButton({
|
||||||
id = crypto.randomUUID().replaceAll("-", ""),
|
id = crypto.randomUUID().replaceAll("-", ""),
|
||||||
className,
|
className,
|
||||||
labelClassName,
|
labelClassName,
|
||||||
@@ -12,7 +11,7 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
|||||||
value,
|
value,
|
||||||
disabled,
|
disabled,
|
||||||
children
|
children
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<Radio
|
<Radio
|
||||||
id={id}
|
id={id}
|
||||||
@@ -28,7 +27,6 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
|||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
aria-labelledby={`${id}Label`}
|
aria-labelledby={`${id}Label`}
|
||||||
ref={ref}
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -55,8 +53,4 @@ const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
|||||||
}
|
}
|
||||||
</Radio>
|
</Radio>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
RadioButton.displayName = "RadioButton";
|
|
||||||
|
|
||||||
export default RadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const SecondaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function SecondaryRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-secondary",
|
"group-data-checked:bg-secondary",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondaryRadioButton.displayName = "SecondaryRadioButton";
|
|
||||||
|
|
||||||
export default SecondaryRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const SuccessRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function SuccessRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-green-600",
|
"group-data-checked:bg-green-600",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessRadioButton.displayName = "SuccessRadioButton";
|
|
||||||
|
|
||||||
export default SuccessRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const TertiaryRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function TertiaryRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-tertiary",
|
"group-data-checked:bg-tertiary",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiaryRadioButton.displayName = "TertiaryRadioButton";
|
|
||||||
|
|
||||||
export default TertiaryRadioButton;
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import type { RadioButtonProps } from "$/types/InputTypes";
|
import type { RadioButtonProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import RadioButton from "./RadioButton";
|
import RadioButton from "./RadioButton";
|
||||||
|
|
||||||
|
|
||||||
const WarningRadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(({
|
export default function WarningRadioButton({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<RadioButtonProps>){
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group-data-checked:bg-warning",
|
"group-data-checked:bg-warning",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningRadioButton.displayName = "WarningRadioButton";
|
|
||||||
|
|
||||||
export default WarningRadioButton;
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import type { MattrixwvButtonSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvButtonSwitchProps } from "$/types/InputTypes";
|
||||||
import { Switch } from "@headlessui/react";
|
import { Switch } from "@headlessui/react";
|
||||||
import { forwardRef } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>(({
|
export default function ButtonSwitch({
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
name,
|
name,
|
||||||
@@ -14,7 +13,7 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
|
|||||||
disabled,
|
disabled,
|
||||||
onNode,
|
onNode,
|
||||||
offNode
|
offNode
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvButtonSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<Switch
|
<Switch
|
||||||
id={id}
|
id={id}
|
||||||
@@ -25,7 +24,6 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
|
|||||||
checked={checked}
|
checked={checked}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
>
|
>
|
||||||
{({ checked }) => (
|
{({ checked }) => (
|
||||||
<>
|
<>
|
||||||
@@ -34,8 +32,4 @@ const ButtonSwitch = forwardRef<HTMLButtonElement, MattrixwvButtonSwitchProps>((
|
|||||||
)}
|
)}
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
ButtonSwitch.displayName = "ButtonSwitch";
|
|
||||||
|
|
||||||
export default ButtonSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const DangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function DangerSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const DangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerSwitch.displayName = "DangerSwitch";
|
|
||||||
|
|
||||||
export default DangerSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const DarkSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function DarkSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const DarkSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkSwitch.displayName = "DarkSwitch";
|
|
||||||
|
|
||||||
export default DarkSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const InfoSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function InfoSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const InfoSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoSwitch.displayName = "InfoSwitch";
|
|
||||||
|
|
||||||
export default InfoSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const LightSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function LightSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const LightSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightSwitch.displayName = "LightSwitch";
|
|
||||||
|
|
||||||
export default LightSwitch;
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import { Field, Label, Switch } from "@headlessui/react";
|
import { Field, Label, Switch } from "@headlessui/react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import { Fragment } from "react/jsx-runtime";
|
import { Fragment } from "react/jsx-runtime";
|
||||||
|
|
||||||
|
|
||||||
const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function MattrixwvSwitch({
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
@@ -20,7 +19,7 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
children,
|
children,
|
||||||
offText,
|
offText,
|
||||||
onText
|
onText
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<Field as={Fragment}>
|
<Field as={Fragment}>
|
||||||
<Switch
|
<Switch
|
||||||
@@ -54,7 +53,6 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
checked={checked}
|
checked={checked}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
offText &&
|
offText &&
|
||||||
@@ -107,8 +105,4 @@ const MattrixwvSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
</Label>
|
</Label>
|
||||||
</Field>
|
</Field>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MattrixwvSwitch.displayName = "MattrixwvSwitch";
|
|
||||||
|
|
||||||
export default MattrixwvSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const MoltenSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function MoltenSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const MoltenSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenSwitch.displayName = "MoltenSwitch";
|
|
||||||
|
|
||||||
export default MoltenSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const PrimarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function PrimarySwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const PrimarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimarySwitch.displayName = "PrimarySwitch";
|
|
||||||
|
|
||||||
export default PrimarySwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const SecondarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function SecondarySwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const SecondarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondarySwitch.displayName = "SecondarySwitch";
|
|
||||||
|
|
||||||
export default SecondarySwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const SuccessDangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function SuccessDangerSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -27,12 +26,7 @@ const SuccessDangerSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessDangerSwitch.displayName = "SuccessDangerSwitch";
|
|
||||||
|
|
||||||
export default SuccessDangerSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const SuccessSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function SuccessSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const SuccessSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessSwitch.displayName = "SuccessSwitch";
|
|
||||||
|
|
||||||
export default SuccessSwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const TertiarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function TertiarySwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const TertiarySwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiarySwitch.displayName = "TertiarySwitch";
|
|
||||||
|
|
||||||
export default TertiarySwitch;
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||||
|
|
||||||
|
|
||||||
const WarningSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
export default function WarningSwitch({
|
||||||
className,
|
className,
|
||||||
knobClassName,
|
knobClassName,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<MattrixwvSwitchProps>){
|
||||||
return (
|
return (
|
||||||
<MattrixwvSwitch
|
<MattrixwvSwitch
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -28,12 +27,7 @@ const WarningSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningSwitch.displayName = "WarningSwitch";
|
|
||||||
|
|
||||||
export default WarningSwitch;
|
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
|
|
||||||
import CenterGrowingBars from "./loading/bar/CenterGrowingBars";
|
|
||||||
import CircleBars from "./loading/bar/CircleBars";
|
|
||||||
import FadingBars from "./loading/bar/FadingBars";
|
|
||||||
import FadingGrowingBars from "./loading/bar/FadingGrowingBars";
|
|
||||||
import GrowingBars from "./loading/bar/GrowingBars";
|
|
||||||
import PulsingBlocks from "./loading/block/PulsingBlocks";
|
|
||||||
import SlidingBlocks2 from "./loading/block/SlidingBlocks2";
|
|
||||||
import SlidingBlocks3 from "./loading/block/SlidingBlocks3";
|
|
||||||
import WaveBlocks from "./loading/block/WaveBlocks";
|
|
||||||
import BouncingDots from "./loading/dot/BouncingDots";
|
|
||||||
import CircleCenterDots from "./loading/dot/CircleCenterDots";
|
|
||||||
import CircleFadingDots from "./loading/dot/CircleFadingDots";
|
|
||||||
import CirclePulsingDots from "./loading/dot/CirclePulsingDots";
|
|
||||||
import CircleRotatingDots from "./loading/dot/CircleRotatingDots";
|
|
||||||
import CircleShrinkingDots from "./loading/dot/CircleShrinkingDots";
|
|
||||||
import CircleSpinningDot from "./loading/dot/CircleSpinningDot";
|
|
||||||
import CyclingDots from "./loading/dot/CyclingDots";
|
|
||||||
import FadingDots from "./loading/dot/FadingDots";
|
|
||||||
import PulsingDots from "./loading/dot/PulsingDots";
|
|
||||||
import RotatingDots from "./loading/dot/RotatingDots";
|
|
||||||
import SwellingDots from "./loading/dot/SwellingDots";
|
|
||||||
import DoubleDrop from "./loading/drop/DoubleDrop";
|
|
||||||
import DoubleWaveDrop from "./loading/drop/DoubleWaveDrop";
|
|
||||||
import Drop from "./loading/drop/Drop";
|
|
||||||
import QuickDrop from "./loading/drop/QuickDrop";
|
|
||||||
import QuickWaveDrop from "./loading/drop/QuickWaveDrop";
|
|
||||||
import TripleDrop from "./loading/drop/TripleDrop";
|
|
||||||
import TripleWaveDrop from "./loading/drop/TripleWaveDrop";
|
|
||||||
import WaveDrop from "./loading/drop/WaveDrop";
|
|
||||||
import HalfSpinner from "./loading/spinner/HalfSpinner";
|
|
||||||
import QuarterSpinner from "./loading/spinner/QuarterSpinner";
|
|
||||||
import RubberSpinner from "./loading/spinner/RubberSpinner";
|
|
||||||
import ThreeQuarterSpinner from "./loading/spinner/ThreeQuarterSpinner";
|
|
||||||
import BouncingDot from "./loading/various/BouncingDot";
|
|
||||||
import PulsingLine from "./loading/various/PulsingLine";
|
|
||||||
import SpinningBinary from "./loading/various/SpinningBinary";
|
|
||||||
import SpinningClock from "./loading/various/SpinningClock";
|
|
||||||
import SpinningEclipse from "./loading/various/SpinningEclipse";
|
|
||||||
import SpinningEclipseHalf from "./loading/various/SpinningEclipseHalf";
|
|
||||||
import SpinningGalaxy from "./loading/various/SpinningGalaxy";
|
|
||||||
import SpinningTadpole from "./loading/various/SpinningTadpole";
|
|
||||||
import Wifi from "./loading/various/Wifi";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
BouncingDot,
|
|
||||||
BouncingDots,
|
|
||||||
CenterGrowingBars,
|
|
||||||
CircleBars,
|
|
||||||
CircleCenterDots,
|
|
||||||
CircleFadingDots,
|
|
||||||
CirclePulsingDots,
|
|
||||||
CircleRotatingDots,
|
|
||||||
CircleShrinkingDots,
|
|
||||||
CircleSpinningDot,
|
|
||||||
CyclingDots,
|
|
||||||
DoubleDrop,
|
|
||||||
DoubleWaveDrop,
|
|
||||||
Drop,
|
|
||||||
FadingBars,
|
|
||||||
FadingDots,
|
|
||||||
FadingGrowingBars,
|
|
||||||
GrowingBars,
|
|
||||||
HalfSpinner,
|
|
||||||
PulsingBlocks,
|
|
||||||
PulsingDots,
|
|
||||||
PulsingLine,
|
|
||||||
QuarterSpinner,
|
|
||||||
QuickDrop,
|
|
||||||
QuickWaveDrop,
|
|
||||||
RotatingDots,
|
|
||||||
RubberSpinner,
|
|
||||||
SlidingBlocks2,
|
|
||||||
SlidingBlocks3,
|
|
||||||
SpinningBinary,
|
|
||||||
SpinningClock,
|
|
||||||
SpinningEclipse,
|
|
||||||
SpinningEclipseHalf,
|
|
||||||
SpinningGalaxy,
|
|
||||||
SpinningTadpole,
|
|
||||||
SwellingDots,
|
|
||||||
ThreeQuarterSpinner,
|
|
||||||
TripleDrop,
|
|
||||||
TripleWaveDrop,
|
|
||||||
WaveBlocks,
|
|
||||||
WaveDrop,
|
|
||||||
Wifi
|
|
||||||
};
|
|
||||||
|
|
||||||
44
lib/component/loading/index.ts
Normal file
44
lib/component/loading/index.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
export { default as CenterGrowingBars } from "./bar/CenterGrowingBars";
|
||||||
|
export { default as CircleBars } from "./bar/CircleBars";
|
||||||
|
export { default as FadingBars } from "./bar/FadingBars";
|
||||||
|
export { default as FadingGrowingBars } from "./bar/FadingGrowingBars";
|
||||||
|
export { default as GrowingBars } from "./bar/GrowingBars";
|
||||||
|
export { default as PulsingBlocks } from "./block/PulsingBlocks";
|
||||||
|
export { default as SlidingBlocks2 } from "./block/SlidingBlocks2";
|
||||||
|
export { default as SlidingBlocks3 } from "./block/SlidingBlocks3";
|
||||||
|
export { default as WaveBlocks } from "./block/WaveBlocks";
|
||||||
|
export { default as BouncingDots } from "./dot/BouncingDots";
|
||||||
|
export { default as CircleCenterDots } from "./dot/CircleCenterDots";
|
||||||
|
export { default as CircleFadingDots } from "./dot/CircleFadingDots";
|
||||||
|
export { default as CirclePulsingDots } from "./dot/CirclePulsingDots";
|
||||||
|
export { default as CircleRotatingDots } from "./dot/CircleRotatingDots";
|
||||||
|
export { default as CircleShrinkingDots } from "./dot/CircleShrinkingDots";
|
||||||
|
export { default as CircleSpinningDot } from "./dot/CircleSpinningDot";
|
||||||
|
export { default as CyclingDots } from "./dot/CyclingDots";
|
||||||
|
export { default as FadingDots } from "./dot/FadingDots";
|
||||||
|
export { default as PulsingDots } from "./dot/PulsingDots";
|
||||||
|
export { default as RotatingDots } from "./dot/RotatingDots";
|
||||||
|
export { default as SwellingDots } from "./dot/SwellingDots";
|
||||||
|
export { default as DoubleDrop } from "./drop/DoubleDrop";
|
||||||
|
export { default as DoubleWaveDrop } from "./drop/DoubleWaveDrop";
|
||||||
|
export { default as Drop } from "./drop/Drop";
|
||||||
|
export { default as QuickDrop } from "./drop/QuickDrop";
|
||||||
|
export { default as QuickWaveDrop } from "./drop/QuickWaveDrop";
|
||||||
|
export { default as TripleDrop } from "./drop/TripleDrop";
|
||||||
|
export { default as TripleWaveDrop } from "./drop/TripleWaveDrop";
|
||||||
|
export { default as WaveDrop } from "./drop/WaveDrop";
|
||||||
|
export { default as HalfSpinner } from "./spinner/HalfSpinner";
|
||||||
|
export { default as QuarterSpinner } from "./spinner/QuarterSpinner";
|
||||||
|
export { default as RubberSpinner } from "./spinner/RubberSpinner";
|
||||||
|
export { default as ThreeQuarterSpinner } from "./spinner/ThreeQuarterSpinner";
|
||||||
|
export { default as BouncingDot } from "./various/BouncingDot";
|
||||||
|
export { default as PulsingLine } from "./various/PulsingLine";
|
||||||
|
export { default as SpinningBinary } from "./various/SpinningBinary";
|
||||||
|
export { default as SpinningClock } from "./various/SpinningClock";
|
||||||
|
export { default as SpinningEclipse } from "./various/SpinningEclipse";
|
||||||
|
export { default as SpinningEclipseHalf } from "./various/SpinningEclipseHalf";
|
||||||
|
export { default as SpinningGalaxy } from "./various/SpinningGalaxy";
|
||||||
|
export { default as SpinningTadpole } from "./various/SpinningTadpole";
|
||||||
|
export { default as Wifi } from "./various/Wifi";
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import DangerMessageBlock from "./message/DangerMessageBlock";
|
|
||||||
import DarkMessageBlock from "./message/DarkMessageBlock";
|
|
||||||
import InfoMessageBlock from "./message/InfoMessageBlock";
|
|
||||||
import LightMessageBlock from "./message/LightMessageBlock";
|
|
||||||
import MessageBlock from "./message/MessageBlock";
|
|
||||||
import MoltenMessageBlock from "./message/MoltenMessageBlock";
|
|
||||||
import PrimaryMessageBlock from "./message/PrimaryMessageBlock";
|
|
||||||
import SecondaryMessageBlock from "./message/SecondaryMessageBlock";
|
|
||||||
import SuccessMessageBlock from "./message/SuccessMessageBlock";
|
|
||||||
import TertiaryMessageBlock from "./message/TertiaryMessageBlock";
|
|
||||||
import WarningMessageBlock from "./message/WarningMessageBlock";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DangerMessageBlock,
|
|
||||||
DarkMessageBlock,
|
|
||||||
InfoMessageBlock,
|
|
||||||
LightMessageBlock,
|
|
||||||
MessageBlock,
|
|
||||||
MoltenMessageBlock,
|
|
||||||
PrimaryMessageBlock,
|
|
||||||
SecondaryMessageBlock,
|
|
||||||
SuccessMessageBlock,
|
|
||||||
TertiaryMessageBlock,
|
|
||||||
WarningMessageBlock
|
|
||||||
};
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const DangerMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function DangerMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-danger-message-block"
|
data-testid="mattrixwv-danger-message-block"
|
||||||
@@ -15,12 +14,7 @@ const DangerMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-danger-xlight text-danger-dark"
|
"bg-danger-xlight text-danger-dark"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerMessageBlock.displayName = "DangerMessageBlock";
|
|
||||||
|
|
||||||
export default DangerMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const DarkMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function DarkMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-dark-message-block"
|
data-testid="mattrixwv-dark-message-block"
|
||||||
@@ -15,12 +14,7 @@ const DarkMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-dark text-dark-xlight"
|
"bg-dark text-dark-xlight"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkMessageBlock.displayName = "DarkMessageBlock";
|
|
||||||
|
|
||||||
export default DarkMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const InfoMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function InfoMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-info-message-block"
|
data-testid="mattrixwv-info-message-block"
|
||||||
@@ -15,12 +14,7 @@ const InfoMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-info-xlight text-info-xdark"
|
"bg-info-xlight text-info-xdark"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoMessageBlock.displayName = "InfoMessageBlock";
|
|
||||||
|
|
||||||
export default InfoMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const LightMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function LightMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-light-message-block"
|
data-testid="mattrixwv-light-message-block"
|
||||||
@@ -15,12 +14,7 @@ const LightMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-white text-black"
|
"bg-white text-black"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightMessageBlock.displayName = "LightMessageBlock";
|
|
||||||
|
|
||||||
export default LightMessageBlock;
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
const MessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function MessageBlock({
|
||||||
className,
|
className,
|
||||||
outline = "sm",
|
outline = "sm",
|
||||||
rounded = "lg",
|
rounded = "lg",
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="mattrixwv-message-block"
|
data-testid="mattrixwv-message-block"
|
||||||
@@ -30,12 +29,7 @@ const MessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
"rounded-xl": rounded === "xl"
|
"rounded-xl": rounded === "xl"
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MessageBlock.displayName = "MessageBlock";
|
|
||||||
|
|
||||||
export default MessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const MoltenMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function MoltenMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-molten-message-block"
|
data-testid="mattrixwv-molten-message-block"
|
||||||
@@ -15,12 +14,7 @@ const MoltenMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-molten-xlight text-molten-mid"
|
"bg-molten-xlight text-molten-mid"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenMessageBlock.displayName = "MoltenMessageBlock";
|
|
||||||
|
|
||||||
export default MoltenMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const PrimaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function PrimaryMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-primary-message-block"
|
data-testid="mattrixwv-primary-message-block"
|
||||||
@@ -15,12 +14,7 @@ const PrimaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-primary-xlight text-primary-dark"
|
"bg-primary-xlight text-primary-dark"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimaryMessageBlock.displayName = "PrimaryMessageBlock";
|
|
||||||
|
|
||||||
export default PrimaryMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const SecondaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function SecondaryMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-secondary-message-block"
|
data-testid="mattrixwv-secondary-message-block"
|
||||||
@@ -15,12 +14,7 @@ const SecondaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-secondary-xlight text-secondary-mid"
|
"bg-secondary-xlight text-secondary-mid"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondaryMessageBlock.displayName = "SecondaryMessageBlock";
|
|
||||||
|
|
||||||
export default SecondaryMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const SuccessMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function SuccessMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-success-message-block"
|
data-testid="mattrixwv-success-message-block"
|
||||||
@@ -15,12 +14,7 @@ const SuccessMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-success-xlight text-success-mid"
|
"bg-success-xlight text-success-mid"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessMessageBlock.displayName = "SuccessMessageBlock";
|
|
||||||
|
|
||||||
export default SuccessMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const TertiaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function TertiaryMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-tertiary-message-block"
|
data-testid="mattrixwv-tertiary-message-block"
|
||||||
@@ -15,12 +14,7 @@ const TertiaryMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-tertiary-xlight text-tertiary-mid"
|
"bg-tertiary-xlight text-tertiary-mid"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiaryMessageBlock.displayName = "TertiaryMessageBlock";
|
|
||||||
|
|
||||||
export default TertiaryMessageBlock;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { MessageBlockProps } from "$/types/MessageTypes";
|
import type { MessageBlockProps } from "$/types/MessageTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import MessageBlock from "./MessageBlock";
|
import MessageBlock from "./MessageBlock";
|
||||||
|
|
||||||
|
|
||||||
const WarningMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
export default function WarningMessageBlock({
|
||||||
className,
|
className,
|
||||||
...messageProps
|
...messageProps
|
||||||
}, ref ) => {
|
}: Readonly<MessageBlockProps>){
|
||||||
return (
|
return (
|
||||||
<MessageBlock
|
<MessageBlock
|
||||||
data-testid="mattrixwv-warning-message-block"
|
data-testid="mattrixwv-warning-message-block"
|
||||||
@@ -15,12 +14,7 @@ const WarningMessageBlock = forwardRef<HTMLDivElement, MessageBlockProps>(({
|
|||||||
className,
|
className,
|
||||||
"bg-warning-xlight text-warning-dark"
|
"bg-warning-xlight text-warning-dark"
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
{...messageProps}
|
{...messageProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningMessageBlock.displayName = "WarningMessageBlock";
|
|
||||||
|
|
||||||
export default WarningMessageBlock;
|
|
||||||
|
|||||||
12
lib/component/message/index.ts
Normal file
12
lib/component/message/index.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export { default as DangerMessageBlock } from "./DangerMessageBlock";
|
||||||
|
export { default as DarkMessageBlock } from "./DarkMessageBlock";
|
||||||
|
export { default as InfoMessageBlock } from "./InfoMessageBlock";
|
||||||
|
export { default as LightMessageBlock } from "./LightMessageBlock";
|
||||||
|
export { default as MessageBlock } from "./MessageBlock";
|
||||||
|
export { default as MoltenMessageBlock } from "./MoltenMessageBlock";
|
||||||
|
export { default as PrimaryMessageBlock } from "./PrimaryMessageBlock";
|
||||||
|
export { default as SecondaryMessageBlock } from "./SecondaryMessageBlock";
|
||||||
|
export { default as SuccessMessageBlock } from "./SuccessMessageBlock";
|
||||||
|
export { default as TertiaryMessageBlock } from "./TertiaryMessageBlock";
|
||||||
|
export { default as WarningMessageBlock } from "./WarningMessageBlock";
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import Modal from "./modal/Modal";
|
|
||||||
import ModalBody from "./modal/ModalBody";
|
|
||||||
import ModalFooter from "./modal/ModalFooter";
|
|
||||||
import ModalHeader from "./modal/ModalHeader";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
Modal,
|
|
||||||
ModalBody,
|
|
||||||
ModalFooter,
|
|
||||||
ModalHeader
|
|
||||||
};
|
|
||||||
|
|
||||||
5
lib/component/modal/index.ts
Normal file
5
lib/component/modal/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { default as Modal } from "./Modal";
|
||||||
|
export { default as ModalBody } from "./ModalBody";
|
||||||
|
export { default as ModalFooter } from "./ModalFooter";
|
||||||
|
export { default as ModalHeader } from "./ModalHeader";
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import DarkModeSwitch from "./nav/DarkModeSwitch";
|
|
||||||
import NavBar from "./nav/NavBar";
|
|
||||||
import PopoverMenu from "./nav/PopoverMenu";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DarkModeSwitch,
|
|
||||||
NavBar,
|
|
||||||
PopoverMenu
|
|
||||||
};
|
|
||||||
4
lib/component/nav/index.ts
Normal file
4
lib/component/nav/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export { default as DarkModeSwitch } from "./DarkModeSwitch";
|
||||||
|
export { default as NavBar } from "./NavBar";
|
||||||
|
export { default as PopoverMenu } from "./PopoverMenu";
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import DangerProgress from "./progress/DangerProgress";
|
|
||||||
import DarkProgress from "./progress/DarkProgress";
|
|
||||||
import InfoProgress from "./progress/InfoProgress";
|
|
||||||
import LightProgress from "./progress/LightProgress";
|
|
||||||
import MoltenProgress from "./progress/MoltenProgress";
|
|
||||||
import PrimaryProgress from "./progress/PrimaryProgress";
|
|
||||||
import Progress from "./progress/Progress";
|
|
||||||
import SecondaryProgress from "./progress/SecondaryProgress";
|
|
||||||
import SuccessProgress from "./progress/SuccessProgress";
|
|
||||||
import TertiaryProgress from "./progress/TertiaryProgress";
|
|
||||||
import WarningProgress from "./progress/WarningProgress";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DangerProgress,
|
|
||||||
DarkProgress,
|
|
||||||
InfoProgress,
|
|
||||||
LightProgress,
|
|
||||||
MoltenProgress,
|
|
||||||
PrimaryProgress,
|
|
||||||
Progress,
|
|
||||||
SecondaryProgress,
|
|
||||||
SuccessProgress,
|
|
||||||
TertiaryProgress,
|
|
||||||
WarningProgress
|
|
||||||
};
|
|
||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const DangerProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function DangerProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-danger)"
|
progressColor="var(--color-danger)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DangerProgress.displayName = "DangerProgress";
|
|
||||||
|
|
||||||
export default DangerProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const DarkProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function DarkProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-dark)"
|
progressColor="var(--color-dark)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
DarkProgress.displayName = "DarkProgress";
|
|
||||||
|
|
||||||
export default DarkProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const InfoProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function InfoProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-info)"
|
progressColor="var(--color-info)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
InfoProgress.displayName = "InfoProgress";
|
|
||||||
|
|
||||||
export default InfoProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const LightProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function LightProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-dark)"
|
backgroundColor="var(--color-dark)"
|
||||||
progressColor="var(--color-light)"
|
progressColor="var(--color-light)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
LightProgress.displayName = "LightProgress";
|
|
||||||
|
|
||||||
export default LightProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const MoltenProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function MoltenProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-molten)"
|
progressColor="var(--color-molten)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
MoltenProgress.displayName = "MoltenProgress";
|
|
||||||
|
|
||||||
export default MoltenProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const PrimaryProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function PrimaryProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-primary)"
|
progressColor="var(--color-primary)"
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
PrimaryProgress.displayName = "PrimaryProgress";
|
|
||||||
|
|
||||||
export default PrimaryProgress;
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { ProgressProps } from "$/types/ProgressTypes";
|
import type { ProgressProps } from "$/types/ProgressTypes";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { forwardRef, useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|
||||||
|
|
||||||
const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
|
export default function Progress({
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
value,
|
value,
|
||||||
@@ -15,7 +15,7 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
|
|||||||
tabIndex,
|
tabIndex,
|
||||||
progressColor,
|
progressColor,
|
||||||
backgroundColor
|
backgroundColor
|
||||||
}, ref ) => {
|
}: Readonly<ProgressProps>){
|
||||||
const percentage = useMemo(() => {
|
const percentage = useMemo(() => {
|
||||||
const num = !value || Number.isNaN(value) ? min : Math.max(value, min);
|
const num = !value || Number.isNaN(value) ? min : Math.max(value, min);
|
||||||
const den = (!value || Number.isNaN(value) ? max : Math.max(value, max)) - min;
|
const den = (!value || Number.isNaN(value) ? max : Math.max(value, max)) - min;
|
||||||
@@ -55,7 +55,6 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
|
|||||||
aria-valuenow={value ? Math.round(value * 10000) / 100 : undefined}
|
aria-valuenow={value ? Math.round(value * 10000) / 100 : undefined}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
tabIndex={tabIndex ?? 0}
|
tabIndex={tabIndex ?? 0}
|
||||||
ref={ref}
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -77,8 +76,4 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
Progress.displayName = "Progress";
|
|
||||||
|
|
||||||
export default Progress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const SecondaryProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function SecondaryProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-gray-300)"
|
backgroundColor="var(--color-gray-300)"
|
||||||
progressColor="var(--color-neutral-500)"
|
progressColor="var(--color-neutral-500)"
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SecondaryProgress.displayName = "SecondaryProgress";
|
|
||||||
|
|
||||||
export default SecondaryProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const SuccessProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function SuccessProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-success)"
|
progressColor="var(--color-success)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
SuccessProgress.displayName = "SuccessProgress";
|
|
||||||
|
|
||||||
export default SuccessProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const TertiaryProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function TertiaryProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-tertiary)"
|
progressColor="var(--color-tertiary)"
|
||||||
{...props}
|
{...props}
|
||||||
ref={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
TertiaryProgress.displayName = "TertiaryProgress";
|
|
||||||
|
|
||||||
export default TertiaryProgress;
|
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
import type { ThemedProgressProps } from "$/types/ProgressTypes";
|
||||||
import { forwardRef } from "react";
|
|
||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
|
|
||||||
|
|
||||||
const WarningProgress = forwardRef<HTMLDivElement, ThemedProgressProps>(({
|
export default function WarningProgress({
|
||||||
...props
|
...props
|
||||||
}, ref ) => {
|
}: Readonly<ThemedProgressProps>){
|
||||||
return (
|
return (
|
||||||
<Progress
|
<Progress
|
||||||
backgroundColor="var(--color-neutral)"
|
backgroundColor="var(--color-neutral)"
|
||||||
progressColor="var(--color-warning)"
|
progressColor="var(--color-warning)"
|
||||||
ref={ref}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
WarningProgress.displayName = "WarningProgress";
|
|
||||||
|
|
||||||
export default WarningProgress;
|
|
||||||
|
|||||||
12
lib/component/progress/index.ts
Normal file
12
lib/component/progress/index.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export { default as DangerProgress } from "./DangerProgress";
|
||||||
|
export { default as DarkProgress } from "./DarkProgress";
|
||||||
|
export { default as InfoProgress } from "./InfoProgress";
|
||||||
|
export { default as LightProgress } from "./LightProgress";
|
||||||
|
export { default as MoltenProgress } from "./MoltenProgress";
|
||||||
|
export { default as PrimaryProgress } from "./PrimaryProgress";
|
||||||
|
export { default as Progress } from "./Progress";
|
||||||
|
export { default as SecondaryProgress } from "./SecondaryProgress";
|
||||||
|
export { default as SuccessProgress } from "./SuccessProgress";
|
||||||
|
export { default as TertiaryProgress } from "./TertiaryProgress";
|
||||||
|
export { default as WarningProgress } from "./WarningProgress";
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import DangerRadioButton from "./input/radio/DangerRadioButton";
|
|
||||||
import DarkRadioButton from "./input/radio/DarkRadioButton";
|
|
||||||
import InfoRadioButton from "./input/radio/InfoRadioButton";
|
|
||||||
import LightRadioButton from "./input/radio/LightRadioButton";
|
|
||||||
import MoltenRadioButton from "./input/radio/MoltenRadioButton";
|
|
||||||
import PrimaryRadioButton from "./input/radio/PrimaryRadioButton";
|
|
||||||
import RadioButton from "./input/radio/RadioButton";
|
|
||||||
import RadioList from "./input/radio/RadioList";
|
|
||||||
import SecondaryRadioButton from "./input/radio/SecondaryRadioButton";
|
|
||||||
import SuccessRadioButton from "./input/radio/SuccessRadioButton";
|
|
||||||
import TertiaryRadioButton from "./input/radio/TertiaryRadioButton";
|
|
||||||
import WarningRadioButton from "./input/radio/WarningRadioButton";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
DangerRadioButton,
|
|
||||||
DarkRadioButton,
|
|
||||||
InfoRadioButton,
|
|
||||||
LightRadioButton,
|
|
||||||
MoltenRadioButton,
|
|
||||||
PrimaryRadioButton,
|
|
||||||
RadioButton,
|
|
||||||
RadioList,
|
|
||||||
SecondaryRadioButton,
|
|
||||||
SuccessRadioButton,
|
|
||||||
TertiaryRadioButton,
|
|
||||||
WarningRadioButton
|
|
||||||
};
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import ButtonSwitch from "./input/switch/ButtonSwitch";
|
|
||||||
import DangerSwitch from "./input/switch/DangerSwitch";
|
|
||||||
import DarkSwitch from "./input/switch/DarkSwitch";
|
|
||||||
import LightSwitch from "./input/switch/LightSwitch";
|
|
||||||
import MattrixwvSwitch from "./input/switch/MattrixwvSwitch";
|
|
||||||
import PrimarySwitch from "./input/switch/PrimarySwitch";
|
|
||||||
import SecondarySwitch from "./input/switch/SecondarySwitch";
|
|
||||||
import SuccessDangerSwitch from "./input/switch/SuccessDangerSwitch";
|
|
||||||
import SuccessSwitch from "./input/switch/SuccessSwitch";
|
|
||||||
import TertiarySwitch from "./input/switch/TertiarySwitch";
|
|
||||||
import WarningSwitch from "./input/switch/WarningSwitch";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
ButtonSwitch,
|
|
||||||
DangerSwitch,
|
|
||||||
DarkSwitch,
|
|
||||||
LightSwitch,
|
|
||||||
MattrixwvSwitch,
|
|
||||||
PrimarySwitch,
|
|
||||||
SecondarySwitch,
|
|
||||||
SuccessDangerSwitch,
|
|
||||||
SuccessSwitch,
|
|
||||||
TertiarySwitch,
|
|
||||||
WarningSwitch
|
|
||||||
};
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import MattrixwvTab from "./tab/MattrixwvTab";
|
|
||||||
import MattrixwvTabGroup from "./tab/MattrixwvTabGroup";
|
|
||||||
import MattrixwvTabList from "./tab/MattrixwvTabList";
|
|
||||||
import MattrixwvTabPanel from "./tab/MattrixwvTabPanel";
|
|
||||||
import MattrixwvTabPanels from "./tab/MattrixwvTabPanels";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
MattrixwvTab,
|
|
||||||
MattrixwvTabGroup,
|
|
||||||
MattrixwvTabList,
|
|
||||||
MattrixwvTabPanel,
|
|
||||||
MattrixwvTabPanels
|
|
||||||
};
|
|
||||||
6
lib/component/tab/index.ts
Normal file
6
lib/component/tab/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export { default as MattrixwvTab } from "./MattrixwvTab";
|
||||||
|
export { default as MattrixwvTabGroup } from "./MattrixwvTabGroup";
|
||||||
|
export { default as MattrixwvTabList } from "./MattrixwvTabList";
|
||||||
|
export { default as MattrixwvTabPanel } from "./MattrixwvTabPanel";
|
||||||
|
export { default as MattrixwvTabPanels } from "./MattrixwvTabPanels";
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import ThemeProvider, { useTheme } from "$/providers/theme/ThemeProvider";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
ThemeProvider,
|
|
||||||
useTheme
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import Toaster from "$/component/toaster/Toaster";
|
|
||||||
import ToasterProvider, { useToaster } from "$/providers/toaster/ToasterProvider";
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
Toaster,
|
|
||||||
ToasterProvider,
|
|
||||||
useToaster
|
|
||||||
};
|
|
||||||
|
|
||||||
3
lib/component/toaster/index.ts
Normal file
3
lib/component/toaster/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export { default as ToasterProvider, useToaster } from "$/providers/toaster/ToasterProvider";
|
||||||
|
export { default as Toaster } from "./Toaster";
|
||||||
|
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
export * from "$/component/button";
|
export * from "$/component/button";
|
||||||
export * from "$/component/checkbox";
|
|
||||||
export * from "$/component/input";
|
export * from "$/component/input";
|
||||||
export * from "$/component/loading";
|
export * from "$/component/loading";
|
||||||
export * from "$/component/message";
|
export * from "$/component/message";
|
||||||
export * from "$/component/modal";
|
export * from "$/component/modal";
|
||||||
export * from "$/component/nav";
|
export * from "$/component/nav";
|
||||||
export * from "$/component/progress";
|
export * from "$/component/progress";
|
||||||
export * from "$/component/radio";
|
|
||||||
export * from "$/component/switch";
|
|
||||||
export * from "$/component/tab";
|
export * from "$/component/tab";
|
||||||
export * from "$/component/theme";
|
|
||||||
export * from "$/component/toaster";
|
export * from "$/component/toaster";
|
||||||
|
export * from "$/providers/theme/theme";
|
||||||
|
|
||||||
|
|||||||
2
lib/providers/theme/theme.ts
Normal file
2
lib/providers/theme/theme.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as ThemeProvider, useTheme } from "$/providers/theme/ThemeProvider";
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { DangerMessageBlock, SuccessMessageBlock, WarningMessageBlock } from "$/component/message";
|
import { DangerMessageBlock, SuccessMessageBlock, WarningMessageBlock } from "$/component/message";
|
||||||
import Toaster from "$/component/toaster/Toaster";
|
import Toaster from "$/component/toaster/Toaster";
|
||||||
import type { Toast, ToastProviderProps, ToastProviderState } from "$/types/ToasterTypes";
|
import type { Toast, ToastProviderProps, ToastProviderState } from "$/types/ToasterTypes";
|
||||||
import moment from "moment";
|
|
||||||
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ export default function ToasterProvider({
|
|||||||
const hideToast = useCallback(function hide(id: string){
|
const hideToast = useCallback(function hide(id: string){
|
||||||
setToast((prev) => {
|
setToast((prev) => {
|
||||||
if(prev.length === 1 && prev[0].id === id){
|
if(prev.length === 1 && prev[0].id === id){
|
||||||
const current = prev[0].hideTime > moment(new Date()).subtract(600, "ms").toDate() ? [...prev] : [];
|
const current = prev[0].hideTime > new Date(Date.now() - 600) ? [...prev] : [];
|
||||||
if(current.length > 0){
|
if(current.length > 0){
|
||||||
setTimeout(() => hide(id), 600);
|
setTimeout(() => hide(id), 600);
|
||||||
}
|
}
|
||||||
@@ -45,7 +44,7 @@ export default function ToasterProvider({
|
|||||||
}
|
}
|
||||||
const id = crypto.randomUUID();
|
const id = crypto.randomUUID();
|
||||||
|
|
||||||
setToast((prev) => [ ...prev, { id, message, duration, hideTime: moment(new Date()).add(duration, "ms").toDate() } ]);
|
setToast((prev) => [ ...prev, { id, message, duration, hideTime: new Date(Date.now() + duration) } ]);
|
||||||
setTimeout(() => hideToast(id), duration);
|
setTimeout(() => hideToast(id), duration);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
import type { ChangeEventHandler } from "react";
|
import type { ChangeEventHandler, InputHTMLAttributes } from "react";
|
||||||
|
|
||||||
|
|
||||||
export interface TextInputProps {
|
export interface TextInputProps {
|
||||||
@@ -164,10 +164,8 @@ export interface RadioListProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface DateInputProps {
|
export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "step">{
|
||||||
id?: string;
|
step?: number;
|
||||||
className?: string;
|
value: Date | undefined;
|
||||||
defaultValue?: Date;
|
onChange: (newValue: Date | undefined) => void;
|
||||||
value?: Date;
|
|
||||||
onChange?: (newValue: Date) => void;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ export function humanReadableBytes(bytes: number, decimals: number = 2): string{
|
|||||||
|
|
||||||
const sizes = [ "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ];
|
const sizes = [ "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ];
|
||||||
const power = Math.floor(Math.log(bytes) / Math.log(1024));
|
const power = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||||
return `${parseFloat((bytes / Math.pow(1024, power)).toFixed(decimals))} ${sizes[power]}`;
|
return `${Number.parseFloat((bytes / Math.pow(1024, power)).toFixed(decimals))} ${sizes[power]}`;
|
||||||
}
|
}
|
||||||
|
|||||||
52
package-lock.json
generated
52
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mattrixwv-components",
|
"name": "mattrixwv-components",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mattrixwv-components",
|
"name": "mattrixwv-components",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^9.39.2",
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
"typescript-eslint": "^8.50.0",
|
"typescript-eslint": "^8.50.0",
|
||||||
"vite": "^7.3.0",
|
"vite": "^7.3.0",
|
||||||
"vite-plugin-dts": "^4.5.4",
|
"vite-plugin-dts": "^4.5.4",
|
||||||
|
"vite-plugin-static-copy": "^3.2.0",
|
||||||
"vitest": "^4.0.16"
|
"vitest": "^4.0.16"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@headlessui/react": "^2.2.9",
|
"@headlessui/react": "^2.2.9",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"moment": "^2.30.1",
|
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.3",
|
||||||
"react-icons": "^5.5.0"
|
"react-icons": "^5.5.0"
|
||||||
@@ -6980,16 +6980,6 @@
|
|||||||
"pathe": "^2.0.1"
|
"pathe": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/moment": {
|
|
||||||
"version": "2.30.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
|
||||||
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
|
||||||
"license": "MIT",
|
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
@@ -7234,6 +7224,19 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/p-map": {
|
||||||
|
"version": "7.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz",
|
||||||
|
"integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/parent-module": {
|
"node_modules/parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
@@ -8843,6 +8846,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vite-plugin-static-copy": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-g2k9z8B/1Bx7D4wnFjPLx9dyYGrqWMLTpwTtPHhcU+ElNZP2O4+4OsyaficiDClus0dzVhdGvoGFYMJxoXZ12Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"chokidar": "^3.6.0",
|
||||||
|
"p-map": "^7.0.4",
|
||||||
|
"picocolors": "^1.1.1",
|
||||||
|
"tinyglobby": "^0.2.15"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.0.0 || >=20.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/sapphi-red"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
|
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
|
||||||
"version": "0.27.2",
|
"version": "0.27.2",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",
|
||||||
|
|||||||
42
package.json
42
package.json
@@ -5,7 +5,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "eslint . && tsc -b && vite build",
|
"build": "eslint . && vitest run && tsc -b && vite build",
|
||||||
|
"build:fast": "tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
@@ -20,7 +21,6 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@headlessui/react": "^2.2.9",
|
"@headlessui/react": "^2.2.9",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"moment": "^2.30.1",
|
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.3",
|
||||||
"react-icons": "^5.5.0"
|
"react-icons": "^5.5.0"
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
"typescript-eslint": "^8.50.0",
|
"typescript-eslint": "^8.50.0",
|
||||||
"vite": "^7.3.0",
|
"vite": "^7.3.0",
|
||||||
"vite-plugin-dts": "^4.5.4",
|
"vite-plugin-dts": "^4.5.4",
|
||||||
|
"vite-plugin-static-copy": "^3.2.0",
|
||||||
"vitest": "^4.0.16"
|
"vitest": "^4.0.16"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
@@ -72,8 +73,43 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/mattrixwv-components.d.ts",
|
"types": "./dist/mattrixwv-components.d.ts",
|
||||||
"require": "./dist/mattrixwv-components.cjs",
|
|
||||||
"import": "./dist/mattrixwv-components.js"
|
"import": "./dist/mattrixwv-components.js"
|
||||||
|
},
|
||||||
|
"./button": {
|
||||||
|
"types": "./dist/button.d.ts",
|
||||||
|
"import": "./dist/button.js"
|
||||||
|
},
|
||||||
|
"./input": {
|
||||||
|
"types": "./dist/input.d.ts",
|
||||||
|
"import": "./dist/input.js"
|
||||||
|
},
|
||||||
|
"./loading": {
|
||||||
|
"types": "./dist/loading.d.ts",
|
||||||
|
"import": "./dist/loading.js"
|
||||||
|
},
|
||||||
|
"./message": {
|
||||||
|
"types": "./dist/message.d.ts",
|
||||||
|
"import": "./dist/message.js"
|
||||||
|
},
|
||||||
|
"./modal": {
|
||||||
|
"types": "./dist/modal.d.ts",
|
||||||
|
"import": "./dist/modal.js"
|
||||||
|
},
|
||||||
|
"./nav": {
|
||||||
|
"types": "./dist/nav.d.ts",
|
||||||
|
"import": "./dist/nav.js"
|
||||||
|
},
|
||||||
|
"./progress": {
|
||||||
|
"types": "./dist/progress.d.ts",
|
||||||
|
"import": "./dist/progress.js"
|
||||||
|
},
|
||||||
|
"./tab": {
|
||||||
|
"types": "./dist/tab.d.ts",
|
||||||
|
"import": "./dist/tab.js"
|
||||||
|
},
|
||||||
|
"./toaster": {
|
||||||
|
"types": "./dist/toaster.d.ts",
|
||||||
|
"import": "./dist/toaster.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user