pixelize-design-library 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/. prettierrc +14 -0
  2. package/.eslintcache +1 -0
  3. package/.husky/pre-commit +4 -0
  4. package/.storybook/main.ts +19 -0
  5. package/.storybook/preview.ts +14 -0
  6. package/README.md +48 -0
  7. package/build/favicon.ico +0 -0
  8. package/build/logo192.png +0 -0
  9. package/build/logo512.png +0 -0
  10. package/build/manifest.json +25 -0
  11. package/build/robots.txt +3 -0
  12. package/eslint.config.mjs +20 -0
  13. package/exposedComponents.json +26 -0
  14. package/package.json +105 -0
  15. package/public/favicon.ico +0 -0
  16. package/public/index.html +43 -0
  17. package/public/logo192.png +0 -0
  18. package/public/logo512.png +0 -0
  19. package/public/manifest.json +25 -0
  20. package/public/robots.txt +3 -0
  21. package/rsbuild.config.ts +49 -0
  22. package/src/App.tsx +10 -0
  23. package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.tsx +39 -0
  24. package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.tsx +80 -0
  25. package/src/Components/Apexcharts/ApexBarChart/ApexBarChartProps.tsx +20 -0
  26. package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.tsx +33 -0
  27. package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.tsx +42 -0
  28. package/src/Components/Apexcharts/ApexPieChart/ApexPieChartProps.tsx +17 -0
  29. package/src/Components/Breadcrumbs/Breadcrumbs.stories.tsx +26 -0
  30. package/src/Components/Breadcrumbs/Breadcrumbs.tsx +25 -0
  31. package/src/Components/Breadcrumbs/BreadcrumbsProps.tsx +12 -0
  32. package/src/Components/Button/Button.stories.tsx +32 -0
  33. package/src/Components/Button/Button.tsx +26 -0
  34. package/src/Components/Button/ButtonProps.tsx +10 -0
  35. package/src/Components/ButtonGroupIcon/ButtonGoupIconProps.tsx +14 -0
  36. package/src/Components/ButtonGroupIcon/ButtonGroupIcon.stories.tsx +37 -0
  37. package/src/Components/ButtonGroupIcon/ButtonGroupIcon.tsx +25 -0
  38. package/src/Components/Checkbox/Checkbox.stories.tsx +45 -0
  39. package/src/Components/Checkbox/Checkbox.tsx +29 -0
  40. package/src/Components/Checkbox/CheckboxProps.tsx +9 -0
  41. package/src/Components/Input/TextInput.stories.tsx +44 -0
  42. package/src/Components/Input/TextInput.tsx +70 -0
  43. package/src/Components/Input/TextInputProps.tsx +27 -0
  44. package/src/Components/InputTextArea/InputTextArea.stories.tsx +48 -0
  45. package/src/Components/InputTextArea/InputTextArea.tsx +36 -0
  46. package/src/Components/InputTextArea/InputTextAreaProps.tsx +11 -0
  47. package/src/Components/Loading/Loading.stories.tsx +25 -0
  48. package/src/Components/Loading/Loading.tsx +37 -0
  49. package/src/Components/Loading/LoadingProps.tsx +1 -0
  50. package/src/Components/Modal/Modal.stories.tsx +106 -0
  51. package/src/Components/Modal/Modal.tsx +44 -0
  52. package/src/Components/Modal/ModalProps.tsx +12 -0
  53. package/src/Components/NavigationBar/NavBar.stories.tsx +26 -0
  54. package/src/Components/NavigationBar/NavigationBar.tsx +55 -0
  55. package/src/Components/NavigationBar/NavigationBarProps.tsx +13 -0
  56. package/src/Components/NumberInput/NumberInput.stories.tsx +31 -0
  57. package/src/Components/NumberInput/NumberInput.tsx +55 -0
  58. package/src/Components/NumberInput/NumberInputProps.tsx +28 -0
  59. package/src/Components/PinInput/PinInput.stories.tsx +40 -0
  60. package/src/Components/PinInput/PinInput.tsx +48 -0
  61. package/src/Components/PinInput/PinInputProps.tsx +33 -0
  62. package/src/Components/ProfileCard/ProfileCard.stories.tsx +30 -0
  63. package/src/Components/ProfileCard/ProfileCard.tsx +58 -0
  64. package/src/Components/ProfileCard/ProfileCardProps.tsx +41 -0
  65. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.tsx +25 -0
  66. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.tsx +68 -0
  67. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.tsx +14 -0
  68. package/src/Components/ProgressBar/ProgressBar.stories.tsx +46 -0
  69. package/src/Components/ProgressBar/ProgressBar.tsx +32 -0
  70. package/src/Components/ProgressBar/ProgressBarProps.tsx +7 -0
  71. package/src/Components/RadioButton/RadioButton.stories.tsx +46 -0
  72. package/src/Components/RadioButton/RadioButton.tsx +63 -0
  73. package/src/Components/RadioButton/RadioButtonProps.tsx +10 -0
  74. package/src/Components/Select/Select.stories.tsx +56 -0
  75. package/src/Components/Select/Select.tsx +45 -0
  76. package/src/Components/Select/SelectProps.tsx +15 -0
  77. package/src/Components/SideBar/SideBar.tsx +143 -0
  78. package/src/Components/SideBar/SideBarProps.tsx +18 -0
  79. package/src/Components/SideBar/Sidebar.stories.tsx +80 -0
  80. package/src/Components/Skeletons/Skeleton.stories.tsx +63 -0
  81. package/src/Components/Skeletons/SkeletonProps.tsx +23 -0
  82. package/src/Components/Skeletons/Skeletons.tsx +51 -0
  83. package/src/Components/Table/Table.stories.tsx +47 -0
  84. package/src/Components/Table/Table.tsx +516 -0
  85. package/src/Components/Table/TableProps.tsx +36 -0
  86. package/src/Components/Toaster/Toaster.stories.tsx +58 -0
  87. package/src/Components/Toaster/Toaster.tsx +34 -0
  88. package/src/Components/Toaster/ToasterProps.tsx +15 -0
  89. package/src/Components/ToolTip/ToolTip.stories.tsx +39 -0
  90. package/src/Components/ToolTip/ToolTip.tsx +61 -0
  91. package/src/Components/ToolTip/ToolTipProps.tsx +45 -0
  92. package/src/Layout.tsx +499 -0
  93. package/src/Theme/Dark/theme.ts +278 -0
  94. package/src/Theme/Default/theme.ts +301 -0
  95. package/src/Theme/index.ts +4 -0
  96. package/src/bootstrap.tsx +13 -0
  97. package/src/index.tsx +22 -0
  98. package/src/stories/Configure.mdx +364 -0
  99. package/src/stories/assets/accessibility.png +0 -0
  100. package/src/stories/assets/accessibility.svg +5 -0
  101. package/src/stories/assets/addon-library.png +0 -0
  102. package/src/stories/assets/assets.png +0 -0
  103. package/src/stories/assets/avif-test-image.avif +0 -0
  104. package/src/stories/assets/context.png +0 -0
  105. package/src/stories/assets/discord.svg +15 -0
  106. package/src/stories/assets/docs.png +0 -0
  107. package/src/stories/assets/figma-plugin.png +0 -0
  108. package/src/stories/assets/github.svg +3 -0
  109. package/src/stories/assets/share.png +0 -0
  110. package/src/stories/assets/styling.png +0 -0
  111. package/src/stories/assets/testing.png +0 -0
  112. package/src/stories/assets/theming.png +0 -0
  113. package/src/stories/assets/tutorials.svg +12 -0
  114. package/src/stories/assets/youtube.svg +4 -0
  115. package/src/stories/header.css +32 -0
  116. package/tsconfig.json +20 -0
@@ -0,0 +1,42 @@
1
+ import { ApexOptions } from "apexcharts";
2
+ import ReactApexChart from "react-apexcharts";
3
+ import { ApexPieChartProps } from "./ApexPieChartProps";
4
+
5
+ export default function ApexPieChart({
6
+ data,
7
+ labels,
8
+ title,
9
+ titlePosition,
10
+ height = 400,
11
+ width = 500,
12
+ chartColor,
13
+ titleStyle = {
14
+ color: "#3182ce",
15
+ },
16
+ }: ApexPieChartProps) {
17
+ const options: ApexOptions = {
18
+ chart: {
19
+ type: "pie",
20
+ height: 350,
21
+ },
22
+ labels: labels,
23
+ title: {
24
+ text: title,
25
+ align: titlePosition,
26
+ style: titleStyle,
27
+ },
28
+ colors: chartColor,
29
+ };
30
+ const series = data;
31
+ return (
32
+ <div>
33
+ <ReactApexChart
34
+ options={options}
35
+ series={series}
36
+ type="pie"
37
+ height={height}
38
+ width={width}
39
+ />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,17 @@
1
+ export type ApexPieChartProps = {
2
+ data: number[];
3
+ labels: string[];
4
+ title?: string;
5
+ titlePosition?: 'left' | 'center' | 'right';
6
+ height?: number;
7
+ width?: number;
8
+ chartColor?: string[];
9
+ titleStyle?: StyleProps;
10
+ }
11
+
12
+ type StyleProps = {
13
+ fontSize?: string
14
+ fontFamily?: string
15
+ fontWeight?: string | number
16
+ color?: string
17
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { StoryFn, Meta } from '@storybook/react/types-6-0';
3
+ import Breadcrumbs from './Breadcrumbs';
4
+ import { BreadcrumbsProps } from './BreadcrumbsProps';
5
+
6
+ export default {
7
+ title: 'Components/Breadcrumbs/Breadcrumb',
8
+ component: Breadcrumbs,
9
+ } as Meta;
10
+
11
+ const Template: StoryFn<BreadcrumbsProps> = (args) => <Breadcrumbs {...args} />;
12
+
13
+ export const Default = Template.bind({});
14
+ Default.args = {
15
+ spacing: "8px",
16
+ separator: "/",
17
+ fontWeight: "normal",
18
+ fontSize: "1rem",
19
+ isCurrentPage: true,
20
+ handleClick: (path) => console.log(`Clicked: ${path}`),
21
+ items: [
22
+ { path: '/home', label: 'Home' },
23
+ { path: '/about', label: 'About' },
24
+ { path: '/contact', label: 'Contact' },
25
+ ],
26
+ };
@@ -0,0 +1,25 @@
1
+ import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, ChakraProvider } from "@chakra-ui/react";
2
+ import { BreadcrumbsProps } from "./BreadcrumbsProps";
3
+
4
+ export default function Breadcrumbs({ spacing, separator, fontWeight, fontSize, isCurrentPage, handleClick, items }: BreadcrumbsProps) {
5
+ return (
6
+ <ChakraProvider>
7
+ <Breadcrumb spacing={spacing} separator={separator} fontWeight={fontWeight} fontSize={fontSize}>
8
+ {items.map((item, index) => (
9
+ <BreadcrumbItem key={index} isCurrentPage={isCurrentPage && index === items.length - 1}>
10
+ <BreadcrumbLink
11
+ href={item.path}
12
+ sx={{ '&:hover, &:active': { textDecoration: 'none' } }}
13
+ onClick={(event) => {
14
+ event.preventDefault();
15
+ handleClick(item.path);
16
+ }}
17
+ >
18
+ {item.label}
19
+ </BreadcrumbLink>
20
+ </BreadcrumbItem>
21
+ ))}
22
+ </Breadcrumb>
23
+ </ChakraProvider>
24
+ );
25
+ }
@@ -0,0 +1,12 @@
1
+ import { BreadcrumbProps } from "@chakra-ui/react";
2
+
3
+ export type BreadcrumbsProps = Pick<BreadcrumbProps, "spacing" | "separator" | "fontWeight" | "fontSize"> & {
4
+ isCurrentPage?: boolean;
5
+ isLastChild?: boolean;
6
+ handleClick: (path: string) => void;
7
+ items: BreadcrumbItem[];
8
+ };
9
+ export type BreadcrumbItem = {
10
+ path: string;
11
+ label: string;
12
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import Button from './Button';
4
+ import { fn } from '@storybook/test';
5
+
6
+ const meta: Meta<typeof Button> = {
7
+ title: 'Components/Button/Button',
8
+ component: Button,
9
+
10
+ parameters: {
11
+ layout: 'centered',
12
+ },
13
+ tags: ['autodocs']
14
+ };
15
+
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ export const Primary: Story = {
20
+ args: {
21
+ label: 'Button',
22
+ width: '',
23
+ color: 'blue',
24
+ variant: 'solid',
25
+ size: 'md',
26
+ isDisabled: false,
27
+ isLoading: false,
28
+ loadingText: 'Loading',
29
+ type: 'button',
30
+ onClick: fn()
31
+ },
32
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Button as ChakraButton, ChakraProvider, } from '@chakra-ui/react';
3
+ import { ButtonProps } from './ButtonProps';
4
+
5
+ export default function Button({
6
+ label,
7
+ width = "120px",
8
+ onClick,
9
+ color,
10
+ variant,
11
+ leftIcon,
12
+ rightIcon,
13
+ size,
14
+ isDisabled = false,
15
+ isLoading = false,
16
+ loadingText = "Loading",
17
+ type
18
+ }: ButtonProps) {
19
+ return (
20
+ <ChakraProvider>
21
+ <ChakraButton type={type} onClick={onClick} width={width} colorScheme={color} variant={variant} size={size} isLoading={isLoading} isDisabled={isDisabled} loadingText={loadingText} leftIcon={leftIcon} rightIcon={rightIcon} >
22
+ {label}
23
+ </ChakraButton>
24
+ </ChakraProvider>
25
+ );
26
+ }
@@ -0,0 +1,10 @@
1
+ import { ButtonProps as ChakraButtonProps } from "@chakra-ui/react";
2
+
3
+ export type ButtonProps = Pick<ChakraButtonProps, "onClick" | "leftIcon" | "rightIcon" | "isDisabled" | "isLoading" | "loadingText" | "colorScheme" | "spinner"> & {
4
+ label?: string,
5
+ width?: string | number,
6
+ size?: "lg" | "md" | "sm" | "xs",
7
+ variant?: "solid" | "outline" | "ghost" | "link" | "unstyled",
8
+ color?: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "whiteAlpha" | "blackAlpha",
9
+ type?: "button" | "submit" | "reset",
10
+ }
@@ -0,0 +1,14 @@
1
+ import { ReactElement } from "react";
2
+
3
+ export type ButtonGroupIconProps = {
4
+ leftIcon?: ReactElement,
5
+ rightIcon?: ReactElement,
6
+ onLeftIconClick?: () => void;
7
+ onRightIconClick?: () => void;
8
+ buttonText: string,
9
+ onButtonClick?: () => void,
10
+ onButtongroupClick?: () => void,
11
+ size?: "lg" | "md" | "sm" | "xs",
12
+ variant?: "solid" | "outline" | "ghost" | "link" | "unstyled",
13
+ color?: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "whiteAlpha" | "blackAlpha",
14
+ }
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { Meta, StoryFn } from '@storybook/react';
3
+ import ButtonGroupIcon from './ButtonGroupIcon'; // Adjust the import path and component type if needed
4
+ import {ButtonGroupIconProps} from './ButtonGoupIconProps';
5
+ import { FiHome } from 'react-icons/fi';
6
+
7
+ export default {
8
+ title: 'Components/ButtonGroupIcon/ButtonGroupIcon',
9
+ component: ButtonGroupIcon,
10
+ argTypes: {
11
+ size: { control: { type: 'select', options: ['sm', 'md', 'lg'] } },
12
+ variant: {
13
+ control: { type: 'select', options: ["solid","outline","ghost","link"] },
14
+ defaultValue: 'solid'
15
+ },
16
+ color: {
17
+ control: { type: 'select', options: ["gray" ,"red" ,"orange" ,"yellow" ,"green" ,"teal" ,"blue" ,"cyan" ,"purple" ,"pink" ,"whiteAlpha" ,"blackAlpha"] },
18
+ defaultValue: 'blue'
19
+ },
20
+ },
21
+ } as Meta;
22
+
23
+ const Template: StoryFn<ButtonGroupIconProps> = (args) => <ButtonGroupIcon {...args} />;
24
+
25
+ export const Default = Template.bind({});
26
+ Default.args = {
27
+ leftIcon: <FiHome/>,
28
+ rightIcon: <FiHome />,
29
+ onLeftIconClick: () => console.log('Left icon clicked'),
30
+ onRightIconClick: () => console.log('Right icon clicked'),
31
+ buttonText: 'Button Text',
32
+ onButtonClick: () => console.log('Button clicked'),
33
+ onButtongroupClick: () => console.log('Button group clicked'),
34
+ size: 'md',
35
+ variant: 'solid',
36
+ color: 'blue',
37
+ };
@@ -0,0 +1,25 @@
1
+ import { Button, ButtonGroup, ChakraProvider, IconButton } from "@chakra-ui/react";
2
+ import { ButtonGroupIconProps } from "./ButtonGoupIconProps";
3
+
4
+ export default function ButtonGroupIcon({
5
+ leftIcon,
6
+ rightIcon,
7
+ onLeftIconClick,
8
+ onRightIconClick,
9
+ buttonText,
10
+ onButtonClick,
11
+ onButtongroupClick,
12
+ size,
13
+ variant,
14
+ color
15
+ }:ButtonGroupIconProps){
16
+ return(
17
+ <ChakraProvider>
18
+ <ButtonGroup size={size} isAttached variant={variant} onClick={onButtongroupClick} colorScheme={color}>
19
+ {leftIcon && <IconButton aria-label='Left icon button' icon={leftIcon} onClick={onLeftIconClick} />}
20
+ <Button onClick={onButtonClick}>{buttonText}</Button>
21
+ {rightIcon && <IconButton aria-label='Right icon button' icon={rightIcon} onClick={onRightIconClick} />}
22
+ </ButtonGroup>
23
+ </ChakraProvider>
24
+ )
25
+ }
@@ -0,0 +1,45 @@
1
+ import React, { useState } from 'react';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import CheckBox from './Checkbox';
4
+ import { fn } from '@storybook/test';
5
+ import { CheckboxProps } from './CheckboxProps';
6
+
7
+ const meta: Meta<typeof CheckBox> = {
8
+ title: 'Components/CheckBox/CheckBox',
9
+ component: CheckBox,
10
+
11
+ parameters: {
12
+ layout: 'centered',
13
+ },
14
+ tags: ['autodocs']
15
+ };
16
+
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ const CheckBoxTemplate = (args: CheckboxProps) => {
21
+ const [check, setCheck] = useState(true);
22
+ const handleCheck = (e: any) => {
23
+ setCheck(!check);
24
+ }
25
+ return <CheckBox {...args} onChange={handleCheck} isChecked={check} />
26
+ }
27
+
28
+ export const Check_box: Story = {
29
+ args: {
30
+ label: 'Checkbox',
31
+ spacing: 6,
32
+ isInvalid: false,
33
+ color: 'blue',
34
+ iconColor: 'white',
35
+ iconSize: '1em',
36
+ isChecked: true,
37
+ isIndeterminate: false,
38
+ isDisabled: false,
39
+ size: 'md',
40
+ value: 'checkbox',
41
+ defaultChecked: false,
42
+ onChange: fn()
43
+ },
44
+ render: (args) => CheckBoxTemplate(args)
45
+ };
@@ -0,0 +1,29 @@
1
+ import React, { FC } from 'react';
2
+ import { Checkbox as ChakraCheckbox, ChakraProvider, } from '@chakra-ui/react';
3
+ import { CheckboxProps } from './CheckboxProps';
4
+
5
+ const CheckBox: FC<CheckboxProps> = ({
6
+ label,
7
+ spacing,
8
+ isInvalid,
9
+ color,
10
+ iconColor,
11
+ iconSize,
12
+ isChecked,
13
+ isIndeterminate,
14
+ onChange,
15
+ isDisabled,
16
+ size,
17
+ value,
18
+ defaultChecked
19
+ }) => {
20
+ return (
21
+ <ChakraProvider>
22
+ <ChakraCheckbox spacing={spacing} isInvalid={isInvalid} colorScheme={color} iconColor={iconColor} iconSize={iconSize} isChecked={isChecked} isIndeterminate={isIndeterminate} onChange={onChange} isDisabled={isDisabled} size={size} value={value} defaultChecked={defaultChecked}>
23
+ {label}
24
+ </ChakraCheckbox>
25
+ </ChakraProvider>
26
+ );
27
+ }
28
+
29
+ export default CheckBox;
@@ -0,0 +1,9 @@
1
+ import { CheckboxProps as ChakraButtonProps } from "@chakra-ui/react";
2
+
3
+ export type CheckboxProps = Pick<ChakraButtonProps, 'spacing' | 'isInvalid' | 'size' | 'iconColor' | 'iconSize' | 'isChecked' | 'isIndeterminate' | 'onChange' | 'isDisabled' | 'value' | 'defaultChecked'> & {
4
+ label?: string;
5
+ width?: string | number;
6
+ variant?: "solid" | "outline" | "ghost" | "link" | "unstyled";
7
+ color?: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "whiteAlpha" | "blackAlpha";
8
+ size?: "sm" | "md" | "lg";
9
+ }
@@ -0,0 +1,44 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
3
+ import { TextInputProps } from './TextInputProps';
4
+ import TextInput from './TextInput';
5
+ import { useState } from 'react';
6
+
7
+ const meta: Meta<typeof TextInput> = {
8
+ title: 'Components/Input/TextInput',
9
+ component: TextInput,
10
+ parameters: {
11
+ layout: 'centered',
12
+ },
13
+ tags: ['autodocs'],
14
+ };
15
+
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ const TextInputTemplate = (args: TextInputProps) => {
20
+ const [value, setValue] = useState("");
21
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
22
+ setValue(e.target.value);
23
+ }
24
+ return <TextInput {...args} onChange={handleChange} value={value} />
25
+ };
26
+
27
+ export const Primary: Story = {
28
+ args: {
29
+ label: 'Button',
30
+ onChange: fn(),
31
+ onBlur: fn(),
32
+ onFocus: fn(),
33
+ isDisabled: false,
34
+ isReadOnly: false,
35
+ isRequired: false,
36
+ value: "",
37
+ placeholder: "Placeholder",
38
+ width: 500,
39
+ error: true,
40
+ errorMessage: "jhkjhkjh",
41
+ helperText: ""
42
+ },
43
+ render: (args) => TextInputTemplate(args)
44
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ ChakraProvider,
3
+ FormControl,
4
+ FormErrorMessage,
5
+ FormHelperText,
6
+ FormLabel,
7
+ Input,
8
+ InputGroup,
9
+ InputRightElement,
10
+ } from "@chakra-ui/react";
11
+ import { TextInputProps } from "./TextInputProps";
12
+ import React from "react";
13
+
14
+ export default function TextInput({
15
+ label,
16
+ type = "text",
17
+ id,
18
+ name,
19
+ onChange,
20
+ onBlur,
21
+ onFocus,
22
+ isDisabled = false,
23
+ isReadOnly = false,
24
+ isRequired = false,
25
+ value,
26
+ placeholder = "Placeholder",
27
+ width = "250px",
28
+ error,
29
+ errorMessage,
30
+ helperText,
31
+ onRightIconclick,
32
+ inputRightIcon,
33
+ inputGroupStyle,
34
+ inputStyle,
35
+ }: TextInputProps) {
36
+ return (
37
+ <ChakraProvider>
38
+ <FormControl isRequired={isRequired} isInvalid={error}>
39
+ {label && <FormLabel mb="0.25rem">{label}</FormLabel>}
40
+ <InputGroup width={width} style={inputGroupStyle}>
41
+ <Input
42
+ type={type}
43
+ placeholder={placeholder}
44
+ onChange={onChange}
45
+ onBlur={onBlur}
46
+ onFocus={onFocus}
47
+ value={value}
48
+ errorBorderColor={error ? "crimson" : ""}
49
+ isDisabled={isDisabled}
50
+ isReadOnly={isReadOnly}
51
+ id={id}
52
+ name={name}
53
+ style={inputStyle}
54
+ />
55
+ {inputRightIcon && (
56
+ <InputRightElement
57
+ children={inputRightIcon}
58
+ onClick={onRightIconclick}
59
+ />
60
+ )}
61
+ </InputGroup>
62
+ {/* <Input type={type} placeholder={placeholder} onChange={onChange} onBlur={onBlur} onFocus={onFocus} value={value} width={width} errorBorderColor={error ? "crimson" : ""} isDisabled={isDisabled} isReadOnly={isReadOnly} /> */}
63
+ {error && <FormErrorMessage pl={4}>{errorMessage}</FormErrorMessage>}
64
+ {helperText && !error && (
65
+ <FormHelperText pl={4}>{helperText}</FormHelperText>
66
+ )}
67
+ </FormControl>
68
+ </ChakraProvider>
69
+ );
70
+ }
@@ -0,0 +1,27 @@
1
+ import { InputProps } from "@chakra-ui/react";
2
+
3
+ export type TextInputProps = Pick<
4
+ InputProps,
5
+ | "value"
6
+ | "type"
7
+ | "onChange"
8
+ | "placeholder"
9
+ | "onBlur"
10
+ | "onFocus"
11
+ | "isDisabled"
12
+ | "isRequired"
13
+ | "isReadOnly"
14
+ | "width"
15
+ | "errorBorderColor"
16
+ > & {
17
+ label?: string;
18
+ id?: string;
19
+ name?: string;
20
+ error?: boolean;
21
+ errorMessage?: string;
22
+ helperText?: string;
23
+ onRightIconclick?: () => void;
24
+ inputRightIcon?: JSX.Element | string;
25
+ inputStyle?: {}
26
+ inputGroupStyle?: {}
27
+ };
@@ -0,0 +1,48 @@
1
+ import type { Meta, StoryObj } from "@storybook/react/*";
2
+ import { InputTextAreaProps } from "./InputTextAreaProps";
3
+ import InputTextArea from "./InputTextArea";
4
+ import { useState } from "react";
5
+
6
+ const meta: Meta<typeof InputTextArea> = {
7
+ title: "Components/InputTextArea/InputTextArea",
8
+ component: InputTextArea,
9
+ parameters: {
10
+ layout: "centered",
11
+ },
12
+ tags: ["autodocs"],
13
+ };
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ const TextAreaTemplate = (args: InputTextAreaProps) => {
19
+ const [value, setValue] = useState("");
20
+ const handleOnChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
21
+ setValue(e.target.value);
22
+ }
23
+ return <InputTextArea {...args} onChange={handleOnChange} value={value} />
24
+ };
25
+
26
+ export const Primary: Story = {
27
+ args: {
28
+ label: "hello",
29
+ helperText: 'Hello',
30
+ errorMessage: 'Required',
31
+ error: true,
32
+ rows: 5,
33
+ onChange: () => { },
34
+ value: "",
35
+ placeholder: "Placeholder",
36
+ width: "100%",
37
+ isDisabled: false,
38
+ isReadOnly: false,
39
+ isRequired: false,
40
+ resize: "vertical",
41
+ size: "md",
42
+ variant: "outline",
43
+ focusBorderColor: "blue.500",
44
+ errorBorderColor: "red.500",
45
+
46
+
47
+ }, render: (args) => TextAreaTemplate(args)
48
+ }
@@ -0,0 +1,36 @@
1
+ import { ChakraProvider, FormControl, FormErrorMessage, FormHelperText, FormLabel, Textarea } from '@chakra-ui/react'
2
+ import React from 'react'
3
+ import { InputTextAreaProps } from './InputTextAreaProps'
4
+
5
+ export default function InputTextArea({
6
+ label,
7
+ placeholder,
8
+ value,
9
+ onChange,
10
+ size = "md",
11
+ resize = "both",
12
+ width = 500,
13
+ isDisabled,
14
+ errorBorderColor,
15
+ focusBorderColor,
16
+ isReadOnly,
17
+ isRequired = false,
18
+ error,
19
+ errorMessage,
20
+ helperText,
21
+ rows,
22
+ height
23
+ }: InputTextAreaProps) {
24
+ return (
25
+ <ChakraProvider>
26
+ <FormControl isRequired={isRequired} isInvalid={error} >
27
+ {label && <FormLabel mb="0.25rem">{label}</FormLabel>}
28
+ <Textarea placeholder={placeholder} value={value} onChange={onChange} size={size} resize={resize} isDisabled={isDisabled} errorBorderColor={errorBorderColor} focusBorderColor={focusBorderColor} isReadOnly={isReadOnly} isInvalid={error} width={width} rows={rows} height={height} />
29
+ {error && (
30
+ <FormErrorMessage pl={4}>{errorMessage}</FormErrorMessage>
31
+ )}
32
+ {helperText && !error && <FormHelperText pl={4}>{helperText}</FormHelperText>}
33
+ </FormControl>
34
+ </ChakraProvider>
35
+ )
36
+ }
@@ -0,0 +1,11 @@
1
+ import { TextareaProps } from "@chakra-ui/react";
2
+
3
+ export type InputTextAreaProps = Pick<TextareaProps, "placeholder" | "value" | "onChange" | "size" | "resize" | "isDisabled" | "errorBorderColor" | "focusBorderColor" | "isReadOnly" | "isRequired" | "variant"> & {
4
+ label?: string;
5
+ error?: boolean;
6
+ errorMessage?: string;
7
+ helperText?: string;
8
+ width?: string | number;
9
+ rows?: number;
10
+ height?: string | number;
11
+ }
@@ -0,0 +1,25 @@
1
+ import React, { useState } from 'react';
2
+ import { StoryFn, Meta } from '@storybook/react/types-6-0';
3
+ import { Button } from "@chakra-ui/react";
4
+ import Loading from './Loading';
5
+ import { LoadingProps } from './LoadingProps';
6
+
7
+ export default {
8
+ title: 'Components/Loading/Loading',
9
+ component: Loading,
10
+ } as Meta;
11
+
12
+ const Template: StoryFn<LoadingProps> = (args) => {
13
+ const [isLoading, setIsLoading] = useState(false);
14
+ return (
15
+ <div>
16
+ <Button onClick={() => setIsLoading(!isLoading)}>Toggle Loading</Button>
17
+ <Loading {...args} isLoading={isLoading} />
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export const Interactive = Template.bind({});
23
+ Interactive.args = {
24
+ text: 'Loading...',
25
+ };
@@ -0,0 +1,37 @@
1
+ import { Box, Center, ChakraProvider, Spinner, Text } from "@chakra-ui/react";
2
+ import { LoadingProps } from "./LoadingProps";
3
+
4
+ export default function Loading({ text, isLoading }: LoadingProps) {
5
+ if (!isLoading) {
6
+ return null;
7
+ }
8
+ return (
9
+ <ChakraProvider>
10
+ <Box
11
+ position="fixed"
12
+ top="0"
13
+ right="0"
14
+ bottom="0"
15
+ left="0"
16
+ backgroundColor="rgba(0, 0, 0, 0.4)"
17
+ backdropFilter="blur(4px)"
18
+ display="flex"
19
+ alignItems="center"
20
+ justifyContent="center"
21
+ flexDirection="column"
22
+ zIndex="9999"
23
+ >
24
+ <Center height="100vh">
25
+ <Spinner
26
+ thickness="4px"
27
+ speed="0.65s"
28
+ emptyColor="gray.200"
29
+ color="blue.500"
30
+ size="xl"
31
+ />
32
+ <Text mt="2" ml={"5"}>{text}</Text>
33
+ </Center>
34
+ </Box>
35
+ </ChakraProvider>
36
+ )
37
+ }