@idealyst/theme 1.0.83 → 1.0.84

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 (68) hide show
  1. package/package.json +2 -1
  2. package/src/components/CLAUDE.md +468 -0
  3. package/src/components/accordion.ts +34 -0
  4. package/src/components/activity-indicator.ts +28 -0
  5. package/src/components/alert.ts +32 -0
  6. package/src/components/avatar.ts +27 -0
  7. package/src/components/badge.ts +28 -0
  8. package/src/components/breadcrumb.ts +36 -0
  9. package/src/components/button.ts +32 -0
  10. package/src/components/card.ts +31 -0
  11. package/src/components/checkbox.ts +37 -0
  12. package/src/components/chip.ts +34 -0
  13. package/src/components/dialog.ts +31 -0
  14. package/src/components/divider.ts +36 -0
  15. package/src/components/icon.ts +26 -0
  16. package/src/components/image.ts +22 -0
  17. package/src/components/index.ts +37 -0
  18. package/src/components/input.ts +35 -0
  19. package/src/components/list.ts +40 -0
  20. package/src/components/menu-item.ts +29 -0
  21. package/src/components/menu.ts +32 -0
  22. package/src/components/popover.ts +25 -0
  23. package/src/components/pressable.ts +20 -0
  24. package/src/components/progress.ts +35 -0
  25. package/src/components/radio-button.ts +38 -0
  26. package/src/components/screen.ts +25 -0
  27. package/src/components/select.ts +62 -0
  28. package/src/components/skeleton.ts +26 -0
  29. package/src/components/slider.ts +62 -0
  30. package/src/components/svg-image.ts +24 -0
  31. package/src/components/switch.ts +54 -0
  32. package/src/components/tab-bar.ts +54 -0
  33. package/src/components/table.ts +57 -0
  34. package/src/components/text.ts +29 -0
  35. package/src/components/textarea.ts +53 -0
  36. package/src/components/tooltip.ts +29 -0
  37. package/src/components/video.ts +18 -0
  38. package/src/components/view.ts +31 -0
  39. package/src/darkTheme.ts +890 -0
  40. package/src/index.ts +7 -166
  41. package/src/lightTheme.ts +873 -0
  42. package/src/styles.ts +14 -0
  43. package/src/theme/color.ts +15 -0
  44. package/src/theme/index.ts +16 -0
  45. package/src/theme/intent.ts +8 -0
  46. package/src/theme/shadow.ts +18 -0
  47. package/src/theme/size.ts +182 -0
  48. package/src/theme/surface.ts +3 -0
  49. package/src/unistyles.ts +6 -14
  50. package/src/variants/color.ts +9 -0
  51. package/src/variants/index.ts +2 -0
  52. package/src/variants/intent.ts +16 -0
  53. package/src/variants/size.ts +0 -0
  54. package/CLAUDE.md +0 -447
  55. package/LLM-ACCESS-GUIDE.md +0 -208
  56. package/README.md +0 -633
  57. package/src/README.md +0 -138
  58. package/src/breakpoints.ts +0 -8
  59. package/src/colorResolver.ts +0 -218
  60. package/src/colors.md +0 -353
  61. package/src/colors.ts +0 -315
  62. package/src/common.ts +0 -92
  63. package/src/defaultThemes.md +0 -407
  64. package/src/defaultThemes.ts +0 -238
  65. package/src/themeBuilder.md +0 -400
  66. package/src/themeBuilder.ts +0 -602
  67. package/src/variantHelpers.ts +0 -584
  68. package/src/variants.ts +0 -56
package/src/common.ts DELETED
@@ -1,92 +0,0 @@
1
- // =============================================================================
2
- // COMMON THEME PROPERTIES
3
- // =============================================================================
4
-
5
- // Common theme properties shared across all themes
6
- export const commonThemeProperties = {
7
- spacing: {
8
- xs: 4,
9
- sm: 8,
10
- md: 16,
11
- lg: 24,
12
- xl: 32,
13
- xxl: 40,
14
- xxxl: 48,
15
- xxxxl: 64,
16
- },
17
-
18
- borderRadius: {
19
- none: 0,
20
- xs: 2,
21
- sm: 4,
22
- md: 8,
23
- lg: 12,
24
- xl: 16,
25
- xxl: 20,
26
- full: 9999,
27
- },
28
-
29
- typography: {
30
- fontSize: {
31
- xs: 12,
32
- sm: 14,
33
- md: 16,
34
- lg: 18,
35
- xl: 20,
36
- xxl: 24,
37
- xxxl: 32,
38
- xxxxl: 40,
39
- },
40
- fontWeight: {
41
- light: '300',
42
- regular: '400',
43
- medium: '500',
44
- semibold: '600',
45
- bold: '700',
46
- extrabold: '800',
47
- },
48
- lineHeight: {
49
- tight: 1.25,
50
- normal: 1.5,
51
- relaxed: 1.75,
52
- },
53
- },
54
-
55
- shadows: {
56
- sm: {
57
- shadowColor: '#000',
58
- shadowOffset: { width: 0, height: 1 },
59
- shadowOpacity: 0.05,
60
- shadowRadius: 2,
61
- elevation: 1,
62
- },
63
- md: {
64
- shadowColor: '#000',
65
- shadowOffset: { width: 0, height: 4 },
66
- shadowOpacity: 0.1,
67
- shadowRadius: 8,
68
- elevation: 4,
69
- },
70
- lg: {
71
- shadowColor: '#000',
72
- shadowOffset: { width: 0, height: 8 },
73
- shadowOpacity: 0.15,
74
- shadowRadius: 16,
75
- elevation: 8,
76
- },
77
- },
78
-
79
- transitions: {
80
- fast: '0.15s ease',
81
- base: '0.2s ease',
82
- slow: '0.3s ease',
83
- button: 'all 0.2s ease',
84
- fade: 'opacity 0.2s ease',
85
- slide: 'transform 0.3s ease',
86
- },
87
-
88
- // Dynamic helper functions
89
- gap: (value: number) => value * 8,
90
- scale: (value: number) => value * 1.2,
91
- alpha: (color: string, alpha: number) => `${color}${Math.round(alpha * 255).toString(16).padStart(2, '0')}`,
92
- };
@@ -1,407 +0,0 @@
1
- # Default Themes
2
-
3
- Pre-built light and dark theme configurations that provide a complete, production-ready theming solution out of the box.
4
-
5
- ## Overview
6
-
7
- The default themes module provides two carefully crafted theme presets:
8
- - **Light Theme**: Optimized for daylight usage and general accessibility
9
- - **Dark Theme**: Optimized for low-light environments and reduced eye strain
10
-
11
- Both themes use the same color palettes but with different mappings and intent resolutions to ensure optimal readability and usability in their respective contexts.
12
-
13
- ## Available Themes
14
-
15
- ### defaultLightTheme
16
-
17
- A comprehensive light theme optimized for daylight usage and accessibility.
18
-
19
- ```tsx
20
- import { defaultLightTheme } from '@idealyst/theme';
21
-
22
- // Theme structure
23
- const lightTheme = {
24
- palettes: { /* 8 color palettes */ },
25
- intents: { /* Light-optimized intent mappings */ },
26
- colors: { /* Component color system for light backgrounds */ },
27
- typography: { /* Font system */ },
28
- spacing: { /* Spacing scale */ },
29
- borderRadius: { /* Border radius scale */ },
30
- shadows: { /* Shadow definitions */ },
31
- transitions: { /* Animation timings */ },
32
- breakpoints: { /* Responsive breakpoints */ },
33
- };
34
- ```
35
-
36
- **Key Characteristics:**
37
- - High contrast dark text on light backgrounds
38
- - Subtle shadows for depth and elevation
39
- - Warm gray tones for comfort
40
- - Optimized for daylight viewing
41
- - WCAG AA compliant contrast ratios
42
-
43
- ### defaultDarkTheme
44
-
45
- A comprehensive dark theme optimized for low-light environments.
46
-
47
- ```tsx
48
- import { defaultDarkTheme } from '@idealyst/theme';
49
-
50
- // Similar structure to light theme but with dark-optimized values
51
- const darkTheme = {
52
- palettes: { /* Same palettes as light theme */ },
53
- intents: { /* Dark-optimized intent mappings */ },
54
- colors: { /* Component color system for dark backgrounds */ },
55
- // ... other properties optimized for dark theme
56
- };
57
- ```
58
-
59
- **Key Characteristics:**
60
- - Light text on dark backgrounds
61
- - Reduced shadows, emphasis on borders
62
- - Cool gray tones to reduce eye strain
63
- - Optimized for low-light viewing
64
- - WCAG AA compliant contrast ratios
65
-
66
- ## Color System Differences
67
-
68
- ### Light Theme Colors
69
-
70
- ```tsx
71
- // Text colors for light theme
72
- text: {
73
- primary: '#1f2937', // Dark gray for main text
74
- secondary: '#6b7280', // Medium gray for secondary text
75
- disabled: '#9ca3af', // Light gray for disabled text
76
- inverse: '#ffffff', // White text for dark backgrounds
77
- muted: '#d1d5db', // Very light gray for muted text
78
- placeholder: '#9ca3af', // Medium gray for placeholders
79
- }
80
-
81
- // Surface colors for light theme
82
- surface: {
83
- primary: '#ffffff', // White primary surface
84
- secondary: '#f9fafb', // Very light gray secondary
85
- tertiary: '#f3f4f6', // Light gray tertiary
86
- elevated: '#ffffff', // White elevated surfaces
87
- overlay: '#000000cc', // Dark overlay with opacity
88
- inverse: '#1f2937', // Dark inverse surface
89
- }
90
- ```
91
-
92
- ### Dark Theme Colors
93
-
94
- ```tsx
95
- // Text colors for dark theme
96
- text: {
97
- primary: '#f9fafb', // Light gray for main text
98
- secondary: '#d1d5db', // Medium gray for secondary text
99
- disabled: '#6b7280', // Darker gray for disabled text
100
- inverse: '#1f2937', // Dark text for light backgrounds
101
- muted: '#9ca3af', // Medium gray for muted text
102
- placeholder: '#9ca3af', // Medium gray for placeholders
103
- }
104
-
105
- // Surface colors for dark theme
106
- surface: {
107
- primary: '#111827', // Very dark gray primary surface
108
- secondary: '#1f2937', // Dark gray secondary
109
- tertiary: '#374151', // Medium dark gray tertiary
110
- elevated: '#1f2937', // Dark gray elevated surfaces
111
- overlay: '#000000e6', // Black overlay with opacity
112
- inverse: '#ffffff', // White inverse surface
113
- }
114
- ```
115
-
116
- ## Intent Mappings
117
-
118
- ### Light Theme Intents
119
-
120
- ```tsx
121
- const lightIntents = {
122
- primary: {
123
- main: '#3b82f6', // Blue 500
124
- on: '#ffffff', // White text
125
- container: '#dbeafe', // Blue 100 container
126
- onContainer: '#1e40af', // Blue 800 text on container
127
- light: '#60a5fa', // Blue 400 light variant
128
- dark: '#2563eb', // Blue 600 dark variant
129
- border: '#2563eb', // Blue 600 border
130
- },
131
- success: {
132
- main: '#22c55e', // Green 500
133
- on: '#ffffff',
134
- container: '#dcfce7', // Green 100
135
- onContainer: '#166534', // Green 800
136
- light: '#4ade80', // Green 400
137
- dark: '#16a34a', // Green 600
138
- border: '#16a34a',
139
- },
140
- // ... other intents
141
- };
142
- ```
143
-
144
- ### Dark Theme Intents
145
-
146
- ```tsx
147
- const darkIntents = {
148
- primary: {
149
- main: '#60a5fa', // Blue 400 (lighter for dark bg)
150
- on: '#1e3a8a', // Blue 900 text
151
- container: '#1e40af', // Blue 800 container
152
- onContainer: '#dbeafe', // Blue 100 text on container
153
- light: '#93c5fd', // Blue 300 light variant
154
- dark: '#3b82f6', // Blue 500 dark variant
155
- border: '#2563eb', // Blue 600 border
156
- },
157
- success: {
158
- main: '#4ade80', // Green 400 (lighter for dark bg)
159
- on: '#14532d', // Green 900 text
160
- container: '#166534', // Green 800 container
161
- onContainer: '#dcfce7', // Green 100 text on container
162
- light: '#86efac', // Green 300 light variant
163
- dark: '#22c55e', // Green 500 dark variant
164
- border: '#16a34a', // Green 600 border
165
- },
166
- // ... other intents
167
- };
168
- ```
169
-
170
- ## Typography System
171
-
172
- Both themes share the same typography system:
173
-
174
- ```tsx
175
- const typography = {
176
- fontFamily: {
177
- sans: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
178
- mono: 'ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace',
179
- },
180
- fontSize: {
181
- xs: 12, // Extra small
182
- sm: 14, // Small
183
- md: 16, // Medium (base)
184
- lg: 18, // Large
185
- xl: 20, // Extra large
186
- xxl: 24, // Extra extra large
187
- },
188
- fontWeight: {
189
- light: '300',
190
- regular: '400',
191
- medium: '500',
192
- semibold: '600',
193
- bold: '700',
194
- },
195
- lineHeight: {
196
- tight: 1.2,
197
- normal: 1.5,
198
- relaxed: 1.75,
199
- },
200
- };
201
- ```
202
-
203
- ## Spacing System
204
-
205
- Consistent spacing scale for both themes:
206
-
207
- ```tsx
208
- const spacing = {
209
- xs: 4, // 0.25rem
210
- sm: 8, // 0.5rem
211
- md: 16, // 1rem
212
- lg: 24, // 1.5rem
213
- xl: 32, // 2rem
214
- xxl: 48, // 3rem
215
- };
216
- ```
217
-
218
- ## Shadow System
219
-
220
- ### Light Theme Shadows
221
-
222
- ```tsx
223
- const lightShadows = {
224
- sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
225
- md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
226
- lg: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',
227
- xl: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',
228
- };
229
- ```
230
-
231
- ### Dark Theme Shadows
232
-
233
- ```tsx
234
- const darkShadows = {
235
- sm: '0 1px 2px 0 rgb(0 0 0 / 0.3)',
236
- md: '0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)',
237
- lg: '0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4)',
238
- xl: '0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4)',
239
- };
240
- ```
241
-
242
- ## Usage Examples
243
-
244
- ### Basic Theme Registration
245
-
246
- ```tsx
247
- import { StyleSheet } from 'react-native-unistyles';
248
- import { defaultLightTheme, defaultDarkTheme } from '@idealyst/theme';
249
-
250
- StyleSheet.configure({
251
- themes: {
252
- light: defaultLightTheme,
253
- dark: defaultDarkTheme,
254
- },
255
- settings: {
256
- adaptiveThemes: true, // Automatically switch based on system preference
257
- },
258
- });
259
- ```
260
-
261
- ### Theme Switching
262
-
263
- ```tsx
264
- import { UnistylesRuntime } from 'react-native-unistyles';
265
-
266
- // Switch to dark theme
267
- UnistylesRuntime.setTheme('dark');
268
-
269
- // Switch to light theme
270
- UnistylesRuntime.setTheme('light');
271
-
272
- // Get current theme
273
- const currentTheme = UnistylesRuntime.themeName;
274
- ```
275
-
276
- ### Using Theme in Components
277
-
278
- ```tsx
279
- import { StyleSheet } from 'react-native-unistyles';
280
-
281
- const styles = StyleSheet.create((theme) => ({
282
- container: {
283
- backgroundColor: theme.colors.surface.primary,
284
- padding: theme.spacing.md,
285
- borderRadius: theme.borderRadius.md,
286
- shadowColor: theme.shadows.md,
287
- },
288
- title: {
289
- color: theme.colors.text.primary,
290
- fontSize: theme.typography.fontSize.lg,
291
- fontWeight: theme.typography.fontWeight.bold,
292
- },
293
- subtitle: {
294
- color: theme.colors.text.secondary,
295
- fontSize: theme.typography.fontSize.md,
296
- },
297
- }));
298
-
299
- const MyComponent = () => {
300
- return (
301
- <View style={styles.container}>
302
- <Text style={styles.title}>Title</Text>
303
- <Text style={styles.subtitle}>Subtitle</Text>
304
- </View>
305
- );
306
- };
307
- ```
308
-
309
- ## Customization
310
-
311
- ### Extending Default Themes
312
-
313
- ```tsx
314
- import { extendTheme, defaultLightTheme } from '@idealyst/theme';
315
-
316
- const customLightTheme = extendTheme(defaultLightTheme, {
317
- typography: {
318
- fontFamily: {
319
- sans: 'Inter, system-ui, sans-serif', // Custom font
320
- },
321
- },
322
- spacing: {
323
- xs: 2, // Tighter spacing
324
- sm: 6,
325
- md: 12,
326
- lg: 20,
327
- xl: 28,
328
- xxl: 40,
329
- },
330
- });
331
- ```
332
-
333
- ### Creating Theme Variants
334
-
335
- ```tsx
336
- // High contrast light theme
337
- const highContrastLight = extendTheme(defaultLightTheme, {
338
- colors: {
339
- text: {
340
- primary: '#000000', // Pure black for maximum contrast
341
- secondary: '#333333',
342
- },
343
- border: {
344
- primary: '#000000',
345
- focus: '#0066cc', // High contrast blue
346
- },
347
- },
348
- });
349
-
350
- // Reduced motion theme
351
- const reducedMotionTheme = extendTheme(defaultLightTheme, {
352
- transitions: {
353
- fast: 0, // No animations
354
- normal: 0,
355
- slow: 0,
356
- },
357
- });
358
- ```
359
-
360
- ## Accessibility Features
361
-
362
- ### WCAG Compliance
363
-
364
- Both default themes meet WCAG AA standards:
365
- - **Text contrast**: 4.5:1 minimum for normal text
366
- - **Large text contrast**: 3:1 minimum for large text (18pt+)
367
- - **UI element contrast**: 3:1 minimum for interactive elements
368
-
369
- ### Color Blind Considerations
370
-
371
- - High contrast between different UI states
372
- - Not relying solely on color for information
373
- - Clear visual hierarchies
374
- - Consistent color meanings across the interface
375
-
376
- ### Low Vision Support
377
-
378
- - Sufficient spacing between elements
379
- - Clear focus indicators
380
- - High contrast mode support
381
- - Scalable typography system
382
-
383
- ## Performance Characteristics
384
-
385
- ### Memory Usage
386
- - Themes are computed once and cached
387
- - Color calculations performed at build time
388
- - Minimal runtime overhead
389
-
390
- ### Bundle Size
391
- - Light theme: ~3KB gzipped
392
- - Dark theme: ~3KB gzipped
393
- - Combined default themes: ~5KB gzipped
394
-
395
- ### Runtime Performance
396
- - Instant theme switching
397
- - No color recalculation needed
398
- - Optimized for 60fps animations
399
-
400
- ## Best Practices
401
-
402
- 1. **Start with defaults**: Use default themes as base for custom themes
403
- 2. **Maintain contrast**: Always check contrast ratios when customizing
404
- 3. **Test both themes**: Ensure your app works well in light and dark modes
405
- 4. **Consider context**: Choose appropriate theme based on usage environment
406
- 5. **Accessibility first**: Prioritize readability and usability
407
- 6. **Performance**: Avoid theme switching in tight loops