opus-toolkit-components 1.6.9 → 1.7.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.
package/lib/index.d.ts CHANGED
@@ -1,206 +1,466 @@
1
- declare module "opus-toolkit-components" {
2
- import * as React from "react";
3
-
4
- // Accordion
5
- export interface AccordionProps {
6
- items?: any[];
7
- className?: string;
8
- }
9
- export const Accordion: React.ComponentType<AccordionProps>;
10
-
11
- // Button
12
- export interface ButtonProps {
13
- children?: React.ReactNode;
14
- variant?: string;
15
- rank?: string;
16
- disabled?: boolean;
17
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
18
- className?: string;
19
- name?: string;
20
- ["data-cy"]?: string;
21
- }
22
- export const Button: React.ComponentType<ButtonProps>;
23
-
24
- // Card
25
- export interface CardProps {
26
- children?: React.ReactNode;
27
- className?: string;
28
- }
29
- export const Card: React.ComponentType<CardProps>;
30
-
31
- // Input
32
- export interface InputProps {
33
- name?: string;
34
- value?: string | number;
35
- placeholder?: string;
36
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
37
- className?: string;
38
- ["data-cy"]?: string;
39
- }
40
- export const Input: React.ComponentType<InputProps>;
41
-
42
- // DatePicker
43
- export interface DatePickerProps {
44
- name?: string;
45
- initialDate?: Date | string;
46
- label?: string;
47
- onChange?: (event: any) => void;
48
- className?: string;
49
- }
50
- export const DatePicker: React.ComponentType<DatePickerProps>;
51
-
52
- // Radio
53
- export interface RadioButtonProps {
54
- name?: string;
55
- value?: string;
56
- checked?: boolean;
57
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
58
- }
59
- export const RadioButton: React.ComponentType<RadioButtonProps>;
60
-
61
- // Checkbox
62
- export interface CheckboxProps {
63
- name?: string;
64
- checked?: boolean;
65
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
66
- label?: string;
67
- }
68
- export const Checkbox: React.ComponentType<CheckboxProps>;
69
-
70
- // Table
71
- export interface TableProps {
72
- columns: any[];
73
- data: any[];
74
- className?: string;
75
- }
76
- export const Table: React.ComponentType<TableProps>;
77
-
78
- // Dropdown
79
- export interface DropdownProps {
80
- name?: string;
81
- value?: string;
82
- options?: { label: string; value: string }[];
83
- onChange?: (event: any) => void;
84
- className?: string;
85
- ["data-cy"]?: string;
86
- }
87
- export const Dropdown: React.ComponentType<DropdownProps>;
88
-
89
- // Navbar
90
- export interface NavbarProps {
91
- children?: React.ReactNode;
92
- className?: string;
93
- }
94
- export const Navbar: React.ComponentType<NavbarProps>;
95
-
96
- // Modal
97
- export interface ModalProps {
98
- open: boolean;
99
- onClose: () => void;
100
- children?: React.ReactNode;
101
- title?: string;
102
- className?: string;
103
- }
104
- export const Modal: React.ComponentType<ModalProps>;
105
-
106
- // Loader
107
- export interface LoaderProps {
108
- size?: number | string;
109
- className?: string;
110
- }
111
- export const Loader: React.ComponentType<LoaderProps>;
112
-
113
- // Pill
114
- export interface PillProps {
115
- label: string;
116
- variant?: string;
117
- className?: string;
118
- }
119
- export const Pill: React.ComponentType<PillProps>;
120
-
121
- // CookieBanner
122
- export interface CookieBannerProps {
123
- message?: string;
124
- acceptLabel?: string;
125
- declineLabel?: string;
126
- onAccept?: () => void;
127
- onDecline?: () => void;
128
- }
129
- export const CookieBanner: React.ComponentType<CookieBannerProps>;
130
-
131
- // Text
132
- export interface TextProps {
133
- variant?: string;
134
- as?: keyof JSX.IntrinsicElements;
135
- children?: React.ReactNode;
136
- className?: string;
137
- }
138
- export const Text: React.ComponentType<TextProps>;
139
-
140
- // Sidebar
141
- export interface SidebarProps {
142
- open?: boolean;
143
- onClose?: () => void;
144
- children?: React.ReactNode;
145
- }
146
- export const Sidebar: React.ComponentType<SidebarProps>;
147
-
148
- // Header
149
- export interface HeaderProps {
150
- title?: string;
151
- actions?: React.ReactNode;
152
- className?: string;
153
- }
154
- export const Header: React.ComponentType<HeaderProps>;
155
-
156
- // Icon
157
- export interface IconProps {
158
- name: string;
159
- size?: number | string;
160
- className?: string;
161
- }
162
- export const Icon: React.ComponentType<IconProps>;
163
-
164
- // Footer
165
- export interface FooterProps {
166
- left?: React.ReactNode;
167
- center?: React.ReactNode;
168
- right?: React.ReactNode;
169
- className?: string;
170
- }
171
- export const Footer: React.ComponentType<FooterProps>;
172
-
173
- // BarLayout
174
- export interface BarLayoutProps {
175
- left?: React.ReactNode;
176
- center?: React.ReactNode;
177
- right?: React.ReactNode;
178
- className?: string;
179
- }
180
- export const BarLayout: React.ComponentType<BarLayoutProps>;
181
-
182
- // PageTemplate
183
- export interface PageTemplateProps {
184
- headerTitle?: string;
185
- headerLeft?: React.ReactNode;
186
- headerCenter?: React.ReactNode;
187
- headerRight?: React.ReactNode;
188
-
189
- footerLeft?: React.ReactNode;
190
- footerCenter?: React.ReactNode;
191
- footerRight?: React.ReactNode;
192
-
193
- children?: React.ReactNode;
194
- className?: string;
195
- }
196
- export const PageTemplate: React.ComponentType<PageTemplateProps>;
197
-
198
- // ProfileCard
199
- export interface ProfileCardProps {
200
- name: string;
201
- description?: string;
202
- avatarUrl?: string;
203
- className?: string;
204
- }
205
- export const ProfileCard: React.ComponentType<ProfileCardProps>;
206
- }
1
+ declare module "opus-toolkit-components" {
2
+ import * as React from "react";
3
+
4
+ // Accordion
5
+ export interface AccordionProps {
6
+ title: string | React.ReactNode;
7
+ handleToggle?: (index: number) => void;
8
+ activeIndex?: number;
9
+ index: number;
10
+ isPreview?: boolean;
11
+ isLocked?: boolean;
12
+ onExitPreview?: () => void;
13
+ content: React.ReactNode;
14
+ preview?: React.ReactNode;
15
+ isPill?: boolean;
16
+ pillText?: string;
17
+ pillStatus?: "success" | "warning" | "error" | "info" | string;
18
+ pillIcon?: React.ReactNode;
19
+ disabled?: boolean;
20
+ }
21
+
22
+ export const Accordion: React.ComponentType<AccordionProps>;
23
+
24
+ // BarLayout
25
+ export interface BarLayoutProps {
26
+ left?: React.ReactNode;
27
+ center?: React.ReactNode;
28
+ right?: React.ReactNode;
29
+ className?: string;
30
+ }
31
+
32
+ export const BarLayout: React.ComponentType<BarLayoutProps>;
33
+
34
+ // Button
35
+ export type ButtonRank =
36
+ | "primary"
37
+ | "secondary"
38
+ | "tertiary"
39
+ | "outline"
40
+ | "destructive";
41
+
42
+ export type ButtonState = "default" | "disabled";
43
+
44
+ export type ButtonSize = "sm" | "md" | "lg" | "xl" | string;
45
+
46
+ export type IconComponent = (
47
+ props: React.SVGProps<SVGSVGElement>,
48
+ ) => JSX.Element;
49
+
50
+ export interface ButtonProps
51
+ extends React.ButtonHTMLAttributes<HTMLButtonElement> {
52
+ type?: "button" | "submit" | "reset";
53
+ rank?: ButtonRank;
54
+ state?: ButtonState;
55
+ text?: string;
56
+ size?: ButtonSize;
57
+ name?: string;
58
+ dataCy?: string;
59
+ tabIndex?: number;
60
+ isFullWidth?: boolean;
61
+ icon?: IconComponent;
62
+ iconPosition?: "left" | "right";
63
+ isIconAnimated?: boolean;
64
+ isSaving?: boolean;
65
+ savingText?: string;
66
+ className?: string;
67
+ title?: string;
68
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
69
+ }
70
+
71
+ export const Button: React.ComponentType<ButtonProps>;
72
+
73
+ // Card
74
+ export type CardIntent =
75
+ | "default"
76
+ | "info"
77
+ | "warning"
78
+ | "success"
79
+ | "error"
80
+ | "brand"
81
+ | "brandSecondary";
82
+
83
+ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
84
+ intent?: CardIntent;
85
+ className?: string;
86
+ children?: React.ReactNode;
87
+ }
88
+
89
+ export const Card: React.ComponentType<CardProps>;
90
+
91
+ // CookieBanner
92
+ export interface CookieBannerProps {
93
+ logo?: string;
94
+ policyTxt?: string;
95
+ linkTxt?: string;
96
+ isVisible?: boolean;
97
+ onAccept?: () => void;
98
+ onLearnMore?: () => void;
99
+ intent?: string;
100
+ }
101
+
102
+ export const CookieBanner: React.ComponentType<CookieBannerProps>;
103
+
104
+ // Footer
105
+ export interface FooterProps {
106
+ left?: React.ReactNode;
107
+ center?: React.ReactNode;
108
+ right?: React.ReactNode;
109
+ className?: string;
110
+ }
111
+
112
+ export const Footer: React.ComponentType<FooterProps>;
113
+
114
+ // Checkbox
115
+
116
+ export interface CheckboxChangeEvent {
117
+ target: {
118
+ name: string;
119
+ value: boolean;
120
+ };
121
+ }
122
+
123
+ export interface CheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
124
+ label: string;
125
+ name: string;
126
+ onChange?: (event: CheckboxChangeEvent) => void;
127
+ value?: boolean;
128
+ isValid?: boolean;
129
+ errorMessage?: string;
130
+ disabled?: boolean;
131
+ title?: string;
132
+ dataCy?: string;
133
+ }
134
+
135
+ export const Checkbox: React.ComponentType<CheckboxProps>;
136
+
137
+ // Datepicker
138
+ export interface DatePickerChangeEvent {
139
+ target: {
140
+ name: string;
141
+ value: string;
142
+ };
143
+ }
144
+
145
+ export interface DatePickerProps
146
+ extends React.HTMLAttributes<HTMLDivElement> {
147
+ initialDate?: string;
148
+ label?: string;
149
+ isValid?: boolean;
150
+ errorMessage?: string;
151
+ name?: string;
152
+ onChange?: (event: DatePickerChangeEvent) => void;
153
+ value?: string;
154
+ className?: string;
155
+ title?: string;
156
+ required?: boolean;
157
+ dataCy?: string;
158
+ disabled?: boolean;
159
+ }
160
+
161
+ export const DatePicker: React.ComponentType<DatePickerProps>;
162
+
163
+ // Dropdown
164
+ export interface DropdownItem {
165
+ label: string;
166
+ value: string | number;
167
+ }
168
+
169
+ export interface DropdownChangeEvent {
170
+ target: {
171
+ name: string;
172
+ value: string | number;
173
+ };
174
+ }
175
+
176
+ export type IconComponent = (
177
+ props: React.SVGProps<SVGSVGElement>,
178
+ ) => JSX.Element;
179
+
180
+ export interface DropdownProps extends React.HTMLAttributes<HTMLDivElement> {
181
+ items?: DropdownItem[];
182
+ label?: string;
183
+ isValid?: boolean;
184
+ required?: boolean;
185
+ placeholder?: string;
186
+ name?: string;
187
+ className?: string;
188
+ title?: string;
189
+ tabIndex?: string | number;
190
+ onChange?: (event: DropdownChangeEvent) => void;
191
+ value?: string | number;
192
+ Icon?: IconComponent;
193
+ errorMessage?: string;
194
+ disabled?: boolean;
195
+ dataCy?: string;
196
+ }
197
+
198
+ export const Dropdown: React.ComponentType<DropdownProps>;
199
+
200
+ // Input
201
+ export type IconComponent = (
202
+ props: React.SVGProps<SVGSVGElement>,
203
+ ) => JSX.Element;
204
+
205
+ export type CustomComponent = (props: any) => JSX.Element;
206
+
207
+ export interface InputProps
208
+ extends React.InputHTMLAttributes<HTMLInputElement> {
209
+ label: string;
210
+ placeholder?: string;
211
+ type?:
212
+ | "text"
213
+ | "email"
214
+ | "password"
215
+ | "number"
216
+ | "search"
217
+ | "tel"
218
+ | "url"
219
+ | "date"
220
+ | "datetime-local"
221
+ | "month"
222
+ | "time"
223
+ | "week"
224
+ | string;
225
+ tabIndex?: string | number;
226
+ title?: string;
227
+ name?: string;
228
+ isValid?: boolean;
229
+ errorMessage?: string;
230
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
231
+ className?: string;
232
+ value?: string | number;
233
+ Icon?: IconComponent;
234
+ iconPosition?: "left" | "right";
235
+ isAnimated?: boolean;
236
+ required?: boolean;
237
+ disabled?: boolean;
238
+ shouldRenderCustomComponent?: boolean;
239
+ customComponent?: CustomComponent;
240
+ customComponentProps?: Record<string, any>;
241
+ dataCy?: string;
242
+ }
243
+
244
+ export const Input: React.ForwardRefExoticComponent<
245
+ InputProps & React.RefAttributes<HTMLInputElement>
246
+ >;
247
+
248
+ // Radios
249
+ export interface RadioOption {
250
+ value: string | number;
251
+ label: string;
252
+ }
253
+
254
+ export interface RadioChangeEvent {
255
+ target: {
256
+ name: string;
257
+ value: string | number;
258
+ };
259
+ }
260
+
261
+ export interface RadioButtonProps
262
+ extends React.HTMLAttributes<HTMLDivElement> {
263
+ label: string;
264
+ options?: RadioOption[];
265
+ name: string;
266
+ value?: string | number;
267
+ onChange?: (event: RadioChangeEvent) => void;
268
+ className?: string;
269
+ tabIndex?: string | number;
270
+ title?: string;
271
+ isValid?: boolean;
272
+ errorMessage?: string;
273
+ required?: boolean;
274
+ dataCy?: string;
275
+ disabled?: boolean;
276
+ }
277
+
278
+ export const RadioButton: React.FC<RadioButtonProps>;
279
+
280
+ // Header
281
+ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
282
+ title: string;
283
+ center?: React.ReactNode;
284
+ right?: React.ReactNode;
285
+ className?: string;
286
+ }
287
+
288
+ export const Header: React.FC<HeaderProps>;
289
+
290
+ // Icon
291
+ export type HeroIconName = keyof typeof HeroIcons;
292
+ export type C247IconName = keyof typeof C247Icons;
293
+ export type IconName = HeroIconName | C247IconName;
294
+
295
+ export type IconLibrary = "hero" | "c247";
296
+
297
+ export interface IconProps extends React.SVGProps<SVGSVGElement> {
298
+ name: IconName;
299
+ library?: IconLibrary;
300
+ size?: number;
301
+ className?: string;
302
+ color?: string;
303
+ }
304
+
305
+ export const Icon: React.FC<IconProps>;
306
+
307
+ // Loader
308
+ export interface LoaderProps {
309
+ isLoading: boolean;
310
+ loaderText?: string;
311
+ customLoader?: React.ReactNode;
312
+ className?: string;
313
+ }
314
+
315
+ export const Loader: React.FC<LoaderProps>;
316
+
317
+ // Modal
318
+ export interface ModalProps {
319
+ isOpen: boolean;
320
+ onClose?: () => void;
321
+ isLoading?: boolean;
322
+ loaderText?: string;
323
+ header?: React.ReactNode;
324
+ hideHeader?: boolean;
325
+ body?: React.ReactNode;
326
+ footer?: React.ReactNode;
327
+ hideFooter?: boolean;
328
+ className?: string;
329
+ footerClassName?: string;
330
+ headerClassName?: string;
331
+ }
332
+
333
+ export const Modal: React.FC<ModalProps>;
334
+
335
+ // Navbar
336
+ export interface NavbarProps {
337
+ children?: React.ReactNode;
338
+ logo?: string;
339
+ className?: string;
340
+ maxWidth?: string;
341
+ }
342
+
343
+ export const Navbar: React.FC<NavbarProps>;
344
+
345
+ // PageTemplate
346
+ export interface PageTemplateProps {
347
+ headerTitle?: string;
348
+ headerCenter?: React.ReactNode;
349
+ headerRight?: React.ReactNode;
350
+
351
+ footerLeft?: React.ReactNode;
352
+ footerCenter?: React.ReactNode;
353
+ footerRight?: React.ReactNode;
354
+
355
+ children: React.ReactNode;
356
+ className?: string;
357
+ }
358
+
359
+ export const PageTemplate: React.FC<PageTemplateProps>;
360
+
361
+ // Pills
362
+ export interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {
363
+ text?: string;
364
+ status?: "primary" | "danger" | "warning" | "success" | "info" | "notice";
365
+ className?: string;
366
+ icon?: (props: React.SVGProps<SVGSVGElement>) => JSX.Element;
367
+ }
368
+
369
+ export const Pill: React.FC<PillProps>;
370
+
371
+ // ProfileCard
372
+ export interface ProfileCardUser {
373
+ name: string;
374
+ role: string;
375
+ }
376
+
377
+ export interface ProfileCardProps
378
+ extends React.HTMLAttributes<HTMLDivElement> {
379
+ user: ProfileCardUser;
380
+ href?: string;
381
+ }
382
+
383
+ export const ProfileCard: React.FC<ProfileCardProps>;
384
+
385
+ // Sidebar
386
+ export interface SidebarMenuItem {
387
+ key: string | number;
388
+ name: string;
389
+ icon?: string;
390
+ href?: string;
391
+ }
392
+
393
+ export interface SidebarMenuGroup {
394
+ key: string | number;
395
+ name: string;
396
+ children: SidebarMenuItem[];
397
+ }
398
+
399
+ export type SidebarMenu = SidebarMenuItem | SidebarMenuGroup;
400
+
401
+ export interface SidebarUser {
402
+ id: string | number;
403
+ name: string;
404
+ role: string;
405
+ avatar?: string;
406
+ }
407
+
408
+ export interface SidebarProps extends React.HTMLAttributes<HTMLDivElement> {
409
+ menus: SidebarMenu[];
410
+ user: SidebarUser;
411
+ activeItem?: string | number | null;
412
+ onItemClick?: (key: string | number) => void;
413
+ logo?: string;
414
+ searchValue?: string;
415
+ onSearchChange?: (value: string) => void;
416
+ }
417
+
418
+ export const Sidebar: React.FC<SidebarProps>;
419
+
420
+ // Table
421
+ export interface TableColumn {
422
+ key: string;
423
+ header: string;
424
+ render?: (row: any) => React.ReactNode;
425
+ }
426
+
427
+ export interface TableProps extends React.HTMLAttributes<HTMLDivElement> {
428
+ data?: TableColumn[];
429
+ rows?: any[];
430
+ className?: string;
431
+ rowClassName?: string;
432
+ cellClassName?: string;
433
+ headRowClassName?: string;
434
+ headCellClassName?: string;
435
+ rowKeyExtractor?: (row: any, index: number) => string | number;
436
+ }
437
+
438
+ export const Table: React.FC<TableProps>;
439
+
440
+ // Text
441
+ export type TextVariant =
442
+ | "h1"
443
+ | "h2"
444
+ | "h3"
445
+ | "h4"
446
+ | "h5"
447
+ | "h6"
448
+ | "body"
449
+ | "small"
450
+ | "caption"
451
+ | "label";
452
+
453
+ export type TextAs = keyof JSX.IntrinsicElements | React.ComponentType<any>;
454
+
455
+ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
456
+ variant?: TextVariant;
457
+ as?: TextAs;
458
+ className?: string;
459
+ color?: string;
460
+ children?: React.ReactNode;
461
+ name?: string;
462
+ dataCy?: string;
463
+ }
464
+
465
+ export const Text: React.FC<TextProps>;
466
+ }
@@ -1587,7 +1587,7 @@ const PageTemplate = _ref => {
1587
1587
  center: headerCenter,
1588
1588
  right: headerRight
1589
1589
  }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("main", {
1590
- className: "flex-1 p-6",
1590
+ className: "flex-1 p-4",
1591
1591
  children: children
1592
1592
  }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_Footer_Footer__WEBPACK_IMPORTED_MODULE_2__["default"], {
1593
1593
  left: footerLeft,
@@ -63579,7 +63579,7 @@ __webpack_require__.r(__webpack_exports__);
63579
63579
 
63580
63580
 
63581
63581
 
63582
- module.exports = __webpack_exports__;
63582
+ module.exports = __webpack_exports__.named;
63583
63583
  /******/ })()
63584
63584
  ;
63585
63585
  //# sourceMappingURL=opus-components.main.js.map