opus-toolkit-components 1.7.6 → 1.7.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.
package/lib/index.d.ts CHANGED
@@ -1,466 +1,25 @@
1
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>;
2
+ export * from "./components/Accordions";
3
+ export * from "./components/BarLayout";
4
+ export * from "./components/Buttons";
5
+ export * from "./components/Cards";
6
+ export * from "./components/Cookie";
7
+ export * from "./components/Footer";
8
+ export * from "./components/Forms/Checkbox";
9
+ export * from "./components/Forms/Datepickers";
10
+ export * from "./components/Forms/Dropdowns";
11
+ export * from "./components/Forms/Inputs";
12
+ export * from "./components/Forms/Radios";
13
+ export * from "./components/Header";
14
+ export * from "./components/Icon";
15
+ export * from "./components/IconButton";
16
+ export * from "./components/Loader";
17
+ export * from "./components/Modals";
18
+ export * from "./components/Navbar";
19
+ export * from "./components/PageTemplate";
20
+ export * from "./components/Pills";
21
+ export * from "./components/Profile/ProfileCard";
22
+ export * from "./components/Sidebar";
23
+ export * from "./components/Tables";
24
+ export * from "./components/Text";
466
25
  }
@@ -3655,16 +3655,16 @@ __webpack_require__.r(__webpack_exports__);
3655
3655
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(94178);
3656
3656
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
3657
3657
 
3658
- /**
3659
- * @typedef {Object} BarLayoutProps
3660
- * @property {React.ReactNode} [left] Left content area
3661
- * @property {React.ReactNode} [center] Center content area
3662
- * @property {React.ReactNode} [right] Right content area
3663
- * @property {string} [className] Optional wrapper class
3658
+ /**
3659
+ * @typedef {Object} BarLayoutProps
3660
+ * @property {React.ReactNode} [left] Left content area
3661
+ * @property {React.ReactNode} [center] Center content area
3662
+ * @property {React.ReactNode} [right] Right content area
3663
+ * @property {string} [className] Optional wrapper class
3664
3664
  */
3665
3665
 
3666
- /**
3667
- * @param {BarLayoutProps} props
3666
+ /**
3667
+ * @param {BarLayoutProps} props
3668
3668
  */
3669
3669
 
3670
3670
  const BarLayout = _ref => {
@@ -48699,80 +48699,80 @@ __webpack_require__.r(__webpack_exports__);
48699
48699
  // Import a spinner icon
48700
48700
 
48701
48701
 
48702
- /**
48703
- * @typedef {'primary'|'secondary'|'tertiary'|'outline'|'destructive'} ButtonRank
48702
+ /**
48703
+ * @typedef {'primary'|'secondary'|'tertiary'|'outline'|'destructive'} ButtonRank
48704
48704
  */
48705
48705
 
48706
- /**
48707
- * @typedef {'default'|'disabled'} ButtonState
48706
+ /**
48707
+ * @typedef {'default'|'disabled'} ButtonState
48708
48708
  */
48709
48709
 
48710
- /**
48711
- * @typedef {'sm'|'md'|'lg'|'xl'|string} ButtonSize
48712
- * (Supports custom tailwind text sizes too)
48710
+ /**
48711
+ * @typedef {'sm'|'md'|'lg'|'xl'|string} ButtonSize
48712
+ * (Supports custom tailwind text sizes too)
48713
48713
  */
48714
48714
 
48715
- /**
48716
- * Icon component type from react-icons or your own components
48717
- * @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
48715
+ /**
48716
+ * Icon component type from react-icons or your own components
48717
+ * @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
48718
48718
  */
48719
48719
 
48720
- /**
48721
- * @typedef {Object} ButtonProps
48722
- *
48723
- * @property {'button'|'submit'|'reset'} [type]
48724
- * Native button type.
48725
- *
48726
- * @property {ButtonRank} [rank]
48727
- * Visual rank: primary, secondary, etc.
48728
- *
48729
- * @property {ButtonState} [state]
48730
- * Current state (default, disabled).
48731
- *
48732
- * @property {string} [text]
48733
- * Text shown inside the button (ignored when isSaving is true).
48734
- *
48735
- * @property {ButtonSize} [size]
48736
- * Tailwind text size (sm, md, lg, xl).
48737
- *
48738
- * @property {string} [name]
48739
- * Standard HTML name attribute + for data-cy.
48740
- *
48741
- * @property {string} [dataCy]
48742
- * Override for auto-generated test selector.
48743
- *
48744
- * @property {number} [tabIndex]
48745
- *
48746
- * @property {boolean} [isFullWidth]
48747
- * Expand to full container width.
48748
- *
48749
- * @property {IconComponent} [icon]
48750
- * Optional icon component (left or right).
48751
- *
48752
- * @property {'left'|'right'} [iconPosition]
48753
- * Position of icon.
48754
- *
48755
- * @property {boolean} [isIconAnimated]
48756
- * Enables subtle translate animation on hover.
48757
- *
48758
- * @property {boolean} [isSaving]
48759
- * Shows a spinner and disables all interaction.
48760
- *
48761
- * @property {string} [savingText]
48762
- * Text shown when isSaving = true.
48763
- *
48764
- * @property {string} [className]
48765
- * Extra custom classes.
48766
- *
48767
- * @property {string} [title]
48768
- * Adds accessible label / tooltip.
48769
- *
48770
- * @property {(event: React.MouseEvent<HTMLButtonElement>) => void} [onClick]
48771
- * Click handler. Not called during saving or disabled state.
48720
+ /**
48721
+ * @typedef {Object} ButtonProps
48722
+ *
48723
+ * @property {'button'|'submit'|'reset'} [type]
48724
+ * Native button type.
48725
+ *
48726
+ * @property {ButtonRank} [rank]
48727
+ * Visual rank: primary, secondary, etc.
48728
+ *
48729
+ * @property {ButtonState} [state]
48730
+ * Current state (default, disabled).
48731
+ *
48732
+ * @property {string} [text]
48733
+ * Text shown inside the button (ignored when isSaving is true).
48734
+ *
48735
+ * @property {ButtonSize} [size]
48736
+ * Tailwind text size (sm, md, lg, xl).
48737
+ *
48738
+ * @property {string} [name]
48739
+ * Standard HTML name attribute + for data-cy.
48740
+ *
48741
+ * @property {string} [dataCy]
48742
+ * Override for auto-generated test selector.
48743
+ *
48744
+ * @property {number} [tabIndex]
48745
+ *
48746
+ * @property {boolean} [isFullWidth]
48747
+ * Expand to full container width.
48748
+ *
48749
+ * @property {IconComponent} [icon]
48750
+ * Optional icon component (left or right).
48751
+ *
48752
+ * @property {'left'|'right'} [iconPosition]
48753
+ * Position of icon.
48754
+ *
48755
+ * @property {boolean} [isIconAnimated]
48756
+ * Enables subtle translate animation on hover.
48757
+ *
48758
+ * @property {boolean} [isSaving]
48759
+ * Shows a spinner and disables all interaction.
48760
+ *
48761
+ * @property {string} [savingText]
48762
+ * Text shown when isSaving = true.
48763
+ *
48764
+ * @property {string} [className]
48765
+ * Extra custom classes.
48766
+ *
48767
+ * @property {string} [title]
48768
+ * Adds accessible label / tooltip.
48769
+ *
48770
+ * @property {(event: React.MouseEvent<HTMLButtonElement>) => void} [onClick]
48771
+ * Click handler. Not called during saving or disabled state.
48772
48772
  */
48773
48773
 
48774
- /**
48775
- * @param {ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>} props
48774
+ /**
48775
+ * @param {ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>} props
48776
48776
  */
48777
48777
 
48778
48778
  function Button(_ref) {
@@ -48804,7 +48804,7 @@ function Button(_ref) {
48804
48804
  // Define styles for button ranks
48805
48805
  const rankStyles = {
48806
48806
  primary: "bg-[--color-primary-btn] hover:bg-[--color-primary-btn-hover] text-[--color-primary-btn-txt] border-solid border-2 border-[--color-primary-btn] hover:border-[--color-primary-btn-hover]",
48807
- secondary: "bg-transparent border-2 border-2 border-[--color-primary-btn] hover:border-[--color-secondary-btn-hover] hover:text-[--color-secondary-btn-hover] text-[--color-primary-btn]",
48807
+ secondary: "border-2 border-2 bg-[--color-brand-secondary] border-[--color-stroke] hover:bg-[--color-primary-btn-hover] text-[--color-white]",
48808
48808
  tertiary: "bg-transparent underline text-[--color-text-strong]",
48809
48809
  outline: "bg-[--color-input-bg] border-solid border-2 border-[--color-outline-btn] hover:border-[--color-outline-btn-hover] text-[--color-text-strong]",
48810
48810
  destructive: "bg-[--color-destructive-btn] hover:bg-[--color-destructive-btn-hover] text-[--color-destructive-btn-txt] border-solid border-2 border-[--color-destructive-btn] hover:border-[--color-destructive-btn-hover]"
@@ -63709,4 +63709,4 @@ __webpack_require__.r(__webpack_exports__);
63709
63709
  module.exports = __webpack_exports__;
63710
63710
  /******/ })()
63711
63711
  ;
63712
- //# sourceMappingURL=opus-components.main.js.map
63712
+ //# sourceMappingURL=main.js.map