@codefast/ui 0.3.10 → 0.3.11-canary.1

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 (214) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +277 -167
  3. package/dist/components/accordion.d.ts +4 -4
  4. package/dist/components/accordion.js +5 -5
  5. package/dist/components/alert-dialog.d.ts +11 -11
  6. package/dist/components/alert-dialog.js +9 -9
  7. package/dist/components/alert.d.ts +5 -5
  8. package/dist/components/alert.js +5 -5
  9. package/dist/components/aspect-ratio.d.ts +2 -2
  10. package/dist/components/avatar.d.ts +2 -2
  11. package/dist/components/avatar.js +3 -3
  12. package/dist/components/badge.d.ts +3 -3
  13. package/dist/components/badge.js +7 -7
  14. package/dist/components/breadcrumb.d.ts +8 -8
  15. package/dist/components/breadcrumb.js +6 -8
  16. package/dist/components/button-group.d.ts +5 -5
  17. package/dist/components/button-group.js +8 -8
  18. package/dist/components/button.d.ts +6 -6
  19. package/dist/components/button.js +17 -17
  20. package/dist/components/calendar.d.ts +5 -5
  21. package/dist/components/calendar.js +35 -35
  22. package/dist/components/card.d.ts +8 -8
  23. package/dist/components/card.js +7 -7
  24. package/dist/components/carousel.d.ts +10 -10
  25. package/dist/components/carousel.js +20 -20
  26. package/dist/components/chart.d.ts +12 -11
  27. package/dist/components/chart.js +42 -42
  28. package/dist/components/checkbox-cards.d.ts +2 -2
  29. package/dist/components/checkbox-cards.js +2 -2
  30. package/dist/components/checkbox-group.d.ts +2 -2
  31. package/dist/components/checkbox-group.js +2 -2
  32. package/dist/components/checkbox.d.ts +2 -2
  33. package/dist/components/checkbox.js +1 -1
  34. package/dist/components/collapsible.d.ts +2 -2
  35. package/dist/components/command.d.ts +4 -4
  36. package/dist/components/command.js +10 -10
  37. package/dist/components/context-menu.d.ts +4 -4
  38. package/dist/components/context-menu.js +10 -10
  39. package/dist/components/dialog.d.ts +10 -10
  40. package/dist/components/dialog.js +12 -12
  41. package/dist/components/drawer.d.ts +9 -9
  42. package/dist/components/drawer.js +9 -9
  43. package/dist/components/dropdown-menu.d.ts +4 -4
  44. package/dist/components/dropdown-menu.js +10 -10
  45. package/dist/components/empty.d.ts +9 -9
  46. package/dist/components/empty.js +10 -10
  47. package/dist/components/field.d.ts +14 -14
  48. package/dist/components/field.js +17 -17
  49. package/dist/components/form.d.ts +10 -10
  50. package/dist/components/form.js +8 -8
  51. package/dist/components/hover-card.d.ts +2 -2
  52. package/dist/components/hover-card.js +3 -3
  53. package/dist/components/input-group.d.ts +15 -15
  54. package/dist/components/input-group.js +20 -20
  55. package/dist/components/input-number.d.ts +2 -2
  56. package/dist/components/input-number.js +7 -7
  57. package/dist/components/input-otp.d.ts +6 -6
  58. package/dist/components/input-otp.js +4 -4
  59. package/dist/components/input-password.d.ts +3 -3
  60. package/dist/components/input-password.js +6 -6
  61. package/dist/components/input-search.d.ts +3 -3
  62. package/dist/components/input-search.js +4 -4
  63. package/dist/components/input.d.ts +2 -2
  64. package/dist/components/input.js +1 -1
  65. package/dist/components/item.d.ts +12 -12
  66. package/dist/components/item.js +23 -23
  67. package/dist/components/kbd.d.ts +3 -3
  68. package/dist/components/kbd.js +2 -2
  69. package/dist/components/label.d.ts +2 -2
  70. package/dist/components/label.js +1 -1
  71. package/dist/components/menubar.d.ts +4 -4
  72. package/dist/components/menubar.js +13 -13
  73. package/dist/components/native-select.d.ts +4 -4
  74. package/dist/components/native-select.js +2 -2
  75. package/dist/components/navigation-menu.d.ts +2 -2
  76. package/dist/components/navigation-menu.js +10 -10
  77. package/dist/components/pagination.d.ts +10 -10
  78. package/dist/components/pagination.js +6 -6
  79. package/dist/components/popover.d.ts +3 -3
  80. package/dist/components/popover.js +3 -3
  81. package/dist/components/progress-circle.d.ts +5 -5
  82. package/dist/components/progress-circle.js +22 -22
  83. package/dist/components/progress.d.ts +2 -2
  84. package/dist/components/progress.js +2 -2
  85. package/dist/components/radio-cards.d.ts +2 -2
  86. package/dist/components/radio-cards.js +3 -3
  87. package/dist/components/radio-group.d.ts +2 -2
  88. package/dist/components/radio-group.js +3 -3
  89. package/dist/components/radio.d.ts +2 -2
  90. package/dist/components/radio.js +1 -1
  91. package/dist/components/resizable.d.ts +2 -2
  92. package/dist/components/resizable.js +3 -3
  93. package/dist/components/scroll-area.d.ts +5 -5
  94. package/dist/components/scroll-area.js +31 -31
  95. package/dist/components/select.d.ts +5 -5
  96. package/dist/components/select.js +9 -9
  97. package/dist/components/separator.d.ts +5 -5
  98. package/dist/components/separator.js +9 -9
  99. package/dist/components/sheet.d.ts +9 -9
  100. package/dist/components/sheet.js +17 -17
  101. package/dist/components/sidebar.d.ts +31 -31
  102. package/dist/components/sidebar.js +65 -65
  103. package/dist/components/skeleton.d.ts +2 -2
  104. package/dist/components/skeleton.js +1 -1
  105. package/dist/components/slider.d.ts +2 -2
  106. package/dist/components/slider.js +4 -4
  107. package/dist/components/sonner.d.ts +3 -3
  108. package/dist/components/sonner.js +4 -4
  109. package/dist/components/spinner.d.ts +2 -2
  110. package/dist/components/spinner.js +5 -5
  111. package/dist/components/switch.d.ts +2 -2
  112. package/dist/components/switch.js +2 -2
  113. package/dist/components/table.d.ts +9 -9
  114. package/dist/components/table.js +8 -8
  115. package/dist/components/tabs.d.ts +2 -2
  116. package/dist/components/tabs.js +4 -4
  117. package/dist/components/textarea.d.ts +2 -2
  118. package/dist/components/textarea.js +1 -1
  119. package/dist/components/toggle-group.d.ts +4 -4
  120. package/dist/components/toggle-group.js +5 -5
  121. package/dist/components/toggle.d.ts +3 -3
  122. package/dist/components/toggle.js +8 -8
  123. package/dist/components/tooltip.d.ts +3 -3
  124. package/dist/components/tooltip.js +2 -2
  125. package/dist/css/preset.css +4 -4
  126. package/dist/css/style.css +3 -3
  127. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
  128. package/dist/hooks/use-copy-to-clipboard.js +1 -1
  129. package/dist/hooks/use-media-query.js +3 -3
  130. package/dist/hooks/use-mutation-observer.d.ts +1 -1
  131. package/dist/hooks/use-pagination.js +1 -1
  132. package/dist/index.d.ts +130 -130
  133. package/dist/primitives/checkbox-group.d.ts +11 -11
  134. package/dist/primitives/checkbox-group.js +3 -3
  135. package/dist/primitives/input-number.d.ts +8 -8
  136. package/dist/primitives/input-number.js +46 -46
  137. package/dist/primitives/input.d.ts +4 -4
  138. package/dist/primitives/input.js +7 -7
  139. package/dist/primitives/progress-circle.d.ts +7 -7
  140. package/dist/primitives/progress-circle.js +8 -8
  141. package/package.json +111 -189
  142. package/dist/components/accordion.cjs +0 -98
  143. package/dist/components/alert-dialog.cjs +0 -156
  144. package/dist/components/alert.cjs +0 -84
  145. package/dist/components/aspect-ratio.cjs +0 -44
  146. package/dist/components/avatar.cjs +0 -66
  147. package/dist/components/badge.cjs +0 -67
  148. package/dist/components/breadcrumb.cjs +0 -127
  149. package/dist/components/button-group.cjs +0 -87
  150. package/dist/components/button.cjs +0 -92
  151. package/dist/components/calendar.cjs +0 -151
  152. package/dist/components/card.cjs +0 -105
  153. package/dist/components/carousel.cjs +0 -211
  154. package/dist/components/chart.cjs +0 -251
  155. package/dist/components/checkbox-cards.cjs +0 -70
  156. package/dist/components/checkbox-group.cjs +0 -64
  157. package/dist/components/checkbox.cjs +0 -54
  158. package/dist/components/collapsible.cjs +0 -62
  159. package/dist/components/command.cjs +0 -168
  160. package/dist/components/context-menu.cjs +0 -219
  161. package/dist/components/dialog.cjs +0 -165
  162. package/dist/components/drawer.cjs +0 -144
  163. package/dist/components/dropdown-menu.cjs +0 -222
  164. package/dist/components/empty.cjs +0 -113
  165. package/dist/components/field.cjs +0 -194
  166. package/dist/components/form.cjs +0 -152
  167. package/dist/components/hover-card.cjs +0 -78
  168. package/dist/components/input-group.cjs +0 -156
  169. package/dist/components/input-number.cjs +0 -99
  170. package/dist/components/input-otp.cjs +0 -102
  171. package/dist/components/input-password.cjs +0 -72
  172. package/dist/components/input-search.cjs +0 -81
  173. package/dist/components/input.cjs +0 -46
  174. package/dist/components/item.cjs +0 -186
  175. package/dist/components/kbd.cjs +0 -54
  176. package/dist/components/label.cjs +0 -46
  177. package/dist/components/menubar.cjs +0 -233
  178. package/dist/components/native-select.cjs +0 -75
  179. package/dist/components/navigation-menu.cjs +0 -146
  180. package/dist/components/pagination.cjs +0 -138
  181. package/dist/components/popover.cjs +0 -87
  182. package/dist/components/progress-circle.cjs +0 -185
  183. package/dist/components/progress.cjs +0 -53
  184. package/dist/components/radio-cards.cjs +0 -67
  185. package/dist/components/radio-group.cjs +0 -60
  186. package/dist/components/radio.cjs +0 -48
  187. package/dist/components/resizable.cjs +0 -72
  188. package/dist/components/scroll-area.cjs +0 -141
  189. package/dist/components/select.cjs +0 -181
  190. package/dist/components/separator.cjs +0 -83
  191. package/dist/components/sheet.cjs +0 -185
  192. package/dist/components/sidebar.cjs +0 -507
  193. package/dist/components/skeleton.cjs +0 -44
  194. package/dist/components/slider.cjs +0 -80
  195. package/dist/components/sonner.cjs +0 -58
  196. package/dist/components/spinner.cjs +0 -76
  197. package/dist/components/switch.cjs +0 -50
  198. package/dist/components/table.cjs +0 -118
  199. package/dist/components/tabs.cjs +0 -76
  200. package/dist/components/textarea.cjs +0 -44
  201. package/dist/components/toggle-group.cjs +0 -91
  202. package/dist/components/toggle.cjs +0 -72
  203. package/dist/components/tooltip.cjs +0 -91
  204. package/dist/hooks/use-animated-value.cjs +0 -75
  205. package/dist/hooks/use-copy-to-clipboard.cjs +0 -58
  206. package/dist/hooks/use-is-mobile.cjs +0 -40
  207. package/dist/hooks/use-media-query.cjs +0 -57
  208. package/dist/hooks/use-mutation-observer.cjs +0 -57
  209. package/dist/hooks/use-pagination.cjs +0 -93
  210. package/dist/index.cjs +0 -1081
  211. package/dist/primitives/checkbox-group.cjs +0 -151
  212. package/dist/primitives/input-number.cjs +0 -439
  213. package/dist/primitives/input.cjs +0 -99
  214. package/dist/primitives/progress-circle.cjs +0 -199
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @codefast/ui
2
2
 
3
+ ## 0.3.11-canary.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dd5130a`](https://github.com/codefastlabs/codefast/commit/dd5130adb5649dca6773614ffda262cdde732d8f) Thanks [@thevuong](https://github.com/thevuong)! - chore(deps): downgrade @rslib/core to 0.19.1 in package.json and pnpm-lock.yaml
8
+
9
+ - [`42758ab`](https://github.com/codefastlabs/codefast/commit/42758ab9d8f548ea9f4a806a7dbb7ed295fe2390) Thanks [@thevuong](https://github.com/thevuong)! - chore: update package configurations and TypeScript settings
10
+
11
+ - [`d2abc63`](https://github.com/codefastlabs/codefast/commit/d2abc636245526ec402811d8585d93684865dde6) Thanks [@thevuong](https://github.com/thevuong)! - chore(deps): update package versions and configurations
12
+
13
+ - Updated dependencies [[`dd5130a`](https://github.com/codefastlabs/codefast/commit/dd5130adb5649dca6773614ffda262cdde732d8f), [`42758ab`](https://github.com/codefastlabs/codefast/commit/42758ab9d8f548ea9f4a806a7dbb7ed295fe2390), [`d2abc63`](https://github.com/codefastlabs/codefast/commit/d2abc636245526ec402811d8585d93684865dde6), [`49df885`](https://github.com/codefastlabs/codefast/commit/49df8854d51bad598381be68b6e41096e7da814c)]:
14
+ - @codefast/tailwind-variants@0.3.11-canary.1
15
+
16
+ ## 0.3.11-canary.0
17
+
18
+ ### Patch Changes
19
+
20
+ - [`bec9cfa`](https://github.com/codefastlabs/codefast/commit/bec9cfab879d59c877db130eb2c2522b1453bc8f) Thanks [@thevuong](https://github.com/thevuong)! - refactor(theme): reorganize imports for improved readability
21
+
22
+ - [`135c6be`](https://github.com/codefastlabs/codefast/commit/135c6bed9d1bc1e96bad3173adab1bf32d74322f) Thanks [@thevuong](https://github.com/thevuong)! - chore: update linting and formatting scripts in package.json
23
+
24
+ - [`610cf7a`](https://github.com/codefastlabs/codefast/commit/610cf7a7f9b6e5b37be21e7675ea363ef1020639) Thanks [@thevuong](https://github.com/thevuong)! - fix(hooks): handle missing `navigator.clipboard.writeText` gracefully
25
+
26
+ - [`b1d23c2`](https://github.com/codefastlabs/codefast/commit/b1d23c27dffff6686193e3cbb3f848970e253493) Thanks [@thevuong](https://github.com/thevuong)! - refactor(chart): update ChartTooltip types for improved compatibility
27
+
28
+ - [`3e90474`](https://github.com/codefastlabs/codefast/commit/3e90474fbbb9f8ac626c5949bfdbac2eaf1cb3e8) Thanks [@thevuong](https://github.com/thevuong)! - chore: update project configuration and dependencies
29
+
30
+ - [`5c09d4c`](https://github.com/codefastlabs/codefast/commit/5c09d4ce2df564dc7ac6727b00cfa668164a1af4) Thanks [@thevuong](https://github.com/thevuong)! - refactor(config): rename `check-types` to `typecheck` and update usage
31
+
32
+ - Updated dependencies [[`135c6be`](https://github.com/codefastlabs/codefast/commit/135c6bed9d1bc1e96bad3173adab1bf32d74322f), [`610cf7a`](https://github.com/codefastlabs/codefast/commit/610cf7a7f9b6e5b37be21e7675ea363ef1020639), [`3e90474`](https://github.com/codefastlabs/codefast/commit/3e90474fbbb9f8ac626c5949bfdbac2eaf1cb3e8), [`5c09d4c`](https://github.com/codefastlabs/codefast/commit/5c09d4ce2df564dc7ac6727b00cfa668164a1af4)]:
33
+ - @codefast/tailwind-variants@0.3.11-canary.0
34
+
3
35
  ## 0.3.10
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -1,17 +1,49 @@
1
- # UI Components Library
1
+ # @codefast/ui
2
2
 
3
3
  Core UI components library built with React, Tailwind CSS, and Radix UI for creating modern, accessible, and customizable user interfaces with a comprehensive design system.
4
4
 
5
5
  [![CI](https://github.com/codefastlabs/codefast/actions/workflows/release.yml/badge.svg)](https://github.com/codefastlabs/codefast/actions/workflows/release.yml)
6
- [![NPM Version](https://img.shields.io/npm/v/@codefast/ui.svg)](https://www.npmjs.com/package/@codefast/ui)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
- [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green.svg)](https://nodejs.org/)
9
- [![pnpm](https://img.shields.io/badge/pnpm-10%2B-blue.svg)](https://pnpm.io/)
6
+ [![npm version](https://img.shields.io/npm/v/@codefast/ui.svg)](https://www.npmjs.com/package/@codefast/ui)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@codefast/ui.svg)](https://www.npmjs.com/package/@codefast/ui)
8
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@codefast/ui)](https://bundlephobia.com/package/@codefast/ui)
9
+ [![license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+
11
+ ## Table of Contents
12
+
13
+ - [Overview](#overview)
14
+ - [Installation](#installation)
15
+ - [Styling Integration](#styling-integration)
16
+ - [SSR with Nitro (TanStack Start)](#ssr-with-nitro-tanstack-start)
17
+ - [Quick Start](#quick-start)
18
+ - [Components](#components)
19
+ - [Layout](#layout)
20
+ - [Form](#form)
21
+ - [Navigation](#navigation)
22
+ - [Overlay](#overlay)
23
+ - [Data Display](#data-display)
24
+ - [Usage Examples](#usage-examples)
25
+ - [Theming and Customization](#theming-and-customization)
26
+ - [API Reference](#api-reference)
27
+ - [Accessibility](#accessibility)
28
+ - [Browser Compatibility](#browser-compatibility)
29
+ - [Contributing](#contributing)
30
+ - [License](#license)
31
+ - [Changelog](#changelog)
32
+
33
+ ## Overview
34
+
35
+ `@codefast/ui` provides **60+ accessible components** for building production-grade user interfaces. Every component is built on [Radix UI](https://radix-ui.com/) primitives, styled with [Tailwind CSS 4](https://tailwindcss.com/), and fully typed with TypeScript.
36
+
37
+ **Key features:**
38
+
39
+ - **60+ Components** -- Layout, form, navigation, overlay, and data display categories.
40
+ - **Accessible by Default** -- WAI-ARIA compliant with keyboard navigation and screen reader support.
41
+ - **Fully Typed** -- Complete TypeScript definitions for all components and props.
42
+ - **Customizable** -- Extend styles with Tailwind CSS utility classes or Tailwind Variants.
43
+ - **Tree-shakeable** -- Import only the components you use.
10
44
 
11
45
  ## Installation
12
46
 
13
- Install the component library via pnpm (recommended):
14
-
15
47
  ```bash
16
48
  pnpm add @codefast/ui
17
49
  ```
@@ -22,31 +54,161 @@ Or using npm:
22
54
  npm install @codefast/ui
23
55
  ```
24
56
 
25
- **Peer Dependencies**:
26
-
27
- Make sure you have installed the peer dependencies:
57
+ **Peer dependencies:**
28
58
 
29
59
  ```bash
30
60
  pnpm add react react-dom
31
61
  pnpm add -D @types/react @types/react-dom
32
62
  ```
33
63
 
34
- **Styling**:
64
+ **Requirements:**
65
+
66
+ - Node.js >= 24.0.0 (LTS)
67
+ - React >= 19.0.0
68
+ - TypeScript >= 5.9.2 (recommended)
69
+ - Tailwind CSS 4.x (for styling)
70
+
71
+ ## Styling Integration
72
+
73
+ `@codefast/ui` requires CSS styles to render correctly. Choose one of the following approaches based on your project setup.
35
74
 
36
- Import the CSS styles in your application:
75
+ ### Option 1: Project Already Uses Tailwind CSS (Recommended)
76
+
77
+ If your project already has Tailwind CSS 4.x configured (e.g. Vite, Next.js, TanStack Start), import only the **theme variables** and **preset** to avoid duplicate Tailwind output:
78
+
79
+ **1. In your main CSS file** (e.g. `src/styles.css` or `src/index.css`):
80
+
81
+ ```css
82
+ @import "tailwindcss";
83
+
84
+ /* @codefast/ui – theme variables & preset (must come after tailwindcss) */
85
+ @import "@codefast/ui/css/slate.css";
86
+ @import "@codefast/ui/css/preset.css";
87
+ ```
88
+
89
+ **2. Select a theme.** Available themes (replace `slate` with any below):
90
+
91
+ | Theme | Import Path |
92
+ | ------- | ------------------------------ |
93
+ | slate | `@codefast/ui/css/slate.css` |
94
+ | gray | `@codefast/ui/css/gray.css` |
95
+ | zinc | `@codefast/ui/css/zinc.css` |
96
+ | neutral | `@codefast/ui/css/neutral.css` |
97
+ | stone | `@codefast/ui/css/stone.css` |
98
+ | red | `@codefast/ui/css/red.css` |
99
+ | orange | `@codefast/ui/css/orange.css` |
100
+ | amber | `@codefast/ui/css/amber.css` |
101
+ | yellow | `@codefast/ui/css/yellow.css` |
102
+ | lime | `@codefast/ui/css/lime.css` |
103
+ | green | `@codefast/ui/css/green.css` |
104
+ | emerald | `@codefast/ui/css/emerald.css` |
105
+ | teal | `@codefast/ui/css/teal.css` |
106
+ | cyan | `@codefast/ui/css/cyan.css` |
107
+ | sky | `@codefast/ui/css/sky.css` |
108
+ | blue | `@codefast/ui/css/blue.css` |
109
+ | indigo | `@codefast/ui/css/indigo.css` |
110
+ | violet | `@codefast/ui/css/violet.css` |
111
+ | purple | `@codefast/ui/css/purple.css` |
112
+ | fuchsia | `@codefast/ui/css/fuchsia.css` |
113
+ | pink | `@codefast/ui/css/pink.css` |
114
+ | rose | `@codefast/ui/css/rose.css` |
115
+
116
+ **3. Dark mode.** All themes include light/dark variants. Add the `.dark` class to `<html>` or `<body>` to enable dark mode:
37
117
 
38
118
  ```tsx
39
- import "@codefast/ui/styles.css";
119
+ // Example: toggle dark mode
120
+ document.documentElement.classList.toggle("dark", isDark);
40
121
  ```
41
122
 
42
- **Requirements**:
123
+ ### Option 2: Standalone (No Existing Tailwind)
124
+
125
+ If your project does **not** use Tailwind yet, import the full stylesheet (includes Tailwind + theme + preset):
126
+
127
+ ```tsx
128
+ // In your app entry (e.g. main.tsx, _app.tsx)
129
+ import "@codefast/ui/css/style.css";
130
+ ```
131
+
132
+ > **Note:** This bundles Tailwind CSS. Ensure your build tool (Vite, webpack, etc.) can process CSS `@import`. You may need `@tailwindcss/vite` or `@tailwindcss/postcss` in devDependencies.
133
+
134
+ ### Option 3: Framework-Specific Setup
135
+
136
+ **Vite (with `@tailwindcss/vite`):**
137
+
138
+ ```css
139
+ /* src/styles.css */
140
+ @import "tailwindcss";
141
+ @import "@codefast/ui/css/slate.css";
142
+ @import "@codefast/ui/css/preset.css";
143
+ ```
144
+
145
+ **Next.js (App Router):**
146
+
147
+ ```css
148
+ /* app/globals.css */
149
+ @import "tailwindcss";
150
+ @import "@codefast/ui/css/slate.css";
151
+ @import "@codefast/ui/css/preset.css";
152
+ ```
153
+
154
+ **TanStack Start:**
155
+
156
+ ```css
157
+ /* src/styles.css */
158
+ @import "tailwindcss";
159
+ @import "@codefast/ui/css/slate.css";
160
+ @import "@codefast/ui/css/preset.css";
161
+ ```
162
+
163
+ #### SSR with Nitro (TanStack Start)
164
+
165
+ When deploying with [Nitro](https://v3.nitro.build/) (Vercel, self-host Node.js, etc.), add this to your `vite.config.ts` to avoid a Rolldown CJS→ESM interop error with `tslib` (used by Radix UI):
166
+
167
+ ```ts
168
+ // vite.config.ts
169
+ import { defineConfig } from "vite";
170
+
171
+ export default defineConfig({
172
+ resolve: {
173
+ alias: {
174
+ // Workaround: Rolldown mishandles tslib CJS; force ESM to avoid SSR 500.
175
+ tslib: "tslib/tslib.es6.mjs",
176
+ },
177
+ },
178
+ // ... other config
179
+ });
180
+ ```
181
+
182
+ **Symptom without this:** `TypeError: Cannot destructure property '__extends' of '__toESM(...).default' as it is undefined` when serving SSR pages.
183
+
184
+ ### Troubleshooting
185
+
186
+ | Issue | Solution |
187
+ | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
188
+ | Components look unstyled | Ensure CSS imports run before any component renders (entry point first). |
189
+ | Duplicate Tailwind CSS | Use Option 1 (theme + preset only), **not** `style.css`. |
190
+ | Dark mode not working | Add `class="dark"` to `<html>` when dark mode is active. |
191
+ | Build: CSS not found | Verify path: `@codefast/ui/css/[theme].css` (e.g. `slate.css`). |
192
+ | SSR 500: `Cannot destructure property '__extends'` | Add `resolve.alias: { tslib: 'tslib/tslib.es6.mjs' }` in `vite.config.ts` (see [SSR with Nitro](#ssr-with-nitro-tanstack-start)). |
193
+
194
+ ### Customizing Theme
195
+
196
+ Override CSS variables in your own CSS after imports:
197
+
198
+ ```css
199
+ @import "@codefast/ui/css/slate.css";
200
+ @import "@codefast/ui/css/preset.css";
43
201
 
44
- - Node.js version 20.0.0 or higher
45
- - React version 19.0.0 or higher
46
- - TypeScript version 5.9.2 or higher (recommended)
202
+ :root {
203
+ --radius: 0.5rem; /* Increase border radius */
204
+ --primary: oklch(0.4 0.2 260); /* Custom primary color */
205
+ }
206
+ ```
47
207
 
48
208
  ## Quick Start
49
209
 
210
+ After integrating styles (see [Styling Integration](#styling-integration)), import and use components:
211
+
50
212
  ```tsx
51
213
  import { Button, Card, CardContent, CardHeader, CardTitle } from "@codefast/ui";
52
214
 
@@ -67,58 +229,63 @@ function App() {
67
229
  }
68
230
  ```
69
231
 
70
- ## Usage
71
-
72
- ### Components Overview
73
-
74
- The library provides a comprehensive set of components organized into categories:
232
+ ## Components
75
233
 
76
- #### Layout Components
234
+ ### Layout
77
235
 
78
- - **Box**: Flexible container component
79
- - **Card**: Content containers with header, content, and footer sections
80
- - **Separator**: Visual dividers between content sections
81
- - **AspectRatio**: Maintain consistent aspect ratios for content
236
+ | Component | Description |
237
+ | ----------- | ----------------------------------------------------------- |
238
+ | Card | Content container with header, content, and footer sections |
239
+ | Separator | Visual divider between content sections |
240
+ | AspectRatio | Maintain consistent aspect ratios for media content |
82
241
 
83
- #### Form Components
242
+ ### Form
84
243
 
85
- - **Button**: Interactive buttons with various styles and sizes
86
- - **Input**: Text input fields with validation support
87
- - **Checkbox**: Individual checkboxes and checkbox groups
88
- - **RadioGroup**: Radio button groups for single selection
89
- - **Select**: Dropdown selection components
90
- - **Switch**: Toggle switches for boolean values
91
- - **Slider**: Range input sliders
92
- - **Label**: Form labels with accessibility features
244
+ | Component | Description |
245
+ | ---------- | --------------------------------------------------- |
246
+ | Button | Interactive button with multiple variants and sizes |
247
+ | Input | Text input with validation support |
248
+ | Checkbox | Individual checkbox and checkbox groups |
249
+ | RadioGroup | Radio button group for single selection |
250
+ | Select | Dropdown selection component |
251
+ | Switch | Toggle switch for boolean values |
252
+ | Slider | Range input slider |
253
+ | Label | Form label with accessibility features |
93
254
 
94
- #### Navigation Components
255
+ ### Navigation
95
256
 
96
- - **Breadcrumb**: Navigation breadcrumbs
97
- - **NavigationMenu**: Complex navigation menus
98
- - **Menubar**: Application menu bars
99
- - **Tabs**: Tabbed interfaces
257
+ | Component | Description |
258
+ | -------------- | -------------------------------------- |
259
+ | Breadcrumb | Navigation breadcrumb trail |
260
+ | NavigationMenu | Complex navigation menus with submenus |
261
+ | Menubar | Application menu bar |
262
+ | Tabs | Tabbed interface with content panels |
100
263
 
101
- #### Overlay Components
264
+ ### Overlay
102
265
 
103
- - **Dialog**: Modal dialogs and popups
104
- - **AlertDialog**: Confirmation and alert dialogs
105
- - **Popover**: Contextual popovers
106
- - **Tooltip**: Informational tooltips
107
- - **HoverCard**: Rich hover cards with content
266
+ | Component | Description |
267
+ | ----------- | ------------------------------------ |
268
+ | Dialog | Modal dialog and popup |
269
+ | AlertDialog | Confirmation and alert dialog |
270
+ | Popover | Contextual popover |
271
+ | Tooltip | Informational tooltip |
272
+ | HoverCard | Rich hover card with preview content |
108
273
 
109
- #### Data Display Components
274
+ ### Data Display
110
275
 
111
- - **Avatar**: User profile images and fallbacks
112
- - **Badge**: Status indicators and labels
113
- - **Alert**: System messages and notifications
114
- - **Progress**: Progress indicators
115
- - **Accordion**: Expandable content sections
116
- - **Calendar**: Date selection calendars
117
- - **Carousel**: Content carousels and sliders
276
+ | Component | Description |
277
+ | --------- | -------------------------------- |
278
+ | Avatar | User profile image with fallback |
279
+ | Badge | Status indicator and label |
280
+ | Alert | System message and notification |
281
+ | Progress | Progress indicator |
282
+ | Accordion | Expandable content sections |
283
+ | Calendar | Date selection calendar |
284
+ | Carousel | Content carousel and slider |
118
285
 
119
- ### Basic Component Usage
286
+ ## Usage Examples
120
287
 
121
- #### Using Form Components
288
+ ### Form Components
122
289
 
123
290
  ```tsx
124
291
  import { Button, Input, Label, Card, CardContent, CardHeader, CardTitle } from "@codefast/ui";
@@ -150,7 +317,7 @@ function ContactForm() {
150
317
  }
151
318
  ```
152
319
 
153
- #### Using Navigation Components
320
+ ### Navigation Components
154
321
 
155
322
  ```tsx
156
323
  import { Tabs, TabsContent, TabsList, TabsTrigger } from "@codefast/ui";
@@ -173,7 +340,7 @@ function TabExample() {
173
340
  }
174
341
  ```
175
342
 
176
- #### Using Overlay Components
343
+ ### Overlay Components
177
344
 
178
345
  ```tsx
179
346
  import {
@@ -206,21 +373,13 @@ function DialogExample() {
206
373
  }
207
374
  ```
208
375
 
209
- ### Theming and Customization
376
+ ## Theming and Customization
210
377
 
211
- The library uses Tailwind CSS for styling and supports theme customization:
378
+ All components use CSS custom properties (`--primary`, `--background`, `--radius`, etc.). You can:
212
379
 
213
- ```tsx
214
- import { ThemeProvider } from "next-themes";
215
-
216
- function App() {
217
- return (
218
- <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
219
- <div className="bg-background text-foreground min-h-screen">{/* Your app content */}</div>
220
- </ThemeProvider>
221
- );
222
- }
223
- ```
380
+ 1. **Switch themes** — Import a different theme file (e.g. `zinc.css` instead of `slate.css`).
381
+ 2. **Override variables** Define your own values in `:root` or `.dark` after imports (see [Customizing Theme](#customizing-theme)).
382
+ 3. **Use a theme provider** — For system/light/dark switching, add/remove `dark` class on `<html>`; many apps use `next-themes` or similar for persistence.
224
383
 
225
384
  ## API Reference
226
385
 
@@ -231,99 +390,71 @@ Most components accept these common props:
231
390
  | Prop | Type | Default | Description |
232
391
  | ----------- | ----------------- | ----------- | ---------------------- |
233
392
  | `className` | `string` | `undefined` | Additional CSS classes |
234
- | `children` | `React.ReactNode` | `undefined` | Child components |
235
-
236
- ### Component Categories
393
+ | `children` | `React.ReactNode` | `undefined` | Child elements |
237
394
 
238
- #### Layout Components
239
-
240
- - **Box**: `BoxProps` - Flexible container with layout utilities
241
- - **Card**: `CardProps` - Content container with sections
242
- - **Separator**: `SeparatorProps` - Visual divider element
243
- - **AspectRatio**: `AspectRatioProps` - Aspect ratio container
395
+ ### TypeScript Support
244
396
 
245
- #### Form Components
397
+ All components export their prop types for use in custom wrappers:
246
398
 
247
- - **Button**: `ButtonProps` - Interactive button with variants
248
- - **Input**: `InputProps` - Text input with validation
249
- - **Label**: `LabelProps` - Form label with accessibility
250
- - **Checkbox**: `CheckboxProps` - Boolean input control
251
- - **RadioGroup**: `RadioGroupProps` - Single selection group
252
- - **Select**: `SelectProps` - Dropdown selection
253
- - **Switch**: `SwitchProps` - Boolean toggle control
254
- - **Slider**: `SliderProps` - Range input control
399
+ ```tsx
400
+ import type { ButtonProps, CardProps, InputProps } from "@codefast/ui";
255
401
 
256
- #### Navigation Components
402
+ function MyCustomButton(props: ButtonProps) {
403
+ return <Button {...props} />;
404
+ }
405
+ ```
257
406
 
258
- - **Tabs**: `TabsProps` - Tabbed interface container
259
- - **NavigationMenu**: `NavigationMenuProps` - Complex navigation
260
- - **Breadcrumb**: `BreadcrumbProps` - Navigation breadcrumbs
261
- - **Menubar**: `MenubarProps` - Application menu bar
407
+ ### Component Prop Types
262
408
 
263
- #### Overlay Components
409
+ **Layout:** `CardProps`, `SeparatorProps`, `AspectRatioProps`
264
410
 
265
- - **Dialog**: `DialogProps` - Modal dialog container
266
- - **AlertDialog**: `AlertDialogProps` - Confirmation dialog
267
- - **Popover**: `PopoverProps` - Contextual overlay
268
- - **Tooltip**: `TooltipProps` - Informational overlay
269
- - **HoverCard**: `HoverCardProps` - Rich content overlay
411
+ **Form:** `ButtonProps`, `InputProps`, `LabelProps`, `CheckboxProps`, `RadioGroupProps`, `SelectProps`, `SwitchProps`, `SliderProps`
270
412
 
271
- ### TypeScript Support
413
+ **Navigation:** `TabsProps`, `NavigationMenuProps`, `BreadcrumbProps`, `MenubarProps`
272
414
 
273
- All components are fully typed with TypeScript. Import types alongside components:
415
+ **Overlay:** `DialogProps`, `AlertDialogProps`, `PopoverProps`, `TooltipProps`, `HoverCardProps`
274
416
 
275
- ```tsx
276
- import type { ButtonProps, CardProps, InputProps, ComponentProps } from "@codefast/ui";
417
+ ## Accessibility
277
418
 
278
- // Component props are fully typed using ComponentProps
279
- function MyButton(props: ComponentProps<typeof Button>) {
280
- return <Button {...props} />;
281
- }
419
+ All components follow [WAI-ARIA](https://www.w3.org/WAI/ARIA/apg/) guidelines and provide:
282
420
 
283
- // Alternative using ButtonProps
284
- function MyCustomButton(props: ButtonProps) {
285
- return <Button {...props} />;
286
- }
287
- ```
421
+ - **Keyboard Navigation** -- Full keyboard support for all interactive elements.
422
+ - **Screen Reader Support** -- Proper ARIA labels and descriptions.
423
+ - **Focus Management** -- Logical focus order and visible focus indicators.
424
+ - **High Contrast** -- Support for high contrast themes.
425
+ - **Reduced Motion** -- Respects the `prefers-reduced-motion` media query.
288
426
 
289
- ### Accessibility Features
427
+ ### Keyboard Shortcuts
290
428
 
291
- All components follow WAI-ARIA guidelines and provide:
429
+ | Key | Action |
430
+ | ------------------- | ------------------------------------- |
431
+ | `Tab` / `Shift+Tab` | Navigate between focusable elements |
432
+ | `Enter` / `Space` | Activate buttons and controls |
433
+ | `Arrow Keys` | Navigate within component groups |
434
+ | `Escape` | Close overlays and cancel actions |
435
+ | `Home` / `End` | Navigate to first/last items in lists |
292
436
 
293
- - **Keyboard Navigation**: Full keyboard support for all interactive elements
294
- - **Screen Reader Support**: Proper ARIA labels and descriptions
295
- - **Focus Management**: Logical focus order and visual indicators
296
- - **High Contrast**: Support for high contrast themes
297
- - **Reduced Motion**: Respects user's motion preferences
437
+ ## Browser Compatibility
298
438
 
299
- #### Keyboard Navigation
439
+ `@codefast/ui` supports all modern browsers:
300
440
 
301
- Common keyboard shortcuts across components:
441
+ | Browser | Version |
442
+ | ------- | --------------- |
443
+ | Chrome | Last 2 versions |
444
+ | Firefox | Last 2 versions |
445
+ | Safari | Last 2 versions |
446
+ | Edge | Last 2 versions |
302
447
 
303
- - **Tab/Shift+Tab**: Navigate between focusable elements
304
- - **Enter/Space**: Activate buttons and controls
305
- - **Arrow Keys**: Navigate within component groups
306
- - **Escape**: Close overlays and cancel actions
307
- - **Home/End**: Navigate to first/last items in lists
448
+ > Internet Explorer is not supported.
308
449
 
309
450
  ## Contributing
310
451
 
311
- We welcome all contributions! To get started with development:
452
+ We welcome contributions! Please see the [contributing guide](../../README.md#contributing) in the root of this repository for detailed instructions.
312
453
 
313
- ### Environment Setup
314
-
315
- 1. Fork this repository
316
- 2. Clone to your machine: `git clone <your-fork-url>`
317
- 3. Install dependencies: `pnpm install`
318
- 4. Create a new branch: `git checkout -b feature/feature-name`
319
-
320
- ### Development Workflow
454
+ For package-specific development:
321
455
 
322
456
  ```bash
323
- # Build all packages
324
- pnpm build:packages
325
-
326
- # Development mode for UI components
457
+ # Development mode
327
458
  pnpm dev --filter=@codefast/ui
328
459
 
329
460
  # Run tests
@@ -331,41 +462,20 @@ pnpm test --filter=@codefast/ui
331
462
 
332
463
  # Run tests with coverage
333
464
  pnpm test:coverage --filter=@codefast/ui
334
-
335
- # Lint and format
336
- pnpm lint:fix
337
- pnpm format
338
465
  ```
339
466
 
340
467
  ### Adding New Components
341
468
 
342
- 1. Create component files in `src/components/[component-name]/`
343
- 2. Export component and types from `src/index.ts`
344
- 3. Add comprehensive tests
345
- 4. Update documentation
346
- 5. Submit a pull request
469
+ 1. Create component files in `src/components/[component-name]/`.
470
+ 2. Export the component and types from the package entry point.
471
+ 3. Add comprehensive tests.
472
+ 4. Update documentation.
473
+ 5. Submit a pull request.
347
474
 
348
475
  ## License
349
476
 
350
477
  Distributed under the MIT License. See [LICENSE](../../LICENSE) for more details.
351
478
 
352
- ## Contact
353
-
354
- - npm: [@codefast/ui](https://www.npmjs.com/package/@codefast/ui)
355
- - GitHub: [codefastlabs/codefast](https://github.com/codefastlabs/codefast)
356
- - Issues: [GitHub Issues](https://github.com/codefastlabs/codefast/issues)
357
- - Documentation: [Component Docs](https://codefast.dev/docs/components)
358
-
359
- ## Acknowledgments
360
-
361
- This library is built on top of excellent open-source projects:
362
-
363
- - **[Radix UI](https://radix-ui.com/)** - Accessible component primitives
364
- - **[Tailwind CSS](https://tailwindcss.com/)** - Utility-first CSS framework
365
- - **[Lucide React](https://lucide.dev/)** - Icon library
366
- - **[React Hook Form](https://react-hook-form.com/)** - Form validation
367
- - **[Next Themes](https://github.com/pacocoursey/next-themes)** - Theme management
368
-
369
479
  ## Changelog
370
480
 
371
481
  See [CHANGELOG.md](./CHANGELOG.md) for a complete list of changes and version history.
@@ -1,6 +1,6 @@
1
- import type { ComponentProps, JSX } from 'react';
2
- import * as AccordionPrimitive from '@radix-ui/react-accordion';
3
- import { Slot } from '@radix-ui/react-slot';
1
+ import type { ComponentProps, JSX } from "react";
2
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
+ import { Slot } from "@radix-ui/react-slot";
4
4
  type AccordionProps = ComponentProps<typeof AccordionPrimitive.Root>;
5
5
  declare function Accordion({ ...props }: AccordionProps): JSX.Element;
6
6
  type AccordionItemProps = ComponentProps<typeof AccordionPrimitive.Item>;
@@ -15,4 +15,4 @@ declare function AccordionTrigger({ children, className, ...props }: AccordionTr
15
15
  type AccordionContentProps = ComponentProps<typeof AccordionPrimitive.Content>;
16
16
  declare function AccordionContent({ children, className, ...props }: AccordionContentProps): JSX.Element;
17
17
  export { Accordion, AccordionContent, AccordionIcon, AccordionItem, AccordionTrigger };
18
- export type { AccordionContentProps, AccordionIconProps, AccordionItemProps, AccordionProps, AccordionTriggerProps };
18
+ export type { AccordionContentProps, AccordionIconProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, };
@@ -12,7 +12,7 @@ function Accordion({ ...props }) {
12
12
  }
13
13
  function AccordionItem({ className, ...props }) {
14
14
  return /*#__PURE__*/ jsx(Item, {
15
- className: cn('border-b last:border-b-0', className),
15
+ className: cn("border-b last:border-b-0", className),
16
16
  "data-slot": "accordion-item",
17
17
  ...props
18
18
  });
@@ -21,7 +21,7 @@ function AccordionIcon({ asChild, className, ...props }) {
21
21
  const Component = asChild ? Slot : ChevronDownIcon;
22
22
  return /*#__PURE__*/ jsx(Component, {
23
23
  "aria-hidden": true,
24
- className: cn('text-muted-foreground size-4 shrink-0 translate-y-0.5 transition-transform duration-200', className),
24
+ className: cn("size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200", className),
25
25
  "data-slot": "accordion-icon",
26
26
  ...props
27
27
  });
@@ -31,7 +31,7 @@ function AccordionTrigger({ children, className, ...props }) {
31
31
  className: "flex",
32
32
  "data-slot": "accordion-trigger-wrapper",
33
33
  children: /*#__PURE__*/ jsx(Trigger, {
34
- className: cn('focus-visible:ring-ring/50 group/accordion-trigger flex grow items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-hidden hover:not-disabled:underline focus-visible:ring-3 disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className),
34
+ className: cn("group/accordion-trigger flex grow items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-hidden hover:not-disabled:underline focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 [&[data-state=open]>svg]:rotate-180", className),
35
35
  "data-slot": "accordion-trigger",
36
36
  ...props,
37
37
  children: children
@@ -40,11 +40,11 @@ function AccordionTrigger({ children, className, ...props }) {
40
40
  }
41
41
  function AccordionContent({ children, className, ...props }) {
42
42
  return /*#__PURE__*/ jsx(Content, {
43
- className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
43
+ className: "overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
44
44
  "data-slot": "accordion-content",
45
45
  ...props,
46
46
  children: /*#__PURE__*/ jsx("div", {
47
- className: cn('pt-0 pb-4 text-sm', className),
47
+ className: cn("pt-0 pb-4 text-sm", className),
48
48
  children: children
49
49
  })
50
50
  });