@marcoschwartz/lite-ui 0.1.1 → 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,10 +1,13 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5
5
  variant?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
6
6
  size?: 'sm' | 'md' | 'lg' | 'xl';
7
7
  children: React.ReactNode;
8
+ leftIcon?: React.ReactNode;
9
+ rightIcon?: React.ReactNode;
10
+ iconOnly?: boolean;
8
11
  }
9
12
  declare const Button: React.FC<ButtonProps>;
10
13
 
@@ -20,9 +23,412 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'size'
20
23
  value?: string;
21
24
  defaultValue?: string;
22
25
  onChange?: (value: string) => void;
26
+ label?: string;
27
+ error?: string;
28
+ helperText?: string;
29
+ searchable?: boolean;
30
+ searchPlaceholder?: string;
23
31
  }
24
32
  declare const Select: React.FC<SelectProps>;
25
33
 
34
+ interface ModalProps {
35
+ isOpen: boolean;
36
+ onClose: () => void;
37
+ title?: string;
38
+ children: React.ReactNode;
39
+ size?: 'sm' | 'md' | 'lg' | 'xl';
40
+ showCloseButton?: boolean;
41
+ }
42
+ declare const Modal: React.FC<ModalProps>;
43
+
44
+ interface NavbarProps {
45
+ logo?: React.ReactNode;
46
+ children?: React.ReactNode;
47
+ className?: string;
48
+ sticky?: boolean;
49
+ }
50
+ declare const Navbar: React.FC<NavbarProps>;
51
+
52
+ interface SidebarProps {
53
+ children: React.ReactNode;
54
+ className?: string;
55
+ width?: 'sm' | 'md' | 'lg';
56
+ position?: 'left' | 'right';
57
+ }
58
+ declare const Sidebar: React.FC<SidebarProps>;
59
+
60
+ interface SidebarContextValue {
61
+ isOpen: boolean;
62
+ isMobile: boolean;
63
+ open: () => void;
64
+ close: () => void;
65
+ toggle: () => void;
66
+ setIsMobile: (isMobile: boolean) => void;
67
+ }
68
+ interface SidebarProviderProps {
69
+ children: ReactNode;
70
+ defaultOpen?: boolean;
71
+ }
72
+ declare const SidebarProvider: React.FC<SidebarProviderProps>;
73
+ declare const useSidebar: () => SidebarContextValue;
74
+
75
+ interface AppShellProps {
76
+ children: React.ReactNode;
77
+ navbar?: {
78
+ content: React.ReactNode;
79
+ width?: 'sm' | 'md' | 'lg';
80
+ breakpoint?: 'sm' | 'md' | 'lg' | 'xl';
81
+ position?: 'side' | 'top';
82
+ };
83
+ header?: React.ReactNode;
84
+ navbarTitle?: string;
85
+ navbarLogo?: React.ReactNode;
86
+ defaultNavbarOpen?: boolean;
87
+ responsive?: boolean;
88
+ className?: string;
89
+ }
90
+ declare const AppShell: React.FC<AppShellProps>;
91
+
92
+ interface DrawerProps {
93
+ isOpen: boolean;
94
+ onClose: () => void;
95
+ title?: string;
96
+ children: React.ReactNode;
97
+ position?: 'left' | 'right' | 'top' | 'bottom';
98
+ size?: 'sm' | 'md' | 'lg';
99
+ showCloseButton?: boolean;
100
+ }
101
+ declare const Drawer: React.FC<DrawerProps>;
102
+
103
+ interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
104
+ label?: string;
105
+ error?: string;
106
+ helperText?: string;
107
+ size?: 'sm' | 'md' | 'lg';
108
+ fullWidth?: boolean;
109
+ leftIcon?: React.ReactNode;
110
+ rightIcon?: React.ReactNode;
111
+ }
112
+ declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
113
+
114
+ interface NumberInputProps {
115
+ label?: string;
116
+ error?: string;
117
+ helperText?: string;
118
+ value?: number;
119
+ onChange?: (value: number | undefined) => void;
120
+ min?: number;
121
+ max?: number;
122
+ step?: number;
123
+ precision?: number;
124
+ disabled?: boolean;
125
+ hideControls?: boolean;
126
+ size?: 'sm' | 'md' | 'lg';
127
+ fullWidth?: boolean;
128
+ placeholder?: string;
129
+ className?: string;
130
+ }
131
+ declare const NumberInput: React.FC<NumberInputProps>;
132
+
133
+ type ActionMenuItem = {
134
+ type?: 'item';
135
+ label: string;
136
+ onClick: () => void;
137
+ icon?: React.ReactNode;
138
+ disabled?: boolean;
139
+ variant?: 'default' | 'danger';
140
+ } | {
141
+ type: 'divider';
142
+ };
143
+ interface ActionMenuProps {
144
+ items: ActionMenuItem[];
145
+ trigger?: React.ReactNode;
146
+ position?: 'left' | 'right';
147
+ placement?: 'top' | 'bottom' | 'left' | 'right';
148
+ }
149
+ declare const ActionMenu: React.FC<ActionMenuProps>;
150
+
151
+ interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
152
+ children: React.ReactNode;
153
+ className?: string;
154
+ padding?: 'none' | 'sm' | 'md' | 'lg';
155
+ hover?: boolean;
156
+ }
157
+ declare const Card: React.FC<CardProps>;
158
+
159
+ interface AlertProps {
160
+ variant?: 'info' | 'success' | 'warning' | 'error';
161
+ title?: string;
162
+ children: React.ReactNode;
163
+ onClose?: () => void;
164
+ className?: string;
165
+ }
166
+ declare const Alert: React.FC<AlertProps>;
167
+
168
+ interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
169
+ label?: string;
170
+ error?: string;
171
+ }
172
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
173
+
174
+ interface ToggleProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
175
+ label?: string;
176
+ size?: 'sm' | 'md' | 'lg';
177
+ }
178
+ declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
179
+
180
+ interface BadgeProps {
181
+ children: React.ReactNode;
182
+ variant?: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
183
+ size?: 'sm' | 'md' | 'lg';
184
+ className?: string;
185
+ }
186
+ declare const Badge: React.FC<BadgeProps>;
187
+
188
+ interface SpinnerProps {
189
+ size?: 'sm' | 'md' | 'lg' | 'xl';
190
+ color?: 'primary' | 'secondary' | 'white';
191
+ className?: string;
192
+ }
193
+ declare const Spinner: React.FC<SpinnerProps>;
194
+
195
+ interface Tab {
196
+ label: string;
197
+ content: React.ReactNode;
198
+ disabled?: boolean;
199
+ }
200
+ interface TabsProps {
201
+ tabs: Tab[];
202
+ defaultIndex?: number;
203
+ onChange?: (index: number) => void;
204
+ className?: string;
205
+ }
206
+ declare const Tabs: React.FC<TabsProps>;
207
+
208
+ interface Column<T = any> {
209
+ key: string;
210
+ title: string;
211
+ render?: (value: any, row: T, index: number) => React.ReactNode;
212
+ width?: string;
213
+ }
214
+ interface TableProps<T = any> {
215
+ columns: Column<T>[];
216
+ data: T[];
217
+ keyField?: string;
218
+ striped?: boolean;
219
+ hoverable?: boolean;
220
+ className?: string;
221
+ }
222
+ declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
223
+
224
+ interface PaginationProps {
225
+ currentPage: number;
226
+ totalPages: number;
227
+ onPageChange: (page: number) => void;
228
+ siblingCount?: number;
229
+ className?: string;
230
+ }
231
+ declare const Pagination: React.FC<PaginationProps>;
232
+
233
+ interface DatePickerProps {
234
+ label?: string;
235
+ error?: string;
236
+ helperText?: string;
237
+ value?: Date;
238
+ onChange?: (date: Date) => void;
239
+ minDate?: Date;
240
+ maxDate?: Date;
241
+ disabled?: boolean;
242
+ className?: string;
243
+ placeholder?: string;
244
+ }
245
+ declare const DatePicker: React.FC<DatePickerProps>;
246
+
247
+ interface TimePickerProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
248
+ label?: string;
249
+ error?: string;
250
+ helperText?: string;
251
+ }
252
+ declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>;
253
+
254
+ interface DateTimePickerProps {
255
+ label?: string;
256
+ error?: string;
257
+ helperText?: string;
258
+ value?: Date;
259
+ onChange?: (date: Date) => void;
260
+ minDate?: Date;
261
+ maxDate?: Date;
262
+ disabled?: boolean;
263
+ className?: string;
264
+ placeholder?: string;
265
+ }
266
+ declare const DateTimePicker: React.FC<DateTimePickerProps>;
267
+
268
+ interface CalendarProps {
269
+ value?: Date;
270
+ onChange?: (date: Date) => void;
271
+ minDate?: Date;
272
+ maxDate?: Date;
273
+ className?: string;
274
+ }
275
+ declare const Calendar: React.FC<CalendarProps>;
276
+
277
+ interface RadioOption {
278
+ value: string;
279
+ label: string;
280
+ disabled?: boolean;
281
+ }
282
+ interface RadioProps {
283
+ name: string;
284
+ options: RadioOption[];
285
+ value?: string;
286
+ defaultValue?: string;
287
+ onChange?: (value: string) => void;
288
+ disabled?: boolean;
289
+ orientation?: 'horizontal' | 'vertical';
290
+ className?: string;
291
+ }
292
+ declare const Radio: React.FC<RadioProps>;
293
+
294
+ interface ProgressBarProps {
295
+ value: number;
296
+ max?: number;
297
+ size?: 'sm' | 'md' | 'lg';
298
+ variant?: 'default' | 'success' | 'warning' | 'danger';
299
+ showLabel?: boolean;
300
+ label?: string;
301
+ className?: string;
302
+ }
303
+ declare const ProgressBar: React.FC<ProgressBarProps>;
304
+
305
+ interface SliderProps {
306
+ value?: number;
307
+ defaultValue?: number;
308
+ min?: number;
309
+ max?: number;
310
+ step?: number;
311
+ onChange?: (value: number) => void;
312
+ disabled?: boolean;
313
+ showValue?: boolean;
314
+ label?: string;
315
+ className?: string;
316
+ range?: boolean;
317
+ rangeValue?: [number, number];
318
+ defaultRangeValue?: [number, number];
319
+ onRangeChange?: (value: [number, number]) => void;
320
+ }
321
+ declare const Slider: React.FC<SliderProps>;
322
+
323
+ interface AvatarProps {
324
+ src?: string;
325
+ alt?: string;
326
+ name?: string;
327
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
328
+ shape?: 'circle' | 'square';
329
+ className?: string;
330
+ fallbackColor?: string;
331
+ }
332
+ declare const Avatar: React.FC<AvatarProps>;
333
+
334
+ interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
335
+ label?: string;
336
+ error?: string;
337
+ helperText?: string;
338
+ size?: 'sm' | 'md' | 'lg';
339
+ resize?: 'none' | 'vertical' | 'horizontal' | 'both';
340
+ }
341
+ declare const Textarea: React.FC<TextareaProps>;
342
+
343
+ interface RichTextEditorProps {
344
+ value?: string;
345
+ onChange?: (html: string) => void;
346
+ placeholder?: string;
347
+ className?: string;
348
+ minHeight?: string;
349
+ maxHeight?: string;
350
+ disabled?: boolean;
351
+ label?: string;
352
+ error?: string;
353
+ helperText?: string;
354
+ }
355
+ declare const RichTextEditor: React.FC<RichTextEditorProps>;
356
+
357
+ interface Toast {
358
+ id: string;
359
+ message: string;
360
+ type?: 'success' | 'error' | 'warning' | 'info';
361
+ duration?: number;
362
+ }
363
+ interface ToastContextValue {
364
+ toasts: Toast[];
365
+ addToast: (toast: Omit<Toast, 'id'>) => void;
366
+ removeToast: (id: string) => void;
367
+ }
368
+ declare const useToast: () => ToastContextValue;
369
+ interface ToastProviderProps {
370
+ children: React.ReactNode;
371
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
372
+ }
373
+ declare const ToastProvider: React.FC<ToastProviderProps>;
374
+ declare const toast: {
375
+ success: (message: string, duration?: number) => {
376
+ message: string;
377
+ type: "success";
378
+ duration: number | undefined;
379
+ };
380
+ error: (message: string, duration?: number) => {
381
+ message: string;
382
+ type: "error";
383
+ duration: number | undefined;
384
+ };
385
+ warning: (message: string, duration?: number) => {
386
+ message: string;
387
+ type: "warning";
388
+ duration: number | undefined;
389
+ };
390
+ info: (message: string, duration?: number) => {
391
+ message: string;
392
+ type: "info";
393
+ duration: number | undefined;
394
+ };
395
+ };
396
+
397
+ interface Step {
398
+ label: string;
399
+ description?: string;
400
+ }
401
+ interface StepperProps {
402
+ steps: Step[];
403
+ currentStep: number;
404
+ orientation?: 'horizontal' | 'vertical';
405
+ className?: string;
406
+ }
407
+ declare const Stepper: React.FC<StepperProps>;
408
+
409
+ interface DividerProps {
410
+ orientation?: 'horizontal' | 'vertical';
411
+ variant?: 'solid' | 'dashed' | 'dotted';
412
+ className?: string;
413
+ label?: string;
414
+ labelPosition?: 'left' | 'center' | 'right';
415
+ }
416
+ declare const Divider: React.FC<DividerProps>;
417
+
418
+ interface FileUploadProps {
419
+ accept?: string;
420
+ multiple?: boolean;
421
+ maxSize?: number;
422
+ maxFiles?: number;
423
+ disabled?: boolean;
424
+ onChange?: (files: File[]) => void;
425
+ onError?: (error: string) => void;
426
+ className?: string;
427
+ label?: string;
428
+ helperText?: string;
429
+ }
430
+ declare const FileUpload: React.FC<FileUploadProps>;
431
+
26
432
  type ThemeName = 'default' | 'minimalistic';
27
433
  interface ButtonTheme {
28
434
  primary: string;
@@ -66,6 +472,7 @@ interface ThemeContextValue {
66
472
  setTheme: (themeName: ThemeName) => void;
67
473
  colorMode: ColorMode;
68
474
  setColorMode: (mode: ColorMode) => void;
475
+ toggleColorMode: () => void;
69
476
  resolvedColorMode: 'light' | 'dark';
70
477
  }
71
478
  declare function useTheme(): ThemeContextValue;
@@ -84,4 +491,71 @@ declare function ThemeProvider({ children, defaultTheme, defaultColorMode }: The
84
491
  declare const themeScript = "\n(function() {\n try {\n // Get stored preferences\n const storedTheme = localStorage.getItem('lite-ui-theme') || 'default';\n const storedColorMode = localStorage.getItem('lite-ui-color-mode');\n\n // Determine color mode (system, light, or dark)\n let colorMode = storedColorMode;\n if (!colorMode || colorMode === 'system') {\n colorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Set attributes before render\n document.documentElement.setAttribute('data-theme', storedTheme);\n document.documentElement.setAttribute('data-color-mode', colorMode);\n\n // Add dark class for Tailwind\n if (colorMode === 'dark') {\n document.documentElement.classList.add('dark');\n } else {\n document.documentElement.classList.remove('dark');\n }\n } catch (e) {\n console.error('Failed to initialize theme:', e);\n }\n})();\n";
85
492
  declare function getThemeScript(): string;
86
493
 
87
- export { Button, type ButtonProps, type ButtonTheme, type ColorMode, Select, type SelectOption, type SelectProps, type SelectTheme, type Theme, type ThemeName, ThemeProvider, getThemeScript, themeScript, themes, useTheme };
494
+ interface IconProps {
495
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
496
+ className?: string;
497
+ color?: string;
498
+ }
499
+ interface IconComponent extends React.FC<IconProps> {
500
+ displayName?: string;
501
+ }
502
+
503
+ declare const HomeIcon: IconComponent;
504
+
505
+ declare const UserIcon: IconComponent;
506
+
507
+ declare const SearchIcon: IconComponent;
508
+
509
+ declare const BellIcon: IconComponent;
510
+
511
+ declare const SettingsIcon: IconComponent;
512
+
513
+ declare const MenuIcon: IconComponent;
514
+
515
+ declare const CloseIcon: IconComponent;
516
+
517
+ declare const ChevronDownIcon: IconComponent;
518
+
519
+ declare const ChevronRightIcon: IconComponent;
520
+
521
+ declare const CheckIcon: IconComponent;
522
+
523
+ declare const PlusIcon: IconComponent;
524
+
525
+ declare const TrashIcon: IconComponent;
526
+
527
+ declare const EditIcon: IconComponent;
528
+
529
+ declare const MailIcon: IconComponent;
530
+
531
+ declare const StarIcon: IconComponent;
532
+
533
+ declare const HeartIcon: IconComponent;
534
+
535
+ declare const DownloadIcon: IconComponent;
536
+
537
+ declare const UploadIcon: IconComponent;
538
+
539
+ declare const CameraIcon: IconComponent;
540
+
541
+ declare const LockIcon: IconComponent;
542
+
543
+ declare const CalendarIcon: IconComponent;
544
+
545
+ declare const GoogleIcon: IconComponent;
546
+
547
+ declare const GitHubIcon: IconComponent;
548
+
549
+ declare const TwitterIcon: IconComponent;
550
+
551
+ declare const FacebookIcon: IconComponent;
552
+
553
+ declare const AppleIcon: IconComponent;
554
+
555
+ declare const LinkedInIcon: IconComponent;
556
+
557
+ declare const YouTubeIcon: IconComponent;
558
+
559
+ declare const SlackIcon: IconComponent;
560
+
561
+ export { ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, type AlertProps, AppShell, type AppShellProps, AppleIcon, Avatar, type AvatarProps, Badge, type BadgeProps, BellIcon, Button, type ButtonProps, type ButtonTheme, Calendar, CalendarIcon, type CalendarProps, CameraIcon, Card, type CardProps, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronRightIcon, CloseIcon, type ColorMode, type Column, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Divider, type DividerProps, DownloadIcon, Drawer, type DrawerProps, EditIcon, FacebookIcon, FileUpload, type FileUploadProps, GitHubIcon, GoogleIcon, HeartIcon, HomeIcon, type IconComponent, type IconProps, LinkedInIcon, LockIcon, MailIcon, MenuIcon, Modal, type ModalProps, Navbar, type NavbarProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PlusIcon, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, RichTextEditor, type RichTextEditorProps, SearchIcon, Select, type SelectOption, type SelectProps, type SelectTheme, SettingsIcon, Sidebar, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SlackIcon, Slider, type SliderProps, Spinner, type SpinnerProps, StarIcon, type Step, Stepper, type StepperProps, type Tab, Table, type TableProps, Tabs, type TabsProps, TextInput, type TextInputProps, Textarea, type TextareaProps, type Theme, type ThemeName, ThemeProvider, TimePicker, type TimePickerProps, type Toast, ToastProvider, type ToastProviderProps, Toggle, type ToggleProps, TrashIcon, TwitterIcon, UploadIcon, UserIcon, YouTubeIcon, getThemeScript, themeScript, themes, toast, useSidebar, useTheme, useToast };