@idealyst/components 1.0.24 → 1.0.25
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 +567 -567
- package/package.json +2 -2
- package/plugin/web.js +319 -185
- package/src/Avatar/Avatar.native.tsx +43 -43
- package/src/Avatar/Avatar.styles.tsx +66 -66
- package/src/Avatar/Avatar.web.tsx +50 -50
- package/src/Avatar/index.native.ts +1 -1
- package/src/Avatar/index.ts +1 -1
- package/src/Avatar/index.web.ts +1 -1
- package/src/Avatar/types.ts +42 -42
- package/src/Badge/Badge.native.tsx +42 -42
- package/src/Badge/Badge.styles.tsx +153 -153
- package/src/Badge/Badge.web.tsx +44 -44
- package/src/Badge/index.native.ts +1 -1
- package/src/Badge/index.ts +1 -1
- package/src/Badge/index.web.ts +1 -1
- package/src/Badge/types.ts +33 -33
- package/src/Button/Button.native.tsx +38 -38
- package/src/Button/Button.styles.tsx +214 -214
- package/src/Button/Button.types.ts +11 -11
- package/src/Button/Button.web.tsx +55 -55
- package/src/Button/index.native.ts +2 -2
- package/src/Button/index.ts +4 -4
- package/src/Button/index.web.ts +2 -2
- package/src/Button/types.ts +48 -48
- package/src/Card/Card.native.tsx +51 -51
- package/src/Card/Card.styles.tsx +239 -239
- package/src/Card/Card.web.tsx +61 -61
- package/src/Card/index.native.ts +2 -2
- package/src/Card/index.ts +4 -4
- package/src/Card/index.web.ts +2 -2
- package/src/Card/types.ts +58 -58
- package/src/Checkbox/Checkbox.native.tsx +98 -98
- package/src/Checkbox/Checkbox.styles.tsx +291 -291
- package/src/Checkbox/Checkbox.web.tsx +130 -130
- package/src/Checkbox/index.native.ts +2 -2
- package/src/Checkbox/index.ts +4 -4
- package/src/Checkbox/index.web.ts +2 -2
- package/src/Checkbox/types.ts +78 -78
- package/src/Divider/Divider.native.tsx +144 -144
- package/src/Divider/Divider.styles.tsx +601 -601
- package/src/Divider/Divider.web.tsx +72 -72
- package/src/Divider/index.native.ts +2 -2
- package/src/Divider/index.ts +4 -4
- package/src/Divider/index.web.ts +2 -2
- package/src/Divider/types.ts +53 -53
- package/src/Icon/Icon.native.tsx +38 -38
- package/src/Icon/Icon.styles.tsx +49 -49
- package/src/Icon/Icon.web.tsx +46 -46
- package/src/Icon/icon-types.ts +7452 -7452
- package/src/Icon/index.native.ts +2 -2
- package/src/Icon/index.ts +4 -4
- package/src/Icon/index.web.ts +2 -2
- package/src/Icon/types.ts +35 -35
- package/src/Input/Input.native.tsx +74 -74
- package/src/Input/Input.styles.tsx +176 -176
- package/src/Input/Input.web.tsx +70 -70
- package/src/Input/index.native.ts +2 -2
- package/src/Input/index.ts +4 -4
- package/src/Input/index.web.ts +2 -2
- package/src/Input/types.ts +68 -68
- package/src/Screen/Screen.native.tsx +40 -40
- package/src/Screen/Screen.styles.tsx +59 -59
- package/src/Screen/Screen.web.tsx +32 -32
- package/src/Screen/index.native.ts +1 -1
- package/src/Screen/index.ts +1 -1
- package/src/Screen/index.web.ts +1 -1
- package/src/Screen/types.ts +37 -37
- package/src/Text/Text.native.tsx +35 -35
- package/src/Text/Text.styles.tsx +66 -66
- package/src/Text/Text.web.tsx +40 -40
- package/src/Text/index.native.ts +2 -2
- package/src/Text/index.ts +4 -4
- package/src/Text/index.web.ts +2 -2
- package/src/Text/types.ts +38 -38
- package/src/View/View.native.tsx +55 -55
- package/src/View/View.styles.tsx +102 -102
- package/src/View/View.web.tsx +59 -59
- package/src/View/index.native.ts +2 -2
- package/src/View/index.ts +4 -4
- package/src/View/index.web.ts +2 -2
- package/src/View/types.ts +72 -72
- package/src/examples/AllExamples.tsx +71 -71
- package/src/examples/AvatarExamples.tsx +96 -96
- package/src/examples/BadgeExamples.tsx +199 -199
- package/src/examples/ButtonExamples.tsx +149 -149
- package/src/examples/CardExamples.tsx +175 -175
- package/src/examples/CheckboxExamples.tsx +216 -216
- package/src/examples/DividerExamples.tsx +217 -217
- package/src/examples/IconExamples.tsx +341 -341
- package/src/examples/InputExamples.tsx +133 -133
- package/src/examples/README.md +135 -135
- package/src/examples/ScreenExamples.tsx +153 -153
- package/src/examples/TextExamples.tsx +88 -88
- package/src/examples/ThemeExtensionExamples.tsx +90 -90
- package/src/examples/ValidationExamples.tsx +94 -94
- package/src/examples/ViewExamples.tsx +128 -128
- package/src/examples/extendedTheme.ts +328 -328
- package/src/examples/index.ts +14 -14
- package/src/index.native.ts +48 -48
- package/src/index.ts +47 -47
- package/src/theme/breakpoints.ts +8 -8
- package/src/theme/colorResolver.ts +217 -217
- package/src/theme/colors.ts +314 -314
- package/src/theme/defaultThemes.ts +325 -325
- package/src/theme/index.ts +187 -187
- package/src/theme/themeBuilder.ts +601 -601
- package/src/theme/unistyles.d.ts +5 -5
- package/src/theme/variantHelpers.ts +583 -583
- package/src/theme/variants.ts +55 -55
package/src/Input/Input.web.tsx
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
-
import { InputProps } from './types';
|
|
4
|
-
import { inputStyles } from './Input.styles';
|
|
5
|
-
|
|
6
|
-
const Input: React.FC<InputProps> = ({
|
|
7
|
-
value,
|
|
8
|
-
onChangeText,
|
|
9
|
-
placeholder,
|
|
10
|
-
disabled = false,
|
|
11
|
-
inputType = 'text',
|
|
12
|
-
secureTextEntry = false,
|
|
13
|
-
autoCapitalize = 'sentences',
|
|
14
|
-
size = 'medium',
|
|
15
|
-
variant = 'default',
|
|
16
|
-
hasError = false,
|
|
17
|
-
style,
|
|
18
|
-
testID,
|
|
19
|
-
}) => {
|
|
20
|
-
const getInputType = () => {
|
|
21
|
-
switch (inputType) {
|
|
22
|
-
case 'email':
|
|
23
|
-
return 'email';
|
|
24
|
-
case 'number':
|
|
25
|
-
return 'number';
|
|
26
|
-
case 'password':
|
|
27
|
-
return 'password';
|
|
28
|
-
case 'text':
|
|
29
|
-
default:
|
|
30
|
-
return 'text';
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
35
|
-
if (onChangeText) {
|
|
36
|
-
onChangeText(e.target.value);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Apply variants using the correct Unistyles 3.0 pattern
|
|
41
|
-
inputStyles.useVariants({
|
|
42
|
-
size: size as 'small' | 'medium' | 'large',
|
|
43
|
-
variant: variant as 'default' | 'outlined' | 'filled',
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Create the style array following the official documentation pattern
|
|
47
|
-
const inputStyleArray = [
|
|
48
|
-
inputStyles.input,
|
|
49
|
-
disabled && inputStyles.disabled,
|
|
50
|
-
hasError && inputStyles.error,
|
|
51
|
-
style,
|
|
52
|
-
].filter(Boolean);
|
|
53
|
-
|
|
54
|
-
// Use getWebProps to generate className and ref for web
|
|
55
|
-
const webProps = getWebProps(inputStyleArray);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<input
|
|
59
|
-
{...webProps}
|
|
60
|
-
type={secureTextEntry ? 'password' : getInputType()}
|
|
61
|
-
value={value}
|
|
62
|
-
onChange={handleChange}
|
|
63
|
-
placeholder={placeholder}
|
|
64
|
-
disabled={disabled}
|
|
65
|
-
autoCapitalize={autoCapitalize}
|
|
66
|
-
data-testid={testID}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { InputProps } from './types';
|
|
4
|
+
import { inputStyles } from './Input.styles';
|
|
5
|
+
|
|
6
|
+
const Input: React.FC<InputProps> = ({
|
|
7
|
+
value,
|
|
8
|
+
onChangeText,
|
|
9
|
+
placeholder,
|
|
10
|
+
disabled = false,
|
|
11
|
+
inputType = 'text',
|
|
12
|
+
secureTextEntry = false,
|
|
13
|
+
autoCapitalize = 'sentences',
|
|
14
|
+
size = 'medium',
|
|
15
|
+
variant = 'default',
|
|
16
|
+
hasError = false,
|
|
17
|
+
style,
|
|
18
|
+
testID,
|
|
19
|
+
}) => {
|
|
20
|
+
const getInputType = () => {
|
|
21
|
+
switch (inputType) {
|
|
22
|
+
case 'email':
|
|
23
|
+
return 'email';
|
|
24
|
+
case 'number':
|
|
25
|
+
return 'number';
|
|
26
|
+
case 'password':
|
|
27
|
+
return 'password';
|
|
28
|
+
case 'text':
|
|
29
|
+
default:
|
|
30
|
+
return 'text';
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
35
|
+
if (onChangeText) {
|
|
36
|
+
onChangeText(e.target.value);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Apply variants using the correct Unistyles 3.0 pattern
|
|
41
|
+
inputStyles.useVariants({
|
|
42
|
+
size: size as 'small' | 'medium' | 'large',
|
|
43
|
+
variant: variant as 'default' | 'outlined' | 'filled',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Create the style array following the official documentation pattern
|
|
47
|
+
const inputStyleArray = [
|
|
48
|
+
inputStyles.input,
|
|
49
|
+
disabled && inputStyles.disabled,
|
|
50
|
+
hasError && inputStyles.error,
|
|
51
|
+
style,
|
|
52
|
+
].filter(Boolean);
|
|
53
|
+
|
|
54
|
+
// Use getWebProps to generate className and ref for web
|
|
55
|
+
const webProps = getWebProps(inputStyleArray);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<input
|
|
59
|
+
{...webProps}
|
|
60
|
+
type={secureTextEntry ? 'password' : getInputType()}
|
|
61
|
+
value={value}
|
|
62
|
+
onChange={handleChange}
|
|
63
|
+
placeholder={placeholder}
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
autoCapitalize={autoCapitalize}
|
|
66
|
+
data-testid={testID}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
71
|
export default Input;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// React Native-specific Input export
|
|
2
|
-
export { default } from './Input.native';
|
|
1
|
+
// React Native-specific Input export
|
|
2
|
+
export { default } from './Input.native';
|
|
3
3
|
export * from './types';
|
package/src/Input/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Platform-agnostic Input export
|
|
2
|
-
// Bundlers will resolve to index.web.ts (web) or index.native.ts (React Native)
|
|
3
|
-
// This file serves as fallback for web environments
|
|
4
|
-
export { default } from './Input.web';
|
|
1
|
+
// Platform-agnostic Input export
|
|
2
|
+
// Bundlers will resolve to index.web.ts (web) or index.native.ts (React Native)
|
|
3
|
+
// This file serves as fallback for web environments
|
|
4
|
+
export { default } from './Input.web';
|
|
5
5
|
export * from './types';
|
package/src/Input/index.web.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Web-specific Input export
|
|
2
|
-
export { default } from './Input.web';
|
|
1
|
+
// Web-specific Input export
|
|
2
|
+
export { default } from './Input.web';
|
|
3
3
|
export * from './types';
|
package/src/Input/types.ts
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import type { IntentVariant } from '../theme/variants';
|
|
2
|
-
|
|
3
|
-
export interface InputProps {
|
|
4
|
-
/**
|
|
5
|
-
* The current value of the input
|
|
6
|
-
*/
|
|
7
|
-
value?: string;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Called when the text changes
|
|
11
|
-
*/
|
|
12
|
-
onChangeText?: (text: string) => void;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Placeholder text
|
|
16
|
-
*/
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Whether the input is disabled
|
|
21
|
-
*/
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The type of input (affects keyboard type on mobile)
|
|
26
|
-
*/
|
|
27
|
-
inputType?: 'text' | 'email' | 'password' | 'number';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Whether to show the password
|
|
31
|
-
*/
|
|
32
|
-
secureTextEntry?: boolean;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Auto-capitalization behavior
|
|
36
|
-
*/
|
|
37
|
-
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Size variant of the input
|
|
41
|
-
*/
|
|
42
|
-
size?: 'small' | 'medium' | 'large';
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Style variant of the input
|
|
46
|
-
*/
|
|
47
|
-
variant?: 'default' | 'outlined' | 'filled';
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The intent/color scheme of the input (for focus states, validation, etc.)
|
|
51
|
-
*/
|
|
52
|
-
intent?: IntentVariant;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Whether the input has an error state
|
|
56
|
-
* @deprecated Use intent="error" instead
|
|
57
|
-
*/
|
|
58
|
-
hasError?: boolean;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Additional styles (platform-specific)
|
|
62
|
-
*/
|
|
63
|
-
style?: any;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Test ID for testing
|
|
67
|
-
*/
|
|
68
|
-
testID?: string;
|
|
1
|
+
import type { IntentVariant } from '../theme/variants';
|
|
2
|
+
|
|
3
|
+
export interface InputProps {
|
|
4
|
+
/**
|
|
5
|
+
* The current value of the input
|
|
6
|
+
*/
|
|
7
|
+
value?: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Called when the text changes
|
|
11
|
+
*/
|
|
12
|
+
onChangeText?: (text: string) => void;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Placeholder text
|
|
16
|
+
*/
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Whether the input is disabled
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The type of input (affects keyboard type on mobile)
|
|
26
|
+
*/
|
|
27
|
+
inputType?: 'text' | 'email' | 'password' | 'number';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the password
|
|
31
|
+
*/
|
|
32
|
+
secureTextEntry?: boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Auto-capitalization behavior
|
|
36
|
+
*/
|
|
37
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Size variant of the input
|
|
41
|
+
*/
|
|
42
|
+
size?: 'small' | 'medium' | 'large';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Style variant of the input
|
|
46
|
+
*/
|
|
47
|
+
variant?: 'default' | 'outlined' | 'filled';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The intent/color scheme of the input (for focus states, validation, etc.)
|
|
51
|
+
*/
|
|
52
|
+
intent?: IntentVariant;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Whether the input has an error state
|
|
56
|
+
* @deprecated Use intent="error" instead
|
|
57
|
+
*/
|
|
58
|
+
hasError?: boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Additional styles (platform-specific)
|
|
62
|
+
*/
|
|
63
|
+
style?: any;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Test ID for testing
|
|
67
|
+
*/
|
|
68
|
+
testID?: string;
|
|
69
69
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View as RNView, ScrollView as RNScrollView } from 'react-native';
|
|
3
|
-
import { ScreenProps } from './types';
|
|
4
|
-
import { screenStyles } from './Screen.styles';
|
|
5
|
-
|
|
6
|
-
const Screen: React.FC<ScreenProps> = ({
|
|
7
|
-
children,
|
|
8
|
-
background = 'primary',
|
|
9
|
-
padding = 'md',
|
|
10
|
-
safeArea = false,
|
|
11
|
-
scrollable = true,
|
|
12
|
-
style,
|
|
13
|
-
testID,
|
|
14
|
-
}) => {
|
|
15
|
-
screenStyles.useVariants({
|
|
16
|
-
background,
|
|
17
|
-
padding,
|
|
18
|
-
safeArea,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const screenStyleArray = [
|
|
22
|
-
screenStyles.screen,
|
|
23
|
-
style,
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
if (scrollable) {
|
|
27
|
-
return (
|
|
28
|
-
<RNScrollView style={screenStyleArray} testID={testID}>
|
|
29
|
-
{children}
|
|
30
|
-
</RNScrollView>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<RNView style={screenStyleArray} testID={testID}>
|
|
36
|
-
{children}
|
|
37
|
-
</RNView>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View as RNView, ScrollView as RNScrollView } from 'react-native';
|
|
3
|
+
import { ScreenProps } from './types';
|
|
4
|
+
import { screenStyles } from './Screen.styles';
|
|
5
|
+
|
|
6
|
+
const Screen: React.FC<ScreenProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
background = 'primary',
|
|
9
|
+
padding = 'md',
|
|
10
|
+
safeArea = false,
|
|
11
|
+
scrollable = true,
|
|
12
|
+
style,
|
|
13
|
+
testID,
|
|
14
|
+
}) => {
|
|
15
|
+
screenStyles.useVariants({
|
|
16
|
+
background,
|
|
17
|
+
padding,
|
|
18
|
+
safeArea,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const screenStyleArray = [
|
|
22
|
+
screenStyles.screen,
|
|
23
|
+
style,
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
if (scrollable) {
|
|
27
|
+
return (
|
|
28
|
+
<RNScrollView style={screenStyleArray} testID={testID}>
|
|
29
|
+
{children}
|
|
30
|
+
</RNScrollView>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<RNView style={screenStyleArray} testID={testID}>
|
|
36
|
+
{children}
|
|
37
|
+
</RNView>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
41
|
export default Screen;
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
|
|
3
|
-
export const screenStyles = StyleSheet.create((theme) => ({
|
|
4
|
-
screen: {
|
|
5
|
-
flex: 1,
|
|
6
|
-
// Default background color as fallback
|
|
7
|
-
backgroundColor: theme.colors.surface.primary,
|
|
8
|
-
variants: {
|
|
9
|
-
background: {
|
|
10
|
-
primary: {
|
|
11
|
-
backgroundColor: theme.colors.surface.primary,
|
|
12
|
-
},
|
|
13
|
-
secondary: {
|
|
14
|
-
backgroundColor: theme.colors.surface.secondary,
|
|
15
|
-
},
|
|
16
|
-
tertiary: {
|
|
17
|
-
backgroundColor: theme.colors.surface.tertiary,
|
|
18
|
-
},
|
|
19
|
-
inverse: {
|
|
20
|
-
backgroundColor: theme.colors.surface.inverse,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
padding: {
|
|
24
|
-
none: {
|
|
25
|
-
padding: 0,
|
|
26
|
-
},
|
|
27
|
-
sm: {
|
|
28
|
-
padding: theme.spacing.sm,
|
|
29
|
-
},
|
|
30
|
-
md: {
|
|
31
|
-
padding: theme.spacing.md,
|
|
32
|
-
},
|
|
33
|
-
lg: {
|
|
34
|
-
padding: theme.spacing.lg,
|
|
35
|
-
},
|
|
36
|
-
xl: {
|
|
37
|
-
padding: theme.spacing.xl,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
safeArea: {
|
|
41
|
-
true: {
|
|
42
|
-
paddingTop: theme.spacing.lg, // Safe area top
|
|
43
|
-
paddingBottom: theme.spacing.lg, // Safe area bottom
|
|
44
|
-
},
|
|
45
|
-
false: {
|
|
46
|
-
paddingTop: 0,
|
|
47
|
-
paddingBottom: 0,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
// Web-specific styles
|
|
52
|
-
_web: {
|
|
53
|
-
overflow: 'auto',
|
|
54
|
-
display: 'flex',
|
|
55
|
-
flexDirection: 'column',
|
|
56
|
-
minHeight: '100%',
|
|
57
|
-
boxSizing: 'border-box',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
export const screenStyles = StyleSheet.create((theme) => ({
|
|
4
|
+
screen: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
// Default background color as fallback
|
|
7
|
+
backgroundColor: theme.colors.surface.primary,
|
|
8
|
+
variants: {
|
|
9
|
+
background: {
|
|
10
|
+
primary: {
|
|
11
|
+
backgroundColor: theme.colors.surface.primary,
|
|
12
|
+
},
|
|
13
|
+
secondary: {
|
|
14
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
15
|
+
},
|
|
16
|
+
tertiary: {
|
|
17
|
+
backgroundColor: theme.colors.surface.tertiary,
|
|
18
|
+
},
|
|
19
|
+
inverse: {
|
|
20
|
+
backgroundColor: theme.colors.surface.inverse,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
padding: {
|
|
24
|
+
none: {
|
|
25
|
+
padding: 0,
|
|
26
|
+
},
|
|
27
|
+
sm: {
|
|
28
|
+
padding: theme.spacing.sm,
|
|
29
|
+
},
|
|
30
|
+
md: {
|
|
31
|
+
padding: theme.spacing.md,
|
|
32
|
+
},
|
|
33
|
+
lg: {
|
|
34
|
+
padding: theme.spacing.lg,
|
|
35
|
+
},
|
|
36
|
+
xl: {
|
|
37
|
+
padding: theme.spacing.xl,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
safeArea: {
|
|
41
|
+
true: {
|
|
42
|
+
paddingTop: theme.spacing.lg, // Safe area top
|
|
43
|
+
paddingBottom: theme.spacing.lg, // Safe area bottom
|
|
44
|
+
},
|
|
45
|
+
false: {
|
|
46
|
+
paddingTop: 0,
|
|
47
|
+
paddingBottom: 0,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
// Web-specific styles
|
|
52
|
+
_web: {
|
|
53
|
+
overflow: 'auto',
|
|
54
|
+
display: 'flex',
|
|
55
|
+
flexDirection: 'column',
|
|
56
|
+
minHeight: '100%',
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
60
|
}));
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
-
import { ScreenProps } from './types';
|
|
4
|
-
import { screenStyles } from './Screen.styles';
|
|
5
|
-
|
|
6
|
-
const Screen: React.FC<ScreenProps> = ({
|
|
7
|
-
children,
|
|
8
|
-
background = 'primary',
|
|
9
|
-
padding = 'md',
|
|
10
|
-
safeArea = false,
|
|
11
|
-
style,
|
|
12
|
-
testID,
|
|
13
|
-
}) => {
|
|
14
|
-
screenStyles.useVariants({
|
|
15
|
-
background,
|
|
16
|
-
padding,
|
|
17
|
-
safeArea,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Use getWebProps to generate className and ref for web
|
|
21
|
-
const webProps = getWebProps([screenStyles.screen, style]);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div
|
|
25
|
-
{...webProps}
|
|
26
|
-
data-testid={testID}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { ScreenProps } from './types';
|
|
4
|
+
import { screenStyles } from './Screen.styles';
|
|
5
|
+
|
|
6
|
+
const Screen: React.FC<ScreenProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
background = 'primary',
|
|
9
|
+
padding = 'md',
|
|
10
|
+
safeArea = false,
|
|
11
|
+
style,
|
|
12
|
+
testID,
|
|
13
|
+
}) => {
|
|
14
|
+
screenStyles.useVariants({
|
|
15
|
+
background,
|
|
16
|
+
padding,
|
|
17
|
+
safeArea,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Use getWebProps to generate className and ref for web
|
|
21
|
+
const webProps = getWebProps([screenStyles.screen, style]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
{...webProps}
|
|
26
|
+
data-testid={testID}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
33
|
export default Screen;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Screen.native';
|
|
1
|
+
export { default } from './Screen.native';
|
|
2
2
|
export * from './types';
|
package/src/Screen/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Screen.web';
|
|
1
|
+
export { default } from './Screen.web';
|
|
2
2
|
export * from './types';
|
package/src/Screen/index.web.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Screen.web';
|
|
1
|
+
export { default } from './Screen.web';
|
|
2
2
|
export * from './types';
|
package/src/Screen/types.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ScreenProps {
|
|
4
|
-
/**
|
|
5
|
-
* The content to display inside the screen
|
|
6
|
-
*/
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Background variant - controls the background color
|
|
11
|
-
*/
|
|
12
|
-
background?: 'primary' | 'secondary' | 'tertiary' | 'inverse';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Screen padding variant
|
|
16
|
-
*/
|
|
17
|
-
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Safe area padding for mobile devices
|
|
21
|
-
*/
|
|
22
|
-
safeArea?: boolean;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Additional styles (platform-specific)
|
|
26
|
-
*/
|
|
27
|
-
style?: any;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Test ID for testing
|
|
31
|
-
*/
|
|
32
|
-
testID?: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Scrollable content
|
|
36
|
-
*/
|
|
37
|
-
scrollable?: boolean;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ScreenProps {
|
|
4
|
+
/**
|
|
5
|
+
* The content to display inside the screen
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Background variant - controls the background color
|
|
11
|
+
*/
|
|
12
|
+
background?: 'primary' | 'secondary' | 'tertiary' | 'inverse';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Screen padding variant
|
|
16
|
+
*/
|
|
17
|
+
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Safe area padding for mobile devices
|
|
21
|
+
*/
|
|
22
|
+
safeArea?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Additional styles (platform-specific)
|
|
26
|
+
*/
|
|
27
|
+
style?: any;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Test ID for testing
|
|
31
|
+
*/
|
|
32
|
+
testID?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Scrollable content
|
|
36
|
+
*/
|
|
37
|
+
scrollable?: boolean;
|
|
38
38
|
}
|