@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
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
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
|
-
// Create style arrays
|
|
29
|
-
const dividerStyleArray = [
|
|
30
|
-
dividerStyles.divider,
|
|
31
|
-
style,
|
|
32
|
-
].filter(Boolean);
|
|
33
|
-
|
|
34
|
-
const containerStyleArray = [dividerStyles.container];
|
|
35
|
-
const contentStyleArray = [dividerStyles.content];
|
|
36
|
-
const lineStyleArray = [dividerStyles.line];
|
|
37
|
-
|
|
38
|
-
// Generate web props
|
|
39
|
-
const dividerProps = getWebProps(dividerStyleArray);
|
|
40
|
-
const containerProps = getWebProps(containerStyleArray);
|
|
41
|
-
const contentProps = getWebProps(contentStyleArray);
|
|
42
|
-
const lineProps = getWebProps(lineStyleArray);
|
|
43
|
-
|
|
44
|
-
// If no children, render simple divider
|
|
45
|
-
if (!children) {
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
{...dividerProps}
|
|
49
|
-
data-testid={testID}
|
|
50
|
-
aria-label={accessibilityLabel}
|
|
51
|
-
role="separator"
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// If has children, render divider with content
|
|
57
|
-
return (
|
|
58
|
-
<div
|
|
59
|
-
{...containerProps}
|
|
60
|
-
data-testid={testID}
|
|
61
|
-
aria-label={accessibilityLabel}
|
|
62
|
-
role="separator"
|
|
63
|
-
>
|
|
64
|
-
<div {...lineProps} />
|
|
65
|
-
<span {...contentProps}>
|
|
66
|
-
{children}
|
|
67
|
-
</span>
|
|
68
|
-
<div {...lineProps} />
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
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
|
+
// Create style arrays
|
|
29
|
+
const dividerStyleArray = [
|
|
30
|
+
dividerStyles.divider,
|
|
31
|
+
style,
|
|
32
|
+
].filter(Boolean);
|
|
33
|
+
|
|
34
|
+
const containerStyleArray = [dividerStyles.container];
|
|
35
|
+
const contentStyleArray = [dividerStyles.content];
|
|
36
|
+
const lineStyleArray = [dividerStyles.line];
|
|
37
|
+
|
|
38
|
+
// Generate web props
|
|
39
|
+
const dividerProps = getWebProps(dividerStyleArray);
|
|
40
|
+
const containerProps = getWebProps(containerStyleArray);
|
|
41
|
+
const contentProps = getWebProps(contentStyleArray);
|
|
42
|
+
const lineProps = getWebProps(lineStyleArray);
|
|
43
|
+
|
|
44
|
+
// If no children, render simple divider
|
|
45
|
+
if (!children) {
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
{...dividerProps}
|
|
49
|
+
data-testid={testID}
|
|
50
|
+
aria-label={accessibilityLabel}
|
|
51
|
+
role="separator"
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// If has children, render divider with content
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
{...containerProps}
|
|
60
|
+
data-testid={testID}
|
|
61
|
+
aria-label={accessibilityLabel}
|
|
62
|
+
role="separator"
|
|
63
|
+
>
|
|
64
|
+
<div {...lineProps} />
|
|
65
|
+
<span {...contentProps}>
|
|
66
|
+
{children}
|
|
67
|
+
</span>
|
|
68
|
+
<div {...lineProps} />
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
73
|
export default Divider;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// React Native-specific Divider export
|
|
2
|
-
export { default } from './Divider.native';
|
|
1
|
+
// React Native-specific Divider export
|
|
2
|
+
export { default } from './Divider.native';
|
|
3
3
|
export * from './types';
|
package/src/Divider/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Platform-agnostic Divider 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 './Divider.web';
|
|
1
|
+
// Platform-agnostic Divider 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 './Divider.web';
|
|
5
5
|
export * from './types';
|
package/src/Divider/index.web.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Web-specific Divider export
|
|
2
|
-
export { default } from './Divider.web';
|
|
1
|
+
// Web-specific Divider export
|
|
2
|
+
export { default } from './Divider.web';
|
|
3
3
|
export * from './types';
|
package/src/Divider/types.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { IntentVariant } from '../theme/variants';
|
|
3
|
-
|
|
4
|
-
export interface DividerProps {
|
|
5
|
-
/**
|
|
6
|
-
* The orientation of the divider
|
|
7
|
-
*/
|
|
8
|
-
orientation?: 'horizontal' | 'vertical';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The visual style variant of the divider
|
|
12
|
-
*/
|
|
13
|
-
variant?: 'solid' | 'dashed' | 'dotted';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The thickness of the divider
|
|
17
|
-
*/
|
|
18
|
-
thickness?: 'thin' | 'medium' | 'thick';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The color intent of the divider
|
|
22
|
-
*/
|
|
23
|
-
intent?: IntentVariant;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The length of the divider (percentage or fixed)
|
|
27
|
-
*/
|
|
28
|
-
length?: 'full' | 'auto' | number;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Spacing around the divider
|
|
32
|
-
*/
|
|
33
|
-
spacing?: 'none' | 'small' | 'medium' | 'large';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Content to display in the center of the divider (for horizontal dividers)
|
|
37
|
-
*/
|
|
38
|
-
children?: ReactNode;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Additional styles (platform-specific)
|
|
42
|
-
*/
|
|
43
|
-
style?: any;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Test ID for testing
|
|
47
|
-
*/
|
|
48
|
-
testID?: string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Accessibility label
|
|
52
|
-
*/
|
|
53
|
-
accessibilityLabel?: string;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { IntentVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export interface DividerProps {
|
|
5
|
+
/**
|
|
6
|
+
* The orientation of the divider
|
|
7
|
+
*/
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The visual style variant of the divider
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'solid' | 'dashed' | 'dotted';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The thickness of the divider
|
|
17
|
+
*/
|
|
18
|
+
thickness?: 'thin' | 'medium' | 'thick';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The color intent of the divider
|
|
22
|
+
*/
|
|
23
|
+
intent?: IntentVariant;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The length of the divider (percentage or fixed)
|
|
27
|
+
*/
|
|
28
|
+
length?: 'full' | 'auto' | number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Spacing around the divider
|
|
32
|
+
*/
|
|
33
|
+
spacing?: 'none' | 'small' | 'medium' | 'large';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Content to display in the center of the divider (for horizontal dividers)
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Additional styles (platform-specific)
|
|
42
|
+
*/
|
|
43
|
+
style?: any;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Test ID for testing
|
|
47
|
+
*/
|
|
48
|
+
testID?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Accessibility label
|
|
52
|
+
*/
|
|
53
|
+
accessibilityLabel?: string;
|
|
54
54
|
}
|
package/src/Icon/Icon.native.tsx
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
3
|
-
import { IconProps } from './types';
|
|
4
|
-
import iconStyles from './Icon.styles';
|
|
5
|
-
|
|
6
|
-
const Icon: React.FC<IconProps> = ({
|
|
7
|
-
name,
|
|
8
|
-
size = 'md',
|
|
9
|
-
color,
|
|
10
|
-
style,
|
|
11
|
-
testID,
|
|
12
|
-
accessibilityLabel,
|
|
13
|
-
}: IconProps) => {
|
|
14
|
-
|
|
15
|
-
// Use Unistyles v3 with color and size variants
|
|
16
|
-
const styles = iconStyles.useVariants({ color, size });
|
|
17
|
-
|
|
18
|
-
// Map size variants to pixel values
|
|
19
|
-
const sizeMap = {
|
|
20
|
-
xs: 12,
|
|
21
|
-
sm: 16,
|
|
22
|
-
md: 24,
|
|
23
|
-
lg: 32,
|
|
24
|
-
xl: 48,
|
|
25
|
-
};
|
|
26
|
-
const iconSize = sizeMap[size];
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<MaterialCommunityIcons
|
|
30
|
-
name={name}
|
|
31
|
-
size={iconSize}
|
|
32
|
-
style={[styles.icon, style]}
|
|
33
|
-
testID={testID}
|
|
34
|
-
accessibilityLabel={accessibilityLabel}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
3
|
+
import { IconProps } from './types';
|
|
4
|
+
import iconStyles from './Icon.styles';
|
|
5
|
+
|
|
6
|
+
const Icon: React.FC<IconProps> = ({
|
|
7
|
+
name,
|
|
8
|
+
size = 'md',
|
|
9
|
+
color,
|
|
10
|
+
style,
|
|
11
|
+
testID,
|
|
12
|
+
accessibilityLabel,
|
|
13
|
+
}: IconProps) => {
|
|
14
|
+
|
|
15
|
+
// Use Unistyles v3 with color and size variants
|
|
16
|
+
const styles = iconStyles.useVariants({ color, size });
|
|
17
|
+
|
|
18
|
+
// Map size variants to pixel values
|
|
19
|
+
const sizeMap = {
|
|
20
|
+
xs: 12,
|
|
21
|
+
sm: 16,
|
|
22
|
+
md: 24,
|
|
23
|
+
lg: 32,
|
|
24
|
+
xl: 48,
|
|
25
|
+
};
|
|
26
|
+
const iconSize = sizeMap[size];
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<MaterialCommunityIcons
|
|
30
|
+
name={name}
|
|
31
|
+
size={iconSize}
|
|
32
|
+
style={[styles.icon, style]}
|
|
33
|
+
testID={testID}
|
|
34
|
+
accessibilityLabel={accessibilityLabel}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
39
|
export default Icon;
|
package/src/Icon/Icon.styles.tsx
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { generateColorVariants } from '../theme/variantHelpers';
|
|
3
|
-
|
|
4
|
-
const iconStyles = StyleSheet.create((theme) => ({
|
|
5
|
-
icon: {
|
|
6
|
-
// Default size (medium)
|
|
7
|
-
width: 24,
|
|
8
|
-
height: 24,
|
|
9
|
-
|
|
10
|
-
// Default theme-based color
|
|
11
|
-
color: theme.colors?.text || '#000000',
|
|
12
|
-
|
|
13
|
-
// Variants for different color schemes and sizes
|
|
14
|
-
variants: {
|
|
15
|
-
// Dynamically generated color variants using generateColorVariants helper
|
|
16
|
-
color: generateColorVariants(theme),
|
|
17
|
-
size: {
|
|
18
|
-
xs: {
|
|
19
|
-
width: 12,
|
|
20
|
-
height: 12,
|
|
21
|
-
},
|
|
22
|
-
sm: {
|
|
23
|
-
width: 16,
|
|
24
|
-
height: 16,
|
|
25
|
-
},
|
|
26
|
-
md: {
|
|
27
|
-
width: 24,
|
|
28
|
-
height: 24,
|
|
29
|
-
},
|
|
30
|
-
lg: {
|
|
31
|
-
width: 32,
|
|
32
|
-
height: 32,
|
|
33
|
-
},
|
|
34
|
-
xl: {
|
|
35
|
-
width: 48,
|
|
36
|
-
height: 48,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
// Web-specific styles
|
|
42
|
-
_web: {
|
|
43
|
-
display: 'inline-block',
|
|
44
|
-
verticalAlign: 'middle',
|
|
45
|
-
flexShrink: 0,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
}));
|
|
49
|
-
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { generateColorVariants } from '../theme/variantHelpers';
|
|
3
|
+
|
|
4
|
+
const iconStyles = StyleSheet.create((theme) => ({
|
|
5
|
+
icon: {
|
|
6
|
+
// Default size (medium)
|
|
7
|
+
width: 24,
|
|
8
|
+
height: 24,
|
|
9
|
+
|
|
10
|
+
// Default theme-based color
|
|
11
|
+
color: theme.colors?.text || '#000000',
|
|
12
|
+
|
|
13
|
+
// Variants for different color schemes and sizes
|
|
14
|
+
variants: {
|
|
15
|
+
// Dynamically generated color variants using generateColorVariants helper
|
|
16
|
+
color: generateColorVariants(theme),
|
|
17
|
+
size: {
|
|
18
|
+
xs: {
|
|
19
|
+
width: 12,
|
|
20
|
+
height: 12,
|
|
21
|
+
},
|
|
22
|
+
sm: {
|
|
23
|
+
width: 16,
|
|
24
|
+
height: 16,
|
|
25
|
+
},
|
|
26
|
+
md: {
|
|
27
|
+
width: 24,
|
|
28
|
+
height: 24,
|
|
29
|
+
},
|
|
30
|
+
lg: {
|
|
31
|
+
width: 32,
|
|
32
|
+
height: 32,
|
|
33
|
+
},
|
|
34
|
+
xl: {
|
|
35
|
+
width: 48,
|
|
36
|
+
height: 48,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Web-specific styles
|
|
42
|
+
_web: {
|
|
43
|
+
display: 'inline-block',
|
|
44
|
+
verticalAlign: 'middle',
|
|
45
|
+
flexShrink: 0,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
50
|
export default iconStyles;
|
package/src/Icon/Icon.web.tsx
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import MdiIcon from '@mdi/react';
|
|
3
|
-
import { IconProps } from './types';
|
|
4
|
-
import iconStyles from './Icon.styles';
|
|
5
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
6
|
-
|
|
7
|
-
// Internal props that include the transformed path from Babel plugin
|
|
8
|
-
interface InternalIconProps extends IconProps {
|
|
9
|
-
path?: string; // Added by Babel plugin transformation
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const Icon: React.FC<IconProps> = (props: InternalIconProps) => {
|
|
13
|
-
const {
|
|
14
|
-
name,
|
|
15
|
-
size = 'md',
|
|
16
|
-
color,
|
|
17
|
-
style,
|
|
18
|
-
testID,
|
|
19
|
-
accessibilityLabel,
|
|
20
|
-
...restProps
|
|
21
|
-
} = props;
|
|
22
|
-
|
|
23
|
-
// Use Unistyles v3 with color and size variants
|
|
24
|
-
const styles = iconStyles.useVariants({ color, size });
|
|
25
|
-
console.log(styles);
|
|
26
|
-
|
|
27
|
-
// Check if we have a path prop (from Babel plugin transformation)
|
|
28
|
-
const { path } = restProps as { path?: string };
|
|
29
|
-
const iconProps = getWebProps(styles.icon);
|
|
30
|
-
|
|
31
|
-
// Use MDI React icon when path is provided (transformed by Babel plugin)
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
{...iconProps}>
|
|
35
|
-
<MdiIcon
|
|
36
|
-
path={path}
|
|
37
|
-
size={'100%'}
|
|
38
|
-
color={'currentColor'}
|
|
39
|
-
data-testid={testID}
|
|
40
|
-
aria-label={accessibilityLabel || name}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MdiIcon from '@mdi/react';
|
|
3
|
+
import { IconProps } from './types';
|
|
4
|
+
import iconStyles from './Icon.styles';
|
|
5
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
6
|
+
|
|
7
|
+
// Internal props that include the transformed path from Babel plugin
|
|
8
|
+
interface InternalIconProps extends IconProps {
|
|
9
|
+
path?: string; // Added by Babel plugin transformation
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Icon: React.FC<IconProps> = (props: InternalIconProps) => {
|
|
13
|
+
const {
|
|
14
|
+
name,
|
|
15
|
+
size = 'md',
|
|
16
|
+
color,
|
|
17
|
+
style,
|
|
18
|
+
testID,
|
|
19
|
+
accessibilityLabel,
|
|
20
|
+
...restProps
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
// Use Unistyles v3 with color and size variants
|
|
24
|
+
const styles = iconStyles.useVariants({ color, size });
|
|
25
|
+
console.log(styles);
|
|
26
|
+
|
|
27
|
+
// Check if we have a path prop (from Babel plugin transformation)
|
|
28
|
+
const { path } = restProps as { path?: string };
|
|
29
|
+
const iconProps = getWebProps(styles.icon);
|
|
30
|
+
|
|
31
|
+
// Use MDI React icon when path is provided (transformed by Babel plugin)
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
{...iconProps}>
|
|
35
|
+
<MdiIcon
|
|
36
|
+
path={path}
|
|
37
|
+
size={'100%'}
|
|
38
|
+
color={'currentColor'}
|
|
39
|
+
data-testid={testID}
|
|
40
|
+
aria-label={accessibilityLabel || name}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
};
|
|
46
|
+
|
|
47
47
|
export default Icon;
|