@idealyst/components 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.
- package/README.md +568 -0
- package/package.json +107 -0
- package/plugin/web.js +186 -0
- package/src/Avatar/Avatar.native.tsx +44 -0
- package/src/Avatar/Avatar.styles.tsx +67 -0
- package/src/Avatar/Avatar.web.tsx +51 -0
- package/src/Avatar/index.native.ts +2 -0
- package/src/Avatar/index.ts +2 -0
- package/src/Avatar/index.web.ts +2 -0
- package/src/Avatar/types.ts +43 -0
- package/src/Badge/Badge.native.tsx +43 -0
- package/src/Badge/Badge.styles.tsx +154 -0
- package/src/Badge/Badge.web.tsx +45 -0
- package/src/Badge/index.native.ts +2 -0
- package/src/Badge/index.ts +2 -0
- package/src/Badge/index.web.ts +2 -0
- package/src/Badge/types.ts +34 -0
- package/src/Button/Button.native.tsx +39 -0
- package/src/Button/Button.styles.tsx +215 -0
- package/src/Button/Button.types.ts +12 -0
- package/src/Button/Button.web.tsx +56 -0
- package/src/Button/index.native.ts +3 -0
- package/src/Button/index.ts +5 -0
- package/src/Button/index.web.ts +3 -0
- package/src/Button/types.ts +49 -0
- package/src/Card/Card.native.tsx +52 -0
- package/src/Card/Card.styles.tsx +240 -0
- package/src/Card/Card.web.tsx +62 -0
- package/src/Card/index.native.ts +3 -0
- package/src/Card/index.ts +5 -0
- package/src/Card/index.web.ts +3 -0
- package/src/Card/types.ts +59 -0
- package/src/Checkbox/Checkbox.native.tsx +99 -0
- package/src/Checkbox/Checkbox.styles.tsx +292 -0
- package/src/Checkbox/Checkbox.web.tsx +131 -0
- package/src/Checkbox/index.native.ts +3 -0
- package/src/Checkbox/index.ts +5 -0
- package/src/Checkbox/index.web.ts +3 -0
- package/src/Checkbox/types.ts +79 -0
- package/src/Divider/Divider.native.tsx +145 -0
- package/src/Divider/Divider.styles.tsx +602 -0
- package/src/Divider/Divider.web.tsx +73 -0
- package/src/Divider/index.native.ts +3 -0
- package/src/Divider/index.ts +5 -0
- package/src/Divider/index.web.ts +3 -0
- package/src/Divider/types.ts +54 -0
- package/src/Icon/Icon.native.tsx +39 -0
- package/src/Icon/Icon.styles.tsx +50 -0
- package/src/Icon/Icon.web.tsx +47 -0
- package/src/Icon/icon-types.ts +7452 -0
- package/src/Icon/index.native.ts +3 -0
- package/src/Icon/index.ts +5 -0
- package/src/Icon/index.web.ts +3 -0
- package/src/Icon/types.ts +36 -0
- package/src/Input/Input.native.tsx +75 -0
- package/src/Input/Input.styles.tsx +177 -0
- package/src/Input/Input.web.tsx +71 -0
- package/src/Input/index.native.ts +3 -0
- package/src/Input/index.ts +5 -0
- package/src/Input/index.web.ts +3 -0
- package/src/Input/types.ts +69 -0
- package/src/Screen/Screen.native.tsx +41 -0
- package/src/Screen/Screen.styles.tsx +60 -0
- package/src/Screen/Screen.web.tsx +33 -0
- package/src/Screen/index.native.ts +2 -0
- package/src/Screen/index.ts +2 -0
- package/src/Screen/index.web.ts +2 -0
- package/src/Screen/types.ts +38 -0
- package/src/Text/Text.native.tsx +36 -0
- package/src/Text/Text.styles.tsx +67 -0
- package/src/Text/Text.web.tsx +41 -0
- package/src/Text/index.native.ts +3 -0
- package/src/Text/index.ts +5 -0
- package/src/Text/index.web.ts +3 -0
- package/src/Text/types.ts +39 -0
- package/src/View/View.native.tsx +56 -0
- package/src/View/View.styles.tsx +103 -0
- package/src/View/View.web.tsx +60 -0
- package/src/View/index.native.ts +3 -0
- package/src/View/index.ts +5 -0
- package/src/View/index.web.ts +3 -0
- package/src/View/types.ts +73 -0
- package/src/examples/AllExamples.tsx +72 -0
- package/src/examples/AvatarExamples.tsx +97 -0
- package/src/examples/BadgeExamples.tsx +200 -0
- package/src/examples/ButtonExamples.tsx +150 -0
- package/src/examples/CardExamples.tsx +176 -0
- package/src/examples/CheckboxExamples.tsx +217 -0
- package/src/examples/DividerExamples.tsx +218 -0
- package/src/examples/IconExamples.tsx +342 -0
- package/src/examples/InputExamples.tsx +134 -0
- package/src/examples/README.md +136 -0
- package/src/examples/ScreenExamples.tsx +154 -0
- package/src/examples/TextExamples.tsx +89 -0
- package/src/examples/ThemeExtensionExamples.tsx +91 -0
- package/src/examples/ValidationExamples.tsx +95 -0
- package/src/examples/ViewExamples.tsx +129 -0
- package/src/examples/extendedTheme.ts +331 -0
- package/src/examples/index.ts +15 -0
- package/src/index.native.ts +52 -0
- package/src/index.ts +48 -0
- package/src/theme/breakpoints.ts +8 -0
- package/src/theme/colorResolver.ts +218 -0
- package/src/theme/colors.ts +315 -0
- package/src/theme/defaultThemes.ts +326 -0
- package/src/theme/index.ts +188 -0
- package/src/theme/themeBuilder.ts +602 -0
- package/src/theme/unistyles.d.ts +6 -0
- package/src/theme/variantHelpers.ts +584 -0
- package/src/theme/variants.ts +56 -0
- package/src/unistyles.d.ts +108 -0
- package/src/unistyles.ts +43 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { IntentVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export interface CheckboxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the checkbox is checked
|
|
7
|
+
*/
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether the checkbox is in an indeterminate state
|
|
12
|
+
*/
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Whether the checkbox is disabled
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Called when the checkbox state changes
|
|
22
|
+
*/
|
|
23
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The size of the checkbox
|
|
27
|
+
*/
|
|
28
|
+
size?: 'small' | 'medium' | 'large';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The intent/color scheme of the checkbox
|
|
32
|
+
*/
|
|
33
|
+
intent?: IntentVariant;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The visual style variant of the checkbox
|
|
37
|
+
*/
|
|
38
|
+
variant?: 'default' | 'outlined';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Label text to display next to the checkbox
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Custom label content (ReactNode)
|
|
47
|
+
*/
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Additional styles (platform-specific)
|
|
52
|
+
*/
|
|
53
|
+
style?: any;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Test ID for testing
|
|
57
|
+
*/
|
|
58
|
+
testID?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Accessibility label
|
|
62
|
+
*/
|
|
63
|
+
accessibilityLabel?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the checkbox is required
|
|
67
|
+
*/
|
|
68
|
+
required?: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Error message to display
|
|
72
|
+
*/
|
|
73
|
+
error?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Helper text to display
|
|
77
|
+
*/
|
|
78
|
+
helperText?: string;
|
|
79
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import { DividerProps } from './types';
|
|
4
|
+
import { dividerStyles } from './Divider.styles';
|
|
5
|
+
|
|
6
|
+
const Divider: React.FC<DividerProps> = ({
|
|
7
|
+
orientation = 'horizontal',
|
|
8
|
+
variant = 'solid',
|
|
9
|
+
thickness = 'thin',
|
|
10
|
+
intent = 'neutral',
|
|
11
|
+
length = 'full',
|
|
12
|
+
spacing = 'medium',
|
|
13
|
+
children,
|
|
14
|
+
style,
|
|
15
|
+
testID,
|
|
16
|
+
accessibilityLabel,
|
|
17
|
+
}) => {
|
|
18
|
+
// Apply variants for main divider
|
|
19
|
+
dividerStyles.useVariants({
|
|
20
|
+
orientation,
|
|
21
|
+
thickness,
|
|
22
|
+
variant: variant as any,
|
|
23
|
+
intent,
|
|
24
|
+
length: typeof length === 'number' ? 'auto' : length,
|
|
25
|
+
spacing,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Get the current styles for color and dimensions
|
|
29
|
+
const dividerStyle = dividerStyles.divider;
|
|
30
|
+
|
|
31
|
+
// Get thickness value
|
|
32
|
+
const getThickness = () => {
|
|
33
|
+
switch (thickness) {
|
|
34
|
+
case 'thin': return 1;
|
|
35
|
+
case 'medium': return 2;
|
|
36
|
+
case 'thick': return 4;
|
|
37
|
+
default: return 1;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// For dashed/dotted variants, use border instead of background
|
|
42
|
+
const getDashedStyle = () => {
|
|
43
|
+
if (variant === 'dashed' || variant === 'dotted') {
|
|
44
|
+
const actualThickness = getThickness();
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
borderStyle: variant,
|
|
49
|
+
borderColor: dividerStyle.backgroundColor,
|
|
50
|
+
...(orientation === 'horizontal' ? {
|
|
51
|
+
borderTopWidth: actualThickness,
|
|
52
|
+
borderBottomWidth: 0,
|
|
53
|
+
borderLeftWidth: 0,
|
|
54
|
+
borderRightWidth: 0,
|
|
55
|
+
width: '100%',
|
|
56
|
+
height: actualThickness,
|
|
57
|
+
} : {
|
|
58
|
+
borderLeftWidth: actualThickness,
|
|
59
|
+
borderTopWidth: 0,
|
|
60
|
+
borderBottomWidth: 0,
|
|
61
|
+
borderRightWidth: 0,
|
|
62
|
+
height: '100%',
|
|
63
|
+
width: actualThickness,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// If no children, render simple divider
|
|
71
|
+
if (!children) {
|
|
72
|
+
if (variant === 'dashed' || variant === 'dotted') {
|
|
73
|
+
return (
|
|
74
|
+
<View
|
|
75
|
+
style={[
|
|
76
|
+
dividerStyle,
|
|
77
|
+
getDashedStyle(),
|
|
78
|
+
style,
|
|
79
|
+
]}
|
|
80
|
+
testID={testID}
|
|
81
|
+
accessibilityLabel={accessibilityLabel || "divider"}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<View
|
|
88
|
+
style={[dividerStyles.divider, style]}
|
|
89
|
+
testID={testID}
|
|
90
|
+
accessibilityLabel={accessibilityLabel || "divider"}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// For lines with content, create a simple dashed line
|
|
96
|
+
const renderLineSegment = () => {
|
|
97
|
+
if (variant === 'dashed' || variant === 'dotted') {
|
|
98
|
+
const actualThickness = getThickness();
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<View
|
|
102
|
+
style={[
|
|
103
|
+
dividerStyles.line,
|
|
104
|
+
{
|
|
105
|
+
backgroundColor: 'transparent',
|
|
106
|
+
borderStyle: variant,
|
|
107
|
+
borderColor: dividerStyles.line.backgroundColor,
|
|
108
|
+
...(orientation === 'horizontal' ? {
|
|
109
|
+
borderTopWidth: actualThickness,
|
|
110
|
+
borderBottomWidth: 0,
|
|
111
|
+
borderLeftWidth: 0,
|
|
112
|
+
borderRightWidth: 0,
|
|
113
|
+
height: actualThickness,
|
|
114
|
+
} : {
|
|
115
|
+
borderLeftWidth: actualThickness,
|
|
116
|
+
borderTopWidth: 0,
|
|
117
|
+
borderBottomWidth: 0,
|
|
118
|
+
borderRightWidth: 0,
|
|
119
|
+
width: actualThickness,
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return <View style={dividerStyles.line} />;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<View
|
|
132
|
+
style={dividerStyles.container}
|
|
133
|
+
testID={testID}
|
|
134
|
+
accessibilityLabel={accessibilityLabel || "divider with content"}
|
|
135
|
+
>
|
|
136
|
+
{renderLineSegment()}
|
|
137
|
+
<Text style={dividerStyles.content}>
|
|
138
|
+
{children}
|
|
139
|
+
</Text>
|
|
140
|
+
{renderLineSegment()}
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export default Divider;
|