@open-ai-school/ai-ui-library 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Open AI School
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ <div align="center">
2
+
3
+ # ๐ŸŽจ AI UI Library
4
+
5
+ **The shared design system for [Open AI School](https://open-ai-school.vercel.app)**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@open-ai-school/ai-ui-library?color=6366f1&label=npm)](https://www.npmjs.com/package/@open-ai-school/ai-ui-library)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
+ [![Storybook](https://img.shields.io/badge/Storybook-FF4785?logo=storybook&logoColor=white)](https://ui.open-ai-school.vercel.app)
11
+
12
+ A production-ready React component library built with TypeScript, Tailwind CSS, and Framer Motion. Designed as the single source of truth for UI across all Open AI School programs.
13
+
14
+ [**Live Storybook โ†’**](https://ui.open-ai-school.vercel.app) ยท [**npm โ†’**](https://www.npmjs.com/package/@open-ai-school/ai-ui-library) ยท [**Open AI School โ†’**](https://open-ai-school.vercel.app)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## โœจ Features
21
+
22
+ - ๐Ÿงฉ **Composable components** โ€” Button, Card, Badge, ThemeToggle, ScrollReveal, and more
23
+ - ๐ŸŽญ **Dark/light mode** โ€” Built-in ThemeProvider with system preference detection
24
+ - ๐ŸŽฌ **Smooth animations** โ€” Framer Motion integration in every interactive component
25
+ - ๐ŸŽจ **Design tokens** โ€” CSS custom properties for consistent theming
26
+ - ๐Ÿ“ฆ **Tree-shakeable** โ€” ESM + CJS dual output via tsup
27
+ - ๐Ÿ”’ **TypeScript strict** โ€” Full type safety with exported interfaces
28
+ - โ™ฟ **Accessible** โ€” Keyboard-navigable, ARIA-compliant
29
+ - ๐Ÿ“– **Storybook** โ€” Interactive component playground with docs
30
+
31
+ ## ๐Ÿ“ฆ Installation
32
+
33
+ ```bash
34
+ npm install @open-ai-school/ai-ui-library
35
+ ```
36
+
37
+ **Peer dependencies** (you likely already have these):
38
+
39
+ ```bash
40
+ npm install react react-dom next
41
+ ```
42
+
43
+ ## ๐Ÿš€ Quick Start
44
+
45
+ ```tsx
46
+ import { Button, Card, Badge, ThemeProvider, ThemeToggle } from "@open-ai-school/ai-ui-library";
47
+ import "@open-ai-school/ai-ui-library/styles.css";
48
+
49
+ export default function App() {
50
+ return (
51
+ <ThemeProvider>
52
+ <div className="p-8 space-y-6">
53
+ <ThemeToggle />
54
+
55
+ <Card variant="glass" hover>
56
+ <Badge variant="success">New</Badge>
57
+ <h2>Welcome to Open AI School</h2>
58
+ <Button variant="primary" size="lg">
59
+ Start Learning โ†’
60
+ </Button>
61
+ </Card>
62
+ </div>
63
+ </ThemeProvider>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ## ๐Ÿงฉ Components
69
+
70
+ ### `<Button />`
71
+
72
+ Animated button with multiple variants and sizes.
73
+
74
+ | Prop | Type | Default | Description |
75
+ | --------- | ------------------------------------------------------- | ----------- | --------------------- |
76
+ | `variant` | `"primary" \| "secondary" \| "ghost" \| "outline" \| "accent"` | `"primary"` | Visual style |
77
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size |
78
+ | `loading` | `boolean` | `false` | Shows spinner |
79
+
80
+ ### `<Card />`
81
+
82
+ Container with glassmorphism and hover effects.
83
+
84
+ | Prop | Type | Default | Description |
85
+ | --------- | --------------------------------------------------- | ----------- | ---------------------- |
86
+ | `variant` | `"default" \| "elevated" \| "glass" \| "outline"` | `"default"` | Visual style |
87
+ | `hover` | `boolean` | `false` | Enable hover animation |
88
+
89
+ ### `<Badge />`
90
+
91
+ Status indicator / label.
92
+
93
+ | Prop | Type | Default | Description |
94
+ | --------- | ----------------------------------------------------------- | ----------- | ------------------------ |
95
+ | `variant` | `"default" \| "success" \| "warning" \| "error" \| "info"` | `"default"` | Semantic color |
96
+ | `size` | `"sm" \| "md"` | `"sm"` | Size |
97
+ | `color` | `string` | โ€” | Custom hex color override|
98
+
99
+ ### `<ThemeProvider />` & `<ThemeToggle />`
100
+
101
+ Dark/light mode with system preference detection and localStorage persistence.
102
+
103
+ ### `<ScrollReveal />`
104
+
105
+ Intersection Observerโ€“powered entrance animations.
106
+
107
+ ### `<FloatingParticles />`
108
+
109
+ Ambient animated background particles.
110
+
111
+ ### `<CourseProgress />` & `<WelcomeBanner />`
112
+
113
+ Education-specific components for progress tracking and personalized greetings.
114
+
115
+ ## ๐ŸŽจ Design Tokens
116
+
117
+ Import the CSS to get the full token system:
118
+
119
+ ```css
120
+ @import "@open-ai-school/ai-ui-library/styles.css";
121
+ ```
122
+
123
+ ### Available tokens
124
+
125
+ | Token | Light | Dark |
126
+ | ----------------------- | -------------- | -------------- |
127
+ | `--color-primary` | `#6366f1` | `#818cf8` |
128
+ | `--color-accent` | `#f59e0b` | `#fbbf24` |
129
+ | `--color-bg` | `#f8fafc` | `#0f172a` |
130
+ | `--color-bg-card` | `#ffffff` | `#1e293b` |
131
+ | `--color-text` | `#0f172a` | `#f1f5f9` |
132
+ | `--color-text-muted` | `#64748b` | `#94a3b8` |
133
+ | `--color-border` | `#e2e8f0` | `#334155` |
134
+
135
+ See [`src/theme/tokens.css`](./src/theme/tokens.css) for the complete set.
136
+
137
+ ## ๐Ÿ—๏ธ Architecture
138
+
139
+ ```
140
+ ai-ui-library/
141
+ โ”œโ”€โ”€ src/
142
+ โ”‚ โ”œโ”€โ”€ components/ # React components
143
+ โ”‚ โ”‚ โ”œโ”€โ”€ Button.tsx
144
+ โ”‚ โ”‚ โ”œโ”€โ”€ Card.tsx
145
+ โ”‚ โ”‚ โ”œโ”€โ”€ Badge.tsx
146
+ โ”‚ โ”‚ โ”œโ”€โ”€ ThemeProvider.tsx
147
+ โ”‚ โ”‚ โ”œโ”€โ”€ ThemeToggle.tsx
148
+ โ”‚ โ”‚ โ”œโ”€โ”€ ScrollReveal.tsx
149
+ โ”‚ โ”‚ โ”œโ”€โ”€ FloatingParticles.tsx
150
+ โ”‚ โ”‚ โ”œโ”€โ”€ CourseProgress.tsx
151
+ โ”‚ โ”‚ โ””โ”€โ”€ WelcomeBanner.tsx
152
+ โ”‚ โ”œโ”€โ”€ hooks/ # Custom hooks
153
+ โ”‚ โ”‚ โ”œโ”€โ”€ useProgress.ts
154
+ โ”‚ โ”‚ โ””โ”€โ”€ useGuestProfile.ts
155
+ โ”‚ โ”œโ”€โ”€ theme/ # Design tokens
156
+ โ”‚ โ”‚ โ””โ”€โ”€ tokens.css
157
+ โ”‚ โ”œโ”€โ”€ utils/ # Shared utilities
158
+ โ”‚ โ””โ”€โ”€ index.ts # Public API (barrel export)
159
+ โ”œโ”€โ”€ .storybook/ # Storybook configuration
160
+ โ”œโ”€โ”€ tsup.config.ts # Build configuration
161
+ โ”œโ”€โ”€ tsconfig.json # TypeScript configuration
162
+ โ””โ”€โ”€ package.json
163
+ ```
164
+
165
+ ## ๐Ÿ› ๏ธ Development
166
+
167
+ ```bash
168
+ # Install dependencies
169
+ npm install
170
+
171
+ # Start Storybook dev server
172
+ npm run storybook
173
+
174
+ # Build the library
175
+ npm run build
176
+
177
+ # Watch mode (rebuild on changes)
178
+ npm run dev
179
+ ```
180
+
181
+ ## ๐ŸŒ Used By
182
+
183
+ This library powers every repo in the [Open AI School](https://github.com/open-ai-school) org:
184
+
185
+ | Repo | Description |
186
+ |------|-------------|
187
+ | [`platform`](https://github.com/open-ai-school/platform) | Main Next.js app shell |
188
+ | [`ai-seeds`](https://github.com/open-ai-school/ai-seeds) | ๐ŸŒฑ Level 1: Absolute beginners |
189
+ | `ai-sprouts` | ๐ŸŒฟ Level 2: Foundations (coming soon) |
190
+ | `ai-branches` | ๐ŸŒณ Level 3: Applied AI (coming soon) |
191
+ | `ai-canopy` | ๐Ÿ•๏ธ Level 4: Advanced (coming soon) |
192
+ | `ai-forest` | ๐ŸŒฒ Level 5: Expert (coming soon) |
193
+
194
+ ## ๐Ÿค Contributing
195
+
196
+ We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details.
197
+
198
+ 1. Fork the repo
199
+ 2. Create your feature branch: `git checkout -b feat/amazing-component`
200
+ 3. Add your component in `src/components/`
201
+ 4. Add a Storybook story
202
+ 5. Run `npm run build` to verify
203
+ 6. Submit a PR
204
+
205
+ ## ๐Ÿ“„ License
206
+
207
+ MIT ยฉ [Open AI School](https://github.com/open-ai-school)
@@ -0,0 +1,94 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, ButtonHTMLAttributes } from 'react';
4
+
5
+ type Theme = "light" | "dark" | "system";
6
+ declare function ThemeProvider({ children }: {
7
+ children: React.ReactNode;
8
+ }): react_jsx_runtime.JSX.Element;
9
+ declare const useTheme: () => {
10
+ theme: Theme;
11
+ resolvedTheme: "light" | "dark";
12
+ setTheme: (theme: Theme) => void;
13
+ };
14
+
15
+ declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
16
+
17
+ type Animation = "fade-up" | "fade-in" | "scale-in" | "slide-left" | "slide-right";
18
+ interface ScrollRevealProps {
19
+ children: ReactNode;
20
+ animation?: Animation;
21
+ delay?: number;
22
+ className?: string;
23
+ stagger?: boolean;
24
+ }
25
+ declare function ScrollReveal({ children, animation, delay, className, stagger, }: ScrollRevealProps): react_jsx_runtime.JSX.Element;
26
+
27
+ declare function FloatingParticles(): react_jsx_runtime.JSX.Element;
28
+
29
+ declare function CourseProgress({ totalLessons, basePath, programSlug, }: {
30
+ totalLessons: number;
31
+ basePath: string;
32
+ programSlug?: string;
33
+ }): react_jsx_runtime.JSX.Element | null;
34
+
35
+ declare function WelcomeBanner({ basePath }: {
36
+ basePath: string;
37
+ }): react_jsx_runtime.JSX.Element | null;
38
+
39
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
40
+ variant?: "primary" | "secondary" | "ghost" | "outline" | "accent";
41
+ size?: "sm" | "md" | "lg";
42
+ loading?: boolean;
43
+ }
44
+ declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
45
+
46
+ interface CardProps {
47
+ children: ReactNode;
48
+ variant?: "default" | "elevated" | "glass" | "outline";
49
+ hover?: boolean;
50
+ className?: string;
51
+ onClick?: () => void;
52
+ }
53
+ declare function Card({ children, variant, hover, className, onClick, }: CardProps): react_jsx_runtime.JSX.Element;
54
+
55
+ interface BadgeProps {
56
+ children: ReactNode;
57
+ variant?: "default" | "success" | "warning" | "error" | "info";
58
+ size?: "sm" | "md";
59
+ color?: string;
60
+ className?: string;
61
+ }
62
+ declare function Badge({ children, variant, size, color, className, }: BadgeProps): react_jsx_runtime.JSX.Element;
63
+
64
+ interface ProgramProgress {
65
+ completed: string[];
66
+ timestamps: Record<string, string>;
67
+ }
68
+ type ProgressData = Record<string, ProgramProgress>;
69
+ declare function useProgress(programSlug?: string): {
70
+ completed: string[];
71
+ completedCount: number;
72
+ totalCompleted: number;
73
+ markComplete: (lessonKey: string) => void;
74
+ isCompleted: (lessonKey: string) => boolean;
75
+ getCompletedAt: (lessonKey: string) => string | null;
76
+ getProgram: (slug: string) => ProgramProgress;
77
+ allData: ProgressData;
78
+ reset: () => void;
79
+ };
80
+
81
+ interface GuestProfile {
82
+ name: string;
83
+ avatar: string;
84
+ joinedAt: string;
85
+ }
86
+ interface GuestProfileContextValue {
87
+ profile: GuestProfile | null;
88
+ saveProfile: (name: string) => void;
89
+ clearProfile: () => void;
90
+ isSignedIn: boolean;
91
+ }
92
+ declare function useGuestProfile(): GuestProfileContextValue;
93
+
94
+ export { Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, CourseProgress, FloatingParticles, ScrollReveal, ThemeProvider, ThemeToggle, WelcomeBanner, useGuestProfile, useProgress, useTheme };
@@ -0,0 +1,94 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, ButtonHTMLAttributes } from 'react';
4
+
5
+ type Theme = "light" | "dark" | "system";
6
+ declare function ThemeProvider({ children }: {
7
+ children: React.ReactNode;
8
+ }): react_jsx_runtime.JSX.Element;
9
+ declare const useTheme: () => {
10
+ theme: Theme;
11
+ resolvedTheme: "light" | "dark";
12
+ setTheme: (theme: Theme) => void;
13
+ };
14
+
15
+ declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
16
+
17
+ type Animation = "fade-up" | "fade-in" | "scale-in" | "slide-left" | "slide-right";
18
+ interface ScrollRevealProps {
19
+ children: ReactNode;
20
+ animation?: Animation;
21
+ delay?: number;
22
+ className?: string;
23
+ stagger?: boolean;
24
+ }
25
+ declare function ScrollReveal({ children, animation, delay, className, stagger, }: ScrollRevealProps): react_jsx_runtime.JSX.Element;
26
+
27
+ declare function FloatingParticles(): react_jsx_runtime.JSX.Element;
28
+
29
+ declare function CourseProgress({ totalLessons, basePath, programSlug, }: {
30
+ totalLessons: number;
31
+ basePath: string;
32
+ programSlug?: string;
33
+ }): react_jsx_runtime.JSX.Element | null;
34
+
35
+ declare function WelcomeBanner({ basePath }: {
36
+ basePath: string;
37
+ }): react_jsx_runtime.JSX.Element | null;
38
+
39
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
40
+ variant?: "primary" | "secondary" | "ghost" | "outline" | "accent";
41
+ size?: "sm" | "md" | "lg";
42
+ loading?: boolean;
43
+ }
44
+ declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
45
+
46
+ interface CardProps {
47
+ children: ReactNode;
48
+ variant?: "default" | "elevated" | "glass" | "outline";
49
+ hover?: boolean;
50
+ className?: string;
51
+ onClick?: () => void;
52
+ }
53
+ declare function Card({ children, variant, hover, className, onClick, }: CardProps): react_jsx_runtime.JSX.Element;
54
+
55
+ interface BadgeProps {
56
+ children: ReactNode;
57
+ variant?: "default" | "success" | "warning" | "error" | "info";
58
+ size?: "sm" | "md";
59
+ color?: string;
60
+ className?: string;
61
+ }
62
+ declare function Badge({ children, variant, size, color, className, }: BadgeProps): react_jsx_runtime.JSX.Element;
63
+
64
+ interface ProgramProgress {
65
+ completed: string[];
66
+ timestamps: Record<string, string>;
67
+ }
68
+ type ProgressData = Record<string, ProgramProgress>;
69
+ declare function useProgress(programSlug?: string): {
70
+ completed: string[];
71
+ completedCount: number;
72
+ totalCompleted: number;
73
+ markComplete: (lessonKey: string) => void;
74
+ isCompleted: (lessonKey: string) => boolean;
75
+ getCompletedAt: (lessonKey: string) => string | null;
76
+ getProgram: (slug: string) => ProgramProgress;
77
+ allData: ProgressData;
78
+ reset: () => void;
79
+ };
80
+
81
+ interface GuestProfile {
82
+ name: string;
83
+ avatar: string;
84
+ joinedAt: string;
85
+ }
86
+ interface GuestProfileContextValue {
87
+ profile: GuestProfile | null;
88
+ saveProfile: (name: string) => void;
89
+ clearProfile: () => void;
90
+ isSignedIn: boolean;
91
+ }
92
+ declare function useGuestProfile(): GuestProfileContextValue;
93
+
94
+ export { Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, CourseProgress, FloatingParticles, ScrollReveal, ThemeProvider, ThemeToggle, WelcomeBanner, useGuestProfile, useProgress, useTheme };