@mahatisystems/mahati-ui-components 0.1.2 → 0.2.0

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/dist/index.d.mts CHANGED
@@ -1,22 +1,19 @@
1
1
  import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
- import * as React from 'react';
3
- import React__default from 'react';
2
+ import React from 'react';
4
3
  import { VariantProps } from 'class-variance-authority';
5
4
 
6
5
  declare const buttonVariants: (props?: ({
7
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
8
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "danger" | null | undefined;
7
+ size?: "default" | "sm" | "md" | "lg" | "icon" | null | undefined;
9
8
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
10
- interface ButtonProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
9
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
11
10
  asChild?: boolean;
12
11
  }
13
- declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
12
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
14
13
 
15
- declare const cardVariants: (props?: ({
16
- variant?: "default" | "outline" | "elevated" | "subtle" | "figma" | null | undefined;
17
- size?: "default" | "sm" | "lg" | "figma" | null | undefined;
18
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
19
- interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'>, VariantProps<typeof cardVariants> {
14
+ type CardVariant = 'default' | 'elevated' | 'outline' | 'subtle' | 'figma';
15
+ type CardSize = 'default' | 'sm' | 'lg' | 'figma';
16
+ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {
20
17
  title?: string;
21
18
  cardContent?: React.ReactNode;
22
19
  cardBackContent?: React.ReactNode;
@@ -26,16 +23,26 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'
26
23
  borderRadius?: string;
27
24
  defaultOpen?: boolean;
28
25
  onFlip?: (isFlipped: boolean) => void;
26
+ variant?: CardVariant;
27
+ size?: CardSize;
28
+ className?: string;
29
+ children?: React.ReactNode;
29
30
  }
30
31
  declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
31
32
 
33
+ type MahatiModalSize = "default" | "sm" | "md" | "lg" | "xl";
32
34
  type MahatiModalProps = {
33
35
  isOpen: boolean;
34
36
  onClose: () => void;
35
37
  title?: string;
36
38
  subtitle?: string;
37
- children?: React__default.ReactNode;
39
+ size?: MahatiModalSize;
40
+ children?: React.ReactNode;
38
41
  className?: string;
42
+ width?: string | number;
43
+ height?: string | number;
44
+ margin?: string | number;
45
+ position?: "center" | "bottom-right" | "top-left" | "top-right" | "bottom-left" | "top-center" | "bottom-center" | "center-left" | "center-right";
39
46
  primaryAction?: {
40
47
  label?: string;
41
48
  onClick?: () => void;
@@ -45,48 +52,125 @@ type MahatiModalProps = {
45
52
  label?: string;
46
53
  onClick?: () => void;
47
54
  };
48
- headerIcon?: React__default.ReactNode;
55
+ headerIcon?: React.ReactNode;
49
56
  showDivider?: boolean;
50
57
  };
51
- declare function Modal({ isOpen, onClose, title, subtitle, children, className, primaryAction, secondaryAction, headerIcon, showDivider, }: MahatiModalProps): React__default.JSX.Element | null;
58
+ declare function Modal({ isOpen, onClose, title, subtitle, children, className, width: customWidth, height, margin, primaryAction, secondaryAction, headerIcon, showDivider, position, size, }: MahatiModalProps): React.JSX.Element | null;
52
59
  declare namespace Modal {
53
60
  var displayName: string;
54
61
  }
55
62
 
63
+ declare const chartVariants: (props?: ({
64
+ variant?: "default" | "elevated" | "filled" | "flat" | "card" | null | undefined;
65
+ size?: "default" | "sm" | "lg" | "xl" | null | undefined;
66
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
67
+ interface MahatiChartProps extends VariantProps<typeof chartVariants> {
68
+ type?: 'line' | 'bar' | 'pie' | 'doughnut' | 'polarArea' | 'radar';
69
+ data: any;
70
+ options?: any;
71
+ className?: string;
72
+ }
73
+ declare const ChartInterface: React.ForwardRefExoticComponent<MahatiChartProps & React.RefAttributes<HTMLDivElement>>;
74
+
56
75
  interface FormContainerProps {
57
- children: React__default.ReactNode;
58
- onSubmit?: (e: React__default.FormEvent) => void;
76
+ children: React.ReactNode;
77
+ onSubmit?: (e: React.FormEvent) => void;
59
78
  className?: string;
60
79
  }
61
- declare const FormContainer: React__default.FC<FormContainerProps>;
80
+ declare const FormContainer: React.FC<FormContainerProps>;
62
81
 
63
82
  interface InputProps {
64
83
  type?: string;
65
84
  name?: string;
66
85
  placeholder: string;
67
- onChange: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
86
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
68
87
  hasError?: boolean;
69
88
  errorMessage?: string;
70
89
  value?: string;
71
90
  className?: string;
72
91
  }
73
- declare const Input: React__default.FC<InputProps>;
92
+ declare const Input: React.FC<InputProps>;
74
93
 
75
- interface Tab {
94
+ interface Tab$1 {
76
95
  id?: string;
77
96
  label: string;
78
- icon?: React__default.ReactNode;
79
- content: React__default.ReactNode;
97
+ icon?: React.ReactNode;
98
+ content: React.ReactNode;
80
99
  disabled?: boolean;
81
100
  }
82
101
  interface MahatiTabbedInterfaceProps {
83
- tabs: Tab[];
102
+ tabs: Tab$1[];
84
103
  variant?: "basic" | "pill" | "dark" | "underline" | "shadow" | "glass" | "gradient" | "square";
85
104
  defaultActiveTab?: number;
86
105
  className?: string;
87
106
  onTabChange?: (tabIndex: number) => void;
88
107
  }
89
- declare const TabbedInterface: React__default.FC<MahatiTabbedInterfaceProps>;
108
+ declare const TabbedInterface$1: React.FC<MahatiTabbedInterfaceProps>;
109
+
110
+ interface Tab {
111
+ label: string;
112
+ content: React.ReactNode;
113
+ icon?: React.ReactNode;
114
+ }
115
+ interface TabbedInterfaceProps {
116
+ tabs: Tab[];
117
+ variant?: "underline" | "pill" | "outline" | "filled" | "gradient" | "shadow" | "glass" | "dark";
118
+ onTabChange?: (label: string) => void;
119
+ /**
120
+ * When true, tab headers are draggable.
121
+ * Use with onReorderTabs to actually reorder parent state.
122
+ */
123
+ draggableTabs?: boolean;
124
+ /**
125
+ * Called when a tab is dropped on another tab.
126
+ * fromIndex: index of dragged tab
127
+ * toIndex: index of drop target
128
+ */
129
+ onReorderTabs?: (fromIndex: number, toIndex: number) => void;
130
+ /**
131
+ * Layout of the tabs:
132
+ * - "horizontal": tabs above content (default)
133
+ * - "vertical": tabs beside the content
134
+ */
135
+ orientation?: "horizontal" | "vertical";
136
+ /**
137
+ * For vertical orientation, which side the tab list sits on:
138
+ * - "left": tabs on the left, content on the right (default)
139
+ * - "right": content on the left, tabs on the right
140
+ */
141
+ verticalPosition?: "left" | "right";
142
+ /**
143
+ * When true, show a small close icon in the tab header,
144
+ * like browser tabs. When false, do not render it at all.
145
+ */
146
+ showTabCloseIconInHeader?: boolean;
147
+ /**
148
+ * If header close icon is shown, where to place it?
149
+ * - "left": at the left edge (with padding)
150
+ * - "right": at the right edge (with padding)
151
+ */
152
+ tabCloseIconPosition?: "left" | "right";
153
+ /**
154
+ * Content of the header close icon.
155
+ * Defaults to "×" but can be "-" or any ReactNode (e.g. an SVG icon).
156
+ */
157
+ tabCloseIconContent?: React.ReactNode;
158
+ /**
159
+ * Called when the header close icon is clicked for a given index.
160
+ * Parent decides how to remove/close the tab.
161
+ */
162
+ onCloseTab?: (index: number) => void;
163
+ /**
164
+ * Font control props:
165
+ * User can pass "sans", "serif", "mono", "poppins",
166
+ * or full Tailwind class like "font-[Poppins]".
167
+ */
168
+ tabHeaderFont?: string;
169
+ tabContentFont?: string;
170
+ sectionTitleFont?: string;
171
+ sectionDescriptionFont?: string;
172
+ }
173
+ declare const TabbedInterface: React.FC<TabbedInterfaceProps>;
90
174
 
91
175
  interface TableProps$1 {
92
176
  headers: {
@@ -102,7 +186,7 @@ interface TableProps$1 {
102
186
  setLimit?: (limit: number) => void;
103
187
  totalCount?: number;
104
188
  highlightRowColor?: string;
105
- actions?: (row: unknown) => React__default.ReactNode;
189
+ actions?: (row: unknown) => React.ReactNode;
106
190
  paginationRequired?: boolean;
107
191
  paginationPosition?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
108
192
  onDownloadPDF?: (data: any[], headers: any[]) => void;
@@ -113,7 +197,7 @@ interface TableProps$1 {
113
197
  searchModeOptions?: ("startsWith" | "includes")[];
114
198
  onResetSearch?: () => void;
115
199
  }
116
- declare const Table: React__default.FC<TableProps$1>;
200
+ declare const Table$1: React.FC<TableProps$1>;
117
201
 
118
202
  interface TableProps {
119
203
  headers: {
@@ -128,24 +212,55 @@ interface TableProps {
128
212
  limit?: number;
129
213
  setLimit?: (limit: number) => void;
130
214
  totalCount?: number;
131
- highlightRowColor?: string;
132
- actions?: (row: unknown) => React__default.ReactNode;
133
215
  paginationRequired?: boolean;
134
216
  paginationPosition?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
217
+ highlightRowColor?: string;
218
+ actions?: (row: unknown) => React.ReactNode;
135
219
  onDownloadPDF?: (data: any[], headers: any[]) => void;
136
220
  onDownloadExcel?: (data: any[], headers: any[]) => void;
137
221
  searchable?: boolean;
138
222
  searchTerm?: string;
139
- onSearch?: (term: string, mode: "startsWith" | "includes") => void;
223
+ onSearch?: (term: string, mode?: "startsWith" | "includes") => void;
140
224
  searchModeOptions?: ("startsWith" | "includes")[];
141
225
  onResetSearch?: () => void;
226
+ /**
227
+ * summary = "single" => only one row summary open at a time
228
+ * summary = "multi" => multiple rows can be expanded
229
+ * undefined / omitted => no summary drawers
230
+ */
231
+ summary?: "single" | "multi";
232
+ /** which key in data row contains the summary text/content (default: "summary") */
233
+ summaryKey?: string;
234
+ /** which key in data row contains title field, e.g. name (default: "name") */
235
+ summaryTitleField?: string;
236
+ /**
237
+ * When true, any cell whose header.key === (summaryColumnKey || summaryKey)
238
+ * will be rendered as a truncated summary column with ellipsis and hover full text.
239
+ */
240
+ summaryColumn?: boolean;
241
+ /** Key to treat as summary column; falls back to summaryKey if not provided */
242
+ summaryColumnKey?: string;
243
+ /** Max length before truncating summary column text (default: 120) */
244
+ summaryColumnMaxLength?: number;
245
+ /**
246
+ * Keys of columns where text should be truncated with ellipsis and show full text on hover.
247
+ * Example: ["summary"] or ["email", "summary", "createdAt"]
248
+ */
249
+ textWrapColumns?: string[];
250
+ /** Global default max length for truncated text (for textWrapColumns) */
251
+ textWrapMaxLength?: number;
252
+ /**
253
+ * Per-column max length overrides for textWrapColumns (and summary column).
254
+ * Example: { email: 40, summary: 200 }
255
+ */
256
+ textWrapColumnMaxLengths?: Record<string, number>;
142
257
  }
143
- declare const TableTailwind: React__default.FC<TableProps>;
258
+ declare const Table: React.FC<TableProps>;
144
259
 
145
260
  interface TooltipProps {
146
261
  text?: string;
147
262
  position?: "top" | "right" | "bottom" | "left";
148
- children: React__default.ReactNode;
263
+ children: React.ReactNode;
149
264
  variant?: "default" | "transparent";
150
265
  className?: string;
151
266
  textColor?: string;
@@ -157,18 +272,184 @@ interface TooltipProps {
157
272
  height?: number;
158
273
  };
159
274
  animation?: {
160
- component: React__default.ComponentType<any>;
275
+ component: React.ComponentType<any>;
161
276
  props?: any;
162
277
  triggerDelay?: number;
163
278
  };
164
279
  }
165
- declare const Tooltip: React__default.FC<TooltipProps>;
280
+ declare const Tooltip: React.FC<TooltipProps>;
281
+
282
+ interface CalendarDate {
283
+ year: number;
284
+ month: number;
285
+ day: number;
286
+ }
287
+ interface CalendarTime {
288
+ hour: number;
289
+ minute: number;
290
+ period: "AM" | "PM";
291
+ }
292
+ interface CalendarDateRange {
293
+ start: CalendarDate | null;
294
+ end: CalendarDate | null;
295
+ }
296
+ type CalendarSize = "small" | "medium" | "large" | "extra-large";
297
+ interface CalendarProps {
298
+ value?: CalendarDate | null;
299
+ onChange?: (date: CalendarDate | null, dateString?: string) => void;
300
+ enableRangeSelection?: boolean;
301
+ rangeValue?: CalendarDateRange;
302
+ onRangeChange?: (range: CalendarDateRange) => void;
303
+ enableTimeSelection?: boolean;
304
+ timeValue?: CalendarTime | null;
305
+ onTimeChange?: (time: CalendarTime) => void;
306
+ showTimeFormatToggle?: boolean;
307
+ timeFormat?: "12h" | "24h";
308
+ onTimeFormatChange?: (format: "12h" | "24h") => void;
309
+ autoHide?: boolean;
310
+ showTodayButton?: boolean;
311
+ showClearButton?: boolean;
312
+ placeholder?: string;
313
+ className?: string;
314
+ disabled?: boolean;
315
+ onShow?: () => void;
316
+ onHide?: () => void;
317
+ icon?: React.ReactNode;
318
+ showIcon?: boolean;
319
+ size?: CalendarSize;
320
+ navButtonLayout?: {
321
+ width?: number;
322
+ height?: number;
323
+ };
324
+ navButtonStyles?: {
325
+ borderRadius?: number;
326
+ backgroundColor?: string;
327
+ };
328
+ navArrowLayout?: {
329
+ width?: number;
330
+ height?: number;
331
+ aspectRatio?: string;
332
+ };
333
+ navArrowStyles?: {
334
+ backgroundImage?: string;
335
+ backgroundColor?: string;
336
+ backgroundPosition?: string;
337
+ backgroundSize?: string;
338
+ backgroundRepeat?: string;
339
+ };
340
+ timeButtonLayout?: {
341
+ width?: number;
342
+ height?: number;
343
+ };
344
+ timeButtonStyles?: {
345
+ backgroundColor?: string;
346
+ borderRadius?: number;
347
+ };
348
+ timeButtonHoverGradient?: {
349
+ gradientStart?: string;
350
+ gradientEnd?: string;
351
+ gradientAngle?: number;
352
+ };
353
+ dateFieldLayout?: {
354
+ width?: number;
355
+ height?: number;
356
+ };
357
+ dateFieldStyles?: {
358
+ borderRadius?: number;
359
+ backgroundColor?: string;
360
+ };
361
+ todayButtonLayout?: {
362
+ width?: number;
363
+ height?: number;
364
+ };
365
+ todayButtonStyles?: {
366
+ backgroundColor?: string;
367
+ borderRadius?: number;
368
+ };
369
+ todayButtonHoverGradient?: {
370
+ gradientStart?: string;
371
+ gradientEnd?: string;
372
+ gradientAngle?: number;
373
+ };
374
+ clearButtonLayout?: {
375
+ width?: number;
376
+ height?: number;
377
+ };
378
+ clearButtonStyles?: {
379
+ backgroundColor?: string;
380
+ borderRadius?: number;
381
+ };
382
+ confirmTimeButtonLayout?: {
383
+ width?: number;
384
+ height?: number;
385
+ };
386
+ confirmTimeButtonStyles?: {
387
+ backgroundColor?: string;
388
+ borderRadius?: number;
389
+ };
390
+ confirmTimeButtonHoverGradient?: {
391
+ gradientStart?: string;
392
+ gradientEnd?: string;
393
+ gradientAngle?: number;
394
+ };
395
+ timeSelectLayout?: {
396
+ width?: number;
397
+ height?: number;
398
+ };
399
+ timeSelectStyles?: {
400
+ borderRadius?: number;
401
+ backgroundColor?: string;
402
+ borderColor?: string;
403
+ borderWidth?: number;
404
+ };
405
+ timeFormatToggleLayout?: {
406
+ width?: number;
407
+ height?: number;
408
+ };
409
+ timeFormatToggleStyles?: {
410
+ borderRadius?: number;
411
+ backgroundColor?: string;
412
+ };
413
+ previewTextStyles?: {
414
+ color?: string;
415
+ fontFamily?: string;
416
+ fontSize?: number;
417
+ fontWeight?: number;
418
+ };
419
+ globalTypography?: {
420
+ fontFamily?: string;
421
+ fontSize?: number;
422
+ fontWeight?: number;
423
+ fontStyle?: string;
424
+ lineHeight?: string;
425
+ };
426
+ calendarContainerLayout?: {
427
+ width?: number;
428
+ height?: number;
429
+ };
430
+ calendarContainerStyles?: {
431
+ borderRadius?: number;
432
+ };
433
+ enableYearDropdown?: boolean;
434
+ showDateFormatSelector?: boolean;
435
+ dateFormat?: string;
436
+ onDateFormatChange?: (format: string) => void;
437
+ showTimeZoneSelector?: boolean;
438
+ timeZoneFormat?: string;
439
+ onTimeZoneFormatChange?: (format: string) => void;
440
+ blockDateConfig?: {
441
+ startDate: CalendarDate;
442
+ days: number;
443
+ };
444
+ }
445
+ declare const Calendar: React.FC<CalendarProps>;
166
446
 
167
447
  interface DropdownProps {
168
448
  options: string[];
169
449
  onSelect: (option: string) => void;
170
450
  variant?: "basic" | "outline" | "pill" | "dark" | "underline" | "shadow" | "glass" | "gradient";
451
+ className?: string;
171
452
  }
172
- declare const Dropdown: React__default.FC<DropdownProps>;
453
+ declare const Dropdown: React.FC<DropdownProps>;
173
454
 
174
- export { Button as MahatiButton, Card as MahatiCard, Dropdown as MahatiDropdown, FormContainer as MahatiFormContainer, Input as MahatiInput, Modal as MahatiModal, TabbedInterface as MahatiTabbedInterface, Table as MahatiTable, TableTailwind as MahatiTableTailwind, Tooltip as MahatiTooltip };
455
+ export { type CalendarDate, type CalendarDateRange, type CalendarTime, Button as MahatiButton, Calendar as MahatiCalendar, Card as MahatiCard, ChartInterface as MahatiChart, Dropdown as MahatiDropdown, FormContainer as MahatiFormContainer, Input as MahatiInput, Modal as MahatiModal, TabbedInterface$1 as MahatiTabbedInterface, TabbedInterface as MahatiTabbedInterfaceTailwind, Table$1 as MahatiTable, Table as MahatiTableTailwind, Tooltip as MahatiTooltip };