diff --git a/src/components/MUI/Feedback/Alert.stories.tsx b/src/components/MUI/Feedback/Alert.stories.tsx new file mode 100644 index 0000000..4ce149e --- /dev/null +++ b/src/components/MUI/Feedback/Alert.stories.tsx @@ -0,0 +1,84 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { Alert, Button, Stack } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/Alert", + component: Alert, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + severity: { + control: "select", + options: ["success", "info", "warning", "error"], + }, + variant: { control: "select", options: ["standard", "outlined", "filled"] }, + children: { name: "message", control: "text" }, + icon: { control: false }, + action: { control: false }, + onClose: { control: false }, + }, + args: { + severity: "info", + variant: "standard", + children: "Alert message", + }, +}; +export default meta; +type Story = StoryObj; + +export const Basic: Story = { render: (args) => }; + +export const Variants: Story = { + render: (args) => ( + + + Standard + + + Outlined + + + Filled + + + ), +}; + +export const SeverityLevels: Story = { + render: (args) => ( + + + This is a success alert + + + This is an info alert + + + This is a warning alert + + + This is an error alert + + + ), +}; + +export const WithActionAndClose: Story = { + render: (args) => ( + <> + + UNDO + + } + onClose={() => console.log("alert close")} + > + Warning with action + + + ), +}; diff --git a/src/components/MUI/Feedback/Backdrop.stories.tsx b/src/components/MUI/Feedback/Backdrop.stories.tsx new file mode 100644 index 0000000..ba99c8a --- /dev/null +++ b/src/components/MUI/Feedback/Backdrop.stories.tsx @@ -0,0 +1,46 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import * as React from "react"; +import { Backdrop, Button, CircularProgress, Stack } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/Backdrop", + component: Backdrop, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + invisible: { control: "boolean" }, + }, + args: { invisible: false }, +}; +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + render: (args) => { + return ( + + + + + + ); + }, +}; + +/** + * Click show to open backdrop and click again to close. + */ +export const ControlledBackdrop: Story = { + render: (args) => { + const [open, setOpen] = React.useState(false); + return ( + + + setOpen(false)}> + + + + ); + }, +}; diff --git a/src/components/MUI/Feedback/CircularProgress.stories.tsx b/src/components/MUI/Feedback/CircularProgress.stories.tsx new file mode 100644 index 0000000..caadb43 --- /dev/null +++ b/src/components/MUI/Feedback/CircularProgress.stories.tsx @@ -0,0 +1,97 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { CircularProgress, Stack, Typography } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/CircularProgress", + component: CircularProgress, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + color: { + control: "select", + options: [ + "primary", + "secondary", + "success", + "error", + "info", + "warning", + "inherit", + ], + }, + variant: { control: "select", options: ["indeterminate", "determinate"] }, + value: { control: { type: "number", min: 0, max: 100, step: 1 } }, + size: { control: { type: "number", min: 8, max: 200, step: 2 } }, + thickness: { control: { type: "number", min: 1, max: 10, step: 0.5 } }, + }, + args: { + color: "primary", + variant: "indeterminate", + value: 75, + size: 40, + thickness: 3.6, + }, +}; +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + render: (args) => , +}; + +export const Determinate: Story = { + args: { variant: "determinate", value: 70 }, + render: (args) => , +}; + +export const DeterminateValues: Story = { + render: (args) => ( + + {[0, 25, 50, 75, 100].map((value) => ( + + + {value}% + + ))} + + ), +}; + +export const Sizes: Story = { + parameters: { + docs: { + description: { + story: "Circular Progress in different sizes.", + }, + }, + }, + render: (args) => ( + + {[16, 24, 40, 64, 80].map((size) => ( + + ))} + + ), +}; + +export const Thickness: Story = { + parameters: {}, + render: (args) => ( + + {[2, 3.6, 5, 7].map((thickness) => ( + + ))} + + ), +}; diff --git a/src/components/MUI/Feedback/Dialog.stories.tsx b/src/components/MUI/Feedback/Dialog.stories.tsx new file mode 100644 index 0000000..9ad50c9 --- /dev/null +++ b/src/components/MUI/Feedback/Dialog.stories.tsx @@ -0,0 +1,84 @@ +import React from "react"; +import type { Meta, StoryObj } from "@storybook/react"; +import { + Box, + Button, + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Typography, +} from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/Dialog", + component: Dialog, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + fullWidth: { control: "boolean" }, + maxWidth: { + control: "select", + options: ["xs", "sm", "md", "lg", "xl", false], + }, + fullScreen: { control: "boolean" }, + scroll: { control: "select", options: ["paper", "body"] }, + }, + args: { fullWidth: true, maxWidth: "sm", fullScreen: false, scroll: "paper" }, +}; +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + render: (args) => { + const [open, setOpen] = React.useState(false); + return ( + + + setOpen(false)}> + Title + + Content goes here. + + + + + + + + ); + }, +}; + +export const FullScreen: Story = { + args: { fullScreen: true }, + render: (args) => { + const [open, setOpen] = React.useState(false); + return ( +
+ + setOpen(false)} + > + Full Screen + + Full-screen content. + + + + + +
+ ); + }, +}; diff --git a/src/components/MUI/Feedback/LinearProgress.stories.tsx b/src/components/MUI/Feedback/LinearProgress.stories.tsx new file mode 100644 index 0000000..1cac2bf --- /dev/null +++ b/src/components/MUI/Feedback/LinearProgress.stories.tsx @@ -0,0 +1,100 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { LinearProgress, Stack, Typography } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/LinearProgress", + component: LinearProgress, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + color: { + control: "select", + options: [ + "primary", + "secondary", + "success", + "error", + "info", + "warning", + "inherit", + ], + }, + variant: { + control: "select", + options: ["indeterminate", "determinate", "buffer", "query"], + }, + value: { control: { type: "number", min: 0, max: 100, step: 1 } }, + valueBuffer: { control: { type: "number", min: 0, max: 100, step: 1 } }, + }, + args: { + color: "primary", + variant: "indeterminate", + value: 40, + valueBuffer: 60, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + render: (args) => , +}; + +export const Determinate: Story = { + args: { variant: "determinate", value: 50 }, + render: (args) => , +}; + +export const Buffer: Story = { + args: { variant: "buffer", value: 30, valueBuffer: 60 }, + render: (args) => , +}; + +export const Query: Story = { + args: { variant: "query" }, + render: (args) => , +}; + +export const DeterminateValues: Story = { + parameters: { + docs: { + description: { + story: "Determinate linear progress with different values.", + }, + }, + }, + render: (args) => ( + + {[0, 25, 50, 75, 100].map((value) => ( + + ))} + + ), +}; + +export const WithLabelValues: Story = { + parameters: { + docs: { + description: { + story: "Linear progress with value labels.", + }, + }, + }, + render: (args) => ( + + {[0, 25, 50, 75, 100].map((value) => ( + + + {value}% + + ))} + + ), +}; diff --git a/src/components/MUI/Feedback/Skeleton.stories.tsx b/src/components/MUI/Feedback/Skeleton.stories.tsx new file mode 100644 index 0000000..3a7332b --- /dev/null +++ b/src/components/MUI/Feedback/Skeleton.stories.tsx @@ -0,0 +1,77 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { Skeleton, Stack, Typography } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/Skeleton", + component: Skeleton, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + variant: { + control: "select", + options: ["text", "rectangular", "circular", "rounded"], + }, + animation: { + control: "select", + options: ["pulse", "wave", false], + }, + width: { + control: { type: "number", min: 16, max: 600, step: 4 }, + }, + height: { + control: { type: "number", min: 16, max: 400, step: 4 }, + }, + }, + args: { + variant: "rectangular", + animation: "pulse", + width: 240, + height: 180, + }, +}; + +export default meta; +type Story = StoryObj; + +/** + * Skeleton represents elements while content is loading. + * Multiple Skeletons can be composed to represent complex layouts. + */ +export const Basic: Story = { + render: (args) => , +}; + +export const Variants: Story = { + render: (_args) => ( + + Text + + Circular + + Rectangular + + Rounded + + + ), +}; + +export const Animations: Story = { + render: (args) => ( + + + Pulse + + + + Wave + + + + None + + + + ), +}; diff --git a/src/components/MUI/Feedback/Snackbar.stories.tsx b/src/components/MUI/Feedback/Snackbar.stories.tsx new file mode 100644 index 0000000..e0a4022 --- /dev/null +++ b/src/components/MUI/Feedback/Snackbar.stories.tsx @@ -0,0 +1,47 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import React from "react"; +import { Button, Snackbar, Stack } from "../MuiWrapped"; +import { muiDocsParameters } from "../../../../.storybook/muiDocsParameters"; + +const meta: Meta = { + title: "MUI/Feedback/Snackbar", + component: Snackbar, + tags: ["autodocs"], + parameters: muiDocsParameters, + argTypes: { + message: { + control: "text", + }, + autoHideDuration: { + control: { type: "number", min: 1000, max: 10000, step: 500 }, + }, + }, + args: { + message: "Saved", + autoHideDuration: 3000, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Basic: Story = { + render: (args) => { + const [open, setOpen] = React.useState(false); + + return ( + + + + setOpen(false)} + /> + + ); + }, +}; diff --git a/src/components/MUI/MuiWrapped.tsx b/src/components/MUI/MuiWrapped.tsx index 8997504..13284a4 100644 --- a/src/components/MUI/MuiWrapped.tsx +++ b/src/components/MUI/MuiWrapped.tsx @@ -69,7 +69,32 @@ import MuiListItemText, { import MuiListSubheader, { ListSubheaderProps as MuiListSubheaderProps, } from "@mui/material/ListSubheader"; +import MuiBackdrop, { + BackdropProps as MuiBackdropProps, +} from "@mui/material/Backdrop"; +import MuiCircularProgress, { + CircularProgressProps as MuiCircularProgressProps, +} from "@mui/material/CircularProgress"; +import MuiDialog, { DialogProps as MuiDialogProps } from "@mui/material/Dialog"; +import MuiDialogTitle, { + DialogTitleProps as MuiDialogTitleProps, +} from "@mui/material/DialogTitle"; +import MuiDialogActions, { + DialogActionsProps as MuiDialogActionsProps, +} from "@mui/material/DialogActions"; +import MuiDialogContent, { + DialogContentProps as MuiDialogContentProps, +} from "@mui/material/DialogContent"; +import MuiLinearProgress, { + LinearProgressProps as MuiLinearProgressProps, +} from "@mui/material/LinearProgress"; import MuiPaper, { PaperProps as MuiPaperProps } from "@mui/material/Paper"; +import MuiSkeleton, { + SkeletonProps as MuiSkeletonProps, +} from "@mui/material/Skeleton"; +import MuiSnackbar, { + SnackbarProps as MuiSnackbarProps, +} from "@mui/material/Snackbar"; import MuiStack, { StackProps as MuiStackProps } from "@mui/material/Stack"; import MuiSvgIcon, { SvgIconProps as MuiSvgIconProps, @@ -128,6 +153,7 @@ export const AvatarGroup = MuiWrapper( "AvatarGroup", ); export const Badge = MuiWrapper(MuiBadge, "Badge"); +export const Backdrop = MuiWrapper(MuiBackdrop, "Backdrop"); export const Box = MuiWrapper(MuiBox, "Box"); export const Button = MuiWrapper(MuiButton, "Button"); export const Card = MuiWrapper(MuiCard, "Card"); @@ -146,6 +172,23 @@ export const CardMedia = MuiWrapper( export const Chip = MuiWrapper(MuiChip, "Chip"); export const DeleteIcon = MuiWrapper(MuiDeleteIcon, "DeleteIcon"); export const Divider = MuiWrapper(MuiDivider, "Divider"); +export const CircularProgress = MuiWrapper< + MuiCircularProgressProps, + HTMLSpanElement +>(MuiCircularProgress, "CircularProgress"); +export const Dialog = MuiWrapper(MuiDialog, "Dialog"); +export const DialogActions = MuiWrapper( + MuiDialogActions, + "DialogActions", +); +export const DialogContent = MuiWrapper( + MuiDialogContent, + "DialogContent", +); +export const DialogTitle = MuiWrapper( + MuiDialogTitle, + "DialogTitle", +); export const ExpandMoreIcon = MuiWrapper(MuiExpandMoreIcon, "ExpandMoreIcon"); export const FolderIcon = MuiWrapper(MuiFolderIcon, "FolderIcon"); export const Icon = MuiWrapper(MuiIcon, "Icon"); @@ -177,6 +220,11 @@ export const ListSubheader = MuiWrapper( "ListSubheader", ); export const MailIcon = MuiWrapper(MuiMailIcon, "MailIcon"); + +export const LinearProgress = MuiWrapper( + MuiLinearProgress, + "LinearProgress", +); export const MenuIcon = MuiWrapper(MuiMenuIcon, "MenuIcon"); export const NotificationsIcon = MuiWrapper( MuiNotificationsIcon, @@ -186,6 +234,8 @@ export const PageviewIcon = MuiWrapper(MuiPageviewIcon, "PageviewIcon"); export const Paper = MuiWrapper(MuiPaper, "Paper"); export const SaveIcon = MuiWrapper(MuiSaveIcon, "SaveIcon"); export const SendIcon = MuiWrapper(MuiSendIcon, "SendIcon"); +export const Skeleton = MuiWrapper(MuiSkeleton, "Skeleton"); +export const Snackbar = MuiWrapper(MuiSnackbar, "Snackbar"); export const Stack = MuiWrapper(MuiStack, "Stack"); export const SvgIcon = MuiWrapper(MuiSvgIcon, "SvgIcon"); export const Table = MuiWrapper(MuiTable, "Table");