dhre-component-lib 0.0.9 → 0.1.1

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 (78) hide show
  1. package/package.json +3 -2
  2. package/src/__mocks__/styleMock.js +1 -0
  3. package/src/components/Avatar/Avatar.test.tsx +53 -0
  4. package/src/components/Avatar/Avatar.tsx +28 -0
  5. package/src/components/Avatar/index.ts +1 -0
  6. package/src/components/Badge/Badge.module.scss +14 -0
  7. package/src/components/Badge/Badge.test.tsx +59 -0
  8. package/src/components/Badge/Badge.tsx +25 -0
  9. package/src/components/Badge/index.ts +1 -0
  10. package/src/components/BreadCrumb/BreadCrumb.test.tsx +90 -0
  11. package/src/components/BreadCrumb/BreadCrumb.tsx +45 -0
  12. package/src/components/BreadCrumb/Breadcrumb.module.scss +20 -0
  13. package/src/components/BreadCrumb/index.ts +1 -0
  14. package/src/components/Button/Button.module.scss +66 -0
  15. package/src/components/Button/Button.test.tsx +49 -0
  16. package/src/components/Button/Button.tsx +29 -0
  17. package/src/components/Button/index.ts +1 -0
  18. package/src/components/Checkbox/Checkbox.test.tsx +93 -0
  19. package/src/components/Checkbox/Checkbox.tsx +35 -0
  20. package/src/components/Checkbox/index.ts +1 -0
  21. package/src/components/CircularProgress/CircularProgress.module.scss +19 -0
  22. package/src/components/CircularProgress/CircularProgress.test.tsx +39 -0
  23. package/src/components/CircularProgress/CircularProgress.tsx +37 -0
  24. package/src/components/CircularProgress/index.ts +1 -0
  25. package/src/components/Divider/Divider.test.tsx +44 -0
  26. package/src/components/Divider/Divider.tsx +24 -0
  27. package/src/components/Divider/index.ts +1 -0
  28. package/src/components/Enum.ts +19 -0
  29. package/src/components/InputTextField/InputTextField.test.tsx +118 -0
  30. package/src/components/InputTextField/InputTextField.tsx +48 -0
  31. package/src/components/InputTextField/index.ts +1 -0
  32. package/src/components/Link/Link.test.tsx +55 -0
  33. package/src/components/Link/Link.tsx +33 -0
  34. package/src/components/Link/index.ts +1 -0
  35. package/src/components/Map/Directions.tsx +36 -0
  36. package/src/components/Map/GoogleMap.module.scss +5 -0
  37. package/src/components/Map/GoogleMap.tsx +186 -0
  38. package/src/components/Map/GoogleMapsLoader.tsx +12 -0
  39. package/src/components/Map/index.ts +2 -0
  40. package/src/components/Modal/Modal.module.scss +26 -0
  41. package/src/components/Modal/Modal.test.tsx +74 -0
  42. package/src/components/Modal/Modal.tsx +39 -0
  43. package/src/components/Modal/index.ts +1 -0
  44. package/src/components/Notification/Notification.module.scss +20 -0
  45. package/src/components/Notification/Notification.test.tsx +53 -0
  46. package/src/components/Notification/Notification.tsx +42 -0
  47. package/src/components/Notification/index.ts +1 -0
  48. package/src/components/OtpInput/OtpInput.module.scss +49 -0
  49. package/src/components/OtpInput/OtpInput.test.tsx +53 -0
  50. package/src/components/OtpInput/OtpInput.tsx +137 -0
  51. package/src/components/OtpInput/index.ts +1 -0
  52. package/src/components/PdfView/PdfView.module.scss +69 -0
  53. package/src/components/PdfView/PdfView.test.tsx +52 -0
  54. package/src/components/PdfView/PdfView.tsx +116 -0
  55. package/src/components/PdfView/index.ts +1 -0
  56. package/src/components/Progress/Progress.test.tsx +43 -0
  57. package/src/components/Progress/Progress.tsx +35 -0
  58. package/src/components/Progress/index.ts +1 -0
  59. package/src/components/RadioButton/RadioButton.test.tsx +56 -0
  60. package/src/components/RadioButton/RadioButton.tsx +43 -0
  61. package/src/components/RadioButton/index.ts +1 -0
  62. package/src/components/Switch/Switch.test.tsx +83 -0
  63. package/src/components/Switch/Switch.tsx +38 -0
  64. package/src/components/Switch/index.ts +1 -0
  65. package/src/components/Tag/Tag.css +14 -0
  66. package/src/components/Tag/Tag.test.tsx +61 -0
  67. package/src/components/Tag/Tag.tsx +19 -0
  68. package/src/components/Tag/index.ts +1 -0
  69. package/src/components/Tooltip/Tooltip.module.scss +37 -0
  70. package/src/components/Tooltip/Tooltip.test.tsx +68 -0
  71. package/src/components/Tooltip/Tooltip.tsx +38 -0
  72. package/src/components/Tooltip/index.ts +1 -0
  73. package/src/components/index.ts +15 -0
  74. package/src/index.ts +1 -0
  75. package/src/theme/Typography/typography.scss +117 -0
  76. package/src/theme/colors/colors.scss +22 -0
  77. package/src/theme/colors.ts +3 -0
  78. package/src/typings.d.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-component-lib",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -53,6 +53,7 @@
53
53
  "module": "dist/esm/index.js",
54
54
  "types": "dist/index.d.ts",
55
55
  "files": [
56
- "dist"
56
+ "dist",
57
+ "src"
57
58
  ]
58
59
  }
@@ -0,0 +1 @@
1
+ module.exports = {};
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import Avatar, { AvatarProps } from './Avatar';
5
+
6
+ describe('Avatar Component', () => {
7
+ const defaultProps: AvatarProps = {
8
+ src: 'test-image.jpg',
9
+ alt: 'Test Avatar',
10
+ imgClassName: 'avatar-class',
11
+ };
12
+
13
+ it('renders the image with the provided src and alt attributes', () => {
14
+ render(<Avatar {...defaultProps} />);
15
+
16
+ const imgElement = screen.getByAltText(defaultProps.alt);
17
+
18
+ expect(imgElement).toHaveAttribute('src', defaultProps.src);
19
+ expect(imgElement).toHaveAttribute('alt', defaultProps.alt);
20
+ });
21
+
22
+ it('applies the correct className to the image', () => {
23
+ render(<Avatar {...defaultProps} />);
24
+
25
+ const imgElement = screen.getByAltText(defaultProps.alt);
26
+
27
+ expect(imgElement).toHaveClass(defaultProps.imgClassName);
28
+ });
29
+
30
+ it('handles the onClick event correctly', () => {
31
+ const handleClick = jest.fn();
32
+ render(<Avatar {...defaultProps} handleClick={handleClick} />);
33
+
34
+ const imgElement = screen.getByAltText(defaultProps.alt);
35
+ fireEvent.click(imgElement);
36
+
37
+ expect(handleClick).toHaveBeenCalledTimes(1);
38
+ });
39
+
40
+ it('does not crash without handleClick prop', () => {
41
+ render(<Avatar {...defaultProps} />);
42
+
43
+ const imgElement = screen.getByAltText(defaultProps.alt);
44
+ expect(() => fireEvent.click(imgElement)).not.toThrow();
45
+ });
46
+
47
+ it('renders correctly without crashing', () => {
48
+ render(<Avatar {...defaultProps} />);
49
+
50
+ const imgElement = screen.getByAltText(defaultProps.alt);
51
+ expect(imgElement).toBeInTheDocument();
52
+ });
53
+ });
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+
3
+ export interface AvatarProps {
4
+ src: string;
5
+ alt: string;
6
+ imgClassName: string;
7
+ handleClick?: () => void;
8
+ }
9
+
10
+ const Avatar: React.FC<AvatarProps> = ({
11
+ src,
12
+ alt,
13
+ imgClassName,
14
+ handleClick,
15
+ }) => {
16
+ return (
17
+ <button onClick={handleClick}>
18
+ <img
19
+ src={src}
20
+ alt={alt}
21
+
22
+ className={imgClassName}
23
+ />
24
+ </button>
25
+ );
26
+ };
27
+
28
+ export default Avatar;
@@ -0,0 +1 @@
1
+ export { default } from "./Avatar";
@@ -0,0 +1,14 @@
1
+ .badge {
2
+ display: inline-block;
3
+ padding: 6px 12px;
4
+ background-color: red;
5
+ color: white;
6
+ border-radius: 12px;
7
+ font-size: 14px;
8
+ text-align: center;
9
+ cursor: pointer;
10
+
11
+ &:hover {
12
+ background-color: darkred;
13
+ }
14
+ }
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import Badge, { BadgeProps } from './Badge';
5
+
6
+ describe('Badge Component', () => {
7
+ const defaultProps: BadgeProps = {
8
+ content: 'Test Badge',
9
+ badgeClassName: 'badge-class',
10
+ };
11
+
12
+ it('renders the badge with the provided content', () => {
13
+ render(<Badge {...defaultProps} />);
14
+
15
+ const badgeElement = screen.getByText(defaultProps.content as string);
16
+
17
+ expect(badgeElement).toBeInTheDocument();
18
+ });
19
+
20
+ it('handles the onClick event correctly', () => {
21
+ const handleClick = jest.fn();
22
+ render(<Badge {...defaultProps} handleClick={handleClick} />);
23
+
24
+ const badgeElement = screen.getByText(defaultProps.content as string);
25
+ fireEvent.click(badgeElement);
26
+
27
+ expect(handleClick).toHaveBeenCalledTimes(1);
28
+ });
29
+
30
+ it('does not crash without handleClick prop', () => {
31
+ render(<Badge {...defaultProps} />);
32
+
33
+ const badgeElement = screen.getByText(defaultProps.content as string);
34
+ expect(() => fireEvent.click(badgeElement)).not.toThrow();
35
+ });
36
+
37
+ it('renders correctly with numeric content', () => {
38
+ const numericProps: BadgeProps = {
39
+ ...defaultProps,
40
+ content: 99,
41
+ };
42
+ render(<Badge {...numericProps} />);
43
+
44
+ const badgeElement = screen.getByText(numericProps.content.toString());
45
+
46
+ expect(badgeElement).toBeInTheDocument();
47
+ expect(badgeElement).toHaveTextContent('99');
48
+ });
49
+
50
+ it('renders correctly with different content', () => {
51
+ const newContent = 'Updated Badge';
52
+ render(<Badge {...defaultProps} content={newContent} />);
53
+
54
+ const badgeElement = screen.getByText(newContent);
55
+
56
+ expect(badgeElement).toBeInTheDocument();
57
+ expect(badgeElement).toHaveTextContent(newContent);
58
+ });
59
+ });
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import styles from './Badge.module.scss';
3
+
4
+ export interface BadgeProps {
5
+ content: string | number;
6
+ badgeClassName?: string;
7
+ handleClick?: () => void;
8
+ }
9
+
10
+ const Badge: React.FC<BadgeProps> = ({
11
+ content,
12
+ badgeClassName,
13
+ handleClick,
14
+ }) => {
15
+ return (
16
+ <button
17
+ onClick={handleClick}
18
+ className={`${styles.badge} ${badgeClassName}`}
19
+ >
20
+ {content}
21
+ </button>
22
+ );
23
+ };
24
+
25
+ export default Badge;
@@ -0,0 +1 @@
1
+ export { default } from "./Badge";
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import Breadcrumb from './BreadCrumb';
5
+
6
+ describe('Breadcrumb', () => {
7
+ it('should render with given props', () => {
8
+ const items = [
9
+ { label: 'Home', handleClick: () => {} },
10
+ { label: 'Library' },
11
+ { label: 'Data' },
12
+ ];
13
+
14
+ render(
15
+ <Breadcrumb
16
+ items={items}
17
+ breadcrumbClassName="breadcrumb-class"
18
+ itemClassName="item-class"
19
+ separator=">"
20
+ separatorClassName="separator-class"
21
+ />
22
+ );
23
+
24
+ // Check if breadcrumb container is rendered
25
+ const breadcrumb = screen.getByRole('navigation');
26
+ expect(breadcrumb).toBeInTheDocument();
27
+ expect(breadcrumb).toHaveClass('breadcrumb-class');
28
+
29
+ // Check if breadcrumb items are rendered
30
+ items.forEach((item) => {
31
+ const itemElement = screen.getByText(item.label);
32
+ expect(itemElement).toBeInTheDocument();
33
+ expect(itemElement).toHaveClass('item-class');
34
+ });
35
+
36
+ // Check if separators are rendered
37
+ const separators = screen.getAllByText('>');
38
+ expect(separators.length).toBe(items.length - 1);
39
+ separators.forEach(separator => expect(separator).toHaveClass('separator-class'));
40
+ });
41
+
42
+ it('should call handleClick when a breadcrumb item is clicked', () => {
43
+ const handleClick = jest.fn();
44
+ const items = [
45
+ { label: 'Home', handleClick },
46
+ { label: 'Library' },
47
+ ];
48
+
49
+ render(
50
+ <Breadcrumb
51
+ items={items}
52
+ breadcrumbClassName="breadcrumb-class"
53
+ itemClassName="item-class"
54
+ separator=">"
55
+ separatorClassName="separator-class"
56
+ />
57
+ );
58
+
59
+ const homeItem = screen.getByText('Home');
60
+ fireEvent.click(homeItem);
61
+
62
+ expect(handleClick).toHaveBeenCalled();
63
+ });
64
+
65
+ it('should render without separators if none are provided', () => {
66
+ const items = [
67
+ { label: 'Home' },
68
+ { label: 'Library' },
69
+ ];
70
+
71
+ render(
72
+ <Breadcrumb
73
+ items={items}
74
+ breadcrumbClassName="breadcrumb-class"
75
+ itemClassName="item-class"
76
+ separator="" // Pass an empty string for separator
77
+ />
78
+ );
79
+
80
+ // Check if breadcrumb items are rendered
81
+ items.forEach((item) => {
82
+ const itemElement = screen.getByText(item.label);
83
+ expect(itemElement).toBeInTheDocument();
84
+ });
85
+
86
+ // Check that no separators are present by querying with the separator class name
87
+ const separators = screen.queryAllByRole('presentation');
88
+ expect(separators.length).toBe(0);
89
+ });
90
+ });
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+ import styles from './Breadcrumb.module.scss';
3
+
4
+ export interface BreadcrumbItem {
5
+ label: string;
6
+ handleClick?: () => void;
7
+ }
8
+
9
+ export interface BreadcrumbProps {
10
+ items: BreadcrumbItem[];
11
+ breadcrumbClassName: string;
12
+ itemClassName?: string;
13
+ separator?: string;
14
+ separatorClassName?: string;
15
+ }
16
+
17
+ const Breadcrumb: React.FC<BreadcrumbProps> = ({
18
+ items,
19
+ breadcrumbClassName,
20
+ itemClassName,
21
+ separator = "/",
22
+ separatorClassName,
23
+ }) => {
24
+ return (
25
+ <nav className={`${styles.breadcrumb} ${breadcrumbClassName}`}>
26
+ {items.map((item, index) => (
27
+ <React.Fragment key={index}>
28
+ <button
29
+ className={`${styles.breadcrumbItem} ${itemClassName}`}
30
+ onClick={item.handleClick}
31
+ >
32
+ {item.label}
33
+ </button>
34
+ {index < items.length - 1 && (
35
+ <span className={`${styles.separator} ${separatorClassName}`}>
36
+ {separator}
37
+ </span>
38
+ )}
39
+ </React.Fragment>
40
+ ))}
41
+ </nav>
42
+ );
43
+ };
44
+
45
+ export default Breadcrumb;
@@ -0,0 +1,20 @@
1
+ .breadcrumb {
2
+ display: flex;
3
+ align-items: center;
4
+ font-size: 16px;
5
+ }
6
+
7
+ .breadcrumbItem {
8
+ color: blue;
9
+ cursor: pointer;
10
+ margin-right: 8px;
11
+
12
+ &:hover {
13
+ text-decoration: underline;
14
+ }
15
+ }
16
+
17
+ .separator {
18
+ margin: 0 8px;
19
+ color: grey;
20
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./BreadCrumb";
@@ -0,0 +1,66 @@
1
+ /* Base button styling */
2
+ .button {
3
+ padding: 8px 16px;
4
+ font-size: 14px;
5
+ border-radius: 4px;
6
+ border: none;
7
+ cursor: pointer;
8
+ transition: background-color 0.3s ease;
9
+
10
+ &.text {
11
+ background-color: transparent;
12
+ color: inherit;
13
+ }
14
+
15
+ &.outlined {
16
+ background-color: transparent;
17
+ border: 2px solid currentColor;
18
+ }
19
+
20
+ &.contained {
21
+ background-color: currentColor;
22
+ color: #fff;
23
+
24
+ &.primary:hover {
25
+ background-color: #1565c0;
26
+ }
27
+
28
+ &.secondary:hover {
29
+ background-color: #7b1fa2;
30
+ }
31
+
32
+ &.success:hover {
33
+ background-color: #388e3c;
34
+ }
35
+
36
+ &.error:hover {
37
+ background-color: #d32f2f;
38
+ }
39
+
40
+ &.warning:hover {
41
+ background-color: #f57c00;
42
+ }
43
+
44
+ &.info:hover {
45
+ background-color: #1976d2;
46
+ }
47
+ }
48
+
49
+ &.primary {
50
+ color: #1976d2;
51
+ }
52
+
53
+ &.secondary {
54
+ color: #9c27b0;
55
+ }
56
+
57
+ &.success {
58
+ color: #4caf50;
59
+ }
60
+
61
+ &.error {
62
+ color: #f44336;
63
+ }
64
+
65
+ &.warning {
66
+ color:
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import Button, { ButtonProps } from './Button';
5
+
6
+ describe('Button Component', () => {
7
+ let handleClick: jest.Mock;
8
+
9
+ beforeEach(() => {
10
+ handleClick = jest.fn(); // Initialize the mock function before each test
11
+ });
12
+
13
+ const renderButton = (props: Partial<ButtonProps> = {}) => {
14
+ const defaultProps: ButtonProps = {
15
+ label: 'Click Me',
16
+ variant: 'contained',
17
+ color: 'primary',
18
+ size: 'small',
19
+ handleClick: handleClick
20
+ };
21
+
22
+ return render(<Button {...defaultProps} />);
23
+ };
24
+
25
+ it('renders the button with the correct label', () => {
26
+ renderButton();
27
+
28
+ const buttonElement = screen.getByText('Click Me');
29
+
30
+ expect(buttonElement).toBeInTheDocument();
31
+ expect(buttonElement.tagName).toBe('BUTTON');
32
+ });
33
+
34
+ it('calls the handleClick function when the button is clicked', () => {
35
+ renderButton();
36
+
37
+ const buttonElement = screen.getByText('Click Me');
38
+
39
+ fireEvent.click(buttonElement);
40
+
41
+ expect(handleClick).toHaveBeenCalledTimes(1); // Ensure the mock function is called once
42
+ });
43
+
44
+ it('does not call handleClick when the button is not clicked', () => {
45
+ renderButton();
46
+
47
+ expect(handleClick).not.toHaveBeenCalled();
48
+ });
49
+ });
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import styles from './Button.module.scss';
3
+
4
+ export interface ButtonProps {
5
+ label: string;
6
+ variant: 'text' | 'outlined' | 'contained';
7
+ color: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info';
8
+ size: 'small' | 'medium' | 'large';
9
+ handleClick: () => void;
10
+ }
11
+
12
+ const Button: React.FC<ButtonProps> = ({
13
+ label,
14
+ variant,
15
+ color,
16
+ size,
17
+ handleClick,
18
+ }) => {
19
+ return (
20
+ <button
21
+ onClick={handleClick}
22
+ className={`${styles.button} ${styles[variant]} ${styles[color]} ${styles[size]}`}
23
+ >
24
+ {label}
25
+ </button>
26
+ );
27
+ };
28
+
29
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import CustomCheckbox from './Checkbox';
5
+
6
+ interface CustomCheckboxProps {
7
+ label?: string;
8
+ checked?: boolean;
9
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
10
+ className?: string;
11
+ checkboxClassName?: string;
12
+ labelClassName?: string;
13
+ }
14
+
15
+ describe('CustomCheckbox Component', () => {
16
+ let handleChange: jest.Mock;
17
+
18
+ // Function to generate default props for each test
19
+ const getDefaultProps = (): CustomCheckboxProps => ({
20
+ label: 'Accept Terms',
21
+ checked: false,
22
+ onChange: handleChange,
23
+ className: 'custom-container',
24
+ checkboxClassName: 'custom-checkbox',
25
+ labelClassName: 'custom-label',
26
+ });
27
+
28
+ beforeEach(() => {
29
+ handleChange = jest.fn(); // Reset the mock function before each test
30
+ });
31
+
32
+ it('renders the checkbox with a label', () => {
33
+ render(<CustomCheckbox {...getDefaultProps()} />);
34
+
35
+ const checkboxElement = screen.getByRole('checkbox');
36
+ const labelElement = screen.getByText('Accept Terms');
37
+
38
+ expect(checkboxElement).toBeInTheDocument();
39
+ expect(labelElement).toBeInTheDocument();
40
+ });
41
+
42
+ it('applies the correct className to the checkbox container', () => {
43
+ render(<CustomCheckbox {...getDefaultProps()} />);
44
+
45
+ const container = screen.getByRole('checkbox').parentElement;
46
+
47
+ expect(container).toHaveClass('custom-container');
48
+ });
49
+
50
+ it('applies the correct className to the checkbox', () => {
51
+ render(<CustomCheckbox {...getDefaultProps()} />);
52
+
53
+ const checkboxElement = screen.getByRole('checkbox');
54
+
55
+ expect(checkboxElement).toHaveClass('custom-checkbox');
56
+ });
57
+
58
+ it('applies the correct className to the label', () => {
59
+ render(<CustomCheckbox {...getDefaultProps()} />);
60
+
61
+ const labelElement = screen.getByText('Accept Terms');
62
+
63
+ expect(labelElement).toHaveClass('custom-label');
64
+ });
65
+
66
+ it('checks the checkbox based on the checked prop', () => {
67
+ render(<CustomCheckbox {...getDefaultProps()} checked={true} />);
68
+
69
+ const checkboxElement = screen.getByRole('checkbox');
70
+
71
+ expect(checkboxElement).toBeChecked();
72
+ });
73
+
74
+ it('calls the onChange function when the checkbox state changes', () => {
75
+ render(<CustomCheckbox {...getDefaultProps()} checked={false} />);
76
+
77
+ const checkboxElement = screen.getByRole('checkbox');
78
+
79
+ fireEvent.click(checkboxElement); // Toggle the checkbox
80
+
81
+ expect(handleChange).toHaveBeenCalledTimes(1);
82
+ });
83
+
84
+ it('renders correctly with different label', () => {
85
+ const newLabel = 'Agree to Privacy Policy';
86
+ render(<CustomCheckbox {...getDefaultProps()} label={newLabel} />);
87
+
88
+ const labelElement = screen.getByText(newLabel);
89
+
90
+ expect(labelElement).toBeInTheDocument();
91
+ expect(labelElement).toHaveTextContent(newLabel);
92
+ });
93
+ });
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+
3
+ interface CustomCheckboxProps {
4
+ label?: string;
5
+ checked?: boolean;
6
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
7
+ className?: string;
8
+ checkboxClassName?: string;
9
+ labelClassName?: string;
10
+ }
11
+
12
+ const CustomCheckbox: React.FC<CustomCheckboxProps> = ({
13
+ label,
14
+ checked = false,
15
+ onChange,
16
+ className = '',
17
+ checkboxClassName = '',
18
+ labelClassName = '',
19
+ ...rest
20
+ }) => {
21
+ return (
22
+ <div className={className}>
23
+ <input
24
+ type="checkbox"
25
+ checked={checked}
26
+ onChange={onChange}
27
+ className={checkboxClassName}
28
+ {...rest}
29
+ />
30
+ {label && <label className={labelClassName}>{label}</label>}
31
+ </div>
32
+ );
33
+ };
34
+
35
+ export default CustomCheckbox;
@@ -0,0 +1 @@
1
+ export { default } from "./Checkbox";
@@ -0,0 +1,19 @@
1
+ .spinner {
2
+ border-style: solid;
3
+ border-radius: 50%;
4
+ border-color: transparent;
5
+ border-top-color: currentColor;
6
+ animation: spin 1s linear infinite;
7
+ }
8
+
9
+ .spinner.primary { color: #007bff; }
10
+ .spinner.secondary { color: #6c757d; }
11
+ .spinner.error { color: #dc3545; }
12
+ .spinner.success { color: #28a745; }
13
+ .spinner.info { color: #17a2b8; }
14
+ .spinner.warning { color: #ffc107; }
15
+
16
+ @keyframes spin {
17
+ 0% { transform: rotate(0deg); }
18
+ 100% { transform: rotate(360deg); }
19
+ }