Skip to content

Commit 7044994

Browse files
authored
Merge pull request #13 from schubergphilis/bugfix/packages
fix: update packages
2 parents 235bcfd + da3a765 commit 7044994

14 files changed

Lines changed: 1978 additions & 1832 deletions

File tree

CLAUDE.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a React component library (`@schubergphilis/sbp-frontend-style`) built with TypeScript and styled-components. It provides a complete set of themed, accessible UI components following atomic design principles. The library supports light/dark modes and responsive scaling.
8+
9+
**Published to**: GitHub Package Registry (`npm.pkg.github.com`)
10+
11+
## Commands
12+
13+
### Development
14+
```bash
15+
pnpm dev # Start Vite dev server on port 3005 with component showcase
16+
```
17+
18+
### Building
19+
```bash
20+
pnpm build # Clean dist/ and build library with Rollup (ESM + CJS bundles)
21+
pnpm clean # Remove dist/ folder
22+
```
23+
24+
### Testing
25+
```bash
26+
pnpm test # Run all tests with coverage (Jest)
27+
pnpm test:debug # Run tests in debug mode with watch and detailed output
28+
pnpm test:focus # Run a specific test file (modify script to target different file)
29+
pnpm test:clear # Clear Jest cache
30+
pnpm coverage # Open coverage report in Chrome
31+
```
32+
33+
### Code Quality
34+
```bash
35+
pnpm lint # ESLint check with TypeScript support
36+
```
37+
38+
### Releasing
39+
```bash
40+
pnpm release # Create new version with standard-version (CHANGELOG, git tag)
41+
```
42+
43+
## Architecture
44+
45+
### Build System
46+
47+
The library uses **two separate entry points**:
48+
- **Demo/Dev**: `src/index.tsx` → Vite dev server showcasing all components
49+
- **Library Build**: `src/build.ts` → Rollup bundles for npm distribution
50+
51+
**Pre-build step**: `component-list.js` scans `src/components/` and generates `src/component-list.json` (used by demo app to dynamically list components). This runs automatically before `dev` and `build` commands.
52+
53+
**Two TypeScript configs**:
54+
- `tsconfig.json`: For development and demo app (Vite, bundler resolution)
55+
- `tsconfig.build.json`: For Rollup library build
56+
57+
### Atomic Design Structure
58+
59+
Components are organized in three levels:
60+
61+
```
62+
src/components/
63+
├── atoms/ # Basic building blocks (buttons, inputs, badges, loaders)
64+
├── molecules/ # Composed components (cards, tables, modals, notifications)
65+
└── organisms/ # Complex UI patterns (accordion, navigation bars)
66+
```
67+
68+
Each level exports through an `index.ts` barrel file. The main export is at `src/components/index.ts`.
69+
70+
### Theming System
71+
72+
**Core files**:
73+
- `src/styling/ThemeConfig.ts`: Defines `GlobalStyles`, `lightTheme`, `darkTheme`, `largeLightTheme`, `largeDarkTheme`
74+
- `src/components/CloudStyle.tsx`: Convenience wrapper around styled-components `ThemeProvider`
75+
76+
**Theme tokens** are accessed via `theme.style.*` (colors, spacing, borders) and `theme.fonts.*` (font families).
77+
78+
**CloudStyle component** combines themes based on `isDarkMode` and `isLargeMode` props:
79+
- Light/Dark mode: Switches color palette
80+
- Large mode: Changes base `fontSize` from 16px to 24px (all components use `em`/`rem` and scale proportionally)
81+
- Custom theme overrides: Pass `lightStyle`, `darkStyle`, or `fonts` props
82+
- **Important**: `darkStyle` inherits overrides from `lightStyle` then applies its own overrides
83+
84+
**Global CSS Reset**: Applied via `GlobalStyles` component (based on Josh Comeau's CSS Reset).
85+
86+
### Path Aliases
87+
88+
TypeScript path resolution is configured with `baseUrl: "./src"`, allowing imports like:
89+
```typescript
90+
import { ColumnModel } from 'models/ColumnModel'
91+
import { FunctionHelpers } from 'helpers/FunctionHelpers'
92+
import { CloudStyle } from 'components/CloudStyle'
93+
```
94+
95+
**Common aliases**:
96+
- `components/*``src/components/*`
97+
- `datatypes/*``src/datatypes/*`
98+
- `helpers/*``src/helpers/*`
99+
- `models/*``src/models/*`
100+
- `styling/*``src/styling/*`
101+
- `store/*``src/store/*` (demo app only)
102+
103+
Both Jest and Vite are configured to resolve these aliases.
104+
105+
### Data Models
106+
107+
`src/models/` contains TypeScript interfaces defining props for complex components:
108+
- `ColumnModel`: Table column configuration (DynamicTable)
109+
- `MenuItemModel`: Navigation menu items
110+
- `SelectOptionModel`: Dropdown options
111+
- `ComponentOptionModel`: Demo component configuration options
112+
- `StepsModel`: Step progress indicators
113+
114+
When modifying components that accept structured data, update these models.
115+
116+
### Demo App Architecture
117+
118+
The Vite demo app (`src/App.tsx`) provides an interactive component showcase. It:
119+
- Uses Redux Toolkit (`src/store/`) for demo settings (dark mode, large mode, etc.)
120+
- Persists settings to localStorage via middleware
121+
- Dynamically renders component examples using `component-list.json`
122+
- Uses `ComponentBox` pattern to create interactive prop controls
123+
124+
**Note**: Consumer applications do **not** need Redux. It's only used for the demo.
125+
126+
## Library Exports
127+
128+
`src/build.ts` exports:
129+
```typescript
130+
export * from './components' // All React components
131+
export * from './datatypes' // Type definitions
132+
export * from './helpers' // Utility functions
133+
export * from './models' // Data models/interfaces
134+
export * from './styling' // Theme config, GlobalStyles
135+
export * from './types' // Additional types
136+
```
137+
138+
**Rollup output**:
139+
- ESM: `dist/esm/index.mjs.js`
140+
- CJS: `dist/cjs/index.js`
141+
- Types: `dist/index.d.ts`
142+
143+
## Key Patterns
144+
145+
### Adding New Components
146+
147+
1. Create component in appropriate atomic level (`atoms/`, `molecules/`, or `organisms/`)
148+
2. Export from level's `index.ts` barrel file
149+
3. Component will be auto-detected by `component-list.js` for demo
150+
4. Use styled-components with theme tokens: `${({ theme }) => theme.style.colorPrimary}`
151+
5. Follow existing prop patterns (e.g., `isRounded`, `isDisabled`, `variant`)
152+
153+
### Testing
154+
155+
- Test files: `__tests__/**/*.test.ts(x)` or co-located `*.test.ts(x)`
156+
- Uses Jest with ts-jest (ESM preset)
157+
- jsdom environment for React components
158+
- Coverage reports in `./coverage/`
159+
160+
**Common test imports**:
161+
```typescript
162+
import '@testing-library/jest-dom'
163+
import { render, screen } from '@testing-library/react'
164+
import userEvent from '@testing-library/user-event'
165+
```
166+
167+
### Styled Components Best Practices
168+
169+
- Use transient props (`$propName`) for styling props not passed to DOM
170+
- Access theme via `${({ theme }) => ...}`
171+
- All colors should reference theme tokens, not hardcoded values
172+
- Use `em` and `rem` for sizes (supports isLargeMode scaling)
173+
174+
### Version & Release
175+
176+
This project uses `standard-version` for semantic versioning:
177+
- Automatically generates CHANGELOG from conventional commits
178+
- Creates git tags
179+
- Updates version in package.json
180+
- Commit format: `type(scope): message` (e.g., `feat(button): add loading state`)
181+
182+
## Important Notes
183+
184+
- **Peer dependencies**: React and ReactDOM are peer deps (not bundled). Consumer apps must provide them.
185+
- **Font files**: Located in `public/fonts/` (TT Interfaces, TT Interphases). Demo app serves these; consumers need to host fonts or provide custom `fonts` prop to CloudStyle.
186+
- **Icons**: SVG icon components in `src/components/icons/` (not exported in atomic index files, access directly)
187+
- **Elements**: Helper UI elements in `src/components/elements/` (Elipse, TableOrder, TimestampBar) used internally by molecules/organisms
188+
- **Module format**: This is an ESM-first package. CJS support provided but ESM is primary target.
189+
190+
## Quality & Honesty
191+
- **No sycophancy, challenge reasoning.** Be direct — no praise, flattery, or filler. Push back on flawed assumptions or suboptimal approaches (yours and mine). Flag trade-offs honestly.

sbp-frontend-style/__tests__/App.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import { act, render, screen } from '@testing-library/react'
66
import { BrowserRouter } from 'react-router-dom'
77
import App from '../src/App'
88

9+
jest.mock('html-react-parser', () => ({
10+
__esModule: true,
11+
default: (html: string) => html
12+
}))
13+
914
global.ResizeObserver = jest.fn().mockImplementation(() => ({
1015
observe: jest.fn(),
1116
unobserve: jest.fn(),

sbp-frontend-style/package.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@schubergphilis/sbp-frontend-style",
3-
"version": "1.13.0",
3+
"version": "1.13.1-1",
44
"license": "MIT",
55
"type": "module",
66
"types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
2525
"lint": "eslint ./src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
2626
"preview": "vite preview",
2727
"clean": "rimraf dist",
28-
"build": "pnpm clean && rollup -c",
28+
"build": "pnpm clean && tsc -p tsconfig.declarations.json && rollup -c",
2929
"release": "standard-version",
3030
"test": "jest --coverage --colors --silent --verbose --watchAll=false",
3131
"test:debug": "jest --watchAll --coverage --color --detectOpenHandles --silent false --verbose true --debug",
@@ -34,70 +34,70 @@
3434
"test:clear": "jest --clearCache"
3535
},
3636
"peerDependencies": {
37-
"react": "^19.2.4",
38-
"react-dom": "^19.2.4"
37+
"react": "^19.2.5",
38+
"react-dom": "^19.2.5"
3939
},
4040
"dependencies": {
4141
"@rollup/plugin-terser": "^1.0.0",
42-
"styled-components": "6.3.12"
42+
"styled-components": "6.4.1"
4343
},
4444
"devDependencies": {
45-
"@eslint/compat": "^2.0.1",
46-
"@eslint/eslintrc": "^3.3.3",
45+
"@eslint/compat": "^2.0.5",
46+
"@eslint/eslintrc": "^3.3.5",
4747
"@eslint/js": "^9.39.2",
48-
"@inrupt/jest-jsdom-polyfills": "^4.0.8",
48+
"@inrupt/jest-jsdom-polyfills": "^4.1.0",
4949
"@reduxjs/toolkit": "^2.11.2",
50-
"@rollup/plugin-commonjs": "^29.0.0",
50+
"@rollup/plugin-commonjs": "^29.0.2",
5151
"@rollup/plugin-node-resolve": "^16.0.3",
52-
"@rollup/plugin-sucrase": "^5.0.2",
53-
"@rollup/plugin-typescript": "^11.1.2",
52+
"@rollup/plugin-sucrase": "^5.1.0",
53+
"@rollup/plugin-typescript": "^12.3.0",
5454
"@testing-library/dom": "^10.4.1",
5555
"@testing-library/jest-dom": "^6.9.1",
56-
"@testing-library/react": "^16.3.1",
56+
"@testing-library/react": "^16.3.2",
5757
"@testing-library/user-event": "^14.6.1",
5858
"@types/jest": "^30.0.0",
59-
"@types/node": "^25.0.6",
60-
"@types/react": "^19.2.8",
59+
"@types/node": "^25.6.0",
60+
"@types/react": "^19.2.14",
6161
"@types/react-dom": "^19.2.3",
6262
"@types/react-redux": "^7.1.34",
6363
"@types/react-syntax-highlighter": "^15.5.13",
6464
"@types/styled-components": "^5.1.36",
65-
"@typescript-eslint/eslint-plugin": "^8.52.0",
66-
"@typescript-eslint/parser": "^8.52.0",
67-
"@vitejs/plugin-react": "^5.1.2",
68-
"@vitejs/plugin-react-swc": "^4.2.2",
69-
"directory-tree": "^3.5.2",
65+
"@typescript-eslint/eslint-plugin": "^8.59.0",
66+
"@typescript-eslint/parser": "^8.59.0",
67+
"@vitejs/plugin-react": "^6.0.1",
68+
"@vitejs/plugin-react-swc": "^4.3.0",
69+
"directory-tree": "^3.6.0",
7070
"eslint": "9.39.2",
7171
"eslint-config-prettier": "10.1.8",
72-
"eslint-plugin-prettier": "5.5.4",
72+
"eslint-plugin-prettier": "5.5.5",
7373
"eslint-plugin-react": "^7.37.5",
74-
"eslint-plugin-react-hooks": "^7.0.1",
75-
"eslint-plugin-react-refresh": "^0.4.26",
76-
"globals": "^17.0.0",
77-
"html-react-parser": "^5.2.11",
78-
"jest": "^30.2.0",
79-
"jest-environment-jsdom": "^30.2.0",
80-
"jest-environment-node": "^30.2.0",
81-
"prettier": "^3.7.4",
74+
"eslint-plugin-react-hooks": "^7.1.1",
75+
"eslint-plugin-react-refresh": "^0.5.2",
76+
"globals": "^17.5.0",
77+
"html-react-parser": "^6.0.1",
78+
"jest": "^30.3.0",
79+
"jest-environment-jsdom": "^30.3.0",
80+
"jest-environment-node": "^30.3.0",
81+
"prettier": "^3.8.3",
8282
"prettier-plugin-organize-imports": "^4.3.0",
83-
"react": "^19.2.3",
84-
"react-dom": "^19.2.3",
83+
"react": "^19.2.5",
84+
"react-dom": "^19.2.5",
8585
"react-element-to-jsx-string": "^17.0.1",
8686
"react-redux": "^9.2.0",
87-
"react-router-dom": "^7.12.0",
88-
"react-syntax-highlighter": "^16.1.0",
89-
"rimraf": "^6.1.2",
90-
"rollup": "^4.60.1",
87+
"react-router-dom": "^7.14.2",
88+
"react-syntax-highlighter": "^16.1.1",
89+
"rimraf": "^6.1.3",
90+
"rollup": "^4.60.2",
9191
"rollup-plugin-delete": "^3.0.2",
92-
"rollup-plugin-dts": "^6.3.0",
92+
"rollup-plugin-dts": "^6.4.1",
9393
"rollup-plugin-peer-deps-external": "^2.2.4",
9494
"rollup-plugin-tsconfig-paths": "^1.5.2",
9595
"standard-version": "^9.5.0",
96-
"ts-jest": "^29.4.6",
97-
"typescript": "5.9.3",
98-
"vite": "^7.3.2",
99-
"vite-tsconfig-paths": "^6.0.4",
100-
"web-vitals": "^5.1.0"
96+
"ts-jest": "^29.4.9",
97+
"typescript": "6.0.3",
98+
"vite": "^8.0.9",
99+
"vite-tsconfig-paths": "^6.1.1",
100+
"web-vitals": "^5.2.0"
101101
},
102102
"release": {
103103
"branches": [
@@ -145,7 +145,7 @@
145145
"^styling/(.*)": "<rootDir>/src/styling/$1"
146146
},
147147
"transformIgnorePatterns": [
148-
"<rootDir>/node_modules/(?!variables|react-syntax-highlighter)"
148+
"node_modules/(?!(variables|react-syntax-highlighter)/)"
149149
]
150150
}
151151
}

0 commit comments

Comments
 (0)