@idealyst/components 1.2.29 → 1.2.30
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 +3 -3
- package/package.json +3 -3
- package/plugin/__tests__/web.test.ts +2 -2
- package/src/Accordion/Accordion.native.tsx +3 -2
- package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
- package/src/ActivityIndicator/ActivityIndicator.styles.tsx +25 -26
- package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -1
- package/src/Alert/Alert.native.tsx +20 -10
- package/src/Alert/Alert.styles.tsx +148 -86
- package/src/Alert/Alert.web.tsx +10 -5
- package/src/Alert/types.ts +53 -3
- package/src/Avatar/Avatar.native.tsx +3 -2
- package/src/Avatar/Avatar.web.tsx +2 -1
- package/src/Avatar/types.ts +1 -1
- package/src/Badge/Badge.native.tsx +18 -6
- package/src/Badge/Badge.styles.tsx +22 -5
- package/src/Badge/Badge.web.tsx +12 -4
- package/src/Badge/types.ts +14 -2
- package/src/Breadcrumb/Breadcrumb.native.tsx +3 -2
- package/src/Button/Button.native.tsx +16 -6
- package/src/Button/Button.styles.tsx +2 -2
- package/src/Button/Button.web.tsx +19 -15
- package/src/Button/types.ts +6 -10
- package/src/Card/Card.native.tsx +27 -3
- package/src/Card/Card.web.tsx +30 -4
- package/src/Card/types.ts +15 -0
- package/src/Checkbox/Checkbox.native.tsx +5 -4
- package/src/Checkbox/Checkbox.styles.tsx +62 -52
- package/src/Checkbox/Checkbox.web.tsx +4 -3
- package/src/Checkbox/types.ts +1 -1
- package/src/Chip/Chip.native.tsx +30 -7
- package/src/Chip/Chip.styles.tsx +142 -124
- package/src/Chip/Chip.web.tsx +28 -5
- package/src/Chip/types.ts +15 -0
- package/src/Dialog/Dialog.native.tsx +6 -6
- package/src/Dialog/Dialog.web.tsx +5 -5
- package/src/Dialog/types.ts +2 -2
- package/src/Divider/Divider.native.tsx +20 -17
- package/src/Divider/Divider.styles.tsx +51 -29
- package/src/Divider/Divider.web.tsx +5 -4
- package/src/Divider/types.ts +3 -3
- package/src/Icon/Icon.native.tsx +3 -2
- package/src/Icon/Icon.web.tsx +2 -1
- package/src/Icon/IconSvg/IconSvg.native.tsx +3 -2
- package/src/Image/Image.native.tsx +3 -2
- package/src/Input/Input.native.tsx +42 -290
- package/src/Input/Input.styles.tsx +1 -1
- package/src/Input/Input.web.tsx +37 -288
- package/src/Input/index.native.ts +9 -2
- package/src/Input/index.ts +8 -1
- package/src/Input/index.web.ts +8 -1
- package/src/Input/types.ts +1 -1
- package/src/List/List.native.tsx +3 -2
- package/src/List/ListItem.native.tsx +3 -2
- package/src/List/ListSection.native.tsx +3 -2
- package/src/Menu/Menu.native.tsx +2 -1
- package/src/Menu/Menu.styles.tsx +79 -29
- package/src/Menu/Menu.web.tsx +2 -1
- package/src/Menu/MenuItem.native.tsx +4 -3
- package/src/Menu/MenuItem.styles.tsx +81 -32
- package/src/Menu/MenuItem.web.tsx +2 -1
- package/src/Menu/docs.ts +1 -1
- package/src/Popover/Popover.native.tsx +2 -1
- package/src/Popover/Popover.web.tsx +2 -1
- package/src/Popover/types.ts +15 -4
- package/src/Pressable/Pressable.native.tsx +3 -2
- package/src/Pressable/Pressable.web.tsx +3 -5
- package/src/Progress/Progress.native.tsx +5 -4
- package/src/Progress/Progress.web.tsx +3 -3
- package/src/Progress/types.ts +3 -3
- package/src/RadioButton/RadioButton.native.tsx +4 -3
- package/src/RadioButton/RadioButton.styles.tsx +53 -33
- package/src/RadioButton/RadioGroup.native.tsx +3 -2
- package/src/SVGImage/SVGImage.native.tsx +5 -4
- package/src/SVGImage/SVGImage.styles.tsx +44 -10
- package/src/SVGImage/SVGImage.web.tsx +2 -1
- package/src/Screen/Screen.native.tsx +2 -1
- package/src/Screen/Screen.web.tsx +2 -1
- package/src/Select/Select.native.tsx +6 -5
- package/src/Select/Select.styles.tsx +1 -1
- package/src/Select/Select.web.tsx +4 -3
- package/src/Select/types.ts +1 -1
- package/src/Skeleton/Skeleton.native.tsx +2 -1
- package/src/Slider/Slider.native.tsx +9 -8
- package/src/Slider/Slider.web.tsx +10 -9
- package/src/Slider/types.ts +9 -2
- package/src/Switch/Switch.native.tsx +7 -6
- package/src/Switch/Switch.styles.tsx +35 -17
- package/src/Switch/Switch.web.tsx +8 -7
- package/src/Switch/types.ts +44 -4
- package/src/TabBar/TabBar.native.tsx +3 -2
- package/src/Text/Text.native.tsx +3 -2
- package/src/Text/Text.web.tsx +2 -1
- package/src/TextArea/TextArea.native.tsx +3 -2
- package/src/TextArea/TextArea.styles.tsx +2 -2
- package/src/TextArea/TextArea.web.tsx +2 -1
- package/src/TextInput/TextInput.native.tsx +300 -0
- package/src/TextInput/TextInput.styles.tsx +207 -0
- package/src/TextInput/TextInput.web.tsx +301 -0
- package/src/TextInput/index.native.ts +3 -0
- package/src/TextInput/index.ts +5 -0
- package/src/TextInput/index.web.ts +5 -0
- package/src/TextInput/types.ts +163 -0
- package/src/Tooltip/Tooltip.native.tsx +3 -2
- package/src/Video/Video.native.tsx +4 -3
- package/src/View/View.native.tsx +2 -1
- package/src/View/View.web.tsx +2 -1
- package/src/examples/AlertExamples.tsx +5 -5
- package/src/examples/ButtonExamples.tsx +12 -12
- package/src/examples/CardExamples.tsx +1 -1
- package/src/examples/CheckboxExamples.tsx +2 -2
- package/src/examples/ChipExamples.tsx +6 -6
- package/src/examples/DialogExamples.tsx +1 -1
- package/src/examples/DividerExamples.tsx +1 -1
- package/src/examples/InputExamples.tsx +1 -1
- package/src/examples/LinkExamples.tsx +1 -1
- package/src/examples/ListExamples.tsx +1 -1
- package/src/examples/MenuExamples.tsx +2 -2
- package/src/examples/ProgressExamples.tsx +1 -1
- package/src/examples/RadioButtonExamples.tsx +5 -5
- package/src/examples/SVGImageExamples.tsx +1 -1
- package/src/examples/SelectExamples.tsx +1 -1
- package/src/examples/SliderExamples.tsx +5 -5
- package/src/examples/SwitchExamples.tsx +2 -2
- package/src/examples/TableExamples.tsx +1 -1
- package/src/examples/TooltipExamples.tsx +2 -2
- package/src/extensions/index.ts +1 -0
- package/src/extensions/types.ts +10 -3
- package/src/index.ts +23 -2
- package/src/utils/index.ts +12 -0
- package/src/utils/refTypes.ts +50 -0
|
@@ -3,6 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { videoStyles } from './Video.styles';
|
|
4
4
|
import type { VideoProps } from './types';
|
|
5
5
|
import { getNativeAccessibilityProps } from '../utils/accessibility';
|
|
6
|
+
import type { IdealystElement } from '../utils/refTypes';
|
|
6
7
|
|
|
7
8
|
// Import react-native-video - it's a peer dependency
|
|
8
9
|
let RNVideo: any;
|
|
@@ -14,7 +15,7 @@ try {
|
|
|
14
15
|
console.warn('react-native-video not installed. Video component will not work on native.');
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
const Video = React.forwardRef<
|
|
18
|
+
const Video = React.forwardRef<IdealystElement, VideoProps>(({
|
|
18
19
|
source,
|
|
19
20
|
poster,
|
|
20
21
|
width: _width,
|
|
@@ -52,7 +53,7 @@ const Video = React.forwardRef<View, VideoProps>(({
|
|
|
52
53
|
|
|
53
54
|
if (!RNVideo) {
|
|
54
55
|
return (
|
|
55
|
-
<View ref={ref} nativeID={id} style={[videoStyles.container, { aspectRatio, borderRadius }, style]} testID={testID} {...nativeA11yProps}>
|
|
56
|
+
<View ref={ref as any} nativeID={id} style={[videoStyles.container, { aspectRatio, borderRadius }, style]} testID={testID} {...nativeA11yProps}>
|
|
56
57
|
<View style={videoStyles.fallback}>
|
|
57
58
|
{/* Fallback when react-native-video is not installed */}
|
|
58
59
|
</View>
|
|
@@ -95,7 +96,7 @@ const Video = React.forwardRef<View, VideoProps>(({
|
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
return (
|
|
98
|
-
<View ref={ref} nativeID={id} style={containerStyle} testID={testID} {...nativeA11yProps}>
|
|
99
|
+
<View ref={ref as any} nativeID={id} style={containerStyle} testID={testID} {...nativeA11yProps}>
|
|
99
100
|
<RNVideo
|
|
100
101
|
source={videoSource}
|
|
101
102
|
poster={poster}
|
package/src/View/View.native.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { View as RNView, ScrollView as RNScrollView, ViewStyle, StyleSheet } fro
|
|
|
3
3
|
import { useResponsiveStyle, ResponsiveStyle } from '@idealyst/theme';
|
|
4
4
|
import { ViewProps } from './types';
|
|
5
5
|
import { viewStyles } from './View.styles';
|
|
6
|
+
import type { IdealystElement } from '../utils/refTypes';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Check if a style object contains any responsive values
|
|
@@ -22,7 +23,7 @@ function hasResponsiveValues(style: any): style is ResponsiveStyle {
|
|
|
22
23
|
return false;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const View = forwardRef<
|
|
26
|
+
const View = forwardRef<IdealystElement, ViewProps>(({
|
|
26
27
|
children,
|
|
27
28
|
background = 'transparent',
|
|
28
29
|
radius = 'none',
|
package/src/View/View.web.tsx
CHANGED
|
@@ -3,12 +3,13 @@ import { getWebProps } from 'react-native-unistyles/web';
|
|
|
3
3
|
import { ViewProps } from './types';
|
|
4
4
|
import { viewStyles } from './View.styles';
|
|
5
5
|
import useMergeRefs from '../hooks/useMergeRefs';
|
|
6
|
+
import type { IdealystElement } from '../utils/refTypes';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Fundamental layout container with background, border, and spacing options.
|
|
9
10
|
* The base building block for composing UI layouts.
|
|
10
11
|
*/
|
|
11
|
-
const View = forwardRef<
|
|
12
|
+
const View = forwardRef<IdealystElement, ViewProps>(({
|
|
12
13
|
children,
|
|
13
14
|
background = 'transparent',
|
|
14
15
|
radius = 'none',
|
|
@@ -26,7 +26,7 @@ export const AlertExamples = () => {
|
|
|
26
26
|
/>
|
|
27
27
|
|
|
28
28
|
<Alert
|
|
29
|
-
intent="
|
|
29
|
+
intent="danger"
|
|
30
30
|
title="Error"
|
|
31
31
|
message="There was an error processing your request."
|
|
32
32
|
/>
|
|
@@ -139,7 +139,7 @@ export const AlertExamples = () => {
|
|
|
139
139
|
{errorVisible && (
|
|
140
140
|
<Alert
|
|
141
141
|
type="outlined"
|
|
142
|
-
intent="
|
|
142
|
+
intent="danger"
|
|
143
143
|
title="Dismissible Error"
|
|
144
144
|
message="This outlined alert can also be dismissed."
|
|
145
145
|
dismissible
|
|
@@ -234,7 +234,7 @@ export const AlertExamples = () => {
|
|
|
234
234
|
<Text typography="h5">All Intent Colors (Soft Variant)</Text>
|
|
235
235
|
|
|
236
236
|
<View gap="sm">
|
|
237
|
-
{(['primary', 'success', '
|
|
237
|
+
{(['primary', 'success', 'danger', 'warning', 'info', 'neutral'] as const).map((intent) => (
|
|
238
238
|
<Alert
|
|
239
239
|
key={intent}
|
|
240
240
|
type="soft"
|
|
@@ -249,7 +249,7 @@ export const AlertExamples = () => {
|
|
|
249
249
|
<Text typography="h5">All Intent Colors (Outlined Variant)</Text>
|
|
250
250
|
|
|
251
251
|
<View gap="sm">
|
|
252
|
-
{(['primary', 'success', '
|
|
252
|
+
{(['primary', 'success', 'danger', 'warning', 'info', 'neutral'] as const).map((intent) => (
|
|
253
253
|
<Alert
|
|
254
254
|
key={intent}
|
|
255
255
|
type="outlined"
|
|
@@ -264,7 +264,7 @@ export const AlertExamples = () => {
|
|
|
264
264
|
<Text typography="h5">All Intent Colors (Filled Variant)</Text>
|
|
265
265
|
|
|
266
266
|
<View gap="sm">
|
|
267
|
-
{(['primary', 'success', '
|
|
267
|
+
{(['primary', 'success', 'danger', 'warning', 'info', 'neutral'] as const).map((intent) => (
|
|
268
268
|
<Alert
|
|
269
269
|
key={intent}
|
|
270
270
|
type="filled"
|
|
@@ -117,12 +117,12 @@ export const ButtonExamples = () => {
|
|
|
117
117
|
>
|
|
118
118
|
Success
|
|
119
119
|
</Button>
|
|
120
|
-
<Button
|
|
121
|
-
intent="
|
|
120
|
+
<Button
|
|
121
|
+
intent="danger"
|
|
122
122
|
type="contained"
|
|
123
|
-
onPress={() => handlePress('
|
|
123
|
+
onPress={() => handlePress('danger')}
|
|
124
124
|
>
|
|
125
|
-
|
|
125
|
+
Danger
|
|
126
126
|
</Button>
|
|
127
127
|
<Button
|
|
128
128
|
intent="warning"
|
|
@@ -187,7 +187,7 @@ export const ButtonExamples = () => {
|
|
|
187
187
|
</Button>
|
|
188
188
|
<Button
|
|
189
189
|
type="contained"
|
|
190
|
-
intent="
|
|
190
|
+
intent="danger"
|
|
191
191
|
leftIcon="delete"
|
|
192
192
|
rightIcon="alert"
|
|
193
193
|
onPress={() => handlePress('icon-both')}
|
|
@@ -246,7 +246,7 @@ export const ButtonExamples = () => {
|
|
|
246
246
|
/>
|
|
247
247
|
<Button
|
|
248
248
|
type="text"
|
|
249
|
-
intent="
|
|
249
|
+
intent="danger"
|
|
250
250
|
leftIcon="close-circle"
|
|
251
251
|
onPress={() => handlePress('icon-only-text')}
|
|
252
252
|
/>
|
|
@@ -283,11 +283,11 @@ export const ButtonExamples = () => {
|
|
|
283
283
|
</Button>
|
|
284
284
|
<Button
|
|
285
285
|
type="contained"
|
|
286
|
-
intent="
|
|
286
|
+
intent="danger"
|
|
287
287
|
leftIcon="alert-circle"
|
|
288
|
-
onPress={() => handlePress('
|
|
288
|
+
onPress={() => handlePress('danger')}
|
|
289
289
|
>
|
|
290
|
-
|
|
290
|
+
Danger
|
|
291
291
|
</Button>
|
|
292
292
|
</View>
|
|
293
293
|
</View>
|
|
@@ -344,7 +344,7 @@ export const ButtonExamples = () => {
|
|
|
344
344
|
</Button>
|
|
345
345
|
<Button
|
|
346
346
|
type="contained"
|
|
347
|
-
intent="
|
|
347
|
+
intent="danger"
|
|
348
348
|
gradient="darken"
|
|
349
349
|
onPress={() => handlePress('gradient-error')}
|
|
350
350
|
>
|
|
@@ -394,7 +394,7 @@ export const ButtonExamples = () => {
|
|
|
394
394
|
</Button>
|
|
395
395
|
<Button
|
|
396
396
|
type="contained"
|
|
397
|
-
intent="
|
|
397
|
+
intent="danger"
|
|
398
398
|
gradient="darken"
|
|
399
399
|
leftIcon="delete"
|
|
400
400
|
onPress={() => handlePress('gradient-icon-delete')}
|
|
@@ -457,7 +457,7 @@ export const ButtonExamples = () => {
|
|
|
457
457
|
</Button>
|
|
458
458
|
<Button
|
|
459
459
|
type="contained"
|
|
460
|
-
intent="
|
|
460
|
+
intent="danger"
|
|
461
461
|
loading
|
|
462
462
|
onPress={() => handlePress('loading-error')}
|
|
463
463
|
>
|
|
@@ -85,7 +85,7 @@ export const CheckboxExamples = () => {
|
|
|
85
85
|
label="Success checkbox"
|
|
86
86
|
/>
|
|
87
87
|
<Checkbox
|
|
88
|
-
intent="
|
|
88
|
+
intent="danger"
|
|
89
89
|
checked={errorChecked}
|
|
90
90
|
onCheckedChange={setErrorChecked}
|
|
91
91
|
label="Error checkbox"
|
|
@@ -200,7 +200,7 @@ export const CheckboxExamples = () => {
|
|
|
200
200
|
onCheckedChange={() => {}}
|
|
201
201
|
label="Checkbox with error"
|
|
202
202
|
error="This field is required"
|
|
203
|
-
intent="
|
|
203
|
+
intent="danger"
|
|
204
204
|
/>
|
|
205
205
|
<Checkbox
|
|
206
206
|
checked={false}
|
|
@@ -31,7 +31,7 @@ export const ChipExamples = () => {
|
|
|
31
31
|
<Chip label="Default" />
|
|
32
32
|
<Chip label="Primary" intent="primary" />
|
|
33
33
|
<Chip label="Success" intent="success" />
|
|
34
|
-
<Chip label="Error" intent="
|
|
34
|
+
<Chip label="Error" intent="danger" />
|
|
35
35
|
<Chip label="Warning" intent="warning" />
|
|
36
36
|
<Chip label="Neutral" intent="neutral" />
|
|
37
37
|
</View>
|
|
@@ -43,21 +43,21 @@ export const ChipExamples = () => {
|
|
|
43
43
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
|
|
44
44
|
<Chip label="Filled Primary" type="filled" intent="primary" />
|
|
45
45
|
<Chip label="Filled Success" type="filled" intent="success" />
|
|
46
|
-
<Chip label="Filled Error" type="filled" intent="
|
|
46
|
+
<Chip label="Filled Error" type="filled" intent="danger" />
|
|
47
47
|
</View>
|
|
48
48
|
|
|
49
49
|
<Text typography="subtitle1">Outlined</Text>
|
|
50
50
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
|
|
51
51
|
<Chip label="Outlined Primary" type="outlined" intent="primary" />
|
|
52
52
|
<Chip label="Outlined Success" type="outlined" intent="success" />
|
|
53
|
-
<Chip label="Outlined Error" type="outlined" intent="
|
|
53
|
+
<Chip label="Outlined Error" type="outlined" intent="danger" />
|
|
54
54
|
</View>
|
|
55
55
|
|
|
56
56
|
<Text typography="subtitle1">Soft</Text>
|
|
57
57
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
|
|
58
58
|
<Chip label="Soft Primary" type="soft" intent="primary" />
|
|
59
59
|
<Chip label="Soft Success" type="soft" intent="success" />
|
|
60
|
-
<Chip label="Soft Error" type="soft" intent="
|
|
60
|
+
<Chip label="Soft Error" type="soft" intent="danger" />
|
|
61
61
|
</View>
|
|
62
62
|
|
|
63
63
|
<Divider spacing="md" />
|
|
@@ -74,7 +74,7 @@ export const ChipExamples = () => {
|
|
|
74
74
|
|
|
75
75
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
|
|
76
76
|
<Chip label="Star" icon="star" />
|
|
77
|
-
<Chip label="Heart" icon="heart" intent="
|
|
77
|
+
<Chip label="Heart" icon="heart" intent="danger" />
|
|
78
78
|
<Chip label="Check" icon="check" intent="success" />
|
|
79
79
|
<Chip label="Info" icon="information" type="outlined" />
|
|
80
80
|
</View>
|
|
@@ -188,7 +188,7 @@ export const ChipExamples = () => {
|
|
|
188
188
|
<Chip label="Design" type="soft" intent="primary" size="sm" />
|
|
189
189
|
<Chip label="Development" type="soft" intent="success" size="sm" />
|
|
190
190
|
<Chip label="Marketing" type="soft" intent="warning" size="sm" />
|
|
191
|
-
<Chip label="Sales" type="soft" intent="
|
|
191
|
+
<Chip label="Sales" type="soft" intent="danger" size="sm" />
|
|
192
192
|
<Chip label="Support" type="soft" intent="neutral" size="sm" />
|
|
193
193
|
</View>
|
|
194
194
|
</View>
|
|
@@ -221,7 +221,7 @@ export const InputExamples = () => {
|
|
|
221
221
|
<Text
|
|
222
222
|
id="password-helper"
|
|
223
223
|
typography="caption"
|
|
224
|
-
color={passwordValue.length > 0 && passwordValue.length < 8 ? '
|
|
224
|
+
color={passwordValue.length > 0 && passwordValue.length < 8 ? 'danger' : 'muted'}
|
|
225
225
|
>
|
|
226
226
|
{passwordValue.length > 0 && passwordValue.length < 8
|
|
227
227
|
? 'Password must be at least 8 characters'
|
|
@@ -96,7 +96,7 @@ export const LinkExamples = () => {
|
|
|
96
96
|
</Link>
|
|
97
97
|
<Link to="/favorites" onPress={() => handlePress('favorites')}>
|
|
98
98
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
|
|
99
|
-
<Icon name="heart" size={20} intent="
|
|
99
|
+
<Icon name="heart" size={20} intent="danger" />
|
|
100
100
|
<Text color="primary">Favorites</Text>
|
|
101
101
|
</View>
|
|
102
102
|
</Link>
|
|
@@ -21,13 +21,13 @@ export const MenuExamples: React.FC = () => {
|
|
|
21
21
|
{ id: 'edit', label: 'Edit', icon: 'pencil', onClick: () => setSelectedAction('Edit') },
|
|
22
22
|
{ id: 'copy', label: 'Copy', icon: 'content-copy', onClick: () => setSelectedAction('Copy') },
|
|
23
23
|
{ id: 'share', label: 'Share', icon: 'share-variant', onClick: () => setSelectedAction('Share'), intent: 'primary' },
|
|
24
|
-
{ id: 'delete', label: 'Delete', icon: 'delete', onClick: () => setSelectedAction('Delete'), intent: '
|
|
24
|
+
{ id: 'delete', label: 'Delete', icon: 'delete', onClick: () => setSelectedAction('Delete'), intent: 'danger' },
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
const intentItems: MenuItem[] = [
|
|
28
28
|
{ id: 'save', label: 'Save', intent: 'success', onClick: () => setSelectedAction('Save') },
|
|
29
29
|
{ id: 'cancel', label: 'Cancel', intent: 'neutral', onClick: () => setSelectedAction('Cancel') },
|
|
30
|
-
{ id: 'delete', label: 'Delete', intent: '
|
|
30
|
+
{ id: 'delete', label: 'Delete', intent: 'danger', onClick: () => setSelectedAction('Delete') },
|
|
31
31
|
{ id: 'warn', label: 'Warning Action', intent: 'warning', onClick: () => setSelectedAction('Warning') },
|
|
32
32
|
];
|
|
33
33
|
|
|
@@ -43,7 +43,7 @@ export const ProgressExamples: React.FC = () => {
|
|
|
43
43
|
<Progress value={70} intent="primary" />
|
|
44
44
|
<Progress value={70} intent="success" />
|
|
45
45
|
<Progress value={70} intent="warning" />
|
|
46
|
-
<Progress value={70} intent="
|
|
46
|
+
<Progress value={70} intent="danger" />
|
|
47
47
|
<Progress value={70} intent="neutral" />
|
|
48
48
|
</View>
|
|
49
49
|
</View>
|
|
@@ -101,11 +101,11 @@ export const RadioButtonExamples: React.FC = () => {
|
|
|
101
101
|
onPress={() => setSelectedIntent('success')}
|
|
102
102
|
/>
|
|
103
103
|
<RadioButton
|
|
104
|
-
value="
|
|
105
|
-
label="
|
|
106
|
-
intent="
|
|
107
|
-
checked={selectedIntent === '
|
|
108
|
-
onPress={() => setSelectedIntent('
|
|
104
|
+
value="danger"
|
|
105
|
+
label="Danger"
|
|
106
|
+
intent="danger"
|
|
107
|
+
checked={selectedIntent === 'danger'}
|
|
108
|
+
onPress={() => setSelectedIntent('danger')}
|
|
109
109
|
/>
|
|
110
110
|
<RadioButton
|
|
111
111
|
value="warning"
|
|
@@ -16,7 +16,7 @@ export const SliderExamples: React.FC = () => {
|
|
|
16
16
|
<Text typography="h5">Basic Slider</Text>
|
|
17
17
|
<Slider
|
|
18
18
|
value={basicValue}
|
|
19
|
-
|
|
19
|
+
onChange={setBasicValue}
|
|
20
20
|
showValue
|
|
21
21
|
/>
|
|
22
22
|
<Text typography="caption" color="secondary">Value: {basicValue}</Text>
|
|
@@ -53,7 +53,7 @@ export const SliderExamples: React.FC = () => {
|
|
|
53
53
|
</View>
|
|
54
54
|
<View gap="xs">
|
|
55
55
|
<Text typography="body2">Error</Text>
|
|
56
|
-
<Slider defaultValue={60} intent="
|
|
56
|
+
<Slider defaultValue={60} intent="danger" />
|
|
57
57
|
</View>
|
|
58
58
|
<View gap="xs">
|
|
59
59
|
<Text typography="body2">Warning</Text>
|
|
@@ -122,7 +122,7 @@ export const SliderExamples: React.FC = () => {
|
|
|
122
122
|
<Text typography="h5">Volume Control</Text>
|
|
123
123
|
<Slider
|
|
124
124
|
value={volumeValue}
|
|
125
|
-
|
|
125
|
+
onChange={setVolumeValue}
|
|
126
126
|
min={0}
|
|
127
127
|
max={100}
|
|
128
128
|
showValue
|
|
@@ -163,7 +163,7 @@ export const SliderExamples: React.FC = () => {
|
|
|
163
163
|
min={10}
|
|
164
164
|
max={30}
|
|
165
165
|
icon="thermometer"
|
|
166
|
-
intent="
|
|
166
|
+
intent="danger"
|
|
167
167
|
showMinMax
|
|
168
168
|
/>
|
|
169
169
|
</View>
|
|
@@ -174,7 +174,7 @@ export const SliderExamples: React.FC = () => {
|
|
|
174
174
|
<Text typography="h5">Temperature Control</Text>
|
|
175
175
|
<Slider
|
|
176
176
|
value={temperatureValue}
|
|
177
|
-
|
|
177
|
+
onChange={setTemperatureValue}
|
|
178
178
|
min={10}
|
|
179
179
|
max={30}
|
|
180
180
|
step={0.5}
|
|
@@ -94,7 +94,7 @@ export const SwitchExamples: React.FC = () => {
|
|
|
94
94
|
<Switch
|
|
95
95
|
checked={intentChecked.error}
|
|
96
96
|
onCheckedChange={(checked) => setIntentChecked(prev => ({ ...prev, error: checked }))}
|
|
97
|
-
intent="
|
|
97
|
+
intent="danger"
|
|
98
98
|
label="Error"
|
|
99
99
|
/>
|
|
100
100
|
<Switch
|
|
@@ -152,7 +152,7 @@ export const SwitchExamples: React.FC = () => {
|
|
|
152
152
|
onCheckedChange={(checked) => setIconChecked(prev => ({ ...prev, wifi: checked }))}
|
|
153
153
|
enabledIcon="wifi"
|
|
154
154
|
disabledIcon="wifi-off"
|
|
155
|
-
intent="
|
|
155
|
+
intent="danger"
|
|
156
156
|
label="WiFi Connection"
|
|
157
157
|
size="sm"
|
|
158
158
|
/>
|
|
@@ -126,7 +126,7 @@ export const TableExamples: React.FC = () => {
|
|
|
126
126
|
<Button size="sm" type="outlined" onPress={() => console.log('Edit', user.id)}>
|
|
127
127
|
Edit
|
|
128
128
|
</Button>
|
|
129
|
-
<Button size="sm" type="outlined" intent="
|
|
129
|
+
<Button size="sm" type="outlined" intent="danger" onPress={() => console.log('Delete', user.id)}>
|
|
130
130
|
Delete
|
|
131
131
|
</Button>
|
|
132
132
|
</View>
|
|
@@ -62,8 +62,8 @@ export const TooltipExamples: React.FC = () => {
|
|
|
62
62
|
<Tooltip content="Warning tooltip" intent="warning">
|
|
63
63
|
<Button type="contained" intent="warning">Warning</Button>
|
|
64
64
|
</Tooltip>
|
|
65
|
-
<Tooltip content="Error tooltip" intent="
|
|
66
|
-
<Button type="contained" intent="
|
|
65
|
+
<Tooltip content="Error tooltip" intent="danger">
|
|
66
|
+
<Button type="contained" intent="danger">Error</Button>
|
|
67
67
|
</Tooltip>
|
|
68
68
|
<Tooltip content="Neutral tooltip" intent="neutral">
|
|
69
69
|
<Button type="contained" intent="neutral">Neutral</Button>
|
package/src/extensions/index.ts
CHANGED
package/src/extensions/types.ts
CHANGED
|
@@ -48,10 +48,10 @@ export type CardStyleableElements = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @see
|
|
51
|
+
* TextInput styleable elements.
|
|
52
|
+
* @see TextInputStylesheet in @idealyst/theme/components/text-input
|
|
53
53
|
*/
|
|
54
|
-
export type
|
|
54
|
+
export type TextInputStyleableElements = {
|
|
55
55
|
container: Styles;
|
|
56
56
|
leftIconContainer: Styles;
|
|
57
57
|
rightIconContainer: Styles;
|
|
@@ -62,6 +62,11 @@ export type InputStyleableElements = {
|
|
|
62
62
|
input: Styles;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Use TextInputStyleableElements instead
|
|
67
|
+
*/
|
|
68
|
+
export type InputStyleableElements = TextInputStyleableElements;
|
|
69
|
+
|
|
65
70
|
/**
|
|
66
71
|
* Chip styleable elements.
|
|
67
72
|
* @see ChipStylesheet in @idealyst/theme/components/chip
|
|
@@ -452,6 +457,8 @@ export interface ComponentStyleExtensions {}
|
|
|
452
457
|
interface BuiltInComponentStyleElements {
|
|
453
458
|
Button: ButtonStyleableElements;
|
|
454
459
|
Card: CardStyleableElements;
|
|
460
|
+
TextInput: TextInputStyleableElements;
|
|
461
|
+
/** @deprecated Use TextInput instead */
|
|
455
462
|
Input: InputStyleableElements;
|
|
456
463
|
Chip: ChipStyleableElements;
|
|
457
464
|
Alert: AlertStyleableElements;
|
package/src/index.ts
CHANGED
|
@@ -18,8 +18,14 @@ export * from './Pressable/types';
|
|
|
18
18
|
export { default as Link } from './Link';
|
|
19
19
|
export * from './Link/types';
|
|
20
20
|
|
|
21
|
+
// TextInput (primary text input component)
|
|
22
|
+
export { default as TextInput } from './TextInput';
|
|
23
|
+
export * from './TextInput/types';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use TextInput instead. Input is maintained for backwards compatibility only.
|
|
27
|
+
*/
|
|
21
28
|
export { default as Input } from './Input';
|
|
22
|
-
export * from './Input/types';
|
|
23
29
|
|
|
24
30
|
// New primitive components
|
|
25
31
|
export { default as Checkbox } from './Checkbox';
|
|
@@ -116,7 +122,9 @@ export type { ButtonProps } from './Button/types';
|
|
|
116
122
|
export type { TextProps } from './Text/types';
|
|
117
123
|
export type { ViewProps } from './View/types';
|
|
118
124
|
export type { LinkProps } from './Link/types';
|
|
119
|
-
export type {
|
|
125
|
+
export type { TextInputProps } from './TextInput/types';
|
|
126
|
+
/** @deprecated Use TextInputProps instead */
|
|
127
|
+
export type { InputProps } from './TextInput/types';
|
|
120
128
|
export type { CheckboxProps } from './Checkbox/types';
|
|
121
129
|
export type { CardProps } from './Card/types';
|
|
122
130
|
export type { DividerProps } from './Divider/types';
|
|
@@ -156,6 +164,18 @@ export * from './utils/events';
|
|
|
156
164
|
export * from './utils/viewStyleProps';
|
|
157
165
|
export * from './utils/buildViewStyleVariants';
|
|
158
166
|
|
|
167
|
+
// Cross-platform ref types
|
|
168
|
+
export type {
|
|
169
|
+
IdealystElement,
|
|
170
|
+
AnchorElement,
|
|
171
|
+
AnchorRef,
|
|
172
|
+
ComponentElement,
|
|
173
|
+
WebElement,
|
|
174
|
+
NativeElement,
|
|
175
|
+
CrossPlatformElement,
|
|
176
|
+
CrossPlatformRef,
|
|
177
|
+
} from './utils/refTypes';
|
|
178
|
+
|
|
159
179
|
// Component style extensions
|
|
160
180
|
export {
|
|
161
181
|
extendComponent,
|
|
@@ -174,6 +194,7 @@ export type {
|
|
|
174
194
|
Styles,
|
|
175
195
|
ButtonStyleableElements,
|
|
176
196
|
CardStyleableElements,
|
|
197
|
+
TextInputStyleableElements,
|
|
177
198
|
InputStyleableElements,
|
|
178
199
|
ChipStyleableElements,
|
|
179
200
|
AlertStyleableElements,
|
package/src/utils/index.ts
CHANGED
|
@@ -18,3 +18,15 @@ export { deepMerge, isPlainObject } from './styleHelpers';
|
|
|
18
18
|
|
|
19
19
|
// Accessibility utilities
|
|
20
20
|
export * from './accessibility';
|
|
21
|
+
|
|
22
|
+
// Cross-platform ref types
|
|
23
|
+
export type {
|
|
24
|
+
IdealystElement,
|
|
25
|
+
AnchorElement,
|
|
26
|
+
AnchorRef,
|
|
27
|
+
ComponentElement,
|
|
28
|
+
WebElement,
|
|
29
|
+
NativeElement,
|
|
30
|
+
CrossPlatformElement,
|
|
31
|
+
CrossPlatformRef,
|
|
32
|
+
} from './refTypes';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform ref types for use with refs across web and React Native.
|
|
3
|
+
*
|
|
4
|
+
* These types provide a unified way to work with refs in a cross-platform manner,
|
|
5
|
+
* especially useful for components like Popover that need to anchor to other elements.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Universal element type for cross-platform refs.
|
|
10
|
+
* Works seamlessly in both React web and React Native contexts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const anchorRef = React.useRef<IdealystElement>(null);
|
|
15
|
+
*
|
|
16
|
+
* <Button ref={anchorRef} onPress={() => setOpen(true)}>
|
|
17
|
+
* Open Popover
|
|
18
|
+
* </Button>
|
|
19
|
+
* <Popover anchor={anchorRef} open={open} onOpenChange={setOpen}>
|
|
20
|
+
* <Text>Content</Text>
|
|
21
|
+
* </Popover>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
export type IdealystElement = any;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use IdealystElement instead
|
|
29
|
+
*/
|
|
30
|
+
export type AnchorElement = IdealystElement;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use React.RefObject<IdealystElement> instead
|
|
34
|
+
*/
|
|
35
|
+
export type AnchorRef = React.RefObject<IdealystElement>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use IdealystElement instead
|
|
39
|
+
*/
|
|
40
|
+
export type CrossPlatformElement = IdealystElement;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use React.RefObject<IdealystElement> instead
|
|
44
|
+
*/
|
|
45
|
+
export type CrossPlatformRef = React.RefObject<IdealystElement>;
|
|
46
|
+
|
|
47
|
+
// Legacy exports kept for backwards compatibility
|
|
48
|
+
export type WebElement = IdealystElement;
|
|
49
|
+
export type NativeElement = IdealystElement;
|
|
50
|
+
export type ComponentElement<T> = IdealystElement;
|