@idealyst/components 1.0.54 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  A comprehensive, cross-platform component library for React and React Native applications. Built with TypeScript and powered by [react-native-unistyles](https://github.com/jpudysz/react-native-unistyles) for consistent styling across platforms.
4
4
 
5
+ [![npm version](https://badge.fury.io/js/@idealyst%2Fcomponents.svg)](https://badge.fury.io/js/@idealyst%2Fcomponents)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
5
8
  ## Features
6
9
 
7
10
  - 🌐 **Cross-Platform**: Works seamlessly in React and React Native
@@ -15,7 +18,7 @@ A comprehensive, cross-platform component library for React and React Native app
15
18
  ## Installation
16
19
 
17
20
  ```bash
18
- # Using Yarn (recommended)
21
+ # Using yarn (recommended)
19
22
  yarn add @idealyst/components
20
23
 
21
24
  # Using npm
@@ -33,8 +36,11 @@ yarn add react react-native-unistyles
33
36
  # For React Native projects
34
37
  yarn add react-native @react-native/normalize-colors react-native-edge-to-edge react-native-nitro-modules
35
38
 
36
- # For React/Web projects
39
+ # For React/Web projects
37
40
  yarn add react
41
+
42
+ # For SVG support (optional)
43
+ yarn add react-native-svg react-native-svg-transformer
38
44
  ```
39
45
 
40
46
  ## Quick Start
@@ -65,53 +71,53 @@ export default function App() {
65
71
 
66
72
  ## Available Components
67
73
 
68
- The library includes 14 core components organized by category. Each component has detailed documentation in its respective folder.
74
+ The library includes 14 core components organized by category:
69
75
 
70
76
  ### Layout Components
71
77
 
72
- | Component | Description | Documentation |
73
- |-----------|-------------|---------------|
74
- | **[View](src/View/README.md)** | Flexible container with built-in spacing system | [View Docs](src/View/README.md) |
75
- | **[Screen](src/Screen/README.md)** | Full-screen container with safe area support | [Screen Docs](src/Screen/README.md) |
76
- | **[Divider](src/Divider/README.md)** | Separator for content sections | [Divider Docs](src/Divider/README.md) |
78
+ | Component | Description | Key Props |
79
+ |-----------|-------------|-----------|
80
+ | **[View](src/View/README.md)** | Flexible container with built-in spacing system | `spacing`, `style` |
81
+ | **[Screen](src/Screen/README.md)** | Full-screen container with safe area support | `background`, `safeArea`, `padding` |
82
+ | **[Divider](src/Divider/README.md)** | Separator for content sections | `orientation`, `spacing`, `intent` |
77
83
 
78
84
  ### Typography
79
85
 
80
- | Component | Description | Documentation |
81
- |-----------|-------------|---------------|
82
- | **[Text](src/Text/README.md)** | Versatile text with extensive styling options | [Text Docs](src/Text/README.md) |
86
+ | Component | Description | Key Props |
87
+ |-----------|-------------|-----------|
88
+ | **[Text](src/Text/README.md)** | Versatile text with extensive styling options | `size`, `weight`, `color`, `align`, `intent` |
83
89
 
84
90
  ### Form Components
85
91
 
86
- | Component | Description | Documentation |
87
- |-----------|-------------|---------------|
88
- | **[Button](src/Button/README.md)** | Customizable button with variants and intents | [Button Docs](src/Button/README.md) |
89
- | **[Input](src/Input/README.md)** | Text input with validation and styling | [Input Docs](src/Input/README.md) |
90
- | **[Checkbox](src/Checkbox/README.md)** | Checkbox with label support | [Checkbox Docs](src/Checkbox/README.md) |
92
+ | Component | Description | Key Props |
93
+ |-----------|-------------|-----------|
94
+ | **[Button](src/Button/README.md)** | Customizable button with variants and intents | `variant`, `intent`, `size`, `onPress` |
95
+ | **[Input](src/Input/README.md)** | Text input with validation and styling | `label`, `placeholder`, `error`, `onChangeText` |
96
+ | **[Checkbox](src/Checkbox/README.md)** | Checkbox with label support | `checked`, `onCheckedChange`, `label` |
91
97
 
92
98
  ### Display Components
93
99
 
94
- | Component | Description | Documentation |
95
- |-----------|-------------|---------------|
96
- | **[Card](src/Card/README.md)** | Container for grouped content | [Card Docs](src/Card/README.md) |
97
- | **[Badge](src/Badge/README.md)** | Status indicators and count displays | [Badge Docs](src/Badge/README.md) |
98
- | **[Avatar](src/Avatar/README.md)** | User profile pictures with fallback | [Avatar Docs](src/Avatar/README.md) |
100
+ | Component | Description | Key Props |
101
+ |-----------|-------------|-----------|
102
+ | **[Card](src/Card/README.md)** | Container for grouped content | `variant`, `padding`, `clickable`, `intent` |
103
+ | **[Badge](src/Badge/README.md)** | Status indicators and count displays | `variant`, `color`, `size` |
104
+ | **[Avatar](src/Avatar/README.md)** | User profile pictures with fallback | `src`, `fallback`, `size`, `shape` |
99
105
 
100
106
  ### Utility Components
101
107
 
102
- | Component | Description | Documentation |
103
- |-----------|-------------|---------------|
104
- | **[Icon](src/Icon/README.md)** | Icon library with extensive options | [Icon Docs](src/Icon/README.md) |
105
- | **[SVGImage](src/SVGImage/README.md)** | SVG rendering with cross-platform support | [SVGImage Docs](src/SVGImage/README.md) |
108
+ | Component | Description | Key Props |
109
+ |-----------|-------------|-----------|
110
+ | **[Icon](src/Icon/README.md)** | Icon library with extensive options | `name`, `size`, `color`, `intent` |
111
+ | **[SVGImage](src/SVGImage/README.md)** | SVG rendering with cross-platform support | `source`, `width`, `height`, `color`, `intent` |
106
112
 
107
113
  ### Overlay Components
108
114
 
109
- | Component | Description | Documentation |
110
- |-----------|-------------|--------------|
111
- | **[Dialog](src/Dialog/README.md)** | Modal dialogs with customizable content | [Dialog Docs](src/Dialog/README.md) |
112
- | **[Popover](src/Popover/README.md)** | Contextual overlays and tooltips | [Popover Docs](src/Popover/README.md) |
115
+ | Component | Description | Key Props |
116
+ |-----------|-------------|-----------|
117
+ | **[Dialog](src/Dialog/README.md)** | Modal dialogs with customizable content | `open`, `onOpenChange`, `title`, `size` |
118
+ | **[Popover](src/Popover/README.md)** | Contextual overlays and tooltips | `open`, `anchor`, `placement`, `content` |
113
119
 
114
- ## Quick Usage Examples
120
+ ## Usage Examples
115
121
 
116
122
  ### Basic Layout
117
123
  ```tsx
@@ -143,26 +149,6 @@ import { View, Text, Input, Checkbox, Button } from '@idealyst/components';
143
149
  </View>
144
150
  ```
145
151
 
146
- ### Card Grid
147
- ```tsx
148
- import { View, Card, Text, Avatar, Badge } from '@idealyst/components';
149
-
150
- <View spacing="md">
151
- {items.map(item => (
152
- <Card key={item.id} clickable onPress={() => navigate(item)}>
153
- <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center' }}>
154
- <Avatar src={item.avatar} fallback={item.initials} />
155
- <View spacing="xs" style={{ flex: 1 }}>
156
- <Text weight="bold">{item.title}</Text>
157
- <Text size="small" color="secondary">{item.subtitle}</Text>
158
- </View>
159
- {item.badge && <Badge color="red">{item.badge}</Badge>}
160
- </View>
161
- </Card>
162
- ))}
163
- </View>
164
- ```
165
-
166
152
  ### SVG Icons
167
153
  ```tsx
168
154
  import { SVGImage, View, Text } from '@idealyst/components';
@@ -183,335 +169,113 @@ import LogoIcon from './assets/logo.svg';
183
169
  </View>
184
170
  ```
185
171
 
186
- ## Theme System
187
-
188
- The library includes a comprehensive theme system with light and dark mode support.
189
-
190
- ### Default Themes
191
-
192
- ```tsx
193
- import { appThemes } from '@idealyst/components';
194
-
195
- // Access theme colors and properties
196
- const { colors, spacing, typography } = appThemes.light;
197
- ```
198
-
199
- ### Intent System
200
-
201
- Components use an intent-based color system for consistent UX:
202
-
203
- - **Primary**: Main brand actions
204
- - **Neutral**: Secondary actions
205
- - **Success**: Positive actions (save, confirm)
206
- - **Error**: Destructive actions (delete, cancel)
207
- - **Warning**: Caution actions
208
-
209
- ### Color Palettes
210
-
211
- The theme includes 8 comprehensive color palettes:
212
- - Blue (Primary)
213
- - Green (Success)
214
- - Red (Error)
215
- - Amber (Warning)
216
- - Gray (Neutral)
217
- - Cyan (Info)
218
- - Purple (Accent)
219
- - Pink (Accent)
220
-
221
- Each palette includes 10 shades (50-900) optimized for both light and dark themes.
222
-
223
- ### Custom Styling
224
-
225
- Use the theme in your custom components:
226
-
227
- ```tsx
228
- import { StyleSheet } from 'react-native';
229
- import { createStyleSheet } from 'react-native-unistyles';
230
-
231
- const styles = createStyleSheet((theme) => ({
232
- container: {
233
- backgroundColor: theme.colors.surface.primary,
234
- padding: theme.spacing.md,
235
- borderRadius: theme.borderRadius.lg,
236
- },
237
- text: {
238
- color: theme.colors.text.primary,
239
- fontSize: theme.typography.fontSize.md,
240
- },
241
- }));
242
- ```
243
-
244
- ## Platform-Specific Usage
245
-
246
- ### React Native
247
-
248
- ```tsx
249
- import React from 'react';
250
- import { Screen, View, Text, Button } from '@idealyst/components';
251
-
252
- export default function App() {
253
- return (
254
- <Screen background="primary">
255
- <View spacing="lg" style={{ flex: 1 }}>
256
- <Text size="large" weight="bold">
257
- React Native App
258
- </Text>
259
- <Button variant="contained" intent="primary">
260
- Native Button
261
- </Button>
262
- </View>
263
- </Screen>
264
- );
265
- }
266
- ```
267
-
268
- ### React Web
269
-
172
+ ### Card Grid
270
173
  ```tsx
271
- import React from 'react';
272
- import { Screen, View, Text, Button } from '@idealyst/components';
174
+ import { View, Card, Text, Avatar, Badge } from '@idealyst/components';
273
175
 
274
- export default function App() {
275
- return (
276
- <Screen background="primary">
277
- <View spacing="lg">
278
- <Text size="large" weight="bold">
279
- Web App
280
- </Text>
281
- <Button variant="contained" intent="primary">
282
- Web Button
283
- </Button>
176
+ <View spacing="md">
177
+ {items.map(item => (
178
+ <Card key={item.id} clickable onPress={() => navigate(item)}>
179
+ <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center' }}>
180
+ <Avatar src={item.avatar} fallback={item.initials} />
181
+ <View spacing="xs" style={{ flex: 1 }}>
182
+ <Text weight="bold">{item.title}</Text>
183
+ <Text size="small" color="secondary">{item.subtitle}</Text>
184
+ </View>
185
+ {item.badge && <Badge color="red">{item.badge}</Badge>}
284
186
  </View>
285
- </Screen>
286
- );
287
- }
187
+ </Card>
188
+ ))}
189
+ </View>
288
190
  ```
289
191
 
290
- ## Examples
291
-
292
- Import pre-built examples to see components in action:
293
-
294
- ```tsx
295
- import { ButtonExamples, TextExamples, ScreenExamples, AllExamples } from '@idealyst/components/examples';
192
+ ## Theme System
296
193
 
297
- // Show all components
298
- <AllExamples />
194
+ The library includes a comprehensive theme system with light and dark mode support.
299
195
 
300
- // Show specific component examples
301
- <ButtonExamples />
302
- <TextExamples />
303
- <ScreenExamples />
304
- ```
196
+ ### Intent System
305
197
 
306
- ## TypeScript Support
198
+ All components use a consistent intent-based color system:
307
199
 
308
- All components are fully typed with comprehensive TypeScript definitions:
200
+ - `primary`: Main brand actions
201
+ - `neutral`: Secondary actions
202
+ - `success`: Positive actions (save, confirm)
203
+ - `error`: Destructive actions (delete, cancel)
204
+ - `warning`: Caution actions
309
205
 
310
206
  ```tsx
311
- import { ButtonProps, TextProps, ViewProps, ScreenProps } from '@idealyst/components';
312
-
313
- // Use component prop types in your own components
314
- interface MyButtonProps extends ButtonProps {
315
- customProp: string;
316
- }
317
-
318
- interface MyScreenProps extends ScreenProps {
319
- customLayout: boolean;
320
- }
207
+ <Button variant="contained" intent="primary">Primary Action</Button>
208
+ <Button variant="contained" intent="success">Save</Button>
209
+ <Button variant="contained" intent="error">Delete</Button>
321
210
  ```
322
211
 
323
- ## Styling Guidelines
324
-
325
- ### Component Styling Architecture
326
-
327
- This library follows a consistent approach to component styling using [react-native-unistyles](https://github.com/jpudysz/react-native-unistyles) with a variant-based system.
328
-
329
- #### 1. Style Precedence
330
-
331
- When both stylesheet variants and manual style props are provided, **manual styles take precedence**:
212
+ ### Theme Integration
332
213
 
333
214
  ```tsx
334
- // The backgroundColor in style will override the background variant
335
- <View
336
- background="primary" // Sets background via variant
337
- style={{ backgroundColor: 'red' }} // This takes precedence
338
- >
339
- Content
340
- </View>
341
- ```
342
-
343
- This allows for flexible overrides while maintaining the design system defaults.
344
-
345
- #### 2. Variants Over Manual Styles
346
-
347
- **All style-related props should be implemented as variants** in the stylesheet rather than direct style modifications. This ensures consistency, theme integration, and maintainability.
215
+ import { appThemes } from '@idealyst/components';
348
216
 
349
- **Good - Using Variants:**
350
- ```tsx
351
- // Component prop
352
- <Text color="primary" size="large" weight="bold">
353
- Hello World
354
- </Text>
355
-
356
- // Stylesheet implementation
357
- const textStyles = StyleSheet.create((theme) => ({
358
- text: {
359
- variants: {
360
- color: {
361
- primary: { color: theme.colors.text.primary },
362
- secondary: { color: theme.colors.text.secondary },
363
- error: { color: theme.intents.error.main },
364
- },
365
- size: {
366
- small: { fontSize: theme.typography.fontSize.sm },
367
- large: { fontSize: theme.typography.fontSize.lg },
368
- },
369
- weight: {
370
- bold: { fontWeight: theme.typography.fontWeight.bold },
371
- normal: { fontWeight: theme.typography.fontWeight.regular },
372
- }
373
- }
374
- }
375
- }));
217
+ // Access theme colors and properties
218
+ const { colors, spacing, typography } = appThemes.light;
376
219
  ```
377
220
 
378
- **Avoid - Direct Style Manipulation:**
379
- ```tsx
380
- // Don't do this
381
- const Text = ({ color, size, style }) => {
382
- const dynamicStyles = {
383
- color: color === 'primary' ? '#007AFF' : '#666',
384
- fontSize: size === 'large' ? 18 : 14,
385
- };
386
-
387
- return <RNText style={[dynamicStyles, style]} />;
388
- };
389
- ```
221
+ ## Platform Setup
390
222
 
391
- #### 3. Benefits of the Variant System
223
+ ### React Native Setup
392
224
 
393
- - **Theme Integration**: Variants automatically use theme values
394
- - **Type Safety**: TypeScript can enforce valid variant values
395
- - **Performance**: Styles are computed once, not on every render
396
- - **Consistency**: All components follow the same patterns
397
- - **Dark Mode**: Automatic theme switching without component changes
225
+ 1. **Install dependencies:**
226
+ ```bash
227
+ yarn add react-native-unistyles react-native-svg react-native-svg-transformer
228
+ ```
398
229
 
399
- #### 4. Style Override Pattern
230
+ 2. **Configure Metro bundler** (`metro.config.js`):
231
+ ```javascript
232
+ const config = {
233
+ transformer: {
234
+ babelTransformerPath: require.resolve('react-native-svg-transformer'),
235
+ },
236
+ resolver: {
237
+ sourceExts: ['js', 'jsx', 'ts', 'tsx', 'svg'],
238
+ assetExts: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
239
+ },
240
+ };
241
+ ```
400
242
 
401
- The recommended pattern for all components:
243
+ 3. **iOS: Install pods:**
244
+ ```bash
245
+ cd ios && pod install
246
+ ```
402
247
 
403
- ```tsx
404
- const Component = ({ variant1, variant2, style, ...props }) => {
405
- componentStyles.useVariants({
406
- variant1,
407
- variant2,
408
- });
409
-
410
- const styleArray = [
411
- componentStyles.component, // Base styles + variants
412
- style, // Manual overrides (highest precedence)
413
- ];
414
-
415
- return <BaseComponent style={styleArray} {...props} />;
416
- };
417
- ```
248
+ ### Web Setup
418
249
 
419
- #### 5. Creating New Variants
250
+ For Vite projects, SVG imports work out of the box. For other bundlers, ensure SVG support is configured.
420
251
 
421
- When adding new style options to components:
252
+ ## TypeScript
422
253
 
423
- 1. **Define the prop type** with specific allowed values
424
- 2. **Add the variant** to the stylesheet
425
- 3. **Use theme values** where possible
426
- 4. **Document the new prop** in the component's props section
254
+ Full TypeScript support with comprehensive type definitions:
427
255
 
428
256
  ```tsx
429
- // 1. Type definition
430
- interface ButtonProps {
431
- radius?: 'none' | 'sm' | 'md' | 'lg' | 'full';
432
- }
257
+ import type { ButtonProps, TextProps, ViewProps } from '@idealyst/components';
433
258
 
434
- // 2. Stylesheet variant
435
- const buttonStyles = StyleSheet.create((theme) => ({
436
- button: {
437
- variants: {
438
- radius: {
439
- none: { borderRadius: 0 },
440
- sm: { borderRadius: theme.borderRadius.sm },
441
- md: { borderRadius: theme.borderRadius.md },
442
- lg: { borderRadius: theme.borderRadius.lg },
443
- full: { borderRadius: theme.borderRadius.full },
444
- }
445
- }
446
- }
447
- }));
448
-
449
- // 3. Component implementation
450
- const Button = ({ radius = 'md', style, ...props }) => {
451
- buttonStyles.useVariants({ radius });
452
- return <Pressable style={[buttonStyles.button, style]} {...props} />;
259
+ const MyButton: React.FC<ButtonProps> = (props) => {
260
+ return <Button {...props} />;
453
261
  };
454
262
  ```
455
263
 
456
- ## Development
457
-
458
- ### Building
459
-
460
- ```bash
461
- # Build the library
462
- yarn build
463
-
464
- # Watch for changes during development
465
- yarn dev
466
- ```
467
-
468
- ### Project Structure
469
-
470
- ```
471
- packages/components/
472
- ├── src/
473
- │ ├── Avatar/ # Avatar component
474
- │ ├── Badge/ # Badge component
475
- │ ├── Button/ # Button component
476
- │ ├── Card/ # Card component
477
- │ ├── Checkbox/ # Checkbox component
478
- │ ├── Divider/ # Divider component
479
- │ ├── Input/ # Input component
480
- │ ├── Text/ # Text component
481
- │ ├── View/ # View component
482
- │ ├── examples/ # Component examples
483
- │ ├── theme/ # Theme system
484
- │ └── index.ts # Main exports
485
- ├── package.json
486
- └── README.md
487
- ```
488
-
489
264
  ## Contributing
490
265
 
491
- 1. Fork the repository
492
- 2. Create a feature branch
493
- 3. Add your component following the existing patterns
494
- 4. Include examples and TypeScript definitions
495
- 5. Submit a pull request
266
+ We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
496
267
 
497
- ### Component Structure
268
+ ## License
498
269
 
499
- Each component follows this structure:
500
- ```
501
- ComponentName/
502
- ├── ComponentName.web.tsx # Web implementation
503
- ├── ComponentName.native.tsx # React Native implementation
504
- ├── ComponentName.styles.tsx # Shared styles
505
- ├── types.ts # TypeScript definitions
506
- ├── index.ts # Web export
507
- ├── index.native.ts # Native export
508
- └── index.web.ts # Web export
509
- ```
270
+ MIT © [Idealyst](https://github.com/IdealystIO)
510
271
 
511
- ## License
272
+ ## Links
512
273
 
513
- MIT License - see LICENSE file for details.
274
+ - [Documentation](https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components)
275
+ - [GitHub](https://github.com/IdealystIO/idealyst-framework)
276
+ - [Issues](https://github.com/IdealystIO/idealyst-framework/issues)
277
+ - [Changelog](https://github.com/IdealystIO/idealyst-framework/releases)
514
278
 
515
- ## Support
279
+ ---
516
280
 
517
- For issues, questions, or contributions, please visit our [GitHub repository](https://github.com/your-org/idealyst-framework).
281
+ Built with ❤️ by the Idealyst team
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@idealyst/components",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "Shared component library for React and React Native",
5
- "documentation": "https://github.com/your-username/idealyst-framework/tree/main/packages/components#readme",
5
+ "documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components#readme",
6
+ "readme": "README.md",
6
7
  "main": "src/index.ts",
7
8
  "module": "src/index.ts",
8
9
  "types": "src/index.ts",
9
10
  "react-native": "src/index.native.ts",
10
11
  "repository": {
11
12
  "type": "git",
12
- "url": "https://github.com/your-username/idealyst-framework.git",
13
+ "url": "https://github.com/IdealystIO/idealyst-framework.git",
13
14
  "directory": "packages/components"
14
15
  },
15
16
  "author": "Your Name <your.email@example.com>",
@@ -40,7 +41,7 @@
40
41
  "publish:npm": "npm publish"
41
42
  },
42
43
  "peerDependencies": {
43
- "@idealyst/theme": "^1.0.54",
44
+ "@idealyst/theme": "^1.0.56",
44
45
  "@mdi/js": "^7.4.47",
45
46
  "@mdi/react": "^1.6.1",
46
47
  "@react-native-vector-icons/common": "^12.0.1",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Pressable as RNPressable } from 'react-native';
2
+ import { TouchableWithoutFeedback, View } from 'react-native';
3
3
  import { PressableProps } from './types';
4
4
 
5
5
  const Pressable: React.FC<PressableProps> = ({
@@ -14,18 +14,19 @@ const Pressable: React.FC<PressableProps> = ({
14
14
  accessibilityRole,
15
15
  }) => {
16
16
  return (
17
- <RNPressable
18
- onPress={onPress}
19
- onPressIn={onPressIn}
20
- onPressOut={onPressOut}
17
+ <TouchableWithoutFeedback
18
+ onPress={disabled ? undefined : onPress}
19
+ onPressIn={disabled ? undefined : onPressIn}
20
+ onPressOut={disabled ? undefined : onPressOut}
21
21
  disabled={disabled}
22
- style={style}
23
22
  testID={testID}
24
23
  accessibilityLabel={accessibilityLabel}
25
24
  accessibilityRole={accessibilityRole}
26
25
  >
27
- {children}
28
- </RNPressable>
26
+ <View style={style}>
27
+ {children}
28
+ </View>
29
+ </TouchableWithoutFeedback>
29
30
  );
30
31
  };
31
32