aibos-design-system 1.0.0 → 1.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.
@@ -0,0 +1,130 @@
1
+ # AIBOS Design System - React Components
2
+
3
+ React components for AIBOS Design System, optimized for Next.js integration.
4
+
5
+ ## Installation
6
+
7
+ The React components are included in the `aibos-design-system` package. No additional installation needed.
8
+
9
+ ## Usage
10
+
11
+ ### StatusIndicator
12
+
13
+ The `StatusIndicator` component provides accessible status indicators using AIBOS CSS classes.
14
+
15
+ ```tsx
16
+ import { StatusIndicator } from 'aibos-design-system/react';
17
+
18
+ // Success status
19
+ <StatusIndicator variant="success" label="Complete" />
20
+
21
+ // Error status
22
+ <StatusIndicator variant="error" label="Failed" />
23
+
24
+ // Warning status
25
+ <StatusIndicator variant="warning" label="Attention Required" />
26
+
27
+ // Pending status
28
+ <StatusIndicator variant="pending" label="In Progress" />
29
+ ```
30
+
31
+ ### With Custom Classes
32
+
33
+ ```tsx
34
+ <StatusIndicator
35
+ variant="success"
36
+ label="Approved"
37
+ className="ml-4"
38
+ />
39
+ ```
40
+
41
+ ### In Cards/Tables
42
+
43
+ ```tsx
44
+ import { Card, CardBody } from '@nextui-org/react';
45
+ import { StatusIndicator } from 'aibos-design-system/react';
46
+
47
+ <Card>
48
+ <CardBody>
49
+ <div className="flex items-center gap-4">
50
+ <span>Invoice #12345</span>
51
+ <StatusIndicator variant="pending" label="Under Review" />
52
+ </div>
53
+ </CardBody>
54
+ </Card>
55
+ ```
56
+
57
+ ## API Reference
58
+
59
+ ### StatusIndicator Props
60
+
61
+ | Prop | Type | Required | Default | Description |
62
+ |------|------|----------|---------|-------------|
63
+ | `variant` | `'success' \| 'error' \| 'warning' \| 'pending'` | Yes | - | Status variant |
64
+ | `label` | `string` | Yes | - | Status label text |
65
+ | `className` | `string` | No | - | Custom CSS classes |
66
+ | `size` | `'small' \| 'default' \| 'large'` | No | `'default'` | Size variant |
67
+ | `showDot` | `boolean` | No | `true` | Show dot indicator |
68
+ | `aria-live` | `'polite' \| 'assertive' \| 'off'` | No | `'polite'` | ARIA live region |
69
+
70
+ ## Variant Mapping
71
+
72
+ | React Variant | AIBOS CSS Class | Color | Usage |
73
+ |---------------|----------------|-------|-------|
74
+ | `success` | `ok` | Green (#10b981) | Complete, approved, ready |
75
+ | `error` | `bad` | Red (#f43f5e) | Error, declined, failed |
76
+ | `warning` | `warn` | Yellow (#f59e0b) | Requires attention |
77
+ | `pending` | `pending` | Yellow (#f59e0b) | In progress, under review |
78
+
79
+ ## Accessibility
80
+
81
+ The `StatusIndicator` component includes:
82
+ - `role="status"` - Indicates live region for status updates
83
+ - `aria-label` - Descriptive label for screen readers
84
+ - `aria-live` - Optional, for dynamic status updates (default: 'polite')
85
+
86
+ ## TypeScript Support
87
+
88
+ Full TypeScript support is included:
89
+
90
+ ```tsx
91
+ import { StatusIndicator, type StatusIndicatorProps, type StatusVariant } from 'aibos-design-system/react';
92
+
93
+ const variant: StatusVariant = 'success';
94
+ const props: StatusIndicatorProps = {
95
+ variant: 'success',
96
+ label: 'Complete',
97
+ };
98
+ ```
99
+
100
+ ## Utilities
101
+
102
+ ### cn() - Class Name Merger
103
+
104
+ ```tsx
105
+ import { cn } from 'aibos-design-system/utils';
106
+
107
+ const classes = cn('na-status', 'ok', isActive && 'active');
108
+ // => 'na-status ok active'
109
+ ```
110
+
111
+ ## Next.js Integration
112
+
113
+ See [NEXTJS_DESIGN_SYSTEM_IMPROVEMENTS.md](../NEXTJS_DESIGN_SYSTEM_IMPROVEMENTS.md) for complete Next.js integration guide.
114
+
115
+ ## Design Tokens
116
+
117
+ ```tsx
118
+ import { designTokens } from 'aibos-design-system/design-tokens';
119
+
120
+ const successColor = designTokens.colors.success; // 'var(--color-success)'
121
+ const spacing = designTokens.spacing.md; // 'var(--spacing-4)'
122
+ const h1Class = designTokens.typography.h1.class; // 'na-h1'
123
+ ```
124
+
125
+ ## Type Definitions
126
+
127
+ ```tsx
128
+ import type { AIBOSStatusVariant, AIBOSTypographyClass } from 'aibos-design-system/types';
129
+ ```
130
+
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Button Component
3
+ *
4
+ * AIBOS-enhanced NextUI Button component
5
+ * Combines NextUI Button with AIBOS design system classes
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <Button variant="primary">Click me</Button>
10
+ * <Button variant="secondary">Cancel</Button>
11
+ * ```
12
+ */
13
+
14
+ import React from 'react';
15
+ import { Button as NextUIButton, ButtonProps as NextUIButtonProps } from '@nextui-org/react';
16
+ import { cn } from '../utils.js';
17
+
18
+ export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
19
+
20
+ export interface ButtonProps extends Omit<NextUIButtonProps, 'className' | 'variant'> {
21
+ /**
22
+ * Custom className - will be merged with AIBOS classes
23
+ */
24
+ className?: string;
25
+
26
+ /**
27
+ * Button variant
28
+ * Maps to AIBOS button classes
29
+ */
30
+ variant?: ButtonVariant;
31
+
32
+ /**
33
+ * Apply AIBOS button styling
34
+ * Default: true
35
+ */
36
+ withAIBOSStyles?: boolean;
37
+ }
38
+
39
+ /**
40
+ * Maps Button variant to AIBOS classes
41
+ */
42
+ const variantClassMap: Record<ButtonVariant, string> = {
43
+ primary: 'na-btn-primary',
44
+ secondary: 'na-btn-secondary',
45
+ ghost: 'na-btn-ghost',
46
+ danger: 'na-btn-danger',
47
+ } as const;
48
+
49
+ /**
50
+ * Button Component
51
+ *
52
+ * Enhanced NextUI Button with AIBOS design system integration.
53
+ * Automatically applies AIBOS button classes for consistent styling.
54
+ */
55
+ export function Button({
56
+ className,
57
+ variant = 'primary',
58
+ withAIBOSStyles = true,
59
+ color,
60
+ ...props
61
+ }: ButtonProps): JSX.Element {
62
+ // Map AIBOS variant to NextUI color if not provided
63
+ const nextUIColor = color || (variant === 'primary' ? 'primary' :
64
+ variant === 'danger' ? 'danger' :
65
+ variant === 'secondary' ? 'secondary' : 'default');
66
+
67
+ const classes = cn(
68
+ withAIBOSStyles && variantClassMap[variant],
69
+ className
70
+ );
71
+
72
+ return (
73
+ <NextUIButton
74
+ className={classes}
75
+ color={nextUIColor}
76
+ {...props}
77
+ />
78
+ );
79
+ }
80
+
81
+ export default Button;
82
+
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Card Component
3
+ *
4
+ * AIBOS-enhanced NextUI Card component
5
+ * Combines NextUI Card with AIBOS design system classes
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <Card>
10
+ * <CardHeader>
11
+ * <h2 className="na-h4">Card Title</h2>
12
+ * </CardHeader>
13
+ * <CardBody>
14
+ * <div className="na-data">$12,450.00</div>
15
+ * </CardBody>
16
+ * </Card>
17
+ * ```
18
+ */
19
+
20
+ import React from 'react';
21
+ import { Card as NextUICard, CardProps as NextUICardProps, CardHeader, CardBody, CardFooter } from '@nextui-org/react';
22
+ import { cn } from '../utils.js';
23
+
24
+ export interface CardProps extends Omit<NextUICardProps, 'className'> {
25
+ /**
26
+ * Custom className - will be merged with AIBOS classes
27
+ */
28
+ className?: string;
29
+
30
+ /**
31
+ * Apply AIBOS card padding (na-p-6)
32
+ * Default: true
33
+ */
34
+ withPadding?: boolean;
35
+
36
+ /**
37
+ * Apply AIBOS card styling
38
+ * Default: true
39
+ */
40
+ withAIBOSStyles?: boolean;
41
+ }
42
+
43
+ /**
44
+ * Card Component
45
+ *
46
+ * Enhanced NextUI Card with AIBOS design system integration.
47
+ * Automatically applies AIBOS card classes for consistent styling.
48
+ */
49
+ export function Card({
50
+ className,
51
+ withPadding = true,
52
+ withAIBOSStyles = true,
53
+ ...props
54
+ }: CardProps): JSX.Element {
55
+ const classes = cn(
56
+ withAIBOSStyles && 'na-card',
57
+ withPadding && 'na-p-6',
58
+ className
59
+ );
60
+
61
+ return (
62
+ <NextUICard
63
+ className={classes}
64
+ {...props}
65
+ />
66
+ );
67
+ }
68
+
69
+ // Re-export NextUI Card sub-components for convenience
70
+ export { CardHeader, CardBody, CardFooter };
71
+
72
+ export default Card;
73
+
@@ -0,0 +1,324 @@
1
+ # AIBOS Design System - React Components for NextUI/HeroUI
2
+
3
+ Complete React component library for seamless NextUI/HeroUI integration with AIBOS Design System.
4
+
5
+ ---
6
+
7
+ ## Components
8
+
9
+ ### StatusIndicator
10
+
11
+ Accessible status indicators with AIBOS styling.
12
+
13
+ ```tsx
14
+ import { StatusIndicator } from 'aibos-design-system/react';
15
+
16
+ <StatusIndicator variant="success" label="Complete" />
17
+ <StatusIndicator variant="error" label="Failed" />
18
+ <StatusIndicator variant="warning" label="Attention Required" />
19
+ <StatusIndicator variant="pending" label="In Progress" />
20
+ ```
21
+
22
+ ### Card
23
+
24
+ Enhanced NextUI Card with AIBOS styling.
25
+
26
+ ```tsx
27
+ import { Card, CardHeader, CardBody } from 'aibos-design-system/react';
28
+
29
+ <Card>
30
+ <CardHeader>
31
+ <h2 className="na-h4">Card Title</h2>
32
+ </CardHeader>
33
+ <CardBody>
34
+ <div className="na-data">$12,450.00</div>
35
+ <div className="na-metadata">PO-88219 • Feed Supply</div>
36
+ </CardBody>
37
+ </Card>
38
+ ```
39
+
40
+ **Props:**
41
+ - `withPadding` (default: `true`) - Apply AIBOS padding (`na-p-6`)
42
+ - `withAIBOSStyles` (default: `true`) - Apply AIBOS card styling (`na-card`)
43
+
44
+ ### Button
45
+
46
+ Enhanced NextUI Button with AIBOS styling.
47
+
48
+ ```tsx
49
+ import { Button } from 'aibos-design-system/react';
50
+
51
+ <Button variant="primary">Click me</Button>
52
+ <Button variant="secondary">Cancel</Button>
53
+ <Button variant="danger">Delete</Button>
54
+ <Button variant="ghost">Skip</Button>
55
+ ```
56
+
57
+ **Props:**
58
+ - `variant` - `'primary' | 'secondary' | 'ghost' | 'danger'`
59
+ - `withAIBOSStyles` (default: `true`) - Apply AIBOS button styling
60
+
61
+ ---
62
+
63
+ ## Integration Helpers
64
+
65
+ ### withAIBOS()
66
+
67
+ Combine AIBOS classes with NextUI components.
68
+
69
+ ```tsx
70
+ import { withAIBOS } from 'aibos-design-system/react';
71
+ import { Card } from '@nextui-org/react';
72
+
73
+ <Card className={withAIBOS('na-card', 'na-p-6', customClass)}>
74
+ Content
75
+ </Card>
76
+ ```
77
+
78
+ ### aibosTypography()
79
+
80
+ Get AIBOS typography classes.
81
+
82
+ ```tsx
83
+ import { aibosTypography } from 'aibos-design-system/react';
84
+
85
+ <h1 className={aibosTypography('h1')}>Title</h1>
86
+ <div className={aibosTypography('data')}>$12,450.00</div>
87
+ <div className={aibosTypography('metadata')}>Label</div>
88
+ ```
89
+
90
+ ### aibosSpacing()
91
+
92
+ Get AIBOS spacing classes.
93
+
94
+ ```tsx
95
+ import { aibosSpacing } from 'aibos-design-system/react';
96
+
97
+ <div className={aibosSpacing('p-6', 'mt-4')}>Content</div>
98
+ ```
99
+
100
+ ### withAIBOSClasses()
101
+
102
+ HOC to add AIBOS classes to any component.
103
+
104
+ ```tsx
105
+ import { withAIBOSClasses } from 'aibos-design-system/react';
106
+ import { Card as NextUICard } from '@nextui-org/react';
107
+
108
+ const AIBOSCard = withAIBOSClasses(NextUICard, 'na-card', 'na-p-6');
109
+
110
+ <AIBOSCard>
111
+ Content
112
+ </AIBOSCard>
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Complete Examples
118
+
119
+ ### Data Dashboard Card
120
+
121
+ ```tsx
122
+ import { Card, CardHeader, CardBody, Button, StatusIndicator } from 'aibos-design-system/react';
123
+
124
+ export function VendorCard({ vendor }) {
125
+ return (
126
+ <Card>
127
+ <CardHeader>
128
+ <h2 className="na-h4">{vendor.name}</h2>
129
+ </CardHeader>
130
+ <CardBody>
131
+ <div className="na-data">${vendor.amount.toLocaleString()}</div>
132
+ <div className="na-metadata">{vendor.id} • {vendor.type}</div>
133
+ <div className="flex items-center gap-4 mt-4">
134
+ <StatusIndicator variant={vendor.status === 'approved' ? 'success' : 'pending'} label={vendor.status} />
135
+ <Button variant="primary">View Details</Button>
136
+ </div>
137
+ </CardBody>
138
+ </Card>
139
+ );
140
+ }
141
+ ```
142
+
143
+ ### Form with AIBOS Styling
144
+
145
+ ```tsx
146
+ import { Card, CardBody, Button } from 'aibos-design-system/react';
147
+ import { Input } from '@nextui-org/react';
148
+
149
+ export function VendorForm() {
150
+ return (
151
+ <Card>
152
+ <CardBody>
153
+ <h2 className="na-h4 mb-4">Create Vendor</h2>
154
+ <Input
155
+ label="Vendor Name"
156
+ className="mb-4"
157
+ />
158
+ <Input
159
+ label="Amount"
160
+ type="number"
161
+ className="mb-4"
162
+ />
163
+ <div className="flex gap-4">
164
+ <Button variant="primary">Submit</Button>
165
+ <Button variant="secondary">Cancel</Button>
166
+ </div>
167
+ </CardBody>
168
+ </Card>
169
+ );
170
+ }
171
+ ```
172
+
173
+ ### Table with Status Indicators
174
+
175
+ ```tsx
176
+ import { StatusIndicator } from 'aibos-design-system/react';
177
+ import { Table, TableHeader, TableColumn, TableBody, TableRow, TableCell } from '@nextui-org/react';
178
+
179
+ export function VendorTable({ vendors }) {
180
+ return (
181
+ <Table>
182
+ <TableHeader>
183
+ <TableColumn>Name</TableColumn>
184
+ <TableColumn>Amount</TableColumn>
185
+ <TableColumn>Status</TableColumn>
186
+ </TableHeader>
187
+ <TableBody>
188
+ {vendors.map((vendor) => (
189
+ <TableRow key={vendor.id}>
190
+ <TableCell className="na-h4">{vendor.name}</TableCell>
191
+ <TableCell className="na-data">${vendor.amount}</TableCell>
192
+ <TableCell>
193
+ <StatusIndicator
194
+ variant={vendor.status === 'approved' ? 'success' : 'pending'}
195
+ label={vendor.status}
196
+ />
197
+ </TableCell>
198
+ </TableRow>
199
+ ))}
200
+ </TableBody>
201
+ </Table>
202
+ );
203
+ }
204
+ ```
205
+
206
+ ---
207
+
208
+ ## TypeScript Support
209
+
210
+ Full TypeScript support with exported types:
211
+
212
+ ```tsx
213
+ import type {
214
+ StatusIndicatorProps,
215
+ StatusVariant,
216
+ CardProps,
217
+ ButtonProps,
218
+ ButtonVariant,
219
+ } from 'aibos-design-system/react';
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Best Practices
225
+
226
+ ### 1. Use AIBOS Components for Consistency
227
+
228
+ ✅ **Good:**
229
+ ```tsx
230
+ import { Card, CardBody } from 'aibos-design-system/react';
231
+ <Card><CardBody>Content</CardBody></Card>
232
+ ```
233
+
234
+ ❌ **Avoid:**
235
+ ```tsx
236
+ import { Card } from '@nextui-org/react';
237
+ <Card className="na-card na-p-6">Content</Card>
238
+ ```
239
+
240
+ ### 2. Combine AIBOS Typography with NextUI Components
241
+
242
+ ✅ **Good:**
243
+ ```tsx
244
+ <Card>
245
+ <CardHeader>
246
+ <h2 className="na-h4">Title</h2>
247
+ </CardHeader>
248
+ <CardBody>
249
+ <div className="na-data">$12,450.00</div>
250
+ </CardBody>
251
+ </Card>
252
+ ```
253
+
254
+ ### 3. Use StatusIndicator for Status Display
255
+
256
+ ✅ **Good:**
257
+ ```tsx
258
+ <StatusIndicator variant="success" label="Approved" />
259
+ ```
260
+
261
+ ❌ **Avoid:**
262
+ ```tsx
263
+ <span className="na-status ok">Approved</span>
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Peer Dependencies
269
+
270
+ These components require NextUI to be installed:
271
+
272
+ ```bash
273
+ pnpm add @nextui-org/react framer-motion
274
+ ```
275
+
276
+ React is a peer dependency (optional, but required for React components):
277
+
278
+ ```bash
279
+ pnpm add react react-dom
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Migration from Direct NextUI Usage
285
+
286
+ ### Before (Direct NextUI)
287
+
288
+ ```tsx
289
+ import { Card, CardBody, Button } from '@nextui-org/react';
290
+
291
+ <Card className="na-card na-p-6">
292
+ <CardBody>
293
+ <Button className="na-btn-primary">Click</Button>
294
+ </CardBody>
295
+ </Card>
296
+ ```
297
+
298
+ ### After (AIBOS Components)
299
+
300
+ ```tsx
301
+ import { Card, CardBody, Button } from 'aibos-design-system/react';
302
+
303
+ <Card>
304
+ <CardBody>
305
+ <Button variant="primary">Click</Button>
306
+ </CardBody>
307
+ </Card>
308
+ ```
309
+
310
+ **Benefits:**
311
+ - ✅ Cleaner code (no manual class application)
312
+ - ✅ Consistent styling
313
+ - ✅ Type-safe props
314
+ - ✅ Better maintainability
315
+
316
+ ---
317
+
318
+ ## See Also
319
+
320
+ - [Main Components README](../README.md)
321
+ - [Design Tokens Documentation](../../types/design-tokens.ts)
322
+ - [Type Definitions](../../types/aibos-classes.ts)
323
+ - [NextUI Integration Guide](../../docs/INTEGRATION_GUIDE.md)
324
+
@@ -0,0 +1,101 @@
1
+ /**
2
+ * StatusIndicator Component
3
+ *
4
+ * AIBOS Design System Status Indicator with NextUI integration
5
+ * Provides accessible status indicators using AIBOS CSS classes
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <StatusIndicator variant="success" label="Complete" />
10
+ * <StatusIndicator variant="error" label="Failed" />
11
+ * ```
12
+ */
13
+
14
+ import React from 'react';
15
+ import { cn } from '../utils.js';
16
+
17
+ export type StatusVariant = 'success' | 'error' | 'warning' | 'pending';
18
+
19
+ export interface StatusIndicatorProps extends React.HTMLAttributes<HTMLSpanElement> {
20
+ /**
21
+ * Status variant
22
+ * Maps to AIBOS CSS classes: ok, bad, warn, pending
23
+ */
24
+ variant: StatusVariant;
25
+
26
+ /**
27
+ * Status label text
28
+ * Required - AIBOS guidelines require text labels with icons
29
+ */
30
+ label: string;
31
+
32
+ /**
33
+ * Optional size variant
34
+ * Default: 'default'
35
+ */
36
+ size?: 'small' | 'default' | 'large';
37
+
38
+ /**
39
+ * Optional icon override
40
+ * Default: true (uses AIBOS ::before pseudo-element dot)
41
+ */
42
+ showDot?: boolean;
43
+
44
+ /**
45
+ * Optional aria-live attribute for dynamic updates
46
+ * Default: 'polite'
47
+ */
48
+ 'aria-live'?: 'polite' | 'assertive' | 'off';
49
+ }
50
+
51
+ /**
52
+ * Maps React variant prop to AIBOS CSS class
53
+ */
54
+ const variantClassMap: Record<StatusVariant, string> = {
55
+ success: 'ok',
56
+ error: 'bad',
57
+ warning: 'warn',
58
+ pending: 'pending',
59
+ } as const;
60
+
61
+ /**
62
+ * StatusIndicator Component
63
+ *
64
+ * Renders an accessible status indicator using AIBOS design system classes.
65
+ * Uses space-separated modifier classes (e.g., "na-status ok") as per AIBOS guidelines.
66
+ */
67
+ export function StatusIndicator({
68
+ variant,
69
+ label,
70
+ className,
71
+ size = 'default',
72
+ showDot = true,
73
+ 'aria-live': ariaLive = 'polite',
74
+ ...props
75
+ }: StatusIndicatorProps): JSX.Element {
76
+ // Map variant to AIBOS CSS class
77
+ const variantClass = variantClassMap[variant];
78
+
79
+ // Build className string with space-separated classes
80
+ const classes = cn(
81
+ 'na-status', // Base AIBOS class
82
+ variantClass, // Variant class (ok, bad, warn, pending) - space-separated
83
+ size !== 'default' && `na-status-${size}`, // Optional size modifier
84
+ className // Custom classes
85
+ );
86
+
87
+ return (
88
+ <span
89
+ className={classes}
90
+ role="status"
91
+ aria-label={`Status: ${label}`}
92
+ aria-live={ariaLive}
93
+ {...props}
94
+ >
95
+ {label}
96
+ </span>
97
+ );
98
+ }
99
+
100
+ export default StatusIndicator;
101
+