pixelize-design-library 1.0.13 → 1.0.15

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 (88) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/index.js +4 -5
  3. package/package.json +1 -1
  4. package/tsconfig.json +0 -4
  5. package/public/favicon.ico +0 -0
  6. package/public/index.html +0 -43
  7. package/public/logo192.png +0 -0
  8. package/public/logo512.png +0 -0
  9. package/public/manifest.json +0 -25
  10. package/public/robots.txt +0 -3
  11. package/src/App.tsx +0 -10
  12. package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.tsx +0 -39
  13. package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.tsx +0 -80
  14. package/src/Components/Apexcharts/ApexBarChart/ApexBarChartProps.tsx +0 -20
  15. package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.tsx +0 -33
  16. package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.tsx +0 -43
  17. package/src/Components/Apexcharts/ApexPieChart/ApexPieChartProps.tsx +0 -17
  18. package/src/Components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -26
  19. package/src/Components/Breadcrumbs/Breadcrumbs.tsx +0 -26
  20. package/src/Components/Breadcrumbs/BreadcrumbsProps.tsx +0 -12
  21. package/src/Components/Button/Button.stories.tsx +0 -32
  22. package/src/Components/Button/Button.tsx +0 -26
  23. package/src/Components/Button/ButtonProps.tsx +0 -10
  24. package/src/Components/ButtonGroupIcon/ButtonGoupIconProps.tsx +0 -14
  25. package/src/Components/ButtonGroupIcon/ButtonGroupIcon.stories.tsx +0 -37
  26. package/src/Components/ButtonGroupIcon/ButtonGroupIcon.tsx +0 -26
  27. package/src/Components/Checkbox/Checkbox.stories.tsx +0 -45
  28. package/src/Components/Checkbox/Checkbox.tsx +0 -29
  29. package/src/Components/Checkbox/CheckboxProps.tsx +0 -9
  30. package/src/Components/Input/TextInput.stories.tsx +0 -45
  31. package/src/Components/Input/TextInput.tsx +0 -70
  32. package/src/Components/Input/TextInputProps.tsx +0 -27
  33. package/src/Components/InputTextArea/InputTextArea.stories.tsx +0 -49
  34. package/src/Components/InputTextArea/InputTextArea.tsx +0 -36
  35. package/src/Components/InputTextArea/InputTextAreaProps.tsx +0 -11
  36. package/src/Components/Loading/Loading.stories.tsx +0 -25
  37. package/src/Components/Loading/Loading.tsx +0 -38
  38. package/src/Components/Loading/LoadingProps.tsx +0 -1
  39. package/src/Components/Modal/Modal.stories.tsx +0 -106
  40. package/src/Components/Modal/Modal.tsx +0 -45
  41. package/src/Components/Modal/ModalProps.tsx +0 -12
  42. package/src/Components/NavigationBar/NavBar.stories.tsx +0 -26
  43. package/src/Components/NavigationBar/NavigationBar.tsx +0 -56
  44. package/src/Components/NavigationBar/NavigationBarProps.tsx +0 -13
  45. package/src/Components/NumberInput/NumberInput.stories.tsx +0 -31
  46. package/src/Components/NumberInput/NumberInput.tsx +0 -56
  47. package/src/Components/NumberInput/NumberInputProps.tsx +0 -28
  48. package/src/Components/PinInput/PinInput.stories.tsx +0 -40
  49. package/src/Components/PinInput/PinInput.tsx +0 -49
  50. package/src/Components/PinInput/PinInputProps.tsx +0 -33
  51. package/src/Components/ProfileCard/ProfileCard.stories.tsx +0 -30
  52. package/src/Components/ProfileCard/ProfileCard.tsx +0 -59
  53. package/src/Components/ProfileCard/ProfileCardProps.tsx +0 -41
  54. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.tsx +0 -25
  55. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.tsx +0 -69
  56. package/src/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.tsx +0 -14
  57. package/src/Components/ProgressBar/ProgressBar.stories.tsx +0 -46
  58. package/src/Components/ProgressBar/ProgressBar.tsx +0 -33
  59. package/src/Components/ProgressBar/ProgressBarProps.tsx +0 -7
  60. package/src/Components/RadioButton/RadioButton.stories.tsx +0 -46
  61. package/src/Components/RadioButton/RadioButton.tsx +0 -63
  62. package/src/Components/RadioButton/RadioButtonProps.tsx +0 -10
  63. package/src/Components/Select/Select.stories.tsx +0 -57
  64. package/src/Components/Select/Select.tsx +0 -46
  65. package/src/Components/Select/SelectProps.tsx +0 -15
  66. package/src/Components/SideBar/SideBar.tsx +0 -143
  67. package/src/Components/SideBar/SideBarProps.tsx +0 -18
  68. package/src/Components/SideBar/Sidebar.stories.tsx +0 -80
  69. package/src/Components/Skeletons/Skeleton.stories.tsx +0 -63
  70. package/src/Components/Skeletons/SkeletonProps.tsx +0 -23
  71. package/src/Components/Skeletons/Skeletons.tsx +0 -52
  72. package/src/Components/Table/Table.stories.tsx +0 -47
  73. package/src/Components/Table/Table.tsx +0 -517
  74. package/src/Components/Table/TableProps.tsx +0 -36
  75. package/src/Components/Toaster/Toaster.stories.tsx +0 -58
  76. package/src/Components/Toaster/Toaster.tsx +0 -34
  77. package/src/Components/Toaster/ToasterProps.tsx +0 -15
  78. package/src/Components/ToolTip/ToolTip.stories.tsx +0 -39
  79. package/src/Components/ToolTip/ToolTip.tsx +0 -62
  80. package/src/Components/ToolTip/ToolTipProps.tsx +0 -45
  81. package/src/Layout.tsx +0 -499
  82. package/src/Theme/Dark/theme.ts +0 -278
  83. package/src/Theme/Default/theme.ts +0 -301
  84. package/src/Theme/index.ts +0 -4
  85. package/src/bootstrap.tsx +0 -13
  86. package/src/index.ts +0 -29
  87. package/src/index.tsx +0 -22
  88. package/src/types/pixelize-design-library.d.ts +0 -7
@@ -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
- };
@@ -1,40 +0,0 @@
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
- };
@@ -1,49 +0,0 @@
1
- import React from 'react';
2
- import {
3
- ChakraProvider,
4
- HStack,
5
- PinInput,
6
- PinInputField,
7
- Text,
8
- } from "@chakra-ui/react";
9
- import { ChakraPinInputProps } from "./PinInputProps";
10
- export default function PinInputs({
11
- otp,
12
- mask,
13
- defaultValue,
14
- placeholder,
15
- manageFocus,
16
- errorBorderColor,
17
- focusBorderColor,
18
- onChange,
19
- onComplete,
20
- type,
21
- color,
22
- variant,
23
- pins = 3,
24
- label
25
- }: ChakraPinInputProps) {
26
- return (
27
- <ChakraProvider>
28
- {label && <Text fontWeight="bold" marginBottom={"8px"}>{label}</Text>}
29
- <HStack>
30
- <PinInput otp={otp}
31
- mask={mask}
32
- defaultValue={defaultValue}
33
- placeholder={placeholder}
34
- manageFocus={manageFocus}
35
- errorBorderColor={errorBorderColor}
36
- focusBorderColor={focusBorderColor}
37
- onChange={onChange}
38
- onComplete={onComplete}
39
- type={type}
40
- colorScheme={color}
41
- variant={variant}>
42
- {Array.from({ length: pins }).map((_, index) => (
43
- <PinInputField key={index} />
44
- ))}
45
- </PinInput>
46
- </HStack>
47
- </ChakraProvider>
48
- );
49
- }
@@ -1,33 +0,0 @@
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
- };
@@ -1,30 +0,0 @@
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
- };
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Card as ChakraCard,
4
- CardBody,
5
- CardFooter,
6
- CardHeader,
7
- ChakraProvider,
8
- Divider,
9
- Box,
10
- Text,
11
- SimpleGrid,
12
- } from "@chakra-ui/react";
13
- import { ProfileCardProps } from "./ProfileCardProps";
14
-
15
- export default function ProfileCard({
16
- key,
17
- maxW,
18
- align,
19
- variant,
20
- direction,
21
- justify,
22
- header,
23
- footer,
24
- children,
25
- size,
26
- color,
27
- overflow,
28
- dividercolor,
29
- dividersize,
30
- dividervariant,
31
- }: ProfileCardProps) {
32
- return (
33
- <ChakraProvider>
34
- <ChakraCard
35
- key={key}
36
- maxW={maxW}
37
- align={align}
38
- variant={variant}
39
- direction={direction}
40
- justify={justify}
41
- size={size}
42
- overflow={overflow}
43
- colorScheme={color}
44
- mr={10}
45
- >
46
- <CardHeader >{header}</CardHeader>
47
- <Divider
48
- colorScheme={dividercolor}
49
- size={dividersize}
50
- variant={dividervariant}
51
- />
52
- <CardBody>
53
- {children}
54
- </CardBody>
55
- <CardFooter>{footer}</CardFooter>
56
- </ChakraCard>
57
- </ChakraProvider>
58
- );
59
- }
@@ -1,41 +0,0 @@
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
- };
@@ -1,25 +0,0 @@
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
- };
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import { Box, Image, IconButton, Input, ChakraProvider } from "@chakra-ui/react";
3
- import { ChangeEvent, useRef, useState } from "react";
4
- import { EditIcon } from "@chakra-ui/icons"; // Ensure you have @chakra-ui/icons installed
5
- import { ProfilePhotoViewerProps } from "./ProfilePhotoViewerProps";
6
-
7
- export default function ProfilePhotoViewer({
8
- photoUrl,
9
- onPhotoChange,
10
- imageWidth = "100px",
11
- imageAlt = "Profile Photo",
12
- imageObjectFit = "cover",
13
- imageBorderRadius = "full",
14
- editIconSize = "sm",
15
- editIconPositionRight = "5px",
16
- editIconPositionBottom = "5px",
17
- isRound = true,
18
- boxStyle
19
- }: ProfilePhotoViewerProps) {
20
- const [photo, setPhoto] = useState<string>(photoUrl);
21
- const fileInputRef = useRef<HTMLInputElement>(null);
22
-
23
- const handlePhotoChange = (event: ChangeEvent<HTMLInputElement>) => {
24
- const file = event.target.files?.[0];
25
- if (file) {
26
- const reader = new FileReader();
27
- reader.onload = () => {
28
- const photoUrl = reader.result as string;
29
- setPhoto(photoUrl);
30
- onPhotoChange(file);
31
- };
32
- reader.readAsDataURL(file);
33
- }
34
- };
35
- const handleClick = () => {
36
- fileInputRef.current?.click();
37
- };
38
- return (
39
- <ChakraProvider>
40
- <Box position="relative" display="inline-block" style={boxStyle}>
41
- <Image
42
- src={photo}
43
- alt={imageAlt}
44
- boxSize={imageWidth}
45
- objectFit={imageObjectFit}
46
- borderRadius={imageBorderRadius}
47
-
48
- />
49
- <IconButton
50
- icon={<EditIcon />}
51
- isRound={isRound}
52
- size={editIconSize}
53
- position="absolute"
54
- right={editIconPositionRight}
55
- bottom={editIconPositionBottom}
56
- onClick={handleClick}
57
- aria-label="Edit photo"
58
- />
59
- <Input
60
- type="file"
61
- accept="image/*"
62
- onChange={handlePhotoChange}
63
- hidden
64
- ref={fileInputRef}
65
- />
66
- </Box>
67
- </ChakraProvider>
68
- );
69
- }
@@ -1,14 +0,0 @@
1
-
2
- export type ProfilePhotoViewerProps = {
3
- photoUrl: string,
4
- onPhotoChange: (photoUrl: File) => void,
5
- imageWidth?: string,
6
- imageAlt?: string,
7
- imageObjectFit?: "cover" | "contain" | "fill" | "none" | "scale-down",
8
- imageBorderRadius?: string,
9
- editIconSize?: string,
10
- editIconPositionRight?: string,
11
- editIconPositionBottom?: string,
12
- isRound?: boolean,
13
- boxStyle?: React.CSSProperties
14
- }
@@ -1,46 +0,0 @@
1
- import React from 'react';
2
- import { Meta, StoryFn } from '@storybook/react';
3
- import { ChakraProvider } from '@chakra-ui/react';
4
- import ProgressBar from './ProgressBar'; // Adjust the import path and component type if needed
5
- import { ProgressBarProps } from "./ProgressBarProps";
6
-
7
- export default {
8
- title: 'Components/ProgressBar/ProgressBar',
9
- component: ProgressBar,
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
- height: { control: { type: 'text' } },
21
- value: { control: { type: 'range', min: 0, max: 100, step: 1 } },
22
- max: { control: { type: 'number' } },
23
- min: { control: { type: 'number' } },
24
- },
25
- } as Meta;
26
-
27
- const Template: StoryFn<ProgressBarProps> = (args) => (
28
- <ChakraProvider>
29
- <ProgressBar {...args} />
30
- </ChakraProvider>
31
- );
32
-
33
- // Default Story
34
- export const Default = Template.bind({});
35
- Default.args = {
36
- size: 'md', // Provide appropriate size
37
- isIndeterminate: false, // Provide appropriate value
38
- color: 'blue', // Provide appropriate color scheme
39
- hasStripe: true, // Provide appropriate value
40
- height: '12px', // Provide appropriate height
41
- value: 50, // Provide appropriate value
42
- isAnimated: true, // Provide appropriate value
43
- max: 100, // Provide appropriate value
44
- min: 0, // Provide appropriate value
45
- variant: 'solid', // Provide appropriate variant
46
- };
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { ChakraProvider, Progress } from "@chakra-ui/react";
3
- import { ProgressBarProps } from "./ProgressBarProps";
4
-
5
- export default function ProgressBar({
6
- size,
7
- isIndeterminate,
8
- color,
9
- hasStripe,
10
- height,
11
- value,
12
- isAnimated,
13
- max,
14
- min,
15
- variant,
16
- }: ProgressBarProps) {
17
- return (
18
- <ChakraProvider>
19
- <Progress
20
- size={size}
21
- isIndeterminate={isIndeterminate}
22
- colorScheme={color}
23
- hasStripe={hasStripe}
24
- height={height}
25
- value={value}
26
- isAnimated={isAnimated}
27
- max={max}
28
- min={min}
29
- variant={variant}
30
- />
31
- </ChakraProvider>
32
- );
33
- }
@@ -1,7 +0,0 @@
1
- import { ProgressProps } from "@chakra-ui/react";
2
-
3
- export type ProgressBarProps =Pick<ProgressProps,"size"|"isIndeterminate"|"value"|"height"|"hasStripe"|"isAnimated"|"max"|"min">&{
4
- color?: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "whiteAlpha" | "blackAlpha",
5
- variant?: "solid" | "outline" | "ghost" | "link" | "unstyled",
6
- size?: "lg" | "md" | "sm" | "xs",
7
- }
@@ -1,46 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Meta, StoryFn } from '@storybook/react';
3
- import { ChakraProvider } from '@chakra-ui/react';
4
- import { RadioButton, RadioButtonGroup } from './RadioButton';
5
- import { ChakraRadioProps, ChakraRadioGroupProps } from './RadioButtonProps';
6
-
7
- export default {
8
- title: 'Components/RadioButton/RadioButton',
9
- component: RadioButton,
10
- decorators: [(Story:any) => <ChakraProvider><Story /></ChakraProvider>],
11
- } as Meta<typeof RadioButton>;
12
-
13
- const RadioButtonTemplate: StoryFn<typeof RadioButton> = (args: ChakraRadioProps) => <RadioButton {...args} />;
14
-
15
- export const SingleRadioButton = RadioButtonTemplate.bind({});
16
- SingleRadioButton.args = {
17
- label: 'Option 1',
18
- value: '1',
19
- colorScheme: 'blue',
20
- size: 'md',
21
- };
22
-
23
- const RadioButtonGroupTemplate: StoryFn<typeof RadioButtonGroup> = (args: ChakraRadioGroupProps) => {
24
- const [selectedValue, setSelectedValue] = useState<string>(args.value as string);
25
-
26
- const handleChange = (value: string) => {
27
- setSelectedValue(value);
28
- if (args.onChange) {
29
- args.onChange(value);
30
- }
31
- };
32
-
33
- return <RadioButtonGroup {...args} value={selectedValue} onChange={handleChange} />;
34
- };
35
-
36
- export const RadioButtonGroupStory = RadioButtonGroupTemplate.bind({});
37
- RadioButtonGroupStory.args = {
38
- options: [
39
- { label: 'Option 1', value: '1' },
40
- { label: 'Option 2', value: '2' },
41
- { label: 'Option 3', value: '3' },
42
- ],
43
- value: '1',
44
- colorScheme: 'blue',
45
- size: 'md',
46
- };
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- import { Radio as ChakraRadio, RadioGroup as ChakraRadioGroup, Box, Stack, ChakraProvider } from '@chakra-ui/react';
3
- import { ChakraRadioProps, ChakraRadioGroupProps } from './RadioButtonProps';
4
-
5
- const RadioButton = ({
6
- label,
7
- colorScheme,
8
- isChecked,
9
- onChange,
10
- isDisabled,
11
- size,
12
- value,
13
- defaultChecked,
14
- }:ChakraRadioProps) => {
15
- return (
16
- <ChakraProvider>
17
- <ChakraRadio
18
- colorScheme={colorScheme}
19
- isChecked={isChecked}
20
- onChange={onChange}
21
- isDisabled={isDisabled}
22
- size={size}
23
- value={value}
24
- defaultChecked={defaultChecked}
25
- >
26
- <Box as="span">
27
- {label}
28
- </Box>
29
- </ChakraRadio>
30
- </ChakraProvider>
31
- );
32
- };
33
-
34
- const RadioButtonGroup = ({
35
- options,
36
- onChange,
37
- value,
38
- defaultValue,
39
- isDisabled,
40
- size,
41
- colorScheme,
42
- }:ChakraRadioGroupProps) => {
43
- return (
44
- <ChakraProvider>
45
- <ChakraRadioGroup onChange={onChange} value={value} defaultValue={defaultValue}>
46
- <Stack direction="row" spacing={4}>
47
- {options.map((option) => (
48
- <RadioButton
49
- key={option.value}
50
- label={option.label}
51
- value={option.value}
52
- isDisabled={isDisabled}
53
- size={size}
54
- colorScheme={colorScheme}
55
- />
56
- ))}
57
- </Stack>
58
- </ChakraRadioGroup>
59
- </ChakraProvider>
60
- );
61
- };
62
-
63
- export { RadioButton, RadioButtonGroup };
@@ -1,10 +0,0 @@
1
-
2
- import { RadioProps , RadioGroupProps } from '@chakra-ui/react';
3
-
4
- export type ChakraRadioProps= Pick<RadioProps,|"size"|"colorScheme"|"isChecked"|"onChange"|"isDisabled"|"value"|"defaultChecked">&{
5
- label: string;
6
- }
7
- export type ChakraRadioGroupProps = Pick<RadioGroupProps,|"size"|"colorScheme"|"isDisabled"|"defaultValue"|"value">&{
8
- options: { label: string; value: string }[];
9
- onChange?: (value: string) => void;
10
- }
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import { Meta, StoryFn } from '@storybook/react';
3
- import { ChakraProvider } from "@chakra-ui/react";
4
- import { useState } from 'react';
5
- import Select from './Select';
6
- import { chakraSelectProps } from './SelectProps';
7
-
8
- const meta: Meta<typeof Select> = {
9
- title: 'Components/Input/Select',
10
- component: Select,
11
- parameters: {
12
- layout: 'centered',
13
- },
14
- tags: ['autodocs'],
15
- };
16
-
17
- export default meta;
18
-
19
- const SelectTemplate: StoryFn<chakraSelectProps> = (args) => {
20
- const [value, setValue] = useState("");
21
-
22
- const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
23
- setValue(e.target.value);
24
- if (args.onChange) {
25
- args.onChange(e);
26
- }
27
- };
28
-
29
- return (
30
- <ChakraProvider>
31
- <Select {...args} onChange={handleChange} value={value} />
32
- </ChakraProvider>
33
- );
34
- };
35
-
36
- export const Primary = SelectTemplate.bind({});
37
- Primary.args = {
38
- placeholder: "Select an option",
39
- size: "md",
40
- variant: "outline",
41
- icon: undefined,
42
- bg: undefined,
43
- borderColor: undefined,
44
- color: undefined,
45
- error: false,
46
- isRequired: false,
47
- label: 'Select Input',
48
- errorMessage: "",
49
- helperText: "",
50
- options: [
51
- { id: '1', label: 'Option 1' },
52
- { id: '2', label: 'Option 2' },
53
- { id: '3', label: 'Option 3' },
54
- ],
55
- value: "",
56
- width: 500,
57
- };