@idealyst/components 1.1.0 → 1.1.2
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/package.json +3 -3
- package/src/Accordion/Accordion.native.tsx +2 -1
- package/src/Accordion/Accordion.web.tsx +2 -1
- package/src/ActivityIndicator/ActivityIndicator.native.tsx +2 -0
- package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -1
- package/src/ActivityIndicator/types.ts +2 -1
- package/src/Alert/Alert.native.tsx +2 -0
- package/src/Alert/Alert.web.tsx +2 -0
- package/src/Alert/types.ts +2 -1
- package/src/Avatar/Avatar.native.tsx +2 -1
- package/src/Avatar/Avatar.web.tsx +2 -1
- package/src/Avatar/types.ts +2 -1
- package/src/Badge/Badge.native.tsx +3 -0
- package/src/Badge/Badge.web.tsx +3 -0
- package/src/Badge/types.ts +2 -1
- package/src/Breadcrumb/Breadcrumb.native.tsx +2 -0
- package/src/Breadcrumb/Breadcrumb.web.tsx +2 -1
- package/src/Breadcrumb/types.ts +2 -1
- package/src/Button/Button.native.tsx +17 -12
- package/src/Button/Button.styles.tsx +2 -2
- package/src/Button/Button.web.tsx +2 -0
- package/src/Button/types.ts +2 -1
- package/src/Card/Card.native.tsx +2 -0
- package/src/Card/Card.web.tsx +2 -0
- package/src/Checkbox/Checkbox.native.tsx +2 -1
- package/src/Checkbox/Checkbox.web.tsx +2 -1
- package/src/Chip/Chip.native.tsx +3 -1
- package/src/Chip/Chip.web.tsx +2 -0
- package/src/Chip/types.ts +2 -1
- package/src/Dialog/Dialog.native.tsx +2 -0
- package/src/Dialog/Dialog.web.tsx +2 -0
- package/src/Dialog/types.ts +2 -1
- package/src/Divider/Divider.native.tsx +4 -0
- package/src/Divider/Divider.web.tsx +3 -0
- package/src/Divider/types.ts +2 -1
- package/src/Icon/Icon.native.tsx +2 -0
- package/src/Icon/Icon.web.tsx +3 -1
- package/src/Icon/types.ts +2 -1
- package/src/Image/Image.native.tsx +2 -1
- package/src/Image/Image.web.tsx +2 -0
- package/src/Image/types.ts +2 -1
- package/src/Input/Input.native.tsx +2 -1
- package/src/Input/Input.web.tsx +2 -1
- package/src/Link/Link.native.tsx +2 -0
- package/src/Link/Link.web.tsx +2 -0
- package/src/Link/types.ts +2 -1
- package/src/List/List.native.tsx +3 -1
- package/src/List/List.web.tsx +2 -0
- package/src/Menu/Menu.native.tsx +2 -1
- package/src/Menu/Menu.web.tsx +2 -0
- package/src/Menu/types.ts +2 -1
- package/src/Popover/Popover.native.tsx +2 -0
- package/src/Popover/Popover.web.tsx +2 -1
- package/src/Popover/types.ts +2 -1
- package/src/Pressable/Pressable.native.tsx +2 -1
- package/src/Pressable/Pressable.web.tsx +2 -0
- package/src/Progress/Progress.native.tsx +3 -2
- package/src/Progress/Progress.web.tsx +3 -2
- package/src/Progress/types.ts +2 -1
- package/src/RadioButton/RadioButton.native.tsx +2 -0
- package/src/RadioButton/RadioButton.web.tsx +2 -0
- package/src/RadioButton/RadioGroup.native.tsx +2 -0
- package/src/RadioButton/RadioGroup.web.tsx +2 -0
- package/src/RadioButton/types.ts +2 -2
- package/src/SVGImage/SVGImage.native.tsx +3 -2
- package/src/SVGImage/SVGImage.web.tsx +3 -2
- package/src/SVGImage/types.ts +2 -1
- package/src/Screen/Screen.native.tsx +3 -1
- package/src/Screen/Screen.web.tsx +2 -0
- package/src/Select/Select.native.tsx +2 -1
- package/src/Select/Select.web.tsx +2 -1
- package/src/Skeleton/Skeleton.native.tsx +4 -0
- package/src/Skeleton/Skeleton.web.tsx +4 -0
- package/src/Skeleton/types.ts +3 -2
- package/src/Slider/Slider.native.tsx +2 -1
- package/src/Slider/Slider.web.tsx +2 -1
- package/src/Switch/Switch.native.tsx +3 -0
- package/src/Switch/Switch.web.tsx +2 -0
- package/src/TabBar/TabBar.native.tsx +2 -1
- package/src/TabBar/TabBar.web.tsx +2 -0
- package/src/Table/Table.native.tsx +2 -0
- package/src/Table/Table.web.tsx +2 -1
- package/src/Text/Text.native.tsx +2 -0
- package/src/Text/Text.web.tsx +2 -0
- package/src/TextArea/TextArea.native.tsx +2 -1
- package/src/TextArea/TextArea.web.tsx +2 -1
- package/src/Tooltip/Tooltip.native.tsx +2 -1
- package/src/Tooltip/Tooltip.web.tsx +2 -0
- package/src/Tooltip/types.ts +2 -1
- package/src/Video/Video.native.tsx +3 -2
- package/src/Video/Video.web.tsx +2 -0
- package/src/Video/types.ts +2 -1
- package/src/View/View.native.tsx +3 -1
- package/src/View/View.web.tsx +2 -0
- package/src/utils/viewStyleProps.ts +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Shared component library for React and React Native",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"publish:npm": "npm publish"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@idealyst/theme": "^1.1.
|
|
44
|
+
"@idealyst/theme": "^1.1.2",
|
|
45
45
|
"@mdi/js": ">=7.0.0",
|
|
46
46
|
"@mdi/react": ">=1.0.0",
|
|
47
47
|
"@react-native-vector-icons/common": ">=12.0.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@idealyst/theme": "^1.1.
|
|
94
|
+
"@idealyst/theme": "^1.1.2",
|
|
95
95
|
"@mdi/react": "^1.6.1",
|
|
96
96
|
"@types/react": "^19.1.0",
|
|
97
97
|
"react": "^19.1.0",
|
|
@@ -142,6 +142,7 @@ const Accordion = forwardRef<View, AccordionProps>(({
|
|
|
142
142
|
marginHorizontal,
|
|
143
143
|
style,
|
|
144
144
|
testID,
|
|
145
|
+
id,
|
|
145
146
|
}, ref) => {
|
|
146
147
|
const [expandedItems, setExpandedItems] = useState<string[]>(defaultExpanded);
|
|
147
148
|
|
|
@@ -175,7 +176,7 @@ const Accordion = forwardRef<View, AccordionProps>(({
|
|
|
175
176
|
};
|
|
176
177
|
|
|
177
178
|
return (
|
|
178
|
-
<View ref={ref} style={[accordionStyles.container, style]} testID={testID}>
|
|
179
|
+
<View ref={ref} nativeID={id} style={[accordionStyles.container, style]} testID={testID}>
|
|
179
180
|
{items.map((item, index) => (
|
|
180
181
|
<AccordionItem
|
|
181
182
|
key={item.id}
|
|
@@ -108,6 +108,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
108
108
|
marginHorizontal,
|
|
109
109
|
style,
|
|
110
110
|
testID,
|
|
111
|
+
id,
|
|
111
112
|
}) => {
|
|
112
113
|
const [expandedItems, setExpandedItems] = useState<string[]>(defaultExpanded);
|
|
113
114
|
|
|
@@ -143,7 +144,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
143
144
|
};
|
|
144
145
|
|
|
145
146
|
return (
|
|
146
|
-
<div {...containerProps} data-testid={testID}>
|
|
147
|
+
<div {...containerProps} id={id} data-testid={testID}>
|
|
147
148
|
{items.map((item) => (
|
|
148
149
|
<AccordionItem
|
|
149
150
|
key={item.id}
|
|
@@ -11,6 +11,7 @@ const ActivityIndicator = forwardRef<View, ActivityIndicatorProps>(({
|
|
|
11
11
|
style,
|
|
12
12
|
testID,
|
|
13
13
|
hidesWhenStopped = true,
|
|
14
|
+
id,
|
|
14
15
|
}, ref) => {
|
|
15
16
|
// Handle numeric size
|
|
16
17
|
const sizeVariant = typeof size === 'number' ? 'md' : size;
|
|
@@ -41,6 +42,7 @@ const ActivityIndicator = forwardRef<View, ActivityIndicatorProps>(({
|
|
|
41
42
|
style
|
|
42
43
|
]}
|
|
43
44
|
ref={ref}
|
|
45
|
+
nativeID={id}
|
|
44
46
|
testID={testID}
|
|
45
47
|
>
|
|
46
48
|
<RNActivityIndicator
|
|
@@ -12,6 +12,7 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
|
|
|
12
12
|
style,
|
|
13
13
|
testID,
|
|
14
14
|
hidesWhenStopped = true,
|
|
15
|
+
id,
|
|
15
16
|
}, ref) => {
|
|
16
17
|
// Handle numeric size
|
|
17
18
|
const sizeVariant = typeof size === 'number' ? 'md' : size;
|
|
@@ -71,7 +72,7 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
|
|
|
71
72
|
}
|
|
72
73
|
`}
|
|
73
74
|
</style>
|
|
74
|
-
<div {...containerProps} ref={mergedRef} data-testid={testID}>
|
|
75
|
+
<div {...containerProps} ref={mergedRef} id={id} data-testid={testID}>
|
|
75
76
|
<div {...spinnerProps} />
|
|
76
77
|
</div>
|
|
77
78
|
</>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Intent, Size } from '@idealyst/theme';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
3
4
|
|
|
4
5
|
// Component-specific type aliases for future extensibility
|
|
5
6
|
export type ActivityIndicatorIntentVariant = Intent;
|
|
6
7
|
export type ActivityIndicatorSizeVariant = Size;
|
|
7
8
|
|
|
8
|
-
export interface ActivityIndicatorProps {
|
|
9
|
+
export interface ActivityIndicatorProps extends BaseProps {
|
|
9
10
|
/**
|
|
10
11
|
* Whether the indicator is animating (visible)
|
|
11
12
|
* @default true
|
|
@@ -28,6 +28,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
28
28
|
actions,
|
|
29
29
|
style,
|
|
30
30
|
testID,
|
|
31
|
+
id,
|
|
31
32
|
}, ref) => {
|
|
32
33
|
// Apply variants to stylesheet
|
|
33
34
|
alertStyles.useVariants({
|
|
@@ -58,6 +59,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
58
59
|
return (
|
|
59
60
|
<View
|
|
60
61
|
ref={ref}
|
|
62
|
+
nativeID={id}
|
|
61
63
|
style={[alertStyles.container, style]}
|
|
62
64
|
testID={testID}
|
|
63
65
|
accessibilityRole="alert"
|
package/src/Alert/Alert.web.tsx
CHANGED
|
@@ -29,6 +29,7 @@ const Alert = forwardRef<HTMLDivElement, AlertProps>(({
|
|
|
29
29
|
actions,
|
|
30
30
|
style,
|
|
31
31
|
testID,
|
|
32
|
+
id,
|
|
32
33
|
}, ref) => {
|
|
33
34
|
// Apply variants to stylesheet
|
|
34
35
|
alertStyles.useVariants({
|
|
@@ -73,6 +74,7 @@ const Alert = forwardRef<HTMLDivElement, AlertProps>(({
|
|
|
73
74
|
<div
|
|
74
75
|
{...containerProps}
|
|
75
76
|
ref={mergedRef}
|
|
77
|
+
id={id}
|
|
76
78
|
data-testid={testID}
|
|
77
79
|
role="alert"
|
|
78
80
|
>
|
package/src/Alert/types.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
import type { Intent } from '@idealyst/theme';
|
|
3
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
3
4
|
|
|
4
5
|
// Component-specific type aliases for future extensibility
|
|
5
6
|
export type AlertIntentVariant = Intent;
|
|
6
7
|
export type AlertType= 'filled' | 'outlined' | 'soft';
|
|
7
8
|
|
|
8
|
-
export interface AlertProps {
|
|
9
|
+
export interface AlertProps extends BaseProps {
|
|
9
10
|
title?: string;
|
|
10
11
|
message?: string;
|
|
11
12
|
children?: React.ReactNode;
|
|
@@ -11,6 +11,7 @@ const Avatar = forwardRef<View, AvatarProps>(({
|
|
|
11
11
|
shape = 'circle',
|
|
12
12
|
style,
|
|
13
13
|
testID,
|
|
14
|
+
id,
|
|
14
15
|
}, ref) => {
|
|
15
16
|
const [hasError, setHasError] = useState(false);
|
|
16
17
|
|
|
@@ -24,7 +25,7 @@ const Avatar = forwardRef<View, AvatarProps>(({
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
return (
|
|
27
|
-
<View ref={ref} style={[avatarStyles.avatar, style]} testID={testID}>
|
|
28
|
+
<View ref={ref} nativeID={id} style={[avatarStyles.avatar, style]} testID={testID}>
|
|
28
29
|
{src && !hasError ? (
|
|
29
30
|
<Image
|
|
30
31
|
source={typeof src === 'string' ? { uri: src } : src}
|
|
@@ -12,6 +12,7 @@ const Avatar = forwardRef<HTMLDivElement, AvatarProps>(({
|
|
|
12
12
|
shape = 'circle',
|
|
13
13
|
style,
|
|
14
14
|
testID,
|
|
15
|
+
id,
|
|
15
16
|
}, ref) => {
|
|
16
17
|
const [hasError, setHasError] = useState(false);
|
|
17
18
|
|
|
@@ -34,7 +35,7 @@ const Avatar = forwardRef<HTMLDivElement, AvatarProps>(({
|
|
|
34
35
|
const mergedRef = useMergeRefs(ref, avatarProps.ref);
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<div {...avatarProps} ref={mergedRef} data-testid={testID}>
|
|
38
|
+
<div {...avatarProps} ref={mergedRef} id={id} data-testid={testID}>
|
|
38
39
|
{src && !hasError ? (
|
|
39
40
|
<img
|
|
40
41
|
src={src as any}
|
package/src/Avatar/types.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Color } from '@idealyst/theme';
|
|
2
2
|
import type { StyleProp, ViewStyle, ImageSourcePropType } from 'react-native';
|
|
3
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
3
4
|
|
|
4
5
|
// Component-specific type aliases for future extensibility
|
|
5
6
|
export type AvatarColorVariant = Color;
|
|
6
7
|
export type AvatarSizeVariant = 'sm' | 'md' | 'lg' | 'xl';
|
|
7
8
|
export type AvatarShapeVariant = 'circle' | 'square';
|
|
8
9
|
|
|
9
|
-
export interface AvatarProps {
|
|
10
|
+
export interface AvatarProps extends BaseProps {
|
|
10
11
|
/**
|
|
11
12
|
* Image source (URL or require())
|
|
12
13
|
*/
|
|
@@ -13,6 +13,7 @@ const Badge = forwardRef<View, BadgeProps>(({
|
|
|
13
13
|
color = 'blue',
|
|
14
14
|
style,
|
|
15
15
|
testID,
|
|
16
|
+
id,
|
|
16
17
|
}, ref) => {
|
|
17
18
|
badgeStyles.useVariants({
|
|
18
19
|
size,
|
|
@@ -48,6 +49,7 @@ const Badge = forwardRef<View, BadgeProps>(({
|
|
|
48
49
|
if (type === 'dot') {
|
|
49
50
|
return (
|
|
50
51
|
<View
|
|
52
|
+
nativeID={id}
|
|
51
53
|
style={[badgeStyle, style]}
|
|
52
54
|
testID={testID}
|
|
53
55
|
accessibilityLabel="status indicator"
|
|
@@ -61,6 +63,7 @@ const Badge = forwardRef<View, BadgeProps>(({
|
|
|
61
63
|
return (
|
|
62
64
|
<View
|
|
63
65
|
ref={ref}
|
|
66
|
+
nativeID={id}
|
|
64
67
|
style={[badgeStyle, style]}
|
|
65
68
|
testID={testID}
|
|
66
69
|
accessibilityLabel="badge"
|
package/src/Badge/Badge.web.tsx
CHANGED
|
@@ -20,6 +20,7 @@ const Badge = forwardRef<HTMLSpanElement, BadgeProps>((props: InternalBadgeProps
|
|
|
20
20
|
iconPath,
|
|
21
21
|
style,
|
|
22
22
|
testID,
|
|
23
|
+
id,
|
|
23
24
|
} = props;
|
|
24
25
|
|
|
25
26
|
badgeStyles.useVariants({
|
|
@@ -63,6 +64,7 @@ const Badge = forwardRef<HTMLSpanElement, BadgeProps>((props: InternalBadgeProps
|
|
|
63
64
|
{...badgeProps}
|
|
64
65
|
style={style as React.CSSProperties}
|
|
65
66
|
ref={mergedRef}
|
|
67
|
+
id={id}
|
|
66
68
|
data-testid={testID}
|
|
67
69
|
role="status"
|
|
68
70
|
aria-label="status indicator"
|
|
@@ -77,6 +79,7 @@ const Badge = forwardRef<HTMLSpanElement, BadgeProps>((props: InternalBadgeProps
|
|
|
77
79
|
{...badgeProps}
|
|
78
80
|
style={style as React.CSSProperties}
|
|
79
81
|
ref={mergedRef}
|
|
82
|
+
id={id}
|
|
80
83
|
data-testid={testID}
|
|
81
84
|
role="status"
|
|
82
85
|
>
|
package/src/Badge/types.ts
CHANGED
|
@@ -2,13 +2,14 @@ import type { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { IconName } from '../Icon/icon-types';
|
|
4
4
|
import { Color, Size } from '@idealyst/theme';
|
|
5
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
5
6
|
|
|
6
7
|
// Component-specific type aliases for future extensibility
|
|
7
8
|
export type BadgeColorVariant = Color;
|
|
8
9
|
export type BadgeSizeVariant = Size;
|
|
9
10
|
export type BadgeType = 'filled' | 'outlined' | 'dot';
|
|
10
11
|
|
|
11
|
-
export interface BadgeProps {
|
|
12
|
+
export interface BadgeProps extends BaseProps {
|
|
12
13
|
/**
|
|
13
14
|
* The content to display inside the badge
|
|
14
15
|
*/
|
|
@@ -121,6 +121,7 @@ const Breadcrumb = forwardRef<View, BreadcrumbProps>(({
|
|
|
121
121
|
testID,
|
|
122
122
|
responsive = false,
|
|
123
123
|
minVisibleItems = 3,
|
|
124
|
+
id,
|
|
124
125
|
}, ref) => {
|
|
125
126
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
126
127
|
|
|
@@ -163,6 +164,7 @@ const Breadcrumb = forwardRef<View, BreadcrumbProps>(({
|
|
|
163
164
|
return (
|
|
164
165
|
<View
|
|
165
166
|
ref={ref}
|
|
167
|
+
nativeID={id}
|
|
166
168
|
style={[breadcrumbContainerStyles.container, style]}
|
|
167
169
|
testID={testID}
|
|
168
170
|
accessibilityLabel="Breadcrumb"
|
|
@@ -157,6 +157,7 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({
|
|
|
157
157
|
testID,
|
|
158
158
|
responsive = false,
|
|
159
159
|
minVisibleItems = 3,
|
|
160
|
+
id,
|
|
160
161
|
}) => {
|
|
161
162
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
162
163
|
const containerProps = getWebProps([breadcrumbContainerStyles.container, style as any]);
|
|
@@ -200,7 +201,7 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({
|
|
|
200
201
|
}));
|
|
201
202
|
|
|
202
203
|
return (
|
|
203
|
-
<nav {...containerProps} aria-label="Breadcrumb" data-testid={testID}>
|
|
204
|
+
<nav {...containerProps} aria-label="Breadcrumb" id={id} data-testid={testID}>
|
|
204
205
|
{displayItems.map((item, index) => {
|
|
205
206
|
const isLast = index === displayItems.length - 1;
|
|
206
207
|
const shouldShowEllipsis = showEllipsis && index === 1;
|
package/src/Breadcrumb/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
2
|
import type { IconName } from '../Icon/icon-types';
|
|
3
3
|
import { Size } from '@idealyst/theme';
|
|
4
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type BreadcrumbIntentVariant = 'primary' | 'neutral';
|
|
@@ -20,7 +21,7 @@ export interface BreadcrumbItem {
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export interface BreadcrumbProps {
|
|
24
|
+
export interface BreadcrumbProps extends BaseProps {
|
|
24
25
|
/** Array of breadcrumb items */
|
|
25
26
|
items: BreadcrumbItem[];
|
|
26
27
|
|
|
@@ -19,6 +19,7 @@ const Button = forwardRef<ComponentRef<typeof TouchableOpacity>, ButtonProps>((p
|
|
|
19
19
|
rightIcon,
|
|
20
20
|
style,
|
|
21
21
|
testID,
|
|
22
|
+
id,
|
|
22
23
|
} = props;
|
|
23
24
|
|
|
24
25
|
// Apply variants
|
|
@@ -107,19 +108,23 @@ const Button = forwardRef<ComponentRef<typeof TouchableOpacity>, ButtonProps>((p
|
|
|
107
108
|
);
|
|
108
109
|
};
|
|
109
110
|
|
|
111
|
+
// TouchableOpacity types don't include nativeID but it's a valid RN prop
|
|
112
|
+
const touchableProps = {
|
|
113
|
+
ref,
|
|
114
|
+
onPress,
|
|
115
|
+
disabled,
|
|
116
|
+
testID,
|
|
117
|
+
nativeID: id,
|
|
118
|
+
activeOpacity: 0.7,
|
|
119
|
+
style: [
|
|
120
|
+
buttonStyle,
|
|
121
|
+
showGradient && { overflow: 'hidden' },
|
|
122
|
+
style,
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
|
|
110
126
|
return (
|
|
111
|
-
<TouchableOpacity
|
|
112
|
-
ref={ref}
|
|
113
|
-
onPress={onPress}
|
|
114
|
-
disabled={disabled}
|
|
115
|
-
testID={testID}
|
|
116
|
-
activeOpacity={0.7}
|
|
117
|
-
style={[
|
|
118
|
-
buttonStyle,
|
|
119
|
-
showGradient && { overflow: 'hidden' },
|
|
120
|
-
style,
|
|
121
|
-
]}
|
|
122
|
-
>
|
|
127
|
+
<TouchableOpacity {...touchableProps as any}>
|
|
123
128
|
{renderGradientLayer()}
|
|
124
129
|
{hasIcons ? (
|
|
125
130
|
<View style={buttonStyles.iconContainer}>
|
|
@@ -35,9 +35,9 @@ function createTypeVariants(theme: Theme) {
|
|
|
35
35
|
borderWidth: 0,
|
|
36
36
|
},
|
|
37
37
|
outlined: {
|
|
38
|
-
borderWidth:
|
|
38
|
+
borderWidth: 1,
|
|
39
39
|
borderStyle: 'solid' ,
|
|
40
|
-
backgroundColor:
|
|
40
|
+
backgroundColor: theme.colors.surface.primary,
|
|
41
41
|
},
|
|
42
42
|
text: {
|
|
43
43
|
borderWidth: 0,
|
|
@@ -28,6 +28,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props: InternalButton
|
|
|
28
28
|
rightIconPath,
|
|
29
29
|
style,
|
|
30
30
|
testID,
|
|
31
|
+
id,
|
|
31
32
|
} = props;
|
|
32
33
|
|
|
33
34
|
buttonStyles.useVariants({
|
|
@@ -95,6 +96,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props: InternalButton
|
|
|
95
96
|
<button
|
|
96
97
|
{...webProps}
|
|
97
98
|
ref={mergedRef}
|
|
99
|
+
id={id}
|
|
98
100
|
onClick={handleClick}
|
|
99
101
|
disabled={disabled}
|
|
100
102
|
data-testid={testID}
|
package/src/Button/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { IconName } from '../Icon/icon-types';
|
|
4
4
|
import { Intent, Size } from '@idealyst/theme';
|
|
5
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
5
6
|
|
|
6
7
|
// Component-specific type aliases for future extensibility
|
|
7
8
|
export type ButtonType = 'contained' | 'outlined' | 'text';
|
|
@@ -16,7 +17,7 @@ export type ButtonSizeVariant = Size;
|
|
|
16
17
|
*/
|
|
17
18
|
export type ButtonGradient = 'darken' | 'lighten';
|
|
18
19
|
|
|
19
|
-
export interface ButtonProps {
|
|
20
|
+
export interface ButtonProps extends BaseProps {
|
|
20
21
|
/**
|
|
21
22
|
* The text or content to display inside the button
|
|
22
23
|
*/
|
package/src/Card/Card.native.tsx
CHANGED
|
@@ -22,6 +22,7 @@ const Card = forwardRef<ComponentRef<typeof View> | ComponentRef<typeof Pressabl
|
|
|
22
22
|
style,
|
|
23
23
|
testID,
|
|
24
24
|
accessibilityLabel,
|
|
25
|
+
id,
|
|
25
26
|
}, ref) => {
|
|
26
27
|
// Apply variants
|
|
27
28
|
cardStyles.useVariants({
|
|
@@ -44,6 +45,7 @@ const Card = forwardRef<ComponentRef<typeof View> | ComponentRef<typeof Pressabl
|
|
|
44
45
|
|
|
45
46
|
const componentProps = {
|
|
46
47
|
ref,
|
|
48
|
+
nativeID: id,
|
|
47
49
|
style: [cardStyles.card, style],
|
|
48
50
|
testID,
|
|
49
51
|
accessibilityLabel,
|
package/src/Card/Card.web.tsx
CHANGED
|
@@ -23,6 +23,7 @@ const Card = forwardRef<HTMLDivElement | HTMLButtonElement, CardProps>(({
|
|
|
23
23
|
style,
|
|
24
24
|
testID,
|
|
25
25
|
accessibilityLabel,
|
|
26
|
+
id,
|
|
26
27
|
}, ref) => {
|
|
27
28
|
const handleClick = () => {
|
|
28
29
|
if (!disabled && clickable && onPress) {
|
|
@@ -58,6 +59,7 @@ const Card = forwardRef<HTMLDivElement | HTMLButtonElement, CardProps>(({
|
|
|
58
59
|
<Component
|
|
59
60
|
{...webProps}
|
|
60
61
|
ref={mergedRef as any}
|
|
62
|
+
id={id}
|
|
61
63
|
onClick={clickable ? handleClick : undefined}
|
|
62
64
|
disabled={clickable && disabled}
|
|
63
65
|
data-testid={testID}
|
|
@@ -24,6 +24,7 @@ const Checkbox = forwardRef<View, CheckboxProps>(({
|
|
|
24
24
|
required = false,
|
|
25
25
|
error,
|
|
26
26
|
helperText,
|
|
27
|
+
id,
|
|
27
28
|
}, ref) => {
|
|
28
29
|
const [internalChecked, setInternalChecked] = useState(checked);
|
|
29
30
|
|
|
@@ -56,7 +57,7 @@ const Checkbox = forwardRef<View, CheckboxProps>(({
|
|
|
56
57
|
const displayHelperText = error || helperText;
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
|
-
<View ref={ref} style={[checkboxStyles.wrapper, style]}>
|
|
60
|
+
<View ref={ref} nativeID={id} style={[checkboxStyles.wrapper, style]}>
|
|
60
61
|
<Pressable
|
|
61
62
|
onPress={handlePress}
|
|
62
63
|
disabled={disabled}
|
|
@@ -26,6 +26,7 @@ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps>(({
|
|
|
26
26
|
required = false,
|
|
27
27
|
error,
|
|
28
28
|
helperText,
|
|
29
|
+
id,
|
|
29
30
|
}, ref) => {
|
|
30
31
|
const [internalChecked, setInternalChecked] = useState(checked);
|
|
31
32
|
|
|
@@ -76,7 +77,7 @@ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps>(({
|
|
|
76
77
|
const mergedRef = useMergeRefs(ref, wrapperProps.ref);
|
|
77
78
|
|
|
78
79
|
return (
|
|
79
|
-
<div {...wrapperProps} ref={mergedRef}>
|
|
80
|
+
<div {...wrapperProps} ref={mergedRef} id={id}>
|
|
80
81
|
<label {...containerProps}>
|
|
81
82
|
<div style={{ position: 'relative' }}>
|
|
82
83
|
<input
|
package/src/Chip/Chip.native.tsx
CHANGED
|
@@ -19,6 +19,7 @@ const Chip = forwardRef<ComponentRef<typeof Pressable>, ChipProps>(({
|
|
|
19
19
|
disabled = false,
|
|
20
20
|
style,
|
|
21
21
|
testID,
|
|
22
|
+
id,
|
|
22
23
|
}, ref) => {
|
|
23
24
|
const handlePress = () => {
|
|
24
25
|
if (disabled) return;
|
|
@@ -99,6 +100,7 @@ const Chip = forwardRef<ComponentRef<typeof Pressable>, ChipProps>(({
|
|
|
99
100
|
return (
|
|
100
101
|
<Pressable
|
|
101
102
|
ref={ref}
|
|
103
|
+
nativeID={id}
|
|
102
104
|
onPress={handlePress}
|
|
103
105
|
disabled={disabled}
|
|
104
106
|
accessibilityRole="button"
|
|
@@ -115,7 +117,7 @@ const Chip = forwardRef<ComponentRef<typeof Pressable>, ChipProps>(({
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
return (
|
|
118
|
-
<View ref={ref} style={[containerStyle, style]} testID={testID}>
|
|
120
|
+
<View ref={ref} nativeID={id} style={[containerStyle, style]} testID={testID}>
|
|
119
121
|
{innerContent}
|
|
120
122
|
</View>
|
|
121
123
|
);
|
package/src/Chip/Chip.web.tsx
CHANGED
|
@@ -21,6 +21,7 @@ const Chip = forwardRef<HTMLDivElement, ChipProps>(({
|
|
|
21
21
|
disabled = false,
|
|
22
22
|
style,
|
|
23
23
|
testID,
|
|
24
|
+
id,
|
|
24
25
|
}, ref) => {
|
|
25
26
|
// Compute actual selected state
|
|
26
27
|
const isSelected = selectable ? selected : false;
|
|
@@ -93,6 +94,7 @@ const Chip = forwardRef<HTMLDivElement, ChipProps>(({
|
|
|
93
94
|
<div
|
|
94
95
|
{...containerProps}
|
|
95
96
|
ref={mergedRef}
|
|
97
|
+
id={id}
|
|
96
98
|
style={{
|
|
97
99
|
cursor: isClickable ? 'pointer' : 'default',
|
|
98
100
|
userSelect: 'none',
|
package/src/Chip/types.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
import type { IconName } from '../Icon/icon-types';
|
|
3
3
|
import { Intent, Size } from '@idealyst/theme';
|
|
4
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
export type ChipSize = Size;
|
|
6
7
|
export type ChipType = 'filled' | 'outlined' | 'soft';
|
|
7
8
|
export type ChipIntent = Intent;
|
|
8
9
|
|
|
9
|
-
export interface ChipProps {
|
|
10
|
+
export interface ChipProps extends BaseProps {
|
|
10
11
|
/** The text content of the chip */
|
|
11
12
|
label: string;
|
|
12
13
|
|
|
@@ -16,6 +16,7 @@ const Dialog = forwardRef<View, DialogProps>(({
|
|
|
16
16
|
animationType = 'fade',
|
|
17
17
|
style,
|
|
18
18
|
testID,
|
|
19
|
+
id,
|
|
19
20
|
}, ref) => {
|
|
20
21
|
const backdropOpacity = useSharedValue(0);
|
|
21
22
|
const containerScale = useSharedValue(0.9);
|
|
@@ -104,6 +105,7 @@ const Dialog = forwardRef<View, DialogProps>(({
|
|
|
104
105
|
onRequestClose={() => onOpenChange(false)}
|
|
105
106
|
statusBarTranslucent
|
|
106
107
|
testID={testID}
|
|
108
|
+
nativeID={id}
|
|
107
109
|
>
|
|
108
110
|
<TouchableWithoutFeedback onPress={handleBackdropPress}>
|
|
109
111
|
<Animated.View style={[dialogStyles.backdrop, backdropAnimatedStyle]}>
|
|
@@ -18,6 +18,7 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(({
|
|
|
18
18
|
closeOnEscapeKey = true,
|
|
19
19
|
style,
|
|
20
20
|
testID,
|
|
21
|
+
id,
|
|
21
22
|
}, ref) => {
|
|
22
23
|
const dialogRef = useRef<HTMLDivElement>(null);
|
|
23
24
|
const previousActiveElementRef = useRef<HTMLElement | null>(null);
|
|
@@ -129,6 +130,7 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(({
|
|
|
129
130
|
<div
|
|
130
131
|
{...backdropProps}
|
|
131
132
|
ref={mergedBackdropRef}
|
|
133
|
+
id={id}
|
|
132
134
|
onClick={handleBackdropClick}
|
|
133
135
|
data-testid={testID}
|
|
134
136
|
>
|
package/src/Dialog/types.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
3
4
|
|
|
4
5
|
// Component-specific type aliases for future extensibility
|
|
5
6
|
export type DialogSizeVariant = 'sm' | 'md' | 'lg' | 'fullscreen';
|
|
6
7
|
export type DialogType = 'standard' | 'alert' | 'confirmation';
|
|
7
8
|
export type DialogAnimationType = 'slide' | 'fade' | 'none';
|
|
8
9
|
|
|
9
|
-
export interface DialogProps {
|
|
10
|
+
export interface DialogProps extends BaseProps {
|
|
10
11
|
/**
|
|
11
12
|
* Whether the dialog is open/visible
|
|
12
13
|
*/
|
|
@@ -14,6 +14,7 @@ const Divider = forwardRef<View, DividerProps>(({
|
|
|
14
14
|
style,
|
|
15
15
|
testID,
|
|
16
16
|
accessibilityLabel,
|
|
17
|
+
id,
|
|
17
18
|
}, ref) => {
|
|
18
19
|
// Apply variants for main divider
|
|
19
20
|
dividerStyles.useVariants({
|
|
@@ -73,6 +74,7 @@ const Divider = forwardRef<View, DividerProps>(({
|
|
|
73
74
|
return (
|
|
74
75
|
<View
|
|
75
76
|
ref={ref}
|
|
77
|
+
nativeID={id}
|
|
76
78
|
style={[
|
|
77
79
|
dividerStyle,
|
|
78
80
|
getDashedStyle(),
|
|
@@ -87,6 +89,7 @@ const Divider = forwardRef<View, DividerProps>(({
|
|
|
87
89
|
return (
|
|
88
90
|
<View
|
|
89
91
|
ref={ref}
|
|
92
|
+
nativeID={id}
|
|
90
93
|
style={[dividerStyles.divider, style]}
|
|
91
94
|
testID={testID}
|
|
92
95
|
accessibilityLabel={accessibilityLabel || "divider"}
|
|
@@ -132,6 +135,7 @@ const Divider = forwardRef<View, DividerProps>(({
|
|
|
132
135
|
return (
|
|
133
136
|
<View
|
|
134
137
|
ref={ref}
|
|
138
|
+
nativeID={id}
|
|
135
139
|
style={dividerStyles.container}
|
|
136
140
|
testID={testID}
|
|
137
141
|
accessibilityLabel={accessibilityLabel || "divider with content"}
|
|
@@ -15,6 +15,7 @@ const Divider = forwardRef<HTMLDivElement, DividerProps>(({
|
|
|
15
15
|
style,
|
|
16
16
|
testID,
|
|
17
17
|
accessibilityLabel,
|
|
18
|
+
id,
|
|
18
19
|
}, ref) => {
|
|
19
20
|
// Apply variants for main divider
|
|
20
21
|
dividerStyles.useVariants({
|
|
@@ -50,6 +51,7 @@ const Divider = forwardRef<HTMLDivElement, DividerProps>(({
|
|
|
50
51
|
<div
|
|
51
52
|
{...dividerProps}
|
|
52
53
|
ref={mergedDividerRef}
|
|
54
|
+
id={id}
|
|
53
55
|
data-testid={testID}
|
|
54
56
|
aria-label={accessibilityLabel}
|
|
55
57
|
role="separator"
|
|
@@ -62,6 +64,7 @@ const Divider = forwardRef<HTMLDivElement, DividerProps>(({
|
|
|
62
64
|
<div
|
|
63
65
|
{...containerProps}
|
|
64
66
|
ref={mergedContainerRef}
|
|
67
|
+
id={id}
|
|
65
68
|
data-testid={testID}
|
|
66
69
|
aria-label={accessibilityLabel}
|
|
67
70
|
role="separator"
|
package/src/Divider/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Intent, Size } from '@idealyst/theme';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { BaseProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type DividerIntentVariant = Intent;
|
|
@@ -10,7 +11,7 @@ export type DividerThicknessVariant = 'thin' | 'md' | 'thick';
|
|
|
10
11
|
export type DividerLengthVariant = 'full' | 'auto' | number;
|
|
11
12
|
export type DividerSpacingVariant = 'none' | Size;
|
|
12
13
|
|
|
13
|
-
export interface DividerProps {
|
|
14
|
+
export interface DividerProps extends BaseProps {
|
|
14
15
|
/**
|
|
15
16
|
* The orientation of the divider
|
|
16
17
|
*/
|