@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.1.3 → 0.1.5
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/CHANGELOG.md +1 -1
- package/dist/index.d.ts +131 -131
- package/dist/index.esm.js +148 -148
- package/dist/index.js +148 -148
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ui/accessibility-demo.tsx +271 -0
- package/src/components/ui/advanced-component-architecture-demo.tsx +916 -0
- package/src/components/ui/advanced-transition-system-demo.tsx +670 -0
- package/src/components/ui/advanced-transition-system.tsx +395 -0
- package/src/components/ui/animation/animated-container.tsx +166 -0
- package/src/components/ui/animation/index.ts +19 -0
- package/src/components/ui/animation/staggered-container.tsx +68 -0
- package/src/components/ui/animation-demo.tsx +250 -0
- package/src/components/ui/badge.tsx +33 -0
- package/src/components/ui/battery-conscious-animation-demo.tsx +568 -0
- package/src/components/ui/border-radius-shadow-demo.tsx +187 -0
- package/src/components/ui/button.tsx +36 -0
- package/src/components/ui/card.tsx +207 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/color-preview.tsx +411 -0
- package/src/components/ui/data-display/chart.tsx +653 -0
- package/src/components/ui/data-display/data-grid-simple.tsx +76 -0
- package/src/components/ui/data-display/data-grid.tsx +680 -0
- package/src/components/ui/data-display/list.tsx +456 -0
- package/src/components/ui/data-display/table.tsx +482 -0
- package/src/components/ui/data-display/timeline.tsx +441 -0
- package/src/components/ui/data-display/tree.tsx +602 -0
- package/src/components/ui/data-display/types.ts +536 -0
- package/src/components/ui/enterprise-mobile-experience-demo.tsx +749 -0
- package/src/components/ui/enterprise-mobile-experience.tsx +464 -0
- package/src/components/ui/feedback/alert.tsx +157 -0
- package/src/components/ui/feedback/progress.tsx +292 -0
- package/src/components/ui/feedback/skeleton.tsx +185 -0
- package/src/components/ui/feedback/toast.tsx +280 -0
- package/src/components/ui/feedback/types.ts +125 -0
- package/src/components/ui/font-preview.tsx +288 -0
- package/src/components/ui/form-demo.tsx +553 -0
- package/src/components/ui/hardware-acceleration-demo.tsx +547 -0
- package/src/components/ui/input.tsx +35 -0
- package/src/components/ui/label.tsx +16 -0
- package/src/components/ui/layout-demo.tsx +367 -0
- package/src/components/ui/layouts/adaptive-layout.tsx +139 -0
- package/src/components/ui/layouts/desktop-layout.tsx +224 -0
- package/src/components/ui/layouts/index.ts +10 -0
- package/src/components/ui/layouts/mobile-layout.tsx +162 -0
- package/src/components/ui/layouts/tablet-layout.tsx +197 -0
- package/src/components/ui/mobile-form-validation.tsx +451 -0
- package/src/components/ui/mobile-input-demo.tsx +201 -0
- package/src/components/ui/mobile-input.tsx +281 -0
- package/src/components/ui/mobile-skeleton-loading-demo.tsx +638 -0
- package/src/components/ui/navigation/breadcrumb.tsx +158 -0
- package/src/components/ui/navigation/index.ts +36 -0
- package/src/components/ui/navigation/menu.tsx +374 -0
- package/src/components/ui/navigation/navigation-demo.tsx +324 -0
- package/src/components/ui/navigation/pagination.tsx +272 -0
- package/src/components/ui/navigation/sidebar.tsx +383 -0
- package/src/components/ui/navigation/stepper.tsx +303 -0
- package/src/components/ui/navigation/tabs.tsx +205 -0
- package/src/components/ui/navigation/types.ts +299 -0
- package/src/components/ui/overlay/backdrop.tsx +81 -0
- package/src/components/ui/overlay/focus-manager.tsx +143 -0
- package/src/components/ui/overlay/index.ts +36 -0
- package/src/components/ui/overlay/modal.tsx +270 -0
- package/src/components/ui/overlay/overlay-manager.tsx +110 -0
- package/src/components/ui/overlay/popover.tsx +462 -0
- package/src/components/ui/overlay/portal.tsx +79 -0
- package/src/components/ui/overlay/tooltip.tsx +303 -0
- package/src/components/ui/overlay/types.ts +196 -0
- package/src/components/ui/performance-demo.tsx +596 -0
- package/src/components/ui/semantic-input-system-demo.tsx +502 -0
- package/src/components/ui/semantic-input-system-demo.tsx.disabled +873 -0
- package/src/components/ui/tablet-layout.tsx +192 -0
- package/src/components/ui/theme-customizer.tsx +386 -0
- package/src/components/ui/theme-preview.tsx +310 -0
- package/src/components/ui/theme-switcher.tsx +264 -0
- package/src/components/ui/theme-toggle.tsx +38 -0
- package/src/components/ui/token-demo.tsx +195 -0
- package/src/components/ui/touch-demo.tsx +462 -0
- package/src/components/ui/touch-friendly-interface-demo.tsx +519 -0
- package/src/components/ui/touch-friendly-interface.tsx +296 -0
- package/src/hooks/index.ts +190 -0
- package/src/hooks/use-accessibility-support.ts +518 -0
- package/src/hooks/use-adaptive-layout.ts +289 -0
- package/src/hooks/use-advanced-patterns.ts +294 -0
- package/src/hooks/use-advanced-transition-system.ts +393 -0
- package/src/hooks/use-animation-profile.ts +288 -0
- package/src/hooks/use-battery-animations.ts +384 -0
- package/src/hooks/use-battery-conscious-loading.ts +475 -0
- package/src/hooks/use-battery-optimization.ts +330 -0
- package/src/hooks/use-battery-status.ts +299 -0
- package/src/hooks/use-component-performance.ts +344 -0
- package/src/hooks/use-device-loading-states.ts +459 -0
- package/src/hooks/use-device.tsx +110 -0
- package/src/hooks/use-enterprise-mobile-experience.ts +488 -0
- package/src/hooks/use-form-feedback.ts +403 -0
- package/src/hooks/use-form-performance.ts +513 -0
- package/src/hooks/use-frame-rate.ts +251 -0
- package/src/hooks/use-gestures.ts +338 -0
- package/src/hooks/use-hardware-acceleration.ts +341 -0
- package/src/hooks/use-input-accessibility.ts +455 -0
- package/src/hooks/use-input-performance.ts +506 -0
- package/src/hooks/use-layout-performance.ts +319 -0
- package/src/hooks/use-loading-accessibility.ts +535 -0
- package/src/hooks/use-loading-performance.ts +473 -0
- package/src/hooks/use-memory-usage.ts +287 -0
- package/src/hooks/use-mobile-form-layout.ts +464 -0
- package/src/hooks/use-mobile-form-validation.ts +518 -0
- package/src/hooks/use-mobile-keyboard-optimization.ts +472 -0
- package/src/hooks/use-mobile-layout.ts +302 -0
- package/src/hooks/use-mobile-optimization.ts +406 -0
- package/src/hooks/use-mobile-skeleton.ts +402 -0
- package/src/hooks/use-mobile-touch.ts +414 -0
- package/src/hooks/use-performance-throttling.ts +348 -0
- package/src/hooks/use-performance.ts +316 -0
- package/src/hooks/use-reusable-architecture.ts +414 -0
- package/src/hooks/use-semantic-input-types.ts +357 -0
- package/src/hooks/use-semantic-input.ts +565 -0
- package/src/hooks/use-tablet-layout.ts +384 -0
- package/src/hooks/use-touch-friendly-input.ts +524 -0
- package/src/hooks/use-touch-friendly-interface.ts +331 -0
- package/src/hooks/use-touch-optimization.ts +375 -0
- package/src/index.ts +279 -279
- package/src/lib/utils.ts +6 -0
- package/src/themes/README.md +272 -0
- package/src/themes/ThemeContext.tsx +31 -0
- package/src/themes/ThemeProvider.tsx +232 -0
- package/src/themes/accessibility/index.ts +27 -0
- package/src/themes/accessibility.ts +259 -0
- package/src/themes/aria-patterns.ts +420 -0
- package/src/themes/base-themes.ts +55 -0
- package/src/themes/colorManager.ts +380 -0
- package/src/themes/examples/dark-theme.ts +154 -0
- package/src/themes/examples/minimal-theme.ts +108 -0
- package/src/themes/focus-management.ts +701 -0
- package/src/themes/fontLoader.ts +201 -0
- package/src/themes/high-contrast.ts +621 -0
- package/src/themes/index.ts +19 -0
- package/src/themes/inheritance.ts +227 -0
- package/src/themes/keyboard-navigation.ts +550 -0
- package/src/themes/motion-reduction.ts +662 -0
- package/src/themes/navigation.ts +238 -0
- package/src/themes/screen-reader.ts +645 -0
- package/src/themes/systemThemeDetector.ts +182 -0
- package/src/themes/themeCSSUpdater.ts +262 -0
- package/src/themes/themePersistence.ts +238 -0
- package/src/themes/themes/default.ts +586 -0
- package/src/themes/themes/harvey.ts +554 -0
- package/src/themes/themes/stan-design.ts +683 -0
- package/src/themes/types.ts +460 -0
- package/src/themes/useSystemTheme.ts +48 -0
- package/src/themes/useTheme.ts +87 -0
- package/src/themes/validation.ts +462 -0
- package/src/tokens/index.ts +34 -0
- package/src/tokens/tokenExporter.ts +397 -0
- package/src/tokens/tokenGenerator.ts +276 -0
- package/src/tokens/tokenManager.ts +248 -0
- package/src/tokens/tokenValidator.ts +543 -0
- package/src/tokens/types.ts +78 -0
- package/src/utils/bundle-analyzer.ts +260 -0
- package/src/utils/bundle-splitting.ts +483 -0
- package/src/utils/lazy-loading.ts +441 -0
- package/src/utils/performance-monitor.ts +513 -0
- package/src/utils/tree-shaking.ts +274 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ListProps,
|
|
4
|
+
ListItem,
|
|
5
|
+
ListAction,
|
|
6
|
+
ListFilter
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
// Simple icon components (inline SVG)
|
|
10
|
+
const ChevronRightIcon: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
11
|
+
<svg
|
|
12
|
+
className={`list__icon ${className}`}
|
|
13
|
+
fill="none"
|
|
14
|
+
stroke="currentColor"
|
|
15
|
+
viewBox="0 0 24 24"
|
|
16
|
+
>
|
|
17
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const SearchIcon: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
22
|
+
<svg
|
|
23
|
+
className={`list__icon ${className}`}
|
|
24
|
+
fill="none"
|
|
25
|
+
stroke="currentColor"
|
|
26
|
+
viewBox="0 0 24 24"
|
|
27
|
+
>
|
|
28
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const FilterIcon: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
33
|
+
<svg
|
|
34
|
+
className={`list__icon ${className}`}
|
|
35
|
+
fill="none"
|
|
36
|
+
stroke="currentColor"
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
>
|
|
39
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.414A1 1 0 013 6.707V4z" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const DotsIcon: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
44
|
+
<svg
|
|
45
|
+
className={`list__icon ${className}`}
|
|
46
|
+
fill="none"
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
viewBox="0 0 24 24"
|
|
49
|
+
>
|
|
50
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" />
|
|
51
|
+
</svg>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const CheckIcon: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
55
|
+
<svg
|
|
56
|
+
className={`list__icon ${className}`}
|
|
57
|
+
fill="none"
|
|
58
|
+
stroke="currentColor"
|
|
59
|
+
viewBox="0 0 24 24"
|
|
60
|
+
>
|
|
61
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// List Search and Filter Bar
|
|
66
|
+
const ListSearchFilterBar: React.FC<{
|
|
67
|
+
searchable: boolean;
|
|
68
|
+
searchValue: string;
|
|
69
|
+
onSearchChange: (value: string) => void;
|
|
70
|
+
filterable: boolean;
|
|
71
|
+
filters: ListFilter[];
|
|
72
|
+
onFiltersChange?: (filters: ListFilter[]) => void;
|
|
73
|
+
theme: string;
|
|
74
|
+
size: 'sm' | 'md' | 'lg';
|
|
75
|
+
}> = ({
|
|
76
|
+
searchable,
|
|
77
|
+
searchValue,
|
|
78
|
+
onSearchChange,
|
|
79
|
+
filterable,
|
|
80
|
+
filters,
|
|
81
|
+
size
|
|
82
|
+
}) => {
|
|
83
|
+
// const { getTheme } = useTheme();
|
|
84
|
+
// const themeConfig = getTheme(theme);
|
|
85
|
+
// const colors = themeConfig?.colors || getDefaultColors();
|
|
86
|
+
|
|
87
|
+
// const sizeClasses = {
|
|
88
|
+
// sm: 'h-8 text-sm px-3',
|
|
89
|
+
// md: 'h-10 text-base px-4',
|
|
90
|
+
// lg: 'h-12 text-lg px-5'
|
|
91
|
+
// };
|
|
92
|
+
|
|
93
|
+
if (!searchable && !filterable) return null;
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className={`list__search-filter-bar list__search-filter-bar--${size}`}>
|
|
97
|
+
{searchable && (
|
|
98
|
+
<div className="list__search-container">
|
|
99
|
+
<div className="list__search-icon">
|
|
100
|
+
<SearchIcon />
|
|
101
|
+
</div>
|
|
102
|
+
<input
|
|
103
|
+
type="text"
|
|
104
|
+
value={searchValue}
|
|
105
|
+
onChange={(e) => onSearchChange(e.target.value)}
|
|
106
|
+
placeholder="Search items..."
|
|
107
|
+
className={`list__search-input list__search-input--${size}`}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
{filterable && (
|
|
113
|
+
<button className={`list__filter-button list__filter-button--${size}`}>
|
|
114
|
+
<FilterIcon className="list__filter-icon" />
|
|
115
|
+
<span className="list__filter-text">Filters</span>
|
|
116
|
+
{filters.length > 0 && (
|
|
117
|
+
<span className="list__filter-badge">
|
|
118
|
+
{filters.length}
|
|
119
|
+
</span>
|
|
120
|
+
)}
|
|
121
|
+
</button>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// List Item Action Component
|
|
128
|
+
const ListItemActions: React.FC<{
|
|
129
|
+
actions: ListAction[];
|
|
130
|
+
item: ListItem;
|
|
131
|
+
theme: string;
|
|
132
|
+
size: 'sm' | 'md' | 'lg';
|
|
133
|
+
}> = ({ actions, item, size }) => {
|
|
134
|
+
// const { getTheme } = useTheme();
|
|
135
|
+
// const themeConfig = getTheme(theme);
|
|
136
|
+
// const colors = themeConfig?.colors || getDefaultColors();
|
|
137
|
+
|
|
138
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
139
|
+
|
|
140
|
+
// const sizeClasses = {
|
|
141
|
+
// sm: 'p-1',
|
|
142
|
+
// md: 'p-1.5',
|
|
143
|
+
// lg: 'p-2'
|
|
144
|
+
// };
|
|
145
|
+
|
|
146
|
+
if (actions.length === 0) return null;
|
|
147
|
+
|
|
148
|
+
// If only one action, show it directly
|
|
149
|
+
if (actions.length === 1) {
|
|
150
|
+
const action = actions[0];
|
|
151
|
+
return (
|
|
152
|
+
<button
|
|
153
|
+
onClick={(e) => {
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
action.onClick(item);
|
|
156
|
+
}}
|
|
157
|
+
className={`list__action-button list__action-button--${size} ${action.variant === 'danger' ? 'list__action-button--danger' : ''}`}
|
|
158
|
+
title={action.label}
|
|
159
|
+
>
|
|
160
|
+
{action.icon || <DotsIcon className="list__action-icon" />}
|
|
161
|
+
</button>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Multiple actions - show dropdown menu
|
|
166
|
+
return (
|
|
167
|
+
<div className="list__action-dropdown">
|
|
168
|
+
<button
|
|
169
|
+
onClick={(e) => {
|
|
170
|
+
e.stopPropagation();
|
|
171
|
+
setShowMenu(!showMenu);
|
|
172
|
+
}}
|
|
173
|
+
className={`list__action-button list__action-button--${size}`}
|
|
174
|
+
>
|
|
175
|
+
<DotsIcon className="list__action-icon" />
|
|
176
|
+
</button>
|
|
177
|
+
|
|
178
|
+
{showMenu && (
|
|
179
|
+
<>
|
|
180
|
+
{/* Backdrop */}
|
|
181
|
+
<div
|
|
182
|
+
className="list__action-backdrop"
|
|
183
|
+
onClick={() => setShowMenu(false)}
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
{/* Menu */}
|
|
187
|
+
<div className="list__action-menu">
|
|
188
|
+
{actions.map((action, index) => (
|
|
189
|
+
<button
|
|
190
|
+
key={index}
|
|
191
|
+
onClick={(e) => {
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
action.onClick(item);
|
|
194
|
+
setShowMenu(false);
|
|
195
|
+
}}
|
|
196
|
+
className={`list__action-menu-item ${action.variant === 'danger' ? 'list__action-menu-item--danger' : ''}`}
|
|
197
|
+
>
|
|
198
|
+
{action.icon && <span className="list__action-menu-icon">{action.icon}</span>}
|
|
199
|
+
{action.label}
|
|
200
|
+
</button>
|
|
201
|
+
))}
|
|
202
|
+
</div>
|
|
203
|
+
</>
|
|
204
|
+
)}
|
|
205
|
+
</div>
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// Individual List Item Component
|
|
210
|
+
const ListItemComponent: React.FC<{
|
|
211
|
+
item: ListItem;
|
|
212
|
+
index: number;
|
|
213
|
+
selectable: boolean;
|
|
214
|
+
selected: boolean;
|
|
215
|
+
onSelectionChange?: (selected: boolean) => void;
|
|
216
|
+
onClick?: (item: ListItem, index: number) => void;
|
|
217
|
+
actions: ListAction[];
|
|
218
|
+
showDivider: boolean;
|
|
219
|
+
theme: string;
|
|
220
|
+
size: 'sm' | 'md' | 'lg';
|
|
221
|
+
variant: 'default' | 'bordered' | 'striped';
|
|
222
|
+
}> = ({
|
|
223
|
+
item,
|
|
224
|
+
index,
|
|
225
|
+
selectable,
|
|
226
|
+
selected,
|
|
227
|
+
onSelectionChange,
|
|
228
|
+
onClick,
|
|
229
|
+
actions,
|
|
230
|
+
showDivider,
|
|
231
|
+
theme,
|
|
232
|
+
size,
|
|
233
|
+
variant
|
|
234
|
+
}) => {
|
|
235
|
+
|
|
236
|
+
const isClickable = !!onClick;
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<div
|
|
240
|
+
className={`list__item list__item--${size} list__item--${variant} ${isClickable ? 'list__item--clickable' : ''} ${index % 2 === 1 && variant === 'striped' ? 'list__item--striped' : ''}`}
|
|
241
|
+
onClick={isClickable ? () => onClick(item, index) : undefined}
|
|
242
|
+
>
|
|
243
|
+
{/* Selection Checkbox */}
|
|
244
|
+
{selectable && (
|
|
245
|
+
<div
|
|
246
|
+
className="list__item-select"
|
|
247
|
+
onClick={(e) => e.stopPropagation()}
|
|
248
|
+
>
|
|
249
|
+
<button
|
|
250
|
+
onClick={() => onSelectionChange?.(!selected)}
|
|
251
|
+
className={`list__item-checkbox ${selected ? 'list__item-checkbox--selected' : ''}`}
|
|
252
|
+
>
|
|
253
|
+
{selected && <CheckIcon className="list__item-checkbox-icon" />}
|
|
254
|
+
</button>
|
|
255
|
+
</div>
|
|
256
|
+
)}
|
|
257
|
+
|
|
258
|
+
{/* Avatar/Icon */}
|
|
259
|
+
{item.avatar && (
|
|
260
|
+
<div className="list__item-avatar">
|
|
261
|
+
{typeof item.avatar === 'string' ? (
|
|
262
|
+
<img
|
|
263
|
+
src={item.avatar}
|
|
264
|
+
alt={item.title}
|
|
265
|
+
className="list__item-avatar-image"
|
|
266
|
+
/>
|
|
267
|
+
) : (
|
|
268
|
+
<div className="list__item-avatar-placeholder">
|
|
269
|
+
{item.avatar}
|
|
270
|
+
</div>
|
|
271
|
+
)}
|
|
272
|
+
</div>
|
|
273
|
+
)}
|
|
274
|
+
|
|
275
|
+
{/* Content */}
|
|
276
|
+
<div className="list__item-content">
|
|
277
|
+
<div className="list__item-content-layout">
|
|
278
|
+
<div className="list__item-text">
|
|
279
|
+
<h3 className="list__item-title">
|
|
280
|
+
{item.title}
|
|
281
|
+
</h3>
|
|
282
|
+
{item.subtitle && (
|
|
283
|
+
<p className="list__item-subtitle">
|
|
284
|
+
{item.subtitle}
|
|
285
|
+
</p>
|
|
286
|
+
)}
|
|
287
|
+
{item.description && (
|
|
288
|
+
<p className="list__item-description">
|
|
289
|
+
{item.description}
|
|
290
|
+
</p>
|
|
291
|
+
)}
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
{/* Metadata */}
|
|
295
|
+
{item.metadata && (
|
|
296
|
+
<div className="list__item-metadata">
|
|
297
|
+
{item.metadata.timestamp && (
|
|
298
|
+
<p className="list__item-timestamp">
|
|
299
|
+
{item.metadata.timestamp}
|
|
300
|
+
</p>
|
|
301
|
+
)}
|
|
302
|
+
{item.metadata.status && (
|
|
303
|
+
<span className={`list__item-status list__item-status--${item.metadata.status}`}>
|
|
304
|
+
{item.metadata.status}
|
|
305
|
+
</span>
|
|
306
|
+
)}
|
|
307
|
+
{item.metadata.badge && (
|
|
308
|
+
<span className="list__item-badge">
|
|
309
|
+
{item.metadata.badge}
|
|
310
|
+
</span>
|
|
311
|
+
)}
|
|
312
|
+
</div>
|
|
313
|
+
)}
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
{/* Actions */}
|
|
318
|
+
<div className="list__item-actions">
|
|
319
|
+
<ListItemActions
|
|
320
|
+
actions={actions}
|
|
321
|
+
item={item}
|
|
322
|
+
theme={theme}
|
|
323
|
+
size={size}
|
|
324
|
+
/>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
{/* Navigation Arrow */}
|
|
328
|
+
{isClickable && (
|
|
329
|
+
<div className="list__item-navigation">
|
|
330
|
+
<ChevronRightIcon className="list__item-navigation-icon" />
|
|
331
|
+
</div>
|
|
332
|
+
)}
|
|
333
|
+
|
|
334
|
+
{/* Divider */}
|
|
335
|
+
{showDivider && variant !== 'bordered' && (
|
|
336
|
+
<div className="list__item-divider" />
|
|
337
|
+
)}
|
|
338
|
+
</div>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// Main List Component
|
|
343
|
+
export const List: React.FC<ListProps> = ({
|
|
344
|
+
items,
|
|
345
|
+
selectable = false,
|
|
346
|
+
selectedKeys = [],
|
|
347
|
+
onSelectionChange,
|
|
348
|
+
onClick,
|
|
349
|
+
actions = [],
|
|
350
|
+
searchable = false,
|
|
351
|
+
searchValue = '',
|
|
352
|
+
onSearchChange,
|
|
353
|
+
filterable = false,
|
|
354
|
+
filters = [],
|
|
355
|
+
// onFiltersChange, // TODO: Implement filter functionality
|
|
356
|
+
loading = false,
|
|
357
|
+
error = null,
|
|
358
|
+
emptyMessage = 'No items found',
|
|
359
|
+
showDividers = true,
|
|
360
|
+
className = '',
|
|
361
|
+
theme = 'stan-design',
|
|
362
|
+
size = 'md',
|
|
363
|
+
variant = 'default'
|
|
364
|
+
}) => {
|
|
365
|
+
// const { getTheme } = useTheme();
|
|
366
|
+
// const themeConfig = getTheme(theme);
|
|
367
|
+
// const colors = themeConfig?.colors || getDefaultColors();
|
|
368
|
+
|
|
369
|
+
// Filter items based on search
|
|
370
|
+
const filteredItems = useMemo(() => {
|
|
371
|
+
if (!searchable || !searchValue.trim()) return items;
|
|
372
|
+
|
|
373
|
+
const searchLower = searchValue.toLowerCase();
|
|
374
|
+
return items.filter(item =>
|
|
375
|
+
item.title.toLowerCase().includes(searchLower) ||
|
|
376
|
+
item.subtitle?.toLowerCase().includes(searchLower) ||
|
|
377
|
+
item.description?.toLowerCase().includes(searchLower)
|
|
378
|
+
);
|
|
379
|
+
}, [items, searchable, searchValue]);
|
|
380
|
+
|
|
381
|
+
const handleSelectionChange = useCallback((itemKey: string, selected: boolean) => {
|
|
382
|
+
if (!onSelectionChange) return;
|
|
383
|
+
|
|
384
|
+
const newSelectedKeys = selected
|
|
385
|
+
? [...selectedKeys, itemKey]
|
|
386
|
+
: selectedKeys.filter(key => key !== itemKey);
|
|
387
|
+
|
|
388
|
+
onSelectionChange(newSelectedKeys);
|
|
389
|
+
}, [selectedKeys, onSelectionChange]);
|
|
390
|
+
|
|
391
|
+
if (loading) {
|
|
392
|
+
return (
|
|
393
|
+
<div className={`list__loading ${className || ''}`}>
|
|
394
|
+
Loading...
|
|
395
|
+
</div>
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (error) {
|
|
400
|
+
return (
|
|
401
|
+
<div className={`list__error ${className || ''}`}>
|
|
402
|
+
{error}
|
|
403
|
+
</div>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return (
|
|
408
|
+
<div className={`list__container ${className || ''}`}>
|
|
409
|
+
{/* Search and Filter Bar */}
|
|
410
|
+
<ListSearchFilterBar
|
|
411
|
+
searchable={searchable}
|
|
412
|
+
searchValue={searchValue}
|
|
413
|
+
onSearchChange={onSearchChange || (() => {})}
|
|
414
|
+
filterable={filterable}
|
|
415
|
+
filters={filters}
|
|
416
|
+
// onFiltersChange={onFiltersChange}
|
|
417
|
+
theme={theme}
|
|
418
|
+
size={size}
|
|
419
|
+
/>
|
|
420
|
+
|
|
421
|
+
{/* List Container */}
|
|
422
|
+
<div className={`list__items list__items--${variant}`}>
|
|
423
|
+
{filteredItems.length === 0 ? (
|
|
424
|
+
<div className="list__empty">
|
|
425
|
+
{emptyMessage}
|
|
426
|
+
</div>
|
|
427
|
+
) : (
|
|
428
|
+
filteredItems.map((item, index) => {
|
|
429
|
+
const itemKey = item.key || item.id || index.toString();
|
|
430
|
+
const isSelected = selectedKeys.includes(itemKey);
|
|
431
|
+
const shouldShowDivider = showDividers && index < filteredItems.length - 1;
|
|
432
|
+
|
|
433
|
+
return (
|
|
434
|
+
<ListItemComponent
|
|
435
|
+
key={itemKey}
|
|
436
|
+
item={item}
|
|
437
|
+
index={index}
|
|
438
|
+
selectable={selectable}
|
|
439
|
+
selected={isSelected}
|
|
440
|
+
onSelectionChange={(selected) => handleSelectionChange(itemKey, selected)}
|
|
441
|
+
onClick={onClick}
|
|
442
|
+
actions={actions}
|
|
443
|
+
showDivider={shouldShowDivider}
|
|
444
|
+
theme={theme}
|
|
445
|
+
size={size}
|
|
446
|
+
variant={variant}
|
|
447
|
+
/>
|
|
448
|
+
);
|
|
449
|
+
})
|
|
450
|
+
)}
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export default List;
|