@khraben/flowui 1.0.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,527 @@
1
+ import * as React$1 from 'react';
2
+ import React__default, { ComponentType, SVGProps, ReactNode } from 'react';
3
+ import ReactDatePicker from 'react-datepicker';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { LucideIcon } from 'lucide-react';
6
+
7
+ type ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'close' | 'clear' | 'icon';
8
+ type ButtonSize = 'sm' | 'md' | 'lg';
9
+
10
+ /**
11
+ * Base color configuration required for all components
12
+ */
13
+ interface BaseColorConfig {
14
+ primary: string;
15
+ secondary: string;
16
+ accent: string;
17
+ }
18
+ /**
19
+ * Extended color configuration with status colors
20
+ * Use this for components that need warning, success, or danger states
21
+ */
22
+ interface ExtendedColorConfig extends BaseColorConfig {
23
+ warning: string;
24
+ success: string;
25
+ danger: string;
26
+ }
27
+ /**
28
+ * Type guard to check if color config has extended colors
29
+ */
30
+ declare function hasExtendedColors(config: BaseColorConfig | ExtendedColorConfig): config is ExtendedColorConfig;
31
+ /**
32
+ * Default color configuration
33
+ */
34
+ declare const DEFAULT_COLOR_CONFIG: ExtendedColorConfig;
35
+
36
+ interface ButtonProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
37
+ variant?: ButtonVariant;
38
+ size?: ButtonSize;
39
+ icon?: React__default.ReactNode;
40
+ iconPosition?: 'left' | 'right';
41
+ isLoading?: boolean;
42
+ loadingText?: string;
43
+ fullWidth?: boolean;
44
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
45
+ children?: React__default.ReactNode;
46
+ baseClassName?: string;
47
+ variantClassName?: string;
48
+ sizeClassName?: string;
49
+ disableDefaultStyles?: boolean;
50
+ colors?: BaseColorConfig;
51
+ customBg?: string;
52
+ customTextColor?: string;
53
+ customBorderColor?: string;
54
+ }
55
+
56
+ declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
57
+
58
+ type InputVariant = 'text' | 'number' | 'search' | 'select' | 'password' | 'time' | 'date';
59
+ type InputSize = 'sm' | 'md' | 'lg';
60
+ type SelectVariant = 'select';
61
+ type TimeVariant = 'time';
62
+
63
+ interface InputProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'size'> {
64
+ variant?: InputVariant;
65
+ size?: InputSize;
66
+ label?: string;
67
+ labelStyle?: React__default.CSSProperties;
68
+ onClear?: () => void;
69
+ showPasswordToggle?: boolean;
70
+ passwordIcon?: React__default.ReactNode;
71
+ passwordIconHidden?: React__default.ReactNode;
72
+ searchIcon?: React__default.ReactNode;
73
+ clearIcon?: React__default.ReactNode;
74
+ fullWidth?: boolean;
75
+ baseClassName?: string;
76
+ labelClassName?: string;
77
+ wrapperClassName?: string;
78
+ disableDefaultStyles?: boolean;
79
+ colors?: BaseColorConfig;
80
+ customBg?: string;
81
+ customTextColor?: string;
82
+ customBorderColor?: string;
83
+ }
84
+
85
+ interface SelectInputProps extends Omit<React__default.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
86
+ variant?: SelectVariant;
87
+ size?: InputSize;
88
+ label?: string;
89
+ labelStyle?: React__default.CSSProperties;
90
+ children?: React__default.ReactNode;
91
+ selectIcon?: React__default.ReactNode;
92
+ fullWidth?: boolean;
93
+ baseClassName?: string;
94
+ labelClassName?: string;
95
+ wrapperClassName?: string;
96
+ disableDefaultStyles?: boolean;
97
+ colors?: BaseColorConfig;
98
+ customBg?: string;
99
+ customTextColor?: string;
100
+ customBorderColor?: string;
101
+ }
102
+
103
+ interface TimeInputProps {
104
+ variant?: TimeVariant;
105
+ size?: InputSize;
106
+ label?: string;
107
+ value?: string;
108
+ onChange?: (e: React__default.ChangeEvent<HTMLSelectElement>) => void;
109
+ startHour?: number;
110
+ endHour?: number;
111
+ interval?: number;
112
+ selectIcon?: React__default.ReactNode;
113
+ fullWidth?: boolean;
114
+ baseClassName?: string;
115
+ labelClassName?: string;
116
+ wrapperClassName?: string;
117
+ disableDefaultStyles?: boolean;
118
+ className?: string;
119
+ colors?: BaseColorConfig;
120
+ customBg?: string;
121
+ customTextColor?: string;
122
+ customBorderColor?: string;
123
+ }
124
+
125
+ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
126
+ declare const SelectInput: React$1.ForwardRefExoticComponent<SelectInputProps & React$1.RefAttributes<HTMLSelectElement>>;
127
+ declare const TimeInput: React$1.ForwardRefExoticComponent<TimeInputProps & React$1.RefAttributes<HTMLSelectElement>>;
128
+
129
+ type DatePickerSize = 'sm' | 'md' | 'lg';
130
+ interface DatePickerProps {
131
+ size?: DatePickerSize;
132
+ onClear?: () => void;
133
+ calendarIcon?: React__default.ReactNode;
134
+ clearIcon?: React__default.ReactNode;
135
+ fullWidth?: boolean;
136
+ baseClassName?: string;
137
+ wrapperClassName?: string;
138
+ disableDefaultStyles?: boolean;
139
+ locale?: unknown;
140
+ selected?: Date | null;
141
+ onChange?: ((date: Date | null, event?: React__default.SyntheticEvent<unknown> | undefined) => void) | ((dates: Date[] | null, event?: React__default.MouseEvent<HTMLElement> | React__default.KeyboardEvent<HTMLElement> | undefined) => void);
142
+ placeholderText?: string;
143
+ dateFormat?: string;
144
+ disabled?: boolean;
145
+ readOnly?: boolean;
146
+ minDate?: Date | null;
147
+ maxDate?: Date | null;
148
+ filterDate?: (date: Date) => boolean;
149
+ includeDates?: Date[];
150
+ excludeDates?: Date[];
151
+ highlightDates?: Date[];
152
+ showMonthDropdown?: boolean;
153
+ showYearDropdown?: boolean;
154
+ showMonthYearPicker?: boolean;
155
+ dropdownMode?: 'scroll' | 'select';
156
+ showTimeSelect?: boolean;
157
+ timeFormat?: string;
158
+ timeIntervals?: number;
159
+ timeCaption?: string;
160
+ showTimeSelectOnly?: boolean;
161
+ dateFormatCalendar?: string;
162
+ monthsShown?: number;
163
+ inline?: boolean;
164
+ fixedHeight?: boolean;
165
+ selectsRange?: boolean;
166
+ startDate?: Date | null;
167
+ endDate?: Date | null;
168
+ selectsStart?: boolean;
169
+ selectsEnd?: boolean;
170
+ isClearable?: boolean;
171
+ clearButtonClassName?: string;
172
+ shouldCloseOnSelect?: boolean;
173
+ showPopperArrow?: boolean;
174
+ autoComplete?: string;
175
+ className?: string;
176
+ label?: string;
177
+ labelStyle?: React__default.CSSProperties;
178
+ colors?: BaseColorConfig;
179
+ customBg?: string;
180
+ customTextColor?: string;
181
+ customBorderColor?: string;
182
+ }
183
+
184
+ declare const DatePicker: React$1.ForwardRefExoticComponent<DatePickerProps & React$1.RefAttributes<ReactDatePicker>>;
185
+
186
+ interface LanguageSelectorProps {
187
+ selectedLanguage?: string;
188
+ onLanguageChange?: (languageKey: string) => void;
189
+ availableLanguages?: string[];
190
+ size?: 'sm' | 'md' | 'lg';
191
+ buttonClassName?: string;
192
+ dropdownClassName?: string;
193
+ itemClassName?: string;
194
+ activeItemClassName?: string;
195
+ disableDefaultStyles?: boolean;
196
+ colors?: BaseColorConfig;
197
+ customBorderColor?: string;
198
+ customBgColor?: string;
199
+ customTextColor?: string;
200
+ }
201
+
202
+ declare const LanguageSelector: React__default.ForwardRefExoticComponent<LanguageSelectorProps & React__default.RefAttributes<HTMLButtonElement>>;
203
+
204
+ interface ThemeSelectorProps {
205
+ theme?: 'light' | 'dark';
206
+ onThemeChange?: (theme: 'light' | 'dark') => void;
207
+ size?: 'sm' | 'md' | 'lg';
208
+ buttonClassName?: string;
209
+ disableDefaultStyles?: boolean;
210
+ colors?: BaseColorConfig;
211
+ customBorderColor?: string;
212
+ customBgColor?: string;
213
+ }
214
+
215
+ declare const ThemeSelector: React__default.ForwardRefExoticComponent<ThemeSelectorProps & React__default.RefAttributes<HTMLButtonElement>>;
216
+
217
+ interface ActionIconProps {
218
+ icon: ComponentType<SVGProps<SVGSVGElement>>;
219
+ onClick?: () => void;
220
+ title?: string;
221
+ size?: 'sm' | 'md' | 'lg';
222
+ className?: string;
223
+ disabled?: boolean;
224
+ colors?: BaseColorConfig;
225
+ customColor?: string;
226
+ customBg?: string;
227
+ }
228
+
229
+ declare const ActionIcon: React__default.FC<ActionIconProps>;
230
+
231
+ interface LoaderProps {
232
+ text?: string;
233
+ size?: 'sm' | 'md' | 'lg';
234
+ variant?: 'spinner' | 'dots' | 'pulse';
235
+ fullScreen?: boolean;
236
+ overlay?: boolean;
237
+ colors?: BaseColorConfig;
238
+ customOverlayColor?: string;
239
+ customSpinnerColor?: string;
240
+ }
241
+
242
+ declare const Loader: React__default.FC<LoaderProps>;
243
+
244
+ type SortDirection = 'asc' | 'desc';
245
+ interface TableColumn<T = Record<string, unknown>> {
246
+ key: string;
247
+ label: string;
248
+ sortable?: boolean;
249
+ render?: (value: unknown, item: T) => React.ReactNode;
250
+ }
251
+ interface TableActionConfig {
252
+ info?: boolean;
253
+ edit?: boolean;
254
+ delete?: boolean;
255
+ }
256
+ interface TableProps<T = Record<string, unknown>> {
257
+ columns: TableColumn<T>[];
258
+ data: T[];
259
+ onInfo?: (item: T) => void;
260
+ onEdit?: (item: T) => void;
261
+ onDelete?: (item: T) => void;
262
+ sortField?: string;
263
+ sortDirection?: SortDirection;
264
+ onSort?: (field: string) => void;
265
+ noDataMessage?: string;
266
+ showActions?: boolean;
267
+ actionConfig?: TableActionConfig;
268
+ actionsLabel?: string;
269
+ infoIcon?: ComponentType<SVGProps<SVGSVGElement>>;
270
+ editIcon?: ComponentType<SVGProps<SVGSVGElement>>;
271
+ deleteIcon?: ComponentType<SVGProps<SVGSVGElement>>;
272
+ colors?: ExtendedColorConfig;
273
+ customHeaderBg?: string;
274
+ customRowBg?: string;
275
+ }
276
+
277
+ declare const Table: {
278
+ <T extends Record<string, unknown>>({ columns, data, onInfo, onEdit, onDelete, sortField, sortDirection, onSort, noDataMessage, showActions, actionConfig, actionsLabel, infoIcon, editIcon, deleteIcon, colors, customHeaderBg, customRowBg, }: TableProps<T>): react_jsx_runtime.JSX.Element;
279
+ displayName: string;
280
+ };
281
+
282
+ /**
283
+ * Stat item configuration for BaseModal stats display
284
+ */
285
+ interface BaseModalStat {
286
+ /** The icon component to display */
287
+ icon?: LucideIcon;
288
+ /** The numeric value or text to display */
289
+ number: string | number;
290
+ /** The label text below the number */
291
+ label: string;
292
+ /** Custom color for the icon */
293
+ color?: string;
294
+ }
295
+ /**
296
+ * Text labels for BaseModal i18n support
297
+ */
298
+ interface BaseModalTexts {
299
+ /** Title for the discard changes confirmation modal */
300
+ discardChangesTitle?: string;
301
+ /** Warning message for unsaved changes */
302
+ unsavedChangesWarning?: string;
303
+ /** Text for "Continue Editing" button */
304
+ continueEditing?: string;
305
+ /** Text for "Discard" button */
306
+ discardButton?: string;
307
+ }
308
+ /**
309
+ * Props for BaseModal component
310
+ */
311
+ interface BaseModalProps {
312
+ /** Whether the modal is open */
313
+ isOpen: boolean;
314
+ /** Callback when modal should close */
315
+ onClose: () => void;
316
+ /** Modal title */
317
+ title: string;
318
+ /** Icon to display next to the title */
319
+ icon?: LucideIcon;
320
+ /** Modal content */
321
+ children: ReactNode;
322
+ /** Optional stats to display below the header */
323
+ stats?: BaseModalStat[];
324
+ /** Maximum width of the modal (default: "56.25rem") */
325
+ maxWidth?: string;
326
+ /** Whether to show the close button (default: true) */
327
+ showCloseButton?: boolean;
328
+ /** Whether the modal has unsaved changes (shows confirmation on close) */
329
+ hasUnsavedChanges?: boolean;
330
+ /** Custom text labels for i18n support */
331
+ texts?: BaseModalTexts;
332
+ colors?: ExtendedColorConfig;
333
+ customOverlayBg?: string;
334
+ customModalBg?: string;
335
+ }
336
+
337
+ declare const BaseModal: React__default.FC<BaseModalProps>;
338
+
339
+ interface ConfirmationModalProps {
340
+ isOpen: boolean;
341
+ onClose: () => void;
342
+ onConfirm: () => Promise<void> | void;
343
+ message: string;
344
+ confirmText?: string;
345
+ cancelText?: string;
346
+ loadingContent?: ReactNode;
347
+ colors?: ExtendedColorConfig;
348
+ }
349
+ declare const ConfirmationModal: React__default.FC<ConfirmationModalProps>;
350
+
351
+ interface SideBarMenuItem {
352
+ id: string;
353
+ label: string;
354
+ icon: React__default.ReactNode;
355
+ onClick?: () => void;
356
+ href?: string;
357
+ section?: 'top' | 'bottom';
358
+ isActive?: boolean;
359
+ }
360
+ interface SideBarLogoutButton {
361
+ label: string;
362
+ icon: React__default.ReactNode;
363
+ onClick: () => void;
364
+ }
365
+ interface SideBarProps {
366
+ menuItems: SideBarMenuItem[];
367
+ logoutButton?: SideBarLogoutButton;
368
+ isOpen?: boolean;
369
+ onToggle?: (isOpen: boolean) => void;
370
+ openWidth?: string;
371
+ closedWidth?: string;
372
+ languageSelector?: {
373
+ selectedLanguage?: string;
374
+ onLanguageChange?: (languageKey: string) => void;
375
+ availableLanguages?: string[];
376
+ };
377
+ colors?: BaseColorConfig;
378
+ customBg?: string;
379
+ customTextColor?: string;
380
+ customHoverBg?: string;
381
+ customToggleBtnBg?: string;
382
+ customToggleBtnHoverBg?: string;
383
+ customLogoutTextColor?: string;
384
+ customLogoutHoverBg?: string;
385
+ customLogoutHoverTextColor?: string;
386
+ }
387
+
388
+ declare const SideBar: {
389
+ ({ menuItems, logoutButton, isOpen: controlledIsOpen, onToggle, openWidth, closedWidth, colors, customBg, customTextColor, customHoverBg, customToggleBtnBg, customToggleBtnHoverBg, customLogoutTextColor, customLogoutHoverBg, customLogoutHoverTextColor, languageSelector, }: SideBarProps): react_jsx_runtime.JSX.Element;
390
+ displayName: string;
391
+ };
392
+
393
+ interface NavBarLogo {
394
+ src?: string;
395
+ alt?: string;
396
+ text?: string;
397
+ href?: string;
398
+ onClick?: () => void;
399
+ }
400
+ interface NavBarMenuItem {
401
+ id?: string;
402
+ label: string;
403
+ href?: string;
404
+ onClick?: () => void;
405
+ isActive?: boolean;
406
+ }
407
+ interface NavBarAction {
408
+ id?: string;
409
+ label: string;
410
+ onClick: () => void;
411
+ variant?: 'primary' | 'secondary' | 'outline';
412
+ icon?: React__default.ReactNode;
413
+ }
414
+ interface NavBarProps {
415
+ logo?: NavBarLogo;
416
+ menuItems?: NavBarMenuItem[];
417
+ actions?: NavBarAction[];
418
+ colors?: BaseColorConfig;
419
+ customBgColor?: string;
420
+ customTextColor?: string;
421
+ customActiveColor?: string;
422
+ customHoverColor?: string;
423
+ height?: string;
424
+ showMobileMenu?: boolean;
425
+ onMobileMenuToggle?: (isOpen: boolean) => void;
426
+ languageSelector?: {
427
+ selectedLanguage?: string;
428
+ onLanguageChange?: (languageKey: string) => void;
429
+ availableLanguages?: string[];
430
+ };
431
+ }
432
+
433
+ declare const NavBar: {
434
+ ({ logo, menuItems, actions, colors, customBgColor, customTextColor, customActiveColor, customHoverColor, height, showMobileMenu: controlledMobileMenu, onMobileMenuToggle, languageSelector, }: NavBarProps): react_jsx_runtime.JSX.Element;
435
+ displayName: string;
436
+ };
437
+
438
+ interface GalleryImage {
439
+ id?: string;
440
+ src: string;
441
+ alt?: string;
442
+ width?: number;
443
+ height?: number;
444
+ }
445
+ interface GalleryProps {
446
+ images: GalleryImage[];
447
+ batchSize?: number;
448
+ enableAnimation?: boolean;
449
+ className?: string;
450
+ disableDefaultStyles?: boolean;
451
+ forceColumnCount?: number;
452
+ gap?: string;
453
+ colors?: BaseColorConfig;
454
+ customBorderColor?: string;
455
+ customSkeletonBg?: string;
456
+ customOverlayColor?: string;
457
+ }
458
+
459
+ declare const Gallery: {
460
+ ({ images, batchSize, enableAnimation, forceColumnCount, gap, colors, customBorderColor, customSkeletonBg, customOverlayColor, }: GalleryProps): react_jsx_runtime.JSX.Element;
461
+ displayName: string;
462
+ };
463
+
464
+ declare const FlagEN: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
465
+
466
+ declare const FlagES: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
467
+
468
+ declare const FlagDE: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
469
+
470
+ declare const FlagFR: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
471
+
472
+ declare const FlagIT: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
473
+
474
+ declare const FlagJA: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
475
+
476
+ declare const FlagPT: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
477
+
478
+ declare const FlagRU: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
479
+
480
+ declare const FlagZH: ({ className }: FlagProps) => react_jsx_runtime.JSX.Element;
481
+
482
+ /**
483
+ * Flag component props
484
+ * All flag components accept a className prop for customization
485
+ */
486
+ interface FlagProps {
487
+ className?: string;
488
+ }
489
+
490
+ /**
491
+ * Color utility functions for dynamic color manipulation
492
+ */
493
+ /**
494
+ * Determines if a color is dark based on its luminance
495
+ */
496
+ declare function isDarkColor(hex: string): boolean;
497
+ /**
498
+ * Darkens a color by a given percentage
499
+ * @param hex - Hex color string (e.g., '#FF5733')
500
+ * @param percent - Percentage to darken (0-100)
501
+ */
502
+ declare function darkenColor(hex: string, percent?: number): string;
503
+ /**
504
+ * Lightens a color by a given percentage
505
+ * @param hex - Hex color string (e.g., '#FF5733')
506
+ * @param percent - Percentage to lighten (0-100)
507
+ */
508
+ declare function lightenColor(hex: string, percent?: number): string;
509
+ /**
510
+ * Automatically calculates the hover color for a given base color
511
+ * Darkens light colors and lightens dark colors
512
+ * @param hex - Hex color string
513
+ * @param intensity - Intensity of the effect (default: 10)
514
+ */
515
+ declare function getHoverColor(hex: string, intensity?: number): string;
516
+ /**
517
+ * Gets a contrast color (black or white) for text based on background color
518
+ */
519
+ declare function getContrastColor(hex: string): string;
520
+ /**
521
+ * Adjusts color opacity
522
+ * @param hex - Hex color string
523
+ * @param opacity - Opacity value (0-1)
524
+ */
525
+ declare function adjustOpacity(hex: string, opacity: number): string;
526
+
527
+ export { ActionIcon, type ActionIconProps, type BaseColorConfig, BaseModal, type BaseModalProps, type BaseModalStat, type BaseModalTexts, Button, type ButtonProps, ConfirmationModal, type ConfirmationModalProps, DEFAULT_COLOR_CONFIG, DatePicker, type DatePickerProps, type ExtendedColorConfig, FlagDE, FlagEN, FlagES, FlagFR, FlagIT, FlagJA, FlagPT, type FlagProps, FlagRU, FlagZH, Gallery, type GalleryImage, type GalleryProps, Input, type InputProps, LanguageSelector, type LanguageSelectorProps, Loader, type LoaderProps, NavBar, type NavBarAction, type NavBarLogo, type NavBarMenuItem, type NavBarProps, SelectInput, SideBar, type SideBarLogoutButton, type SideBarMenuItem, type SideBarProps, Table, type TableColumn, type TableProps, ThemeSelector, type ThemeSelectorProps, TimeInput, adjustOpacity, darkenColor, getContrastColor, getHoverColor, hasExtendedColors, isDarkColor, lightenColor };