@idealyst/components 1.0.24 → 1.0.26
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/Card/Card.web.tsx
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
-
import { CardProps } from './types';
|
|
4
|
-
import { cardStyles, cardHoverStyles } from './Card.styles';
|
|
5
|
-
|
|
6
|
-
const Card: React.FC<CardProps> = ({
|
|
7
|
-
children,
|
|
8
|
-
variant = 'default',
|
|
9
|
-
padding = 'medium',
|
|
10
|
-
radius = 'medium',
|
|
11
|
-
intent = 'neutral',
|
|
12
|
-
clickable = false,
|
|
13
|
-
onPress,
|
|
14
|
-
disabled = false,
|
|
15
|
-
style,
|
|
16
|
-
testID,
|
|
17
|
-
accessibilityLabel,
|
|
18
|
-
}) => {
|
|
19
|
-
const handleClick = () => {
|
|
20
|
-
if (!disabled && clickable && onPress) {
|
|
21
|
-
onPress();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Apply variants
|
|
26
|
-
cardStyles.useVariants({
|
|
27
|
-
variant: variant as any,
|
|
28
|
-
padding,
|
|
29
|
-
radius,
|
|
30
|
-
intent,
|
|
31
|
-
clickable,
|
|
32
|
-
disabled,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Create style arrays
|
|
36
|
-
const cardStyleArray = [
|
|
37
|
-
cardStyles.card,
|
|
38
|
-
clickable && !disabled && cardHoverStyles.clickableHover,
|
|
39
|
-
style,
|
|
40
|
-
].filter(Boolean);
|
|
41
|
-
|
|
42
|
-
// Generate web props
|
|
43
|
-
const webProps = getWebProps(cardStyleArray);
|
|
44
|
-
|
|
45
|
-
// Use appropriate HTML element based on clickable state
|
|
46
|
-
const Component = clickable ? 'button' : 'div';
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Component
|
|
50
|
-
{...webProps}
|
|
51
|
-
onClick={clickable ? handleClick : undefined}
|
|
52
|
-
disabled={clickable && disabled}
|
|
53
|
-
data-testid={testID}
|
|
54
|
-
aria-label={accessibilityLabel}
|
|
55
|
-
role={clickable ? 'button' : undefined}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
</Component>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { CardProps } from './types';
|
|
4
|
+
import { cardStyles, cardHoverStyles } from './Card.styles';
|
|
5
|
+
|
|
6
|
+
const Card: React.FC<CardProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
variant = 'default',
|
|
9
|
+
padding = 'medium',
|
|
10
|
+
radius = 'medium',
|
|
11
|
+
intent = 'neutral',
|
|
12
|
+
clickable = false,
|
|
13
|
+
onPress,
|
|
14
|
+
disabled = false,
|
|
15
|
+
style,
|
|
16
|
+
testID,
|
|
17
|
+
accessibilityLabel,
|
|
18
|
+
}) => {
|
|
19
|
+
const handleClick = () => {
|
|
20
|
+
if (!disabled && clickable && onPress) {
|
|
21
|
+
onPress();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Apply variants
|
|
26
|
+
cardStyles.useVariants({
|
|
27
|
+
variant: variant as any,
|
|
28
|
+
padding,
|
|
29
|
+
radius,
|
|
30
|
+
intent,
|
|
31
|
+
clickable,
|
|
32
|
+
disabled,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Create style arrays
|
|
36
|
+
const cardStyleArray = [
|
|
37
|
+
cardStyles.card,
|
|
38
|
+
clickable && !disabled && cardHoverStyles.clickableHover,
|
|
39
|
+
style,
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
|
|
42
|
+
// Generate web props
|
|
43
|
+
const webProps = getWebProps(cardStyleArray);
|
|
44
|
+
|
|
45
|
+
// Use appropriate HTML element based on clickable state
|
|
46
|
+
const Component = clickable ? 'button' : 'div';
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Component
|
|
50
|
+
{...webProps}
|
|
51
|
+
onClick={clickable ? handleClick : undefined}
|
|
52
|
+
disabled={clickable && disabled}
|
|
53
|
+
data-testid={testID}
|
|
54
|
+
aria-label={accessibilityLabel}
|
|
55
|
+
role={clickable ? 'button' : undefined}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Component>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
62
|
export default Card;
|
package/src/Card/index.native.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// React Native-specific Card export
|
|
2
|
-
export { default } from './Card.native';
|
|
1
|
+
// React Native-specific Card export
|
|
2
|
+
export { default } from './Card.native';
|
|
3
3
|
export * from './types';
|
package/src/Card/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Platform-agnostic Card export
|
|
2
|
-
// Metro will resolve to index.native.ts for React Native
|
|
3
|
-
// This file serves as fallback for web environments
|
|
4
|
-
export { default } from './Card.web';
|
|
1
|
+
// Platform-agnostic Card export
|
|
2
|
+
// Metro will resolve to index.native.ts for React Native
|
|
3
|
+
// This file serves as fallback for web environments
|
|
4
|
+
export { default } from './Card.web';
|
|
5
5
|
export * from './types';
|
package/src/Card/index.web.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Web-specific Card export
|
|
2
|
-
export { default } from './Card.web';
|
|
1
|
+
// Web-specific Card export
|
|
2
|
+
export { default } from './Card.web';
|
|
3
3
|
export * from './types';
|
package/src/Card/types.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { IntentVariant } from '../theme/variants';
|
|
3
|
-
|
|
4
|
-
export interface CardProps {
|
|
5
|
-
/**
|
|
6
|
-
* The content to display inside the card
|
|
7
|
-
*/
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The visual style variant of the card
|
|
12
|
-
*/
|
|
13
|
-
variant?: 'default' | 'outlined' | 'elevated' | 'filled';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The padding size inside the card
|
|
17
|
-
*/
|
|
18
|
-
padding?: 'none' | 'small' | 'medium' | 'large';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The border radius of the card
|
|
22
|
-
*/
|
|
23
|
-
radius?: 'none' | 'small' | 'medium' | 'large';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The intent/color scheme of the card
|
|
27
|
-
*/
|
|
28
|
-
intent?: IntentVariant;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Whether the card is clickable
|
|
32
|
-
*/
|
|
33
|
-
clickable?: boolean;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Called when the card is pressed (if clickable)
|
|
37
|
-
*/
|
|
38
|
-
onPress?: () => void;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Whether the card is disabled
|
|
42
|
-
*/
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Additional styles (platform-specific)
|
|
47
|
-
*/
|
|
48
|
-
style?: any;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Test ID for testing
|
|
52
|
-
*/
|
|
53
|
-
testID?: string;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Accessibility label
|
|
57
|
-
*/
|
|
58
|
-
accessibilityLabel?: string;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { IntentVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export interface CardProps {
|
|
5
|
+
/**
|
|
6
|
+
* The content to display inside the card
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The visual style variant of the card
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'default' | 'outlined' | 'elevated' | 'filled';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The padding size inside the card
|
|
17
|
+
*/
|
|
18
|
+
padding?: 'none' | 'small' | 'medium' | 'large';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The border radius of the card
|
|
22
|
+
*/
|
|
23
|
+
radius?: 'none' | 'small' | 'medium' | 'large';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The intent/color scheme of the card
|
|
27
|
+
*/
|
|
28
|
+
intent?: IntentVariant;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Whether the card is clickable
|
|
32
|
+
*/
|
|
33
|
+
clickable?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Called when the card is pressed (if clickable)
|
|
37
|
+
*/
|
|
38
|
+
onPress?: () => void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Whether the card is disabled
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Additional styles (platform-specific)
|
|
47
|
+
*/
|
|
48
|
+
style?: any;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Test ID for testing
|
|
52
|
+
*/
|
|
53
|
+
testID?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Accessibility label
|
|
57
|
+
*/
|
|
58
|
+
accessibilityLabel?: string;
|
|
59
59
|
}
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, Text, Pressable } from 'react-native';
|
|
3
|
-
import { CheckboxProps } from './types';
|
|
4
|
-
import { checkboxStyles, checkboxLabelStyles, checkboxCheckmarkStyles, checkboxHelperStyles } from './Checkbox.styles';
|
|
5
|
-
|
|
6
|
-
const Checkbox: React.FC<CheckboxProps> = ({
|
|
7
|
-
checked = false,
|
|
8
|
-
indeterminate = false,
|
|
9
|
-
disabled = false,
|
|
10
|
-
onCheckedChange,
|
|
11
|
-
size = 'medium',
|
|
12
|
-
intent = 'primary',
|
|
13
|
-
variant = 'default',
|
|
14
|
-
label,
|
|
15
|
-
children,
|
|
16
|
-
style,
|
|
17
|
-
testID,
|
|
18
|
-
accessibilityLabel,
|
|
19
|
-
required = false,
|
|
20
|
-
error,
|
|
21
|
-
helperText,
|
|
22
|
-
}) => {
|
|
23
|
-
const [internalChecked, setInternalChecked] = useState(checked);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
setInternalChecked(checked);
|
|
27
|
-
}, [checked]);
|
|
28
|
-
|
|
29
|
-
const handlePress = () => {
|
|
30
|
-
if (disabled) return;
|
|
31
|
-
|
|
32
|
-
const newChecked = !internalChecked;
|
|
33
|
-
setInternalChecked(newChecked);
|
|
34
|
-
onCheckedChange?.(newChecked);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Apply variants for main checkbox
|
|
38
|
-
checkboxStyles.useVariants({
|
|
39
|
-
size,
|
|
40
|
-
intent,
|
|
41
|
-
variant: variant as any,
|
|
42
|
-
checked: internalChecked,
|
|
43
|
-
disabled,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Apply variants for label
|
|
47
|
-
checkboxLabelStyles.useVariants({
|
|
48
|
-
size,
|
|
49
|
-
disabled,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Apply variants for checkmark
|
|
53
|
-
checkboxCheckmarkStyles.useVariants({
|
|
54
|
-
size,
|
|
55
|
-
visible: internalChecked,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Apply variants for helper text
|
|
59
|
-
checkboxHelperStyles.useVariants({
|
|
60
|
-
error: !!error,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const labelContent = children || label;
|
|
64
|
-
const displayHelperText = error || helperText;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<View style={[checkboxStyles.wrapper, style]}>
|
|
68
|
-
<Pressable
|
|
69
|
-
onPress={handlePress}
|
|
70
|
-
disabled={disabled}
|
|
71
|
-
testID={testID}
|
|
72
|
-
accessibilityLabel={accessibilityLabel}
|
|
73
|
-
accessibilityRole="checkbox"
|
|
74
|
-
accessibilityState={{ checked: internalChecked }}
|
|
75
|
-
style={checkboxStyles.container}
|
|
76
|
-
>
|
|
77
|
-
<View style={checkboxStyles.checkbox}>
|
|
78
|
-
{(internalChecked || indeterminate) && (
|
|
79
|
-
<Text style={checkboxCheckmarkStyles.checkmark}>
|
|
80
|
-
{indeterminate ? '−' : '✓'}
|
|
81
|
-
</Text>
|
|
82
|
-
)}
|
|
83
|
-
</View>
|
|
84
|
-
{labelContent && (
|
|
85
|
-
<Text style={checkboxLabelStyles.label}>
|
|
86
|
-
{labelContent}
|
|
87
|
-
</Text>
|
|
88
|
-
)}
|
|
89
|
-
</Pressable>
|
|
90
|
-
{displayHelperText && (
|
|
91
|
-
<Text style={checkboxHelperStyles.helperText}>
|
|
92
|
-
{error || helperText}
|
|
93
|
-
</Text>
|
|
94
|
-
)}
|
|
95
|
-
</View>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, Pressable } from 'react-native';
|
|
3
|
+
import { CheckboxProps } from './types';
|
|
4
|
+
import { checkboxStyles, checkboxLabelStyles, checkboxCheckmarkStyles, checkboxHelperStyles } from './Checkbox.styles';
|
|
5
|
+
|
|
6
|
+
const Checkbox: React.FC<CheckboxProps> = ({
|
|
7
|
+
checked = false,
|
|
8
|
+
indeterminate = false,
|
|
9
|
+
disabled = false,
|
|
10
|
+
onCheckedChange,
|
|
11
|
+
size = 'medium',
|
|
12
|
+
intent = 'primary',
|
|
13
|
+
variant = 'default',
|
|
14
|
+
label,
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
testID,
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
required = false,
|
|
20
|
+
error,
|
|
21
|
+
helperText,
|
|
22
|
+
}) => {
|
|
23
|
+
const [internalChecked, setInternalChecked] = useState(checked);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setInternalChecked(checked);
|
|
27
|
+
}, [checked]);
|
|
28
|
+
|
|
29
|
+
const handlePress = () => {
|
|
30
|
+
if (disabled) return;
|
|
31
|
+
|
|
32
|
+
const newChecked = !internalChecked;
|
|
33
|
+
setInternalChecked(newChecked);
|
|
34
|
+
onCheckedChange?.(newChecked);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Apply variants for main checkbox
|
|
38
|
+
checkboxStyles.useVariants({
|
|
39
|
+
size,
|
|
40
|
+
intent,
|
|
41
|
+
variant: variant as any,
|
|
42
|
+
checked: internalChecked,
|
|
43
|
+
disabled,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Apply variants for label
|
|
47
|
+
checkboxLabelStyles.useVariants({
|
|
48
|
+
size,
|
|
49
|
+
disabled,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Apply variants for checkmark
|
|
53
|
+
checkboxCheckmarkStyles.useVariants({
|
|
54
|
+
size,
|
|
55
|
+
visible: internalChecked,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Apply variants for helper text
|
|
59
|
+
checkboxHelperStyles.useVariants({
|
|
60
|
+
error: !!error,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const labelContent = children || label;
|
|
64
|
+
const displayHelperText = error || helperText;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<View style={[checkboxStyles.wrapper, style]}>
|
|
68
|
+
<Pressable
|
|
69
|
+
onPress={handlePress}
|
|
70
|
+
disabled={disabled}
|
|
71
|
+
testID={testID}
|
|
72
|
+
accessibilityLabel={accessibilityLabel}
|
|
73
|
+
accessibilityRole="checkbox"
|
|
74
|
+
accessibilityState={{ checked: internalChecked }}
|
|
75
|
+
style={checkboxStyles.container}
|
|
76
|
+
>
|
|
77
|
+
<View style={checkboxStyles.checkbox}>
|
|
78
|
+
{(internalChecked || indeterminate) && (
|
|
79
|
+
<Text style={checkboxCheckmarkStyles.checkmark}>
|
|
80
|
+
{indeterminate ? '−' : '✓'}
|
|
81
|
+
</Text>
|
|
82
|
+
)}
|
|
83
|
+
</View>
|
|
84
|
+
{labelContent && (
|
|
85
|
+
<Text style={checkboxLabelStyles.label}>
|
|
86
|
+
{labelContent}
|
|
87
|
+
</Text>
|
|
88
|
+
)}
|
|
89
|
+
</Pressable>
|
|
90
|
+
{displayHelperText && (
|
|
91
|
+
<Text style={checkboxHelperStyles.helperText}>
|
|
92
|
+
{error || helperText}
|
|
93
|
+
</Text>
|
|
94
|
+
)}
|
|
95
|
+
</View>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
99
|
export default Checkbox;
|