dhre-component-lib 0.2.3 → 0.2.4

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.
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './Badge.module.scss';
2
3
  export interface BadgeProps {
3
4
  content: string | number;
4
5
  badgeClassName?: string;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './Breadcrumb.module.scss';
2
3
  export interface BreadcrumbItem {
3
4
  label: string;
4
5
  handleClick?: () => void;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './Button.module.scss';
2
3
  export interface ButtonProps {
3
4
  label: string;
4
5
  variant: 'text' | 'outlined' | 'contained';
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import './CircularProgress.module.scss';
2
3
  export interface CircularProgressProps {
3
4
  value?: number;
4
5
  variant?: 'determinate' | 'indeterminate';
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './GoogleMap.module.scss';
2
3
  export interface MapComponentProps {
3
4
  containerClassName?: string;
4
5
  zoom?: number;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './PdfView.module.scss';
2
3
  export interface PdfViewerProps {
3
4
  content: string;
4
5
  contentType?: string;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import "./Tag.module.scss";
2
3
  export interface TagProps {
3
4
  content: string | number;
4
5
  tagClassName?: string;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import './Tooltip.module.scss';
2
3
  export interface TooltipProps {
3
4
  content: string;
4
5
  tooltipClassName: string;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,166 @@
1
- export { default as Button } from "./components/Button";
2
- export { default as Avatar } from "./components/Avatar";
3
- export { default as Badge } from "./components/Badge";
4
- export { default as BreadCrumb } from "./components/BreadCrumb";
5
- export { default as Checkbox } from "./components/Checkbox";
6
- export { default as CircularProgress } from "./components/CircularProgress";
7
- export { default as Divider } from "./components/Divider";
8
- export { default as Link } from "./components/Link";
9
- export { default as Progress } from "./components/Progress";
10
- export { default as RadioButton } from "./components/RadioButton";
11
- export { default as InputTextField } from "./components/InputTextField";
12
- export { default } from "./components/PdfView";
13
- export { default as Directions } from "./components/Map/Directions";
14
- export { default as GoogleMap } from "./components/Map/GoogleMap";
15
- export { default as OtpInput } from "./components/OtpInput/OtpInput";
1
+ import React from 'react';
2
+
3
+ interface ButtonProps {
4
+ label: string;
5
+ variant: 'text' | 'outlined' | 'contained';
6
+ color: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info';
7
+ size: 'small' | 'medium' | 'large';
8
+ handleClick: () => void;
9
+ }
10
+ declare const Button: React.FC<ButtonProps>;
11
+
12
+ interface AvatarProps {
13
+ src: string;
14
+ alt: string;
15
+ imgClassName: string;
16
+ handleClick?: () => void;
17
+ }
18
+ declare const Avatar: React.FC<AvatarProps>;
19
+
20
+ interface BadgeProps {
21
+ content: string | number;
22
+ badgeClassName?: string;
23
+ handleClick?: () => void;
24
+ }
25
+ declare const Badge: React.FC<BadgeProps>;
26
+
27
+ interface BreadcrumbItem {
28
+ label: string;
29
+ handleClick?: () => void;
30
+ }
31
+ interface BreadcrumbProps {
32
+ items: BreadcrumbItem[];
33
+ breadcrumbClassName: string;
34
+ itemClassName?: string;
35
+ separator?: string;
36
+ separatorClassName?: string;
37
+ }
38
+ declare const Breadcrumb: React.FC<BreadcrumbProps>;
39
+
40
+ interface CustomCheckboxProps {
41
+ label?: string;
42
+ checked?: boolean;
43
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
44
+ className?: string;
45
+ checkboxClassName?: string;
46
+ labelClassName?: string;
47
+ }
48
+ declare const CustomCheckbox: React.FC<CustomCheckboxProps>;
49
+
50
+ interface CircularProgressProps {
51
+ value?: number;
52
+ variant?: 'determinate' | 'indeterminate';
53
+ color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
54
+ thickness?: number;
55
+ size?: number | string;
56
+ }
57
+ declare const CircularProgress: React.FC<CircularProgressProps>;
58
+
59
+ interface CustomDividerProps {
60
+ orientation?: string;
61
+ className?: string;
62
+ dividerClassName?: string;
63
+ }
64
+ declare const CustomDivider: React.FC<CustomDividerProps>;
65
+
66
+ interface LinkProps {
67
+ href: string;
68
+ target?: string;
69
+ rel?: string;
70
+ className?: string;
71
+ children?: React.ReactNode;
72
+ }
73
+ declare const Link: React.FC<LinkProps>;
74
+
75
+ interface ProgressProps {
76
+ value: number;
77
+ max: number;
78
+ className?: string;
79
+ barContainerClassName?: string;
80
+ barClassName?: string;
81
+ labelClassName?: string;
82
+ label?: string;
83
+ }
84
+ declare const Progress: React.FC<ProgressProps>;
85
+
86
+ interface RadioButtonProps {
87
+ name: string;
88
+ value: string;
89
+ checked?: boolean;
90
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
91
+ className?: string;
92
+ inputClassName?: string;
93
+ labelClassName?: string;
94
+ id?: string;
95
+ [key: string]: any;
96
+ }
97
+ declare const CustomRadioButton: React.FC<RadioButtonProps>;
98
+
99
+ interface CustomInputFieldProps {
100
+ label?: string;
101
+ value?: string;
102
+ type?: string;
103
+ placeholder?: string;
104
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
105
+ className?: string;
106
+ inputClassName?: string;
107
+ labelClassName?: string;
108
+ error?: string;
109
+ errorClassName?: string;
110
+ id?: string;
111
+ }
112
+ declare const CustomInputField: React.FC<CustomInputFieldProps>;
113
+
114
+ interface PdfViewerProps {
115
+ content: string;
116
+ contentType?: string;
117
+ buttonText?: string;
118
+ loadingText?: string;
119
+ errorText?: string;
120
+ cleanUpDelay?: number;
121
+ buttonVariant?: "text" | "outlined" | "contained";
122
+ buttonColor?: "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
123
+ buttonSize?: "small" | "medium" | "large";
124
+ showLoadingSpinner?: boolean;
125
+ spinnerSize?: number;
126
+ spinnerColor?: "inherit" | "primary" | "secondary";
127
+ className?: string;
128
+ }
129
+ declare const PdfView: React.FC<PdfViewerProps>;
130
+
131
+ interface GetDirectionActionProps {
132
+ title: string;
133
+ titleClasses?: string;
134
+ location: string;
135
+ locationClasses?: string;
136
+ hours: string;
137
+ hoursClasses?: string;
138
+ directionsLink: string;
139
+ buttonName?: string;
140
+ }
141
+ declare const GetDirectionAction: React.FC<GetDirectionActionProps>;
142
+
143
+ interface MapComponentProps {
144
+ containerClassName?: string;
145
+ zoom?: number;
146
+ mapOptions?: google.maps.MapOptions;
147
+ radius?: number;
148
+ googleMapsUrls: string[];
149
+ buttonText: string;
150
+ buttonClassName: string;
151
+ }
152
+ declare const MapComponent: React.FC<MapComponentProps>;
153
+
154
+ interface OTPInputProps {
155
+ length?: number;
156
+ onChange: (otp: string) => void;
157
+ autoFocus?: boolean;
158
+ onResend: () => void;
159
+ resendDelay?: number;
160
+ error?: boolean;
161
+ errorText?: string;
162
+ resendText: string;
163
+ }
164
+ declare const OTPInput: React.FC<OTPInputProps>;
165
+
166
+ export { Avatar, Badge, Breadcrumb as BreadCrumb, Button, CustomCheckbox as Checkbox, CircularProgress, GetDirectionAction as Directions, CustomDivider as Divider, MapComponent as GoogleMap, CustomInputField as InputTextField, Link, OTPInput as OtpInput, Progress, CustomRadioButton as RadioButton, PdfView as default };
package/dist/index.esm.js CHANGED
@@ -3,10 +3,13 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import * as ReactDOM from 'react-dom';
4
4
  import { createPortal } from 'react-dom';
5
5
 
6
- var styles$5 = {};
6
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
7
+
8
+ var css$6 = ".button {\n padding: 8px 16px;\n font-size: 14px;\n border-radius: 4px;\n border: none;\n cursor: pointer;\n transition: background-color 0.3s ease;\n}\n.button.text {\n background-color: transparent;\n color: inherit;\n}\n.button.outlined {\n background-color: transparent;\n border: 2px solid currentColor;\n}\n.button.contained {\n background-color: currentColor;\n color: #fff;\n}\n.button.contained.primary:hover {\n background-color: #1565c0;\n}\n.button.contained.secondary:hover {\n background-color: #7b1fa2;\n}\n.button.contained.success:hover {\n background-color: #388e3c;\n}\n.button.contained.error:hover {\n background-color: #d32f2f;\n}\n.button.contained.warning:hover {\n background-color: #f57c00;\n}\n.button.contained.info:hover {\n background-color: #1976d2;\n}\n.button.primary {\n color: #1976d2;\n}\n.button.secondary {\n color: #9c27b0;\n}\n.button.success {\n color: #4caf50;\n}\n.button.error {\n color: #f44336;\n}\n.button.warning {\n color: yellow;\n}";
9
+ n(css$6,{});
7
10
 
8
11
  const Button = ({ label, variant, color, size, handleClick, }) => {
9
- return (React.createElement("button", { onClick: handleClick, className: `${styles$5.button} ${styles$5[variant]} ${styles$5[color]} ${styles$5[size]}` }, label));
12
+ return (React.createElement("button", { onClick: handleClick, className: `${'button'} ${variant} ${color} ${size}` }, label));
10
13
  };
11
14
 
12
15
  const Avatar = ({ src, alt, imgClassName, handleClick, }) => {
@@ -14,18 +17,20 @@ const Avatar = ({ src, alt, imgClassName, handleClick, }) => {
14
17
  React.createElement("img", { src: src, alt: alt, className: imgClassName })));
15
18
  };
16
19
 
17
- var styles$4 = {};
20
+ var css$5 = ".badge {\n display: inline-block;\n padding: 6px 12px;\n background-color: red;\n color: white;\n border-radius: 12px;\n font-size: 14px;\n text-align: center;\n cursor: pointer;\n}\n.badge:hover {\n background-color: darkred;\n}";
21
+ n(css$5,{});
18
22
 
19
23
  const Badge = ({ content, badgeClassName, handleClick, }) => {
20
- return (React.createElement("button", { onClick: handleClick, className: `${styles$4.badge} ${badgeClassName}` }, content));
24
+ return (React.createElement("button", { onClick: handleClick, className: `${'badge'} ${badgeClassName}` }, content));
21
25
  };
22
26
 
23
- var styles$3 = {};
27
+ var css$4 = ".breadcrumb {\n display: flex;\n align-items: center;\n font-size: 16px;\n}\n\n.breadcrumbItem {\n color: blue;\n cursor: pointer;\n margin-right: 8px;\n}\n.breadcrumbItem:hover {\n text-decoration: underline;\n}\n\n.separator {\n margin: 0 8px;\n color: grey;\n}";
28
+ n(css$4,{});
24
29
 
25
30
  const Breadcrumb = ({ items, breadcrumbClassName, itemClassName, separator = "/", separatorClassName, }) => {
26
- return (React.createElement("nav", { className: `${styles$3.breadcrumb} ${breadcrumbClassName}` }, items.map((item, index) => (React.createElement(React.Fragment, { key: index },
27
- React.createElement("button", { className: `${styles$3.breadcrumbItem} ${itemClassName}`, onClick: item.handleClick }, item.label),
28
- index < items.length - 1 && (React.createElement("span", { className: `${styles$3.separator} ${separatorClassName}` }, separator)))))));
31
+ return (React.createElement("nav", { className: `${'breadcrumb'} ${breadcrumbClassName}` }, items.map((item, index) => (React.createElement(React.Fragment, { key: index },
32
+ React.createElement("button", { className: `${'breadcrumbItem'} ${itemClassName}`, onClick: item.handleClick }, item.label),
33
+ index < items.length - 1 && (React.createElement("span", { className: `${'separator'} ${separatorClassName}` }, separator)))))));
29
34
  };
30
35
 
31
36
  const CustomCheckbox = ({ label, checked = false, onChange, className = '', checkboxClassName = '', labelClassName = '', ...rest }) => {
@@ -34,14 +39,15 @@ const CustomCheckbox = ({ label, checked = false, onChange, className = '', chec
34
39
  label && React.createElement("label", { className: labelClassName }, label)));
35
40
  };
36
41
 
37
- var styles$2 = {};
42
+ var css$3 = ".spinner {\n border-style: solid;\n border-radius: 50%;\n border-color: transparent;\n border-top-color: currentColor;\n animation: spin 1s linear infinite;\n}\n\n.spinner.primary {\n color: #007bff;\n}\n\n.spinner.secondary {\n color: #6c757d;\n}\n\n.spinner.error {\n color: #dc3545;\n}\n\n.spinner.success {\n color: #28a745;\n}\n\n.spinner.info {\n color: #17a2b8;\n}\n\n.spinner.warning {\n color: #ffc107;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}";
43
+ n(css$3,{});
38
44
 
39
45
  const CircularProgress = ({ value = 0, variant = 'indeterminate', color = 'primary', thickness = 4, size = 100, }) => {
40
46
  const isDeterminate = variant === 'determinate';
41
47
  const rotationStyle = isDeterminate
42
48
  ? { transform: `rotate(${(value / 100) * 360}deg)` }
43
49
  : {};
44
- return (React.createElement("div", { className: `${styles$2.spinner} ${styles$2[color]}`, style: {
50
+ return (React.createElement("div", { className: `${'spinner'} ${color}`, style: {
45
51
  width: typeof size === 'number' ? `${size}px` : size,
46
52
  height: typeof size === 'number' ? `${size}px` : size,
47
53
  borderWidth: `${thickness}px`,
@@ -97,7 +103,8 @@ const CustomInputField = ({ label, value = '', type = INPUT_TYPES.TEXT, placehol
97
103
  error && React.createElement("div", { className: errorClassName }, error)));
98
104
  };
99
105
 
100
- var styles$1 = {};
106
+ var css$2 = ".container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.spinner {\n border: 2px solid transparent;\n border-radius: 50%;\n border-top: 2px solid currentColor;\n animation: spin 1s linear infinite;\n}\n\n.spinnerInner {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n}\n\n.errorText {\n color: red;\n}\n\n.button {\n padding: 8px 16px;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 16px;\n}\n.button-text {\n background: none;\n}\n.button-outlined {\n border: 1px solid currentColor;\n}\n.button-contained {\n background-color: currentColor;\n color: white;\n}\n.button-primary {\n color: blue;\n}\n.button-secondary {\n color: gray;\n}\n.button-small {\n font-size: 12px;\n}\n.button-medium {\n font-size: 16px;\n}\n.button-large {\n font-size: 20px;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}";
107
+ n(css$2,{});
101
108
 
102
109
  const PdfView = ({ content, contentType = "application/pdf", buttonText = "View PDF", loadingText = "Loading...", errorText = "Failed to load PDF", cleanUpDelay = 1000, buttonVariant = "contained", buttonColor = "primary", buttonSize = "medium", showLoadingSpinner = false, spinnerSize = 24, spinnerColor = "primary", className = "", }) => {
103
110
  const [isLoading, setIsLoading] = React.useState(false);
@@ -142,16 +149,16 @@ const PdfView = ({ content, contentType = "application/pdf", buttonText = "View
142
149
  }
143
150
  };
144
151
  const buttonClass = `
145
- ${styles$1.button}
146
- ${styles$1[`button${buttonVariant.charAt(0).toUpperCase() + buttonVariant.slice(1)}`]}
147
- ${styles$1[`button${buttonColor.charAt(0).toUpperCase() + buttonColor.slice(1)}`]}
148
- ${styles$1[`button${buttonSize.charAt(0).toUpperCase() + buttonSize.slice(1)}`]}
152
+ ${'button'}
153
+ ${`button${buttonVariant.charAt(0).toUpperCase() + buttonVariant.slice(1)}`}
154
+ ${`button${buttonColor.charAt(0).toUpperCase() + buttonColor.slice(1)}`}
155
+ ${`button${buttonSize.charAt(0).toUpperCase() + buttonSize.slice(1)}`}
149
156
  `;
150
- const spinnerClass = `${styles$1.spinner} ${styles$1.spinnerInner}`;
151
- return (React.createElement("div", { className: `${styles$1.container} ${className}` },
157
+ const spinnerClass = `${'spinner'} ${'spinnerInner'}`;
158
+ return (React.createElement("div", { className: `${'container'} ${className}` },
152
159
  isLoading && showLoadingSpinner && (React.createElement("div", { "data-testid": "spinnertest", className: spinnerClass, style: { width: spinnerSize, height: spinnerSize, borderColor: spinnerColor } },
153
- React.createElement("div", { className: styles$1.spinnerInner }))),
154
- isError && React.createElement("p", { className: styles$1.errorText }, errorMsg),
160
+ React.createElement("div", { className: 'spinnerInner' }))),
161
+ isError && React.createElement("p", { className: 'errorText' }, errorMsg),
155
162
  !isLoading && !isError && (React.createElement("button", { onClick: handleViewPdf, className: buttonClass }, buttonText)),
156
163
  isLoading && !showLoadingSpinner && React.createElement("p", null, loadingText)));
157
164
  };
@@ -9151,7 +9158,8 @@ const useGoogleMapsLoader = () => {
9151
9158
  });
9152
9159
  };
9153
9160
 
9154
- var styles = {};
9161
+ var css$1 = ".mapContainerStyle {\n width: 100%;\n height: 100%;\n position: absolute;\n}";
9162
+ n(css$1,{});
9155
9163
 
9156
9164
  const MapComponent = ({ containerClassName = "map-container", zoom = 18, mapOptions = {
9157
9165
  zoomControl: true,
@@ -9226,7 +9234,7 @@ const MapComponent = ({ containerClassName = "map-container", zoom = 18, mapOpti
9226
9234
  if (mapVisible && location) {
9227
9235
  return (React.createElement("div", { className: containerClassName },
9228
9236
  React.createElement("button", { onClick: handleLocationRequest, className: buttonClassName }, buttonText),
9229
- React.createElement(GoogleMap, { mapContainerStyle: styles.mapContainerStyle, center: { lat: location.latitude, lng: location.longitude }, zoom: zoom, options: mapOptions, onLoad: (map) => {
9237
+ React.createElement(GoogleMap, { mapContainerClassName: "mapContainerStyle", center: { lat: location.latitude, lng: location.longitude }, zoom: zoom, options: mapOptions, onLoad: (map) => {
9230
9238
  mapRef.current = map;
9231
9239
  directionsRenderer.current = new google.maps.DirectionsRenderer();
9232
9240
  directionsRenderer.current.setMap(map);
@@ -9253,6 +9261,9 @@ const MapComponent = ({ containerClassName = "map-container", zoom = 18, mapOpti
9253
9261
  }
9254
9262
  };
9255
9263
 
9264
+ var css = ".otpMainContainer {\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 10px;\n width: 343px;\n}\n\n.otpInputDiv {\n flex-direction: row;\n gap: 12px;\n display: flex;\n}\n\n.otpInput {\n width: 76px;\n height: 48px;\n text-align: center;\n font-size: 18px;\n font-weight: 400;\n border-radius: 8px;\n}\n\n.resendContainer {\n display: flex;\n flex-direction: row;\n margin-top: 10px;\n justify-content: space-between;\n}\n\n.errorText {\n color: #EB0542;\n font-weight: 400;\n font-size: 14px;\n}\n\n.timerText {\n color: #A7A7A7;\n font-weight: 400;\n font-size: 14px;\n}\n\n.resendText {\n color: #A7A7A7;\n font-weight: 700;\n font-size: 14px;\n}";
9265
+ n(css,{});
9266
+
9256
9267
  const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDelay = 60, error = false, errorText, resendText, }) => {
9257
9268
  const [otp, setOtp] = useState(Array(length).fill(""));
9258
9269
  const [timer, setTimer] = useState(resendDelay);