dhre-component-lib 0.2.9 → 0.3.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,7 @@ type Tab = {
7
7
  interface TabsProps {
8
8
  tabs: Tab[];
9
9
  onTabChange: (selectedTab: Tab) => void;
10
+ selectedTabValue?: string;
10
11
  }
11
12
  declare const Tabs: React.FC<TabsProps>;
12
13
  export default Tabs;
package/dist/index.d.ts CHANGED
@@ -1,229 +1,20 @@
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
- interface TypographyProps {
167
- variant?: 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'H7' | 'H8' | 'B1' | 'B2' | 'B3' | 'B4' | 'L1' | 'L2' | 'L3';
168
- weight?: 'BOLD' | 'SEMI_BOLD' | 'MEDIUM';
169
- children: React.ReactNode;
170
- className?: string;
171
- }
172
- declare const Typography: React.FC<TypographyProps>;
173
-
174
- interface Suggestion {
175
- id: string;
176
- title: string;
177
- faqAnswer: string;
178
- faqQuestion: string;
179
- fieldFaqCategory: string;
180
- isBookmarked: boolean;
181
- images: string[];
182
- videos: string[];
183
- }
184
- interface CustomSearchFieldProps {
185
- searchIcon: React.ReactNode;
186
- crossIcon: React.ReactNode;
187
- disabled?: boolean;
188
- onSearch: (query: string) => void;
189
- onSelectSuggestion: (selectedSuggestion: Suggestion | null) => void;
190
- suggestions: Suggestion[] | null | undefined;
191
- placeholder: string;
192
- className?: string;
193
- onSearchIconClick?: () => void;
194
- onHandleClear?: () => void;
195
- }
196
- declare const Search: React.FC<CustomSearchFieldProps>;
197
-
198
- interface ModalProps {
199
- isOpen: boolean;
200
- onClose: () => void;
201
- title?: React.ReactNode;
202
- children: React.ReactNode;
203
- crossIcon: React.ReactNode;
204
- }
205
- declare const Modal: React.FC<ModalProps>;
206
-
207
- type AccordionProps = {
208
- icon?: React.ReactNode;
209
- title: React.ReactNode;
210
- description?: React.ReactNode;
211
- children?: React.ReactNode;
212
- border?: boolean;
213
- upArrowIcon: React.ReactNode;
214
- downArrowIcon: React.ReactNode;
215
- openByDefault?: boolean;
216
- };
217
- declare const Accordion: React.FC<AccordionProps>;
218
-
219
- type Tab = {
220
- name: string;
221
- value: string;
222
- };
223
- interface TabsProps {
224
- tabs: Tab[];
225
- onTabChange: (selectedTab: Tab) => void;
226
- }
227
- declare const Tabs: React.FC<TabsProps>;
228
-
229
- export { Accordion as Accordian, Avatar, Badge, Breadcrumb as BreadCrumb, Button, CustomCheckbox as Checkbox, CircularProgress, GetDirectionAction as Directions, CustomDivider as Divider, MapComponent as GoogleMap, CustomInputField as InputTextField, Link, Modal, OTPInput as OtpInput, Progress, CustomRadioButton as RadioButton, Search, Tabs, Typography, PdfView as default };
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";
16
+ export { default as Typography } from "./components/Typography/Typography";
17
+ export { default as Search } from "./components/Search/Search";
18
+ export { default as Modal } from "./components/Modal/Modal";
19
+ export { default as Accordian } from "./components/Accordian/Accordian";
20
+ export { default as Tabs } from "./components/Tabs/Tabs";
package/dist/index.esm.js CHANGED
@@ -9438,8 +9438,8 @@ const Modal = ({ isOpen, onClose, title, children, crossIcon }) => {
9438
9438
  }, [isOpen]);
9439
9439
  if (!isOpen)
9440
9440
  return null;
9441
- return (React.createElement("div", { className: "modal-overlay", onClick: onClose },
9442
- React.createElement("div", { className: "modal-container", onClick: (e) => e.stopPropagation() },
9441
+ return (React.createElement("div", { className: "modal-overlay", onClick: onClose, "data-testid": "modal-overlay" },
9442
+ React.createElement("div", { className: "modal-container", onClick: (e) => e.stopPropagation(), "data-testid": "modal-container" },
9443
9443
  title && React.createElement("div", { className: "modal-header" }, title),
9444
9444
  React.createElement("div", null, children),
9445
9445
  React.createElement("button", { className: "modal-close", onClick: onClose }, crossIcon))));
@@ -9472,13 +9472,21 @@ const Accordion = ({ icon, title, description, children, border = false, upArrow
9472
9472
  var css = ".tabs {\n display: flex;\n gap: 12px;\n}\n\n.tab {\n padding: 12px;\n cursor: pointer;\n background-color: transparent;\n border: none;\n color: #A7A7A7;\n border-bottom: 2px solid transparent;\n transition: border-bottom 0.3s ease;\n}\n\n.tab.active {\n border-bottom: 2px solid #000000;\n color: #000000;\n}\n\n.tab:hover {\n color: #000000;\n}";
9473
9473
  n(css,{});
9474
9474
 
9475
- const Tabs = ({ tabs, onTabChange }) => {
9475
+ const Tabs = ({ tabs, onTabChange, selectedTabValue }) => {
9476
9476
  const [selectedTab, setSelectedTab] = useState();
9477
9477
  useEffect(() => {
9478
9478
  if (tabs?.length) {
9479
9479
  setSelectedTab(tabs[0]);
9480
9480
  }
9481
9481
  }, [tabs]);
9482
+ useEffect(() => {
9483
+ if (selectedTabValue) {
9484
+ const newSelectedTab = tabs?.find((tab) => tab?.value === selectedTabValue);
9485
+ if (newSelectedTab) {
9486
+ setSelectedTab(newSelectedTab);
9487
+ }
9488
+ }
9489
+ }, [selectedTabValue, tabs]);
9482
9490
  const handleTabClick = (tab) => {
9483
9491
  setSelectedTab(tab);
9484
9492
  onTabChange(tab);