@trinitydesign/design-system 1.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,167 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Trinity Design System will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.2.0] - 2026-01-12
9
+
10
+ ### Changed
11
+
12
+ #### Build Optimization (BREAKING)
13
+ - **Package size reduced from 169MB to 261KB** (99.85% reduction)
14
+ - Removed source maps from npm package
15
+ - Optimized chunk splitting into logical groups (ai, charts, data, forms, navigation)
16
+ - Externalized image assets from bundle
17
+
18
+ #### Dependency Restructuring
19
+ - Moved `@mui/icons-material` to peer dependencies (required)
20
+ - Moved `@mui/x-data-grid` to optional peer dependencies
21
+ - Moved `@mui/x-date-pickers` to optional peer dependencies
22
+ - Moved `dayjs` to optional peer dependencies
23
+ - Moved `recharts` to optional peer dependencies
24
+ - Moved `tailwindcss`, `@tailwindcss/vite` to dev dependencies
25
+
26
+ ### Removed
27
+
28
+ #### Breaking Changes
29
+ - **Asset exports removed**: `gradientIcons`, `backgroundImages`, `brandGradients` no longer exported from main package (80MB of images were bloating the bundle)
30
+ - **`@mui/x-date-pickers-pro`** removed (date range functionality now uses two standard `DatePicker` components)
31
+
32
+ ### Migration
33
+ See [MIGRATION.md](./MIGRATION.md) for detailed upgrade instructions.
34
+
35
+ ---
36
+
37
+ ## [1.1.0] - 2025-01-XX
38
+
39
+ ### Added
40
+
41
+ #### New Components (7)
42
+ - **TreeView** - Hierarchical tree component with expand/collapse, multi-select, checkboxes, search filtering, and drag-drop support. Full ARIA tree semantics with keyboard navigation (Arrow keys, Home, End, Enter, Space).
43
+ - **TransferList** - Dual-list selection component for transferring items between lists. Supports search, custom rendering, disabled items, and move-all controls.
44
+ - **Combobox** - Enhanced multi-select autocomplete with creatable options, grouping, icons, and custom rendering. Built on MUI Autocomplete.
45
+ - **SplitPane** - Resizable split panel layout with horizontal/vertical orientations, min/max constraints, and collapsible panels. Full ARIA separator with keyboard resize (Arrow keys, Shift+Arrow for large steps).
46
+ - **RichTextEditor** - WYSIWYG editor with customizable toolbar, formatting (bold, italic, lists, headings), alignment, links, images, and fullscreen mode.
47
+ - **DiffViewer** - Code/text diff viewer with side-by-side and unified view modes, syntax highlighting, line numbers, and word wrap.
48
+ - **DockLayout** - VS Code-style dockable panel layout with tabbed zones, split layouts, drag-and-drop panels, and panel actions.
49
+
50
+ #### Design Tokens
51
+ - **Spacing half-values** - Added `0.5`, `1.5`, `2.5` to spacing scale for fine-grained layout control
52
+ - **Animation easing tokens** - New reusable easing functions: `smooth`, `bounce`, `elastic`
53
+ - **Surface status colors** - Semantic surface colors for success/warning/error/info states
54
+ - **Brand variants** - 5 theme variants: `trinity`, `corporate`, `tech`, `nature`, `midnight`
55
+ - **Dark mode improvements** - Enhanced contrast ratios meeting WCAG AA+ (4.5:1+)
56
+
57
+ #### Storybook Documentation
58
+ - 74 new stories across 7 components with interactive controls
59
+ - All stories include `autodocs`, `argTypes`, and component descriptions
60
+ - Full coverage of variants, states, and edge cases
61
+
62
+ #### Documentation
63
+ - **COMPOSITION_PATTERNS.md** - 8 real-world layout patterns demonstrating component composition:
64
+ - Dashboard Layout, Data Explorer, Settings Panel, File Browser
65
+ - Command Center, Content Editor, Code Review Interface, Admin Console
66
+
67
+ ### Changed
68
+ - Improved accessibility for TreeView and SplitPane with full ARIA support
69
+ - Enhanced keyboard navigation across complex components
70
+
71
+ ## [Unreleased]
72
+
73
+ ### Changed (Phase 3.3 & 3.4 - Color Token Normalization)
74
+
75
+ - **Token Architecture Normalization** - Improved internal consistency without breaking changes
76
+ - AI component tokens (`aiHover`, `aiHoverDark`) now reference `baseTokens.colors.indigo` scale
77
+ - Charts sequential palette normalized to `baseTokens.colors.indigo[50-900]`
78
+ - Navigation components (`TopNavHeader`, `TopNavWithSidebar`) inline `#fff` → `brandColors.neutral.white`
79
+ - AI components (6 files) inline `#FFFFFF` → `brandColors.neutral.white`
80
+ - `IllustratedMessage` SVG colors centralized to `illustrationStatusColors` constant
81
+
82
+ - **Intentional Color Decisions Documented**
83
+ - Charts categorical palette: Intentionally uses full brand spectrum for data visualization distinction
84
+ - DataTable header grays: Tuned for dense tabular readability (NOT from gray scale)
85
+ - Status illustration colors: Tailwind-standard (red-500, amber-500, emerald-500) for universal recognition
86
+
87
+ ### Added
88
+ - **Accessibility Utilities** (`@trinity/design-system/accessibility`)
89
+ - `useFocusTrap` - Hook for trapping focus within modal dialogs
90
+ - `useReducedMotion` - Hook to detect user's reduced motion preference
91
+ - `useAriaLive` - Hook for managing ARIA live regions
92
+ - `useRovingTabIndex` - Hook for keyboard navigation in lists
93
+ - `SkipLink` - Component for skip-to-content functionality
94
+ - `VisuallyHidden` - Component for screen reader-only content
95
+
96
+ - **Enhanced TypeScript Support**
97
+ - Added `TrinityTokens` interface with full token structure
98
+ - Created `useTrinityTokens()` hook for consuming tokens
99
+ - Added CSS variable export via `generateCSSVariables()`
100
+ - New `tokens.ts` module with typed design tokens
101
+
102
+ - **Modular Component Architecture**
103
+ - Split `AI.tsx` into 9 focused modules under `components/AI/`
104
+ - Split `StatusIndicator.tsx` into 6 focused modules under `components/StatusIndicator/`
105
+ - Created shared navigation utilities under `components/navigation/`
106
+
107
+ - **Improved Package Exports**
108
+ - Added tree-shaking support with `sideEffects` configuration
109
+ - New subpath exports: `/theme`, `/tokens`, `/components`, `/accessibility`, `/navigation`
110
+ - Individual component exports: `/components/AI`, `/components/StatusIndicator`, `/components/Icon`
111
+
112
+ - **Testing Infrastructure**
113
+ - Added comprehensive tests for StatusIndicator components
114
+ - Added comprehensive tests for Icon component
115
+ - Added comprehensive tests for IllustratedMessage component
116
+ - Added tests for accessibility utilities
117
+
118
+ ### Changed
119
+ - Refactored navigation components to share common hooks and styled components
120
+ - Improved TypeScript strictness with proper type definitions
121
+ - Enhanced dark mode support with better accessible color combinations
122
+
123
+ ### Fixed
124
+ - Fixed `any` type usage in DataTable.stories.tsx
125
+ - Fixed `any` type usage in Icons.stories.tsx
126
+ - Fixed type errors in AI components (IconName, brandColors references)
127
+
128
+ ## [1.0.0] - 2024-01-XX
129
+
130
+ ### Added
131
+ - Initial release of Trinity Design System
132
+ - MUI v6/7-based component library
133
+ - Light and dark theme support
134
+ - Brand colors with accessible combinations
135
+ - Core components:
136
+ - `TopNavHeader` - Top navigation header component
137
+ - `TopNavWithSidebar` - Navigation with collapsible sidebar
138
+ - `Layout` - Page layout wrapper
139
+ - `Icon` - Icon wrapper with multiple library support
140
+ - `IllustratedMessage` - Empty states with illustrations
141
+ - `StatusIndicator` - Status display components
142
+ - `AI` - AI-specific UI components
143
+ - Storybook documentation with interactive examples
144
+ - WCAG 2.1 AA accessibility compliance
145
+ - Montserrat typography
146
+ - Custom MUI component overrides (buttons, switches, inputs)
147
+
148
+ ### Design Tokens
149
+ - Brand colors (Navy, Coral, Teal, White, Grays)
150
+ - Accessible color combinations
151
+ - Typography scale
152
+ - Spacing scale
153
+ - Border radius values
154
+ - Shadow definitions
155
+ - Breakpoints
156
+
157
+ ---
158
+
159
+ ## Migration Guides
160
+
161
+ For detailed migration instructions, see [MIGRATION.md](./MIGRATION.md).
162
+
163
+ ## Release Types
164
+
165
+ - **Major (X.0.0)**: Breaking changes requiring code updates
166
+ - **Minor (0.X.0)**: New features, backward compatible
167
+ - **Patch (0.0.X)**: Bug fixes, backward compatible
@@ -0,0 +1,394 @@
1
+ # Contributing to Trinity Design System
2
+
3
+ Thank you for your interest in contributing to the Trinity Design System! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Workflow](#development-workflow)
10
+ - [Component Guidelines](#component-guidelines)
11
+ - [Styling Guidelines](#styling-guidelines)
12
+ - [Accessibility Requirements](#accessibility-requirements)
13
+ - [Testing Requirements](#testing-requirements)
14
+ - [Documentation](#documentation)
15
+ - [Pull Request Process](#pull-request-process)
16
+
17
+ ## Code of Conduct
18
+
19
+ Please be respectful and constructive in all interactions. We are committed to providing a welcoming and inclusive environment for all contributors.
20
+
21
+ ## Getting Started
22
+
23
+ ### Prerequisites
24
+
25
+ - Node.js 18+
26
+ - npm 9+
27
+ - Git
28
+
29
+ ### Setup
30
+
31
+ 1. Clone the repository:
32
+ ```bash
33
+ git clone https://github.com/your-org/trinity-design-system.git
34
+ cd trinity-design-system
35
+ ```
36
+
37
+ 2. Install dependencies:
38
+ ```bash
39
+ npm install
40
+ ```
41
+
42
+ 3. Start the development server:
43
+ ```bash
44
+ npm run dev
45
+ ```
46
+
47
+ 4. Start Storybook:
48
+ ```bash
49
+ npm run storybook
50
+ ```
51
+
52
+ ## Development Workflow
53
+
54
+ ### Branch Naming
55
+
56
+ - `feature/` - New features
57
+ - `fix/` - Bug fixes
58
+ - `docs/` - Documentation updates
59
+ - `refactor/` - Code refactoring
60
+ - `test/` - Test additions or updates
61
+
62
+ Example: `feature/add-date-picker-component`
63
+
64
+ ### Commit Messages
65
+
66
+ Follow [Conventional Commits](https://www.conventionalcommits.org/):
67
+
68
+ ```
69
+ type(scope): description
70
+
71
+ [optional body]
72
+
73
+ [optional footer]
74
+ ```
75
+
76
+ Types:
77
+ - `feat`: New feature
78
+ - `fix`: Bug fix
79
+ - `docs`: Documentation only
80
+ - `style`: Formatting (no code change)
81
+ - `refactor`: Code refactoring
82
+ - `test`: Adding tests
83
+ - `chore`: Maintenance tasks
84
+
85
+ Examples:
86
+ ```
87
+ feat(Button): add loading state prop
88
+ fix(StatusIndicator): correct color contrast for warning state
89
+ docs(README): update installation instructions
90
+ ```
91
+
92
+ ## Component Guidelines
93
+
94
+ ### File Structure
95
+
96
+ New components should follow this structure:
97
+
98
+ ```
99
+ src/components/ComponentName/
100
+ ├── index.ts # Barrel exports
101
+ ├── ComponentName.tsx # Main component
102
+ ├── types.ts # TypeScript types/interfaces
103
+ ├── styles.ts # Styled components (if needed)
104
+ └── utils.ts # Helper functions (if needed)
105
+ ```
106
+
107
+ ### Component Template
108
+
109
+ ```tsx
110
+ import React from 'react';
111
+ import { Box, SxProps, Theme } from '@mui/material';
112
+
113
+ export interface MyComponentProps {
114
+ /** Description of the prop */
115
+ variant?: 'primary' | 'secondary';
116
+ /** Additional custom styles */
117
+ sx?: SxProps<Theme>;
118
+ /** Component content */
119
+ children?: React.ReactNode;
120
+ }
121
+
122
+ /**
123
+ * MyComponent - Brief description of what the component does.
124
+ *
125
+ * @example
126
+ * ```tsx
127
+ * <MyComponent variant="primary">Content</MyComponent>
128
+ * ```
129
+ */
130
+ export const MyComponent: React.FC<MyComponentProps> = ({
131
+ variant = 'primary',
132
+ sx,
133
+ children,
134
+ }) => {
135
+ return (
136
+ <Box
137
+ sx={{
138
+ // Component styles
139
+ ...sx,
140
+ }}
141
+ >
142
+ {children}
143
+ </Box>
144
+ );
145
+ };
146
+ ```
147
+
148
+ ### Export Components
149
+
150
+ Add exports to `src/components/index.ts`:
151
+
152
+ ```typescript
153
+ export * from './MyComponent';
154
+ ```
155
+
156
+ ## Styling Guidelines
157
+
158
+ ### Use Theme Tokens
159
+
160
+ Always use theme tokens from `src/theme.ts`:
161
+
162
+ ```tsx
163
+ // ✅ Good
164
+ <Box sx={{ color: 'primary.main', borderRadius: 2 }}>
165
+
166
+ // ❌ Avoid
167
+ <Box sx={{ color: '#003366', borderRadius: '16px' }}>
168
+ ```
169
+
170
+ ### Accessible Color Combinations
171
+
172
+ Use `accessibleCombinations` for text/background pairs:
173
+
174
+ ```tsx
175
+ import { accessibleCombinations } from '../theme';
176
+
177
+ <Box sx={{
178
+ backgroundColor: accessibleCombinations.whiteOnNavy.bg,
179
+ color: accessibleCombinations.whiteOnNavy.text,
180
+ }}>
181
+ ```
182
+
183
+ ### Trinity-Specific Patterns
184
+
185
+ - **Buttons**: Pill shape (`borderRadius: 100`), no elevation
186
+ - **Cards/Containers**: 16px border radius (light), 8px (dark)
187
+ - **Inputs**: 6px border radius for small inputs
188
+ - **Typography**: Montserrat font, no uppercase buttons
189
+
190
+ ## Accessibility Requirements
191
+
192
+ All components must meet **WCAG 2.1 AA** standards:
193
+
194
+ ### Minimum Requirements
195
+
196
+ 1. **Color Contrast**: 4.5:1 for normal text, 3:1 for large text
197
+ 2. **Keyboard Navigation**: All interactive elements must be keyboard accessible
198
+ 3. **Focus Indicators**: Visible focus states for all focusable elements
199
+ 4. **ARIA Labels**: Proper labels for screen readers
200
+ 5. **Reduced Motion**: Respect `prefers-reduced-motion` preference
201
+
202
+ ### Testing Accessibility
203
+
204
+ ```tsx
205
+ // Use accessibility utilities
206
+ import { useReducedMotion, VisuallyHidden } from '../accessibility';
207
+
208
+ const MyComponent = () => {
209
+ const prefersReducedMotion = useReducedMotion();
210
+
211
+ return (
212
+ <button>
213
+ <VisuallyHidden>Screen reader text</VisuallyHidden>
214
+ <Icon aria-hidden="true" />
215
+ </button>
216
+ );
217
+ };
218
+ ```
219
+
220
+ ### Storybook Accessibility Addon
221
+
222
+ Run accessibility audits in Storybook using the addon-a11y panel.
223
+
224
+ ## Testing Requirements
225
+
226
+ ### Test Structure
227
+
228
+ ```
229
+ src/
230
+ ├── components/
231
+ │ ├── __tests__/
232
+ │ │ └── MyComponent.test.tsx
233
+ │ └── MyComponent.tsx
234
+ ```
235
+
236
+ ### Running Tests
237
+
238
+ ```bash
239
+ # Run all tests
240
+ npm test
241
+
242
+ # Run tests with coverage
243
+ npm run test:coverage
244
+
245
+ # Run tests in watch mode
246
+ npm run test:watch
247
+ ```
248
+
249
+ ### Test Template
250
+
251
+ ```tsx
252
+ import { describe, it, expect, vi } from 'vitest';
253
+ import { render, screen, fireEvent } from '@testing-library/react';
254
+ import { MyComponent } from '../MyComponent';
255
+
256
+ describe('MyComponent', () => {
257
+ it('should render with default props', () => {
258
+ render(<MyComponent>Content</MyComponent>);
259
+ expect(screen.getByText('Content')).toBeInTheDocument();
260
+ });
261
+
262
+ it('should handle click events', () => {
263
+ const onClick = vi.fn();
264
+ render(<MyComponent onClick={onClick}>Click me</MyComponent>);
265
+
266
+ fireEvent.click(screen.getByText('Click me'));
267
+ expect(onClick).toHaveBeenCalled();
268
+ });
269
+
270
+ it('should apply custom styles', () => {
271
+ render(<MyComponent sx={{ color: 'red' }}>Styled</MyComponent>);
272
+ // Assert styles
273
+ });
274
+ });
275
+ ```
276
+
277
+ ### Coverage Requirements
278
+
279
+ - Minimum 80% code coverage for new components
280
+ - All public APIs must have tests
281
+ - Edge cases and error states should be tested
282
+
283
+ ## Documentation
284
+
285
+ ### Storybook Stories
286
+
287
+ Every component needs a Storybook story:
288
+
289
+ ```tsx
290
+ // src/stories/MyComponent.stories.tsx
291
+ import type { Meta, StoryObj } from '@storybook/react';
292
+ import { MyComponent } from '../components/MyComponent';
293
+
294
+ const meta: Meta<typeof MyComponent> = {
295
+ title: 'Components/MyComponent',
296
+ component: MyComponent,
297
+ tags: ['autodocs'],
298
+ argTypes: {
299
+ variant: {
300
+ control: 'select',
301
+ options: ['primary', 'secondary'],
302
+ description: 'Visual variant',
303
+ },
304
+ },
305
+ };
306
+
307
+ export default meta;
308
+ type Story = StoryObj<typeof meta>;
309
+
310
+ export const Default: Story = {
311
+ args: {
312
+ children: 'Default content',
313
+ },
314
+ };
315
+
316
+ export const Secondary: Story = {
317
+ args: {
318
+ variant: 'secondary',
319
+ children: 'Secondary variant',
320
+ },
321
+ };
322
+ ```
323
+
324
+ ### JSDoc Comments
325
+
326
+ All exported functions and components should have JSDoc comments:
327
+
328
+ ```tsx
329
+ /**
330
+ * Calculates the accessible color for a given background.
331
+ *
332
+ * @param backgroundColor - The background color in hex format
333
+ * @returns The appropriate text color for accessibility
334
+ *
335
+ * @example
336
+ * ```tsx
337
+ * const textColor = getAccessibleColor('#003366');
338
+ * // Returns '#ffffff'
339
+ * ```
340
+ */
341
+ export const getAccessibleColor = (backgroundColor: string): string => {
342
+ // Implementation
343
+ };
344
+ ```
345
+
346
+ ## Pull Request Process
347
+
348
+ ### Before Submitting
349
+
350
+ 1. ✅ Run `npm run lint` and fix any issues
351
+ 2. ✅ Run `npm test` and ensure all tests pass
352
+ 3. ✅ Run `npm run build` to verify build succeeds
353
+ 4. ✅ Update documentation if needed
354
+ 5. ✅ Add/update Storybook stories
355
+ 6. ✅ Update CHANGELOG.md with your changes
356
+
357
+ ### PR Template
358
+
359
+ ```markdown
360
+ ## Description
361
+ Brief description of the changes.
362
+
363
+ ## Type of Change
364
+ - [ ] Bug fix
365
+ - [ ] New feature
366
+ - [ ] Breaking change
367
+ - [ ] Documentation update
368
+
369
+ ## Checklist
370
+ - [ ] Tests added/updated
371
+ - [ ] Documentation updated
372
+ - [ ] Storybook stories added/updated
373
+ - [ ] CHANGELOG.md updated
374
+ - [ ] Accessibility requirements met
375
+ - [ ] Token compliance verified (`npm run lint:tokens`)
376
+ - [ ] Any `eslint-disable` for colors references [INTENTIONAL_EXCEPTIONS.md](docs/INTENTIONAL_EXCEPTIONS.md)
377
+
378
+ ## Screenshots (if applicable)
379
+ ```
380
+
381
+ ### Review Process
382
+
383
+ 1. Create PR against `main` branch
384
+ 2. Request review from team members
385
+ 3. Address feedback and update PR
386
+ 4. Squash and merge when approved
387
+
388
+ ## Questions?
389
+
390
+ If you have questions, feel free to:
391
+ - Open a GitHub issue
392
+ - Reach out to the design system team
393
+
394
+ Thank you for contributing! 🎉