@idealyst/components 1.1.7 → 1.1.8

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 (105) hide show
  1. package/package.json +3 -3
  2. package/src/Accordion/Accordion.native.tsx +8 -6
  3. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  4. package/src/Accordion/Accordion.styles.tsx +102 -236
  5. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  6. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
  7. package/src/Alert/Alert.native.tsx +16 -6
  8. package/src/Alert/Alert.styles.old.tsx +209 -0
  9. package/src/Alert/Alert.styles.tsx +67 -149
  10. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  11. package/src/Avatar/Avatar.styles.tsx +35 -80
  12. package/src/Badge/Badge.styles.old.tsx +157 -0
  13. package/src/Badge/Badge.styles.tsx +61 -121
  14. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  15. package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
  16. package/src/Breadcrumb/Breadcrumb.web.tsx +28 -23
  17. package/src/Button/Button.styles.tsx +89 -141
  18. package/src/Card/Card.native.tsx +7 -11
  19. package/src/Card/Card.styles.old.tsx +160 -0
  20. package/src/Card/Card.styles.tsx +105 -142
  21. package/src/Card/Card.web.tsx +5 -4
  22. package/src/Checkbox/Checkbox.native.tsx +9 -5
  23. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  24. package/src/Checkbox/Checkbox.styles.tsx +104 -216
  25. package/src/Checkbox/Checkbox.web.tsx +6 -6
  26. package/src/Chip/Chip.styles.old.tsx +184 -0
  27. package/src/Chip/Chip.styles.tsx +34 -72
  28. package/src/Dialog/Dialog.native.tsx +7 -4
  29. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  30. package/src/Dialog/Dialog.styles.tsx +69 -133
  31. package/src/Divider/Divider.styles.old.tsx +172 -0
  32. package/src/Divider/Divider.styles.tsx +62 -84
  33. package/src/Icon/Icon.native.tsx +8 -8
  34. package/src/Icon/Icon.styles.old.tsx +81 -0
  35. package/src/Icon/Icon.styles.tsx +52 -66
  36. package/src/Icon/Icon.web.tsx +43 -7
  37. package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
  38. package/src/Image/Image.styles.old.tsx +69 -0
  39. package/src/Image/Image.styles.tsx +46 -60
  40. package/src/Input/Input.native.tsx +138 -53
  41. package/src/Input/Input.styles.old.tsx +289 -0
  42. package/src/Input/Input.styles.tsx +127 -198
  43. package/src/List/List.native.tsx +5 -2
  44. package/src/List/List.styles.old.tsx +242 -0
  45. package/src/List/List.styles.tsx +179 -215
  46. package/src/List/ListItem.native.tsx +12 -6
  47. package/src/List/ListItem.web.tsx +23 -13
  48. package/src/Menu/Menu.styles.old.tsx +197 -0
  49. package/src/Menu/Menu.styles.tsx +68 -150
  50. package/src/Menu/MenuItem.native.tsx +5 -3
  51. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  52. package/src/Menu/MenuItem.styles.tsx +57 -89
  53. package/src/Menu/MenuItem.web.tsx +8 -3
  54. package/src/Popover/Popover.native.tsx +10 -4
  55. package/src/Popover/Popover.styles.old.tsx +135 -0
  56. package/src/Popover/Popover.styles.tsx +51 -112
  57. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  58. package/src/Pressable/Pressable.styles.tsx +35 -27
  59. package/src/Progress/Progress.styles.old.tsx +200 -0
  60. package/src/Progress/Progress.styles.tsx +75 -164
  61. package/src/RadioButton/RadioButton.native.tsx +4 -3
  62. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  63. package/src/RadioButton/RadioButton.styles.tsx +83 -154
  64. package/src/RadioButton/RadioButton.web.tsx +2 -2
  65. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  66. package/src/SVGImage/SVGImage.styles.tsx +35 -78
  67. package/src/Screen/Screen.native.tsx +18 -25
  68. package/src/Screen/Screen.styles.old.tsx +87 -0
  69. package/src/Screen/Screen.styles.tsx +105 -67
  70. package/src/Screen/Screen.web.tsx +1 -1
  71. package/src/Select/Select.native.tsx +42 -33
  72. package/src/Select/Select.styles.old.tsx +353 -0
  73. package/src/Select/Select.styles.tsx +223 -292
  74. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  75. package/src/Skeleton/Skeleton.styles.tsx +29 -53
  76. package/src/Slider/Slider.styles.old.tsx +259 -0
  77. package/src/Slider/Slider.styles.tsx +153 -234
  78. package/src/Switch/Switch.native.tsx +7 -5
  79. package/src/Switch/Switch.styles.old.tsx +203 -0
  80. package/src/Switch/Switch.styles.tsx +101 -174
  81. package/src/Switch/Switch.web.tsx +5 -5
  82. package/src/TabBar/TabBar.native.tsx +3 -2
  83. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  84. package/src/TabBar/TabBar.styles.tsx +145 -279
  85. package/src/Table/Table.native.tsx +18 -9
  86. package/src/Table/Table.styles.old.tsx +311 -0
  87. package/src/Table/Table.styles.tsx +152 -286
  88. package/src/Text/Text.native.tsx +1 -3
  89. package/src/Text/Text.style.demo.tsx +16 -0
  90. package/src/Text/Text.styles.old.tsx +219 -0
  91. package/src/Text/Text.styles.tsx +94 -84
  92. package/src/Text/Text.web.tsx +2 -2
  93. package/src/Text/index.ts +1 -0
  94. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  95. package/src/TextArea/TextArea.styles.tsx +93 -181
  96. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  97. package/src/Tooltip/Tooltip.styles.tsx +32 -56
  98. package/src/Video/Video.styles.old.tsx +51 -0
  99. package/src/Video/Video.styles.tsx +32 -44
  100. package/src/View/View.native.tsx +12 -14
  101. package/src/View/View.styles.old.tsx +125 -0
  102. package/src/View/View.styles.tsx +76 -106
  103. package/src/View/View.web.tsx +1 -0
  104. package/src/examples/CardExamples.tsx +0 -6
  105. package/src/extensions/extendComponent.ts +61 -0
@@ -1,118 +1,86 @@
1
+ /**
2
+ * MenuItem styles using defineStyle with dynamic props.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
7
+
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
5
10
 
6
- type MenuItemDynamicProps = {
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
13
+
14
+ export type MenuItemDynamicProps = {
15
+ size?: Size;
7
16
  intent?: Intent;
17
+ disabled?: boolean;
8
18
  };
9
19
 
10
20
  /**
11
- * Get hover styles for menu item based on intent
21
+ * MenuItem styles with intent/disabled handling.
12
22
  */
13
- function getItemHoverStyles(theme: Theme, intent: Intent) {
14
- if (intent === 'neutral') {
15
- return {
16
- _web: {
17
- _hover: {
18
- backgroundColor: theme.colors.surface.secondary,
19
- },
20
- },
21
- } as const;
22
- }
23
- const intentValue = theme.intents[intent];
24
- return {
25
- _web: {
26
- _hover: {
27
- backgroundColor: intentValue.light,
28
- color: intentValue.primary,
29
- },
30
- },
31
- } as const;
32
- }
23
+ export const menuItemStyles = defineStyle('MenuItem', (theme: Theme) => ({
24
+ item: ({ intent = 'neutral', disabled = false }: MenuItemDynamicProps) => {
25
+ const intentValue = theme.intents[intent];
26
+ const hoverStyles = intent !== 'neutral' ? {
27
+ backgroundColor: intentValue.light,
28
+ color: intentValue.primary,
29
+ } : {
30
+ backgroundColor: theme.colors.surface.secondary,
31
+ };
33
32
 
34
- /**
35
- * Create dynamic item styles
36
- */
37
- function createItemStyles(theme: Theme) {
38
- return ({ intent = 'neutral' }: MenuItemDynamicProps) => {
39
- const hoverStyles = getItemHoverStyles(theme, intent);
40
33
  return {
41
- flexDirection: 'row',
42
- alignItems: 'center',
43
- backgroundColor: 'transparent',
34
+ flexDirection: 'row' as const,
35
+ alignItems: 'center' as const,
36
+ backgroundColor: 'transparent' as const,
44
37
  borderRadius: 4,
45
38
  minHeight: 44,
39
+ opacity: disabled ? 0.5 : 1,
46
40
  variants: {
47
- size: buildSizeVariants(theme, 'menu', (size) => ({
48
- paddingVertical: size.paddingVertical,
49
- paddingHorizontal: size.paddingHorizontal,
50
- })),
51
- disabled: {
52
- true: {
53
- opacity: 0.5,
54
- _web: {
55
- cursor: 'not-allowed',
56
- _hover: {
57
- backgroundColor: 'transparent',
58
- },
59
- },
60
- },
61
- false: {},
41
+ size: {
42
+ paddingVertical: theme.sizes.$menu.paddingVertical,
43
+ paddingHorizontal: theme.sizes.$menu.paddingHorizontal,
62
44
  },
63
45
  },
64
46
  _web: {
65
47
  display: 'flex',
66
48
  width: '100%',
67
- cursor: 'pointer',
49
+ cursor: disabled ? 'not-allowed' : 'pointer',
68
50
  border: 'none',
69
51
  borderWidth: 0,
70
52
  outline: 'none',
71
53
  transition: 'background-color 0.2s ease',
72
54
  textAlign: 'left',
73
- _hover: {
74
- backgroundColor: theme.colors.surface.secondary,
75
- },
55
+ _hover: disabled ? { backgroundColor: 'transparent' } : hoverStyles,
76
56
  },
77
- ...hoverStyles,
78
57
  } as const;
79
- };
80
- }
58
+ },
81
59
 
82
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
83
- export const menuItemStyles = StyleSheet.create((theme: Theme) => {
84
- // Apply extensions to main visual elements
85
- const extended = applyExtensions('MenuItem', theme, {
86
- item: createItemStyles(theme),
87
- });
88
-
89
- return {
90
- ...extended,
91
- // Minor utility styles (not extended)
92
- icon: {
93
- alignItems: 'center',
94
- justifyContent: 'center',
95
- flexShrink: 0,
96
- marginRight: 12,
97
- variants: {
98
- size: buildSizeVariants(theme, 'menu', (size) => ({
99
- width: size.iconSize,
100
- height: size.iconSize,
101
- fontSize: size.iconSize,
102
- }))
103
- },
104
- _web: {
105
- display: 'flex',
60
+ icon: (_props: MenuItemDynamicProps) => ({
61
+ alignItems: 'center' as const,
62
+ justifyContent: 'center' as const,
63
+ flexShrink: 0,
64
+ marginRight: 12,
65
+ variants: {
66
+ size: {
67
+ width: theme.sizes.$menu.iconSize,
68
+ height: theme.sizes.$menu.iconSize,
69
+ fontSize: theme.sizes.$menu.iconSize,
106
70
  },
107
71
  },
108
- label: {
109
- flex: 1,
110
- color: theme.colors.text.primary,
111
- variants: {
112
- size: buildSizeVariants(theme, 'menu', (size) => ({
113
- fontSize: size.labelFontSize,
114
- })),
72
+ _web: {
73
+ display: 'flex',
74
+ },
75
+ }),
76
+
77
+ label: (_props: MenuItemDynamicProps) => ({
78
+ flex: 1,
79
+ color: theme.colors.text.primary,
80
+ variants: {
81
+ size: {
82
+ fontSize: theme.sizes.$menu.labelFontSize,
115
83
  },
116
84
  },
117
- };
118
- });
85
+ }),
86
+ }));
@@ -20,11 +20,14 @@ const MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(({ item, onPress,
20
20
  disabled: Boolean(item.disabled),
21
21
  });
22
22
 
23
- // Compute dynamic item style with intent
23
+ // Compute dynamic styles - call as functions for theme reactivity
24
24
  const itemStyle = (menuItemStyles.item as any)({ intent: item.intent || 'neutral' });
25
+ const iconStyle = (menuItemStyles.icon as any)({});
26
+ const labelStyle = (menuItemStyles.label as any)({});
27
+
25
28
  const itemProps = getWebProps([itemStyle]);
26
- const iconProps = getWebProps([menuItemStyles.icon]);
27
- const labelProps = getWebProps([menuItemStyles.label]);
29
+ const iconProps = getWebProps([iconStyle]);
30
+ const labelProps = getWebProps([labelStyle]);
28
31
 
29
32
  const renderIcon = () => {
30
33
  if (!item.icon) return null;
@@ -32,9 +35,11 @@ const MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(({ item, onPress,
32
35
  if (isIconName(item.icon)) {
33
36
  // Resolve icon name to path and render with IconSvg
34
37
  const iconPath = resolveIconPath(item.icon);
38
+ // IconSvg uses size="1em" by default, sized by container's fontSize from styles
35
39
  return (
36
40
  <IconSvg
37
41
  path={iconPath}
42
+ color="currentColor"
38
43
  aria-label={item.icon}
39
44
  />
40
45
  );
@@ -43,6 +43,12 @@ const Popover = forwardRef<View, PopoverProps>(({
43
43
  // Apply variants
44
44
  popoverStyles.useVariants({});
45
45
 
46
+ // Get dynamic styles - call as functions for theme reactivity
47
+ const backdropStyle = (popoverStyles.backdrop as any)({});
48
+ const containerStyle = (popoverStyles.container as any)({});
49
+ const arrowStyle = (popoverStyles.arrow as any)({});
50
+ const contentStyle = (popoverStyles.content as any)({});
51
+
46
52
  // Determine if anchor is a ref object
47
53
  const anchorRefToUse = React.useMemo(() => {
48
54
  if (!anchor || typeof anchor !== 'object') return null;
@@ -147,19 +153,19 @@ const Popover = forwardRef<View, PopoverProps>(({
147
153
  nativeID={id}
148
154
  >
149
155
  <TouchableWithoutFeedback onPress={handleBackdropPress}>
150
- <View style={popoverStyles.backdrop}>
156
+ <View style={backdropStyle}>
151
157
  <TouchableWithoutFeedback>
152
158
  <BoundedModalContent
153
159
  top={popoverPosition.top}
154
160
  left={popoverPosition.left}
155
161
  width={Math.min(popoverPosition.width || 200, maxPopoverWidth)}
156
162
  maxHeight={500}
157
- style={[(popoverStyles.container as any)({}), style]}
163
+ style={[containerStyle, style]}
158
164
  onLayout={handlePopoverLayout}
159
165
  {...nativeA11yProps}
160
166
  >
161
- {showArrow && <View style={popoverStyles.arrow} />}
162
- <View style={popoverStyles.content}>
167
+ {showArrow && <View style={arrowStyle} />}
168
+ <View style={contentStyle}>
163
169
  {children}
164
170
  </View>
165
171
  </BoundedModalContent>
@@ -0,0 +1,135 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, StylesheetStyles } from '@idealyst/theme';
3
+ import { applyExtensions } from '../extensions/applyExtension';
4
+
5
+ type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
6
+
7
+ type PopoverVariants = {
8
+ placement: PopoverPlacement;
9
+ }
10
+
11
+ export type ExpandedPopoverStyles = StylesheetStyles<keyof PopoverVariants>;
12
+
13
+ export type PopoverStylesheet = {
14
+ container: ExpandedPopoverStyles;
15
+ content: ExpandedPopoverStyles;
16
+ arrow: ExpandedPopoverStyles;
17
+ backdrop: ExpandedPopoverStyles;
18
+ }
19
+
20
+ function createArrowPlacementVariants(theme: Theme) {
21
+ return {
22
+ top: {
23
+ bottom: -6,
24
+ _web: {
25
+ left: '50%',
26
+ marginLeft: -6,
27
+ },
28
+ },
29
+ 'top-start': {
30
+ bottom: -6,
31
+ left: 16,
32
+ },
33
+ 'top-end': {
34
+ bottom: -6,
35
+ right: 16,
36
+ },
37
+ bottom: {
38
+ top: -6,
39
+ _web: {
40
+ left: '50%',
41
+ marginLeft: -6,
42
+ },
43
+ },
44
+ 'bottom-start': {
45
+ top: -6,
46
+ left: 16,
47
+ },
48
+ 'bottom-end': {
49
+ top: -6,
50
+ right: 16,
51
+ },
52
+ left: {
53
+ right: -6,
54
+ _web: {
55
+ top: '50%',
56
+ marginTop: -6,
57
+ },
58
+ },
59
+ 'left-start': {
60
+ right: -6,
61
+ top: 16,
62
+ },
63
+ 'left-end': {
64
+ right: -6,
65
+ bottom: 16,
66
+ },
67
+ right: {
68
+ left: -6,
69
+ _web: {
70
+ top: '50%',
71
+ marginTop: -6,
72
+ },
73
+ },
74
+ 'right-start': {
75
+ left: -6,
76
+ top: 16,
77
+ },
78
+ 'right-end': {
79
+ left: -6,
80
+ bottom: 16,
81
+ },
82
+ };
83
+ }
84
+
85
+ // Style creators for extension support
86
+ function createContainerStyles(theme: Theme) {
87
+ return () => ({
88
+ backgroundColor: theme.colors.surface.primary,
89
+ borderRadius: 8,
90
+ borderWidth: 1,
91
+ borderColor: theme.colors.border.primary,
92
+ borderStyle: 'solid' as const,
93
+ shadowColor: '#000',
94
+ shadowOffset: { width: 0, height: 4 },
95
+ shadowOpacity: 0.1,
96
+ shadowRadius: 12,
97
+ elevation: 8,
98
+ _web: {
99
+ border: `1px solid ${theme.colors.border.primary}`,
100
+ boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
101
+ transition: 'opacity 150ms ease-out, transform 150ms ease-out',
102
+ transformOrigin: 'center center',
103
+ },
104
+ });
105
+ }
106
+
107
+ // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
108
+ // transform on native cannot resolve function calls to extract variant structures.
109
+ export const popoverStyles = StyleSheet.create((theme: Theme) => {
110
+ // Apply extensions to main visual elements
111
+
112
+ return applyExtensions('Popover', theme, {container: createContainerStyles(theme),
113
+ // Additional styles (merged from return)
114
+ // Minor utility styles (not extended)
115
+ content: {
116
+ padding: 16,
117
+ },
118
+ arrow: {
119
+ position: 'absolute',
120
+ width: 12,
121
+ height: 12,
122
+ backgroundColor: theme.colors.surface.primary,
123
+ variants: {
124
+ placement: createArrowPlacementVariants(theme),
125
+ },
126
+ _web: {
127
+ transform: 'rotate(45deg)',
128
+ boxShadow: '-2px 2px 4px rgba(0, 0, 0, 0.1)',
129
+ },
130
+ },
131
+ backdrop: {
132
+ flex: 1,
133
+ backgroundColor: 'transparent',
134
+ }});
135
+ });
@@ -1,90 +1,27 @@
1
+ /**
2
+ * Popover styles using defineStyle.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme } from '@idealyst/theme';
4
7
 
5
- type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
6
-
7
- type PopoverVariants = {
8
- placement: PopoverPlacement;
9
- }
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
10
10
 
11
- export type ExpandedPopoverStyles = StylesheetStyles<keyof PopoverVariants>;
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
12
13
 
13
- export type PopoverStylesheet = {
14
- container: ExpandedPopoverStyles;
15
- content: ExpandedPopoverStyles;
16
- arrow: ExpandedPopoverStyles;
17
- backdrop: ExpandedPopoverStyles;
18
- }
14
+ type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
19
15
 
20
- function createArrowPlacementVariants(theme: Theme) {
21
- return {
22
- top: {
23
- bottom: -6,
24
- _web: {
25
- left: '50%',
26
- marginLeft: -6,
27
- },
28
- },
29
- 'top-start': {
30
- bottom: -6,
31
- left: 16,
32
- },
33
- 'top-end': {
34
- bottom: -6,
35
- right: 16,
36
- },
37
- bottom: {
38
- top: -6,
39
- _web: {
40
- left: '50%',
41
- marginLeft: -6,
42
- },
43
- },
44
- 'bottom-start': {
45
- top: -6,
46
- left: 16,
47
- },
48
- 'bottom-end': {
49
- top: -6,
50
- right: 16,
51
- },
52
- left: {
53
- right: -6,
54
- _web: {
55
- top: '50%',
56
- marginTop: -6,
57
- },
58
- },
59
- 'left-start': {
60
- right: -6,
61
- top: 16,
62
- },
63
- 'left-end': {
64
- right: -6,
65
- bottom: 16,
66
- },
67
- right: {
68
- left: -6,
69
- _web: {
70
- top: '50%',
71
- marginTop: -6,
72
- },
73
- },
74
- 'right-start': {
75
- left: -6,
76
- top: 16,
77
- },
78
- 'right-end': {
79
- left: -6,
80
- bottom: 16,
81
- },
82
- };
83
- }
16
+ export type PopoverDynamicProps = {
17
+ placement?: PopoverPlacement;
18
+ };
84
19
 
85
- // Style creators for extension support
86
- function createContainerStyles(theme: Theme) {
87
- return () => ({
20
+ /**
21
+ * Popover styles with placement variants.
22
+ */
23
+ export const popoverStyles = defineStyle('Popover', (theme: Theme) => ({
24
+ container: (_props: PopoverDynamicProps) => ({
88
25
  backgroundColor: theme.colors.surface.primary,
89
26
  borderRadius: 8,
90
27
  borderWidth: 1,
@@ -101,39 +38,41 @@ function createContainerStyles(theme: Theme) {
101
38
  transition: 'opacity 150ms ease-out, transform 150ms ease-out',
102
39
  transformOrigin: 'center center',
103
40
  },
104
- });
105
- }
41
+ }),
106
42
 
107
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
108
- // transform on native cannot resolve function calls to extract variant structures.
109
- export const popoverStyles = StyleSheet.create((theme: Theme) => {
110
- // Apply extensions to main visual elements
111
- const extended = applyExtensions('Popover', theme, {
112
- container: createContainerStyles(theme),
113
- });
43
+ content: (_props: PopoverDynamicProps) => ({
44
+ padding: 16,
45
+ }),
114
46
 
115
- return {
116
- ...extended,
117
- // Minor utility styles (not extended)
118
- content: {
119
- padding: 16,
120
- },
121
- arrow: {
122
- position: 'absolute',
123
- width: 12,
124
- height: 12,
125
- backgroundColor: theme.colors.surface.primary,
126
- variants: {
127
- placement: createArrowPlacementVariants(theme),
128
- },
129
- _web: {
130
- transform: 'rotate(45deg)',
131
- boxShadow: '-2px 2px 4px rgba(0, 0, 0, 0.1)',
47
+ arrow: (_props: PopoverDynamicProps) => ({
48
+ position: 'absolute' as const,
49
+ width: 12,
50
+ height: 12,
51
+ backgroundColor: theme.colors.surface.primary,
52
+ variants: {
53
+ placement: {
54
+ top: { bottom: -6, _web: { left: '50%', marginLeft: -6 } },
55
+ 'top-start': { bottom: -6, left: 16 },
56
+ 'top-end': { bottom: -6, right: 16 },
57
+ bottom: { top: -6, _web: { left: '50%', marginLeft: -6 } },
58
+ 'bottom-start': { top: -6, left: 16 },
59
+ 'bottom-end': { top: -6, right: 16 },
60
+ left: { right: -6, _web: { top: '50%', marginTop: -6 } },
61
+ 'left-start': { right: -6, top: 16 },
62
+ 'left-end': { right: -6, bottom: 16 },
63
+ right: { left: -6, _web: { top: '50%', marginTop: -6 } },
64
+ 'right-start': { left: -6, top: 16 },
65
+ 'right-end': { left: -6, bottom: 16 },
132
66
  },
133
67
  },
134
- backdrop: {
135
- flex: 1,
136
- backgroundColor: 'transparent',
68
+ _web: {
69
+ transform: 'rotate(45deg)',
70
+ boxShadow: '-2px 2px 4px rgba(0, 0, 0, 0.1)',
137
71
  },
138
- };
139
- });
72
+ }),
73
+
74
+ backdrop: (_props: PopoverDynamicProps) => ({
75
+ flex: 1,
76
+ backgroundColor: 'transparent' as const,
77
+ }),
78
+ }));
@@ -0,0 +1,27 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme } from '@idealyst/theme';
3
+ import {
4
+ buildPaddingVariants,
5
+ buildPaddingVerticalVariants,
6
+ buildPaddingHorizontalVariants,
7
+ } from '../utils/buildViewStyleVariants';
8
+ import { applyExtensions } from '../extensions/applyExtension';
9
+
10
+ // Style creators for extension support
11
+ function createPressableStyles(theme: Theme) {
12
+ return () => ({
13
+ variants: {
14
+ // Spacing variants from PressableSpacingStyleProps
15
+ padding: buildPaddingVariants(theme),
16
+ paddingVertical: buildPaddingVerticalVariants(theme),
17
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
18
+ },
19
+ });
20
+ }
21
+
22
+ export const pressableStyles = StyleSheet.create((theme: Theme) => {
23
+ // Apply extensions to main visual elements
24
+ return applyExtensions('Pressable', theme, {
25
+ pressable: createPressableStyles(theme),
26
+ });
27
+ });
@@ -1,31 +1,39 @@
1
+ /**
2
+ * Pressable styles using defineStyle with $iterator expansion.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme } from '@idealyst/theme';
3
- import {
4
- buildPaddingVariants,
5
- buildPaddingVerticalVariants,
6
- buildPaddingHorizontalVariants,
7
- } from '../utils/buildViewStyleVariants';
8
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme } from '@idealyst/theme';
7
+ import { ViewStyleSize } from '../utils/viewStyleProps';
9
8
 
10
- // Style creators for extension support
11
- function createPressableStyles(theme: Theme) {
12
- return () => ({
13
- variants: {
14
- // Spacing variants from PressableSpacingStyleProps
15
- padding: buildPaddingVariants(theme),
16
- paddingVertical: buildPaddingVerticalVariants(theme),
17
- paddingHorizontal: buildPaddingHorizontalVariants(theme),
18
- },
19
- });
20
- }
9
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
10
+ void StyleSheet;
11
+
12
+ // Wrap theme for $iterator support
13
+ type Theme = ThemeStyleWrapper<BaseTheme>;
21
14
 
22
- export const pressableStyles = StyleSheet.create((theme: Theme) => {
23
- // Apply extensions to main visual elements
24
- const extended = applyExtensions('Pressable', theme, {
25
- pressable: createPressableStyles(theme),
26
- });
15
+ export type PressableDynamicProps = {
16
+ padding?: ViewStyleSize;
17
+ paddingVertical?: ViewStyleSize;
18
+ paddingHorizontal?: ViewStyleSize;
19
+ };
27
20
 
28
- return {
29
- ...extended,
30
- };
31
- });
21
+ /**
22
+ * Pressable styles with spacing variants.
23
+ */
24
+ export const pressableStyles = defineStyle('Pressable', (theme: Theme) => ({
25
+ pressable: (_props: PressableDynamicProps) => ({
26
+ variants: {
27
+ // $iterator expands for each view size
28
+ padding: {
29
+ padding: theme.sizes.$view.padding,
30
+ },
31
+ paddingVertical: {
32
+ paddingVertical: theme.sizes.$view.padding,
33
+ },
34
+ paddingHorizontal: {
35
+ paddingHorizontal: theme.sizes.$view.padding,
36
+ },
37
+ },
38
+ }),
39
+ }));