@opencosmos/ui 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +239 -0
- package/README.md +161 -0
- package/dist/cli.mjs +151 -0
- package/dist/dates.d.mts +20 -0
- package/dist/dates.d.ts +20 -0
- package/dist/dates.js +240 -0
- package/dist/dates.js.map +1 -0
- package/dist/dates.mjs +203 -0
- package/dist/dates.mjs.map +1 -0
- package/dist/dnd.d.mts +126 -0
- package/dist/dnd.d.ts +126 -0
- package/dist/dnd.js +274 -0
- package/dist/dnd.js.map +1 -0
- package/dist/dnd.mjs +250 -0
- package/dist/dnd.mjs.map +1 -0
- package/dist/fontThemes-Dh8mtXES.d.mts +868 -0
- package/dist/fontThemes-Dh8mtXES.d.ts +868 -0
- package/dist/forms.d.mts +38 -0
- package/dist/forms.d.ts +38 -0
- package/dist/forms.js +198 -0
- package/dist/forms.js.map +1 -0
- package/dist/forms.mjs +159 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/hooks-1b8WaQf1.d.mts +225 -0
- package/dist/hooks-CKW8vE9H.d.ts +225 -0
- package/dist/hooks.d.mts +3 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +971 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +943 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index-DscTIrZ2.d.mts +29 -0
- package/dist/index-DscTIrZ2.d.ts +29 -0
- package/dist/index.d.mts +3382 -0
- package/dist/index.d.ts +3382 -0
- package/dist/index.js +15146 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +14802 -0
- package/dist/index.mjs.map +1 -0
- package/dist/providers-CXPDMsl7.d.mts +30 -0
- package/dist/providers-Dn_Msjvz.d.ts +30 -0
- package/dist/providers.d.mts +3 -0
- package/dist/providers.d.ts +3 -0
- package/dist/providers.js +1885 -0
- package/dist/providers.js.map +1 -0
- package/dist/providers.mjs +1859 -0
- package/dist/providers.mjs.map +1 -0
- package/dist/tables.d.mts +10 -0
- package/dist/tables.d.ts +10 -0
- package/dist/tables.js +248 -0
- package/dist/tables.js.map +1 -0
- package/dist/tables.mjs +218 -0
- package/dist/tables.mjs.map +1 -0
- package/dist/tokens.d.mts +1065 -0
- package/dist/tokens.d.ts +1065 -0
- package/dist/tokens.js +2637 -0
- package/dist/tokens.js.map +1 -0
- package/dist/tokens.mjs +2555 -0
- package/dist/tokens.mjs.map +1 -0
- package/dist/utils-CIIM7dAC.d.ts +986 -0
- package/dist/utils-Cs04sxth.d.mts +986 -0
- package/dist/utils.d.mts +4 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +874 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +806 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/validation-Bj1ye-v_.d.mts +114 -0
- package/dist/validation-Bj1ye-v_.d.ts +114 -0
- package/dist/webgl.d.mts +104 -0
- package/dist/webgl.d.ts +104 -0
- package/dist/webgl.js +226 -0
- package/dist/webgl.js.map +1 -0
- package/dist/webgl.mjs +195 -0
- package/dist/webgl.mjs.map +1 -0
- package/package.json +267 -0
- package/src/cli.ts +206 -0
- package/src/component-registry.ts +183 -0
- package/src/components/actions/Button.test.tsx +61 -0
- package/src/components/actions/Button.tsx +70 -0
- package/src/components/actions/Link.tsx +78 -0
- package/src/components/actions/Magnetic.tsx +68 -0
- package/src/components/actions/Toggle.test.tsx +40 -0
- package/src/components/actions/Toggle.tsx +47 -0
- package/src/components/actions/ToggleGroup.tsx +70 -0
- package/src/components/actions/index.ts +5 -0
- package/src/components/backgrounds/FaultyTerminal.tsx +426 -0
- package/src/components/backgrounds/OrbBackground.tsx +424 -0
- package/src/components/backgrounds/WarpBackground.tsx +358 -0
- package/src/components/backgrounds/index.ts +3 -0
- package/src/components/blocks/Hero.tsx +142 -0
- package/src/components/blocks/social/OpenGraphCard.tsx +243 -0
- package/src/components/cursor/SplashCursor.tsx +1315 -0
- package/src/components/cursor/TargetCursor.tsx +187 -0
- package/src/components/cursor/index.ts +2 -0
- package/src/components/data-display/AspectImage.tsx +73 -0
- package/src/components/data-display/Avatar.test.tsx +35 -0
- package/src/components/data-display/Avatar.tsx +55 -0
- package/src/components/data-display/Badge.test.tsx +43 -0
- package/src/components/data-display/Badge.tsx +84 -0
- package/src/components/data-display/Brand.tsx +123 -0
- package/src/components/data-display/Calendar.tsx +70 -0
- package/src/components/data-display/Card.test.tsx +92 -0
- package/src/components/data-display/Card.tsx +115 -0
- package/src/components/data-display/Code.tsx +210 -0
- package/src/components/data-display/CollapsibleCodeBlock.tsx +238 -0
- package/src/components/data-display/DataTable.tsx +119 -0
- package/src/components/data-display/DescriptionList.tsx +41 -0
- package/src/components/data-display/GitHubIcon.tsx +44 -0
- package/src/components/data-display/Heading.test.tsx +36 -0
- package/src/components/data-display/Heading.tsx +83 -0
- package/src/components/data-display/StatCard.tsx +195 -0
- package/src/components/data-display/Table.tsx +133 -0
- package/src/components/data-display/Text.test.tsx +48 -0
- package/src/components/data-display/Text.tsx +144 -0
- package/src/components/data-display/Timeline.tsx +194 -0
- package/src/components/data-display/TreeView.tsx +226 -0
- package/src/components/data-display/Typewriter.tsx +119 -0
- package/src/components/data-display/VariableWeightText.tsx +130 -0
- package/src/components/data-display/index.ts +19 -0
- package/src/components/feedback/Alert.test.tsx +44 -0
- package/src/components/feedback/Alert.tsx +65 -0
- package/src/components/feedback/EmptyState.tsx +113 -0
- package/src/components/feedback/Progress.test.tsx +60 -0
- package/src/components/feedback/Progress.tsx +30 -0
- package/src/components/feedback/ProgressBar.tsx +158 -0
- package/src/components/feedback/Skeleton.test.tsx +39 -0
- package/src/components/feedback/Skeleton.tsx +45 -0
- package/src/components/feedback/Sonner.tsx +28 -0
- package/src/components/feedback/Spinner.test.tsx +33 -0
- package/src/components/feedback/Spinner.tsx +99 -0
- package/src/components/feedback/Stepper.tsx +307 -0
- package/src/components/feedback/Toast/Toast.tsx +243 -0
- package/src/components/feedback/Toast/index.ts +2 -0
- package/src/components/feedback/index.ts +9 -0
- package/src/components/forms/Checkbox.test.tsx +40 -0
- package/src/components/forms/Checkbox.tsx +31 -0
- package/src/components/forms/ColorPicker.tsx +118 -0
- package/src/components/forms/Combobox.tsx +96 -0
- package/src/components/forms/DragDrop.tsx +440 -0
- package/src/components/forms/FileUpload.tsx +252 -0
- package/src/components/forms/FilterButton.tsx +65 -0
- package/src/components/forms/Form.tsx +197 -0
- package/src/components/forms/Input.test.tsx +46 -0
- package/src/components/forms/Input.tsx +43 -0
- package/src/components/forms/InputOTP.tsx +81 -0
- package/src/components/forms/Label.test.tsx +20 -0
- package/src/components/forms/Label.tsx +25 -0
- package/src/components/forms/RadioGroup.tsx +51 -0
- package/src/components/forms/SearchBar.tsx +215 -0
- package/src/components/forms/Select.test.tsx +118 -0
- package/src/components/forms/Select.tsx +274 -0
- package/src/components/forms/Slider.tsx +29 -0
- package/src/components/forms/Switch.test.tsx +76 -0
- package/src/components/forms/Switch.tsx +30 -0
- package/src/components/forms/TextField.tsx +152 -0
- package/src/components/forms/Textarea.test.tsx +41 -0
- package/src/components/forms/Textarea.tsx +29 -0
- package/src/components/forms/ThemeSwitcher.tsx +290 -0
- package/src/components/forms/ThemeToggle.tsx +151 -0
- package/src/components/forms/index.ts +19 -0
- package/src/components/layout/Accordion.test.tsx +66 -0
- package/src/components/layout/Accordion.tsx +64 -0
- package/src/components/layout/AspectRatio.tsx +7 -0
- package/src/components/layout/Carousel.tsx +277 -0
- package/src/components/layout/Collapsible.test.tsx +40 -0
- package/src/components/layout/Collapsible.tsx +31 -0
- package/src/components/layout/Container.test.tsx +45 -0
- package/src/components/layout/Container.tsx +99 -0
- package/src/components/layout/CustomizerPanel.tsx +400 -0
- package/src/components/layout/DatePicker.tsx +57 -0
- package/src/components/layout/Footer/Footer.tsx +175 -0
- package/src/components/layout/Footer/index.ts +2 -0
- package/src/components/layout/GlassSurface.tsx +82 -0
- package/src/components/layout/Grid.test.tsx +31 -0
- package/src/components/layout/Grid.tsx +130 -0
- package/src/components/layout/Header/Header.tsx +450 -0
- package/src/components/layout/Header/index.ts +2 -0
- package/src/components/layout/PageLayout.tsx +180 -0
- package/src/components/layout/PageTemplate.tsx +158 -0
- package/src/components/layout/Resizable.tsx +48 -0
- package/src/components/layout/ScrollArea.tsx +53 -0
- package/src/components/layout/Separator.test.tsx +28 -0
- package/src/components/layout/Separator.tsx +29 -0
- package/src/components/layout/Sidebar.tsx +171 -0
- package/src/components/layout/Stack.test.tsx +41 -0
- package/src/components/layout/Stack.tsx +89 -0
- package/src/components/layout/glass-surface.css +60 -0
- package/src/components/layout/index.ts +18 -0
- package/src/components/motion/AnimatedBeam.tsx +159 -0
- package/src/components/navigation/Breadcrumb.test.tsx +57 -0
- package/src/components/navigation/Breadcrumb.tsx +119 -0
- package/src/components/navigation/Breadcrumbs.tsx +221 -0
- package/src/components/navigation/Command.tsx +159 -0
- package/src/components/navigation/Menubar.tsx +115 -0
- package/src/components/navigation/NavLink.tsx +55 -0
- package/src/components/navigation/NavigationMenu.tsx +125 -0
- package/src/components/navigation/Pagination.tsx +121 -0
- package/src/components/navigation/SecondaryNav.tsx +100 -0
- package/src/components/navigation/Tabs.test.tsx +47 -0
- package/src/components/navigation/Tabs.tsx +60 -0
- package/src/components/navigation/TertiaryNav.tsx +90 -0
- package/src/components/navigation/index.ts +10 -0
- package/src/components/overlays/AlertDialog.test.tsx +69 -0
- package/src/components/overlays/AlertDialog.tsx +166 -0
- package/src/components/overlays/ContextMenu.tsx +243 -0
- package/src/components/overlays/Dialog.test.tsx +79 -0
- package/src/components/overlays/Dialog.tsx +158 -0
- package/src/components/overlays/Drawer.tsx +128 -0
- package/src/components/overlays/Dropdown.tsx +253 -0
- package/src/components/overlays/DropdownMenu.tsx +242 -0
- package/src/components/overlays/HoverCard.tsx +32 -0
- package/src/components/overlays/Modal.tsx +250 -0
- package/src/components/overlays/NotificationCenter.tsx +364 -0
- package/src/components/overlays/Popover.test.tsx +40 -0
- package/src/components/overlays/Popover.tsx +46 -0
- package/src/components/overlays/Sheet.tsx +163 -0
- package/src/components/overlays/Tooltip.test.tsx +33 -0
- package/src/components/overlays/Tooltip.tsx +32 -0
- package/src/components/overlays/index.ts +12 -0
- package/src/dates.ts +2 -0
- package/src/dnd.ts +1 -0
- package/src/forms.ts +1 -0
- package/src/globals.css +187 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useForm.ts +247 -0
- package/src/hooks/useMotionPreference.test.ts +102 -0
- package/src/hooks/useMotionPreference.ts +78 -0
- package/src/hooks/useTheme.ts +58 -0
- package/src/hooks.ts +9 -0
- package/src/index.ts +168 -0
- package/src/lib/animations.ts +356 -0
- package/src/lib/breadcrumbs.ts +94 -0
- package/src/lib/colors.ts +493 -0
- package/src/lib/store/customizer.ts +482 -0
- package/src/lib/store/index.ts +3 -0
- package/src/lib/store/theme.ts +55 -0
- package/src/lib/syntax-parser/index.ts +50 -0
- package/src/lib/syntax-parser/patterns.ts +64 -0
- package/src/lib/syntax-parser/tokenizer.ts +117 -0
- package/src/lib/syntax-parser/types.ts +27 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/validation.ts +204 -0
- package/src/lib/webgl/Color.ts +11 -0
- package/src/lib/webgl/Mesh.ts +41 -0
- package/src/lib/webgl/Program.ts +118 -0
- package/src/lib/webgl/Renderer.ts +51 -0
- package/src/lib/webgl/Triangle.ts +27 -0
- package/src/lib/webgl/Vec3.ts +18 -0
- package/src/lib/webgl/index.ts +13 -0
- package/src/nativewind-env.d.ts +1 -0
- package/src/providers/ThemeProvider.tsx +461 -0
- package/src/providers/index.ts +1 -0
- package/src/providers.ts +7 -0
- package/src/tables.ts +1 -0
- package/src/test/setup.ts +39 -0
- package/src/theme.css +158 -0
- package/src/tokens.ts +7 -0
- package/src/utils.ts +12 -0
- package/src/webgl.ts +1 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// MAIN BARREL EXPORTS - Backward Compatible
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// All components remain importable from '@thesage/ui' root
|
|
5
|
+
// Example: import { Button, Card, Dialog } from '@thesage/ui'
|
|
6
|
+
|
|
7
|
+
// Actions
|
|
8
|
+
export * from './components/actions/Button';
|
|
9
|
+
export * from './components/actions/Link';
|
|
10
|
+
export * from './components/actions/Toggle';
|
|
11
|
+
export * from './components/actions/ToggleGroup';
|
|
12
|
+
export * from './components/actions/Magnetic';
|
|
13
|
+
|
|
14
|
+
// Forms
|
|
15
|
+
export * from './components/forms/Checkbox';
|
|
16
|
+
export * from './components/forms/ColorPicker';
|
|
17
|
+
export * from './components/forms/Combobox';
|
|
18
|
+
export * from './components/forms/DragDrop';
|
|
19
|
+
export * from './components/forms/FilterButton';
|
|
20
|
+
export * from './components/forms/Form';
|
|
21
|
+
export * from './components/forms/Input';
|
|
22
|
+
export * from './components/forms/InputOTP';
|
|
23
|
+
export * from './components/forms/Label';
|
|
24
|
+
export * from './components/forms/RadioGroup';
|
|
25
|
+
export * from './components/forms/SearchBar';
|
|
26
|
+
export * from './components/forms/Select';
|
|
27
|
+
export * from './components/forms/Slider';
|
|
28
|
+
export * from './components/forms/Switch';
|
|
29
|
+
export * from './components/forms/TextField';
|
|
30
|
+
export * from './components/forms/Textarea';
|
|
31
|
+
export * from './components/forms/ThemeSwitcher';
|
|
32
|
+
export * from './components/forms/ThemeToggle';
|
|
33
|
+
export * from './components/forms/FileUpload';
|
|
34
|
+
|
|
35
|
+
// Navigation
|
|
36
|
+
export * from './components/navigation/Breadcrumb';
|
|
37
|
+
export * from './components/navigation/Breadcrumbs';
|
|
38
|
+
export * from './components/navigation/Command';
|
|
39
|
+
export * from './components/navigation/Menubar';
|
|
40
|
+
export * from './components/navigation/NavLink';
|
|
41
|
+
export * from './components/navigation/NavigationMenu';
|
|
42
|
+
export * from './components/navigation/Pagination';
|
|
43
|
+
export * from './components/navigation/SecondaryNav';
|
|
44
|
+
export * from './components/navigation/Tabs';
|
|
45
|
+
export * from './components/navigation/TertiaryNav';
|
|
46
|
+
|
|
47
|
+
// Overlays
|
|
48
|
+
export * from './components/overlays/AlertDialog';
|
|
49
|
+
export * from './components/overlays/ContextMenu';
|
|
50
|
+
export * from './components/overlays/Dialog';
|
|
51
|
+
export * from './components/overlays/Drawer';
|
|
52
|
+
export * from './components/overlays/Dropdown';
|
|
53
|
+
export * from './components/overlays/DropdownMenu';
|
|
54
|
+
export * from './components/overlays/HoverCard';
|
|
55
|
+
export * from './components/overlays/Modal';
|
|
56
|
+
export * from './components/overlays/Popover';
|
|
57
|
+
export * from './components/overlays/Sheet';
|
|
58
|
+
export * from './components/overlays/Tooltip';
|
|
59
|
+
export * from './components/overlays/NotificationCenter';
|
|
60
|
+
|
|
61
|
+
// Feedback
|
|
62
|
+
export * from './components/feedback/Alert';
|
|
63
|
+
export * from './components/feedback/Progress';
|
|
64
|
+
export * from './components/feedback/ProgressBar';
|
|
65
|
+
export * from './components/feedback/Skeleton';
|
|
66
|
+
export * from './components/feedback/Sonner';
|
|
67
|
+
export * from './components/feedback/Spinner';
|
|
68
|
+
export * from './components/feedback/Toast';
|
|
69
|
+
export * from './components/feedback/EmptyState';
|
|
70
|
+
export * from './components/feedback/Stepper';
|
|
71
|
+
|
|
72
|
+
// Data Display
|
|
73
|
+
export * from './components/data-display/AspectImage';
|
|
74
|
+
export * from './components/data-display/Avatar';
|
|
75
|
+
export * from './components/data-display/Badge';
|
|
76
|
+
export * from './components/data-display/Brand';
|
|
77
|
+
export * from './components/data-display/Calendar';
|
|
78
|
+
export * from './components/data-display/Card';
|
|
79
|
+
export * from './components/data-display/Code';
|
|
80
|
+
export * from './components/data-display/CollapsibleCodeBlock';
|
|
81
|
+
export * from './components/data-display/DataTable';
|
|
82
|
+
export * from './components/data-display/DescriptionList';
|
|
83
|
+
export * from './components/data-display/GitHubIcon';
|
|
84
|
+
export * from './components/data-display/Heading';
|
|
85
|
+
export * from './components/data-display/Table';
|
|
86
|
+
export * from './components/data-display/Text';
|
|
87
|
+
export * from './components/data-display/VariableWeightText';
|
|
88
|
+
export * from './components/data-display/Typewriter';
|
|
89
|
+
export * from './components/data-display/StatCard';
|
|
90
|
+
export * from './components/data-display/Timeline';
|
|
91
|
+
export * from './components/data-display/TreeView';
|
|
92
|
+
export * from './components/blocks/social/OpenGraphCard';
|
|
93
|
+
|
|
94
|
+
// Layout
|
|
95
|
+
export * from './components/layout/Accordion';
|
|
96
|
+
export * from './components/layout/AspectRatio';
|
|
97
|
+
export * from './components/layout/Carousel';
|
|
98
|
+
export * from './components/layout/Collapsible';
|
|
99
|
+
export * from './components/layout/Container';
|
|
100
|
+
export * from './components/layout/CustomizerPanel';
|
|
101
|
+
export * from './components/layout/DatePicker';
|
|
102
|
+
export * from './components/layout/Footer';
|
|
103
|
+
export * from './components/layout/Grid';
|
|
104
|
+
export * from './components/layout/Header';
|
|
105
|
+
export * from './components/layout/PageLayout';
|
|
106
|
+
export * from './components/layout/PageTemplate';
|
|
107
|
+
export * from './components/layout/Resizable';
|
|
108
|
+
export * from './components/layout/ScrollArea';
|
|
109
|
+
export * from './components/layout/Separator';
|
|
110
|
+
export * from './components/layout/Sidebar';
|
|
111
|
+
export * from './components/layout/Stack';
|
|
112
|
+
export * from './components/layout/GlassSurface';
|
|
113
|
+
|
|
114
|
+
// Backgrounds
|
|
115
|
+
export * from './components/backgrounds/WarpBackground';
|
|
116
|
+
export * from './components/backgrounds/FaultyTerminal';
|
|
117
|
+
|
|
118
|
+
// Motion
|
|
119
|
+
export * from "./components/motion/AnimatedBeam";
|
|
120
|
+
export * from "./components/backgrounds/OrbBackground";
|
|
121
|
+
export * from "./components/blocks/Hero";
|
|
122
|
+
export * from './components/cursor/SplashCursor';
|
|
123
|
+
export * from './components/cursor/TargetCursor';
|
|
124
|
+
|
|
125
|
+
// Providers
|
|
126
|
+
export * from './providers/ThemeProvider';
|
|
127
|
+
|
|
128
|
+
// Hooks
|
|
129
|
+
export * from './hooks/useTheme';
|
|
130
|
+
export * from './hooks/useMotionPreference';
|
|
131
|
+
export * from './hooks/useForm';
|
|
132
|
+
|
|
133
|
+
// Stores
|
|
134
|
+
export * from './lib/store';
|
|
135
|
+
|
|
136
|
+
// Utilities
|
|
137
|
+
export * from './lib/animations';
|
|
138
|
+
export * from './lib/breadcrumbs';
|
|
139
|
+
export * from './lib/colors';
|
|
140
|
+
export * from './lib/utils';
|
|
141
|
+
export * from './lib/validation';
|
|
142
|
+
export * from './lib/syntax-parser';
|
|
143
|
+
|
|
144
|
+
// Tokens (selective re-exports)
|
|
145
|
+
export { typographySystem } from '@thesage/tokens';
|
|
146
|
+
|
|
147
|
+
// Component Registry (metadata)
|
|
148
|
+
export * from './component-registry';
|
|
149
|
+
|
|
150
|
+
// ============================================================================
|
|
151
|
+
// OPTIONAL CATEGORY-BASED EXPORTS (Future Use)
|
|
152
|
+
// ============================================================================
|
|
153
|
+
// These allow category-specific imports for better code organization
|
|
154
|
+
// Example: import { Button } from '@thesage/ui/actions'
|
|
155
|
+
// Note: These require package.json exports configuration
|
|
156
|
+
|
|
157
|
+
// Re-export categories for convenience
|
|
158
|
+
export * as Actions from './components/actions';
|
|
159
|
+
export * as Forms from './components/forms';
|
|
160
|
+
export * as Navigation from './components/navigation';
|
|
161
|
+
export * as Overlays from './components/overlays';
|
|
162
|
+
export * as Feedback from './components/feedback';
|
|
163
|
+
export * as DataDisplay from './components/data-display';
|
|
164
|
+
export * as Layout from './components/layout';
|
|
165
|
+
export * as Backgrounds from './components/backgrounds';
|
|
166
|
+
export * as Motion from './components/cursor';
|
|
167
|
+
export * as Providers from './providers';
|
|
168
|
+
export * as Hooks from './hooks';
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Presets
|
|
3
|
+
*
|
|
4
|
+
* Reusable animation configurations for consistent motion throughout the design system.
|
|
5
|
+
* Works with Framer Motion and respects user motion preferences.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Type definitions (compatible with Framer Motion)
|
|
9
|
+
export type Variant = {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type Variants = {
|
|
14
|
+
[key: string]: Variant;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type Transition = {
|
|
18
|
+
duration?: number;
|
|
19
|
+
ease?: readonly number[] | number[] | string;
|
|
20
|
+
type?: 'spring' | 'tween' | 'inertia';
|
|
21
|
+
damping?: number;
|
|
22
|
+
stiffness?: number;
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Animation Duration Presets
|
|
28
|
+
* Based on Material Design motion guidelines
|
|
29
|
+
*/
|
|
30
|
+
export const durations = {
|
|
31
|
+
instant: 0,
|
|
32
|
+
fast: 0.15,
|
|
33
|
+
normal: 0.3,
|
|
34
|
+
slow: 0.5,
|
|
35
|
+
slower: 0.7,
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Easing Presets
|
|
40
|
+
* Common easing curves for smooth animations
|
|
41
|
+
*/
|
|
42
|
+
export const easings = {
|
|
43
|
+
// Standard easing - default for most transitions
|
|
44
|
+
standard: [0.4, 0.0, 0.2, 1],
|
|
45
|
+
|
|
46
|
+
// Deceleration - use when objects enter screen
|
|
47
|
+
decelerate: [0.0, 0.0, 0.2, 1],
|
|
48
|
+
|
|
49
|
+
// Acceleration - use when objects exit screen
|
|
50
|
+
accelerate: [0.4, 0.0, 1, 1],
|
|
51
|
+
|
|
52
|
+
// Sharp - use for very quick transitions
|
|
53
|
+
sharp: [0.4, 0.0, 0.6, 1],
|
|
54
|
+
|
|
55
|
+
// Bounce - playful animation
|
|
56
|
+
bounce: [0.68, -0.55, 0.265, 1.55],
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Common transition presets
|
|
61
|
+
*/
|
|
62
|
+
export const transitions = {
|
|
63
|
+
default: {
|
|
64
|
+
duration: durations.normal,
|
|
65
|
+
ease: easings.standard,
|
|
66
|
+
} as Transition,
|
|
67
|
+
|
|
68
|
+
fast: {
|
|
69
|
+
duration: durations.fast,
|
|
70
|
+
ease: easings.standard,
|
|
71
|
+
} as Transition,
|
|
72
|
+
|
|
73
|
+
slow: {
|
|
74
|
+
duration: durations.slow,
|
|
75
|
+
ease: easings.standard,
|
|
76
|
+
} as Transition,
|
|
77
|
+
|
|
78
|
+
bounce: {
|
|
79
|
+
duration: durations.normal,
|
|
80
|
+
ease: easings.bounce,
|
|
81
|
+
} as Transition,
|
|
82
|
+
|
|
83
|
+
spring: {
|
|
84
|
+
type: 'spring' as const,
|
|
85
|
+
damping: 20,
|
|
86
|
+
stiffness: 300,
|
|
87
|
+
} as Transition,
|
|
88
|
+
|
|
89
|
+
springBouncy: {
|
|
90
|
+
type: 'spring' as const,
|
|
91
|
+
damping: 10,
|
|
92
|
+
stiffness: 100,
|
|
93
|
+
} as Transition,
|
|
94
|
+
} as const;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Fade Animation Variants
|
|
98
|
+
*/
|
|
99
|
+
export const fadeVariants: Variants = {
|
|
100
|
+
hidden: { opacity: 0 },
|
|
101
|
+
visible: { opacity: 1 },
|
|
102
|
+
exit: { opacity: 0 },
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Slide Animation Variants
|
|
107
|
+
*/
|
|
108
|
+
export const slideVariants = {
|
|
109
|
+
fromLeft: {
|
|
110
|
+
hidden: { x: -20, opacity: 0 },
|
|
111
|
+
visible: { x: 0, opacity: 1 },
|
|
112
|
+
exit: { x: -20, opacity: 0 },
|
|
113
|
+
},
|
|
114
|
+
fromRight: {
|
|
115
|
+
hidden: { x: 20, opacity: 0 },
|
|
116
|
+
visible: { x: 0, opacity: 1 },
|
|
117
|
+
exit: { x: 20, opacity: 0 },
|
|
118
|
+
},
|
|
119
|
+
fromTop: {
|
|
120
|
+
hidden: { y: -20, opacity: 0 },
|
|
121
|
+
visible: { y: 0, opacity: 1 },
|
|
122
|
+
exit: { y: -20, opacity: 0 },
|
|
123
|
+
},
|
|
124
|
+
fromBottom: {
|
|
125
|
+
hidden: { y: 20, opacity: 0 },
|
|
126
|
+
visible: { y: 0, opacity: 1 },
|
|
127
|
+
exit: { y: 20, opacity: 0 },
|
|
128
|
+
},
|
|
129
|
+
} as const;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Scale Animation Variants
|
|
133
|
+
*/
|
|
134
|
+
export const scaleVariants = {
|
|
135
|
+
default: {
|
|
136
|
+
hidden: { scale: 0.95, opacity: 0 },
|
|
137
|
+
visible: { scale: 1, opacity: 1 },
|
|
138
|
+
exit: { scale: 0.95, opacity: 0 },
|
|
139
|
+
},
|
|
140
|
+
grow: {
|
|
141
|
+
hidden: { scale: 0.8, opacity: 0 },
|
|
142
|
+
visible: { scale: 1, opacity: 1 },
|
|
143
|
+
exit: { scale: 0.8, opacity: 0 },
|
|
144
|
+
},
|
|
145
|
+
pop: {
|
|
146
|
+
hidden: { scale: 0 },
|
|
147
|
+
visible: { scale: 1 },
|
|
148
|
+
exit: { scale: 0 },
|
|
149
|
+
},
|
|
150
|
+
} as const;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Rotate Animation Variants
|
|
154
|
+
*/
|
|
155
|
+
export const rotateVariants = {
|
|
156
|
+
default: {
|
|
157
|
+
hidden: { rotate: -10, opacity: 0 },
|
|
158
|
+
visible: { rotate: 0, opacity: 1 },
|
|
159
|
+
exit: { rotate: 10, opacity: 0 },
|
|
160
|
+
},
|
|
161
|
+
flip: {
|
|
162
|
+
hidden: { rotateX: 90, opacity: 0 },
|
|
163
|
+
visible: { rotateX: 0, opacity: 1 },
|
|
164
|
+
exit: { rotateX: -90, opacity: 0 },
|
|
165
|
+
},
|
|
166
|
+
} as const;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* List/Stagger Animation Variants
|
|
170
|
+
*/
|
|
171
|
+
export const listVariants = {
|
|
172
|
+
container: {
|
|
173
|
+
hidden: { opacity: 0 },
|
|
174
|
+
visible: {
|
|
175
|
+
opacity: 1,
|
|
176
|
+
transition: {
|
|
177
|
+
staggerChildren: 0.1,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
item: {
|
|
182
|
+
hidden: { y: 20, opacity: 0 },
|
|
183
|
+
visible: {
|
|
184
|
+
y: 0,
|
|
185
|
+
opacity: 1,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
} as const;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Modal/Overlay Animation Variants
|
|
192
|
+
*/
|
|
193
|
+
export const modalVariants = {
|
|
194
|
+
overlay: {
|
|
195
|
+
hidden: { opacity: 0 },
|
|
196
|
+
visible: { opacity: 1 },
|
|
197
|
+
exit: { opacity: 0 },
|
|
198
|
+
},
|
|
199
|
+
content: {
|
|
200
|
+
hidden: { scale: 0.95, opacity: 0, y: 20 },
|
|
201
|
+
visible: { scale: 1, opacity: 1, y: 0 },
|
|
202
|
+
exit: { scale: 0.95, opacity: 0, y: 20 },
|
|
203
|
+
},
|
|
204
|
+
} as const;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Drawer/Sheet Animation Variants
|
|
208
|
+
*/
|
|
209
|
+
export const drawerVariants = {
|
|
210
|
+
fromLeft: {
|
|
211
|
+
hidden: { x: '-100%' },
|
|
212
|
+
visible: { x: 0 },
|
|
213
|
+
exit: { x: '-100%' },
|
|
214
|
+
},
|
|
215
|
+
fromRight: {
|
|
216
|
+
hidden: { x: '100%' },
|
|
217
|
+
visible: { x: 0 },
|
|
218
|
+
exit: { x: '100%' },
|
|
219
|
+
},
|
|
220
|
+
fromTop: {
|
|
221
|
+
hidden: { y: '-100%' },
|
|
222
|
+
visible: { y: 0 },
|
|
223
|
+
exit: { y: '-100%' },
|
|
224
|
+
},
|
|
225
|
+
fromBottom: {
|
|
226
|
+
hidden: { y: '100%' },
|
|
227
|
+
visible: { y: 0 },
|
|
228
|
+
exit: { y: '100%' },
|
|
229
|
+
},
|
|
230
|
+
} as const;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Collapse/Expand Animation Variants
|
|
234
|
+
*/
|
|
235
|
+
export const collapseVariants = {
|
|
236
|
+
collapsed: {
|
|
237
|
+
height: 0,
|
|
238
|
+
opacity: 0,
|
|
239
|
+
transition: { duration: durations.fast },
|
|
240
|
+
},
|
|
241
|
+
expanded: {
|
|
242
|
+
height: 'auto',
|
|
243
|
+
opacity: 1,
|
|
244
|
+
transition: { duration: durations.normal },
|
|
245
|
+
},
|
|
246
|
+
} as const;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Preset Animations
|
|
250
|
+
* Complete animation configurations ready to use
|
|
251
|
+
*/
|
|
252
|
+
export const presets = {
|
|
253
|
+
/**
|
|
254
|
+
* Fade in/out animation
|
|
255
|
+
*/
|
|
256
|
+
fade: {
|
|
257
|
+
initial: 'hidden',
|
|
258
|
+
animate: 'visible',
|
|
259
|
+
exit: 'exit',
|
|
260
|
+
variants: fadeVariants,
|
|
261
|
+
transition: transitions.default,
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Slide from bottom animation
|
|
266
|
+
*/
|
|
267
|
+
slideUp: {
|
|
268
|
+
initial: 'hidden',
|
|
269
|
+
animate: 'visible',
|
|
270
|
+
exit: 'exit',
|
|
271
|
+
variants: slideVariants.fromBottom,
|
|
272
|
+
transition: transitions.default,
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Scale animation
|
|
277
|
+
*/
|
|
278
|
+
scale: {
|
|
279
|
+
initial: 'hidden',
|
|
280
|
+
animate: 'visible',
|
|
281
|
+
exit: 'exit',
|
|
282
|
+
variants: scaleVariants.default,
|
|
283
|
+
transition: transitions.default,
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Modal animation (overlay + content)
|
|
288
|
+
*/
|
|
289
|
+
modal: {
|
|
290
|
+
overlay: {
|
|
291
|
+
initial: 'hidden',
|
|
292
|
+
animate: 'visible',
|
|
293
|
+
exit: 'exit',
|
|
294
|
+
variants: modalVariants.overlay,
|
|
295
|
+
transition: transitions.fast,
|
|
296
|
+
},
|
|
297
|
+
content: {
|
|
298
|
+
initial: 'hidden',
|
|
299
|
+
animate: 'visible',
|
|
300
|
+
exit: 'exit',
|
|
301
|
+
variants: modalVariants.content,
|
|
302
|
+
transition: transitions.default,
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* List stagger animation
|
|
308
|
+
*/
|
|
309
|
+
list: {
|
|
310
|
+
container: {
|
|
311
|
+
initial: 'hidden',
|
|
312
|
+
animate: 'visible',
|
|
313
|
+
variants: listVariants.container,
|
|
314
|
+
},
|
|
315
|
+
item: {
|
|
316
|
+
variants: listVariants.item,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
} as const;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Helper to create a custom animation preset
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```tsx
|
|
326
|
+
* const customFade = createAnimation({
|
|
327
|
+
* hidden: { opacity: 0, scale: 0.8 },
|
|
328
|
+
* visible: { opacity: 1, scale: 1 },
|
|
329
|
+
* }, transitions.bounce);
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
export function createAnimation(
|
|
333
|
+
variants: Variants,
|
|
334
|
+
transition: Transition = transitions.default
|
|
335
|
+
) {
|
|
336
|
+
return {
|
|
337
|
+
initial: 'hidden',
|
|
338
|
+
animate: 'visible',
|
|
339
|
+
exit: 'exit',
|
|
340
|
+
variants,
|
|
341
|
+
transition,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Helper to scale transition duration based on motion preference
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```tsx
|
|
350
|
+
* const { scale } = useMotionPreference();
|
|
351
|
+
* const duration = scaleDuration(durations.normal, scale);
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
export function scaleDuration(duration: number, scale: number): number {
|
|
355
|
+
return duration * (scale / 10);
|
|
356
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { BreadcrumbItemLegacy } from '../components/navigation/Breadcrumbs';
|
|
2
|
+
|
|
3
|
+
export interface RouteConfig {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
label: string;
|
|
6
|
+
children?: RouteConfig;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generates breadcrumb items from hash-based routing
|
|
12
|
+
*
|
|
13
|
+
* @param hash - Current window.location.hash (e.g., '#atoms/button')
|
|
14
|
+
* @param routeConfig - Configuration mapping routes to labels
|
|
15
|
+
* @param baseUrl - Base URL for href generation (default: '#')
|
|
16
|
+
* @returns Array of breadcrumb items with the last item having no href
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const routeConfig = {
|
|
21
|
+
* atoms: {
|
|
22
|
+
* label: 'Components',
|
|
23
|
+
* children: {
|
|
24
|
+
* button: { label: 'Button' }
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* // With hash: '#atoms/button'
|
|
30
|
+
* const breadcrumbs = generateBreadcrumbs('#atoms/button', routeConfig);
|
|
31
|
+
* // Returns: [
|
|
32
|
+
* // { label: 'Home', href: '#' },
|
|
33
|
+
* // { label: 'Components', href: '#atoms' },
|
|
34
|
+
* // { label: 'Button' } // No href for current page
|
|
35
|
+
* // ]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function generateBreadcrumbs(
|
|
39
|
+
hash: string,
|
|
40
|
+
routeConfig: RouteConfig,
|
|
41
|
+
baseUrl: string = '#'
|
|
42
|
+
): BreadcrumbItemLegacy[] {
|
|
43
|
+
// Remove '#' prefix and clean up
|
|
44
|
+
const cleanHash = hash.replace(/^#/, '').trim();
|
|
45
|
+
|
|
46
|
+
// If no hash, return just home
|
|
47
|
+
if (!cleanHash) {
|
|
48
|
+
return [{ label: 'Home', href: baseUrl }];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Split path into segments
|
|
52
|
+
const segments = cleanHash.split('/').filter(Boolean);
|
|
53
|
+
const breadcrumbs: BreadcrumbItemLegacy[] = [{ label: 'Home', href: baseUrl }];
|
|
54
|
+
|
|
55
|
+
let currentPath = '';
|
|
56
|
+
let currentConfig = routeConfig;
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < segments.length; i++) {
|
|
59
|
+
const segment = segments[i];
|
|
60
|
+
const isLast = i === segments.length - 1;
|
|
61
|
+
|
|
62
|
+
currentPath += (currentPath ? '/' : '') + segment;
|
|
63
|
+
|
|
64
|
+
// Look up label in config
|
|
65
|
+
const config = currentConfig[segment];
|
|
66
|
+
|
|
67
|
+
if (!config) {
|
|
68
|
+
// Fallback: convert kebab-case to Title Case
|
|
69
|
+
const label = segment
|
|
70
|
+
.split('-')
|
|
71
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
72
|
+
.join(' ');
|
|
73
|
+
|
|
74
|
+
breadcrumbs.push({
|
|
75
|
+
label,
|
|
76
|
+
// No href for the last item (current page)
|
|
77
|
+
href: isLast ? undefined : `${baseUrl}${currentPath}`,
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
breadcrumbs.push({
|
|
81
|
+
label: config.label,
|
|
82
|
+
// No href for the last item (current page)
|
|
83
|
+
href: isLast ? undefined : `${baseUrl}${currentPath}`,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Update config for next level of nesting
|
|
87
|
+
if (config.children) {
|
|
88
|
+
currentConfig = config.children;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return breadcrumbs;
|
|
94
|
+
}
|