@idealyst/components 1.2.9 → 1.2.12

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.9",
3
+ "version": "1.2.12",
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.9",
59
+ "@idealyst/theme": "^1.2.12",
60
60
  "@mdi/js": ">=7.0.0",
61
61
  "@mdi/react": ">=1.0.0",
62
62
  "@react-native-vector-icons/common": ">=12.0.0",
@@ -106,7 +106,7 @@
106
106
  }
107
107
  },
108
108
  "devDependencies": {
109
- "@idealyst/theme": "^1.2.9",
109
+ "@idealyst/theme": "^1.2.12",
110
110
  "@idealyst/tooling": "^1.2.4",
111
111
  "@mdi/react": "^1.6.1",
112
112
  "@types/react": "^19.1.0",
@@ -1,7 +1,7 @@
1
1
  import React, { useState, forwardRef, useEffect, useMemo } from 'react';
2
2
  import { View, TouchableOpacity, LayoutChangeEvent } from 'react-native';
3
3
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
4
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
4
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
5
5
  import { accordionStyles } from './Accordion.styles';
6
6
  import Text from '../Text';
7
7
  import type { AccordionProps, AccordionItem as AccordionItemType } from './types';
@@ -96,7 +96,7 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
96
96
  </Text>
97
97
  </View>
98
98
  <Animated.View style={[iconStyle, animatedIconStyle]}>
99
- <MaterialCommunityIcons
99
+ <MaterialDesignIcons
100
100
  name="chevron-down"
101
101
  size={20}
102
102
  style={iconStyle}
@@ -1,6 +1,6 @@
1
1
  import React, { isValidElement, forwardRef, ComponentRef } from 'react';
2
2
  import { View, Text, TouchableOpacity } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import { alertStyles } from './Alert.styles';
5
5
  import { isIconName } from '../Icon/icon-resolver';
6
6
  import type { AlertProps } from './types';
@@ -49,7 +49,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
49
49
 
50
50
  if (typeof displayIcon === 'string' && isIconName(displayIcon)) {
51
51
  return (
52
- <MaterialCommunityIcons
52
+ <MaterialDesignIcons
53
53
  name={displayIcon}
54
54
  size={20}
55
55
  style={iconContainerStyle}
@@ -110,7 +110,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
110
110
  accessibilityLabel="Dismiss alert"
111
111
  accessibilityRole="button"
112
112
  >
113
- <MaterialCommunityIcons
113
+ <MaterialDesignIcons
114
114
  name="close"
115
115
  size={16}
116
116
  style={closeIconStyle}
@@ -1,6 +1,6 @@
1
1
  import React, { isValidElement, forwardRef } from 'react';
2
2
  import { View, Text } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import { BadgeProps } from './types';
5
5
  import { badgeStyles } from './Badge.styles';
6
6
  import { isIconName } from '../Icon/icon-resolver';
@@ -33,7 +33,7 @@ const Badge = forwardRef<View, BadgeProps>(({
33
33
 
34
34
  if (typeof icon === 'string' && isIconName(icon)) {
35
35
  return (
36
- <MaterialCommunityIcons
36
+ <MaterialDesignIcons
37
37
  name={icon}
38
38
  size={iconSize}
39
39
  color={textStyle.color}
@@ -1,6 +1,6 @@
1
1
  import React, { ComponentRef, forwardRef, isValidElement, useMemo } from 'react';
2
2
  import { ActivityIndicator, StyleSheet as RNStyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import Svg, { Defs, LinearGradient, Stop, Rect } from 'react-native-svg';
5
5
  import { buttonStyles } from './Button.styles';
6
6
  import { ButtonProps } from './types';
@@ -208,7 +208,7 @@ const Button = forwardRef<ComponentRef<typeof TouchableOpacity>, ButtonProps>((p
208
208
  {hasIcons ? (
209
209
  <View style={[iconContainerStyle, { opacity: contentOpacity }]}>
210
210
  {leftIcon && (
211
- <MaterialCommunityIcons
211
+ <MaterialDesignIcons
212
212
  name={leftIcon}
213
213
  size={iconSize}
214
214
  style={iconStyle}
@@ -218,7 +218,7 @@ const Button = forwardRef<ComponentRef<typeof TouchableOpacity>, ButtonProps>((p
218
218
  {buttonContent}
219
219
  </Text>
220
220
  {rightIcon && (
221
- <MaterialCommunityIcons
221
+ <MaterialDesignIcons
222
222
  name={rightIcon}
223
223
  size={iconSize}
224
224
  style={iconStyle}
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, forwardRef, useMemo } from 'react';
2
2
  import { View, Text, Pressable } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import { CheckboxProps } from './types';
5
5
  import { checkboxStyles } from './Checkbox.styles';
6
6
  import { getNativeSelectionAccessibilityProps } from '../utils/accessibility';
@@ -118,7 +118,7 @@ const Checkbox = forwardRef<View, CheckboxProps>(({
118
118
  >
119
119
  <View style={checkboxStyle}>
120
120
  {(internalChecked || indeterminate) && (
121
- <MaterialCommunityIcons
121
+ <MaterialDesignIcons
122
122
  name={indeterminate ? 'minus' : 'check'}
123
123
  size={14}
124
124
  color="#ffffff"
@@ -1,6 +1,6 @@
1
1
  import React, { isValidElement, forwardRef, ComponentRef } from 'react';
2
2
  import { Pressable, Text, View } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import { chipStyles } from './Chip.styles';
5
5
  import { isIconName } from '../Icon/icon-resolver';
6
6
  import type { ChipProps } from './types';
@@ -59,7 +59,7 @@ const Chip = forwardRef<ComponentRef<typeof Pressable>, ChipProps>(({
59
59
  if (typeof icon === 'string' && isIconName(icon)) {
60
60
  return (
61
61
  <View style={iconStyle}>
62
- <MaterialCommunityIcons
62
+ <MaterialDesignIcons
63
63
  name={icon}
64
64
  size={iconSize}
65
65
  style={iconStyle}
@@ -89,7 +89,7 @@ const Chip = forwardRef<ComponentRef<typeof Pressable>, ChipProps>(({
89
89
  accessibilityLabel="Delete"
90
90
  accessibilityRole="button"
91
91
  >
92
- <MaterialCommunityIcons
92
+ <MaterialDesignIcons
93
93
  name="close"
94
94
  size={deleteIconSize}
95
95
  style={deleteIconStyle}
@@ -1,5 +1,5 @@
1
1
  import { forwardRef, useMemo } from 'react';
2
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
2
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
3
3
  import { IconProps } from './types';
4
4
  import { iconStyles } from './Icon.styles';
5
5
  import { useUnistyles } from 'react-native-unistyles';
@@ -28,7 +28,7 @@ const Icon = forwardRef<any, IconProps>(({
28
28
  const iconColor = iconStyle.color;
29
29
 
30
30
  return (
31
- <MaterialCommunityIcons
31
+ <MaterialDesignIcons
32
32
  ref={ref}
33
33
  nativeID={id}
34
34
  size={iconSize}
@@ -1,6 +1,6 @@
1
1
  import React, { useState, isValidElement, useMemo, useEffect, useRef, useCallback } from 'react';
2
2
  import { View, TextInput, TouchableOpacity, Platform, TextInputProps } from 'react-native';
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
4
4
  import { useUnistyles } from 'react-native-unistyles';
5
5
  import { InputProps } from './types';
6
6
  import { inputStyles } from './Input.styles';
@@ -220,7 +220,7 @@ const Input = React.forwardRef<TextInput, InputProps>(({
220
220
 
221
221
  if (typeof leftIcon === 'string') {
222
222
  return (
223
- <MaterialCommunityIcons
223
+ <MaterialDesignIcons
224
224
  name={leftIcon}
225
225
  size={iconSize}
226
226
  color={iconColor}
@@ -239,7 +239,7 @@ const Input = React.forwardRef<TextInput, InputProps>(({
239
239
 
240
240
  if (typeof rightIcon === 'string') {
241
241
  return (
242
- <MaterialCommunityIcons
242
+ <MaterialDesignIcons
243
243
  name={rightIcon}
244
244
  size={iconSize}
245
245
  color={iconColor}
@@ -279,7 +279,7 @@ const Input = React.forwardRef<TextInput, InputProps>(({
279
279
  disabled={disabled}
280
280
  accessibilityLabel={isPasswordVisible ? 'Hide password' : 'Show password'}
281
281
  >
282
- <MaterialCommunityIcons
282
+ <MaterialDesignIcons
283
283
  name={isPasswordVisible ? 'eye-off' : 'eye'}
284
284
  size={iconSize}
285
285
  color={iconColor}
@@ -1,7 +1,7 @@
1
1
  import React, { isValidElement, forwardRef, ComponentRef, useMemo } from 'react';
2
2
  import { View, Pressable, Text } from 'react-native';
3
3
  import { useUnistyles } from 'react-native-unistyles';
4
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
4
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
5
5
  import { getColorFromString, Intent, Theme, Color } from '@idealyst/theme';
6
6
  import { listStyles } from './List.styles';
7
7
  import type { ListItemProps } from './types';
@@ -87,7 +87,7 @@ const ListItem = forwardRef<ComponentRef<typeof View> | ComponentRef<typeof Pres
87
87
  if (typeof element === 'string') {
88
88
  const iconSize = styleKey === 'leading' ? leadingStyle.width : trailingIconStyle.width;
89
89
  return (
90
- <MaterialCommunityIcons
90
+ <MaterialDesignIcons
91
91
  name={element}
92
92
  size={iconSize}
93
93
  color={resolvedIconColor}
@@ -0,0 +1,35 @@
1
+ import { Platform as RNPlatform } from 'react-native';
2
+ import type { PlatformAPI, PlatformSelectSpec, PlatformSystem } from './types';
3
+
4
+ const system: PlatformSystem = RNPlatform.OS === 'ios' ? 'ios' : 'android';
5
+
6
+ /**
7
+ * Platform utility for React Native (iOS and Android)
8
+ */
9
+ const Platform: PlatformAPI = {
10
+ system,
11
+ isWeb: false,
12
+ isNative: true,
13
+ isIOS: RNPlatform.OS === 'ios',
14
+ isAndroid: RNPlatform.OS === 'android',
15
+
16
+ select<T>(spec: PlatformSelectSpec<T>): T | undefined {
17
+ // First check for specific platform
18
+ if (system === 'ios' && spec.ios !== undefined) {
19
+ return spec.ios;
20
+ }
21
+ if (system === 'android' && spec.android !== undefined) {
22
+ return spec.android;
23
+ }
24
+
25
+ // Then check for native fallback
26
+ if (spec.native !== undefined) {
27
+ return spec.native;
28
+ }
29
+
30
+ // Finally check for default
31
+ return spec.default;
32
+ },
33
+ };
34
+
35
+ export default Platform;
@@ -0,0 +1,21 @@
1
+ import type { PlatformAPI, PlatformSelectSpec, PlatformSystem } from './types';
2
+
3
+ /**
4
+ * Platform utility for web
5
+ */
6
+ const Platform: PlatformAPI = {
7
+ system: 'web' as PlatformSystem,
8
+ isWeb: true,
9
+ isNative: false,
10
+ isIOS: false,
11
+ isAndroid: false,
12
+
13
+ select<T>(spec: PlatformSelectSpec<T>): T | undefined {
14
+ if (spec.web !== undefined) {
15
+ return spec.web;
16
+ }
17
+ return spec.default;
18
+ },
19
+ };
20
+
21
+ export default Platform;
@@ -0,0 +1,2 @@
1
+ export { default } from './Platform.native';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export { default } from './Platform.web';
2
+ export * from './types';
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Platform system types
3
+ */
4
+ export type PlatformSystem = 'web' | 'ios' | 'android';
5
+
6
+ /**
7
+ * Platform select specification
8
+ * Allows selecting a value based on the current platform
9
+ */
10
+ export type PlatformSelectSpec<T> = {
11
+ web?: T;
12
+ ios?: T;
13
+ android?: T;
14
+ native?: T; // Fallback for ios and android
15
+ default?: T; // Fallback for any platform
16
+ };
17
+
18
+ /**
19
+ * Platform API interface
20
+ */
21
+ export interface PlatformAPI {
22
+ /**
23
+ * The current platform system: 'web', 'ios', or 'android'
24
+ */
25
+ system: PlatformSystem;
26
+
27
+ /**
28
+ * Whether the current platform is web
29
+ */
30
+ isWeb: boolean;
31
+
32
+ /**
33
+ * Whether the current platform is native (ios or android)
34
+ */
35
+ isNative: boolean;
36
+
37
+ /**
38
+ * Whether the current platform is iOS
39
+ */
40
+ isIOS: boolean;
41
+
42
+ /**
43
+ * Whether the current platform is Android
44
+ */
45
+ isAndroid: boolean;
46
+
47
+ /**
48
+ * Select a value based on the current platform
49
+ *
50
+ * @example
51
+ * const padding = Platform.select({
52
+ * web: 20,
53
+ * ios: 16,
54
+ * android: 14,
55
+ * default: 12,
56
+ * });
57
+ *
58
+ * @example
59
+ * const fontFamily = Platform.select({
60
+ * web: 'Inter',
61
+ * native: 'System',
62
+ * });
63
+ */
64
+ select<T>(spec: PlatformSelectSpec<T>): T | undefined;
65
+ }
@@ -10,7 +10,7 @@ import {
10
10
  Platform,
11
11
  Animated,
12
12
  } from 'react-native';
13
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
13
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
14
14
  import { SelectProps, SelectOption } from './types';
15
15
  import { selectStyles } from './Select.styles';
16
16
  import { BoundedModalContent } from '../internal/BoundedModalContent.native';
@@ -180,7 +180,7 @@ const Select = forwardRef<View, SelectProps>(({
180
180
  const renderChevron = () => {
181
181
  return (
182
182
  <View style={chevronStyle}>
183
- <MaterialCommunityIcons
183
+ <MaterialDesignIcons
184
184
  name="chevron-down"
185
185
  style={chevronStyle}
186
186
  />
@@ -195,7 +195,7 @@ const Select = forwardRef<View, SelectProps>(({
195
195
  if (typeof icon === 'string') {
196
196
  return (
197
197
  <View style={iconStyle}>
198
- <MaterialCommunityIcons
198
+ <MaterialDesignIcons
199
199
  style={iconStyle}
200
200
  name={icon}
201
201
  />
@@ -214,7 +214,7 @@ const Select = forwardRef<View, SelectProps>(({
214
214
  if (typeof icon === 'string') {
215
215
  return (
216
216
  <View style={optionIconStyle}>
217
- <MaterialCommunityIcons
217
+ <MaterialDesignIcons
218
218
  style={optionIconStyle}
219
219
  name={icon}
220
220
  />
@@ -2,7 +2,7 @@ import React, { useState, useCallback, forwardRef, useMemo } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { GestureDetector, Gesture } from 'react-native-gesture-handler';
4
4
  import Animated, { useSharedValue, useAnimatedStyle, runOnJS, withSpring } from 'react-native-reanimated';
5
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
+ import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
6
6
  import { sliderStyles } from './Slider.styles';
7
7
  import Text from '../Text';
8
8
  import type { SliderProps } from './types';
@@ -195,7 +195,7 @@ const Slider = forwardRef<View, SliderProps>(({
195
195
  if (typeof icon === 'string' && isIconName(icon)) {
196
196
  const iconStyle = (sliderStyles.thumbIcon as any)({ intent });
197
197
  return (
198
- <MaterialCommunityIcons
198
+ <MaterialDesignIcons
199
199
  name={icon}
200
200
  size={iconStyle.width || 16}
201
201
  color={iconStyle.color}
@@ -101,8 +101,11 @@ export * from './Chip/types';
101
101
  export { default as Breadcrumb } from './Breadcrumb';
102
102
  export * from './Breadcrumb/types';
103
103
 
104
- export { default as Link } from './Link';
105
- export * from './Link/types';
104
+ export { default as Link } from './Link';
105
+ export * from './Link/types';
106
+
107
+ export { default as Platform } from './Platform';
108
+ export * from './Platform/types';
106
109
 
107
110
  export type { ButtonProps } from './Button/types';
108
111
  export type { TextProps } from './Text/types';
@@ -137,6 +140,7 @@ export type { SkeletonProps, SkeletonGroupProps, SkeletonShape, SkeletonAnimatio
137
140
  export type { ChipProps, ChipSize, ChipIntent } from './Chip/types';
138
141
  export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb/types';
139
142
  export type { LinkProps } from './Link/types';
143
+ export type { PlatformAPI, PlatformSystem, PlatformSelectSpec } from './Platform/types';
140
144
 
141
145
  // Event utilities
142
146
  export * from './utils/events';
package/src/index.ts CHANGED
@@ -109,6 +109,9 @@ export * from './Chip/types';
109
109
  export { default as Breadcrumb } from './Breadcrumb';
110
110
  export * from './Breadcrumb/types';
111
111
 
112
+ export { default as Platform } from './Platform';
113
+ export * from './Platform/types';
114
+
112
115
  export type { ButtonProps } from './Button/types';
113
116
  export type { TextProps } from './Text/types';
114
117
  export type { ViewProps } from './View/types';
@@ -142,6 +145,7 @@ export type { AlertProps } from './Alert/types';
142
145
  export type { SkeletonProps, SkeletonGroupProps, SkeletonShape, SkeletonAnimation } from './Skeleton/types';
143
146
  export type { ChipProps, ChipSize, ChipIntent } from './Chip/types';
144
147
  export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb/types';
148
+ export type { PlatformAPI, PlatformSystem, PlatformSelectSpec } from './Platform/types';
145
149
 
146
150
  export { useMergeRefs };
147
151