@chesapeake/stack 0.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +190 -0
  3. package/README.md +440 -0
  4. package/components/ui/avatar.tsx +87 -0
  5. package/components/ui/badge.tsx +49 -0
  6. package/components/ui/badgeVariants.ts +26 -0
  7. package/components/ui/button-group.tsx +67 -0
  8. package/components/ui/button.tsx +70 -0
  9. package/components/ui/buttonGroupVariants.ts +23 -0
  10. package/components/ui/buttonVariants.ts +38 -0
  11. package/components/ui/calendar.tsx +220 -0
  12. package/components/ui/card.tsx +162 -0
  13. package/components/ui/dialog.tsx +290 -0
  14. package/components/ui/drawer.tsx +227 -0
  15. package/components/ui/dropdown-menu.tsx +260 -0
  16. package/components/ui/index.ts +86 -0
  17. package/components/ui/input.tsx +59 -0
  18. package/components/ui/label.tsx +47 -0
  19. package/components/ui/location-input.md +194 -0
  20. package/components/ui/location-input.tsx +384 -0
  21. package/components/ui/popover.tsx +110 -0
  22. package/components/ui/select.tsx +306 -0
  23. package/components/ui/separator.tsx +50 -0
  24. package/components/ui/sonner-api.ts +8 -0
  25. package/components/ui/sonner.tsx +69 -0
  26. package/components/ui/textarea.tsx +53 -0
  27. package/components/ui/tooltip.tsx +125 -0
  28. package/components/ux/ActivityAnimation.tsx +135 -0
  29. package/components/ux/EmptyState.tsx +22 -0
  30. package/components/ux/FeedbackDrawer.tsx +141 -0
  31. package/components/ux/FireAnimation.tsx +189 -0
  32. package/components/ux/FriendList.tsx +111 -0
  33. package/components/ux/FriendRequestList.tsx +104 -0
  34. package/components/ux/GifSearch.tsx +264 -0
  35. package/components/ux/ImageUpload.tsx +829 -0
  36. package/components/ux/SelectedUsersList.tsx +91 -0
  37. package/components/ux/StandardLayout/PageLayout.tsx +107 -0
  38. package/components/ux/StandardLayout/ProfilePage.tsx +452 -0
  39. package/components/ux/StandardLayout/StandardLayout.tsx +345 -0
  40. package/components/ux/StandardLayout/index.ts +22 -0
  41. package/components/ux/TutorialCarousel.tsx +128 -0
  42. package/components/ux/UserSearch.tsx +324 -0
  43. package/components/ux/UserSelector.tsx +116 -0
  44. package/components/ux/auth/AuthSelector.tsx +154 -0
  45. package/components/ux/auth/MultiAuthProvider.tsx +196 -0
  46. package/components/ux/auth/README.md +317 -0
  47. package/components/ux/auth/context.ts +46 -0
  48. package/components/ux/auth/github/AuthCallback.tsx +177 -0
  49. package/components/ux/auth/github/AuthProvider.tsx +111 -0
  50. package/components/ux/auth/github/README.md +208 -0
  51. package/components/ux/auth/github/client.ts +127 -0
  52. package/components/ux/auth/github/config.ts +68 -0
  53. package/components/ux/auth/github/context.ts +34 -0
  54. package/components/ux/auth/github/default-client.ts +74 -0
  55. package/components/ux/auth/github/index.ts +43 -0
  56. package/components/ux/auth/github/types.ts +44 -0
  57. package/components/ux/auth/github/useGitHubAuth.ts +16 -0
  58. package/components/ux/auth/google/AuthCallback.tsx +170 -0
  59. package/components/ux/auth/google/AuthProvider.tsx +108 -0
  60. package/components/ux/auth/google/README.md +450 -0
  61. package/components/ux/auth/google/client.ts +109 -0
  62. package/components/ux/auth/google/config.ts +65 -0
  63. package/components/ux/auth/google/context.ts +34 -0
  64. package/components/ux/auth/google/default-client.ts +69 -0
  65. package/components/ux/auth/google/index.ts +43 -0
  66. package/components/ux/auth/google/types.ts +42 -0
  67. package/components/ux/auth/google/useGoogleAuth.ts +16 -0
  68. package/components/ux/auth/index.ts +72 -0
  69. package/components/ux/auth/useAuth.ts +16 -0
  70. package/components/ux/index.ts +46 -0
  71. package/components/ux/theme-provider-context.ts +20 -0
  72. package/components/ux/theme-provider.tsx +114 -0
  73. package/components/ux/useTheme.ts +42 -0
  74. package/index.ts +29 -0
  75. package/lib/utils.ts +57 -0
  76. package/package.json +170 -0
  77. package/styles/base.css +38 -0
  78. package/styles/components.css +54 -0
  79. package/styles/index.css +7 -0
  80. package/styles/tokens.css +189 -0
  81. package/tailwind.preset.ts +169 -0
  82. package/types/user.ts +69 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project 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
7
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [0.1.0] - 2026-02-05
10
+
11
+ ### Added
12
+
13
+ - Initial public release
14
+ - shadcn/ui based component library with New York style
15
+ - UI components: Button, Avatar, Calendar, Card, Dialog, Drawer, DropdownMenu,
16
+ Input, Label, Textarea, Checkbox, Popover, Select, Separator, Sonner, Tooltip,
17
+ Badge, ButtonGroup
18
+ - UX components: UserSearch, UserSelector, FriendList, FriendRequestList,
19
+ GifSearch, ImageUpload, TutorialCarousel, PageLayout, FeedbackDrawer,
20
+ ThemeProvider
21
+ - Authentication components: GoogleAuth, GitHubAuth with providers and callbacks
22
+ - Tailwind CSS preset with design tokens
23
+ - Full dark mode support via CSS custom properties
24
+ - Apache 2.0 license
25
+
26
+ [0.1.0]: https://github.com/chesapeake-computing/stack/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Chesapeake Computing
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,440 @@
1
+ # @chesapeake/stack
2
+
3
+ <!-- npm badge: uncomment when published to npm
4
+ [![npm version](https://badge.fury.io/js/@chesapeake/stack.svg)](https://www.npmjs.com/package/@chesapeake/stack)
5
+ -->
6
+
7
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
8
+
9
+ A reusable React component library and design system built on shadcn components
10
+ & derived user experiences. the shadcn community seems to refer to these things
11
+ as blocks, which we currently don't support. The npm package contains a tiny
12
+ design system in the form of a tailwind preset & a single css import. The design
13
+ system consists of:
14
+
15
+ - Reusable React components in `components/` (UI components in `ui/`, UX
16
+ components in `ux/`)
17
+ - `styles/index.css` that includes Tailwind CSS, design tokens, base styles, and
18
+ component styles
19
+ - `tailwind.preset.ts` for use in `tailwind.config.ts`
20
+ - Peer dependencies declared for any component dependencies
21
+
22
+ ## Installation
23
+
24
+ To utilize the design system in your app:
25
+
26
+ ### 1. Install Dependencies
27
+
28
+ Add the required peer dependencies to your app's `package.json`:
29
+
30
+ ```bash
31
+ npm install react react-dom tailwindcss tw-animate-css
32
+ npm install react-day-picker vaul # if using calendar or drawer components
33
+ ```
34
+
35
+ ### 2. Import Styles
36
+
37
+ Import the shared styles in your app's main CSS file (e.g., `src/index.css`):
38
+
39
+ ```css
40
+ /* Import Tailwind, third-party CSS, and shared styles */
41
+ @import "tailwindcss";
42
+ @import "tw-animate-css";
43
+ @import "react-day-picker/style.css"; /* if using calendar component */
44
+ @import "vaul/style.css"; /* if using drawer component */
45
+ @import "@chesapeake/stack/styles/index.css";
46
+ ```
47
+
48
+ ### 3. Configure Bundler and TypeScript
49
+
50
+ If you consume the package from source (e.g. in a monorepo), add a path alias so
51
+ imports resolve correctly. When using the published npm package, use the package
52
+ name in place of `@chesapeake/stack` in the examples below.
53
+
54
+ **Vite** (`vite.config.ts`):
55
+
56
+ ```typescript
57
+ import path from "path";
58
+
59
+ export default defineConfig({
60
+ resolve: {
61
+ alias: {
62
+ "@shared": path.resolve(__dirname, "../stack"),
63
+ },
64
+ },
65
+ });
66
+ ```
67
+
68
+ **TypeScript** (`tsconfig.json`):
69
+
70
+ ```json
71
+ {
72
+ "compilerOptions": {
73
+ "paths": {
74
+ "@shared/*": ["../stack/*"]
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### 4. Configure Tailwind
81
+
82
+ Extend your `tailwind.config.ts` with the shared preset:
83
+
84
+ ```typescript
85
+ import type { Config } from "tailwindcss";
86
+ import sharedPreset from "@chesapeake/stack/tailwind.preset";
87
+
88
+ const config: Config = {
89
+ content: [
90
+ // your app's content paths
91
+ ],
92
+ presets: [sharedPreset],
93
+ // your app's additional configuration
94
+ };
95
+
96
+ export default config;
97
+ ```
98
+
99
+ ### 5. Configure Tailwind Content
100
+
101
+ Add the package to your Tailwind content configuration so classes are processed:
102
+
103
+ **`tailwind.config.ts`**:
104
+
105
+ ```typescript
106
+ import type { Config } from "tailwindcss";
107
+ import sharedPreset from "@chesapeake/stack/tailwind.preset";
108
+
109
+ const config: Config = {
110
+ content: [
111
+ "./src/**/*.{js,ts,jsx,tsx}",
112
+ "./node_modules/@chesapeake/stack/**/*.{js,ts,jsx,tsx}",
113
+ ],
114
+ presets: [sharedPreset],
115
+ // your app's additional configuration
116
+ };
117
+
118
+ export default config;
119
+ ```
120
+
121
+ ### 6. Import and Use Components
122
+
123
+ Import and use components in your React components:
124
+
125
+ ```tsx
126
+ import { Button } from "@chesapeake/stack/components/ui/button";
127
+ import { ThemeProvider } from "@chesapeake/stack/components/ux/theme-provider";
128
+
129
+ function App() {
130
+ return (
131
+ <ThemeProvider>
132
+ <Button variant="default">Click me</Button>
133
+ </ThemeProvider>
134
+ );
135
+ }
136
+ ```
137
+
138
+ ### Why peer dependencies?
139
+
140
+ The package declares peer dependencies instead of bundling them so that:
141
+
142
+ - **CSS is correct**: Third-party CSS (Tailwind, react-day-picker, vaul, etc.)
143
+ is imported once in your app instead of via the package.
144
+ - **Versions stay flexible**: Your app installs and controls the versions that
145
+ work with your build.
146
+ - **Bundle size stays small**: No duplicated CSS or runtime deps inside the
147
+ package.
148
+
149
+ Install the peer dependencies listed in the package’s `package.json` in your
150
+ app.
151
+
152
+ ### Installation troubleshooting
153
+
154
+ - **CSS not loading**: Ensure all peer dependencies are installed, CSS imports
155
+ are in your main CSS file in the right order, and your bundler/TypeScript path
156
+ mapping resolves `@chesapeake/stack` (or the package name) correctly.
157
+ - **Version conflicts**: Use `npm ls` to inspect installed versions; align with
158
+ the peer dependency ranges required by the package.
159
+ - **Build errors**: Run the package’s validate script (e.g. `make validate`) if
160
+ available, confirm required CSS files exist, and check import paths.
161
+
162
+ ### Types (optional)
163
+
164
+ The package exports shared TypeScript types for use in consuming apps (e.g. user
165
+ and friend types). Import from the `types/user` subpath:
166
+
167
+ ```ts
168
+ import type {
169
+ BaseUser,
170
+ Friend,
171
+ toBaseUser,
172
+ } from "@chesapeake/stack/types/user";
173
+ ```
174
+
175
+ ### Migrating from an older setup
176
+
177
+ If you previously copied shared CSS or used a different import pattern: remove
178
+ duplicate CSS, switch to the import pattern above, install any missing peer
179
+ dependencies, and test all components.
180
+
181
+ ## Usage
182
+
183
+ ### Available Components
184
+
185
+ #### UI Components (`components/ui/`)
186
+
187
+ - **Button** - Various button variants and sizes
188
+ - **Input** - Form input component
189
+ - **Label** - Form label component
190
+ - **Textarea** - Multi-line text input
191
+ - **Avatar** - User avatar display
192
+ - **Calendar** - Date picker component
193
+ - **Drawer** - Slide-out drawer component
194
+ - **Dropdown Menu** - Dropdown menu component
195
+ - **Location Input** - Location search input
196
+ - **Popover** - Popover component
197
+ - **Toast** - Toast notification system
198
+
199
+ #### UX Components (`components/ux/`)
200
+
201
+ - **Theme Provider** - Dark/light theme context provider
202
+ - **Gif Search** - GIF search and selection component
203
+ - **Image Upload** - Image upload component
204
+ - **Tutorial Carousel** - Step-by-step tutorial component
205
+ - **Page Layout** - `PageContent`, `PageHeader`, `PageLayout` for consistent
206
+ page structure
207
+
208
+ ### Design System Features
209
+
210
+ - **Design Tokens**: Consistent color palette, spacing, and typography
211
+ - **Dark Mode**: Built-in dark theme support
212
+ - **Responsive**: Mobile-first responsive design
213
+ - **Accessibility**: ARIA-compliant components
214
+ - **Animations**: Smooth transitions and micro-interactions
215
+
216
+ ## Theming
217
+
218
+ This section explains how the shared theme system works and how projects can
219
+ customize themes.
220
+
221
+ ### Base Theme
222
+
223
+ The shared design system (`@chesapeake/stack`) includes a default theme defined
224
+ in `stack/styles/tokens.css`. This theme includes:
225
+
226
+ - **Color palette**: Primary, secondary, muted, accent, destructive colors
227
+ - **Light and dark mode**: Automatic theme switching via `.dark` class
228
+ - **Typography**: Poppins (sans-serif), Lora (serif), Fira Code (monospace)
229
+ - **Shadows**: Custom shadow system with offset shadows
230
+ - **Border radius**: Consistent radius values
231
+ - **Chart colors**: Pre-defined chart color palette
232
+
233
+ This theme is automatically applied to any project that imports
234
+ `@chesapeake/stack/styles/index.css`.
235
+
236
+ ### Using the Default Theme
237
+
238
+ Projects use the default theme automatically:
239
+
240
+ ```css
241
+ /* e.g. src/index.css */
242
+ @import "tailwindcss";
243
+ @import "tw-animate-css";
244
+ @import "react-day-picker/style.css";
245
+ @import "@chesapeake/stack/styles/index.css";
246
+ /* That's it! Default theme is now active */
247
+ ```
248
+
249
+ **Don't forget to load fonts in your `index.html`:**
250
+
251
+ ```html
252
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
253
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
254
+ <link
255
+ href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Lora:wght@400;500;600&family=Fira+Code:wght@400;500;600&display=swap"
256
+ rel="stylesheet"
257
+ />
258
+ ```
259
+
260
+ ### Overriding the Theme
261
+
262
+ Projects can override specific theme variables to create a different look and
263
+ feel:
264
+
265
+ ```css
266
+ /* e.g. src/index.css */
267
+ @import "tailwindcss";
268
+ @import "tw-animate-css";
269
+ @import "react-day-picker/style.css";
270
+ @import "@chesapeake/stack/styles/index.css";
271
+
272
+ /* Override theme variables */
273
+ :root {
274
+ /* Change primary color */
275
+ --primary: oklch(0.723 0.219 149.579);
276
+
277
+ /* Change background */
278
+ --background: oklch(0.95 0.01 200);
279
+
280
+ /* Use different fonts */
281
+ --font-sans: "Inter", sans-serif;
282
+ --font-serif: "Crimson Text", serif;
283
+ --font-mono: "JetBrains Mono", monospace;
284
+ }
285
+
286
+ .dark {
287
+ /* Override dark mode colors */
288
+ --primary: oklch(0.8 0.2 150);
289
+ --background: oklch(0.2 0.02 200);
290
+ }
291
+
292
+ /* Project-specific utility classes (e.g. brand gradient) */
293
+ .my-brand-gradient {
294
+ background: linear-gradient(to right, var(--primary), var(--secondary));
295
+ }
296
+ ```
297
+
298
+ ### CSS Variable Priority
299
+
300
+ CSS custom properties follow standard CSS cascade rules:
301
+
302
+ 1. **Shared theme** (`@chesapeake/stack/styles/tokens.css`) - Base defaults
303
+ 2. **Project overrides** (your `index.css` after
304
+ `@import "@chesapeake/stack/styles/index.css"`) - Your customizations
305
+ 3. **Inline styles** (component-level) - Most specific
306
+
307
+ This means you only need to override the variables you want to change!
308
+
309
+ ### Available Theme Variables
310
+
311
+ #### Colors
312
+
313
+ - `--background`, `--foreground`
314
+ - `--primary`, `--primary-foreground`
315
+ - `--secondary`, `--secondary-foreground`
316
+ - `--muted`, `--muted-foreground`
317
+ - `--accent`, `--accent-foreground`
318
+ - `--destructive`, `--destructive-foreground`
319
+ - `--card`, `--card-foreground`
320
+ - `--popover`, `--popover-foreground`
321
+ - `--border`, `--input`, `--ring`
322
+ - `--chart-1` through `--chart-5`
323
+ - `--sidebar-*` variants
324
+
325
+ #### Typography
326
+
327
+ - `--font-sans` (default: Poppins)
328
+ - `--font-serif` (default: Lora)
329
+ - `--font-mono` (default: Fira Code)
330
+
331
+ #### Spacing & Layout
332
+
333
+ - `--radius` (default: 0.4rem)
334
+ - `--spacing` (default: 0.25rem)
335
+ - `--tracking-normal` (default: 0em)
336
+
337
+ #### Shadows
338
+
339
+ - `--shadow-2xs`, `--shadow-xs`, `--shadow-sm`, `--shadow`, `--shadow-md`,
340
+ `--shadow-lg`, `--shadow-xl`, `--shadow-2xl`
341
+ - `--shadow-x`, `--shadow-y`, `--shadow-blur`, `--shadow-spread`,
342
+ `--shadow-opacity`, `--shadow-color`
343
+
344
+ ### Example: Creating a Custom Brand Theme
345
+
346
+ ```css
347
+ /* e.g. src/index.css */
348
+ @import "tailwindcss";
349
+ @import "tw-animate-css";
350
+ @import "@chesapeake/stack/styles/index.css";
351
+
352
+ :root {
353
+ /* Brand colors */
354
+ --primary: oklch(0.65 0.25 250); /* Purple brand */
355
+ --secondary: oklch(0.75 0.15 180); /* Teal accent */
356
+ --accent: oklch(0.85 0.1 300); /* Pink accent */
357
+
358
+ /* Custom background */
359
+ --background: oklch(0.98 0.005 260); /* Very light purple tint */
360
+
361
+ /* Custom fonts */
362
+ --font-sans: "Inter", "system-ui", sans-serif;
363
+ --font-serif: "Crimson Text", serif;
364
+ --font-mono: "SF Mono", "Monaco", monospace;
365
+
366
+ /* Larger border radius for softer look */
367
+ --radius: 0.75rem;
368
+ }
369
+
370
+ .dark {
371
+ /* Dark mode adjustments */
372
+ --primary: oklch(0.75 0.25 250);
373
+ --background: oklch(0.15 0.02 260);
374
+ --secondary: oklch(0.65 0.15 180);
375
+ }
376
+
377
+ /* Custom utility classes for this app */
378
+ .my-app-gradient {
379
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
380
+ }
381
+ ```
382
+
383
+ ### Theming Tips
384
+
385
+ 1. **Always import shared styles first**, then override
386
+ 2. **Use OKLCH color space** for better color interpolation and consistency
387
+ 3. **Test both light and dark modes** when customizing
388
+ 4. **Keep shadow values** unless you want a completely different shadow system
389
+ 5. **Override fonts** if your brand requires different typography
390
+ 6. **Use Tailwind's color utilities** - they automatically use your custom
391
+ variables
392
+
393
+ ### Migrating from an Older Theme
394
+
395
+ If you're migrating from the old theme:
396
+
397
+ 1. Check which variables your project currently uses
398
+ 2. Import `@chesapeake/stack/styles/index.css`
399
+ 3. Override only the variables that need to change
400
+ 4. Test thoroughly in both light and dark modes
401
+
402
+ ### Further Reading
403
+
404
+ - [MDN: CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) -
405
+ Comprehensive guide with examples
406
+ - [CSS Tricks: Custom Properties](https://css-tricks.com/a-complete-guide-to-custom-properties/) -
407
+ In-depth tutorial and best practices
408
+ - [Can I Use: CSS Custom Properties](https://caniuse.com/css-variables) -
409
+ Browser support information
410
+
411
+ ## Project Structure
412
+
413
+ ```
414
+ stack/
415
+ ├── components/
416
+ │ ├── ui/ # Basic UI components (shadcn/ui primitives)
417
+ │ └── ux/ # Complex UX components (auth, layout, feedback)
418
+ ├── styles/
419
+ │ ├── index.css # Main stylesheet entry point
420
+ │ ├── tokens.css # Design tokens and CSS variables
421
+ │ ├── base.css # Base styles and utilities
422
+ │ └── components.css # Component-specific styles
423
+ ├── lib/
424
+ │ └── utils.ts # Utility functions
425
+ ├── types/ # Shared TypeScript types (e.g. user)
426
+ ├── tailwind.preset.ts # Tailwind configuration preset
427
+ ├── index.html # Demo app entry (run npm run dev to preview)
428
+ ├── src/ # Demo app source (showcase components)
429
+ ├── public/ # Demo app static assets
430
+ ├── Makefile # Lint, validate, add_component
431
+ └── package.json # Package configuration and exports
432
+ ```
433
+
434
+ The demo app (`index.html`, `src/`, `public/`) is for local development and
435
+ showcase only; it is not published to npm.
436
+
437
+ # Contributing
438
+
439
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, adding shadcn
440
+ components, and opening PRs.