@codepom/react 0.1.0 → 2.0.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) 2025 CodePom
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,157 @@
1
+ # @codepom/react
2
+
3
+ React component library for the CodePom design system.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @codepom/react @codepom/tokens
9
+ # or
10
+ pnpm add @codepom/react @codepom/tokens
11
+ ```
12
+
13
+ Peer dependencies: `react >= 18`, `react-dom >= 18`
14
+
15
+ ## Setup
16
+
17
+ ### 1. Import styles
18
+
19
+ In your app entry (e.g. `_app.tsx`, `layout.tsx`, or `global.css`):
20
+
21
+ ```ts
22
+ import '@codepom/tokens/css' // design tokens (CSS custom properties)
23
+ import '@codepom/tokens/reset' // optional: minimal CSS reset
24
+ import '@codepom/react/styles' // component styles
25
+ ```
26
+
27
+ ### 2. Tailwind (optional)
28
+
29
+ If you use Tailwind CSS, add the CodePom preset to your config:
30
+
31
+ ```js
32
+ // tailwind.config.js
33
+ import codepomPreset from '@codepom/tokens/tailwind'
34
+
35
+ export default {
36
+ presets: [codepomPreset],
37
+ content: [
38
+ './src/**/*.{ts,tsx}',
39
+ './node_modules/@codepom/react/dist/**/*.js',
40
+ ],
41
+ }
42
+ ```
43
+
44
+ ### 3. Fonts
45
+
46
+ The design system uses **Space Grotesk** (sans) and **Space Mono** (mono). Load them however your framework prefers:
47
+
48
+ ```html
49
+ <!-- HTML link tag -->
50
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
51
+ <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet" />
52
+ ```
53
+
54
+ ```ts
55
+ // Next.js app/layout.tsx
56
+ import { Space_Grotesk, Space_Mono } from 'next/font/google'
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ```tsx
62
+ import { Button, Badge, Mascot, Icon, Modal, useToast, ToastProvider } from '@codepom/react'
63
+
64
+ // Wrap your app with ToastProvider
65
+ export default function App({ children }) {
66
+ return <ToastProvider position="top-right">{children}</ToastProvider>
67
+ }
68
+
69
+ // Use components
70
+ function Page() {
71
+ const { show } = useToast()
72
+
73
+ return (
74
+ <>
75
+ <Mascot variant="full" size={120} />
76
+ <Icon name="agility" size={24} />
77
+ <Button variant="primary" onClick={() => show({ message: 'Shipped!' })}>
78
+ Deploy
79
+ </Button>
80
+ <Badge variant="success">Live</Badge>
81
+ </>
82
+ )
83
+ }
84
+ ```
85
+
86
+ ## Components
87
+
88
+ | Component | Description |
89
+ |-----------|-------------|
90
+ | `Button` | Primary, secondary, accent, outline, ghost, destructive variants |
91
+ | `Badge` | Inline status labels with 7 variants |
92
+ | `Alert` | Info, success, warning, error banners |
93
+ | `Avatar` | User avatars with status indicators and size options |
94
+ | `Card` / `CardHeader` / `CardBody` / `CardFooter` | Composable card layout |
95
+ | `Input` / `Textarea` / `Select` / `Label` / `Field` | Form controls with label and hint support |
96
+ | `Checkbox` | Controlled/uncontrolled checkbox |
97
+ | `Radio` | Controlled/uncontrolled radio button |
98
+ | `Toggle` | On/off toggle switch |
99
+ | `Modal` | Accessible `<dialog>`-based modal with sizes |
100
+ | `Tabs` | Underline and pill tab variants |
101
+ | `Tooltip` | Hover tooltip with placement options |
102
+ | `Popover` | Click-triggered popover with outside-click dismiss |
103
+ | `ToastProvider` / `useToast` | Global toast notifications |
104
+ | `Navbar` | Top navigation bar |
105
+ | `Sidebar` | Collapsible sidebar with nested links |
106
+ | `Breadcrumb` | Accessible breadcrumb navigation |
107
+ | `Pagination` | Page navigation controls |
108
+ | `Table` | Data table with typed columns |
109
+ | `Skeleton` / `SkeletonCard` / `SkeletonText` | Loading placeholders |
110
+ | `Mascot` | CodePom brand mascot — `variant: full\|solid\|line`, `theme: light\|dark` |
111
+ | `Icon` | Brand icon set — agility, partner, integrity, bone, db, gear-paw, gear, cloud, terminal, chip, plus, chevron-down |
112
+ | `Pattern` | Background texture pattern |
113
+ | `BrandPrinciples` | Brand values display block |
114
+ | `BusinessCard` | Branded business card component |
115
+
116
+ ## Next.js
117
+
118
+ All components include a `"use client"` directive and work with the App Router. Import them directly in client components or wrap in your own client boundary.
119
+
120
+ ```tsx
121
+ // app/layout.tsx
122
+ import '@codepom/tokens/css'
123
+ import '@codepom/react/styles'
124
+ import { ToastProvider } from '@codepom/react'
125
+
126
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
127
+ return (
128
+ <html lang="en">
129
+ <body>
130
+ <ToastProvider>{children}</ToastProvider>
131
+ </body>
132
+ </html>
133
+ )
134
+ }
135
+ ```
136
+
137
+ ## Astro
138
+
139
+ ```astro
140
+ ---
141
+ // src/layouts/Layout.astro
142
+ import '@codepom/tokens/css'
143
+ import '@codepom/react/styles'
144
+ ---
145
+ ```
146
+
147
+ ```astro
148
+ ---
149
+ // src/components/MyIsland.astro
150
+ import { Button } from '@codepom/react'
151
+ ---
152
+ <Button client:load variant="primary">Click me</Button>
153
+ ```
154
+
155
+ ## License
156
+
157
+ MIT