@idealyst/components 1.2.70 → 1.2.71
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.71",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"publish:npm": "npm publish"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@idealyst/theme": "^1.2.
|
|
59
|
+
"@idealyst/theme": "^1.2.71",
|
|
60
60
|
"@mdi/js": ">=7.0.0",
|
|
61
61
|
"@mdi/react": ">=1.0.0",
|
|
62
62
|
"@react-native-vector-icons/common": ">=12.0.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@idealyst/blur": "^1.2.40",
|
|
110
|
-
"@idealyst/theme": "^1.2.
|
|
110
|
+
"@idealyst/theme": "^1.2.71",
|
|
111
111
|
"@idealyst/tooling": "^1.2.30",
|
|
112
112
|
"@mdi/react": "^1.6.1",
|
|
113
113
|
"@types/react": "^19.1.0",
|
|
@@ -2,10 +2,12 @@ import { forwardRef, useMemo } from 'react';
|
|
|
2
2
|
import { ActivityIndicator, StyleSheet as RNStyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
|
|
4
4
|
import Svg, { Defs, LinearGradient, Stop, Rect } from 'react-native-svg';
|
|
5
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
5
6
|
import { iconButtonStyles } from './IconButton.styles';
|
|
6
7
|
import { IconButtonProps } from './types';
|
|
7
8
|
import { getNativeInteractiveAccessibilityProps } from '../utils/accessibility';
|
|
8
9
|
import type { IdealystElement } from '../utils/refTypes';
|
|
10
|
+
import type { Theme } from '@idealyst/theme';
|
|
9
11
|
|
|
10
12
|
const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) => {
|
|
11
13
|
const {
|
|
@@ -34,9 +36,15 @@ const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) =>
|
|
|
34
36
|
accessibilityPressed,
|
|
35
37
|
} = props;
|
|
36
38
|
|
|
39
|
+
// Get theme for icon size
|
|
40
|
+
const { theme } = useUnistyles() as { theme: Theme };
|
|
41
|
+
|
|
37
42
|
// Button is effectively disabled when loading
|
|
38
43
|
const isDisabled = disabled || loading;
|
|
39
44
|
|
|
45
|
+
// Get icon size directly from theme
|
|
46
|
+
const iconSize = theme.sizes.iconButton[size]?.iconSize ?? 24;
|
|
47
|
+
|
|
40
48
|
// Determine the handler to use - onPress takes precedence
|
|
41
49
|
const pressHandler = onPress ?? onClick;
|
|
42
50
|
|
|
@@ -63,9 +71,6 @@ const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) =>
|
|
|
63
71
|
// Gradient is only applicable to contained buttons
|
|
64
72
|
const showGradient = gradient && type === 'contained';
|
|
65
73
|
|
|
66
|
-
// Get icon size from the computed icon style (from theme)
|
|
67
|
-
const iconSize = iconStyle?.width ?? iconStyle?.height ?? 24;
|
|
68
|
-
|
|
69
74
|
// Generate native accessibility props
|
|
70
75
|
const nativeA11yProps = useMemo(() => {
|
|
71
76
|
const computedLabel = accessibilityLabel ?? (typeof icon === 'string' ? icon : undefined);
|
|
@@ -193,19 +198,15 @@ const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) =>
|
|
|
193
198
|
{renderGradientLayer()}
|
|
194
199
|
{/* Centered spinner overlay */}
|
|
195
200
|
{loading && (
|
|
196
|
-
<View style={RNStyleSheet.absoluteFill}>
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/>
|
|
202
|
-
</View>
|
|
201
|
+
<View style={[RNStyleSheet.absoluteFill, { justifyContent: 'center', alignItems: 'center' }]}>
|
|
202
|
+
<ActivityIndicator
|
|
203
|
+
size="small"
|
|
204
|
+
color={spinnerColor}
|
|
205
|
+
/>
|
|
203
206
|
</View>
|
|
204
207
|
)}
|
|
205
|
-
{/*
|
|
206
|
-
|
|
207
|
-
{renderIcon()}
|
|
208
|
-
</View>
|
|
208
|
+
{/* Icon renders directly - TouchableOpacity has alignItems/justifyContent center */}
|
|
209
|
+
{renderIcon()}
|
|
209
210
|
</TouchableOpacity>
|
|
210
211
|
);
|
|
211
212
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { isValidElement, forwardRef, useMemo } from 'react';
|
|
2
2
|
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
3
4
|
import { IconButtonProps } from './types';
|
|
4
5
|
import { iconButtonStyles } from './IconButton.styles';
|
|
5
6
|
import { IconSvg } from '../Icon/IconSvg/IconSvg.web';
|
|
6
7
|
import useMergeRefs from '../hooks/useMergeRefs';
|
|
7
8
|
import { getWebInteractiveAriaProps, generateAccessibilityId } from '../utils/accessibility';
|
|
8
9
|
import type { IdealystElement } from '../utils/refTypes';
|
|
10
|
+
import type { Theme } from '@idealyst/theme';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Circular icon button component with multiple visual variants and sizes.
|
|
@@ -40,9 +42,15 @@ const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) =>
|
|
|
40
42
|
accessibilityHasPopup,
|
|
41
43
|
} = props;
|
|
42
44
|
|
|
45
|
+
// Get theme for icon size
|
|
46
|
+
const { theme } = useUnistyles() as { theme: Theme };
|
|
47
|
+
|
|
43
48
|
// Button is effectively disabled when loading
|
|
44
49
|
const isDisabled = disabled || loading;
|
|
45
50
|
|
|
51
|
+
// Get icon size directly from theme
|
|
52
|
+
const iconSize = theme.sizes.iconButton[size]?.iconSize ?? 24;
|
|
53
|
+
|
|
46
54
|
// Apply variants for size, disabled, gradient
|
|
47
55
|
iconButtonStyles.useVariants({
|
|
48
56
|
size,
|
|
@@ -121,9 +129,6 @@ const IconButton = forwardRef<IdealystElement, IconButtonProps>((props, ref) =>
|
|
|
121
129
|
const iconStyleArray = [iconStyleComputed];
|
|
122
130
|
const iconProps = getWebProps(iconStyleArray);
|
|
123
131
|
|
|
124
|
-
// Extract icon size from computed styles for explicit sizing
|
|
125
|
-
const iconSize = iconStyleComputed?.width ?? iconStyleComputed?.height ?? 24;
|
|
126
|
-
|
|
127
132
|
// Spinner styles that match the icon color
|
|
128
133
|
const spinnerStyleArray = [(iconButtonStyles.spinner as any)(dynamicProps)];
|
|
129
134
|
const spinnerProps = getWebProps(spinnerStyleArray);
|
|
@@ -185,7 +185,12 @@ const TextArea = forwardRef<IdealystElement, TextAreaProps>(({
|
|
|
185
185
|
// For autoGrow: don't set height, let it grow naturally with minHeight constraint
|
|
186
186
|
// For fixed height: use rows-based height
|
|
187
187
|
autoGrow
|
|
188
|
-
? {
|
|
188
|
+
? {
|
|
189
|
+
minHeight: minHeight ?? 44,
|
|
190
|
+
maxHeight: maxHeight,
|
|
191
|
+
// Force height to minHeight when empty to ensure shrinking
|
|
192
|
+
...(value === '' ? { height: minHeight ?? 44 } : {}),
|
|
193
|
+
}
|
|
189
194
|
: { height: rows * 24 },
|
|
190
195
|
textareaStyle,
|
|
191
196
|
]}
|