@idealyst/components 1.2.13 → 1.2.14

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.
Files changed (47) hide show
  1. package/package.json +3 -3
  2. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -3
  3. package/src/ActivityIndicator/ActivityIndicator.web.tsx +3 -3
  4. package/src/Avatar/Avatar.native.tsx +1 -1
  5. package/src/Breadcrumb/Breadcrumb.native.tsx +20 -21
  6. package/src/Dialog/Dialog.native.tsx +2 -2
  7. package/src/Icon/types.ts +3 -0
  8. package/src/Skeleton/Skeleton.native.tsx +3 -3
  9. package/src/Skeleton/Skeleton.web.tsx +3 -3
  10. package/src/Slider/Slider.native.tsx +2 -2
  11. package/src/TabBar/TabBar.native.tsx +2 -2
  12. package/src/index.native.ts +1 -1
  13. package/src/index.ts +1 -1
  14. package/src/Accordion/Accordion.styles.old.tsx +0 -298
  15. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +0 -94
  16. package/src/Alert/Alert.styles.old.tsx +0 -209
  17. package/src/Avatar/Avatar.styles.old.tsx +0 -99
  18. package/src/Badge/Badge.styles.old.tsx +0 -157
  19. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +0 -231
  20. package/src/Card/Card.styles.old.tsx +0 -160
  21. package/src/Checkbox/Checkbox.styles.old.tsx +0 -271
  22. package/src/Chip/Chip.styles.old.tsx +0 -184
  23. package/src/Dialog/Dialog.styles.old.tsx +0 -202
  24. package/src/Divider/Divider.styles.old.tsx +0 -172
  25. package/src/Icon/Icon.styles.old.tsx +0 -81
  26. package/src/Image/Image.styles.old.tsx +0 -69
  27. package/src/Input/Input.styles.old.tsx +0 -289
  28. package/src/List/List.styles.old.tsx +0 -242
  29. package/src/Menu/Menu.styles.old.tsx +0 -197
  30. package/src/Menu/MenuItem.styles.old.tsx +0 -114
  31. package/src/Popover/Popover.styles.old.tsx +0 -135
  32. package/src/Pressable/Pressable.styles.old.tsx +0 -27
  33. package/src/Progress/Progress.styles.old.tsx +0 -200
  34. package/src/RadioButton/RadioButton.styles.old.tsx +0 -175
  35. package/src/SVGImage/SVGImage.styles.old.tsx +0 -86
  36. package/src/Screen/Screen.styles.old.tsx +0 -87
  37. package/src/Select/Select.styles.old.tsx +0 -353
  38. package/src/Skeleton/Skeleton.styles.old.tsx +0 -67
  39. package/src/Slider/Slider.styles.old.tsx +0 -259
  40. package/src/Switch/Switch.styles.old.tsx +0 -203
  41. package/src/TabBar/TabBar.styles.old.tsx +0 -343
  42. package/src/Table/Table.styles.old.tsx +0 -311
  43. package/src/Text/Text.styles.old.tsx +0 -219
  44. package/src/TextArea/TextArea.styles.old.tsx +0 -213
  45. package/src/Tooltip/Tooltip.styles.old.tsx +0 -82
  46. package/src/Video/Video.styles.old.tsx +0 -51
  47. package/src/View/View.styles.old.tsx +0 -125
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/components",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
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.13",
59
+ "@idealyst/theme": "^1.2.14",
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.13",
109
+ "@idealyst/theme": "^1.2.14",
110
110
  "@idealyst/tooling": "^1.2.4",
111
111
  "@mdi/react": "^1.6.1",
112
112
  "@types/react": "^19.1.0",
@@ -15,17 +15,17 @@ const ActivityIndicator = forwardRef<View, ActivityIndicatorProps>(({
15
15
  id,
16
16
  // Accessibility props
17
17
  accessibilityLabel,
18
- accessibilityLiveRegion,
18
+ accessibilityLive,
19
19
  accessibilityBusy,
20
20
  }, ref) => {
21
21
  // Generate native accessibility props
22
22
  const nativeA11yProps = useMemo(() => {
23
23
  return getNativeLiveRegionAccessibilityProps({
24
24
  accessibilityLabel: accessibilityLabel ?? 'Loading',
25
- accessibilityLiveRegion: accessibilityLiveRegion ?? 'polite',
25
+ accessibilityLive: accessibilityLive ?? 'polite',
26
26
  accessibilityBusy: accessibilityBusy ?? animating,
27
27
  });
28
- }, [accessibilityLabel, accessibilityLiveRegion, accessibilityBusy, animating]);
28
+ }, [accessibilityLabel, accessibilityLive, accessibilityBusy, animating]);
29
29
  // Handle numeric size
30
30
  const sizeVariant = typeof size === 'number' ? 'md' : size;
31
31
  const customSize = typeof size === 'number' ? size : undefined;
@@ -20,7 +20,7 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
20
20
  id,
21
21
  // Accessibility props
22
22
  accessibilityLabel,
23
- accessibilityLiveRegion,
23
+ accessibilityLive,
24
24
  accessibilityBusy,
25
25
  accessibilityAtomic,
26
26
  accessibilityRelevant,
@@ -29,12 +29,12 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
29
29
  const ariaProps = useMemo(() => {
30
30
  return getWebLiveRegionAriaProps({
31
31
  accessibilityLabel: accessibilityLabel ?? 'Loading',
32
- accessibilityLiveRegion: accessibilityLiveRegion ?? 'polite',
32
+ accessibilityLive: accessibilityLive ?? 'polite',
33
33
  accessibilityBusy: accessibilityBusy ?? animating,
34
34
  accessibilityAtomic,
35
35
  accessibilityRelevant,
36
36
  });
37
- }, [accessibilityLabel, accessibilityLiveRegion, accessibilityBusy, animating, accessibilityAtomic, accessibilityRelevant]);
37
+ }, [accessibilityLabel, accessibilityLive, accessibilityBusy, animating, accessibilityAtomic, accessibilityRelevant]);
38
38
  // Handle numeric size
39
39
  const sizeVariant = typeof size === 'number' ? 'md' : size;
40
40
  const customSize = typeof size === 'number' ? size : undefined;
@@ -27,7 +27,7 @@ const Avatar = forwardRef<View, AvatarProps>(({
27
27
  accessibilityHint,
28
28
  accessibilityDisabled,
29
29
  accessibilityHidden,
30
- accessibilityRole: accessibilityRole ?? 'image',
30
+ accessibilityRole: accessibilityRole ?? 'img',
31
31
  });
32
32
  }, [accessibilityLabel, alt, accessibilityHint, accessibilityDisabled, accessibilityHidden, accessibilityRole]);
33
33
  const [hasError, setHasError] = useState(false);
@@ -1,12 +1,6 @@
1
1
  import React, { forwardRef, isValidElement, useState } from 'react';
2
2
  import { Pressable, Text, View } from 'react-native';
3
- import {
4
- breadcrumbContainerStyles,
5
- breadcrumbItemStyles,
6
- breadcrumbSeparatorStyles,
7
- breadcrumbEllipsisStyles,
8
- breadcrumbMenuButtonStyles
9
- } from './Breadcrumb.styles';
3
+ import { breadcrumbStyles } from './Breadcrumb.styles';
10
4
  import type { BreadcrumbProps, BreadcrumbItem as BreadcrumbItemType } from './types';
11
5
  import Icon from '../Icon';
12
6
  import type { IconName } from '../Icon/icon-types';
@@ -26,19 +20,19 @@ const BreadcrumbItem: React.FC<BreadcrumbItemProps> = ({ item, isLast, size, int
26
20
  const isDisabled = item.disabled || false;
27
21
 
28
22
  // Apply size variant
29
- breadcrumbItemStyles.useVariants({
23
+ breadcrumbStyles.useVariants({
30
24
  size,
31
25
  });
32
26
 
33
27
  // Get dynamic item text style
34
- const itemTextStyle = (breadcrumbItemStyles.itemText as any)({
28
+ const itemTextStyle = (breadcrumbStyles.itemText as any)({
35
29
  intent,
36
30
  isLast,
37
31
  disabled: isDisabled,
38
32
  clickable: isClickable,
39
33
  });
40
34
 
41
- const iconStyle = breadcrumbItemStyles.icon;
35
+ const iconStyle = (breadcrumbStyles.icon as any)({});
42
36
 
43
37
  const renderIcon = () => {
44
38
  if (!item.icon) return null;
@@ -59,8 +53,10 @@ const BreadcrumbItem: React.FC<BreadcrumbItemProps> = ({ item, isLast, size, int
59
53
  return null;
60
54
  };
61
55
 
56
+ const itemContainerStyle = (breadcrumbStyles.item as any)({});
57
+
62
58
  const content = (
63
- <View style={[breadcrumbItemStyles.item, itemStyle]}>
59
+ <View style={[itemContainerStyle, itemStyle]}>
64
60
  {item.icon && <View style={iconStyle}>{renderIcon()}</View>}
65
61
  <Text style={itemTextStyle}>{item.label}</Text>
66
62
  </View>
@@ -91,8 +87,8 @@ interface BreadcrumbSeparatorProps {
91
87
  }
92
88
 
93
89
  const BreadcrumbSeparator: React.FC<BreadcrumbSeparatorProps> = ({ separator, size, separatorStyle }) => {
94
- breadcrumbSeparatorStyles.useVariants({ size });
95
- const sepStyle = breadcrumbSeparatorStyles.separator;
90
+ breadcrumbStyles.useVariants({ size });
91
+ const sepStyle = (breadcrumbStyles.separator as any)({});
96
92
 
97
93
  if (typeof separator === 'string') {
98
94
  return <Text style={[sepStyle, separatorStyle]}>{separator}</Text>;
@@ -106,11 +102,12 @@ interface BreadcrumbEllipsisProps {
106
102
  }
107
103
 
108
104
  const BreadcrumbEllipsis: React.FC<BreadcrumbEllipsisProps> = ({ size, intent }) => {
109
- breadcrumbEllipsisStyles.useVariants({ size });
110
- const iconStyle = breadcrumbEllipsisStyles.icon({ intent });
105
+ breadcrumbStyles.useVariants({ size });
106
+ const ellipsisStyle = (breadcrumbStyles.ellipsis as any)({});
107
+ const iconStyle = (breadcrumbStyles.ellipsisIcon as any)({ intent });
111
108
 
112
109
  return (
113
- <View style={breadcrumbEllipsisStyles.ellipsis}>
110
+ <View style={ellipsisStyle}>
114
111
  <Icon name="dots-horizontal" style={iconStyle} />
115
112
  </View>
116
113
  );
@@ -132,9 +129,11 @@ const Breadcrumb = forwardRef<View, BreadcrumbProps>(({
132
129
  }, ref) => {
133
130
  const [menuOpen, setMenuOpen] = useState(false);
134
131
 
135
- // Apply variants for menu button
136
- breadcrumbMenuButtonStyles.useVariants({ size });
137
- const menuIconStyle = breadcrumbMenuButtonStyles.icon({ intent });
132
+ // Apply variants
133
+ breadcrumbStyles.useVariants({ size });
134
+ const containerStyle = (breadcrumbStyles.container as any)({});
135
+ const menuButtonStyle = (breadcrumbStyles.menuButton as any)({});
136
+ const menuIconStyle = (breadcrumbStyles.menuButtonIcon as any)({ intent });
138
137
 
139
138
  // Handle responsive collapsing
140
139
  let displayItems = items;
@@ -172,7 +171,7 @@ const Breadcrumb = forwardRef<View, BreadcrumbProps>(({
172
171
  <View
173
172
  ref={ref}
174
173
  nativeID={id}
175
- style={[breadcrumbContainerStyles.container, style]}
174
+ style={[containerStyle, style]}
176
175
  testID={testID}
177
176
  accessibilityLabel="Breadcrumb"
178
177
  >
@@ -200,7 +199,7 @@ const Breadcrumb = forwardRef<View, BreadcrumbProps>(({
200
199
  size={size}
201
200
  >
202
201
  <Pressable
203
- style={breadcrumbMenuButtonStyles.button}
202
+ style={menuButtonStyle}
204
203
  accessibilityRole="button"
205
204
  accessibilityLabel="Show more breadcrumb items"
206
205
  >
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, forwardRef, useMemo } from 'react';
2
- import { Modal, View, Text, TouchableOpacity, TouchableWithoutFeedback, BackHandler } from 'react-native';
2
+ import { Modal, View, Text, TouchableOpacity, TouchableWithoutFeedback, BackHandler, GestureResponderEvent } from 'react-native';
3
3
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
4
4
  import { DialogProps } from './types';
5
5
  import { dialogStyles } from './Dialog.styles';
@@ -135,7 +135,7 @@ const Dialog = forwardRef<View, DialogProps>(({
135
135
  >
136
136
  <TouchableWithoutFeedback onPress={handleBackdropPress}>
137
137
  <Animated.View style={[backdropStyle, backdropAnimatedStyle]}>
138
- <TouchableWithoutFeedback onPress={(e) => e.stopPropagation()}>
138
+ <TouchableWithoutFeedback onPress={(e: GestureResponderEvent) => e.stopPropagation()}>
139
139
  <Animated.View ref={ref as any} style={[containerStyle, style, containerAnimatedStyle]} nativeID={id} {...nativeA11yProps}>
140
140
  {(title || showCloseButton) && (
141
141
  <View style={headerStyle}>
package/src/Icon/types.ts CHANGED
@@ -4,6 +4,9 @@ import type { Size, Text } from '@idealyst/theme';
4
4
  import { Color, Intent } from '@idealyst/theme';
5
5
  import { BaseProps } from '../utils/viewStyleProps';
6
6
 
7
+ // Re-export IconName for external consumers
8
+ export type { IconName } from './icon-types';
9
+
7
10
  export type IconSizeVariant = Size | number;
8
11
 
9
12
  /**
@@ -23,17 +23,17 @@ const Skeleton = forwardRef<View, SkeletonProps>(({
23
23
  id,
24
24
  // Accessibility props
25
25
  accessibilityLabel,
26
- accessibilityLiveRegion,
26
+ accessibilityLive,
27
27
  accessibilityBusy,
28
28
  }, ref) => {
29
29
  // Generate native accessibility props
30
30
  const nativeA11yProps = useMemo(() => {
31
31
  return getNativeLiveRegionAccessibilityProps({
32
32
  accessibilityLabel: accessibilityLabel ?? 'Loading content',
33
- accessibilityLiveRegion: accessibilityLiveRegion ?? 'polite',
33
+ accessibilityLive: accessibilityLive ?? 'polite',
34
34
  accessibilityBusy: accessibilityBusy ?? true,
35
35
  });
36
- }, [accessibilityLabel, accessibilityLiveRegion, accessibilityBusy]);
36
+ }, [accessibilityLabel, accessibilityLive, accessibilityBusy]);
37
37
  skeletonStyles.useVariants({
38
38
  shape,
39
39
  animation,
@@ -19,7 +19,7 @@ const Skeleton: React.FC<SkeletonProps> = ({
19
19
  id,
20
20
  // Accessibility props
21
21
  accessibilityLabel,
22
- accessibilityLiveRegion,
22
+ accessibilityLive,
23
23
  accessibilityBusy,
24
24
  accessibilityAtomic,
25
25
  accessibilityRelevant,
@@ -28,12 +28,12 @@ const Skeleton: React.FC<SkeletonProps> = ({
28
28
  const ariaProps = useMemo(() => {
29
29
  return getWebLiveRegionAriaProps({
30
30
  accessibilityLabel: accessibilityLabel ?? 'Loading content',
31
- accessibilityLiveRegion: accessibilityLiveRegion ?? 'polite',
31
+ accessibilityLive: accessibilityLive ?? 'polite',
32
32
  accessibilityBusy: accessibilityBusy ?? true,
33
33
  accessibilityAtomic,
34
34
  accessibilityRelevant,
35
35
  });
36
- }, [accessibilityLabel, accessibilityLiveRegion, accessibilityBusy, accessibilityAtomic, accessibilityRelevant]);
36
+ }, [accessibilityLabel, accessibilityLive, accessibilityBusy, accessibilityAtomic, accessibilityRelevant]);
37
37
  skeletonStyles.useVariants({
38
38
  shape,
39
39
  animation,
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useCallback, forwardRef, useMemo } from 'react';
2
- import { View } from 'react-native';
2
+ import { View, LayoutChangeEvent } 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
5
  import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
@@ -222,7 +222,7 @@ const Slider = forwardRef<View, SliderProps>(({
222
222
  <GestureDetector gesture={composedGesture}>
223
223
  <View
224
224
  style={trackStyle}
225
- onLayout={(e) => {
225
+ onLayout={(e: LayoutChangeEvent) => {
226
226
  const width = e.nativeEvent.layout.width;
227
227
  trackWidth.value = width;
228
228
  setTrackWidthState(width);
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useRef, useEffect, forwardRef, ReactNode, useMemo } from 'react';
2
- import { View, TouchableOpacity, Text, ScrollView } from 'react-native';
2
+ import { View, TouchableOpacity, Text, ScrollView, LayoutChangeEvent } from 'react-native';
3
3
  import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
4
4
  import {
5
5
  tabBarContainerStyles,
@@ -187,7 +187,7 @@ const TabBar = forwardRef<View, TabBarProps>(({
187
187
  return (
188
188
  <TouchableOpacity
189
189
  key={item.value}
190
- onLayout={(event) => {
190
+ onLayout={(event: LayoutChangeEvent) => {
191
191
  const { x, width } = event.nativeEvent.layout;
192
192
  handleTabLayout(item.value, x, width);
193
193
  }}
@@ -145,4 +145,4 @@ export type { PlatformAPI, PlatformSystem, PlatformSelectSpec } from './Platform
145
145
  // Event utilities
146
146
  export * from './utils/events';
147
147
 
148
- export type { AppTheme } from '@idealyst/theme';
148
+ export type { Theme as AppTheme } from '@idealyst/theme';
package/src/index.ts CHANGED
@@ -181,4 +181,4 @@ export type {
181
181
  SelectStyleableElements,
182
182
  } from './extensions';
183
183
 
184
- export type { AppTheme } from '@idealyst/theme';
184
+ export type { Theme as AppTheme } from '@idealyst/theme';
@@ -1,298 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Size } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import {
5
- buildGapVariants,
6
- buildPaddingVariants,
7
- buildPaddingVerticalVariants,
8
- buildPaddingHorizontalVariants,
9
- buildMarginVariants,
10
- buildMarginVerticalVariants,
11
- buildMarginHorizontalVariants,
12
- } from '../utils/buildViewStyleVariants';
13
- import { AccordionType } from './types';
14
- import { applyExtensions } from '../extensions/applyExtension';
15
-
16
- type AccordionSize = Size;
17
-
18
- type AccordionVariants = {
19
- size: AccordionSize;
20
- type: AccordionType;
21
- expanded: boolean;
22
- disabled: boolean;
23
- isLast: boolean;
24
- }
25
-
26
- export type ExpandedAccordionStyles = StylesheetStyles<keyof AccordionVariants>;
27
-
28
- type ItemDynamicProps = {
29
- type?: AccordionType;
30
- isLast?: boolean;
31
- };
32
-
33
- /**
34
- * Create type variants for container
35
- */
36
- function createContainerTypeVariants(theme: Theme) {
37
- return {
38
- standard: {
39
- gap: 0,
40
- },
41
- separated: {
42
- gap: 8,
43
- },
44
- bordered: {
45
- gap: 0,
46
- borderWidth: 1,
47
- borderStyle: 'solid' as const,
48
- borderColor: theme.colors.border.primary,
49
- borderRadius: 8,
50
- overflow: 'hidden' as const,
51
- },
52
- } as const;
53
- }
54
-
55
- /**
56
- * Get item styles based on type and isLast
57
- */
58
- function getItemTypeStyles(theme: Theme, type: AccordionType, isLast: boolean) {
59
- switch (type) {
60
- case 'standard':
61
- return {
62
- borderBottomWidth: isLast ? 0 : 1,
63
- borderBottomStyle: 'solid' as const,
64
- borderBottomColor: theme.colors.border.primary,
65
- };
66
- case 'separated':
67
- return {
68
- borderWidth: 1,
69
- borderStyle: 'solid' as const,
70
- borderColor: theme.colors.border.primary,
71
- borderRadius: 8,
72
- overflow: 'hidden' as const,
73
- };
74
- case 'bordered':
75
- return {
76
- borderBottomWidth: isLast ? 0 : 1,
77
- borderBottomStyle: 'solid' as const,
78
- borderBottomColor: theme.colors.border.primary,
79
- };
80
- default:
81
- return {};
82
- }
83
- }
84
-
85
- /**
86
- * Create dynamic item styles
87
- */
88
- function createItemStyles(theme: Theme) {
89
- return ({ type = 'standard', isLast = false }: ItemDynamicProps) => {
90
- const typeStyles = getItemTypeStyles(theme, type, isLast);
91
- return {
92
- display: 'flex' as const,
93
- flexDirection: 'column' as const,
94
- ...typeStyles,
95
- variants: {
96
- size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
97
- expanded: { true: {}, false: {} },
98
- disabled: { true: {}, false: {} },
99
- },
100
- } as const;
101
- };
102
- }
103
-
104
- /**
105
- * Create size variants for header
106
- */
107
- function createHeaderSizeVariants(theme: Theme) {
108
- return buildSizeVariants(theme, 'accordion', (size) => ({
109
- fontSize: size.headerFontSize,
110
- padding: size.headerPadding,
111
- }));
112
- }
113
-
114
- /**
115
- * Create size variants for icon
116
- */
117
- function createIconSizeVariants(theme: Theme) {
118
- return buildSizeVariants(theme, 'accordion', (size) => ({
119
- width: size.iconSize,
120
- height: size.iconSize,
121
- }));
122
- }
123
-
124
- /**
125
- * Create size variants for content inner
126
- */
127
- function createContentInnerSizeVariants(theme: Theme) {
128
- return buildSizeVariants(theme, 'accordion', (size) => ({
129
- fontSize: size.headerFontSize,
130
- padding: size.contentPadding,
131
- paddingTop: 0,
132
- }));
133
- }
134
-
135
- // Helper functions to create static styles wrapped in dynamic functions
136
- function createContainerStyles(theme: Theme) {
137
- return () => ({
138
- display: 'flex' as const,
139
- flexDirection: 'column' as const,
140
- variants: {
141
- size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
142
- type: createContainerTypeVariants(theme),
143
- expanded: { true: {}, false: {} },
144
- disabled: { true: {}, false: {} },
145
- isLast: { true: {}, false: {} },
146
- // Spacing variants from ContainerStyleProps
147
- gap: buildGapVariants(theme),
148
- padding: buildPaddingVariants(theme),
149
- paddingVertical: buildPaddingVerticalVariants(theme),
150
- paddingHorizontal: buildPaddingHorizontalVariants(theme),
151
- margin: buildMarginVariants(theme),
152
- marginVertical: buildMarginVerticalVariants(theme),
153
- marginHorizontal: buildMarginHorizontalVariants(theme),
154
- },
155
- });
156
- }
157
-
158
- function createHeaderStyles(theme: Theme) {
159
- return () => ({
160
- display: 'flex' as const,
161
- flexDirection: 'row' as const,
162
- alignItems: 'center' as const,
163
- justifyContent: 'space-between' as const,
164
- width: '100%' as const,
165
- backgroundColor: 'transparent' as const,
166
- color: theme.colors.text.primary,
167
- textAlign: 'left' as const,
168
- variants: {
169
- size: createHeaderSizeVariants(theme),
170
- type: { standard: {}, separated: {}, bordered: {} },
171
- expanded: {
172
- true: {
173
- fontWeight: '600' as const,
174
- },
175
- false: {
176
- fontWeight: '500' as const,
177
- },
178
- },
179
- disabled: {
180
- true: {
181
- opacity: 0.5,
182
- _web: {
183
- cursor: 'not-allowed' as const,
184
- },
185
- },
186
- false: {
187
- _web: {
188
- cursor: 'pointer' as const,
189
- _hover: {
190
- backgroundColor: theme.colors.surface.secondary,
191
- },
192
- },
193
- },
194
- },
195
- isLast: { true: {}, false: {} },
196
- } as const,
197
- _web: {
198
- border: 'none' as const,
199
- outline: 'none' as const,
200
- transition: 'background-color 0.2s ease' as const,
201
- },
202
- });
203
- }
204
-
205
- function createTitleStyles() {
206
- return () => ({
207
- flex: 1,
208
- variants: {
209
- size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
210
- type: { standard: {}, separated: {}, bordered: {} },
211
- expanded: { true: {}, false: {} },
212
- disabled: { true: {}, false: {} },
213
- isLast: { true: {}, false: {} },
214
- },
215
- });
216
- }
217
-
218
- function createIconStyles(theme: Theme) {
219
- return () => ({
220
- display: 'flex' as const,
221
- alignItems: 'center' as const,
222
- justifyContent: 'center' as const,
223
- marginLeft: 8,
224
- color: theme.intents.primary.primary,
225
- variants: {
226
- size: createIconSizeVariants(theme),
227
- type: { standard: {}, separated: {}, bordered: {} },
228
- expanded: {
229
- true: {
230
- _web: {
231
- transform: 'rotate(180deg)' as const,
232
- },
233
- },
234
- false: {
235
- _web: {
236
- transform: 'rotate(0deg)' as const,
237
- },
238
- },
239
- },
240
- disabled: { true: {}, false: {} },
241
- isLast: { true: {}, false: {} },
242
- },
243
- _web: {
244
- transition: 'transform 0.2s ease' as const,
245
- },
246
- });
247
- }
248
-
249
- function createContentStyles() {
250
- return () => ({
251
- overflow: 'hidden' as const,
252
- variants: {
253
- size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
254
- type: { standard: {}, separated: {}, bordered: {} },
255
- expanded: {
256
- true: {
257
- maxHeight: 2000,
258
- },
259
- false: {
260
- maxHeight: 0,
261
- },
262
- },
263
- disabled: { true: {}, false: {} },
264
- isLast: { true: {}, false: {} },
265
- },
266
- _web: {
267
- transition: 'height 0.15s ease, padding 0.3s ease' as const,
268
- },
269
- });
270
- }
271
-
272
- function createContentInnerStyles(theme: Theme) {
273
- return () => ({
274
- color: theme.colors.text.secondary,
275
- variants: {
276
- size: createContentInnerSizeVariants(theme),
277
- type: { standard: {}, separated: {}, bordered: {} },
278
- expanded: { true: {}, false: {} },
279
- disabled: { true: {}, false: {} },
280
- isLast: { true: {}, false: {} },
281
- },
282
- });
283
- }
284
-
285
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
286
- export const accordionStyles = StyleSheet.create((theme: Theme) => {
287
- // Apply extensions to main visual elements
288
-
289
- return applyExtensions('Accordion', theme, {container: createContainerStyles(theme),
290
- item: createItemStyles(theme),
291
- header: createHeaderStyles(theme),
292
- content: createContentStyles(),
293
- icon: createIconStyles(theme),
294
- // Additional styles (merged from return)
295
- // Minor utility styles (not extended)
296
- title: createTitleStyles()(),
297
- contentInner: createContentInnerStyles(theme)()});
298
- });