cherry-styled-components 0.1.2 → 0.1.3

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.md ADDED
@@ -0,0 +1,70 @@
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
+ Cherry Design System — a React component library built with TypeScript and styled-components v6. White-label design system with built-in theming, dark mode, and responsive breakpoints. Published as both ES module and UMD bundle.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ pnpm install # Install dependencies (project uses pnpm)
13
+ pnpm run dev # Start Vite dev server
14
+ pnpm run build # Production build (outputs dist/cherry.js and dist/cherry.umd.cjs)
15
+ pnpm run format # Format with Prettier
16
+ ```
17
+
18
+ No test framework is configured.
19
+
20
+ ## Architecture
21
+
22
+ ### Entry Point & Build
23
+
24
+ - **Library entry:** `src/lib/index.ts` — barrel export of all components and utilities
25
+ - **Vite** builds the library with `@vitejs/plugin-react` and `vite-plugin-dts` for declaration generation
26
+ - React and React DOM are external (not bundled)
27
+ - `src/main.tsx` → `src/App.tsx` is the demo app, not part of the library output
28
+
29
+ ### Component Pattern
30
+
31
+ Every component follows this structure:
32
+
33
+ 1. Props interface extending native HTML element attributes (e.g., `ButtonProps extends React.ButtonHTMLAttributes`)
34
+ 2. Styled component with theme-aware CSS
35
+ 3. `forwardRef` wrapper
36
+ 4. Named export
37
+
38
+ **Styled props use `$` prefix** (e.g., `$variant`, `$fullWidth`) to prevent DOM attribute pollution — this is a styled-components v6 convention.
39
+
40
+ All components include `"use client"` directive for Next.js App Router compatibility.
41
+
42
+ ### Theming System (`src/lib/utils/theme.ts`)
43
+
44
+ Two complete theme objects (light and dark) defining: breakpoints (xs–xxxl), colors (primary/secondary/tertiary + status), spacing, shadows, and typography (font sizes, line heights — all responsive).
45
+
46
+ `CherryThemeProvider` (`src/lib/styled-components/theme-provider.tsx`) wraps styled-components' ThemeProvider, handles system dark mode detection, persists preference to localStorage, and toggles a `"dark"` class on `document.documentElement`.
47
+
48
+ ### Component Categories
49
+
50
+ - **Form:** Button, Input, Select, Textarea, Toggle, Range — all support `$label`, `$size`, `$error`/`$success`, `$fullWidth`
51
+ - **Layout:** Container, Grid, Col, Flex, Box, MaxWidth, Space — all support responsive props per breakpoint (e.g., `$xsCols`, `$lgCols`)
52
+ - **Icon:** Wrapper around `lucide-react` icons accessed by name string
53
+
54
+ ### Shared Utilities (`src/lib/utils/mixins.tsx`)
55
+
56
+ CSS helper functions used across components: `resetButton`, `resetInput`, `fullWidthStyles`, `statusBorderStyles`, `formElementHeightStyles`, and responsive style generators (`generateGapStyles`, `generateColsStyles`, etc.).
57
+
58
+ ### SSR Support
59
+
60
+ `StyledComponentsRegistry` (`src/lib/styled-components/registry.tsx`) uses Next.js `useServerInsertedHTML` for server-side style extraction.
61
+
62
+ ## Code Style
63
+
64
+ - TypeScript strict mode
65
+ - Prettier: double quotes, trailing commas, 2-space indent, semicolons
66
+ - ESLint with TypeScript parser + react-hooks + react-refresh plugins
67
+
68
+ ## Git Commits
69
+
70
+ When asked to commit, always follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. Do not add a Co-Authored-By line.