pixelize-design-library 1.0.21 → 1.0.22
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.
- package/package.json +1 -1
- package/src/App.tsx +0 -10
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.tsx +0 -39
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.tsx +0 -80
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChartProps.tsx +0 -20
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.tsx +0 -33
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.tsx +0 -43
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChartProps.tsx +0 -17
- package/src/Components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -26
- package/src/Components/Breadcrumbs/Breadcrumbs.tsx +0 -26
- package/src/Components/Breadcrumbs/BreadcrumbsProps.tsx +0 -12
- package/src/Components/Button/Button.stories.tsx +0 -32
- package/src/Components/Button/Button.tsx +0 -26
- package/src/Components/Button/ButtonProps.tsx +0 -10
- package/src/Components/ButtonGroupIcon/ButtonGoupIconProps.tsx +0 -14
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.stories.tsx +0 -37
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.tsx +0 -26
- package/src/Components/Checkbox/Checkbox.stories.tsx +0 -45
- package/src/Components/Checkbox/Checkbox.tsx +0 -29
- package/src/Components/Checkbox/CheckboxProps.tsx +0 -9
- package/src/Components/Input/TextInput.stories.tsx +0 -45
- package/src/Components/Input/TextInput.tsx +0 -70
- package/src/Components/Input/TextInputProps.tsx +0 -27
- package/src/Components/InputTextArea/InputTextArea.stories.tsx +0 -49
- package/src/Components/InputTextArea/InputTextArea.tsx +0 -36
- package/src/Components/InputTextArea/InputTextAreaProps.tsx +0 -11
- package/src/Components/Loading/Loading.stories.tsx +0 -25
- package/src/Components/Loading/Loading.tsx +0 -38
- package/src/Components/Loading/LoadingProps.tsx +0 -1
- package/src/Components/Modal/Modal.stories.tsx +0 -106
- package/src/Components/Modal/Modal.tsx +0 -45
- package/src/Components/Modal/ModalProps.tsx +0 -12
- package/src/Components/NavigationBar/NavBar.stories.tsx +0 -26
- package/src/Components/NavigationBar/NavigationBar.tsx +0 -56
- package/src/Components/NavigationBar/NavigationBarProps.tsx +0 -13
- package/src/Components/NumberInput/NumberInput.stories.tsx +0 -31
- package/src/Components/NumberInput/NumberInput.tsx +0 -56
- package/src/Components/NumberInput/NumberInputProps.tsx +0 -28
- package/src/Components/PinInput/PinInput.stories.tsx +0 -40
- package/src/Components/PinInput/PinInput.tsx +0 -49
- package/src/Components/PinInput/PinInputProps.tsx +0 -33
- package/src/Components/ProfileCard/ProfileCard.stories.tsx +0 -30
- package/src/Components/ProfileCard/ProfileCard.tsx +0 -59
- package/src/Components/ProfileCard/ProfileCardProps.tsx +0 -41
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.tsx +0 -25
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.tsx +0 -69
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.tsx +0 -14
- package/src/Components/ProgressBar/ProgressBar.stories.tsx +0 -46
- package/src/Components/ProgressBar/ProgressBar.tsx +0 -33
- package/src/Components/ProgressBar/ProgressBarProps.tsx +0 -7
- package/src/Components/RadioButton/RadioButton.stories.tsx +0 -46
- package/src/Components/RadioButton/RadioButton.tsx +0 -63
- package/src/Components/RadioButton/RadioButtonProps.tsx +0 -10
- package/src/Components/Select/Select.stories.tsx +0 -57
- package/src/Components/Select/Select.tsx +0 -46
- package/src/Components/Select/SelectProps.tsx +0 -15
- package/src/Components/SideBar/SideBar.tsx +0 -143
- package/src/Components/SideBar/SideBarProps.tsx +0 -18
- package/src/Components/SideBar/Sidebar.stories.tsx +0 -80
- package/src/Components/Skeletons/Skeleton.stories.tsx +0 -63
- package/src/Components/Skeletons/SkeletonProps.tsx +0 -23
- package/src/Components/Skeletons/Skeletons.tsx +0 -52
- package/src/Components/Table/Table.stories.tsx +0 -47
- package/src/Components/Table/Table.tsx +0 -517
- package/src/Components/Table/TableProps.tsx +0 -36
- package/src/Components/Toaster/Toaster.stories.tsx +0 -58
- package/src/Components/Toaster/Toaster.tsx +0 -34
- package/src/Components/Toaster/ToasterProps.tsx +0 -15
- package/src/Components/ToolTip/ToolTip.stories.tsx +0 -39
- package/src/Components/ToolTip/ToolTip.tsx +0 -62
- package/src/Components/ToolTip/ToolTipProps.tsx +0 -45
- package/src/Layout.tsx +0 -499
- package/src/Theme/Dark/theme.ts +0 -278
- package/src/Theme/Default/theme.ts +0 -301
- package/src/Theme/index.ts +0 -4
- package/src/bootstrap.tsx +0 -13
- package/src/index.ts +0 -29
- package/src/index.tsx +0 -22
- package/src/types/pixelize-design-library.d.ts +0 -4
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react/*";
|
|
3
|
-
import { InputTextAreaProps } from "./InputTextAreaProps";
|
|
4
|
-
import InputTextArea from "./InputTextArea";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof InputTextArea> = {
|
|
8
|
-
title: "Components/InputTextArea/InputTextArea",
|
|
9
|
-
component: InputTextArea,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
},
|
|
13
|
-
tags: ["autodocs"],
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
const TextAreaTemplate = (args: InputTextAreaProps) => {
|
|
20
|
-
const [value, setValue] = useState("");
|
|
21
|
-
const handleOnChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
22
|
-
setValue(e.target.value);
|
|
23
|
-
}
|
|
24
|
-
return <InputTextArea {...args} onChange={handleOnChange} value={value} />
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Primary: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
label: "hello",
|
|
30
|
-
helperText: 'Hello',
|
|
31
|
-
errorMessage: 'Required',
|
|
32
|
-
error: true,
|
|
33
|
-
rows: 5,
|
|
34
|
-
onChange: () => { },
|
|
35
|
-
value: "",
|
|
36
|
-
placeholder: "Placeholder",
|
|
37
|
-
width: "100%",
|
|
38
|
-
isDisabled: false,
|
|
39
|
-
isReadOnly: false,
|
|
40
|
-
isRequired: false,
|
|
41
|
-
resize: "vertical",
|
|
42
|
-
size: "md",
|
|
43
|
-
variant: "outline",
|
|
44
|
-
focusBorderColor: "blue.500",
|
|
45
|
-
errorBorderColor: "red.500",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, render: (args) => TextAreaTemplate(args)
|
|
49
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Center, ChakraProvider, Spinner, Text } from "@chakra-ui/react";
|
|
3
|
-
import { LoadingProps } from "./LoadingProps";
|
|
4
|
-
|
|
5
|
-
export default function Loading({ text, isLoading }: LoadingProps) {
|
|
6
|
-
if (!isLoading) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
return (
|
|
10
|
-
<ChakraProvider>
|
|
11
|
-
<Box
|
|
12
|
-
position="fixed"
|
|
13
|
-
top="0"
|
|
14
|
-
right="0"
|
|
15
|
-
bottom="0"
|
|
16
|
-
left="0"
|
|
17
|
-
backgroundColor="rgba(0, 0, 0, 0.4)"
|
|
18
|
-
backdropFilter="blur(4px)"
|
|
19
|
-
display="flex"
|
|
20
|
-
alignItems="center"
|
|
21
|
-
justifyContent="center"
|
|
22
|
-
flexDirection="column"
|
|
23
|
-
zIndex="9999"
|
|
24
|
-
>
|
|
25
|
-
<Center height="100vh">
|
|
26
|
-
<Spinner
|
|
27
|
-
thickness="4px"
|
|
28
|
-
speed="0.65s"
|
|
29
|
-
emptyColor="gray.200"
|
|
30
|
-
color="blue.500"
|
|
31
|
-
size="xl"
|
|
32
|
-
/>
|
|
33
|
-
<Text mt="2" ml={"5"}>{text}</Text>
|
|
34
|
-
</Center>
|
|
35
|
-
</Box>
|
|
36
|
-
</ChakraProvider>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type LoadingProps = { text?: string, isLoading: boolean }
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
-
import Modal from './Modal';
|
|
4
|
-
import { ChakraProvider, Button } from '@chakra-ui/react';
|
|
5
|
-
import { ChakraModelProps } from './ModalProps';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Components/Modal/Modal',
|
|
9
|
-
component: Modal,
|
|
10
|
-
argTypes: {
|
|
11
|
-
size: {
|
|
12
|
-
control: 'select',
|
|
13
|
-
options: ['xs', 'sm', 'md', 'lg', 'xl', 'full'],
|
|
14
|
-
defaultValue: 'md',
|
|
15
|
-
},
|
|
16
|
-
isOpen: {
|
|
17
|
-
control: 'boolean',
|
|
18
|
-
defaultValue: false,
|
|
19
|
-
},
|
|
20
|
-
title: {
|
|
21
|
-
control: 'text',
|
|
22
|
-
defaultValue: 'Modal Title',
|
|
23
|
-
},
|
|
24
|
-
overlaybg: {
|
|
25
|
-
control: 'text',
|
|
26
|
-
defaultValue: 'blackAlpha.300',
|
|
27
|
-
},
|
|
28
|
-
overlaybackdropFilter: {
|
|
29
|
-
control: 'text',
|
|
30
|
-
defaultValue: 'blur(10px) hue-rotate(90deg)',
|
|
31
|
-
},
|
|
32
|
-
overlaybackdropInvert: {
|
|
33
|
-
control: 'text',
|
|
34
|
-
defaultValue: '0%',
|
|
35
|
-
},
|
|
36
|
-
overlaybackdropBlur: {
|
|
37
|
-
control: 'text',
|
|
38
|
-
defaultValue: '0px',
|
|
39
|
-
},
|
|
40
|
-
isCentered: {
|
|
41
|
-
control: 'boolean',
|
|
42
|
-
defaultValue: true,
|
|
43
|
-
},
|
|
44
|
-
blockScrollOnMount: {
|
|
45
|
-
control: 'boolean',
|
|
46
|
-
defaultValue: true,
|
|
47
|
-
},
|
|
48
|
-
closeOnOverlayClick: {
|
|
49
|
-
control: 'boolean',
|
|
50
|
-
defaultValue: true,
|
|
51
|
-
},
|
|
52
|
-
motionPreset: {
|
|
53
|
-
control: 'text',
|
|
54
|
-
defaultValue: 'scale',
|
|
55
|
-
},
|
|
56
|
-
scrollBehavior: {
|
|
57
|
-
control: 'text',
|
|
58
|
-
defaultValue: 'inside',
|
|
59
|
-
},
|
|
60
|
-
footer: {
|
|
61
|
-
control: 'text',
|
|
62
|
-
defaultValue: 'Footer Content',
|
|
63
|
-
},
|
|
64
|
-
children: {
|
|
65
|
-
control: 'text',
|
|
66
|
-
defaultValue: 'This is the body of the modal',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
} as Meta;
|
|
70
|
-
|
|
71
|
-
interface StoryProps extends ChakraModelProps {
|
|
72
|
-
footer: React.ReactNode;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const Template: StoryFn<StoryProps> = (args) => {
|
|
76
|
-
const [isOpen, setIsOpen] = useState(args.isOpen);
|
|
77
|
-
|
|
78
|
-
const handleClose = () => setIsOpen(false);
|
|
79
|
-
const handleOpen = () => setIsOpen(true);
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<ChakraProvider>
|
|
83
|
-
<Button onClick={handleOpen}>Open Modal</Button>
|
|
84
|
-
<Modal {...args} isOpen={isOpen} onClose={handleClose} footer={<Button onClick={handleClose}>Footer Button</Button>}>
|
|
85
|
-
{args.children}
|
|
86
|
-
</Modal>
|
|
87
|
-
</ChakraProvider>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const Default = Template.bind({});
|
|
92
|
-
Default.args = {
|
|
93
|
-
size: 'md',
|
|
94
|
-
title: 'Modal Title',
|
|
95
|
-
overlaybg: 'blackAlpha.300',
|
|
96
|
-
overlaybackdropFilter: 'blur(10px) hue-rotate(90deg)',
|
|
97
|
-
overlaybackdropInvert: '0%',
|
|
98
|
-
overlaybackdropBlur: '0px',
|
|
99
|
-
isCentered: true,
|
|
100
|
-
blockScrollOnMount: true,
|
|
101
|
-
closeOnOverlayClick: true,
|
|
102
|
-
motionPreset: 'scale',
|
|
103
|
-
scrollBehavior: 'inside',
|
|
104
|
-
footer: <Button onClick={() => alert('Footer button clicked')}>Footer Button</Button>,
|
|
105
|
-
children: 'This is the body of the modal',
|
|
106
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChakraProvider, Modal as ChakraModal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter } from "@chakra-ui/react";
|
|
3
|
-
import { ChakraModelProps } from "./ModalProps";
|
|
4
|
-
|
|
5
|
-
export default function Modal({
|
|
6
|
-
size,
|
|
7
|
-
isOpen = false,
|
|
8
|
-
onClose,
|
|
9
|
-
title,
|
|
10
|
-
footer,
|
|
11
|
-
overlaybg = "blackAlpha.300",
|
|
12
|
-
overlaybackdropFilter = "blur(10px) hue-rotate(90deg)",
|
|
13
|
-
overlaybackdropInvert,
|
|
14
|
-
overlaybackdropBlur,
|
|
15
|
-
isCentered,
|
|
16
|
-
finalFocusRef,
|
|
17
|
-
blockScrollOnMount,
|
|
18
|
-
initialFocusRef,
|
|
19
|
-
closeOnOverlayClick,
|
|
20
|
-
motionPreset,
|
|
21
|
-
scrollBehavior,
|
|
22
|
-
children,
|
|
23
|
-
}: ChakraModelProps) {
|
|
24
|
-
if (!isOpen) return <></>;
|
|
25
|
-
return (
|
|
26
|
-
<ChakraProvider>
|
|
27
|
-
<ChakraModal isOpen={true} onClose={onClose} size={size} isCentered={isCentered} finalFocusRef={finalFocusRef} blockScrollOnMount={blockScrollOnMount} initialFocusRef={initialFocusRef} closeOnOverlayClick={closeOnOverlayClick} motionPreset={motionPreset} scrollBehavior={scrollBehavior}>
|
|
28
|
-
<ModalOverlay bg={overlaybg}
|
|
29
|
-
backdropFilter={overlaybackdropFilter}
|
|
30
|
-
backdropInvert={overlaybackdropInvert}
|
|
31
|
-
backdropBlur={overlaybackdropBlur} />
|
|
32
|
-
<ModalContent>
|
|
33
|
-
<ModalHeader>{title}</ModalHeader>
|
|
34
|
-
<ModalCloseButton />
|
|
35
|
-
<ModalBody>
|
|
36
|
-
{children}
|
|
37
|
-
</ModalBody>
|
|
38
|
-
<ModalFooter>
|
|
39
|
-
{footer}
|
|
40
|
-
</ModalFooter>
|
|
41
|
-
</ModalContent>
|
|
42
|
-
</ChakraModal>
|
|
43
|
-
</ChakraProvider>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ModalProps } from "@chakra-ui/react";
|
|
2
|
-
|
|
3
|
-
export type ChakraModelProps = Pick<ModalProps, "isOpen" | "onClose" | "finalFocusRef" | "blockScrollOnMount" | "initialFocusRef" | "closeOnOverlayClick" | "isCentered" | "motionPreset" | "scrollBehavior"> & {
|
|
4
|
-
title?: string,
|
|
5
|
-
footer?: any,
|
|
6
|
-
overlaybg?: string,
|
|
7
|
-
overlaybackdropFilter?: string,
|
|
8
|
-
overlaybackdropInvert?: string,
|
|
9
|
-
overlaybackdropBlur?: string,
|
|
10
|
-
size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full',
|
|
11
|
-
children?: any
|
|
12
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// NavBar.stories.tsx
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { StoryFn, Meta } from '@storybook/react/types-6-0';
|
|
5
|
-
import NavBar from './NavigationBar';
|
|
6
|
-
import { NavbarProps } from './NavigationBarProps';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Components/NavBar/NavBar',
|
|
10
|
-
component: NavBar,
|
|
11
|
-
} as Meta;
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<NavbarProps> = (args) => <NavBar {...args} />;
|
|
14
|
-
|
|
15
|
-
export const Default = Template.bind({});
|
|
16
|
-
Default.args = {
|
|
17
|
-
userAvathar: 'https://example.com/avatar.jpg',
|
|
18
|
-
userName: 'John Doe',
|
|
19
|
-
navMenu: [
|
|
20
|
-
{ title: 'Menu 1', url: '/menu1' },
|
|
21
|
-
{ title: 'Menu 2', url: '/menu2' },
|
|
22
|
-
],
|
|
23
|
-
handleNavOnClick: (url: string) => console.log(`Navigate to ${url}`),
|
|
24
|
-
handleLogout: () => console.log('Logout'),
|
|
25
|
-
logoutText: 'Logout',
|
|
26
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Avatar, Box, Button, Center, ChakraProvider, Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Stack } from "@chakra-ui/react";
|
|
3
|
-
import { MenuProps, NavbarProps } from "./NavigationBarProps";
|
|
4
|
-
|
|
5
|
-
export default function NavBar({ userAvathar, userName, navMenu, handleNavOnClick, handleLogout, logoutText }: NavbarProps) {
|
|
6
|
-
return (
|
|
7
|
-
<ChakraProvider>
|
|
8
|
-
<Box bg={"#ffffff"} px={4} boxShadow="0 4px 12px 0 rgba(0, 0, 0, 0.05)">
|
|
9
|
-
<Flex h={16} alignItems={'center'} justifyContent={'space-between'}>
|
|
10
|
-
<Box></Box>
|
|
11
|
-
<Flex alignItems={'center'}>
|
|
12
|
-
<Stack direction={'row'} spacing={7}>
|
|
13
|
-
<Menu>
|
|
14
|
-
<MenuButton
|
|
15
|
-
as={Button}
|
|
16
|
-
rounded={'full'}
|
|
17
|
-
variant={'link'}
|
|
18
|
-
cursor={'pointer'}
|
|
19
|
-
minW={0}>
|
|
20
|
-
<Avatar
|
|
21
|
-
size={'sm'}
|
|
22
|
-
src={userAvathar}
|
|
23
|
-
/>
|
|
24
|
-
</MenuButton>
|
|
25
|
-
<MenuList alignItems={'center'}>
|
|
26
|
-
<br />
|
|
27
|
-
<Center>
|
|
28
|
-
<Avatar
|
|
29
|
-
size={'2xl'}
|
|
30
|
-
src={userAvathar}
|
|
31
|
-
/>
|
|
32
|
-
</Center>
|
|
33
|
-
<br />
|
|
34
|
-
<Center>
|
|
35
|
-
<p>{userName}</p>
|
|
36
|
-
</Center>
|
|
37
|
-
<br />
|
|
38
|
-
<MenuDivider />
|
|
39
|
-
{navMenu?.map((menu: MenuProps) => (
|
|
40
|
-
<div onClick={() => handleNavOnClick(menu.url)} key={menu.title}>
|
|
41
|
-
<MenuItem>{menu.title}</MenuItem>
|
|
42
|
-
</div>
|
|
43
|
-
))}
|
|
44
|
-
<MenuDivider />
|
|
45
|
-
<div onClick={handleLogout} key={"logout"}>
|
|
46
|
-
<MenuItem >{logoutText}</MenuItem>
|
|
47
|
-
</div>
|
|
48
|
-
</MenuList>
|
|
49
|
-
</Menu>
|
|
50
|
-
</Stack>
|
|
51
|
-
</Flex>
|
|
52
|
-
</Flex>
|
|
53
|
-
</Box>
|
|
54
|
-
</ChakraProvider>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type NavbarProps = {
|
|
2
|
-
userAvathar: string;
|
|
3
|
-
userName: string;
|
|
4
|
-
navMenu: MenuProps[];
|
|
5
|
-
handleNavOnClick: (url: string) => void;
|
|
6
|
-
handleLogout: () => void;
|
|
7
|
-
logoutText: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type MenuProps = {
|
|
11
|
-
title: string;
|
|
12
|
-
url: string;
|
|
13
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StoryFn, Meta } from '@storybook/react';
|
|
3
|
-
import NumberInputs from './NumberInput';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Components/NumberInputs/NumberInputs',
|
|
7
|
-
component: NumberInputs,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: StoryFn = (args) => <NumberInputs {...args} />;
|
|
11
|
-
|
|
12
|
-
export const Default = Template.bind({});
|
|
13
|
-
Default.args = {
|
|
14
|
-
defaultValue: 0,
|
|
15
|
-
min: 0,
|
|
16
|
-
max: 100,
|
|
17
|
-
step: 1,
|
|
18
|
-
precision: 0,
|
|
19
|
-
clampValueOnBlur: true,
|
|
20
|
-
keepWithinRange: true,
|
|
21
|
-
size: 'md',
|
|
22
|
-
maxW: 'full',
|
|
23
|
-
allowMouseWheel: true,
|
|
24
|
-
NumberIncrementStepperBg: 'blue.200',
|
|
25
|
-
NumberIncrementStepperActive: { bg: 'blue.400' },
|
|
26
|
-
NumberIncrementStepperChildren: '+',
|
|
27
|
-
NumberDecrementStepperBg: 'blue.200',
|
|
28
|
-
NumberDecrementStepperActive: { bg: 'blue.400' },
|
|
29
|
-
NumberDecrementStepperChildren: '-',
|
|
30
|
-
onChange: (value: number) => console.log(value),
|
|
31
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ChakraProvider,
|
|
4
|
-
NumberDecrementStepper,
|
|
5
|
-
NumberIncrementStepper,
|
|
6
|
-
NumberInput as ChakraNumberInput,
|
|
7
|
-
NumberInputField,
|
|
8
|
-
NumberInputStepper,
|
|
9
|
-
} from "@chakra-ui/react";
|
|
10
|
-
import { NumberInputProps } from "./NumberInputProps";
|
|
11
|
-
|
|
12
|
-
export default function NumberInput({
|
|
13
|
-
defaultValue,
|
|
14
|
-
min,
|
|
15
|
-
max,
|
|
16
|
-
precision,
|
|
17
|
-
step,
|
|
18
|
-
clampValueOnBlur,
|
|
19
|
-
keepWithinRange,
|
|
20
|
-
value,
|
|
21
|
-
onChange,
|
|
22
|
-
size,
|
|
23
|
-
maxW,
|
|
24
|
-
allowMouseWheel,
|
|
25
|
-
NumberIncrementStepperBg,
|
|
26
|
-
NumberIncrementStepperActive,
|
|
27
|
-
NumberIncrementStepperChildren,
|
|
28
|
-
NumberDecrementStepperBg,
|
|
29
|
-
NumberDecrementStepperChildren,
|
|
30
|
-
NumberDecrementStepperActive
|
|
31
|
-
}: NumberInputProps) {
|
|
32
|
-
return (
|
|
33
|
-
<ChakraProvider>
|
|
34
|
-
<ChakraNumberInput
|
|
35
|
-
defaultValue={defaultValue}
|
|
36
|
-
min={min}
|
|
37
|
-
max={max}
|
|
38
|
-
step={step}
|
|
39
|
-
precision={precision}
|
|
40
|
-
clampValueOnBlur={clampValueOnBlur}
|
|
41
|
-
keepWithinRange={keepWithinRange}
|
|
42
|
-
value={value}
|
|
43
|
-
onChange={onChange}
|
|
44
|
-
size={size}
|
|
45
|
-
maxW={maxW}
|
|
46
|
-
allowMouseWheel={allowMouseWheel}
|
|
47
|
-
>
|
|
48
|
-
<NumberInputField />
|
|
49
|
-
<NumberInputStepper>
|
|
50
|
-
<NumberIncrementStepper bg={NumberIncrementStepperBg} _active={NumberIncrementStepperActive} children={NumberIncrementStepperChildren} />
|
|
51
|
-
<NumberDecrementStepper bg={NumberDecrementStepperBg} _active={NumberDecrementStepperActive} children={NumberDecrementStepperChildren} />
|
|
52
|
-
</NumberInputStepper>
|
|
53
|
-
</ChakraNumberInput>
|
|
54
|
-
</ChakraProvider>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { NumberInputProps as chakraNumbetInpurProps } from "@chakra-ui/react";
|
|
2
|
-
|
|
3
|
-
export type NumberInputProps = Pick<
|
|
4
|
-
chakraNumbetInpurProps,
|
|
5
|
-
| "defaultValue"
|
|
6
|
-
| "min"
|
|
7
|
-
| "max"
|
|
8
|
-
| "precision"
|
|
9
|
-
| "step"
|
|
10
|
-
| "clampValueOnBlur"
|
|
11
|
-
| "keepWithinRange"
|
|
12
|
-
| "value"
|
|
13
|
-
| "onChange"
|
|
14
|
-
|"size"
|
|
15
|
-
|"maxW"
|
|
16
|
-
|"allowMouseWheel"
|
|
17
|
-
> & {
|
|
18
|
-
NumberIncrementStepperBg?:string,
|
|
19
|
-
NumberIncrementStepperActive?:ActiveStyle,
|
|
20
|
-
NumberIncrementStepperChildren?:string,
|
|
21
|
-
NumberDecrementStepperBg?:string,
|
|
22
|
-
NumberDecrementStepperChildren?:string,
|
|
23
|
-
NumberDecrementStepperActive?:ActiveStyle,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type ActiveStyle = {
|
|
27
|
-
bg: string;
|
|
28
|
-
};
|