dhre-component-lib 0.0.8 → 0.0.9

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 (82) hide show
  1. package/package.json +6 -3
  2. package/jest.config.ts +0 -10
  3. package/rollup.config.mjs +0 -37
  4. package/setupTests.ts +0 -1
  5. package/src/__mocks__/styleMock.js +0 -1
  6. package/src/components/Avatar/Avatar.test.tsx +0 -53
  7. package/src/components/Avatar/Avatar.tsx +0 -28
  8. package/src/components/Avatar/index.ts +0 -1
  9. package/src/components/Badge/Badge.module.scss +0 -14
  10. package/src/components/Badge/Badge.test.tsx +0 -59
  11. package/src/components/Badge/Badge.tsx +0 -25
  12. package/src/components/Badge/index.ts +0 -1
  13. package/src/components/BreadCrumb/BreadCrumb.test.tsx +0 -90
  14. package/src/components/BreadCrumb/BreadCrumb.tsx +0 -45
  15. package/src/components/BreadCrumb/Breadcrumb.module.scss +0 -20
  16. package/src/components/BreadCrumb/index.ts +0 -1
  17. package/src/components/Button/Button.module.scss +0 -66
  18. package/src/components/Button/Button.test.tsx +0 -49
  19. package/src/components/Button/Button.tsx +0 -29
  20. package/src/components/Button/index.ts +0 -1
  21. package/src/components/Checkbox/Checkbox.test.tsx +0 -93
  22. package/src/components/Checkbox/Checkbox.tsx +0 -35
  23. package/src/components/Checkbox/index.ts +0 -1
  24. package/src/components/CircularProgress/CircularProgress.module.scss +0 -19
  25. package/src/components/CircularProgress/CircularProgress.test.tsx +0 -39
  26. package/src/components/CircularProgress/CircularProgress.tsx +0 -37
  27. package/src/components/CircularProgress/index.ts +0 -1
  28. package/src/components/Divider/Divider.test.tsx +0 -44
  29. package/src/components/Divider/Divider.tsx +0 -24
  30. package/src/components/Divider/index.ts +0 -1
  31. package/src/components/Enum.ts +0 -19
  32. package/src/components/InputTextField/InputTextField.test.tsx +0 -118
  33. package/src/components/InputTextField/InputTextField.tsx +0 -48
  34. package/src/components/InputTextField/index.ts +0 -1
  35. package/src/components/Link/Link.test.tsx +0 -55
  36. package/src/components/Link/Link.tsx +0 -33
  37. package/src/components/Link/index.ts +0 -1
  38. package/src/components/Map/Directions.tsx +0 -36
  39. package/src/components/Map/GoogleMap.module.scss +0 -5
  40. package/src/components/Map/GoogleMap.tsx +0 -186
  41. package/src/components/Map/GoogleMapsLoader.tsx +0 -12
  42. package/src/components/Map/index.ts +0 -2
  43. package/src/components/Modal/Modal.module.scss +0 -26
  44. package/src/components/Modal/Modal.test.tsx +0 -74
  45. package/src/components/Modal/Modal.tsx +0 -39
  46. package/src/components/Modal/index.ts +0 -1
  47. package/src/components/Notification/Notification.module.scss +0 -20
  48. package/src/components/Notification/Notification.test.tsx +0 -53
  49. package/src/components/Notification/Notification.tsx +0 -42
  50. package/src/components/Notification/index.ts +0 -1
  51. package/src/components/OtpInput/OtpInput.module.scss +0 -49
  52. package/src/components/OtpInput/OtpInput.test.tsx +0 -53
  53. package/src/components/OtpInput/OtpInput.tsx +0 -137
  54. package/src/components/OtpInput/index.ts +0 -1
  55. package/src/components/PdfView/PdfView.module.scss +0 -69
  56. package/src/components/PdfView/PdfView.test.tsx +0 -52
  57. package/src/components/PdfView/PdfView.tsx +0 -116
  58. package/src/components/PdfView/index.ts +0 -1
  59. package/src/components/Progress/Progress.test.tsx +0 -43
  60. package/src/components/Progress/Progress.tsx +0 -35
  61. package/src/components/Progress/index.ts +0 -1
  62. package/src/components/RadioButton/RadioButton.test.tsx +0 -56
  63. package/src/components/RadioButton/RadioButton.tsx +0 -43
  64. package/src/components/RadioButton/index.ts +0 -1
  65. package/src/components/Switch/Switch.test.tsx +0 -83
  66. package/src/components/Switch/Switch.tsx +0 -38
  67. package/src/components/Switch/index.ts +0 -1
  68. package/src/components/Tag/Tag.css +0 -14
  69. package/src/components/Tag/Tag.test.tsx +0 -61
  70. package/src/components/Tag/Tag.tsx +0 -19
  71. package/src/components/Tag/index.ts +0 -1
  72. package/src/components/Tooltip/Tooltip.module.scss +0 -37
  73. package/src/components/Tooltip/Tooltip.test.tsx +0 -68
  74. package/src/components/Tooltip/Tooltip.tsx +0 -38
  75. package/src/components/Tooltip/index.ts +0 -1
  76. package/src/components/index.ts +0 -15
  77. package/src/index.ts +0 -1
  78. package/src/theme/Typography/typography.scss +0 -117
  79. package/src/theme/colors/colors.scss +0 -22
  80. package/src/theme/colors.ts +0 -3
  81. package/src/typings.d.ts +0 -1
  82. package/tsconfig.json +0 -16
@@ -1,35 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default } from "./Checkbox";
@@ -1,19 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import CircularProgress, { CircularProgressProps } from "./CircularProgress";
4
-
5
- describe("Loading Component", () => {
6
- const renderComponent = (props: CircularProgressProps) =>
7
- render(<CircularProgress {...props} />);
8
-
9
- it("applies the correct size and thickness", () => {
10
- const { container } = renderComponent({ size: 60, thickness: 5 });
11
- const spinner = container.firstChild as HTMLElement;
12
-
13
- expect(spinner).not.toBeNull();
14
- expect(spinner.style.width).toBe("60px");
15
- expect(spinner.style.height).toBe("60px");
16
- expect(spinner.style.borderWidth).toBe("5px");
17
- });
18
-
19
- it("renders the determinate spinner with the correct rotation", () => {
20
- const { container } = renderComponent({
21
- variant: "determinate",
22
- value: 75,
23
- });
24
- const spinner = container.firstChild as HTMLElement;
25
-
26
- const expectedRotation = `rotate(${(75 / 100) * 360}deg)`;
27
- expect(spinner).not.toBeNull();
28
- expect(spinner.style.transform).toBe(expectedRotation);
29
- });
30
-
31
- it("handles string size correctly", () => {
32
- const { container } = renderComponent({ size: "50%" });
33
- const spinner = container.firstChild as HTMLElement;
34
-
35
- expect(spinner).not.toBeNull();
36
- expect(spinner.style.width).toBe("50%");
37
- expect(spinner.style.height).toBe("50%");
38
- });
39
- });
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import styles from './CircularProgress.module.scss';
3
-
4
- export interface CircularProgressProps {
5
- value?: number;
6
- variant?: 'determinate' | 'indeterminate';
7
- color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
8
- thickness?: number;
9
- size?: number | string;
10
- }
11
-
12
- const CircularProgress: React.FC<CircularProgressProps> = ({
13
- value = 0,
14
- variant = 'indeterminate',
15
- color = 'primary',
16
- thickness = 4,
17
- size = 100,
18
- }) => {
19
- const isDeterminate = variant === 'determinate';
20
- const rotationStyle = isDeterminate
21
- ? { transform: `rotate(${(value / 100) * 360}deg)` }
22
- : {};
23
-
24
- return (
25
- <div
26
- className={`${styles.spinner} ${styles[color]}`}
27
- style={{
28
- width: typeof size === 'number' ? `${size}px` : size,
29
- height: typeof size === 'number' ? `${size}px` : size,
30
- borderWidth: `${thickness}px`,
31
- ...rotationStyle,
32
- }}
33
- />
34
- );
35
- };
36
-
37
- export default CircularProgress;
@@ -1 +0,0 @@
1
- export { default } from "./CircularProgress";
@@ -1,44 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import CustomDivider from "./Divider";
4
- import { DIVIDER_ORIENTATION } from "../Enum";
5
-
6
- describe("CustomDivider Component", () => {
7
- it("renders without crashing", () => {
8
- const { container } = render(<CustomDivider />);
9
- expect(container.firstChild).toBeTruthy();
10
- });
11
-
12
- it("applies the correct default orientation class", () => {
13
- const { container } = render(<CustomDivider />);
14
- expect(container.firstChild).toHaveClass(DIVIDER_ORIENTATION.Horizontal);
15
- });
16
-
17
- it("applies a custom orientation class", () => {
18
- const { container } = render(
19
- <CustomDivider orientation={DIVIDER_ORIENTATION.Vertical} />
20
- );
21
- expect(container.firstChild).toHaveClass(DIVIDER_ORIENTATION.Vertical);
22
- });
23
-
24
- it("applies the passed className to the outer div", () => {
25
- const { container } = render(
26
- <CustomDivider className="custom-class" />
27
- );
28
- expect(container.firstChild).toHaveClass("custom-class");
29
- });
30
-
31
- it("applies the passed dividerClassName to the inner div", () => {
32
- const { container } = render(
33
- <CustomDivider dividerClassName="inner-class" />
34
- );
35
- expect(container.firstChild?.firstChild).toHaveClass("inner-class");
36
- });
37
-
38
- it("passes additional props to the outer div", () => {
39
- const { container } = render(
40
- <CustomDivider data-testid="custom-divider" />
41
- );
42
- expect(container.firstChild).toHaveAttribute("data-testid", "custom-divider");
43
- });
44
- });
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import { DIVIDER_ORIENTATION } from "../Enum";
3
-
4
- interface CustomDividerProps {
5
- orientation?: string;
6
- className?: string;
7
- dividerClassName?: string;
8
-
9
- }
10
-
11
- const CustomDivider: React.FC<CustomDividerProps> = ({
12
- orientation = DIVIDER_ORIENTATION.Horizontal,
13
- className = "",
14
- dividerClassName = "",
15
- ...rest
16
- }) => {
17
- return (
18
- <div className={`${className} ${orientation}`} {...rest}>
19
- <div className={dividerClassName} />
20
- </div>
21
- );
22
- };
23
-
24
- export default CustomDivider;
@@ -1 +0,0 @@
1
- export { default } from "./Divider";
@@ -1,19 +0,0 @@
1
- export const INPUT_TYPES ={
2
- PASSWORD : 'password',
3
- TEXT : 'text',
4
- EMAIL : 'email',
5
- NUMBER : 'number',
6
- DATE : 'date',
7
- }
8
-
9
- export const DIVIDER_ORIENTATION = {
10
- Horizontal : "horizontal",
11
- Vertical : "vertical",
12
- }
13
-
14
- export const LINK_TARGET = {
15
- Self : '_self',
16
- Blank : '_blank',
17
- Parent : '_parent',
18
- Top : '_top',
19
- }
@@ -1,118 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import CustomInputField, { CustomInputFieldProps } from './InputTextField';
4
- import { INPUT_TYPES } from '../Enum';
5
-
6
- const renderWithProps = (props: Partial<CustomInputFieldProps> = {}) => {
7
- const defaultProps: CustomInputFieldProps = {
8
- label: 'Test Label',
9
- value: 'Test Value',
10
- type: INPUT_TYPES.TEXT,
11
- placeholder: 'Enter text...',
12
- onChange: jest.fn(),
13
- className: 'custom-input-wrapper',
14
- inputClassName: 'custom-input',
15
- labelClassName: 'custom-label',
16
- error: '',
17
- errorClassName: 'custom-error',
18
- id: 'test-input-field',
19
- ...props
20
- };
21
- return render(<CustomInputField {...defaultProps} />);
22
- };
23
-
24
- describe('CustomInputField Component', () => {
25
- // it('renders without crashing', () => {
26
- // renderWithProps();
27
- // // Check if the label correctly associates with the input by using the id
28
- // const input = screen.getByLabelText('Test Label');
29
- // expect(input).toBeInTheDocument();
30
- // });
31
-
32
-
33
- it('renders the label correctly', () => {
34
- renderWithProps();
35
- expect(screen.getByText('Test Label')).toHaveClass('custom-label');
36
- });
37
-
38
- it('renders the input with the correct value', () => {
39
- renderWithProps();
40
- expect(screen.getByDisplayValue('Test Value')).toHaveClass('custom-input');
41
- });
42
-
43
- it('calls the onChange handler when input value changes', () => {
44
- const mockOnChange = jest.fn();
45
- renderWithProps({ onChange: mockOnChange });
46
- const input = screen.getByDisplayValue('Test Value');
47
- fireEvent.change(input, { target: { value: 'New Value' } });
48
- expect(mockOnChange).toHaveBeenCalledTimes(1);
49
- });
50
-
51
- it('displays the error message correctly', () => {
52
- renderWithProps({ error: 'Error message' });
53
- expect(screen.getByText('Error message')).toHaveClass('custom-error');
54
- });
55
-
56
- it('renders the input with the correct type', () => {
57
- renderWithProps({ type: INPUT_TYPES.EMAIL });
58
- expect(screen.getByPlaceholderText('Enter text...')).toHaveAttribute('type', INPUT_TYPES.EMAIL);
59
- });
60
-
61
- // it('applies the passed className to the wrapper div', () => {
62
- // renderWithProps();
63
- // // Check the class name of the wrapper div
64
- // const wrapper = screen.getByLabelText('Test Label').parentElement?.parentElement;
65
- // expect(wrapper).toHaveClass('custom-input-wrapper');
66
- // });
67
-
68
- it('applies additional props to the input field', () => {
69
- renderWithProps();
70
- expect(screen.getByPlaceholderText('Enter text...')).toBeInTheDocument();
71
- });
72
- });
73
-
74
- describe('CustomInputField Component - Default Values', () => {
75
- it('renders the input field with default value when value prop is not provided', () => {
76
- render(<CustomInputField label="Test Label" type={INPUT_TYPES.TEXT} value="" onChange={jest.fn()} />);
77
- expect(screen.getByPlaceholderText('')).toHaveValue('');
78
- });
79
-
80
- it('renders the input field with default type when type prop is not provided', () => {
81
- render(<CustomInputField label="Test Label" value="Test Value" type={INPUT_TYPES.TEXT} onChange={jest.fn()} />);
82
- expect(screen.getByDisplayValue('Test Value')).toHaveAttribute('type', INPUT_TYPES.TEXT);
83
- });
84
-
85
- it('renders the input field with default placeholder when placeholder prop is not provided', () => {
86
- render(<CustomInputField label="Test Label" value="Test Value" type={INPUT_TYPES.TEXT} onChange={jest.fn()} />);
87
- expect(screen.getByDisplayValue('Test Value')).toHaveAttribute('placeholder', '');
88
- });
89
-
90
- // it('applies default class names if className, inputClassName, or labelClassName are not provided', () => {
91
- // render(<CustomInputField label="Test Label" value="Test Value" type={INPUT_TYPES.TEXT} onChange={jest.fn()} />);
92
-
93
- // // Get the label element
94
- // const label = screen.getByText('Test Label');
95
- // const input = screen.getByDisplayValue('Test Value');
96
-
97
- // // Get the parent wrapper div
98
- // const wrapper = label.closest('div');
99
-
100
- // // Check if the wrapper div has default class names or no class names
101
- // if (wrapper) {
102
- // // Expect no additional class names or specific default class names
103
- // expect(wrapper).toHaveClass('default-wrapper-class'); // Replace with actual default class
104
- // }
105
-
106
- // // Check if the input field has default input class names or no class names
107
- // expect(input).toHaveClass('default-input-class'); // Replace with actual default class
108
-
109
- // // Check if the label has default label class names or no class names
110
- // expect(label).toHaveClass('default-label-class'); // Replace with actual default class
111
- // });
112
-
113
- it('does not render the error message if error prop is not provided', () => {
114
- render(<CustomInputField label="Test Label" value="Test Value" type={INPUT_TYPES.TEXT} onChange={jest.fn()} />);
115
- const errorMessage = screen.queryByText('Error message');
116
- expect(errorMessage).not.toBeInTheDocument();
117
- });
118
- });
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import { INPUT_TYPES } from '../Enum';
3
-
4
- export interface CustomInputFieldProps {
5
- label?: string;
6
- value?: string;
7
- type?:string ;
8
- placeholder?: string;
9
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
10
- className?: string;
11
- inputClassName?: string;
12
- labelClassName?: string;
13
- error?: string;
14
- errorClassName?: string;
15
- id?: string;
16
- }
17
-
18
-
19
- const CustomInputField: React.FC<CustomInputFieldProps> = ({
20
- label,
21
- value = '',
22
- type = INPUT_TYPES.TEXT,
23
- placeholder = '',
24
- onChange,
25
- className = '',
26
- inputClassName = '',
27
- labelClassName = '',
28
- error = '',
29
- errorClassName = '',
30
- ...rest
31
- }) => {
32
- return (
33
- <div className={className}>
34
- {label && <label className={labelClassName}>{label}</label>}
35
- <input
36
- type={type}
37
- value={value}
38
- placeholder={placeholder}
39
- onChange={onChange}
40
- className={inputClassName}
41
- {...rest}
42
- />
43
- {error && <div className={errorClassName}>{error}</div>}
44
- </div>
45
- );
46
- };
47
-
48
- export default CustomInputField;
@@ -1 +0,0 @@
1
- export { default } from "./InputTextField";
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import Link, { LinkProps } from './Link';
4
- import { LINK_TARGET } from '../Enum';
5
-
6
- describe('Link Component', () => {
7
- const defaultProps: LinkProps = {
8
- href: 'https://example.com',
9
- target: LINK_TARGET.Self,
10
- rel: 'noopener noreferrer',
11
- className: 'custom-link',
12
- children: 'Click here',
13
- };
14
-
15
- it('renders the link with the correct href', () => {
16
- render(<Link {...defaultProps} />);
17
- expect(screen.getByText('Click here')).toHaveAttribute('href', 'https://example.com');
18
- });
19
-
20
- it('renders the link with the correct target attribute', () => {
21
- render(<Link {...defaultProps} />);
22
- expect(screen.getByText('Click here')).toHaveAttribute('target', LINK_TARGET.Self);
23
- });
24
-
25
- it('renders the link with the correct rel attribute', () => {
26
- render(<Link {...defaultProps} />);
27
- expect(screen.getByText('Click here')).toHaveAttribute('rel', 'noopener noreferrer');
28
- });
29
-
30
- it('renders the link with the correct className', () => {
31
- render(<Link {...defaultProps} />);
32
- expect(screen.getByText('Click here')).toHaveClass('custom-link');
33
- });
34
-
35
- it('renders the link with the correct children', () => {
36
- render(<Link {...defaultProps} />);
37
- expect(screen.getByText('Click here')).toBeInTheDocument();
38
- });
39
-
40
- it('renders with default target when not specified', () => {
41
- const propsWithoutTarget: Omit<LinkProps, 'target'> = {
42
- href: defaultProps.href,
43
- rel: defaultProps.rel,
44
- className: defaultProps.className,
45
- children: defaultProps.children,
46
- };
47
- render(<Link {...propsWithoutTarget} />);
48
- expect(screen.getByText('Click here')).toHaveAttribute('target', LINK_TARGET.Self);
49
- });
50
-
51
- it('applies additional props to the link element', () => {
52
- render(<Link {...defaultProps} data-testid="custom-link" />);
53
- expect(screen.getByTestId('custom-link')).toBeInTheDocument();
54
- });
55
- });
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { LINK_TARGET } from '../Enum';
3
-
4
- export interface LinkProps {
5
- href: string;
6
- target?:string ;
7
- rel?: string;
8
- className?: string;
9
- children?: React.ReactNode;
10
- }
11
-
12
- const Link: React.FC<LinkProps> = ({
13
- href,
14
- target = LINK_TARGET.Self,
15
- rel,
16
- className = '',
17
- children,
18
- ...rest
19
- }) => {
20
- return (
21
- <a
22
- href={href}
23
- target={target}
24
- rel={rel}
25
- className={className}
26
- {...rest}
27
- >
28
- {children}
29
- </a>
30
- );
31
- };
32
-
33
- export default Link;
@@ -1 +0,0 @@
1
- export { default } from "./Link";
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
-
3
- interface GetDirectionActionProps {
4
- title: string;
5
- titleClasses?: string;
6
- location: string;
7
- locationClasses?: string;
8
- hours: string;
9
- hoursClasses?: string;
10
- directionsLink: string;
11
- buttonName?: string;
12
- }
13
-
14
- const GetDirectionAction: React.FC<GetDirectionActionProps> = ({
15
- title,
16
- titleClasses,
17
- location,
18
- locationClasses,
19
- hours,
20
- hoursClasses,
21
- directionsLink,
22
- buttonName = 'Get Directions',
23
- }) => {
24
- return (
25
- <div className="direction-action-container">
26
- <h3 className={titleClasses}>{title}</h3>
27
- <p className={locationClasses}>{location}</p>
28
- <p className={hoursClasses}>{hours}</p>
29
- <a href={directionsLink} target="_blank" rel="noopener noreferrer" className="directions-link">
30
- {buttonName}
31
- </a>
32
- </div>
33
- );
34
- };
35
-
36
- export default GetDirectionAction;
@@ -1,5 +0,0 @@
1
- .mapContainerStyle{
2
- width: 100%;
3
- height: 100%;
4
- position: absolute;
5
- }