flikkui 0.1.0-beta.4 → 0.1.0-beta.6
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/components/charts/AreaChart/AreaChart.js +434 -0
- package/dist/components/charts/AreaChart/AreaChart.types.js +7 -0
- package/dist/components/charts/BarChart/BarChart.js +402 -0
- package/dist/components/charts/BarChart/BarChart.types.js +7 -0
- package/dist/components/charts/ChartContainer.js +38 -0
- package/dist/components/charts/Heatmap/Heatmap.js +153 -0
- package/dist/components/charts/Heatmap/HeatmapCell.js +100 -0
- package/dist/components/charts/Heatmap/HeatmapLegend.js +20 -0
- package/dist/components/charts/Heatmap/utils/heatmapUtils.js +174 -0
- package/dist/components/charts/LineChart/LineChart.js +396 -0
- package/dist/components/charts/LineChart/LineChart.types.js +7 -0
- package/dist/components/charts/hooks/useChartAccessibility.js +127 -0
- package/dist/components/charts/hooks/useChartTheme.js +86 -0
- package/dist/components/charts/hooks/useChartValidation.js +59 -0
- package/dist/components/charts/hooks/useTooltipPosition.js +292 -0
- package/dist/components/charts/shared/ChartAxis/XAxis.js +30 -0
- package/dist/components/charts/shared/ChartAxis/YAxis.js +97 -0
- package/dist/components/charts/shared/ChartCrosshair/ChartCrosshair.js +35 -0
- package/dist/components/charts/shared/ChartCrosshair/ChartCrosshair.theme.js +11 -0
- package/dist/components/charts/shared/ChartErrorBoundary/ChartErrorBoundary.js +66 -0
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.js +22 -0
- package/dist/components/charts/shared/ChartLegend/ChartLegend.js +30 -0
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.js +22 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.js +25 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.theme.js +9 -0
- package/dist/components/charts/shared/ChartText/ChartText.js +33 -0
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +9 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.js +62 -0
- package/dist/components/charts/theme/chart.theme.js +73 -0
- package/dist/components/charts/types/chart.types.js +29 -0
- package/dist/components/charts/utils/chart-validation.js +292 -0
- package/dist/components/charts/utils/color-utils.js +175 -0
- package/dist/components/core/Accordion/Accordion.animations.js +45 -0
- package/dist/components/core/Accordion/Accordion.js +52 -0
- package/dist/components/core/Accordion/Accordion.theme.js +8 -0
- package/dist/components/core/Accordion/AccordionContent.js +25 -0
- package/dist/components/core/Accordion/AccordionItem.js +56 -0
- package/dist/components/core/Accordion/AccordionTrigger.js +32 -0
- package/dist/components/core/Accordion/index.js +5 -0
- package/dist/components/core/Avatar/Avatar.js +94 -0
- package/dist/components/core/Avatar/Avatar.theme.js +25 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.js +79 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.js +67 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +23 -0
- package/dist/components/core/Badge/Badge.animations.js +109 -0
- package/dist/components/core/Badge/Badge.js +101 -0
- package/dist/components/core/Badge/Badge.theme.js +41 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +8 -8
- package/dist/components/core/Button/Button.theme.js +5 -5
- package/dist/components/core/Card/Card.js +46 -0
- package/dist/components/core/Card/Card.theme.js +5 -0
- package/dist/components/core/Divider/Divider.js +21 -0
- package/dist/components/core/Divider/Divider.theme.js +19 -0
- package/dist/components/core/Pagination/Pagination.js +113 -0
- package/dist/components/core/Pagination/Pagination.theme.js +27 -0
- package/dist/components/core/Segmented/Segmented.js +69 -0
- package/dist/components/core/Segmented/Segmented.theme.js +40 -0
- package/dist/components/core/Segmented/SegmentedContext.js +8 -0
- package/dist/components/core/Segmented/SegmentedItem.js +30 -0
- package/dist/components/core/Stepper/Stepper.js +57 -0
- package/dist/components/core/Stepper/Stepper.theme.js +9 -0
- package/dist/components/core/Stepper/components/ConnectorLine.js +42 -0
- package/dist/components/core/Stepper/components/IconCircle.js +44 -0
- package/dist/components/core/Stepper/components/ProgressIndicator.js +12 -0
- package/dist/components/core/Stepper/components/StepContent.js +36 -0
- package/dist/components/core/Stepper/components/StepperItem.js +22 -0
- package/dist/components/core/Tabs/Tabs.theme.js +2 -2
- package/dist/components/core/Tooltip/Tooltip.animations.js +46 -0
- package/dist/components/core/Tooltip/Tooltip.js +85 -0
- package/dist/components/core/Tooltip/Tooltip.theme.js +11 -0
- package/dist/components/core/Tooltip/useTooltipPositioning.js +59 -0
- package/dist/components/core/Tree/Tree.animations.js +38 -0
- package/dist/components/core/Tree/Tree.js +177 -0
- package/dist/components/core/Tree/Tree.theme.js +11 -0
- package/dist/components/data-display/Table/Table.js +177 -0
- package/dist/components/data-display/Table/Table.theme.js +28 -0
- package/dist/components/data-display/Table/Table.utils.js +28 -0
- package/dist/components/data-display/Table/components/DeclarativeComponents.js +123 -0
- package/dist/components/data-display/Table/components/TableActions/TableActions.js +56 -0
- package/dist/components/data-display/Table/components/TableActions/TableActionsMenu.js +29 -0
- package/dist/components/data-display/Table/components/TableColumnManager/TableColumnManager.js +85 -0
- package/dist/components/data-display/Table/components/TableColumnManager/TableColumnManager.theme.js +21 -0
- package/dist/components/data-display/Table/components/TablePagination/TablePagination.js +51 -0
- package/dist/components/data-display/Table/components/TableSelectionHeader/TableSelectionHeader.js +29 -0
- package/dist/components/data-display/Table/components/core/TableBody.js +32 -0
- package/dist/components/data-display/Table/components/core/TableCell.js +47 -0
- package/dist/components/data-display/Table/components/core/TableHeader.js +77 -0
- package/dist/components/data-display/Table/components/core/TableRow.js +46 -0
- package/dist/components/data-display/Table/index.js +20 -0
- package/dist/components/feedback/Alert/Alert.js +36 -0
- package/dist/components/feedback/Alert/Alert.theme.js +17 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.js +26 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.theme.js +16 -0
- package/dist/components/feedback/Empty/Empty.js +26 -0
- package/dist/components/feedback/Empty/Empty.theme.js +13 -0
- package/dist/components/feedback/Notification/Notification.js +41 -0
- package/dist/components/feedback/Notification/Notification.theme.js +49 -0
- package/dist/components/feedback/Spinner/Spinner.theme.js +3 -3
- package/dist/components/feedback/Toast/Toast.animations.js +58 -0
- package/dist/components/feedback/Toast/Toast.js +67 -0
- package/dist/components/feedback/Toast/Toast.theme.js +18 -0
- package/dist/components/feedback/Toast/ToastProvider.js +73 -0
- package/dist/components/feedback/Toast/useToast.js +91 -0
- package/dist/components/forms/Checkbox/Checkbox.theme.js +1 -1
- package/dist/components/forms/FormLabel/FormLabel.theme.js +2 -2
- package/dist/components/forms/Input/Input.theme.js +4 -4
- package/dist/components/forms/Radio/Radio.theme.js +2 -2
- package/dist/components/forms/Select/Select.js +1 -1
- package/dist/components/forms/Select/Select.theme.js +5 -5
- package/dist/components/forms/Switch/Switch.theme.js +1 -1
- package/dist/components/forms/TimePicker/TimePicker.theme.js +19 -19
- package/dist/components/forms/forms.theme.js +8 -8
- package/dist/components/navigation/NavItem/NavItem.js +93 -0
- package/dist/components/navigation/NavItem/NavItem.theme.js +27 -0
- package/dist/components/navigation/Sidebar/Sidebar.js +28 -0
- package/dist/components/navigation/Sidebar/Sidebar.theme.js +16 -0
- package/dist/components/navigation/Sidebar/SidebarContent.js +12 -0
- package/dist/components/navigation/Sidebar/SidebarContext.js +38 -0
- package/dist/components/navigation/Sidebar/SidebarFooter.js +11 -0
- package/dist/components/navigation/Sidebar/SidebarHeader.js +22 -0
- package/dist/components/navigation/Sidebar/SidebarNav.js +11 -0
- package/dist/components/navigation/Sidebar/SidebarNavGroup.js +19 -0
- package/dist/components/navigation/Sidebar/SidebarToggle.js +26 -0
- package/dist/icons/core/TickIcon.js +3 -1
- package/dist/index.d.ts +29 -4
- package/dist/index.js +64 -4
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ChevronDoubleLeftIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ChevronDoubleRightIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ChevronLeftIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/Cog6ToothIcon.js +32 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/EllipsisVerticalIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/PlusIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/ArrowPathIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/BellIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/CheckCircleIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/ExclamationTriangleIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/InformationCircleIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/XCircleIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/XMarkIcon.js +26 -0
- package/dist/node_modules/tslib/tslib.es6.js +15 -1
- package/dist/utils/dateUtils.js +32 -0
- package/dist/utils/debounce.js +21 -0
- package/package.json +1 -1
- package/dist/styles.css +0 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utilities for chart components
|
|
3
|
+
* Handles color extraction, manipulation, and theme integration
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extracts the fill color class from a combined class string
|
|
7
|
+
* @param classString - Combined class string like "fill-primary-base stroke-primary-base"
|
|
8
|
+
* @returns The fill class or empty string
|
|
9
|
+
*/
|
|
10
|
+
function extractFillClass(classString) {
|
|
11
|
+
var classes = classString.split(' ');
|
|
12
|
+
var fillClass = classes.find(function (cls) { return cls.startsWith('fill-'); });
|
|
13
|
+
return fillClass || '';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extracts the stroke color class from a combined class string
|
|
17
|
+
* @param classString - Combined class string like "fill-primary-base stroke-primary-base"
|
|
18
|
+
* @returns The stroke class or empty string
|
|
19
|
+
*/
|
|
20
|
+
function extractStrokeClass(classString) {
|
|
21
|
+
var classes = classString.split(' ');
|
|
22
|
+
var strokeClass = classes.find(function (cls) { return cls.startsWith('stroke-'); });
|
|
23
|
+
return strokeClass || '';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Converts a Tailwind color class to a CSS variable
|
|
27
|
+
* @param colorClass - Tailwind color class like "fill-primary-base"
|
|
28
|
+
* @returns CSS variable string like "var(--color-primary-500)"
|
|
29
|
+
*/
|
|
30
|
+
function colorClassToVariable(colorClass) {
|
|
31
|
+
// Remove the prefix (fill-, stroke-, bg-, text-, etc.)
|
|
32
|
+
var colorPart = colorClass.replace(/^(fill-|stroke-|bg-|text-|border-)/, '');
|
|
33
|
+
// Convert to CSS variable format
|
|
34
|
+
if (colorPart.includes('-base')) {
|
|
35
|
+
return "var(--color-".concat(colorPart.replace('-base', '-500'), ")");
|
|
36
|
+
}
|
|
37
|
+
return "var(--color-".concat(colorPart, ")");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Combines multiple Tailwind classes into a single class string
|
|
41
|
+
* @param classes - Array of class strings
|
|
42
|
+
* @returns Combined class string
|
|
43
|
+
*/
|
|
44
|
+
function combineClasses() {
|
|
45
|
+
var classes = [];
|
|
46
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
47
|
+
classes[_i] = arguments[_i];
|
|
48
|
+
}
|
|
49
|
+
return classes.filter(Boolean).join(' ');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates a color class string for chart elements
|
|
53
|
+
* @param baseColor - Base color (e.g., "primary", "warning")
|
|
54
|
+
* @param type - Type of element ("fill", "stroke", "both")
|
|
55
|
+
* @param shade - Color shade (e.g., "base", "400", "500")
|
|
56
|
+
* @returns Tailwind class string
|
|
57
|
+
*/
|
|
58
|
+
function createColorClass(baseColor, type, shade) {
|
|
59
|
+
if (type === void 0) { type = 'both'; }
|
|
60
|
+
if (shade === void 0) { shade = 'base'; }
|
|
61
|
+
var colorName = "".concat(baseColor, "-").concat(shade);
|
|
62
|
+
switch (type) {
|
|
63
|
+
case 'fill':
|
|
64
|
+
return "fill-".concat(colorName);
|
|
65
|
+
case 'stroke':
|
|
66
|
+
return "stroke-".concat(colorName);
|
|
67
|
+
case 'both':
|
|
68
|
+
return "fill-".concat(colorName, " stroke-").concat(colorName);
|
|
69
|
+
default:
|
|
70
|
+
return "fill-".concat(colorName, " stroke-").concat(colorName);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generates a series of color classes for multiple data series
|
|
75
|
+
* @param baseColors - Array of base color names
|
|
76
|
+
* @param type - Type of element ("fill", "stroke", "both")
|
|
77
|
+
* @param shade - Color shade
|
|
78
|
+
* @returns Array of color class strings
|
|
79
|
+
*/
|
|
80
|
+
function generateSeriesColors(baseColors, type, shade) {
|
|
81
|
+
if (type === void 0) { type = 'both'; }
|
|
82
|
+
if (shade === void 0) { shade = 'base'; }
|
|
83
|
+
return baseColors.map(function (color) { return createColorClass(color, type, shade); });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Default color palette for charts
|
|
87
|
+
*/
|
|
88
|
+
var DEFAULT_CHART_COLORS = [
|
|
89
|
+
'primary',
|
|
90
|
+
'warning',
|
|
91
|
+
'success',
|
|
92
|
+
'danger',
|
|
93
|
+
];
|
|
94
|
+
/**
|
|
95
|
+
* Extended color palette for charts with more options
|
|
96
|
+
*/
|
|
97
|
+
var EXTENDED_CHART_COLORS = [
|
|
98
|
+
'primary',
|
|
99
|
+
'warning',
|
|
100
|
+
'success',
|
|
101
|
+
'danger',
|
|
102
|
+
'info',
|
|
103
|
+
'purple',
|
|
104
|
+
'pink',
|
|
105
|
+
'indigo',
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* Minimal color palette for subtle charts
|
|
109
|
+
*/
|
|
110
|
+
var MINIMAL_CHART_COLORS = [
|
|
111
|
+
'neutral',
|
|
112
|
+
'slate',
|
|
113
|
+
'gray',
|
|
114
|
+
'zinc',
|
|
115
|
+
];
|
|
116
|
+
/**
|
|
117
|
+
* Generate a color palette for charts
|
|
118
|
+
*/
|
|
119
|
+
function generateColorPalette(count, baseHue) {
|
|
120
|
+
if (baseHue === void 0) { baseHue = 200; }
|
|
121
|
+
var colors = [];
|
|
122
|
+
var saturation = 70;
|
|
123
|
+
var lightness = 50;
|
|
124
|
+
for (var i = 0; i < count; i++) {
|
|
125
|
+
var hue = (baseHue + (i * 360) / count) % 360;
|
|
126
|
+
colors.push("hsl(".concat(hue, ", ").concat(saturation, "%, ").concat(lightness, "%)"));
|
|
127
|
+
}
|
|
128
|
+
return colors;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get contrast color (black or white) based on background color
|
|
132
|
+
*/
|
|
133
|
+
function getContrastColor(backgroundColor) {
|
|
134
|
+
// Convert hex to RGB
|
|
135
|
+
var hex = backgroundColor.replace('#', '');
|
|
136
|
+
var r = parseInt(hex.substr(0, 2), 16);
|
|
137
|
+
var g = parseInt(hex.substr(2, 2), 16);
|
|
138
|
+
var b = parseInt(hex.substr(4, 2), 16);
|
|
139
|
+
// Calculate luminance
|
|
140
|
+
var luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
141
|
+
return luminance > 0.5 ? '#000000' : '#ffffff';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Comprehensive color mapping that handles all chart color class variations
|
|
145
|
+
* Returns CSS variable references to match actual chart element colors
|
|
146
|
+
* Only uses CSS variables that actually exist in the project
|
|
147
|
+
*/
|
|
148
|
+
var getColorValue = function (colorClass) {
|
|
149
|
+
// Normalize the color class by removing prefixes and handling variations
|
|
150
|
+
var normalizedClass = colorClass
|
|
151
|
+
.replace(/^(fill-|stroke-)/, '') // Remove fill- or stroke- prefix
|
|
152
|
+
.replace(/-(base|400|500|600)$/, ''); // Remove suffix variations
|
|
153
|
+
// Map to CSS variables that actually exist in global.css
|
|
154
|
+
var colorMap = {
|
|
155
|
+
// Primary colors (exists)
|
|
156
|
+
'primary': 'var(--color-primary-base)',
|
|
157
|
+
// Warning/Yellow colors (exists)
|
|
158
|
+
'warning': 'var(--color-warning-base)',
|
|
159
|
+
// Success/Green colors (exists)
|
|
160
|
+
'success': 'var(--color-success-base)',
|
|
161
|
+
// Error/Danger/Red colors (exists as danger)
|
|
162
|
+
'error': 'var(--color-danger-base)', // Map error to danger
|
|
163
|
+
'danger': 'var(--color-danger-base)',
|
|
164
|
+
// Fallbacks for colors that don't exist in CSS - use primary as fallback
|
|
165
|
+
'info': 'var(--color-primary-base)', // Fallback to primary
|
|
166
|
+
'secondary': 'var(--color-primary-base)', // Fallback to primary
|
|
167
|
+
// Neutral colors - fallback to primary
|
|
168
|
+
'neutral': 'var(--color-primary-base)',
|
|
169
|
+
'slate': 'var(--color-primary-base)',
|
|
170
|
+
};
|
|
171
|
+
// Return the CSS variable directly
|
|
172
|
+
return colorMap[normalizedClass] || colorMap['primary'];
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { DEFAULT_CHART_COLORS, EXTENDED_CHART_COLORS, MINIMAL_CHART_COLORS, colorClassToVariable, combineClasses, createColorClass, extractFillClass, extractStrokeClass, generateColorPalette, generateSeriesColors, getColorValue, getContrastColor };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion animation variants for smooth, staggered open/close transitions
|
|
3
|
+
*/
|
|
4
|
+
var accordionAnimations = {
|
|
5
|
+
collapsed: {
|
|
6
|
+
height: 0,
|
|
7
|
+
opacity: 0,
|
|
8
|
+
transition: {
|
|
9
|
+
height: { duration: 0.3, ease: [0.04, 0.62, 0.23, 0.98] },
|
|
10
|
+
opacity: { duration: 0.25 }
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
open: {
|
|
14
|
+
height: 'auto',
|
|
15
|
+
opacity: 1,
|
|
16
|
+
transition: {
|
|
17
|
+
height: { duration: 0.4, ease: [0.04, 0.62, 0.23, 0.98] },
|
|
18
|
+
opacity: { duration: 0.3, delay: 0.1 }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Content animation variants for subtle slide-in effect after container expands
|
|
24
|
+
*/
|
|
25
|
+
var accordionContentAnimations = {
|
|
26
|
+
collapsed: {
|
|
27
|
+
opacity: 0,
|
|
28
|
+
y: -10,
|
|
29
|
+
transition: {
|
|
30
|
+
y: { duration: 0.2, ease: 'easeOut' },
|
|
31
|
+
opacity: { duration: 0.2 }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
open: {
|
|
35
|
+
opacity: 1,
|
|
36
|
+
y: 0,
|
|
37
|
+
transition: {
|
|
38
|
+
delay: 0.15, // Start after the container has begun expanding
|
|
39
|
+
y: { duration: 0.3, ease: 'easeOut' },
|
|
40
|
+
opacity: { duration: 0.3, ease: 'easeOut' }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { accordionAnimations, accordionContentAnimations };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React__default, { useContext, createContext, useState, useCallback } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { accordionTheme } from './Accordion.theme.js';
|
|
5
|
+
import { AccordionTrigger } from './AccordionTrigger.js';
|
|
6
|
+
import { AccordionContent } from './AccordionContent.js';
|
|
7
|
+
import { AccordionItem } from './AccordionItem.js';
|
|
8
|
+
|
|
9
|
+
// Create context for the main Accordion component
|
|
10
|
+
var AccordionContext = createContext(undefined);
|
|
11
|
+
var useAccordionContext = function () {
|
|
12
|
+
var ctx = useContext(AccordionContext);
|
|
13
|
+
if (!ctx)
|
|
14
|
+
throw new Error("Accordion compound components must be used within <Accordion>");
|
|
15
|
+
return ctx;
|
|
16
|
+
};
|
|
17
|
+
var Accordion = function (_a) {
|
|
18
|
+
var children = _a.children, className = _a.className, _b = _a.type, type = _b === void 0 ? "single" : _b, _c = _a.collapsible, collapsible = _c === void 0 ? false : _c, defaultValue = _a.defaultValue, value = _a.value, onValueChange = _a.onValueChange, themeOverrides = _a.theme, props = __rest(_a, ["children", "className", "type", "collapsible", "defaultValue", "value", "onValueChange", "theme"]);
|
|
19
|
+
// State for uncontrolled component
|
|
20
|
+
var _d = useState(defaultValue || (type === "single" ? "" : [])), uncontrolledValue = _d[0], setUncontrolledValue = _d[1];
|
|
21
|
+
// Determine if component is controlled
|
|
22
|
+
var isControlled = value !== undefined;
|
|
23
|
+
var currentValue = isControlled ? value : uncontrolledValue;
|
|
24
|
+
// Handler for value changes
|
|
25
|
+
var handleValueChange = useCallback(function (newValue) {
|
|
26
|
+
if (!isControlled) {
|
|
27
|
+
setUncontrolledValue(newValue);
|
|
28
|
+
}
|
|
29
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
30
|
+
}, [isControlled, onValueChange]);
|
|
31
|
+
// Merge theme with any overrides
|
|
32
|
+
var theme = __assign(__assign({}, accordionTheme), (themeOverrides || {}));
|
|
33
|
+
// Context value to be provided to children
|
|
34
|
+
var contextValue = {
|
|
35
|
+
type: type,
|
|
36
|
+
collapsible: collapsible,
|
|
37
|
+
value: currentValue,
|
|
38
|
+
onValueChange: handleValueChange,
|
|
39
|
+
theme: theme,
|
|
40
|
+
};
|
|
41
|
+
return (React__default.createElement(AccordionContext.Provider, { value: contextValue },
|
|
42
|
+
React__default.createElement("div", __assign({ className: cn(theme.baseStyle, className, "accordion") }, props), children)));
|
|
43
|
+
};
|
|
44
|
+
Accordion.displayName = "Accordion";
|
|
45
|
+
// Attach compound subcomponents
|
|
46
|
+
var Accordion$1 = Object.assign(Accordion, {
|
|
47
|
+
Item: AccordionItem,
|
|
48
|
+
Trigger: AccordionTrigger,
|
|
49
|
+
Content: AccordionContent,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { Accordion$1 as default, useAccordionContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var accordionTheme = {
|
|
2
|
+
baseStyle: "w-full max-w-xl",
|
|
3
|
+
itemStyle: "border border-border rounded-[var(--form-rounded)] bg-white overflow-hidden mb-2 last-of-type:mb-0 data-[state=open]:shadow-lg data-[state=open]:shadow-neutral-500/10",
|
|
4
|
+
triggerStyle: "flex w-full items-center justify-between px-4 py-3 text-left font-medium transition-all duration-200 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 text-text-primary [&[data-state=open]>svg]:rotate-180",
|
|
5
|
+
contentStyle: "data-[state=closed]:max-h-0 data-[state=open]:max-h-[500px]",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { accordionTheme };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useAccordionContext } from './Accordion.js';
|
|
5
|
+
import { useAccordionItemContext } from './AccordionItem.js';
|
|
6
|
+
import { accordionAnimations, accordionContentAnimations } from './Accordion.animations.js';
|
|
7
|
+
import { AnimatePresence } from '../../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
|
|
8
|
+
import { motion } from '../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js';
|
|
9
|
+
|
|
10
|
+
var AccordionContent = React__default.forwardRef(function (_a, ref) {
|
|
11
|
+
var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
|
|
12
|
+
var theme = useAccordionContext().theme;
|
|
13
|
+
var isOpen = useAccordionItemContext().isOpen;
|
|
14
|
+
// Filter out conflicting props to avoid type issues
|
|
15
|
+
rest.onDrag; rest.onDragEnd; rest.onDragStart; rest.onAnimationStart; rest.onAnimationEnd; rest.onTransitionEnd; rest.onTransitionStart; var safeProps = __rest(rest, ["onDrag", "onDragEnd", "onDragStart", "onAnimationStart", "onAnimationEnd", "onTransitionEnd", "onTransitionStart"]);
|
|
16
|
+
return (React__default.createElement(AnimatePresence, { initial: false }, isOpen && (React__default.createElement(motion.div, __assign({ ref: ref, className: cn(
|
|
17
|
+
// Default theme styles (can be overridden by className)
|
|
18
|
+
(theme === null || theme === void 0 ? void 0 : theme.contentStyle) || "data-[state=closed]:max-h-0 data-[state=open]:max-h-[500px]", "accordion-content overflow-hidden",
|
|
19
|
+
// User className takes precedence
|
|
20
|
+
className), "data-state": isOpen ? "open" : "closed", "aria-hidden": !isOpen, initial: "collapsed", animate: "open", exit: "collapsed", variants: accordionAnimations }, safeProps),
|
|
21
|
+
React__default.createElement(motion.div, { className: "accordion-content-inner p-4", variants: accordionContentAnimations, initial: "collapsed", animate: "open", exit: "collapsed" }, children)))));
|
|
22
|
+
});
|
|
23
|
+
AccordionContent.displayName = "AccordionContent";
|
|
24
|
+
|
|
25
|
+
export { AccordionContent };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __rest, __assign, __spreadArray } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React__default, { createContext, useContext } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useAccordionContext } from './Accordion.js';
|
|
5
|
+
|
|
6
|
+
// Create context for AccordionItem
|
|
7
|
+
var AccordionItemContext = createContext(undefined);
|
|
8
|
+
// Hook to use AccordionItem context
|
|
9
|
+
var useAccordionItemContext = function () {
|
|
10
|
+
var ctx = useContext(AccordionItemContext);
|
|
11
|
+
if (!ctx)
|
|
12
|
+
throw new Error("Accordion.Trigger and Accordion.Content must be used within Accordion.Item");
|
|
13
|
+
return ctx;
|
|
14
|
+
};
|
|
15
|
+
var AccordionItem = React__default.forwardRef(function (_a, ref) {
|
|
16
|
+
var children = _a.children, className = _a.className, value = _a.value, props = __rest(_a, ["children", "className", "value"]);
|
|
17
|
+
var _b = useAccordionContext(), selectedValue = _b.value, onValueChange = _b.onValueChange, type = _b.type, collapsible = _b.collapsible, theme = _b.theme;
|
|
18
|
+
// Determine if this item is open
|
|
19
|
+
var isOpen = type === "single"
|
|
20
|
+
? selectedValue === value
|
|
21
|
+
: Array.isArray(selectedValue) && selectedValue.includes(value);
|
|
22
|
+
// Toggle handler for this specific item
|
|
23
|
+
var toggle = function () {
|
|
24
|
+
if (type === "single") {
|
|
25
|
+
// For single type, either select this item or clear selection if collapsible
|
|
26
|
+
onValueChange(isOpen && collapsible ? "" : value);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// For multiple type, add or remove from array
|
|
30
|
+
if (Array.isArray(selectedValue)) {
|
|
31
|
+
var newValue = isOpen
|
|
32
|
+
? selectedValue.filter(function (v) { return v !== value; })
|
|
33
|
+
: __spreadArray(__spreadArray([], selectedValue, true), [value], false);
|
|
34
|
+
onValueChange(newValue);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
onValueChange([value]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// Context value for Trigger and Content
|
|
42
|
+
var contextValue = {
|
|
43
|
+
value: value,
|
|
44
|
+
isOpen: isOpen,
|
|
45
|
+
toggle: toggle
|
|
46
|
+
};
|
|
47
|
+
return (React__default.createElement(AccordionItemContext.Provider, { value: contextValue },
|
|
48
|
+
React__default.createElement("div", __assign({ ref: ref, className: cn(
|
|
49
|
+
// Default theme styles (can be overridden by className)
|
|
50
|
+
(theme === null || theme === void 0 ? void 0 : theme.itemStyle) || "border border-gray-200 rounded-lg bg-white overflow-hidden mb-2 last-of-type:mb-0 data-[state=open]:shadow-lg data-[state=open]:shadow-gray-500/10",
|
|
51
|
+
// User className takes precedence
|
|
52
|
+
className), "data-state": isOpen ? "open" : "closed", "data-value": value }, props), children)));
|
|
53
|
+
});
|
|
54
|
+
AccordionItem.displayName = "AccordionItem";
|
|
55
|
+
|
|
56
|
+
export { AccordionItem, useAccordionItemContext };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useAccordionContext } from './Accordion.js';
|
|
5
|
+
import { useAccordionItemContext } from './AccordionItem.js';
|
|
6
|
+
import { PlusIcon } from '../../../icons/core/PlusIcon.js';
|
|
7
|
+
import '../../../icons/core/MinusIcon.js';
|
|
8
|
+
import '../../../icons/core/SearchIcon.js';
|
|
9
|
+
import '../../../icons/core/LockIcon.js';
|
|
10
|
+
import '../../../icons/core/DollarIcon.js';
|
|
11
|
+
import '../../../icons/core/TickIcon.js';
|
|
12
|
+
import { motion } from '../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js';
|
|
13
|
+
|
|
14
|
+
var AccordionTrigger = React__default.forwardRef(function (_a, ref) {
|
|
15
|
+
var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
|
|
16
|
+
var theme = useAccordionContext().theme;
|
|
17
|
+
var _b = useAccordionItemContext(), isOpen = _b.isOpen, toggle = _b.toggle;
|
|
18
|
+
return (React__default.createElement("button", __assign({ ref: ref, type: "button", className: cn(
|
|
19
|
+
// Default theme styles (can be overridden by className)
|
|
20
|
+
(theme === null || theme === void 0 ? void 0 : theme.triggerStyle) || "cursor-pointer focus:outline-none transition-all flex justify-between gap-3 w-full px-4 py-2",
|
|
21
|
+
// User className takes precedence
|
|
22
|
+
className), "aria-expanded": isOpen, "data-state": isOpen ? "open" : "closed", onClick: toggle }, props),
|
|
23
|
+
children,
|
|
24
|
+
React__default.createElement(motion.div, { animate: { rotate: isOpen ? 45 : 0 }, transition: {
|
|
25
|
+
duration: 0.2,
|
|
26
|
+
ease: [0.4, 0.0, 0.2, 1]
|
|
27
|
+
}, className: "flex items-center justify-center" },
|
|
28
|
+
React__default.createElement(PlusIcon, { size: "sm" }))));
|
|
29
|
+
});
|
|
30
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
31
|
+
|
|
32
|
+
export { AccordionTrigger };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { avatarTheme } from './Avatar.theme.js';
|
|
5
|
+
import Tooltip from '../Tooltip/Tooltip.js';
|
|
6
|
+
import '../Tooltip/Tooltip.animations.js';
|
|
7
|
+
|
|
8
|
+
var Avatar = React__default.forwardRef(function (_a, ref) {
|
|
9
|
+
var src = _a.src, _b = _a.alt, alt = _b === void 0 ? "Avatar" : _b, // Default alt text for better accessibility
|
|
10
|
+
_c = _a.size, // Default alt text for better accessibility
|
|
11
|
+
size = _c === void 0 ? "md" : _c, _d = _a.status, status = _d === void 0 ? "none" : _d, fallback = _a.fallback, className = _a.className, role = _a.role, _e = _a.lazyLoad, lazyLoad = _e === void 0 ? true : _e, _f = _a.retryCount, retryCount = _f === void 0 ? 0 : _f, _g = _a.retryDelay, retryDelay = _g === void 0 ? 1000 : _g, contextualLabel = _a.contextualLabel, groupPosition = _a.groupPosition, _h = _a.showTooltip, showTooltip = _h === void 0 ? false : _h, props = __rest(_a, ["src", "alt", "size", "status", "fallback", "className", "role", "lazyLoad", "retryCount", "retryDelay", "contextualLabel", "groupPosition", "showTooltip"]);
|
|
12
|
+
var _j = useState(false), imageError = _j[0], setImageError = _j[1];
|
|
13
|
+
var _k = useState(0), retries = _k[0], setRetries = _k[1];
|
|
14
|
+
var retryTimerRef = useRef(null);
|
|
15
|
+
// Clear timeout on unmount to prevent memory leaks
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
return function () {
|
|
18
|
+
if (retryTimerRef.current) {
|
|
19
|
+
clearTimeout(retryTimerRef.current);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
// Handle image loading errors with retry functionality
|
|
24
|
+
var handleImageError = function () {
|
|
25
|
+
if (retries < retryCount) {
|
|
26
|
+
// Log error and retry
|
|
27
|
+
console.warn("Avatar image load failed, retrying (".concat(retries + 1, "/").concat(retryCount, ")..."));
|
|
28
|
+
// Set up retry with delay
|
|
29
|
+
retryTimerRef.current = setTimeout(function () {
|
|
30
|
+
setRetries(function (prev) { return prev + 1; });
|
|
31
|
+
setImageError(false); // Reset error state to trigger re-render and retry
|
|
32
|
+
}, retryDelay);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Max retries reached, show fallback
|
|
36
|
+
console.warn("Avatar image load failed after maximum retries");
|
|
37
|
+
setImageError(true);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// Handle fallback content
|
|
41
|
+
var getFallbackContent = function () {
|
|
42
|
+
if (fallback) {
|
|
43
|
+
return fallback;
|
|
44
|
+
}
|
|
45
|
+
// If no fallback provided and no alt text, use placeholder
|
|
46
|
+
if (alt === "Avatar") {
|
|
47
|
+
return React__default.createElement("span", { "aria-hidden": "true" }, "?");
|
|
48
|
+
}
|
|
49
|
+
// Use initials from alt text
|
|
50
|
+
var initials = alt
|
|
51
|
+
.split(" ")
|
|
52
|
+
.map(function (part) { return part[0]; })
|
|
53
|
+
.slice(0, 2)
|
|
54
|
+
.join("")
|
|
55
|
+
.toUpperCase();
|
|
56
|
+
return React__default.createElement("span", { "aria-hidden": "true" }, initials);
|
|
57
|
+
};
|
|
58
|
+
// Determine status indicator size based on avatar size
|
|
59
|
+
var getStatusSize = function () {
|
|
60
|
+
switch (size) {
|
|
61
|
+
case "xs":
|
|
62
|
+
return "size-1.5 right-0 bottom-0.5";
|
|
63
|
+
case "sm":
|
|
64
|
+
return "size-2 right-0 bottom-1";
|
|
65
|
+
case "md":
|
|
66
|
+
return "size-2.5 right-0 bottom-1";
|
|
67
|
+
case "lg":
|
|
68
|
+
return "size-3 right-0 bottom-1";
|
|
69
|
+
case "xl":
|
|
70
|
+
return "size-3.5 right-0 bottom-1";
|
|
71
|
+
default:
|
|
72
|
+
return "size-2.5 right-0 bottom-1";
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Create full accessibility label including context if provided
|
|
76
|
+
var accessibilityLabel = contextualLabel ? "".concat(alt).concat(contextualLabel) : alt;
|
|
77
|
+
// Determine appropriate ARIA role
|
|
78
|
+
var ariaRole = role || (src ? undefined : "img");
|
|
79
|
+
// Avatar content to potentially wrap in tooltip
|
|
80
|
+
var avatarContent = (React__default.createElement("div", __assign({ ref: ref, className: cn("relative inline-block avatar-wrapper", groupPosition // Apply group positioning classes if provided
|
|
81
|
+
), role: ariaRole === "presentation" ? "presentation" : undefined, "aria-label": ariaRole === "presentation" ? undefined : accessibilityLabel, "data-size": size, "data-status": status, "data-error": imageError ? "true" : "false" }, props),
|
|
82
|
+
React__default.createElement("div", { className: cn(avatarTheme.baseStyle, avatarTheme.sizes[size], className // User overrides take precedence
|
|
83
|
+
), "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-size": size }, src && !imageError ? (React__default.createElement("img", { src: src, alt: alt, className: "size-full object-cover object-top", onError: handleImageError, loading: lazyLoad ? "lazy" : undefined, "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-loaded": "true" })) : (React__default.createElement("div", { className: "avatar-fallback" }, getFallbackContent()))),
|
|
84
|
+
status !== "none" && (React__default.createElement("span", { className: cn("absolute rounded-full ring-2 ring-white", getStatusSize(), avatarTheme.statuses[status]), "aria-label": "Status: ".concat(status), role: "status", "data-status": status }))));
|
|
85
|
+
// Conditionally wrap in tooltip
|
|
86
|
+
if (showTooltip && alt && alt !== "Avatar") {
|
|
87
|
+
return (React__default.createElement(Tooltip, { content: alt, placement: "top" }, avatarContent));
|
|
88
|
+
}
|
|
89
|
+
return avatarContent;
|
|
90
|
+
});
|
|
91
|
+
// Set display name for dev tools and Storybook
|
|
92
|
+
Avatar.displayName = "Avatar";
|
|
93
|
+
|
|
94
|
+
export { Avatar, Avatar as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default theme for the Avatar component
|
|
3
|
+
*/
|
|
4
|
+
var avatarTheme = {
|
|
5
|
+
// Base styles for the avatar element
|
|
6
|
+
baseStyle: 'relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-text-primary font-semibold tracking-tighter rounded-[var(--avatar-rounded)] ring-2 ring-[var(--color-primary)]/10 border border-white transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2',
|
|
7
|
+
// Size variants using CSS variables
|
|
8
|
+
sizes: {
|
|
9
|
+
xs: 'size-[var(--avatar-size-xs)] text-[var(--avatar-text-xs)]',
|
|
10
|
+
sm: 'size-[var(--avatar-size-sm)] text-[var(--avatar-text-sm)]',
|
|
11
|
+
md: 'size-[var(--avatar-size-md)] text-[var(--avatar-text-md)]',
|
|
12
|
+
lg: 'size-[var(--avatar-size-lg)] text-[var(--avatar-text-lg)]',
|
|
13
|
+
xl: 'size-[var(--avatar-size-xl)] text-[var(--avatar-text-xl)]',
|
|
14
|
+
},
|
|
15
|
+
// Status indicator styles
|
|
16
|
+
statuses: {
|
|
17
|
+
online: 'bg-[var(--color-success)]',
|
|
18
|
+
offline: 'bg-neutral-400',
|
|
19
|
+
busy: 'bg-[var(--color-danger)]',
|
|
20
|
+
away: 'bg-[var(--color-warning)]',
|
|
21
|
+
none: '',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { avatarTheme };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation variants for AvatarGroup hover effects
|
|
3
|
+
* Creates a creative sliding and focus effect where hovered avatars scale up
|
|
4
|
+
* while non-hovered avatars slide closer together and fade slightly
|
|
5
|
+
*/
|
|
6
|
+
var getAvatarGroupVariants = function (direction, shouldReduceMotion, enableAnimations) {
|
|
7
|
+
if (shouldReduceMotion === void 0) { shouldReduceMotion = false; }
|
|
8
|
+
if (enableAnimations === void 0) { enableAnimations = true; }
|
|
9
|
+
if (shouldReduceMotion || !enableAnimations) {
|
|
10
|
+
return {
|
|
11
|
+
initial: { scale: 1, opacity: 1, zIndex: 10 },
|
|
12
|
+
hover: { scale: 1, zIndex: 10 }, // Keep same z-index when animations disabled
|
|
13
|
+
notHovered: { scale: 1, opacity: 1, zIndex: 10 },
|
|
14
|
+
default: { scale: 1, opacity: 1, zIndex: 10 }
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
initial: {
|
|
19
|
+
scale: 1,
|
|
20
|
+
opacity: 1,
|
|
21
|
+
x: 0,
|
|
22
|
+
filter: "blur(0px)",
|
|
23
|
+
zIndex: 10
|
|
24
|
+
},
|
|
25
|
+
hover: {
|
|
26
|
+
scale: 1.05,
|
|
27
|
+
opacity: 1,
|
|
28
|
+
x: 0,
|
|
29
|
+
filter: "blur(0px)",
|
|
30
|
+
zIndex: 20,
|
|
31
|
+
transition: {
|
|
32
|
+
type: "spring",
|
|
33
|
+
stiffness: 400,
|
|
34
|
+
damping: 25,
|
|
35
|
+
duration: 0.2
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
notHovered: {
|
|
39
|
+
scale: 0.95,
|
|
40
|
+
// opacity: 0.4,
|
|
41
|
+
// x: direction === "row" ? -8 : 8, // Slide towards the center
|
|
42
|
+
filter: "blur(0px) saturate(0) brightness(1.15)",
|
|
43
|
+
zIndex: 5,
|
|
44
|
+
transition: {
|
|
45
|
+
type: "spring",
|
|
46
|
+
stiffness: 300,
|
|
47
|
+
damping: 20,
|
|
48
|
+
duration: 0.3
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
default: {
|
|
52
|
+
scale: 1,
|
|
53
|
+
opacity: 1,
|
|
54
|
+
x: 0,
|
|
55
|
+
filter: "blur(0px)",
|
|
56
|
+
zIndex: 10,
|
|
57
|
+
transition: {
|
|
58
|
+
type: "spring",
|
|
59
|
+
stiffness: 300,
|
|
60
|
+
damping: 20,
|
|
61
|
+
duration: 0.3
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Determines which animation state to use based on hover index
|
|
68
|
+
*/
|
|
69
|
+
var getAnimationState = function (currentIndex, hoveredIndex, enableAnimations) {
|
|
70
|
+
if (!enableAnimations)
|
|
71
|
+
return "default";
|
|
72
|
+
if (hoveredIndex === currentIndex)
|
|
73
|
+
return "hover";
|
|
74
|
+
if (hoveredIndex !== null && hoveredIndex !== currentIndex)
|
|
75
|
+
return "notHovered";
|
|
76
|
+
return "default";
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { getAnimationState, getAvatarGroupVariants };
|