@opencxh/ui-kit 1.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.
Files changed (37) hide show
  1. package/README.md +261 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +3076 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.umd.cjs +2 -0
  6. package/dist/index.umd.cjs.map +1 -0
  7. package/dist/src/action/Button.d.ts +50 -0
  8. package/dist/src/action/ButtonGroup.d.ts +17 -0
  9. package/dist/src/action/Link.d.ts +21 -0
  10. package/dist/src/command-palette/CommandPalette.d.ts +22 -0
  11. package/dist/src/command-palette/index.d.ts +2 -0
  12. package/dist/src/content/Icon.d.ts +21 -0
  13. package/dist/src/content/Image.d.ts +29 -0
  14. package/dist/src/content/PageHeader.d.ts +43 -0
  15. package/dist/src/content/Table.d.ts +108 -0
  16. package/dist/src/feedback/Badge.d.ts +48 -0
  17. package/dist/src/feedback/ContentLoading.d.ts +21 -0
  18. package/dist/src/feedback/Spinner.d.ts +32 -0
  19. package/dist/src/forms/Form.d.ts +119 -0
  20. package/dist/src/index.d.ts +28 -0
  21. package/dist/src/input/Checkbox.d.ts +55 -0
  22. package/dist/src/input/DatePicker.d.ts +26 -0
  23. package/dist/src/input/Select.d.ts +89 -0
  24. package/dist/src/input/TextArea.d.ts +39 -0
  25. package/dist/src/input/TextField.d.ts +68 -0
  26. package/dist/src/navigation/Sidebar.d.ts +17 -0
  27. package/dist/src/navigation/Tabs.d.ts +59 -0
  28. package/dist/src/overlays/Dropdown.d.ts +41 -0
  29. package/dist/src/overlays/Modal.d.ts +82 -0
  30. package/dist/src/primitives/Box.d.ts +47 -0
  31. package/dist/src/primitives/Card.d.ts +6 -0
  32. package/dist/src/typography/Heading.d.ts +23 -0
  33. package/dist/src/typography/List.d.ts +31 -0
  34. package/dist/src/typography/Text.d.ts +31 -0
  35. package/dist/src/utils/cn.d.ts +14 -0
  36. package/dist/vite.config.d.ts +2 -0
  37. package/package.json +62 -0
package/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # @opencxh/ui-kit
2
+
3
+ A comprehensive, theme-aware UI component library for the OpenCXH platform. Built with React, TypeScript, and Tailwind CSS, this library provides a consistent design system that automatically adapts to your theme configuration.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Theme-aware**: All components automatically adapt to your theme colors and settings
8
+ - 🌙 **Dark mode support**: Built-in dark mode with automatic color adjustments
9
+ - ♿ **Accessible**: WCAG compliant components with proper ARIA attributes
10
+ - 📱 **Responsive**: Mobile-first design with responsive breakpoints
11
+ - 🔧 **TypeScript**: Full TypeScript support with comprehensive type definitions
12
+ - 🎯 **Consistent**: Unified design language across all components
13
+ - âš¡ **Performance**: Optimized for performance with minimal bundle size
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @opencxh/ui-kit
19
+ # or
20
+ yarn add @opencxh/ui-kit
21
+ # or
22
+ pnpm add @opencxh/ui-kit
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```tsx
28
+ import { Button, TextField, Modal } from '@opencxh/ui-kit';
29
+ import { useState } from 'react';
30
+
31
+ function App() {
32
+ const [isModalOpen, setIsModalOpen] = useState(false);
33
+
34
+ return (
35
+ <div>
36
+ <TextField
37
+ label="Email"
38
+ placeholder="Enter your email"
39
+ type="email"
40
+ />
41
+
42
+ <Button onClick={() => setIsModalOpen(true)}>
43
+ Open Modal
44
+ </Button>
45
+
46
+ <Modal
47
+ open={isModalOpen}
48
+ onClose={() => setIsModalOpen(false)}
49
+ title="Welcome"
50
+ >
51
+ <p>Hello from the UI kit!</p>
52
+ </Modal>
53
+ </div>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ## Components
59
+
60
+ ### Action Components
61
+
62
+ #### Button
63
+ A versatile button component with multiple variants and states.
64
+
65
+ ```tsx
66
+ <Button variant="primary" size="md">
67
+ Primary Button
68
+ </Button>
69
+
70
+ <Button variant="outline" leftIcon={<PlusIcon />}>
71
+ Add Item
72
+ </Button>
73
+
74
+ <Button loading variant="secondary">
75
+ Loading...
76
+ </Button>
77
+ ```
78
+
79
+ **Props:**
80
+ - `variant`: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive'
81
+ - `size`: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
82
+ - `fullWidth`: boolean
83
+ - `loading`: boolean
84
+ - `leftIcon`, `rightIcon`: React.ReactNode
85
+ - `iconOnly`: boolean
86
+
87
+ ### Input Components
88
+
89
+ #### TextField
90
+ A comprehensive text input with validation states and icons.
91
+
92
+ ```tsx
93
+ <TextField
94
+ label="Search"
95
+ placeholder="Search..."
96
+ startIcon={<SearchIcon />}
97
+ />
98
+
99
+ <TextField
100
+ label="Password"
101
+ type="password"
102
+ error="Password is required"
103
+ />
104
+ ```
105
+
106
+ **Props:**
107
+ - `label`: string
108
+ - `helperText`: string
109
+ - `error`: string
110
+ - `size`: 'sm' | 'md' | 'lg'
111
+ - `fullWidth`: boolean
112
+ - `startIcon`, `endIcon`: React.ReactNode
113
+ - `loading`: boolean
114
+
115
+ ### Overlay Components
116
+
117
+ #### Modal
118
+ An accessible modal dialog with focus management.
119
+
120
+ ```tsx
121
+ <Modal
122
+ open={isOpen}
123
+ onClose={() => setIsOpen(false)}
124
+ title="Settings"
125
+ size="lg"
126
+ footer={
127
+ <div className="flex justify-end space-x-2">
128
+ <Button variant="outline" onClick={() => setIsOpen(false)}>
129
+ Cancel
130
+ </Button>
131
+ <Button onClick={handleSave}>
132
+ Save
133
+ </Button>
134
+ </div>
135
+ }
136
+ >
137
+ <SettingsForm />
138
+ </Modal>
139
+ ```
140
+
141
+ **Props:**
142
+ - `open`: boolean
143
+ - `onClose`: () => void
144
+ - `title`: string
145
+ - `size`: 'sm' | 'md' | 'lg' | 'xl' | 'full'
146
+ - `closeOnBackdropClick`: boolean
147
+ - `closeOnEscape`: boolean
148
+ - `footer`: React.ReactNode
149
+
150
+ ### Primitive Components
151
+
152
+ #### Box
153
+ A flexible container component for layout and styling.
154
+
155
+ ```tsx
156
+ <Box padding="md" background="primary" radius="lg">
157
+ Content
158
+ </Box>
159
+
160
+ <Box as="section" padding="lg" shadow="md">
161
+ <h2>Section Title</h2>
162
+ <p>Section content</p>
163
+ </Box>
164
+ ```
165
+
166
+ **Props:**
167
+ - `as`: keyof JSX.IntrinsicElements
168
+ - `padding`, `margin`: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
169
+ - `background`: 'none' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
170
+ - `radius`: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'
171
+ - `shadow`: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
172
+ - `border`: 'none' | 'sm' | 'md' | 'lg'
173
+ - `borderColor`: theme color names
174
+
175
+ ## Theme Integration
176
+
177
+ The UI kit automatically integrates with the OpenCXH theme system. Components use CSS custom properties that are automatically generated from your theme configuration.
178
+
179
+ ```tsx
180
+ import { initializeTheming } from '@opencxh/ui-kit';
181
+
182
+ // Initialize with your theme
183
+ initializeTheming({
184
+ colors: {
185
+ primary: '#3b82f6',
186
+ secondary: '#6b7280',
187
+ // ... other colors
188
+ },
189
+ components: {
190
+ button: {
191
+ radius: '0.5rem',
192
+ shadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)'
193
+ }
194
+ }
195
+ });
196
+ ```
197
+
198
+ ## Utilities
199
+
200
+ ### cn
201
+ A utility function for combining class names.
202
+
203
+ ```tsx
204
+ import { cn } from '@opencxh/ui-kit';
205
+
206
+ const className = cn(
207
+ 'base-class',
208
+ condition && 'conditional-class',
209
+ { 'object-class': true }
210
+ );
211
+ ```
212
+
213
+ ### useThemeVariables
214
+ A hook that provides theme-aware CSS variables and utilities.
215
+
216
+ ```tsx
217
+ import { useThemeVariables } from '@opencxh/ui-kit';
218
+
219
+ function MyComponent() {
220
+ const { colors, getBgClass, getTextClass } = useThemeVariables();
221
+
222
+ return (
223
+ <div className={getBgClass('primary', 50)}>
224
+ <span className={getTextClass('primary', 900)}>
225
+ Themed content
226
+ </span>
227
+ </div>
228
+ );
229
+ }
230
+ ```
231
+
232
+ ## Development
233
+
234
+ ```bash
235
+ # Install dependencies
236
+ pnpm install
237
+
238
+ # Build the library
239
+ pnpm build
240
+
241
+ # Run in development mode
242
+ pnpm dev
243
+
244
+ # Run tests
245
+ pnpm test
246
+
247
+ # Type check
248
+ pnpm type-check
249
+ ```
250
+
251
+ ## Contributing
252
+
253
+ 1. Fork the repository
254
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
255
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
256
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
257
+ 5. Open a Pull Request
258
+
259
+ ## License
260
+
261
+ MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,2 @@
1
+ export * from './src/index'
2
+ export {}