my-animated-components 1.3.9 → 1.4.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.ts +233 -25
- package/dist/index.js +307 -163
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React$1 from 'react';
|
|
2
|
-
import { Variants, HTMLMotionProps, motion } from 'framer-motion';
|
|
1
|
+
import React$1, { ReactNode } from 'react';
|
|
2
|
+
import { Variants, HTMLMotionProps, Transition, motion, MotionProps } from 'framer-motion';
|
|
3
3
|
|
|
4
4
|
declare const motionVariants: Record<string, Variants>;
|
|
5
5
|
|
|
@@ -10,27 +10,106 @@ interface WithChildren {
|
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
type Color$e = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
13
|
-
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
type Size$1 = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
14
|
interface ColorProps {
|
|
15
15
|
color?: Color$e;
|
|
16
16
|
}
|
|
17
17
|
interface SizeProps {
|
|
18
|
-
size?: Size;
|
|
18
|
+
size?: Size$1;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type Color$d = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
22
|
-
type
|
|
21
|
+
type Color$d = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | string;
|
|
22
|
+
type ButtonVariant = 'solid' | 'outline' | 'ghost' | string;
|
|
23
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
|
|
24
|
+
type MotionVariantKey$3 = keyof typeof motionVariants;
|
|
23
25
|
interface ButtonProps extends BaseProps, SizeProps, HTMLMotionProps<'button'> {
|
|
24
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Visual style of the button
|
|
28
|
+
* @default 'solid'
|
|
29
|
+
*/
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
/**
|
|
32
|
+
* Color theme of the button
|
|
33
|
+
* @default 'primary'
|
|
34
|
+
*/
|
|
25
35
|
color?: Color$d;
|
|
26
36
|
/**
|
|
27
|
-
* Predefined motion variant
|
|
28
|
-
*
|
|
37
|
+
* Predefined motion variant from motionVariants for initial animation
|
|
38
|
+
* @default 'fadeIn'
|
|
29
39
|
*/
|
|
30
|
-
motionVariant?: MotionVariantKey;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
motionVariant?: MotionVariantKey$3;
|
|
41
|
+
/**
|
|
42
|
+
* Custom animation variants to override default motionVariants
|
|
43
|
+
*/
|
|
44
|
+
customVariants?: Variants;
|
|
45
|
+
/**
|
|
46
|
+
* Predefined motion variant for hover animation
|
|
47
|
+
*/
|
|
48
|
+
whileHoverAnimation?: MotionVariantKey$3;
|
|
49
|
+
/**
|
|
50
|
+
* Predefined motion variant for tap animation
|
|
51
|
+
*/
|
|
52
|
+
whileTapAnimation?: MotionVariantKey$3;
|
|
53
|
+
/**
|
|
54
|
+
* Predefined motion variant for focus animation
|
|
55
|
+
*/
|
|
56
|
+
whileFocusAnimation?: MotionVariantKey$3;
|
|
57
|
+
/**
|
|
58
|
+
* Custom transition for initial animation
|
|
59
|
+
*/
|
|
60
|
+
customTransition?: Transition;
|
|
61
|
+
/**
|
|
62
|
+
* Custom hover animation properties
|
|
63
|
+
*/
|
|
64
|
+
customHoverAnimation?: Record<string, any>;
|
|
65
|
+
/**
|
|
66
|
+
* Custom tap animation properties
|
|
67
|
+
*/
|
|
68
|
+
customTapAnimation?: Record<string, any>;
|
|
69
|
+
/**
|
|
70
|
+
* Custom focus animation properties
|
|
71
|
+
*/
|
|
72
|
+
customFocusAnimation?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* Custom class names for different button states
|
|
75
|
+
*/
|
|
76
|
+
stateClasses?: {
|
|
77
|
+
hover?: string;
|
|
78
|
+
focus?: string;
|
|
79
|
+
active?: string;
|
|
80
|
+
disabled?: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Custom class names for different variants and colors
|
|
84
|
+
*/
|
|
85
|
+
customClasses?: {
|
|
86
|
+
[variant in ButtonVariant]?: {
|
|
87
|
+
[color in Color$d]?: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Custom size class mapping
|
|
92
|
+
*/
|
|
93
|
+
customSizeClasses?: Record<Size, string>;
|
|
94
|
+
/**
|
|
95
|
+
* Whether to use animation on initial render
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
useAnimation?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Custom base classes to override defaults
|
|
101
|
+
*/
|
|
102
|
+
baseClassName?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Option to bypass default styling completely
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
unstyled?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Button type attribute
|
|
110
|
+
* @default 'button'
|
|
111
|
+
*/
|
|
112
|
+
type?: 'button' | 'submit' | 'reset';
|
|
34
113
|
}
|
|
35
114
|
declare const Button: React$1.FC<ButtonProps>;
|
|
36
115
|
|
|
@@ -79,7 +158,7 @@ interface AlertProps extends BaseProps, WithChildren, ColorProps {
|
|
|
79
158
|
}
|
|
80
159
|
declare const Alert: React$1.FC<AlertProps>;
|
|
81
160
|
|
|
82
|
-
interface AvatarProps extends BaseProps, SizeProps {
|
|
161
|
+
interface AvatarProps extends BaseProps, SizeProps, HTMLMotionProps<'div'> {
|
|
83
162
|
src?: string;
|
|
84
163
|
alt?: string;
|
|
85
164
|
initials?: string;
|
|
@@ -211,6 +290,8 @@ declare const Textarea: React$1.FC<TextareaProps>;
|
|
|
211
290
|
interface ContainerProps extends BaseProps, WithChildren {
|
|
212
291
|
fluid?: boolean;
|
|
213
292
|
motionVariant?: keyof typeof motionVariants;
|
|
293
|
+
duration?: number;
|
|
294
|
+
loop?: boolean;
|
|
214
295
|
}
|
|
215
296
|
declare const Container: React$1.FC<ContainerProps>;
|
|
216
297
|
|
|
@@ -219,26 +300,43 @@ interface FlexProps extends BaseProps, WithChildren {
|
|
|
219
300
|
justify?: 'start' | 'center' | 'end' | 'between' | 'around';
|
|
220
301
|
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
221
302
|
wrap?: boolean;
|
|
303
|
+
motionVariant?: keyof typeof motionVariants;
|
|
304
|
+
duration?: number;
|
|
305
|
+
loop?: boolean;
|
|
222
306
|
}
|
|
223
307
|
declare const Flex: React$1.FC<FlexProps>;
|
|
224
308
|
|
|
225
309
|
interface GridProps extends BaseProps, WithChildren {
|
|
226
310
|
cols?: number;
|
|
227
311
|
gap?: number;
|
|
312
|
+
motionVariant?: keyof typeof motionVariants;
|
|
313
|
+
duration?: number;
|
|
314
|
+
loop?: boolean;
|
|
228
315
|
}
|
|
229
316
|
declare const Grid: React$1.FC<GridProps>;
|
|
230
317
|
|
|
231
318
|
interface ListProps extends BaseProps, WithChildren {
|
|
232
319
|
as?: 'ul' | 'ol';
|
|
320
|
+
motionVariant?: keyof typeof motionVariants;
|
|
321
|
+
duration?: number;
|
|
322
|
+
loop?: boolean;
|
|
233
323
|
}
|
|
234
324
|
declare const List: React$1.FC<ListProps>;
|
|
235
325
|
|
|
236
|
-
|
|
326
|
+
type MotionVariantKey$2 = keyof typeof motionVariants;
|
|
327
|
+
interface ListItemProps extends BaseProps, WithChildren {
|
|
328
|
+
motionVariant?: MotionVariantKey$2;
|
|
329
|
+
duration?: number;
|
|
330
|
+
loop?: boolean;
|
|
331
|
+
}
|
|
332
|
+
declare const ListItem: React$1.FC<ListItemProps>;
|
|
237
333
|
|
|
238
334
|
interface ModalProps extends BaseProps, WithChildren {
|
|
239
335
|
isOpen: boolean;
|
|
240
336
|
onClose: () => void;
|
|
241
337
|
motionVariant?: keyof typeof motionVariants;
|
|
338
|
+
duration?: number;
|
|
339
|
+
loop?: boolean;
|
|
242
340
|
}
|
|
243
341
|
declare const Modal: React$1.FC<ModalProps>;
|
|
244
342
|
|
|
@@ -248,23 +346,107 @@ declare const ModalFooter: React$1.FC<BaseProps & WithChildren>;
|
|
|
248
346
|
|
|
249
347
|
declare const ModalHeader: React$1.FC<BaseProps & WithChildren>;
|
|
250
348
|
|
|
349
|
+
/**
|
|
350
|
+
* A fully customizable navigation link with motion and style props.
|
|
351
|
+
*/
|
|
352
|
+
type MotionVariantKey$1 = keyof typeof motionVariants;
|
|
251
353
|
interface NavItemProps extends BaseProps, WithChildren {
|
|
354
|
+
/** Link destination */
|
|
252
355
|
href: string;
|
|
356
|
+
/** Whether this item is active */
|
|
253
357
|
active?: boolean;
|
|
254
|
-
|
|
255
|
-
|
|
358
|
+
/** Size key for padding and font size */
|
|
359
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
360
|
+
/** Customize size classes */
|
|
361
|
+
sizeClasses?: Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', string>>;
|
|
362
|
+
/** Motion variant key */
|
|
363
|
+
motionVariant?: MotionVariantKey$1;
|
|
364
|
+
/** Animation duration override (seconds) */
|
|
365
|
+
duration?: number;
|
|
366
|
+
/** Loop the animation */
|
|
367
|
+
loop?: boolean;
|
|
368
|
+
/** Text color classes when inactive */
|
|
369
|
+
textColorClass?: string;
|
|
370
|
+
/** Text color classes on hover */
|
|
371
|
+
hoverTextColorClass?: string;
|
|
372
|
+
/** Text color classes when active */
|
|
373
|
+
activeTextColorClass?: string;
|
|
374
|
+
/** Border classes when active */
|
|
375
|
+
activeBorderClass?: string;
|
|
376
|
+
/** Scale on hover */
|
|
377
|
+
hoverScale?: number;
|
|
378
|
+
/** Scale on tap */
|
|
379
|
+
tapScale?: number;
|
|
256
380
|
}
|
|
257
381
|
declare const NavItem: React$1.FC<NavItemProps>;
|
|
258
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Fully customizable, responsive Navbar with mobile menu.
|
|
385
|
+
* All styling and behavior can be overridden via props.
|
|
386
|
+
*/
|
|
259
387
|
interface NavbarProps extends BaseProps, WithChildren {
|
|
388
|
+
/** Brand/logo element */
|
|
260
389
|
brand?: React$1.ReactNode;
|
|
390
|
+
/** Tailwind class for navbar background */
|
|
391
|
+
bgColorClass?: string;
|
|
392
|
+
/** Tailwind class for navbar text */
|
|
393
|
+
textColorClass?: string;
|
|
394
|
+
/** Tailwind class for hover state on menu items */
|
|
395
|
+
hoverTextColorClass?: string;
|
|
396
|
+
/** Tailwind class for navbar shadow */
|
|
397
|
+
shadowClass?: string;
|
|
398
|
+
/** Container max-width wrapper class */
|
|
399
|
+
containerClassName?: string;
|
|
400
|
+
/** Class for desktop menu wrapper */
|
|
401
|
+
desktopMenuClassName?: string;
|
|
402
|
+
/** Class for mobile menu wrapper */
|
|
403
|
+
mobileMenuWrapperClassName?: string;
|
|
404
|
+
/** Class for individual mobile menu item */
|
|
405
|
+
mobileMenuItemClassName?: string;
|
|
406
|
+
/** Custom hamburger icon */
|
|
407
|
+
menuIcon?: React$1.ReactNode;
|
|
408
|
+
/** Custom close icon */
|
|
409
|
+
closeIcon?: React$1.ReactNode;
|
|
410
|
+
/** Framer Motion props for nav container */
|
|
411
|
+
navMotion?: Partial<MotionProps>;
|
|
412
|
+
/** Framer Motion props for mobile menu */
|
|
413
|
+
mobileMotion?: Partial<MotionProps>;
|
|
414
|
+
duration?: number;
|
|
415
|
+
loop?: boolean;
|
|
261
416
|
}
|
|
262
417
|
declare const Navbar: React$1.FC<NavbarProps>;
|
|
263
418
|
|
|
419
|
+
/**
|
|
420
|
+
* A fully customizable offcanvas panel component.
|
|
421
|
+
*/
|
|
264
422
|
interface OffcanvasProps extends BaseProps, WithChildren {
|
|
423
|
+
/** Controls visibility of the panel */
|
|
265
424
|
isOpen: boolean;
|
|
425
|
+
/** Callback when panel should close */
|
|
266
426
|
onClose: () => void;
|
|
427
|
+
/** Which edge the panel should originate from */
|
|
267
428
|
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
429
|
+
/** Panel size utility classes (width/height) */
|
|
430
|
+
panelSizeClass?: string;
|
|
431
|
+
/** Background classes for the overlay layer */
|
|
432
|
+
overlayBgClass?: string;
|
|
433
|
+
/** Background classes for the panel content */
|
|
434
|
+
panelBgClass?: string;
|
|
435
|
+
/** Shadow classes for the panel */
|
|
436
|
+
panelShadowClass?: string;
|
|
437
|
+
/** z-index utility class */
|
|
438
|
+
zIndex?: string;
|
|
439
|
+
/** If true, clicking the overlay closes the panel */
|
|
440
|
+
closeOnOverlayClick?: boolean;
|
|
441
|
+
/** Duration of open/close animations in seconds */
|
|
442
|
+
duration?: number;
|
|
443
|
+
/** Custom close icon placed inside the panel */
|
|
444
|
+
customCloseIcon?: ReactNode;
|
|
445
|
+
/** Override motion props on the overlay */
|
|
446
|
+
overlayMotion?: Partial<MotionProps>;
|
|
447
|
+
/** Override motion props on the panel */
|
|
448
|
+
panelMotion?: Partial<MotionProps>;
|
|
449
|
+
loop?: boolean;
|
|
268
450
|
}
|
|
269
451
|
declare const Offcanvas: React$1.FC<OffcanvasProps>;
|
|
270
452
|
|
|
@@ -276,26 +458,52 @@ interface OffcanvasHeaderProps extends BaseProps, WithChildren {
|
|
|
276
458
|
declare const OffcanvasHeader: React$1.FC<OffcanvasHeaderProps>;
|
|
277
459
|
|
|
278
460
|
type Color$5 = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
interface PaginationProps extends BaseProps, PaginationMotionProps {
|
|
461
|
+
type PaginationSize = 'sm' | 'md' | 'lg';
|
|
462
|
+
interface PaginationProps extends BaseProps, HTMLMotionProps<'nav'> {
|
|
282
463
|
currentPage: number;
|
|
283
464
|
totalPages: number;
|
|
284
465
|
onPageChange: (page: number) => void;
|
|
285
466
|
color?: Color$5;
|
|
467
|
+
size?: PaginationSize;
|
|
286
468
|
motionVariant?: keyof typeof motionVariants;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
469
|
+
showFirstLast?: boolean;
|
|
470
|
+
maxVisiblePages?: number;
|
|
471
|
+
showPageNumbers?: boolean;
|
|
472
|
+
previousLabel?: React$1.ReactNode;
|
|
473
|
+
nextLabel?: React$1.ReactNode;
|
|
474
|
+
firstLabel?: React$1.ReactNode;
|
|
475
|
+
lastLabel?: React$1.ReactNode;
|
|
476
|
+
buttonProps?: HTMLMotionProps<'button'>;
|
|
477
|
+
activeButtonProps?: HTMLMotionProps<'button'>;
|
|
478
|
+
disabledButtonProps?: HTMLMotionProps<'button'>;
|
|
290
479
|
}
|
|
291
480
|
declare const Pagination: React$1.FC<PaginationProps>;
|
|
292
481
|
|
|
482
|
+
type MotionVariantKey = keyof typeof motionVariants;
|
|
293
483
|
type Color$4 = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
294
|
-
interface ProgressBarProps extends BaseProps, ColorProps {
|
|
484
|
+
interface ProgressBarProps extends BaseProps, ColorProps, MotionProps {
|
|
485
|
+
/** Current value */
|
|
295
486
|
value: number;
|
|
487
|
+
/** Maximum value */
|
|
296
488
|
max?: number;
|
|
489
|
+
/** Semantic color key */
|
|
297
490
|
color?: Color$4;
|
|
298
|
-
|
|
491
|
+
/** Override height utility class */
|
|
492
|
+
heightClass?: string;
|
|
493
|
+
/** Container background class */
|
|
494
|
+
containerBgClass?: string;
|
|
495
|
+
/** Bar background class override (falls back to color key) */
|
|
496
|
+
barBgClass?: string;
|
|
497
|
+
/** Motion variant key */
|
|
498
|
+
motionVariant?: MotionVariantKey;
|
|
499
|
+
/** Animation duration in seconds */
|
|
500
|
+
duration?: number;
|
|
501
|
+
/** Loop animation */
|
|
502
|
+
loop?: boolean;
|
|
503
|
+
/** Show percentage label */
|
|
504
|
+
showLabel?: boolean;
|
|
505
|
+
/** Label container class */
|
|
506
|
+
labelClassName?: string;
|
|
299
507
|
}
|
|
300
508
|
declare const ProgressBar: React$1.FC<ProgressBarProps>;
|
|
301
509
|
|
package/dist/index.js
CHANGED
|
@@ -483,13 +483,19 @@ const motionVariants = {
|
|
|
483
483
|
},
|
|
484
484
|
};
|
|
485
485
|
|
|
486
|
-
const Button = ({ children, className = '', color = 'primary', size = 'md', onClick, disabled = false, variant = 'solid', motionVariant = 'fadeIn',
|
|
486
|
+
const Button = ({ children, className = '', color = 'primary', size = 'md', onClick, disabled = false, variant = 'solid', motionVariant = 'fadeIn', customVariants, customTransition,
|
|
487
487
|
// Standard Framer Motion props
|
|
488
488
|
whileHover, whileTap, whileFocus,
|
|
489
|
-
// Additional
|
|
490
|
-
whileHoverAnimation, whileTapAnimation, whileFocusAnimation,
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
// Additional animation props
|
|
490
|
+
whileHoverAnimation, whileTapAnimation, whileFocusAnimation, customHoverAnimation, customTapAnimation, customFocusAnimation,
|
|
491
|
+
// Styling customization
|
|
492
|
+
stateClasses = {}, customClasses = {}, customSizeClasses, baseClassName, unstyled = false, useAnimation = true, type = 'button', ...rest }) => {
|
|
493
|
+
// Default base classes if not unstyled and no custom base class provided
|
|
494
|
+
const defaultBaseClasses = 'font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2';
|
|
495
|
+
// Use either provided base class, default base class, or none if unstyled
|
|
496
|
+
const baseClasses = unstyled ? '' : (baseClassName || defaultBaseClasses);
|
|
497
|
+
// Default color classes for different variants
|
|
498
|
+
const defaultColorClasses = {
|
|
493
499
|
primary: {
|
|
494
500
|
solid: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',
|
|
495
501
|
outline: 'border border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
|
|
@@ -521,23 +527,63 @@ whileHoverAnimation, whileTapAnimation, whileFocusAnimation, ...rest }) => {
|
|
|
521
527
|
ghost: 'text-blue-400 hover:bg-blue-50 focus:ring-blue-300',
|
|
522
528
|
},
|
|
523
529
|
};
|
|
524
|
-
|
|
530
|
+
// Default size classes
|
|
531
|
+
const defaultSizeClasses = {
|
|
525
532
|
xs: 'px-2.5 py-1.5 text-xs',
|
|
526
533
|
sm: 'px-3 py-2 text-sm',
|
|
527
534
|
md: 'px-4 py-2 text-base',
|
|
528
535
|
lg: 'px-4 py-2 text-lg',
|
|
529
536
|
xl: 'px-6 py-3 text-xl',
|
|
530
537
|
};
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
// Determine the appropriate color classes
|
|
539
|
+
const getColorClasses = () => {
|
|
540
|
+
if (unstyled)
|
|
541
|
+
return '';
|
|
542
|
+
// Check if custom classes are provided for this variant and color combination
|
|
543
|
+
if (customClasses?.[variant]?.[color]) {
|
|
544
|
+
return customClasses[variant][color];
|
|
545
|
+
}
|
|
546
|
+
// If we have a predefined color class for this variant and color
|
|
547
|
+
if (defaultColorClasses[color]?.[variant]) {
|
|
548
|
+
return defaultColorClasses[color][variant];
|
|
549
|
+
}
|
|
550
|
+
// Fallback to primary if the combination doesn't exist
|
|
551
|
+
return defaultColorClasses.primary[variant] || '';
|
|
552
|
+
};
|
|
553
|
+
// Determine the appropriate size classes
|
|
554
|
+
const getSizeClasses = () => {
|
|
555
|
+
if (unstyled)
|
|
556
|
+
return '';
|
|
557
|
+
// Use custom size classes if provided, otherwise default
|
|
558
|
+
const sizeClassMap = customSizeClasses || defaultSizeClasses;
|
|
559
|
+
return sizeClassMap[size] || defaultSizeClasses.md;
|
|
560
|
+
};
|
|
561
|
+
// Determine state-specific classes
|
|
562
|
+
const getStateClasses = () => {
|
|
563
|
+
if (unstyled)
|
|
564
|
+
return '';
|
|
565
|
+
return disabled && stateClasses.disabled ? stateClasses.disabled : '';
|
|
566
|
+
};
|
|
567
|
+
// Compute all classes
|
|
568
|
+
const computedClasses = `
|
|
569
|
+
${baseClasses}
|
|
570
|
+
${getColorClasses()}
|
|
571
|
+
${getSizeClasses()}
|
|
572
|
+
${getStateClasses()}
|
|
573
|
+
${className}
|
|
574
|
+
`.trim().replace(/\s+/g, ' ');
|
|
575
|
+
// Compute animation variants and states
|
|
576
|
+
const variants = customVariants || (useAnimation ? motionVariants[motionVariant] || {} : {});
|
|
577
|
+
// Compute hover animation
|
|
578
|
+
const computedWhileHover = customHoverAnimation ||
|
|
579
|
+
(whileHoverAnimation ? getVariantVisible(whileHoverAnimation) : whileHover);
|
|
580
|
+
// Compute tap animation
|
|
581
|
+
const computedWhileTap = customTapAnimation ||
|
|
582
|
+
(whileTapAnimation ? getVariantVisible(whileTapAnimation) : whileTap);
|
|
583
|
+
// Compute focus animation
|
|
584
|
+
const computedWhileFocus = customFocusAnimation ||
|
|
585
|
+
(whileFocusAnimation ? getVariantVisible(whileFocusAnimation) : whileFocus);
|
|
586
|
+
return (React.createElement(framerMotion.motion.button, { className: computedClasses, onClick: onClick, disabled: disabled, type: type, variants: variants, initial: useAnimation ? "hidden" : false, animate: useAnimation ? "visible" : false, transition: customTransition, whileHover: computedWhileHover, whileTap: computedWhileTap, whileFocus: computedWhileFocus, ...rest }, children));
|
|
541
587
|
};
|
|
542
588
|
|
|
543
589
|
const IconButton = ({ className = '', color = 'primary', size = 'md', icon, onClick, disabled = false, variant = 'solid', motionVariant = 'fadeIn', whileHover, whileTap, whileFocus, whileHoverAnimation, whileTapAnimation, whileFocusAnimation, ...rest }) => {
|
|
@@ -647,7 +693,7 @@ const Accordion = ({ className = '', items, color = 'primary', variant = 'solid'
|
|
|
647
693
|
React.createElement(framerMotion.AnimatePresence, null, isOpen(index) && (React.createElement(framerMotion.motion.div, { variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", className: `px-4 py-2 border-t ${contentClassName}`, ...rest }, item.content))))))));
|
|
648
694
|
};
|
|
649
695
|
|
|
650
|
-
const Alert = ({ children, className = '', color = 'primary', onClose, motionVariant = 'fadeIn', }) => {
|
|
696
|
+
const Alert = ({ children, className = '', color = 'primary', onClose, motionVariant = 'fadeIn', ...rest }) => {
|
|
651
697
|
const colorClasses = {
|
|
652
698
|
primary: 'bg-blue-100 text-blue-700',
|
|
653
699
|
secondary: 'bg-gray-100 text-gray-700',
|
|
@@ -656,7 +702,7 @@ const Alert = ({ children, className = '', color = 'primary', onClose, motionVar
|
|
|
656
702
|
warning: 'bg-yellow-100 text-yellow-700',
|
|
657
703
|
info: 'bg-indigo-100 text-indigo-700',
|
|
658
704
|
};
|
|
659
|
-
return (React.createElement(framerMotion.motion.div, { className: `p-4 rounded-md ${colorClasses[color]} ${className}`, role: "alert", variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } },
|
|
705
|
+
return (React.createElement(framerMotion.motion.div, { className: `p-4 rounded-md ${colorClasses[color]} ${className}`, role: "alert", variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", ...rest, transition: { duration: 0.3 } },
|
|
660
706
|
React.createElement("div", { className: "flex" },
|
|
661
707
|
React.createElement("div", { className: "flex-grow" }, children),
|
|
662
708
|
onClose && (React.createElement("button", { type: "button", className: "ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 inline-flex h-8 w-8", onClick: onClose, "aria-label": "Close" },
|
|
@@ -665,7 +711,7 @@ const Alert = ({ children, className = '', color = 'primary', onClose, motionVar
|
|
|
665
711
|
React.createElement("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" })))))));
|
|
666
712
|
};
|
|
667
713
|
|
|
668
|
-
const Avatar = ({ className = '', size = 'md', src, alt, initials }) => {
|
|
714
|
+
const Avatar = ({ className = '', size = 'md', src, alt, initials, ...rest }) => {
|
|
669
715
|
const sizeClasses = {
|
|
670
716
|
xs: 'w-6 h-6 text-xs',
|
|
671
717
|
sm: 'w-8 h-8 text-sm',
|
|
@@ -673,11 +719,11 @@ const Avatar = ({ className = '', size = 'md', src, alt, initials }) => {
|
|
|
673
719
|
lg: 'w-12 h-12 text-lg',
|
|
674
720
|
xl: 'w-14 h-14 text-xl',
|
|
675
721
|
};
|
|
676
|
-
return (React.createElement(
|
|
722
|
+
return (React.createElement(framerMotion.motion.div, { ...rest, className: `relative inline-flex items-center justify-center ${sizeClasses[size]} ${className} rounded-full bg-gray-200 overflow-hidden` }, src ? (React.createElement("img", { src: src, alt: alt || 'Avatar', className: "w-full h-full object-cover" })) : (React.createElement("span", { className: "font-medium text-gray-600" }, initials))));
|
|
677
723
|
};
|
|
678
724
|
|
|
679
725
|
const Badge = ({ children, className = '', color = 'primary', size = 'md', motionVariant = 'fadeIn', // Default motion variant
|
|
680
|
-
}) => {
|
|
726
|
+
...rest }) => {
|
|
681
727
|
// Define the colors
|
|
682
728
|
const colorStyles = {
|
|
683
729
|
primary: '#E0F7FA', // bg-blue-100
|
|
@@ -710,10 +756,10 @@ const Badge = ({ children, className = '', color = 'primary', size = 'md', motio
|
|
|
710
756
|
padding: sizeStyles[size].padding,
|
|
711
757
|
fontSize: sizeStyles[size].fontSize,
|
|
712
758
|
};
|
|
713
|
-
return (React.createElement(framerMotion.motion.span, { className: `inline-flex items-center font-medium rounded-full ${className}`, style: customStyle, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
759
|
+
return (React.createElement(framerMotion.motion.span, { className: `inline-flex items-center font-medium rounded-full ${className}`, style: customStyle, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children));
|
|
714
760
|
};
|
|
715
761
|
|
|
716
|
-
const Breadcrumb = ({ className = '', items, motionVariant = 'fadeIn', color = 'primary' }) => {
|
|
762
|
+
const Breadcrumb = ({ className = '', items, motionVariant = 'fadeIn', color = 'primary', ...rest }) => {
|
|
717
763
|
// Color classes for breadcrumb
|
|
718
764
|
const colorClasses = {
|
|
719
765
|
primary: 'text-blue-600 hover:text-blue-800',
|
|
@@ -723,30 +769,30 @@ const Breadcrumb = ({ className = '', items, motionVariant = 'fadeIn', color = '
|
|
|
723
769
|
warning: 'text-yellow-600 hover:text-yellow-800',
|
|
724
770
|
info: 'text-blue-400 hover:text-blue-500',
|
|
725
771
|
};
|
|
726
|
-
return (React.createElement(framerMotion.motion.nav, { className: `flex ${className}`, "aria-label": "Breadcrumb", variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } },
|
|
772
|
+
return (React.createElement(framerMotion.motion.nav, { className: `flex ${className}`, "aria-label": "Breadcrumb", variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest },
|
|
727
773
|
React.createElement("ol", { className: "inline-flex items-center space-x-1 md:space-x-3" }, items.map((item, index) => (React.createElement("li", { key: index, className: "inline-flex items-center" },
|
|
728
774
|
index > 0 && (React.createElement("svg", { className: "w-6 h-6 text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg" },
|
|
729
775
|
React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }))),
|
|
730
776
|
React.createElement("a", { href: item.href, className: `ml-1 text-sm font-medium ${index === items.length - 1 ? 'text-gray-500 hover:text-gray-700' : colorClasses[color]}` }, item.label)))))));
|
|
731
777
|
};
|
|
732
778
|
|
|
733
|
-
const Card = ({ children, className = '', motionVariant = 'fadeIn' }) => {
|
|
734
|
-
return (React.createElement(framerMotion.motion.div, { className: `bg-white shadow rounded-lg overflow-hidden ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
779
|
+
const Card = ({ children, className = '', motionVariant = 'fadeIn', ...rest }) => {
|
|
780
|
+
return (React.createElement(framerMotion.motion.div, { className: `bg-white shadow rounded-lg overflow-hidden ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children));
|
|
735
781
|
};
|
|
736
782
|
|
|
737
|
-
const CardBody = ({ children, className = '', motionVariant = 'fadeIn' }) => {
|
|
738
|
-
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-5 sm:p-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
783
|
+
const CardBody = ({ children, className = '', motionVariant = 'fadeIn', ...rest }) => {
|
|
784
|
+
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-5 sm:p-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children));
|
|
739
785
|
};
|
|
740
786
|
|
|
741
|
-
const CardFooter = ({ children, className = '', motionVariant = 'fadeIn' }) => {
|
|
742
|
-
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-4 sm:px-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
787
|
+
const CardFooter = ({ children, className = '', motionVariant = 'fadeIn', ...rest }) => {
|
|
788
|
+
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-4 sm:px-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children));
|
|
743
789
|
};
|
|
744
790
|
|
|
745
|
-
const CardHeader = ({ children, className = '', motionVariant = 'fadeIn' }) => {
|
|
746
|
-
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-5 sm:px-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
791
|
+
const CardHeader = ({ children, className = '', motionVariant = 'fadeIn' }, ...rest) => {
|
|
792
|
+
return (React.createElement(framerMotion.motion.div, { className: `px-4 py-5 sm:px-6 ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children));
|
|
747
793
|
};
|
|
748
794
|
|
|
749
|
-
const Dropdown = ({ children, className = '', trigger, motionVariant = 'fadeIn' }) => {
|
|
795
|
+
const Dropdown = ({ children, className = '', trigger, motionVariant = 'fadeIn' }, ...rest) => {
|
|
750
796
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
751
797
|
const dropdownRef = React.useRef(null);
|
|
752
798
|
React.useEffect(() => {
|
|
@@ -763,14 +809,14 @@ const Dropdown = ({ children, className = '', trigger, motionVariant = 'fadeIn'
|
|
|
763
809
|
return (React.createElement("div", { className: `relative inline-block text-left ${className}`, ref: dropdownRef },
|
|
764
810
|
React.createElement("div", null,
|
|
765
811
|
React.createElement("button", { type: "button", onClick: () => setIsOpen(prev => !prev) }, trigger),
|
|
766
|
-
React.createElement(framerMotion.AnimatePresence, null, isOpen && (React.createElement(framerMotion.motion.div, { variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children))))));
|
|
812
|
+
React.createElement(framerMotion.AnimatePresence, null, isOpen && (React.createElement(framerMotion.motion.div, { variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 }, ...rest }, children))))));
|
|
767
813
|
};
|
|
768
814
|
|
|
769
|
-
const DropdownItem = ({ children, className = '' }) => {
|
|
770
|
-
return (React.createElement("a", { href: "#", className: `block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 ${className}`, role: "menuitem" }, children));
|
|
815
|
+
const DropdownItem = ({ children, className = '', ...rest }) => {
|
|
816
|
+
return (React.createElement("a", { ...rest, href: "#", className: `block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 ${className}`, role: "menuitem" }, children));
|
|
771
817
|
};
|
|
772
818
|
|
|
773
|
-
const Checkbox = ({ className = '', label, checked, onChange, color = 'primary', motionVariant = 'fadeIn', }) => {
|
|
819
|
+
const Checkbox = ({ className = '', label, checked, onChange, color = 'primary', motionVariant = 'fadeIn', ...rest }) => {
|
|
774
820
|
const colorClasses = {
|
|
775
821
|
primary: 'text-blue-600 focus:ring-blue-500 hover:text-blue-700',
|
|
776
822
|
secondary: 'text-gray-600 focus:ring-gray-500 hover:text-gray-700',
|
|
@@ -779,14 +825,14 @@ const Checkbox = ({ className = '', label, checked, onChange, color = 'primary',
|
|
|
779
825
|
warning: 'text-yellow-500 focus:ring-yellow-400 hover:text-yellow-600',
|
|
780
826
|
info: 'text-blue-400 focus:ring-blue-300 hover:text-blue-500',
|
|
781
827
|
};
|
|
782
|
-
return (React.createElement(framerMotion.motion.label, { className: `inline-flex items-center cursor-pointer select-none ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 }, variants: motionVariants[motionVariant] },
|
|
828
|
+
return (React.createElement(framerMotion.motion.label, { className: `inline-flex items-center cursor-pointer select-none ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 }, variants: motionVariants[motionVariant], ...rest },
|
|
783
829
|
React.createElement("input", { type: "checkbox", className: `form-checkbox h-5 w-5 rounded focus:ring-2 ${colorClasses[color]}`, checked: checked, onChange: onChange }),
|
|
784
830
|
React.createElement("span", { className: `ml-2 font-medium ${colorClasses[color]}` }, label)));
|
|
785
831
|
};
|
|
786
832
|
|
|
787
833
|
const FileUpload = ({ className = '', onChange, accept, multiple, buttonColor = 'primary', // Default button color
|
|
788
834
|
motionVariant = 'fadeIn', // Default motion variant
|
|
789
|
-
}) => {
|
|
835
|
+
...rest }) => {
|
|
790
836
|
const fileInputRef = React.useRef(null);
|
|
791
837
|
const handleClick = () => {
|
|
792
838
|
fileInputRef.current?.click();
|
|
@@ -805,10 +851,10 @@ motionVariant = 'fadeIn', // Default motion variant
|
|
|
805
851
|
};
|
|
806
852
|
return (React.createElement(framerMotion.motion.div, { className: `flex items-center ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 }, variants: motionVariants[motionVariant] },
|
|
807
853
|
React.createElement("button", { type: "button", onClick: handleClick, className: `px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 ${buttonColorClasses[buttonColor]}` }, "Choose File"),
|
|
808
|
-
React.createElement("input", { type: "file", ref: fileInputRef, onChange: handleChange, accept: accept, multiple: multiple, className: "hidden" })));
|
|
854
|
+
React.createElement("input", { ...rest, type: "file", ref: fileInputRef, onChange: handleChange, accept: accept, multiple: multiple, className: "hidden" })));
|
|
809
855
|
};
|
|
810
856
|
|
|
811
|
-
const Input = ({ className = '', size = 'md', type = 'text', placeholder, value, onChange, color = 'primary', textColor = 'black', }) => {
|
|
857
|
+
const Input = ({ className = '', size = 'md', type = 'text', placeholder, value, onChange, color = 'primary', textColor = 'black', ...rest }) => {
|
|
812
858
|
const sizeClasses = {
|
|
813
859
|
xs: 'px-2 py-1 text-xs',
|
|
814
860
|
sm: 'px-3 py-2 text-sm',
|
|
@@ -833,10 +879,10 @@ const Input = ({ className = '', size = 'md', type = 'text', placeholder, value,
|
|
|
833
879
|
red: 'text-red-600',
|
|
834
880
|
};
|
|
835
881
|
return (React.createElement(framerMotion.motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
|
|
836
|
-
React.createElement("input", { type: type, className: `w-full rounded-md ${sizeClasses[size]} ${colorClasses[color]} ${textColorClasses[textColor]} ${className} focus:outline-none focus:ring-2`, placeholder: placeholder, value: value, onChange: onChange })));
|
|
882
|
+
React.createElement("input", { ...rest, type: type, className: `w-full rounded-md ${sizeClasses[size]} ${colorClasses[color]} ${textColorClasses[textColor]} ${className} focus:outline-none focus:ring-2`, placeholder: placeholder, value: value, onChange: onChange })));
|
|
837
883
|
};
|
|
838
884
|
|
|
839
|
-
const Radio = ({ className = '', label, name, value, checked, onChange, color = 'primary', size = 'md', motionVariant = 'fadeIn', }) => {
|
|
885
|
+
const Radio = ({ className = '', label, name, value, checked, onChange, color = 'primary', size = 'md', motionVariant = 'fadeIn', ...rest }) => {
|
|
840
886
|
const baseClasses = 'inline-flex items-center cursor-pointer';
|
|
841
887
|
// Dynamic color classes
|
|
842
888
|
const colorClasses = {
|
|
@@ -856,12 +902,12 @@ const Radio = ({ className = '', label, name, value, checked, onChange, color =
|
|
|
856
902
|
xl: 'h-8 w-8',
|
|
857
903
|
};
|
|
858
904
|
return (React.createElement(framerMotion.motion.label, { className: `${baseClasses} ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 }, variants: motionVariants[motionVariant] },
|
|
859
|
-
React.createElement("input", { type: "radio", name: name, value: value, checked: checked, onChange: onChange, className: `form-radio rounded-full border-2 focus:ring-2 ${colorClasses[color]} ${sizeClasses[size]}` }),
|
|
905
|
+
React.createElement("input", { ...rest, type: "radio", name: name, value: value, checked: checked, onChange: onChange, className: `form-radio rounded-full border-2 focus:ring-2 ${colorClasses[color]} ${sizeClasses[size]}` }),
|
|
860
906
|
React.createElement("span", { className: `ml-2 font-medium ${colorClasses[color]}` }, label)));
|
|
861
907
|
};
|
|
862
908
|
|
|
863
909
|
const Select = ({ className = '', size = 'md', options, value, onChange, color = 'primary', motionVariant = 'fadeIn', // Default motion variant
|
|
864
|
-
}) => {
|
|
910
|
+
...rest }) => {
|
|
865
911
|
const baseClasses = 'w-full border rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2';
|
|
866
912
|
const colorClasses = {
|
|
867
913
|
primary: 'border-blue-600 focus:ring-blue-500 text-blue-600',
|
|
@@ -879,11 +925,11 @@ const Select = ({ className = '', size = 'md', options, value, onChange, color =
|
|
|
879
925
|
xl: 'px-5 py-4 text-xl',
|
|
880
926
|
};
|
|
881
927
|
return (React.createElement(framerMotion.motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, variants: motionVariants[motionVariant], transition: { duration: 0.3 } },
|
|
882
|
-
React.createElement("select", { className: `${baseClasses} ${colorClasses[color]} ${sizeClasses[size]} ${className}`, value: value, onChange: onChange }, options.map((option) => (React.createElement("option", { key: option.value, value: option.value }, option.label))))));
|
|
928
|
+
React.createElement("select", { className: `${baseClasses} ${colorClasses[color]} ${sizeClasses[size]} ${className}`, value: value, onChange: onChange, ...rest }, options.map((option) => (React.createElement("option", { key: option.value, value: option.value }, option.label))))));
|
|
883
929
|
};
|
|
884
930
|
|
|
885
931
|
const Switch = ({ className = '', checked, onChange, label, color = 'primary', motionVariant = 'fadeIn', // Default motion variant
|
|
886
|
-
}) => {
|
|
932
|
+
...rest }) => {
|
|
887
933
|
const baseClasses = 'inline-flex items-center cursor-pointer';
|
|
888
934
|
const colorClasses = {
|
|
889
935
|
primary: 'bg-blue-600',
|
|
@@ -895,14 +941,14 @@ const Switch = ({ className = '', checked, onChange, label, color = 'primary', m
|
|
|
895
941
|
};
|
|
896
942
|
return (React.createElement(framerMotion.motion.label, { className: `${baseClasses} ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, variants: motionVariants[motionVariant], transition: { duration: 0.3 } },
|
|
897
943
|
React.createElement("div", { className: "relative" },
|
|
898
|
-
React.createElement("input", { type: "checkbox", className: "sr-only", checked: checked, onChange: (e) => onChange(e.target.checked) }),
|
|
944
|
+
React.createElement("input", { ...rest, type: "checkbox", className: "sr-only", checked: checked, onChange: (e) => onChange(e.target.checked) }),
|
|
899
945
|
React.createElement("div", { className: `w-10 h-6 bg-gray-200 rounded-full shadow-inner ${checked ? colorClasses[color] : ''}` }),
|
|
900
946
|
React.createElement("div", { className: `absolute w-4 h-4 bg-white rounded-full shadow inset-y-1 left-1 transition-transform duration-200 ease-in-out ${checked ? 'transform translate-x-4' : ''}` })),
|
|
901
947
|
label && React.createElement("span", { className: "ml-3 text-sm font-medium text-gray-900" }, label)));
|
|
902
948
|
};
|
|
903
949
|
|
|
904
950
|
const Textarea = ({ className = '', size = 'md', placeholder, value, onChange, rows = 4, color = 'primary', motionVariant = 'fadeIn', // Default motion variant
|
|
905
|
-
}) => {
|
|
951
|
+
...rest }) => {
|
|
906
952
|
const baseClasses = 'w-full border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500';
|
|
907
953
|
const colorClasses = {
|
|
908
954
|
primary: 'focus:ring-blue-500 focus:border-blue-500',
|
|
@@ -920,15 +966,19 @@ const Textarea = ({ className = '', size = 'md', placeholder, value, onChange, r
|
|
|
920
966
|
xl: 'px-5 py-4 text-xl',
|
|
921
967
|
};
|
|
922
968
|
return (React.createElement(framerMotion.motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, variants: motionVariants[motionVariant], transition: { duration: 0.3 } },
|
|
923
|
-
React.createElement("textarea", { className: `${baseClasses} ${colorClasses[color]} ${sizeClasses[size]} ${className}`, placeholder: placeholder, value: value, onChange: onChange, rows: rows })));
|
|
969
|
+
React.createElement("textarea", { className: `${baseClasses} ${colorClasses[color]} ${sizeClasses[size]} ${className}`, placeholder: placeholder, value: value, onChange: onChange, rows: rows, ...rest })));
|
|
924
970
|
};
|
|
925
971
|
|
|
926
|
-
const Container = ({ children, className = '', fluid = false, motionVariant = 'fadeIn' }) => {
|
|
972
|
+
const Container = ({ children, className = '', fluid = false, motionVariant = 'fadeIn', duration = 0.3, loop = false, ...rest }) => {
|
|
927
973
|
const containerClass = fluid ? 'w-full' : 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8';
|
|
928
|
-
|
|
974
|
+
const transition = {
|
|
975
|
+
duration,
|
|
976
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
977
|
+
};
|
|
978
|
+
return (React.createElement(framerMotion.motion.div, { className: `${containerClass} ${className}`, variants: motionVariants[motionVariant], ...rest, initial: "hidden", animate: "visible", transition: { transition } }, children));
|
|
929
979
|
};
|
|
930
980
|
|
|
931
|
-
const Flex = ({ children, className = '', direction = 'row', justify = 'start', align = 'start', wrap = false, }) => {
|
|
981
|
+
const Flex = ({ children, className = '', direction = 'row', justify = 'start', align = 'start', wrap = false, motionVariant = 'fadeIn', duration = 0.3, loop = false, ...rest }) => {
|
|
932
982
|
const flexClass = `
|
|
933
983
|
flex
|
|
934
984
|
${direction === 'col' ? 'flex-col' : 'flex-row'}
|
|
@@ -936,25 +986,45 @@ const Flex = ({ children, className = '', direction = 'row', justify = 'start',
|
|
|
936
986
|
${`items-${align}`}
|
|
937
987
|
${wrap ? 'flex-wrap' : 'flex-nowrap'}
|
|
938
988
|
`;
|
|
939
|
-
|
|
989
|
+
const transition = {
|
|
990
|
+
duration,
|
|
991
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
992
|
+
};
|
|
993
|
+
return (React.createElement(framerMotion.motion.div, { variants: motionVariants[motionVariant], ...rest, initial: "hidden", animate: "visible", transition: { transition }, className: `${flexClass} ${className}` }, children));
|
|
940
994
|
};
|
|
941
995
|
|
|
942
|
-
const Grid = ({ children, className = '', cols = 3, gap = 4 }) => {
|
|
943
|
-
|
|
996
|
+
const Grid = ({ children, className = '', cols = 3, gap = 4, duration = 0.3, loop = false, motionVariant = 'fadeIn', ...rest }) => {
|
|
997
|
+
const transition = {
|
|
998
|
+
duration,
|
|
999
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1000
|
+
};
|
|
1001
|
+
return (React.createElement(framerMotion.motion.div, { ...rest, initial: "hidden", animate: "visible", transition: { transition }, variants: motionVariants[motionVariant], className: `grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-${cols} gap-${gap} ${className}` }, children));
|
|
944
1002
|
};
|
|
945
1003
|
|
|
946
|
-
const List = ({ children, className = '', as = 'ul' }) => {
|
|
1004
|
+
const List = ({ children, className = '', duration = 0.3, loop = false, as = 'ul', motionVariant = 'fadeIn', ...rest }) => {
|
|
1005
|
+
const transition = {
|
|
1006
|
+
duration,
|
|
1007
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1008
|
+
};
|
|
947
1009
|
const Tag = as;
|
|
948
|
-
return (React.createElement(framerMotion.motion.div, { initial:
|
|
1010
|
+
return (React.createElement(framerMotion.motion.div, { initial: "hidden", animate: "visible", variants: motionVariants[motionVariant], transition: { transition }, ...rest },
|
|
949
1011
|
React.createElement(Tag, { className: `space-y-1 ${className}` }, children)));
|
|
950
1012
|
};
|
|
951
1013
|
|
|
952
|
-
const ListItem = ({ children, className = '' }) => {
|
|
953
|
-
|
|
1014
|
+
const ListItem = ({ children, className = '', motionVariant = 'fadeIn', duration = 0.3, loop = false, ...rest }) => {
|
|
1015
|
+
const transition = {
|
|
1016
|
+
duration,
|
|
1017
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1018
|
+
};
|
|
1019
|
+
return (React.createElement(framerMotion.motion.li, { className: className, initial: "hidden", animate: "visible", variants: motionVariants[motionVariant], transition: { transition }, ...rest }, children));
|
|
954
1020
|
};
|
|
955
1021
|
|
|
956
|
-
const Modal = ({ children, className = '', isOpen, onClose, motionVariant = 'bounce' }) => {
|
|
957
|
-
|
|
1022
|
+
const Modal = ({ children, className = '', isOpen, onClose, motionVariant = 'bounce', duration = 0.3, loop = false, ...rest }) => {
|
|
1023
|
+
const transition = {
|
|
1024
|
+
duration,
|
|
1025
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1026
|
+
};
|
|
1027
|
+
return (React.createElement(framerMotion.AnimatePresence, null, isOpen && (React.createElement(framerMotion.motion.div, { className: "fixed inset-0 z-50 overflow-y-auto", ...rest, initial: "hidden", animate: "visible", transition: { transition }, variants: motionVariants[motionVariant] },
|
|
958
1028
|
React.createElement("div", { className: "flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" },
|
|
959
1029
|
React.createElement("div", { className: "fixed inset-0 transition-opacity", "aria-hidden": "true" },
|
|
960
1030
|
React.createElement("div", { className: "absolute inset-0 bg-black opacity-45", onClick: onClose })),
|
|
@@ -975,35 +1045,55 @@ const ModalHeader = ({ children, className = '' }) => {
|
|
|
975
1045
|
React.createElement("h3", { className: "text-lg leading-6 font-medium text-gray-900" }, children)));
|
|
976
1046
|
};
|
|
977
1047
|
|
|
978
|
-
const NavItem = ({ children, className = '',
|
|
979
|
-
|
|
980
|
-
const
|
|
1048
|
+
const NavItem = ({ href, children, className = '', active = false, size = 'md', sizeClasses, motionVariant = 'fadeIn', duration = 0.3, loop = false, textColorClass = 'text-gray-500', hoverTextColorClass = 'hover:text-gray-700', activeTextColorClass = 'text-gray-900', activeBorderClass = 'border-b-2 border-blue-500', hoverScale = 1.05, tapScale = 0.95, ...rest }) => {
|
|
1049
|
+
// default size class map
|
|
1050
|
+
const defaultSizeClasses = {
|
|
981
1051
|
xs: 'text-xs px-1 py-0.5',
|
|
982
1052
|
sm: 'text-sm px-2 py-1',
|
|
983
1053
|
md: 'text-base px-3 py-2',
|
|
984
1054
|
lg: 'text-lg px-4 py-3',
|
|
985
1055
|
xl: 'text-xl px-5 py-4',
|
|
986
1056
|
};
|
|
987
|
-
|
|
1057
|
+
// merged size classes
|
|
1058
|
+
const mergedSizeClasses = {
|
|
1059
|
+
...defaultSizeClasses,
|
|
1060
|
+
...sizeClasses,
|
|
1061
|
+
};
|
|
1062
|
+
const baseClasses = `inline-flex items-center ${mergedSizeClasses[size]}`;
|
|
1063
|
+
const stateClasses = active
|
|
1064
|
+
? `${activeTextColorClass} ${activeBorderClass}`
|
|
1065
|
+
: `${textColorClass} ${hoverTextColorClass}`;
|
|
1066
|
+
const transition = {
|
|
1067
|
+
duration,
|
|
1068
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1069
|
+
};
|
|
1070
|
+
return (React.createElement(framerMotion.motion.a, { href: href, className: `${baseClasses} ${stateClasses} ${className}`, initial: "hidden", animate: "visible", variants: motionVariants[motionVariant], transition: { transition }, whileHover: { scale: hoverScale }, whileTap: { scale: tapScale }, ...rest }, children));
|
|
988
1071
|
};
|
|
989
1072
|
|
|
990
|
-
const Navbar = ({ children, className = '',
|
|
991
|
-
const [
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1073
|
+
const Navbar = ({ brand, children, className = '', bgColorClass = 'bg-white', textColorClass = 'text-gray-800', hoverTextColorClass = 'hover:text-gray-600', shadowClass = 'shadow', containerClassName = 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8', desktopMenuClassName = 'hidden md:flex items-center space-x-4', mobileMenuWrapperClassName = 'md:hidden bg-white shadow-md', mobileMenuItemClassName = 'block px-4 py-2', menuIcon, closeIcon, navMotion, mobileMotion, duration = 0.3, loop = false, ...rest }) => {
|
|
1074
|
+
const [isMobileOpen, setMobileOpen] = React.useState(false);
|
|
1075
|
+
const toggleMobile = () => setMobileOpen(prev => !prev);
|
|
1076
|
+
const transition = {
|
|
1077
|
+
duration,
|
|
1078
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1079
|
+
};
|
|
1080
|
+
return (React.createElement(React.Fragment, null,
|
|
1081
|
+
React.createElement(framerMotion.motion.nav, { className: `flex items-center justify-between ${bgColorClass} ${shadowClass} ${className}`, initial: "hidden", animate: "visible", transition: { transition }, ...navMotion, ...rest },
|
|
1082
|
+
React.createElement("div", { className: containerClassName + ' flex items-center justify-between h-16' },
|
|
1083
|
+
React.createElement("div", { className: "flex-shrink-0" }, brand),
|
|
1084
|
+
React.createElement("div", { className: desktopMenuClassName + ` ${textColorClass}` }, React.Children.map(children, child => (React.createElement("div", { className: `${hoverTextColorClass}` }, child)))),
|
|
1085
|
+
React.createElement("div", { className: "md:hidden flex items-center" },
|
|
1086
|
+
React.createElement("button", { onClick: toggleMobile, "aria-label": isMobileOpen ? 'Close menu' : 'Open menu', className: `${textColorClass} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400` }, isMobileOpen
|
|
1087
|
+
? closeIcon || (React.createElement("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
|
|
1088
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })))
|
|
1089
|
+
: menuIcon || (React.createElement("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
|
|
1090
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h16" }))))))),
|
|
1091
|
+
React.createElement(framerMotion.AnimatePresence, null, isMobileOpen && (React.createElement(framerMotion.motion.div, { className: mobileMenuWrapperClassName + ` ${textColorClass}`, initial: { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.3 }, ...mobileMotion },
|
|
1092
|
+
React.createElement("div", { className: "space-y-2 py-2" }, React.Children.map(children, child => (React.createElement("div", { className: `${mobileMenuItemClassName} ${hoverTextColorClass}` }, child)))))))));
|
|
1003
1093
|
};
|
|
1004
1094
|
|
|
1005
|
-
const Offcanvas = ({
|
|
1006
|
-
const
|
|
1095
|
+
const Offcanvas = ({ isOpen, onClose, position = 'left', className = '', children, panelSizeClass = 'max-w-md', overlayBgClass = 'bg-black bg-opacity-75', panelBgClass = 'bg-white', panelShadowClass = 'shadow-xl', zIndex = 'z-50', closeOnOverlayClick = true, duration = 0.3, loop = false, customCloseIcon, overlayMotion, panelMotion, ...rest }) => {
|
|
1096
|
+
const posClasses = {
|
|
1007
1097
|
left: 'left-0 top-0 h-full',
|
|
1008
1098
|
right: 'right-0 top-0 h-full',
|
|
1009
1099
|
top: 'top-0 left-0 w-full',
|
|
@@ -1015,12 +1105,18 @@ const Offcanvas = ({ children, className = '', isOpen, onClose, position = 'left
|
|
|
1015
1105
|
top: { y: '-100%' },
|
|
1016
1106
|
bottom: { y: '100%' },
|
|
1017
1107
|
};
|
|
1018
|
-
|
|
1108
|
+
const transition = {
|
|
1109
|
+
duration,
|
|
1110
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1111
|
+
};
|
|
1112
|
+
return (React.createElement(framerMotion.AnimatePresence, null, isOpen && (React.createElement("div", { className: `fixed inset-0 ${zIndex} overflow-hidden` },
|
|
1019
1113
|
React.createElement("div", { className: "absolute inset-0 overflow-hidden" },
|
|
1020
|
-
React.createElement(framerMotion.motion.div, { className:
|
|
1021
|
-
React.createElement("section", { className: `absolute ${
|
|
1022
|
-
React.createElement(framerMotion.motion.div, { className: `h-full w-full transform
|
|
1023
|
-
React.createElement("div", { className:
|
|
1114
|
+
React.createElement(framerMotion.motion.div, { className: `absolute inset-0 ${overlayBgClass}`, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { transition }, onClick: closeOnOverlayClick ? onClose : undefined, ...overlayMotion }),
|
|
1115
|
+
React.createElement("section", { className: `absolute ${posClasses[position]} ${panelSizeClass}` },
|
|
1116
|
+
React.createElement(framerMotion.motion.div, { className: `h-full w-full transform ${className}`, initial: variants[position], animate: { x: 0, y: 0 }, exit: variants[position], transition: { transition }, ...panelMotion },
|
|
1117
|
+
React.createElement("div", { className: `${panelBgClass} ${panelShadowClass} h-full relative` },
|
|
1118
|
+
customCloseIcon && (React.createElement("button", { className: "absolute top-2 right-2", onClick: onClose, "aria-label": "Close" }, customCloseIcon)),
|
|
1119
|
+
children))))))));
|
|
1024
1120
|
};
|
|
1025
1121
|
|
|
1026
1122
|
const OffcanvasBody = ({ children, className = '' }) => {
|
|
@@ -1036,80 +1132,119 @@ const OffcanvasHeader = ({ children, className = '', onClose }) => {
|
|
|
1036
1132
|
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })))));
|
|
1037
1133
|
};
|
|
1038
1134
|
|
|
1039
|
-
const Pagination = ({ className = '', currentPage, totalPages, onPageChange, color = 'primary', motionVariant = 'fadeIn',
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
if (startPage > 2)
|
|
1058
|
-
pages.push('...');
|
|
1059
|
-
for (let i = startPage; i <= endPage; i++)
|
|
1060
|
-
pages.push(i);
|
|
1061
|
-
if (endPage < totalPages - 1)
|
|
1062
|
-
pages.push('...');
|
|
1063
|
-
pages.push(totalPages);
|
|
1064
|
-
return pages;
|
|
1065
|
-
};
|
|
1066
|
-
setVisiblePages(generateVisiblePages());
|
|
1067
|
-
}, [currentPage, totalPages, windowWidth]);
|
|
1135
|
+
const Pagination = ({ className = '', currentPage, totalPages, onPageChange, color = 'primary', size = 'md', motionVariant = 'fadeIn', showFirstLast = false, maxVisiblePages = 5, showPageNumbers = true, previousLabel = 'Previous', nextLabel = 'Next', firstLabel = '«', lastLabel = '»', buttonProps = {}, activeButtonProps = {}, disabledButtonProps = {}, ...restProps }) => {
|
|
1136
|
+
// Generate array of page numbers to display
|
|
1137
|
+
const getPageRange = () => {
|
|
1138
|
+
if (totalPages <= maxVisiblePages) {
|
|
1139
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
1140
|
+
}
|
|
1141
|
+
// Calculate the range to show
|
|
1142
|
+
let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
|
|
1143
|
+
let endPage = startPage + maxVisiblePages - 1;
|
|
1144
|
+
// Adjust if end page exceeds total pages
|
|
1145
|
+
if (endPage > totalPages) {
|
|
1146
|
+
endPage = totalPages;
|
|
1147
|
+
startPage = Math.max(1, endPage - maxVisiblePages + 1);
|
|
1148
|
+
}
|
|
1149
|
+
return Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);
|
|
1150
|
+
};
|
|
1151
|
+
const pageNumbers = getPageRange();
|
|
1152
|
+
// Color classes for different states
|
|
1068
1153
|
const colorClasses = {
|
|
1069
|
-
primary: 'text-blue-600 bg-blue-50 hover:bg-blue-100 hover:text-blue-700
|
|
1070
|
-
secondary: 'text-gray-600 bg-gray-50 hover:bg-gray-100 hover:text-gray-700
|
|
1071
|
-
success: 'text-green-600 bg-green-50 hover:bg-green-100 hover:text-green-700
|
|
1072
|
-
danger: 'text-red-600 bg-red-50 hover:bg-red-100 hover:text-red-700
|
|
1073
|
-
warning: 'text-yellow-600 bg-yellow-50 hover:bg-yellow-100 hover:text-yellow-700
|
|
1074
|
-
info: 'text-blue-400 bg-blue-50 hover:bg-blue-100 hover:text-blue-500
|
|
1154
|
+
primary: 'text-blue-600 bg-blue-50 hover:bg-blue-100 hover:text-blue-700',
|
|
1155
|
+
secondary: 'text-gray-600 bg-gray-50 hover:bg-gray-100 hover:text-gray-700',
|
|
1156
|
+
success: 'text-green-600 bg-green-50 hover:bg-green-100 hover:text-green-700',
|
|
1157
|
+
danger: 'text-red-600 bg-red-50 hover:bg-red-100 hover:text-red-700',
|
|
1158
|
+
warning: 'text-yellow-600 bg-yellow-50 hover:bg-yellow-100 hover:text-yellow-700',
|
|
1159
|
+
info: 'text-blue-400 bg-blue-50 hover:bg-blue-100 hover:text-blue-500',
|
|
1075
1160
|
};
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
:
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
:
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
${colorClasses[color]}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1161
|
+
// Size classes
|
|
1162
|
+
const sizeClasses = {
|
|
1163
|
+
sm: 'px-2 py-1 text-xs',
|
|
1164
|
+
md: 'px-3 py-2 text-sm',
|
|
1165
|
+
lg: 'px-4 py-3 text-base',
|
|
1166
|
+
};
|
|
1167
|
+
// Active page classes
|
|
1168
|
+
const activeClasses = {
|
|
1169
|
+
primary: 'bg-blue-600 text-white hover:bg-blue-700',
|
|
1170
|
+
secondary: 'bg-gray-600 text-white hover:bg-gray-700',
|
|
1171
|
+
success: 'bg-green-600 text-white hover:bg-green-700',
|
|
1172
|
+
danger: 'bg-red-600 text-white hover:bg-red-700',
|
|
1173
|
+
warning: 'bg-yellow-600 text-white hover:bg-yellow-700',
|
|
1174
|
+
info: 'bg-blue-500 text-white hover:bg-blue-600',
|
|
1175
|
+
};
|
|
1176
|
+
// Base button classes
|
|
1177
|
+
const baseButtonClasses = `
|
|
1178
|
+
border border-gray-300
|
|
1179
|
+
transition-colors duration-200 ease-in-out
|
|
1180
|
+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
|
|
1181
|
+
${sizeClasses[size]}
|
|
1182
|
+
`;
|
|
1183
|
+
return (React.createElement(framerMotion.motion.nav, { className: `flex flex-wrap justify-center ${className}`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", transition: { duration: 0.5, staggerChildren: 0.05 }, ...restProps },
|
|
1184
|
+
React.createElement("ul", { className: "flex flex-wrap items-center space-x-1 md:space-x-2" },
|
|
1185
|
+
showFirstLast && (React.createElement("li", null,
|
|
1186
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(1), disabled: currentPage === 1, className: `
|
|
1187
|
+
${baseButtonClasses}
|
|
1188
|
+
${colorClasses[color]}
|
|
1189
|
+
rounded-l-lg md:rounded-lg
|
|
1190
|
+
${currentPage === 1 ? 'cursor-not-allowed opacity-50' : ''}
|
|
1191
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === 1 ? disabledButtonProps : {}), "aria-label": "Go to first page" }, firstLabel))),
|
|
1192
|
+
React.createElement("li", null,
|
|
1193
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, className: `
|
|
1194
|
+
${baseButtonClasses}
|
|
1195
|
+
${colorClasses[color]}
|
|
1196
|
+
${!showFirstLast ? 'rounded-l-lg' : ''}
|
|
1197
|
+
${currentPage === 1 ? 'cursor-not-allowed opacity-50' : ''}
|
|
1198
|
+
hidden sm:block
|
|
1199
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === 1 ? disabledButtonProps : {}), "aria-label": "Go to previous page" }, previousLabel),
|
|
1200
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, className: `
|
|
1201
|
+
${baseButtonClasses}
|
|
1202
|
+
${colorClasses[color]}
|
|
1203
|
+
${!showFirstLast ? 'rounded-l-lg' : ''}
|
|
1204
|
+
${currentPage === 1 ? 'cursor-not-allowed opacity-50' : ''}
|
|
1205
|
+
sm:hidden
|
|
1206
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === 1 ? disabledButtonProps : {}), "aria-label": "Go to previous page" }, "<")),
|
|
1207
|
+
showPageNumbers && pageNumbers.map((number) => (React.createElement("li", { key: number, className: "hidden sm:block" },
|
|
1208
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(number), className: `
|
|
1209
|
+
${baseButtonClasses}
|
|
1210
|
+
${currentPage === number ? activeClasses[color] : colorClasses[color]}
|
|
1211
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === number ? activeButtonProps : {}), "aria-label": `Page ${number}`, "aria-current": currentPage === number ? 'page' : undefined }, number)))),
|
|
1212
|
+
React.createElement("li", { className: "block sm:hidden" },
|
|
1213
|
+
React.createElement(framerMotion.motion.span, { className: `
|
|
1214
|
+
${baseButtonClasses}
|
|
1215
|
+
${activeClasses[color]}
|
|
1216
|
+
flex items-center justify-center
|
|
1217
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible" },
|
|
1218
|
+
currentPage,
|
|
1219
|
+
" / ",
|
|
1220
|
+
totalPages)),
|
|
1221
|
+
React.createElement("li", null,
|
|
1222
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(currentPage + 1), disabled: currentPage === totalPages, className: `
|
|
1223
|
+
${baseButtonClasses}
|
|
1224
|
+
${colorClasses[color]}
|
|
1225
|
+
${!showFirstLast ? 'rounded-r-lg' : ''}
|
|
1226
|
+
${currentPage === totalPages ? 'cursor-not-allowed opacity-50' : ''}
|
|
1227
|
+
hidden sm:block
|
|
1228
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === totalPages ? disabledButtonProps : {}), "aria-label": "Go to next page" }, nextLabel),
|
|
1229
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(currentPage + 1), disabled: currentPage === totalPages, className: `
|
|
1230
|
+
${baseButtonClasses}
|
|
1231
|
+
${colorClasses[color]}
|
|
1232
|
+
${!showFirstLast ? 'rounded-r-lg' : ''}
|
|
1233
|
+
${currentPage === totalPages ? 'cursor-not-allowed opacity-50' : ''}
|
|
1234
|
+
sm:hidden
|
|
1235
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === totalPages ? disabledButtonProps : {}), "aria-label": "Go to next page" }, ">")),
|
|
1236
|
+
showFirstLast && (React.createElement("li", null,
|
|
1237
|
+
React.createElement(framerMotion.motion.button, { onClick: () => onPageChange(totalPages), disabled: currentPage === totalPages, className: `
|
|
1238
|
+
${baseButtonClasses}
|
|
1239
|
+
${colorClasses[color]}
|
|
1240
|
+
rounded-r-lg md:rounded-lg
|
|
1241
|
+
${currentPage === totalPages ? 'cursor-not-allowed opacity-50' : ''}
|
|
1242
|
+
`, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...buttonProps, ...(currentPage === totalPages ? disabledButtonProps : {}), "aria-label": "Go to last page" }, lastLabel))))));
|
|
1107
1243
|
};
|
|
1108
1244
|
|
|
1109
|
-
const ProgressBar = ({ className = '', color = 'primary',
|
|
1110
|
-
}) => {
|
|
1245
|
+
const ProgressBar = ({ className = '', value, max = 100, color = 'primary', heightClass = 'h-2.5', containerBgClass = 'bg-gray-200', barBgClass, motionVariant = 'fadeIn', duration = 0.5, loop = false, showLabel = false, labelClassName = 'text-xs font-medium text-gray-700 ml-2', ...rest }) => {
|
|
1111
1246
|
const percentage = Math.min(100, Math.max(0, (value / max) * 100));
|
|
1112
|
-
const
|
|
1247
|
+
const defaultColorMap = {
|
|
1113
1248
|
primary: 'bg-blue-600',
|
|
1114
1249
|
secondary: 'bg-gray-600',
|
|
1115
1250
|
success: 'bg-green-600',
|
|
@@ -1117,12 +1252,21 @@ const ProgressBar = ({ className = '', color = 'primary', value, max = 100, moti
|
|
|
1117
1252
|
warning: 'bg-yellow-600',
|
|
1118
1253
|
info: 'bg-indigo-600',
|
|
1119
1254
|
};
|
|
1120
|
-
|
|
1121
|
-
|
|
1255
|
+
const barClass = barBgClass || defaultColorMap[color];
|
|
1256
|
+
const transition = {
|
|
1257
|
+
duration,
|
|
1258
|
+
...(loop ? { repeat: Infinity, repeatType: 'loop' } : {}),
|
|
1259
|
+
};
|
|
1260
|
+
return (React.createElement("div", { className: `flex items-center ${className}` },
|
|
1261
|
+
React.createElement("div", { className: `relative w-full ${containerBgClass} rounded-full ${heightClass}` },
|
|
1262
|
+
React.createElement(framerMotion.motion.div, { className: `absolute left-0 top-0 rounded-full ${heightClass} ${barClass}`, style: { width: `${percentage}%` }, initial: { width: 0 }, animate: { width: `${percentage}%` }, transition: transition, variants: motionVariants[motionVariant], role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, ...rest })),
|
|
1263
|
+
showLabel && (React.createElement("span", { className: labelClassName },
|
|
1264
|
+
Math.round(percentage),
|
|
1265
|
+
"%"))));
|
|
1122
1266
|
};
|
|
1123
1267
|
|
|
1124
1268
|
const Skeleton = ({ className = '', width = '100%', height = '20px', color = 'primary', motionVariant = 'fadeIn', // Default motion variant
|
|
1125
|
-
}) => {
|
|
1269
|
+
...rest }) => {
|
|
1126
1270
|
const colorClasses = {
|
|
1127
1271
|
primary: 'bg-blue-200',
|
|
1128
1272
|
secondary: 'bg-gray-300',
|
|
@@ -1131,7 +1275,7 @@ const Skeleton = ({ className = '', width = '100%', height = '20px', color = 'pr
|
|
|
1131
1275
|
warning: 'bg-yellow-200',
|
|
1132
1276
|
info: 'bg-indigo-200',
|
|
1133
1277
|
};
|
|
1134
|
-
return (React.createElement(framerMotion.motion.div, { className: `animate-pulse rounded ${colorClasses[color]} ${className}`, style: { width, height }, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible" }));
|
|
1278
|
+
return (React.createElement(framerMotion.motion.div, { className: `animate-pulse rounded ${colorClasses[color]} ${className}`, style: { width, height }, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", ...rest }));
|
|
1135
1279
|
};
|
|
1136
1280
|
|
|
1137
1281
|
const Slider = ({ className = '', min, max, value, onChange, step = 1, color = 'primary', // Default color set to primary
|
|
@@ -1319,7 +1463,7 @@ const Tooltip = ({ children, className = '', content, position = 'top', color =
|
|
|
1319
1463
|
React.createElement(framerMotion.AnimatePresence, null, isVisible && (React.createElement(framerMotion.motion.div, { className: `absolute z-10 px-3 py-2 text-sm font-medium text-white rounded-lg shadow-sm ${positionClasses[position]} ${colorClasses[color]} ${className}`, initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, variants: motionVariants[motionVariant] }, content)))));
|
|
1320
1464
|
};
|
|
1321
1465
|
|
|
1322
|
-
const Heading = ({ children, className = '', as = 'h2', size = 'md' }) => {
|
|
1466
|
+
const Heading = ({ children, className = '', as = 'h2', size = 'md', ...rest }) => {
|
|
1323
1467
|
const Tag = as;
|
|
1324
1468
|
const sizeClasses = {
|
|
1325
1469
|
xs: 'text-lg',
|
|
@@ -1329,10 +1473,10 @@ const Heading = ({ children, className = '', as = 'h2', size = 'md' }) => {
|
|
|
1329
1473
|
xl: 'text-4xl',
|
|
1330
1474
|
};
|
|
1331
1475
|
return (React.createElement(framerMotion.motion.div, { initial: { opacity: 0, y: -20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 } },
|
|
1332
|
-
React.createElement(Tag, { className: `font-bold ${sizeClasses[size]} ${className}` }, children)));
|
|
1476
|
+
React.createElement(Tag, { ...rest, className: `font-bold ${sizeClasses[size]} ${className}` }, children)));
|
|
1333
1477
|
};
|
|
1334
1478
|
|
|
1335
|
-
const Text = ({ children, className = '', size = 'md', weight = 'normal' }) => {
|
|
1479
|
+
const Text = ({ children, className = '', size = 'md', weight = 'normal', ...rest }) => {
|
|
1336
1480
|
const sizeClasses = {
|
|
1337
1481
|
xs: 'text-xs',
|
|
1338
1482
|
sm: 'text-sm',
|
|
@@ -1346,7 +1490,7 @@ const Text = ({ children, className = '', size = 'md', weight = 'normal' }) => {
|
|
|
1346
1490
|
semibold: 'font-semibold',
|
|
1347
1491
|
bold: 'font-bold',
|
|
1348
1492
|
};
|
|
1349
|
-
return (React.createElement("p", { className: `${sizeClasses[size]} ${weightClasses[weight]} ${className}` }, children));
|
|
1493
|
+
return (React.createElement("p", { ...rest, className: `${sizeClasses[size]} ${weightClasses[weight]} ${className}` }, children));
|
|
1350
1494
|
};
|
|
1351
1495
|
|
|
1352
1496
|
exports.Accordion = Accordion;
|