@idealyst/components 1.0.53 → 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/CLAUDE.md +10 -1
- package/README.md +111 -319
- package/package.json +5 -4
- package/src/Pressable/Pressable.native.tsx +9 -8
- package/src/SVGImage/README.md +209 -0
- package/src/SVGImage/SVGImage.native.tsx +60 -0
- package/src/SVGImage/SVGImage.styles.tsx +70 -0
- package/src/SVGImage/SVGImage.web.tsx +93 -0
- package/src/SVGImage/index.native.ts +2 -0
- package/src/SVGImage/index.ts +5 -0
- package/src/SVGImage/index.web.ts +2 -0
- package/src/SVGImage/types.ts +14 -0
- package/src/examples/AllExamples.tsx +4 -0
- package/src/examples/SVGImageExamples.tsx +188 -0
- package/src/examples/index.ts +1 -0
- package/src/examples/test-logo.svg +8 -0
- package/src/index.native.ts +4 -0
- package/src/index.ts +4 -0
package/CLAUDE.md
CHANGED
|
@@ -5,7 +5,7 @@ This file provides comprehensive component documentation for LLMs working with t
|
|
|
5
5
|
## Library Overview
|
|
6
6
|
|
|
7
7
|
@idealyst/components is a cross-platform React/React Native component library with:
|
|
8
|
-
-
|
|
8
|
+
- 14 core components organized into 7 categories
|
|
9
9
|
- Theme-based styling with Unistyles
|
|
10
10
|
- Intent-based color system (primary, neutral, success, error, warning)
|
|
11
11
|
- Cross-platform compatibility (React & React Native)
|
|
@@ -33,6 +33,7 @@ This file provides comprehensive component documentation for LLMs working with t
|
|
|
33
33
|
|
|
34
34
|
### Utility Components
|
|
35
35
|
- **Icon**: Icon display (`name`, `size`, `color`, `intent`)
|
|
36
|
+
- **SVGImage**: SVG rendering (`source`, `width`, `height`, `size`, `color`, `intent`)
|
|
36
37
|
|
|
37
38
|
### Overlay Components
|
|
38
39
|
- **Dialog**: Modal dialog (`open`, `onOpenChange`, `title`, `size="small|medium|large"`, `variant="default"`, `showCloseButton`, `closeOnBackdropClick`, `closeOnEscapeKey`)
|
|
@@ -67,6 +68,14 @@ All components use a consistent intent-based color system:
|
|
|
67
68
|
</View>
|
|
68
69
|
```
|
|
69
70
|
|
|
71
|
+
### SVG Usage
|
|
72
|
+
```tsx
|
|
73
|
+
import MyIcon from './assets/icon.svg';
|
|
74
|
+
|
|
75
|
+
<SVGImage source={MyIcon} size={24} intent="primary" />
|
|
76
|
+
<SVGImage source={{ uri: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/react.svg" }} size={32} color="#61dafb" />
|
|
77
|
+
```
|
|
78
|
+
|
|
70
79
|
### Card with Content
|
|
71
80
|
```tsx
|
|
72
81
|
<Card variant="outlined" clickable onPress={handlePress}>
|
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
|
+
[](https://badge.fury.io/js/@idealyst%2Fcomponents)
|
|
6
|
+
[](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
|
|
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,45 +71,53 @@ export default function App() {
|
|
|
65
71
|
|
|
66
72
|
## Available Components
|
|
67
73
|
|
|
68
|
-
The library includes
|
|
74
|
+
The library includes 14 core components organized by category:
|
|
69
75
|
|
|
70
76
|
### Layout Components
|
|
71
77
|
|
|
72
|
-
| Component | Description |
|
|
73
|
-
|
|
74
|
-
| **[View](src/View/README.md)** | Flexible container with built-in spacing system |
|
|
75
|
-
| **[Screen](src/Screen/README.md)** | Full-screen container with safe area support |
|
|
76
|
-
| **[Divider](src/Divider/README.md)** | Separator for content sections |
|
|
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 |
|
|
81
|
-
|
|
82
|
-
| **[Text](src/Text/README.md)** | Versatile text with extensive styling options |
|
|
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 |
|
|
87
|
-
|
|
88
|
-
| **[Button](src/Button/README.md)** | Customizable button with variants and intents |
|
|
89
|
-
| **[Input](src/Input/README.md)** | Text input with validation and styling |
|
|
90
|
-
| **[Checkbox](src/Checkbox/README.md)** | Checkbox with label support |
|
|
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 |
|
|
95
|
-
|
|
96
|
-
| **[Card](src/Card/README.md)** | Container for grouped content |
|
|
97
|
-
| **[Badge](src/Badge/README.md)** | Status indicators and count displays |
|
|
98
|
-
| **[Avatar](src/Avatar/README.md)** | User profile pictures with fallback |
|
|
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 |
|
|
103
|
-
|
|
104
|
-
| **[Icon](src/Icon/README.md)** | Icon library with extensive options |
|
|
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` |
|
|
112
|
+
|
|
113
|
+
### Overlay Components
|
|
114
|
+
|
|
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` |
|
|
105
119
|
|
|
106
|
-
##
|
|
120
|
+
## Usage Examples
|
|
107
121
|
|
|
108
122
|
### Basic Layout
|
|
109
123
|
```tsx
|
|
@@ -135,6 +149,26 @@ import { View, Text, Input, Checkbox, Button } from '@idealyst/components';
|
|
|
135
149
|
</View>
|
|
136
150
|
```
|
|
137
151
|
|
|
152
|
+
### SVG Icons
|
|
153
|
+
```tsx
|
|
154
|
+
import { SVGImage, View, Text } from '@idealyst/components';
|
|
155
|
+
import LogoIcon from './assets/logo.svg';
|
|
156
|
+
|
|
157
|
+
<View spacing="md">
|
|
158
|
+
<Text size="large" weight="bold">My App</Text>
|
|
159
|
+
|
|
160
|
+
{/* Imported SVG */}
|
|
161
|
+
<SVGImage source={LogoIcon} size={40} intent="primary" />
|
|
162
|
+
|
|
163
|
+
{/* Remote SVG */}
|
|
164
|
+
<SVGImage
|
|
165
|
+
source={{ uri: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/react.svg" }}
|
|
166
|
+
size={24}
|
|
167
|
+
color="#61dafb"
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
```
|
|
171
|
+
|
|
138
172
|
### Card Grid
|
|
139
173
|
```tsx
|
|
140
174
|
import { View, Card, Text, Avatar, Badge } from '@idealyst/components';
|
|
@@ -159,331 +193,89 @@ import { View, Card, Text, Avatar, Badge } from '@idealyst/components';
|
|
|
159
193
|
|
|
160
194
|
The library includes a comprehensive theme system with light and dark mode support.
|
|
161
195
|
|
|
162
|
-
### Default Themes
|
|
163
|
-
|
|
164
|
-
```tsx
|
|
165
|
-
import { appThemes } from '@idealyst/components';
|
|
166
|
-
|
|
167
|
-
// Access theme colors and properties
|
|
168
|
-
const { colors, spacing, typography } = appThemes.light;
|
|
169
|
-
```
|
|
170
|
-
|
|
171
196
|
### Intent System
|
|
172
197
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- **Primary**: Main brand actions
|
|
176
|
-
- **Neutral**: Secondary actions
|
|
177
|
-
- **Success**: Positive actions (save, confirm)
|
|
178
|
-
- **Error**: Destructive actions (delete, cancel)
|
|
179
|
-
- **Warning**: Caution actions
|
|
198
|
+
All components use a consistent intent-based color system:
|
|
180
199
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
- Red (Error)
|
|
187
|
-
- Amber (Warning)
|
|
188
|
-
- Gray (Neutral)
|
|
189
|
-
- Cyan (Info)
|
|
190
|
-
- Purple (Accent)
|
|
191
|
-
- Pink (Accent)
|
|
192
|
-
|
|
193
|
-
Each palette includes 10 shades (50-900) optimized for both light and dark themes.
|
|
194
|
-
|
|
195
|
-
### Custom Styling
|
|
196
|
-
|
|
197
|
-
Use the theme in your custom components:
|
|
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
|
|
198
205
|
|
|
199
206
|
```tsx
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const styles = createStyleSheet((theme) => ({
|
|
204
|
-
container: {
|
|
205
|
-
backgroundColor: theme.colors.surface.primary,
|
|
206
|
-
padding: theme.spacing.md,
|
|
207
|
-
borderRadius: theme.borderRadius.lg,
|
|
208
|
-
},
|
|
209
|
-
text: {
|
|
210
|
-
color: theme.colors.text.primary,
|
|
211
|
-
fontSize: theme.typography.fontSize.md,
|
|
212
|
-
},
|
|
213
|
-
}));
|
|
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>
|
|
214
210
|
```
|
|
215
211
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
### React Native
|
|
212
|
+
### Theme Integration
|
|
219
213
|
|
|
220
214
|
```tsx
|
|
221
|
-
import
|
|
222
|
-
import { Screen, View, Text, Button } from '@idealyst/components';
|
|
223
|
-
|
|
224
|
-
export default function App() {
|
|
225
|
-
return (
|
|
226
|
-
<Screen background="primary">
|
|
227
|
-
<View spacing="lg" style={{ flex: 1 }}>
|
|
228
|
-
<Text size="large" weight="bold">
|
|
229
|
-
React Native App
|
|
230
|
-
</Text>
|
|
231
|
-
<Button variant="contained" intent="primary">
|
|
232
|
-
Native Button
|
|
233
|
-
</Button>
|
|
234
|
-
</View>
|
|
235
|
-
</Screen>
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### React Web
|
|
241
|
-
|
|
242
|
-
```tsx
|
|
243
|
-
import React from 'react';
|
|
244
|
-
import { Screen, View, Text, Button } from '@idealyst/components';
|
|
245
|
-
|
|
246
|
-
export default function App() {
|
|
247
|
-
return (
|
|
248
|
-
<Screen background="primary">
|
|
249
|
-
<View spacing="lg">
|
|
250
|
-
<Text size="large" weight="bold">
|
|
251
|
-
Web App
|
|
252
|
-
</Text>
|
|
253
|
-
<Button variant="contained" intent="primary">
|
|
254
|
-
Web Button
|
|
255
|
-
</Button>
|
|
256
|
-
</View>
|
|
257
|
-
</Screen>
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Examples
|
|
263
|
-
|
|
264
|
-
Import pre-built examples to see components in action:
|
|
265
|
-
|
|
266
|
-
```tsx
|
|
267
|
-
import { ButtonExamples, TextExamples, ScreenExamples, AllExamples } from '@idealyst/components/examples';
|
|
268
|
-
|
|
269
|
-
// Show all components
|
|
270
|
-
<AllExamples />
|
|
271
|
-
|
|
272
|
-
// Show specific component examples
|
|
273
|
-
<ButtonExamples />
|
|
274
|
-
<TextExamples />
|
|
275
|
-
<ScreenExamples />
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
## TypeScript Support
|
|
279
|
-
|
|
280
|
-
All components are fully typed with comprehensive TypeScript definitions:
|
|
281
|
-
|
|
282
|
-
```tsx
|
|
283
|
-
import { ButtonProps, TextProps, ViewProps, ScreenProps } from '@idealyst/components';
|
|
284
|
-
|
|
285
|
-
// Use component prop types in your own components
|
|
286
|
-
interface MyButtonProps extends ButtonProps {
|
|
287
|
-
customProp: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
interface MyScreenProps extends ScreenProps {
|
|
291
|
-
customLayout: boolean;
|
|
292
|
-
}
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
## Styling Guidelines
|
|
296
|
-
|
|
297
|
-
### Component Styling Architecture
|
|
298
|
-
|
|
299
|
-
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.
|
|
300
|
-
|
|
301
|
-
#### 1. Style Precedence
|
|
302
|
-
|
|
303
|
-
When both stylesheet variants and manual style props are provided, **manual styles take precedence**:
|
|
304
|
-
|
|
305
|
-
```tsx
|
|
306
|
-
// The backgroundColor in style will override the background variant
|
|
307
|
-
<View
|
|
308
|
-
background="primary" // Sets background via variant
|
|
309
|
-
style={{ backgroundColor: 'red' }} // This takes precedence
|
|
310
|
-
>
|
|
311
|
-
Content
|
|
312
|
-
</View>
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
This allows for flexible overrides while maintaining the design system defaults.
|
|
316
|
-
|
|
317
|
-
#### 2. Variants Over Manual Styles
|
|
318
|
-
|
|
319
|
-
**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';
|
|
320
216
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// Component prop
|
|
324
|
-
<Text color="primary" size="large" weight="bold">
|
|
325
|
-
Hello World
|
|
326
|
-
</Text>
|
|
327
|
-
|
|
328
|
-
// Stylesheet implementation
|
|
329
|
-
const textStyles = StyleSheet.create((theme) => ({
|
|
330
|
-
text: {
|
|
331
|
-
variants: {
|
|
332
|
-
color: {
|
|
333
|
-
primary: { color: theme.colors.text.primary },
|
|
334
|
-
secondary: { color: theme.colors.text.secondary },
|
|
335
|
-
error: { color: theme.intents.error.main },
|
|
336
|
-
},
|
|
337
|
-
size: {
|
|
338
|
-
small: { fontSize: theme.typography.fontSize.sm },
|
|
339
|
-
large: { fontSize: theme.typography.fontSize.lg },
|
|
340
|
-
},
|
|
341
|
-
weight: {
|
|
342
|
-
bold: { fontWeight: theme.typography.fontWeight.bold },
|
|
343
|
-
normal: { fontWeight: theme.typography.fontWeight.regular },
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}));
|
|
217
|
+
// Access theme colors and properties
|
|
218
|
+
const { colors, spacing, typography } = appThemes.light;
|
|
348
219
|
```
|
|
349
220
|
|
|
350
|
-
|
|
351
|
-
```tsx
|
|
352
|
-
// Don't do this
|
|
353
|
-
const Text = ({ color, size, style }) => {
|
|
354
|
-
const dynamicStyles = {
|
|
355
|
-
color: color === 'primary' ? '#007AFF' : '#666',
|
|
356
|
-
fontSize: size === 'large' ? 18 : 14,
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
return <RNText style={[dynamicStyles, style]} />;
|
|
360
|
-
};
|
|
361
|
-
```
|
|
221
|
+
## Platform Setup
|
|
362
222
|
|
|
363
|
-
|
|
223
|
+
### React Native Setup
|
|
364
224
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
- **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
|
+
```
|
|
370
229
|
|
|
371
|
-
|
|
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
|
+
```
|
|
372
242
|
|
|
373
|
-
|
|
243
|
+
3. **iOS: Install pods:**
|
|
244
|
+
```bash
|
|
245
|
+
cd ios && pod install
|
|
246
|
+
```
|
|
374
247
|
|
|
375
|
-
|
|
376
|
-
const Component = ({ variant1, variant2, style, ...props }) => {
|
|
377
|
-
componentStyles.useVariants({
|
|
378
|
-
variant1,
|
|
379
|
-
variant2,
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
const styleArray = [
|
|
383
|
-
componentStyles.component, // Base styles + variants
|
|
384
|
-
style, // Manual overrides (highest precedence)
|
|
385
|
-
];
|
|
386
|
-
|
|
387
|
-
return <BaseComponent style={styleArray} {...props} />;
|
|
388
|
-
};
|
|
389
|
-
```
|
|
248
|
+
### Web Setup
|
|
390
249
|
|
|
391
|
-
|
|
250
|
+
For Vite projects, SVG imports work out of the box. For other bundlers, ensure SVG support is configured.
|
|
392
251
|
|
|
393
|
-
|
|
252
|
+
## TypeScript
|
|
394
253
|
|
|
395
|
-
|
|
396
|
-
2. **Add the variant** to the stylesheet
|
|
397
|
-
3. **Use theme values** where possible
|
|
398
|
-
4. **Document the new prop** in the component's props section
|
|
254
|
+
Full TypeScript support with comprehensive type definitions:
|
|
399
255
|
|
|
400
256
|
```tsx
|
|
401
|
-
|
|
402
|
-
interface ButtonProps {
|
|
403
|
-
radius?: 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
404
|
-
}
|
|
257
|
+
import type { ButtonProps, TextProps, ViewProps } from '@idealyst/components';
|
|
405
258
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
button: {
|
|
409
|
-
variants: {
|
|
410
|
-
radius: {
|
|
411
|
-
none: { borderRadius: 0 },
|
|
412
|
-
sm: { borderRadius: theme.borderRadius.sm },
|
|
413
|
-
md: { borderRadius: theme.borderRadius.md },
|
|
414
|
-
lg: { borderRadius: theme.borderRadius.lg },
|
|
415
|
-
full: { borderRadius: theme.borderRadius.full },
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}));
|
|
420
|
-
|
|
421
|
-
// 3. Component implementation
|
|
422
|
-
const Button = ({ radius = 'md', style, ...props }) => {
|
|
423
|
-
buttonStyles.useVariants({ radius });
|
|
424
|
-
return <Pressable style={[buttonStyles.button, style]} {...props} />;
|
|
259
|
+
const MyButton: React.FC<ButtonProps> = (props) => {
|
|
260
|
+
return <Button {...props} />;
|
|
425
261
|
};
|
|
426
262
|
```
|
|
427
263
|
|
|
428
|
-
## Development
|
|
429
|
-
|
|
430
|
-
### Building
|
|
431
|
-
|
|
432
|
-
```bash
|
|
433
|
-
# Build the library
|
|
434
|
-
yarn build
|
|
435
|
-
|
|
436
|
-
# Watch for changes during development
|
|
437
|
-
yarn dev
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
### Project Structure
|
|
441
|
-
|
|
442
|
-
```
|
|
443
|
-
packages/components/
|
|
444
|
-
├── src/
|
|
445
|
-
│ ├── Avatar/ # Avatar component
|
|
446
|
-
│ ├── Badge/ # Badge component
|
|
447
|
-
│ ├── Button/ # Button component
|
|
448
|
-
│ ├── Card/ # Card component
|
|
449
|
-
│ ├── Checkbox/ # Checkbox component
|
|
450
|
-
│ ├── Divider/ # Divider component
|
|
451
|
-
│ ├── Input/ # Input component
|
|
452
|
-
│ ├── Text/ # Text component
|
|
453
|
-
│ ├── View/ # View component
|
|
454
|
-
│ ├── examples/ # Component examples
|
|
455
|
-
│ ├── theme/ # Theme system
|
|
456
|
-
│ └── index.ts # Main exports
|
|
457
|
-
├── package.json
|
|
458
|
-
└── README.md
|
|
459
|
-
```
|
|
460
|
-
|
|
461
264
|
## Contributing
|
|
462
265
|
|
|
463
|
-
|
|
464
|
-
2. Create a feature branch
|
|
465
|
-
3. Add your component following the existing patterns
|
|
466
|
-
4. Include examples and TypeScript definitions
|
|
467
|
-
5. Submit a pull request
|
|
266
|
+
We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
|
|
468
267
|
|
|
469
|
-
|
|
268
|
+
## License
|
|
470
269
|
|
|
471
|
-
|
|
472
|
-
```
|
|
473
|
-
ComponentName/
|
|
474
|
-
├── ComponentName.web.tsx # Web implementation
|
|
475
|
-
├── ComponentName.native.tsx # React Native implementation
|
|
476
|
-
├── ComponentName.styles.tsx # Shared styles
|
|
477
|
-
├── types.ts # TypeScript definitions
|
|
478
|
-
├── index.ts # Web export
|
|
479
|
-
├── index.native.ts # Native export
|
|
480
|
-
└── index.web.ts # Web export
|
|
481
|
-
```
|
|
270
|
+
MIT © [Idealyst](https://github.com/IdealystIO)
|
|
482
271
|
|
|
483
|
-
##
|
|
272
|
+
## Links
|
|
484
273
|
|
|
485
|
-
|
|
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)
|
|
486
278
|
|
|
487
|
-
|
|
279
|
+
---
|
|
488
280
|
|
|
489
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "Shared component library for React and React Native",
|
|
5
|
-
"documentation": "https://github.com/
|
|
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/
|
|
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.
|
|
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 {
|
|
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
|
-
<
|
|
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
|
-
{
|
|
28
|
-
|
|
26
|
+
<View style={style}>
|
|
27
|
+
{children}
|
|
28
|
+
</View>
|
|
29
|
+
</TouchableWithoutFeedback>
|
|
29
30
|
);
|
|
30
31
|
};
|
|
31
32
|
|