dhre-component-lib 0.1.6 → 0.1.8

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 (145) hide show
  1. package/{src/components/Badge → dist}/Badge.module.scss +0 -1
  2. package/{src/components/BreadCrumb → dist}/Breadcrumb.module.scss +0 -3
  3. package/{src/components/Button → dist}/Button.module.scss +3 -16
  4. package/{src/components/CircularProgress → dist}/CircularProgress.module.scss +0 -1
  5. package/dist/assets/output-4Fi7j5sB.css +247 -0
  6. package/dist/components/Avatar/Avatar.d.ts +9 -0
  7. package/dist/components/Avatar/Avatar.test.d.ts +1 -0
  8. package/dist/components/Avatar/index.d.ts +1 -0
  9. package/dist/components/Badge/Badge.d.ts +8 -0
  10. package/dist/components/Badge/Badge.test.d.ts +1 -0
  11. package/dist/components/Badge/index.d.ts +1 -0
  12. package/dist/components/BreadCrumb/BreadCrumb.d.ts +14 -0
  13. package/dist/components/BreadCrumb/BreadCrumb.test.d.ts +1 -0
  14. package/dist/components/BreadCrumb/index.d.ts +1 -0
  15. package/dist/components/Button/Button.d.ts +10 -0
  16. package/dist/components/Button/Button.test.d.ts +1 -0
  17. package/dist/components/Button/index.d.ts +1 -0
  18. package/dist/components/Checkbox/Checkbox.d.ts +11 -0
  19. package/dist/components/Checkbox/Checkbox.test.d.ts +1 -0
  20. package/dist/components/Checkbox/index.d.ts +1 -0
  21. package/dist/components/CircularProgress/CircularProgress.d.ts +10 -0
  22. package/dist/components/CircularProgress/CircularProgress.test.d.ts +1 -0
  23. package/dist/components/CircularProgress/index.d.ts +1 -0
  24. package/dist/components/Divider/Divider.d.ts +8 -0
  25. package/dist/components/Divider/Divider.test.d.ts +1 -0
  26. package/dist/components/Divider/index.d.ts +1 -0
  27. package/dist/components/Enum.d.ts +17 -0
  28. package/dist/components/InputTextField/InputTextField.d.ts +16 -0
  29. package/dist/components/InputTextField/InputTextField.test.d.ts +1 -0
  30. package/dist/components/InputTextField/index.d.ts +1 -0
  31. package/dist/components/Link/Link.d.ts +10 -0
  32. package/dist/components/Link/Link.test.d.ts +1 -0
  33. package/dist/components/Link/index.d.ts +1 -0
  34. package/dist/components/Map/Directions.d.ts +13 -0
  35. package/dist/components/Map/GoogleMap.d.ts +12 -0
  36. package/dist/components/Map/GoogleMapsLoader.d.ts +4 -0
  37. package/dist/components/Modal/Modal.d.ts +10 -0
  38. package/dist/components/Modal/Modal.test.d.ts +1 -0
  39. package/dist/components/Modal/index.d.ts +1 -0
  40. package/dist/components/Notification/Notification.d.ts +10 -0
  41. package/dist/components/Notification/Notification.test.d.ts +1 -0
  42. package/dist/components/Notification/index.d.ts +1 -0
  43. package/dist/components/OtpInput/OtpInput.d.ts +14 -0
  44. package/dist/components/OtpInput/OtpInput.test.d.ts +1 -0
  45. package/dist/components/OtpInput/index.d.ts +1 -0
  46. package/dist/components/PdfView/PdfView.d.ts +18 -0
  47. package/dist/components/PdfView/PdfView.test.d.ts +1 -0
  48. package/dist/components/PdfView/index.d.ts +1 -0
  49. package/dist/components/Progress/Progress.d.ts +12 -0
  50. package/dist/components/Progress/Progress.test.d.ts +1 -0
  51. package/dist/components/Progress/index.d.ts +1 -0
  52. package/dist/components/RadioButton/RadioButton.d.ts +14 -0
  53. package/dist/components/RadioButton/RadioButton.test.d.ts +1 -0
  54. package/dist/components/RadioButton/index.d.ts +1 -0
  55. package/dist/components/Switch/Switch.d.ts +13 -0
  56. package/dist/components/Switch/Switch.test.d.ts +1 -0
  57. package/dist/components/Switch/index.d.ts +1 -0
  58. package/dist/components/Tag/Tag.d.ts +9 -0
  59. package/dist/components/Tag/Tag.test.d.ts +1 -0
  60. package/dist/components/Tag/index.d.ts +1 -0
  61. package/dist/components/Tooltip/Tooltip.d.ts +9 -0
  62. package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
  63. package/dist/components/Tooltip/index.d.ts +1 -0
  64. package/dist/dist/styles.css +2 -0
  65. package/dist/dist/styles.css.map +1 -0
  66. package/dist/index.d.ts +15 -0
  67. package/dist/index.esm.js +9323 -0
  68. package/dist/index.esm.js.map +1 -0
  69. package/dist/index.js +9359 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/theme/colors.d.ts +1 -0
  72. package/package.json +17 -7
  73. package/src/__mocks__/styleMock.js +0 -1
  74. package/src/components/Avatar/Avatar.test.tsx +0 -53
  75. package/src/components/Avatar/Avatar.tsx +0 -28
  76. package/src/components/Avatar/index.ts +0 -1
  77. package/src/components/Badge/Badge.test.tsx +0 -59
  78. package/src/components/Badge/Badge.tsx +0 -25
  79. package/src/components/Badge/index.ts +0 -1
  80. package/src/components/BreadCrumb/BreadCrumb.test.tsx +0 -90
  81. package/src/components/BreadCrumb/BreadCrumb.tsx +0 -45
  82. package/src/components/BreadCrumb/index.ts +0 -1
  83. package/src/components/Button/Button.test.tsx +0 -49
  84. package/src/components/Button/Button.tsx +0 -29
  85. package/src/components/Button/index.ts +0 -1
  86. package/src/components/Checkbox/Checkbox.test.tsx +0 -93
  87. package/src/components/Checkbox/Checkbox.tsx +0 -35
  88. package/src/components/Checkbox/index.ts +0 -1
  89. package/src/components/CircularProgress/CircularProgress.test.tsx +0 -39
  90. package/src/components/CircularProgress/CircularProgress.tsx +0 -37
  91. package/src/components/CircularProgress/index.ts +0 -1
  92. package/src/components/Divider/Divider.test.tsx +0 -44
  93. package/src/components/Divider/Divider.tsx +0 -24
  94. package/src/components/Divider/index.ts +0 -1
  95. package/src/components/Enum.ts +0 -19
  96. package/src/components/InputTextField/InputTextField.test.tsx +0 -118
  97. package/src/components/InputTextField/InputTextField.tsx +0 -48
  98. package/src/components/InputTextField/index.ts +0 -1
  99. package/src/components/Link/Link.test.tsx +0 -55
  100. package/src/components/Link/Link.tsx +0 -33
  101. package/src/components/Link/index.ts +0 -1
  102. package/src/components/Map/Directions.tsx +0 -36
  103. package/src/components/Map/GoogleMap.tsx +0 -186
  104. package/src/components/Map/GoogleMapsLoader.tsx +0 -12
  105. package/src/components/Modal/Modal.test.tsx +0 -74
  106. package/src/components/Modal/Modal.tsx +0 -39
  107. package/src/components/Modal/index.ts +0 -1
  108. package/src/components/Notification/Notification.test.tsx +0 -53
  109. package/src/components/Notification/Notification.tsx +0 -42
  110. package/src/components/Notification/index.ts +0 -1
  111. package/src/components/OtpInput/OtpInput.test.tsx +0 -53
  112. package/src/components/OtpInput/OtpInput.tsx +0 -137
  113. package/src/components/OtpInput/index.ts +0 -1
  114. package/src/components/PdfView/PdfView.test.tsx +0 -52
  115. package/src/components/PdfView/PdfView.tsx +0 -116
  116. package/src/components/PdfView/index.ts +0 -1
  117. package/src/components/Progress/Progress.test.tsx +0 -43
  118. package/src/components/Progress/Progress.tsx +0 -35
  119. package/src/components/Progress/index.ts +0 -1
  120. package/src/components/RadioButton/RadioButton.test.tsx +0 -56
  121. package/src/components/RadioButton/RadioButton.tsx +0 -43
  122. package/src/components/RadioButton/index.ts +0 -1
  123. package/src/components/Switch/Switch.test.tsx +0 -83
  124. package/src/components/Switch/Switch.tsx +0 -38
  125. package/src/components/Switch/index.ts +0 -1
  126. package/src/components/Tag/Tag.css +0 -14
  127. package/src/components/Tag/Tag.test.tsx +0 -61
  128. package/src/components/Tag/Tag.tsx +0 -19
  129. package/src/components/Tag/index.ts +0 -1
  130. package/src/components/Tooltip/Tooltip.test.tsx +0 -68
  131. package/src/components/Tooltip/Tooltip.tsx +0 -38
  132. package/src/components/Tooltip/index.ts +0 -1
  133. package/src/components/index.ts +0 -15
  134. package/src/index.ts +0 -1
  135. package/src/theme/colors.ts +0 -3
  136. package/src/typings.d.ts +0 -1
  137. /package/{src/components/Map → dist}/GoogleMap.module.scss +0 -0
  138. /package/{src/components/Modal → dist}/Modal.module.scss +0 -0
  139. /package/{src/components/Notification → dist}/Notification.module.scss +0 -0
  140. /package/{src/components/OtpInput → dist}/OtpInput.module.scss +0 -0
  141. /package/{src/components/PdfView → dist}/PdfView.module.scss +0 -0
  142. /package/{src/components/Tooltip → dist}/Tooltip.module.scss +0 -0
  143. /package/{src/theme/colors → dist}/colors.scss +0 -0
  144. /package/{src/components/Map/index.ts → dist/components/Map/index.d.ts} +0 -0
  145. /package/{src/theme/Typography → dist}/typography.scss +0 -0
@@ -1 +0,0 @@
1
- export { default } from "./RadioButton";
@@ -1,83 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import Switch from './Switch';
5
-
6
- describe('Switch Component', () => {
7
- it('renders with basic props', () => {
8
- const { container } = render(<Switch checked={true} handleChange={() => {}} switchClassName="switch-class" />);
9
-
10
- const switchInput = screen.getByRole('checkbox');
11
- const switchToggle = container.querySelector('.switch-class');
12
-
13
- expect(switchInput).toBeInTheDocument();
14
- expect(switchInput).toBeChecked();
15
- expect(switchToggle).toBeInTheDocument();
16
- });
17
-
18
- it('renders with a label', () => {
19
- render(
20
- <Switch
21
- checked={true}
22
- handleChange={() => {}}
23
- switchClassName="switch-class"
24
- label="Toggle Switch"
25
- labelClassName="label-class"
26
- />
27
- );
28
-
29
- const label = screen.getByText('Toggle Switch');
30
- const switchInput = screen.getByRole('checkbox');
31
-
32
- expect(label).toBeInTheDocument();
33
- expect(label).toHaveClass('label-class');
34
- expect(switchInput).toBeChecked();
35
- });
36
-
37
- it('calls handleChange handler when clicked', () => {
38
- // Simulate a component that manages its own state
39
- const TestComponent = () => {
40
- const [checked, setChecked] = useState(false);
41
- return (
42
- <Switch
43
- checked={checked}
44
- handleChange={() => setChecked(!checked)}
45
- switchClassName="switch-class"
46
- />
47
- );
48
- };
49
-
50
- render(<TestComponent />);
51
-
52
- const switchInput = screen.getByRole('checkbox');
53
- expect(switchInput).not.toBeChecked();
54
-
55
- // Simulate the click event
56
- fireEvent.click(switchInput);
57
-
58
- // Check if the switchInput is now checked
59
- expect(switchInput).toBeChecked();
60
- });
61
-
62
- it('applies custom classes', () => {
63
- const { container } = render(
64
- <Switch
65
- checked={true}
66
- handleChange={() => {}}
67
- switchClassName="switch-class"
68
- containerClassName="container-class"
69
- toggleClassName="toggle-class"
70
- label="Toggle Switch"
71
- labelClassName="label-class"
72
- />
73
- );
74
-
75
- const containerDiv = container.querySelector('.container-class');
76
- const switchToggle = container.querySelector('.switch-class');
77
- const label = screen.getByText('Toggle Switch');
78
-
79
- expect(containerDiv).toHaveClass('container-class');
80
- expect(switchToggle).toHaveClass('switch-class');
81
- expect(label).toHaveClass('label-class');
82
- });
83
- });
@@ -1,38 +0,0 @@
1
- import React from "react";
2
- import './Switch.css';
3
-
4
- export interface SwitchProps {
5
- checked: boolean;
6
- handleChange: () => void;
7
- switchClassName: string;
8
- label?: string;
9
- labelClassName?: string;
10
- containerClassName?: string;
11
- toggleClassName?:string,
12
- }
13
-
14
- const Switch: React.FC<SwitchProps> = ({
15
- checked,
16
- handleChange,
17
- switchClassName,
18
- label,
19
- labelClassName,
20
- containerClassName,
21
- toggleClassName
22
- }) => {
23
- return (
24
- <div className={containerClassName}>
25
- {label && <span className={labelClassName}>{label}</span>}
26
- <label className={toggleClassName}>
27
- <input
28
- type="checkbox"
29
- checked={checked}
30
- onChange={handleChange}
31
- />
32
- <span className={switchClassName}></span>
33
- </label>
34
- </div>
35
- );
36
- };
37
-
38
- export default Switch;
@@ -1 +0,0 @@
1
- export { default } from "./Switch";
@@ -1,14 +0,0 @@
1
- .customTagClass {
2
- display: inline-block;
3
- padding: 5px 10px;
4
- background-color: #f0f0f0;
5
- color: #333;
6
- border-radius: 12px;
7
- font-size: 14px;
8
- cursor: pointer;
9
- margin-right: 8px;
10
-
11
- &:hover {
12
- background-color: #e0e0e0;
13
- }
14
- }
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import Tag, { TagProps } from './Tag';
5
-
6
- describe('Tag Component', () => {
7
- let handleClick: jest.Mock;
8
-
9
- beforeEach(() => {
10
- handleClick = jest.fn(); // Reset the mock function before each test
11
- });
12
-
13
- // Function to generate default props for each test
14
- const getDefaultProps = (): TagProps => ({
15
- content: 'Sample Tag',
16
- tagClassName: 'tag-class',
17
- handleClick,
18
- });
19
-
20
- it('renders the tag with the correct content', () => {
21
- render(<Tag {...getDefaultProps()} />);
22
-
23
- const tagElement = screen.getByText('Sample Tag');
24
-
25
- expect(tagElement).toBeInTheDocument();
26
- });
27
-
28
- it('applies the correct className to the tag', () => {
29
- render(<Tag {...getDefaultProps()} />);
30
-
31
- const tagElement = screen.getByText('Sample Tag');
32
-
33
- expect(tagElement).toHaveClass('tag-class');
34
- });
35
-
36
- it('calls the handleClick function when the tag is clicked', () => {
37
- render(<Tag {...getDefaultProps()} />);
38
-
39
- const tagElement = screen.getByText('Sample Tag');
40
-
41
- fireEvent.click(tagElement);
42
-
43
- expect(handleClick).toHaveBeenCalledTimes(1);
44
- });
45
-
46
- it('does not call handleClick when the tag is not clicked', () => {
47
- render(<Tag {...getDefaultProps()} />);
48
-
49
- expect(handleClick).not.toHaveBeenCalled();
50
- });
51
-
52
- it('renders correctly with different content', () => {
53
- const newContent = 'New Tag Content';
54
- render(<Tag {...getDefaultProps()} content={newContent} />);
55
-
56
- const tagElement = screen.getByText(newContent);
57
-
58
- expect(tagElement).toBeInTheDocument();
59
- expect(tagElement).toHaveTextContent(newContent);
60
- });
61
- });
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import styles from "./Tag.module.scss";
3
-
4
- export interface TagProps {
5
- content: string | number;
6
- tagClassName?: string; // Optional prop for custom class name
7
- handleClick?: () => void;
8
- style?: React.CSSProperties; // Inline styles as props
9
- }
10
-
11
- const Tag: React.FC<TagProps> = ({ content, tagClassName = styles.customTagClass, handleClick, style }) => {
12
- return (
13
- <button onClick={handleClick} style={style} className={tagClassName}>
14
- {content}
15
- </button>
16
- );
17
- };
18
-
19
- export default Tag;
@@ -1 +0,0 @@
1
- export { default } from "./Tag";
@@ -1,68 +0,0 @@
1
- import React from "react";
2
- import { render, screen, fireEvent } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import Tooltip, { TooltipProps } from "./Tooltip";
5
-
6
- describe("Tooltip Component", () => {
7
- const defaultProps: TooltipProps = {
8
- content: "Tooltip content",
9
- tooltipClassName: "tooltip-class",
10
- children: <button>Hover me</button>,
11
- };
12
-
13
- it("renders the children correctly", () => {
14
- render(<Tooltip {...defaultProps} />);
15
-
16
- const childElement = screen.getByText("Hover me");
17
-
18
- expect(childElement).toBeInTheDocument();
19
- });
20
-
21
- it("does not show tooltip content by default", () => {
22
- render(<Tooltip {...defaultProps} />);
23
-
24
- const tooltipElement = screen.queryByText(defaultProps.content);
25
-
26
- expect(tooltipElement).not.toBeInTheDocument();
27
- });
28
-
29
- it("shows tooltip content on mouse enter and hides it on mouse leave", () => {
30
- render(<Tooltip {...defaultProps} />);
31
-
32
- const childElement = screen.getByText("Hover me");
33
-
34
- // Trigger mouse enter
35
- fireEvent.mouseEnter(childElement);
36
- let tooltipElement = screen.queryByText(defaultProps.content);
37
- expect(tooltipElement).toBeInTheDocument();
38
- expect(tooltipElement).toHaveClass(defaultProps.tooltipClassName);
39
-
40
- // Trigger mouse leave
41
- fireEvent.mouseLeave(childElement);
42
- tooltipElement = screen.queryByText(defaultProps.content);
43
-
44
- // Ensure tooltipElement is null if it was not found
45
- expect(tooltipElement).toBeNull();
46
- });
47
-
48
- it("applies the correct container className", () => {
49
- const customClassName = "custom-container-class";
50
- render(<Tooltip {...defaultProps} containerClassName={customClassName} />);
51
-
52
- const containerElement = screen.getByText("Hover me").parentElement;
53
-
54
- expect(containerElement).toHaveClass(customClassName);
55
- });
56
-
57
- it("handles tooltip visibility correctly", () => {
58
- render(<Tooltip {...defaultProps} />);
59
-
60
- const childElement = screen.getByText("Hover me");
61
-
62
- fireEvent.mouseEnter(childElement);
63
-
64
- const tooltipElement = screen.queryByText(defaultProps.content);
65
-
66
- expect(tooltipElement).toBeInTheDocument();
67
- });
68
- });
@@ -1,38 +0,0 @@
1
- import React, { useState } from "react";
2
- import styles from './Tooltip.module.scss';
3
-
4
- export interface TooltipProps {
5
- content: string;
6
- tooltipClassName: string;
7
- children: React.ReactNode;
8
- containerClassName?: string;
9
- }
10
-
11
- const Tooltip: React.FC<TooltipProps> = ({
12
- content,
13
- tooltipClassName,
14
- children,
15
- containerClassName = "",
16
- }) => {
17
- const [visible, setVisible] = useState(false);
18
-
19
- const showTooltip = () => setVisible(true);
20
- const hideTooltip = () => setVisible(false);
21
-
22
- return (
23
- <div
24
- className={`${styles.tooltipWrapper} ${containerClassName}`}
25
- onMouseEnter={showTooltip}
26
- onMouseLeave={hideTooltip}
27
- >
28
- {children}
29
- {visible && (
30
- <div className={`${styles.customTooltipClass} ${tooltipClassName}`}>
31
- {content}
32
- </div>
33
- )}
34
- </div>
35
- );
36
- };
37
-
38
- export default Tooltip;
@@ -1 +0,0 @@
1
- export { default } from "./Tooltip";
@@ -1,15 +0,0 @@
1
- export { default as Button } from "./Button";
2
- export { default as Avatar } from "./Avatar";
3
- export { default as Badge } from "./Badge";
4
- export { default as BreadCrumb } from "./BreadCrumb";
5
- export { default as Checkbox } from "./Checkbox";
6
- export { default as CircularProgress } from "./CircularProgress";
7
- export { default as Divider } from "./Divider";
8
- export { default as Link } from "./Link";
9
- export { default as Progress } from "./Progress";
10
- export { default as RadioButton } from "./RadioButton";
11
- export { default as InputTextField } from "./InputTextField";
12
- export { default } from "./PdfView";
13
- export { default as Directions } from "./Map/Directions";
14
- export { default as GoogleMap } from "./Map/GoogleMap";
15
- export { default as OtpInput } from "./OtpInput/OtpInput";
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components';
@@ -1,3 +0,0 @@
1
- // format: Color name: BRAND_800
2
-
3
- export const COLORS = {};
package/src/typings.d.ts DELETED
@@ -1 +0,0 @@
1
- declare module '*.scss';
File without changes
File without changes