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.
- package/. prettierrc +14 -0
- package/.eslintcache +1 -0
- package/.husky/pre-commit +4 -0
- package/.storybook/main.ts +19 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +48 -0
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/eslint.config.mjs +20 -0
- package/exposedComponents.json +26 -0
- package/package.json +105 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/rsbuild.config.ts +49 -0
- package/src/App.tsx +10 -0
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.tsx +39 -0
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.tsx +80 -0
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChartProps.tsx +20 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.tsx +33 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.tsx +42 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChartProps.tsx +17 -0
- package/src/Components/Breadcrumbs/Breadcrumbs.stories.tsx +26 -0
- package/src/Components/Breadcrumbs/Breadcrumbs.tsx +25 -0
- package/src/Components/Breadcrumbs/BreadcrumbsProps.tsx +12 -0
- package/src/Components/Button/Button.stories.tsx +32 -0
- package/src/Components/Button/Button.tsx +26 -0
- package/src/Components/Button/ButtonProps.tsx +10 -0
- package/src/Components/ButtonGroupIcon/ButtonGoupIconProps.tsx +14 -0
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.stories.tsx +37 -0
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.tsx +25 -0
- package/src/Components/Checkbox/Checkbox.stories.tsx +45 -0
- package/src/Components/Checkbox/Checkbox.tsx +29 -0
- package/src/Components/Checkbox/CheckboxProps.tsx +9 -0
- package/src/Components/Input/TextInput.stories.tsx +44 -0
- package/src/Components/Input/TextInput.tsx +70 -0
- package/src/Components/Input/TextInputProps.tsx +27 -0
- package/src/Components/InputTextArea/InputTextArea.stories.tsx +48 -0
- package/src/Components/InputTextArea/InputTextArea.tsx +36 -0
- package/src/Components/InputTextArea/InputTextAreaProps.tsx +11 -0
- package/src/Components/Loading/Loading.stories.tsx +25 -0
- package/src/Components/Loading/Loading.tsx +37 -0
- package/src/Components/Loading/LoadingProps.tsx +1 -0
- package/src/Components/Modal/Modal.stories.tsx +106 -0
- package/src/Components/Modal/Modal.tsx +44 -0
- package/src/Components/Modal/ModalProps.tsx +12 -0
- package/src/Components/NavigationBar/NavBar.stories.tsx +26 -0
- package/src/Components/NavigationBar/NavigationBar.tsx +55 -0
- package/src/Components/NavigationBar/NavigationBarProps.tsx +13 -0
- package/src/Components/NumberInput/NumberInput.stories.tsx +31 -0
- package/src/Components/NumberInput/NumberInput.tsx +55 -0
- package/src/Components/NumberInput/NumberInputProps.tsx +28 -0
- package/src/Components/PinInput/PinInput.stories.tsx +40 -0
- package/src/Components/PinInput/PinInput.tsx +48 -0
- package/src/Components/PinInput/PinInputProps.tsx +33 -0
- package/src/Components/ProfileCard/ProfileCard.stories.tsx +30 -0
- package/src/Components/ProfileCard/ProfileCard.tsx +58 -0
- package/src/Components/ProfileCard/ProfileCardProps.tsx +41 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.tsx +25 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.tsx +68 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.tsx +14 -0
- package/src/Components/ProgressBar/ProgressBar.stories.tsx +46 -0
- package/src/Components/ProgressBar/ProgressBar.tsx +32 -0
- package/src/Components/ProgressBar/ProgressBarProps.tsx +7 -0
- package/src/Components/RadioButton/RadioButton.stories.tsx +46 -0
- package/src/Components/RadioButton/RadioButton.tsx +63 -0
- package/src/Components/RadioButton/RadioButtonProps.tsx +10 -0
- package/src/Components/Select/Select.stories.tsx +56 -0
- package/src/Components/Select/Select.tsx +45 -0
- package/src/Components/Select/SelectProps.tsx +15 -0
- package/src/Components/SideBar/SideBar.tsx +143 -0
- package/src/Components/SideBar/SideBarProps.tsx +18 -0
- package/src/Components/SideBar/Sidebar.stories.tsx +80 -0
- package/src/Components/Skeletons/Skeleton.stories.tsx +63 -0
- package/src/Components/Skeletons/SkeletonProps.tsx +23 -0
- package/src/Components/Skeletons/Skeletons.tsx +51 -0
- package/src/Components/Table/Table.stories.tsx +47 -0
- package/src/Components/Table/Table.tsx +516 -0
- package/src/Components/Table/TableProps.tsx +36 -0
- package/src/Components/Toaster/Toaster.stories.tsx +58 -0
- package/src/Components/Toaster/Toaster.tsx +34 -0
- package/src/Components/Toaster/ToasterProps.tsx +15 -0
- package/src/Components/ToolTip/ToolTip.stories.tsx +39 -0
- package/src/Components/ToolTip/ToolTip.tsx +61 -0
- package/src/Components/ToolTip/ToolTipProps.tsx +45 -0
- package/src/Layout.tsx +499 -0
- package/src/Theme/Dark/theme.ts +278 -0
- package/src/Theme/Default/theme.ts +301 -0
- package/src/Theme/index.ts +4 -0
- package/src/bootstrap.tsx +13 -0
- package/src/index.tsx +22 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +5 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +15 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +3 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +12 -0
- package/src/stories/assets/youtube.svg +4 -0
- package/src/stories/header.css +32 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LoadingProps = { text?: string, isLoading: boolean }
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChakraProvider, Modal as ChakraModal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter } from "@chakra-ui/react";
|
|
2
|
+
import { ChakraModelProps } from "./ModalProps";
|
|
3
|
+
|
|
4
|
+
export default function Modal({
|
|
5
|
+
size,
|
|
6
|
+
isOpen = false,
|
|
7
|
+
onClose,
|
|
8
|
+
title,
|
|
9
|
+
footer,
|
|
10
|
+
overlaybg = "blackAlpha.300",
|
|
11
|
+
overlaybackdropFilter = "blur(10px) hue-rotate(90deg)",
|
|
12
|
+
overlaybackdropInvert,
|
|
13
|
+
overlaybackdropBlur,
|
|
14
|
+
isCentered,
|
|
15
|
+
finalFocusRef,
|
|
16
|
+
blockScrollOnMount,
|
|
17
|
+
initialFocusRef,
|
|
18
|
+
closeOnOverlayClick,
|
|
19
|
+
motionPreset,
|
|
20
|
+
scrollBehavior,
|
|
21
|
+
children,
|
|
22
|
+
}: ChakraModelProps) {
|
|
23
|
+
if (!isOpen) return <></>;
|
|
24
|
+
return (
|
|
25
|
+
<ChakraProvider>
|
|
26
|
+
<ChakraModal isOpen={true} onClose={onClose} size={size} isCentered={isCentered} finalFocusRef={finalFocusRef} blockScrollOnMount={blockScrollOnMount} initialFocusRef={initialFocusRef} closeOnOverlayClick={closeOnOverlayClick} motionPreset={motionPreset} scrollBehavior={scrollBehavior}>
|
|
27
|
+
<ModalOverlay bg={overlaybg}
|
|
28
|
+
backdropFilter={overlaybackdropFilter}
|
|
29
|
+
backdropInvert={overlaybackdropInvert}
|
|
30
|
+
backdropBlur={overlaybackdropBlur} />
|
|
31
|
+
<ModalContent>
|
|
32
|
+
<ModalHeader>{title}</ModalHeader>
|
|
33
|
+
<ModalCloseButton />
|
|
34
|
+
<ModalBody>
|
|
35
|
+
{children}
|
|
36
|
+
</ModalBody>
|
|
37
|
+
<ModalFooter>
|
|
38
|
+
{footer}
|
|
39
|
+
</ModalFooter>
|
|
40
|
+
</ModalContent>
|
|
41
|
+
</ChakraModal>
|
|
42
|
+
</ChakraProvider>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Avatar, Box, Button, Center, ChakraProvider, Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Stack } from "@chakra-ui/react";
|
|
2
|
+
import { MenuProps, NavbarProps } from "./NavigationBarProps";
|
|
3
|
+
|
|
4
|
+
export default function NavBar({ userAvathar, userName, navMenu, handleNavOnClick, handleLogout, logoutText }: NavbarProps) {
|
|
5
|
+
return (
|
|
6
|
+
<ChakraProvider>
|
|
7
|
+
<Box bg={"#ffffff"} px={4} boxShadow="0 4px 12px 0 rgba(0, 0, 0, 0.05)">
|
|
8
|
+
<Flex h={16} alignItems={'center'} justifyContent={'space-between'}>
|
|
9
|
+
<Box></Box>
|
|
10
|
+
<Flex alignItems={'center'}>
|
|
11
|
+
<Stack direction={'row'} spacing={7}>
|
|
12
|
+
<Menu>
|
|
13
|
+
<MenuButton
|
|
14
|
+
as={Button}
|
|
15
|
+
rounded={'full'}
|
|
16
|
+
variant={'link'}
|
|
17
|
+
cursor={'pointer'}
|
|
18
|
+
minW={0}>
|
|
19
|
+
<Avatar
|
|
20
|
+
size={'sm'}
|
|
21
|
+
src={userAvathar}
|
|
22
|
+
/>
|
|
23
|
+
</MenuButton>
|
|
24
|
+
<MenuList alignItems={'center'}>
|
|
25
|
+
<br />
|
|
26
|
+
<Center>
|
|
27
|
+
<Avatar
|
|
28
|
+
size={'2xl'}
|
|
29
|
+
src={userAvathar}
|
|
30
|
+
/>
|
|
31
|
+
</Center>
|
|
32
|
+
<br />
|
|
33
|
+
<Center>
|
|
34
|
+
<p>{userName}</p>
|
|
35
|
+
</Center>
|
|
36
|
+
<br />
|
|
37
|
+
<MenuDivider />
|
|
38
|
+
{navMenu?.map((menu: MenuProps) => (
|
|
39
|
+
<div onClick={() => handleNavOnClick(menu.url)} key={menu.title}>
|
|
40
|
+
<MenuItem>{menu.title}</MenuItem>
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
<MenuDivider />
|
|
44
|
+
<div onClick={handleLogout} key={"logout"}>
|
|
45
|
+
<MenuItem >{logoutText}</MenuItem>
|
|
46
|
+
</div>
|
|
47
|
+
</MenuList>
|
|
48
|
+
</Menu>
|
|
49
|
+
</Stack>
|
|
50
|
+
</Flex>
|
|
51
|
+
</Flex>
|
|
52
|
+
</Box>
|
|
53
|
+
</ChakraProvider>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChakraProvider,
|
|
3
|
+
NumberDecrementStepper,
|
|
4
|
+
NumberIncrementStepper,
|
|
5
|
+
NumberInput as ChakraNumberInput,
|
|
6
|
+
NumberInputField,
|
|
7
|
+
NumberInputStepper,
|
|
8
|
+
} from "@chakra-ui/react";
|
|
9
|
+
import { NumberInputProps } from "./NumberInputProps";
|
|
10
|
+
|
|
11
|
+
export default function NumberInput({
|
|
12
|
+
defaultValue,
|
|
13
|
+
min,
|
|
14
|
+
max,
|
|
15
|
+
precision,
|
|
16
|
+
step,
|
|
17
|
+
clampValueOnBlur,
|
|
18
|
+
keepWithinRange,
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
size,
|
|
22
|
+
maxW,
|
|
23
|
+
allowMouseWheel,
|
|
24
|
+
NumberIncrementStepperBg,
|
|
25
|
+
NumberIncrementStepperActive,
|
|
26
|
+
NumberIncrementStepperChildren,
|
|
27
|
+
NumberDecrementStepperBg,
|
|
28
|
+
NumberDecrementStepperChildren,
|
|
29
|
+
NumberDecrementStepperActive
|
|
30
|
+
}: NumberInputProps) {
|
|
31
|
+
return (
|
|
32
|
+
<ChakraProvider>
|
|
33
|
+
<ChakraNumberInput
|
|
34
|
+
defaultValue={defaultValue}
|
|
35
|
+
min={min}
|
|
36
|
+
max={max}
|
|
37
|
+
step={step}
|
|
38
|
+
precision={precision}
|
|
39
|
+
clampValueOnBlur={clampValueOnBlur}
|
|
40
|
+
keepWithinRange={keepWithinRange}
|
|
41
|
+
value={value}
|
|
42
|
+
onChange={onChange}
|
|
43
|
+
size={size}
|
|
44
|
+
maxW={maxW}
|
|
45
|
+
allowMouseWheel={allowMouseWheel}
|
|
46
|
+
>
|
|
47
|
+
<NumberInputField/>
|
|
48
|
+
<NumberInputStepper>
|
|
49
|
+
<NumberIncrementStepper bg={NumberIncrementStepperBg} _active={NumberIncrementStepperActive} children={NumberIncrementStepperChildren}/>
|
|
50
|
+
<NumberDecrementStepper bg={NumberDecrementStepperBg} _active={NumberDecrementStepperActive} children={NumberDecrementStepperChildren}/>
|
|
51
|
+
</NumberInputStepper>
|
|
52
|
+
</ChakraNumberInput>
|
|
53
|
+
</ChakraProvider>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
3
|
+
import PinInput from './PinInput';
|
|
4
|
+
import { ChakraPinInputProps } from './PinInputProps';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/PinInput/PinInput',
|
|
8
|
+
component: PinInput,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: StoryFn<ChakraPinInputProps> = (args) => <PinInput {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Default = Template.bind({});
|
|
14
|
+
Default.args = {
|
|
15
|
+
otp: false,
|
|
16
|
+
mask: false,
|
|
17
|
+
defaultValue: '',
|
|
18
|
+
placeholder: '•',
|
|
19
|
+
manageFocus: true,
|
|
20
|
+
errorBorderColor: 'red.500',
|
|
21
|
+
focusBorderColor: 'blue.500',
|
|
22
|
+
onChange: (value: string) => console.log(value),
|
|
23
|
+
onComplete: (value: string) => console.log(`Completed: ${value}`),
|
|
24
|
+
type: 'alphanumeric',
|
|
25
|
+
color: 'blue',
|
|
26
|
+
variant: 'outline',
|
|
27
|
+
pins: 3,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Masked = Template.bind({});
|
|
31
|
+
Masked.args = {
|
|
32
|
+
...Default.args,
|
|
33
|
+
mask: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const SixPins = Template.bind({});
|
|
37
|
+
SixPins.args = {
|
|
38
|
+
...Default.args,
|
|
39
|
+
pins: 6,
|
|
40
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChakraProvider,
|
|
3
|
+
HStack,
|
|
4
|
+
PinInput,
|
|
5
|
+
PinInputField,
|
|
6
|
+
Text,
|
|
7
|
+
} from "@chakra-ui/react";
|
|
8
|
+
import { ChakraPinInputProps } from "./PinInputProps";
|
|
9
|
+
export default function PinInputs({
|
|
10
|
+
otp,
|
|
11
|
+
mask,
|
|
12
|
+
defaultValue,
|
|
13
|
+
placeholder,
|
|
14
|
+
manageFocus,
|
|
15
|
+
errorBorderColor,
|
|
16
|
+
focusBorderColor,
|
|
17
|
+
onChange,
|
|
18
|
+
onComplete,
|
|
19
|
+
type,
|
|
20
|
+
color,
|
|
21
|
+
variant,
|
|
22
|
+
pins = 3,
|
|
23
|
+
label
|
|
24
|
+
}: ChakraPinInputProps) {
|
|
25
|
+
return (
|
|
26
|
+
<ChakraProvider>
|
|
27
|
+
{label && <Text fontWeight="bold" marginBottom={"8px"}>{label}</Text>}
|
|
28
|
+
<HStack>
|
|
29
|
+
<PinInput otp={otp}
|
|
30
|
+
mask={mask}
|
|
31
|
+
defaultValue={defaultValue}
|
|
32
|
+
placeholder={placeholder}
|
|
33
|
+
manageFocus={manageFocus}
|
|
34
|
+
errorBorderColor={errorBorderColor}
|
|
35
|
+
focusBorderColor={focusBorderColor}
|
|
36
|
+
onChange={onChange}
|
|
37
|
+
onComplete={onComplete}
|
|
38
|
+
type={type}
|
|
39
|
+
colorScheme={color}
|
|
40
|
+
variant={variant}>
|
|
41
|
+
{Array.from({ length: pins }).map((_, index) => (
|
|
42
|
+
<PinInputField key={index} />
|
|
43
|
+
))}
|
|
44
|
+
</PinInput>
|
|
45
|
+
</HStack>
|
|
46
|
+
</ChakraProvider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PinInputProps } from "@chakra-ui/react";
|
|
2
|
+
|
|
3
|
+
export type ChakraPinInputProps = Pick<
|
|
4
|
+
PinInputProps,
|
|
5
|
+
| "otp"
|
|
6
|
+
| "mask"
|
|
7
|
+
| "defaultValue"
|
|
8
|
+
| "placeholder"
|
|
9
|
+
| "manageFocus"
|
|
10
|
+
| "errorBorderColor"
|
|
11
|
+
| "focusBorderColor"
|
|
12
|
+
| "onChange"
|
|
13
|
+
| "onComplete"
|
|
14
|
+
> & {
|
|
15
|
+
type?: "alphanumeric" | "number";
|
|
16
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
17
|
+
variant?: "flushed" | "outline" | "filled" | "unstyled";
|
|
18
|
+
color?:
|
|
19
|
+
| "gray"
|
|
20
|
+
| "red"
|
|
21
|
+
| "orange"
|
|
22
|
+
| "yellow"
|
|
23
|
+
| "green"
|
|
24
|
+
| "teal"
|
|
25
|
+
| "blue"
|
|
26
|
+
| "cyan"
|
|
27
|
+
| "purple"
|
|
28
|
+
| "pink"
|
|
29
|
+
| "whiteAlpha"
|
|
30
|
+
| "blackAlpha";
|
|
31
|
+
pins: number;
|
|
32
|
+
label?: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react/types-6-0';
|
|
3
|
+
import ProfileCard from './ProfileCard';
|
|
4
|
+
import { ProfileCardProps } from './ProfileCardProps';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/ProfileCard/ProfileCard',
|
|
8
|
+
component: ProfileCard,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: StoryFn<ProfileCardProps> = (args) => <ProfileCard {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Default = Template.bind({});
|
|
14
|
+
Default.args = {
|
|
15
|
+
key: '1',
|
|
16
|
+
maxW: 'sm',
|
|
17
|
+
align: 'center',
|
|
18
|
+
variant: 'filled',
|
|
19
|
+
direction: 'column',
|
|
20
|
+
justify: 'center',
|
|
21
|
+
header: 'Header',
|
|
22
|
+
footer: 'Footer',
|
|
23
|
+
children: 'Content',
|
|
24
|
+
size: 'md',
|
|
25
|
+
color: 'teal',
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
dividercolor: 'gray',
|
|
28
|
+
dividersize: 'md',
|
|
29
|
+
dividervariant: 'solid',
|
|
30
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card as ChakraCard,
|
|
3
|
+
CardBody,
|
|
4
|
+
CardFooter,
|
|
5
|
+
CardHeader,
|
|
6
|
+
ChakraProvider,
|
|
7
|
+
Divider,
|
|
8
|
+
Box,
|
|
9
|
+
Text,
|
|
10
|
+
SimpleGrid,
|
|
11
|
+
} from "@chakra-ui/react";
|
|
12
|
+
import { ProfileCardProps } from "./ProfileCardProps";
|
|
13
|
+
|
|
14
|
+
export default function ProfileCard({
|
|
15
|
+
key,
|
|
16
|
+
maxW,
|
|
17
|
+
align,
|
|
18
|
+
variant,
|
|
19
|
+
direction,
|
|
20
|
+
justify,
|
|
21
|
+
header,
|
|
22
|
+
footer,
|
|
23
|
+
children,
|
|
24
|
+
size,
|
|
25
|
+
color,
|
|
26
|
+
overflow,
|
|
27
|
+
dividercolor,
|
|
28
|
+
dividersize,
|
|
29
|
+
dividervariant,
|
|
30
|
+
}: ProfileCardProps) {
|
|
31
|
+
return (
|
|
32
|
+
<ChakraProvider>
|
|
33
|
+
<ChakraCard
|
|
34
|
+
key={key}
|
|
35
|
+
maxW={maxW}
|
|
36
|
+
align={align}
|
|
37
|
+
variant={variant}
|
|
38
|
+
direction={direction}
|
|
39
|
+
justify={justify}
|
|
40
|
+
size={size}
|
|
41
|
+
overflow={overflow}
|
|
42
|
+
colorScheme={color}
|
|
43
|
+
mr={10}
|
|
44
|
+
>
|
|
45
|
+
<CardHeader >{header}</CardHeader>
|
|
46
|
+
<Divider
|
|
47
|
+
colorScheme={dividercolor}
|
|
48
|
+
size={dividersize}
|
|
49
|
+
variant={dividervariant}
|
|
50
|
+
/>
|
|
51
|
+
<CardBody>
|
|
52
|
+
{children}
|
|
53
|
+
</CardBody>
|
|
54
|
+
<CardFooter>{footer}</CardFooter>
|
|
55
|
+
</ChakraCard>
|
|
56
|
+
</ChakraProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CardProps } from "@chakra-ui/react";
|
|
2
|
+
|
|
3
|
+
export type ProfileCardProps = Pick<
|
|
4
|
+
CardProps,
|
|
5
|
+
"direction" | "maxW" | "align" | "justify" | "overflow"
|
|
6
|
+
> & {
|
|
7
|
+
header?: React.ReactNode;
|
|
8
|
+
footer?: React.ReactNode;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
variant?: "elevated" | "outlein" | "filled" | "unstyled";
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
color?:
|
|
13
|
+
| "whiteAlpha"
|
|
14
|
+
| "blackAlpha"
|
|
15
|
+
| "gray"
|
|
16
|
+
| "red"
|
|
17
|
+
| "orange"
|
|
18
|
+
| "yellow"
|
|
19
|
+
| "green"
|
|
20
|
+
| "teal"
|
|
21
|
+
| "blue"
|
|
22
|
+
| "cyan"
|
|
23
|
+
| "purple"
|
|
24
|
+
| "pink";
|
|
25
|
+
key?: string;
|
|
26
|
+
dividercolor?:
|
|
27
|
+
| "whiteAlpha"
|
|
28
|
+
| "blackAlpha"
|
|
29
|
+
| "gray"
|
|
30
|
+
| "red"
|
|
31
|
+
| "orange"
|
|
32
|
+
| "yellow"
|
|
33
|
+
| "green"
|
|
34
|
+
| "teal"
|
|
35
|
+
| "blue"
|
|
36
|
+
| "cyan"
|
|
37
|
+
| "purple"
|
|
38
|
+
| "pink";
|
|
39
|
+
dividersize?: string;
|
|
40
|
+
dividervariant?: "solid" | "dashed";
|
|
41
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
3
|
+
import ProfilePhotoViewer from './ProfilePhotoViewer';
|
|
4
|
+
import { ProfilePhotoViewerProps } from './ProfilePhotoViewerProps';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/ProfilePhotoViewer/ProfilePhotoViewer',
|
|
8
|
+
component: ProfilePhotoViewer,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: StoryFn<ProfilePhotoViewerProps> = (args) => <ProfilePhotoViewer {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Default = Template.bind({});
|
|
14
|
+
Default.args = {
|
|
15
|
+
photoUrl: 'https://via.placeholder.com/150',
|
|
16
|
+
onPhotoChange: (file: File) => console.log(file.name),
|
|
17
|
+
imageWidth: "100px",
|
|
18
|
+
imageAlt: "Profile Photo",
|
|
19
|
+
imageObjectFit: "cover",
|
|
20
|
+
imageBorderRadius: "full",
|
|
21
|
+
editIconSize: "sm",
|
|
22
|
+
editIconPositionRight: "5px",
|
|
23
|
+
editIconPositionBottom: "5px",
|
|
24
|
+
isRound: true,
|
|
25
|
+
};
|