@idealyst/components 1.1.6 → 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 (144) hide show
  1. package/package.json +8 -3
  2. package/src/Accordion/Accordion.native.tsx +22 -14
  3. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  4. package/src/Accordion/Accordion.styles.tsx +139 -248
  5. package/src/Accordion/Accordion.web.tsx +12 -7
  6. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +43 -62
  9. package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -2
  10. package/src/Alert/Alert.native.tsx +26 -15
  11. package/src/Alert/Alert.styles.old.tsx +209 -0
  12. package/src/Alert/Alert.styles.tsx +108 -281
  13. package/src/Alert/Alert.web.tsx +6 -10
  14. package/src/Avatar/Avatar.native.tsx +5 -2
  15. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  16. package/src/Avatar/Avatar.styles.tsx +47 -62
  17. package/src/Avatar/Avatar.web.tsx +2 -2
  18. package/src/Badge/Badge.native.tsx +2 -2
  19. package/src/Badge/Badge.styles.old.tsx +157 -0
  20. package/src/Badge/Badge.styles.tsx +69 -108
  21. package/src/Badge/Badge.web.tsx +6 -6
  22. package/src/Breadcrumb/Breadcrumb.native.tsx +12 -5
  23. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  24. package/src/Breadcrumb/Breadcrumb.styles.tsx +93 -209
  25. package/src/Breadcrumb/Breadcrumb.web.tsx +39 -27
  26. package/src/Button/Button.native.tsx +39 -14
  27. package/src/Button/Button.styles.tsx +99 -253
  28. package/src/Button/Button.web.tsx +10 -8
  29. package/src/Card/Card.native.tsx +8 -4
  30. package/src/Card/Card.styles.old.tsx +160 -0
  31. package/src/Card/Card.styles.tsx +107 -142
  32. package/src/Card/Card.web.tsx +6 -4
  33. package/src/Checkbox/Checkbox.native.tsx +14 -6
  34. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  35. package/src/Checkbox/Checkbox.styles.tsx +109 -197
  36. package/src/Checkbox/Checkbox.web.tsx +7 -7
  37. package/src/Chip/Chip.native.tsx +5 -5
  38. package/src/Chip/Chip.styles.old.tsx +184 -0
  39. package/src/Chip/Chip.styles.tsx +34 -22
  40. package/src/Chip/Chip.web.tsx +5 -5
  41. package/src/Dialog/Dialog.native.tsx +16 -7
  42. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  43. package/src/Dialog/Dialog.styles.tsx +108 -132
  44. package/src/Dialog/Dialog.web.tsx +4 -4
  45. package/src/Divider/Divider.native.tsx +29 -42
  46. package/src/Divider/Divider.styles.old.tsx +172 -0
  47. package/src/Divider/Divider.styles.tsx +116 -242
  48. package/src/Divider/Divider.web.tsx +17 -14
  49. package/src/Icon/Icon.native.tsx +12 -4
  50. package/src/Icon/Icon.styles.old.tsx +81 -0
  51. package/src/Icon/Icon.styles.tsx +52 -60
  52. package/src/Icon/Icon.web.tsx +43 -7
  53. package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
  54. package/src/Image/Image.styles.old.tsx +69 -0
  55. package/src/Image/Image.styles.tsx +45 -43
  56. package/src/Input/Input.native.tsx +140 -56
  57. package/src/Input/Input.styles.old.tsx +289 -0
  58. package/src/Input/Input.styles.tsx +177 -228
  59. package/src/Input/Input.web.tsx +5 -8
  60. package/src/Link/Link.native.tsx +4 -1
  61. package/src/List/List.native.tsx +5 -2
  62. package/src/List/List.styles.old.tsx +242 -0
  63. package/src/List/List.styles.tsx +178 -240
  64. package/src/List/ListItem.native.tsx +16 -8
  65. package/src/List/ListItem.web.tsx +26 -15
  66. package/src/Menu/Menu.native.tsx +1 -1
  67. package/src/Menu/Menu.styles.old.tsx +197 -0
  68. package/src/Menu/Menu.styles.tsx +90 -156
  69. package/src/Menu/Menu.web.tsx +2 -2
  70. package/src/Menu/MenuItem.native.tsx +9 -5
  71. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  72. package/src/Menu/MenuItem.styles.tsx +71 -104
  73. package/src/Menu/MenuItem.web.tsx +23 -5
  74. package/src/Popover/Popover.native.tsx +10 -4
  75. package/src/Popover/Popover.styles.old.tsx +135 -0
  76. package/src/Popover/Popover.styles.tsx +46 -96
  77. package/src/Popover/Popover.web.tsx +1 -1
  78. package/src/Pressable/Pressable.native.tsx +3 -1
  79. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  80. package/src/Pressable/Pressable.styles.tsx +35 -20
  81. package/src/Pressable/Pressable.web.tsx +1 -1
  82. package/src/Progress/Progress.native.tsx +15 -6
  83. package/src/Progress/Progress.styles.old.tsx +200 -0
  84. package/src/Progress/Progress.styles.tsx +69 -118
  85. package/src/Progress/Progress.web.tsx +10 -9
  86. package/src/RadioButton/RadioButton.native.tsx +10 -4
  87. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  88. package/src/RadioButton/RadioButton.styles.tsx +81 -145
  89. package/src/RadioButton/RadioButton.web.tsx +4 -4
  90. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  91. package/src/SVGImage/SVGImage.styles.tsx +35 -66
  92. package/src/Screen/Screen.native.tsx +30 -27
  93. package/src/Screen/Screen.styles.old.tsx +87 -0
  94. package/src/Screen/Screen.styles.tsx +120 -71
  95. package/src/Screen/Screen.web.tsx +2 -2
  96. package/src/Select/Select.native.tsx +44 -29
  97. package/src/Select/Select.styles.old.tsx +353 -0
  98. package/src/Select/Select.styles.tsx +244 -293
  99. package/src/Select/Select.web.tsx +5 -5
  100. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  101. package/src/Skeleton/Skeleton.styles.tsx +31 -43
  102. package/src/Slider/Slider.native.tsx +9 -5
  103. package/src/Slider/Slider.styles.old.tsx +259 -0
  104. package/src/Slider/Slider.styles.tsx +157 -227
  105. package/src/Slider/Slider.web.tsx +5 -5
  106. package/src/Switch/Switch.native.tsx +11 -5
  107. package/src/Switch/Switch.styles.old.tsx +203 -0
  108. package/src/Switch/Switch.styles.tsx +103 -149
  109. package/src/Switch/Switch.web.tsx +8 -8
  110. package/src/TabBar/TabBar.native.tsx +24 -31
  111. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  112. package/src/TabBar/TabBar.styles.tsx +204 -494
  113. package/src/TabBar/TabBar.web.tsx +21 -33
  114. package/src/Table/Table.native.tsx +18 -9
  115. package/src/Table/Table.styles.old.tsx +311 -0
  116. package/src/Table/Table.styles.tsx +151 -278
  117. package/src/Table/Table.web.tsx +1 -1
  118. package/src/Text/Text.native.tsx +1 -4
  119. package/src/Text/Text.style.demo.tsx +16 -0
  120. package/src/Text/Text.styles.old.tsx +219 -0
  121. package/src/Text/Text.styles.tsx +94 -78
  122. package/src/Text/Text.web.tsx +2 -2
  123. package/src/Text/index.ts +1 -0
  124. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  125. package/src/TextArea/TextArea.styles.tsx +101 -157
  126. package/src/Tooltip/Tooltip.native.tsx +2 -2
  127. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  128. package/src/Tooltip/Tooltip.styles.tsx +38 -53
  129. package/src/Tooltip/Tooltip.web.tsx +2 -2
  130. package/src/Video/Video.styles.old.tsx +51 -0
  131. package/src/Video/Video.styles.tsx +32 -28
  132. package/src/View/View.native.tsx +12 -12
  133. package/src/View/View.styles.old.tsx +125 -0
  134. package/src/View/View.styles.tsx +84 -103
  135. package/src/View/View.web.tsx +14 -2
  136. package/src/examples/CardExamples.tsx +0 -6
  137. package/src/extensions/applyExtension.ts +210 -0
  138. package/src/extensions/extendComponent.ts +438 -0
  139. package/src/extensions/index.ts +102 -0
  140. package/src/extensions/types.ts +497 -0
  141. package/src/globals.ts +16 -0
  142. package/src/index.native.ts +4 -0
  143. package/src/index.ts +28 -0
  144. package/src/utils/deepMerge.ts +54 -2
@@ -0,0 +1,175 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
3
+ import { buildSizeVariants } from '../utils/buildSizeVariants';
4
+ import {
5
+ buildMarginVariants,
6
+ buildMarginVerticalVariants,
7
+ buildMarginHorizontalVariants,
8
+ } from '../utils/buildViewStyleVariants';
9
+ import { applyExtensions } from '../extensions/applyExtension';
10
+
11
+ type RadioButtonSize = Size;
12
+ type RadioButtonIntent = Intent;
13
+ type RadioGroupOrientation = 'horizontal' | 'vertical';
14
+
15
+ type RadioButtonVariants = {
16
+ size: RadioButtonSize;
17
+ intent: RadioButtonIntent;
18
+ checked: boolean;
19
+ disabled: boolean;
20
+ }
21
+
22
+ type RadioGroupVariants = {
23
+ orientation: RadioGroupOrientation;
24
+ }
25
+
26
+ export type ExpandedRadioButtonStyles = StylesheetStyles<keyof RadioButtonVariants>;
27
+ export type ExpandedRadioGroupStyles = StylesheetStyles<keyof RadioGroupVariants>;
28
+
29
+ export type RadioButtonStylesheet = {
30
+ container: ExpandedRadioButtonStyles;
31
+ radio: ExpandedRadioButtonStyles;
32
+ radioDot: ExpandedRadioButtonStyles;
33
+ label: ExpandedRadioButtonStyles;
34
+ groupContainer: ExpandedRadioGroupStyles;
35
+ }
36
+
37
+ function createRadioSizeVariants(theme: Theme) {
38
+ return buildSizeVariants(theme, 'radioButton', (size) => ({
39
+ width: size.radioSize,
40
+ height: size.radioSize,
41
+ }));
42
+ }
43
+
44
+ function createCheckedVariants(theme: Theme, intent: RadioButtonIntent) {
45
+ const intentValue = theme.intents[intent];
46
+ return {
47
+ true: {
48
+ borderColor: intentValue.primary,
49
+ },
50
+ false: {
51
+ borderColor: theme.colors.border.primary,
52
+ },
53
+ } as const;
54
+ }
55
+
56
+ function createRadioDotSizeVariants(theme: Theme) {
57
+ return buildSizeVariants(theme, 'radioButton', (size) => ({
58
+ width: size.radioDotSize,
59
+ height: size.radioDotSize,
60
+ }));
61
+ }
62
+
63
+ function createRadioDotIntentColor(theme: Theme, intent: RadioButtonIntent) {
64
+ return theme.intents[intent].primary;
65
+ }
66
+
67
+ function createRadioStyles(theme: Theme) {
68
+ return ({ intent }: Partial<RadioButtonVariants>) => {
69
+ return {
70
+ borderRadius: 9999,
71
+ borderWidth: 1.5,
72
+ borderStyle: 'solid',
73
+ alignItems: 'center',
74
+ justifyContent: 'center',
75
+ backgroundColor: theme.colors.surface.primary,
76
+ variants: {
77
+ size: createRadioSizeVariants(theme),
78
+ checked: createCheckedVariants(theme, intent),
79
+ disabled: {
80
+ true: {
81
+ opacity: 0.5,
82
+ backgroundColor: theme.colors.surface.tertiary,
83
+ _web: {
84
+ cursor: 'not-allowed',
85
+ },
86
+ },
87
+ false: {
88
+ opacity: 1,
89
+ backgroundColor: theme.colors.surface.primary,
90
+ _web: {
91
+ cursor: 'pointer',
92
+ _hover: {
93
+ opacity: 0.8,
94
+ },
95
+ _active: {
96
+ opacity: 0.6,
97
+ },
98
+ },
99
+ },
100
+ },
101
+ },
102
+ _web: {
103
+ transition: 'all 0.2s ease',
104
+ },
105
+ } as const;
106
+ }
107
+ }
108
+
109
+ function createRadioDotStyles(theme: Theme) {
110
+ return ({ intent }: Partial<RadioButtonVariants>) => {
111
+ return {
112
+ borderRadius: 9999,
113
+ backgroundColor: createRadioDotIntentColor(theme, intent),
114
+ variants: {
115
+ size: createRadioDotSizeVariants(theme),
116
+ },
117
+ } as const;
118
+ }
119
+ }
120
+
121
+ // Container style creator for extension support
122
+ function createContainerStyles(theme: Theme) {
123
+ return () => ({
124
+ flexDirection: 'row' as const,
125
+ alignItems: 'center' as const,
126
+ paddingVertical: 4,
127
+ variants: {
128
+ size: buildSizeVariants(theme, 'radioButton', (size) => ({
129
+ gap: size.gap,
130
+ })),
131
+ margin: buildMarginVariants(theme),
132
+ marginVertical: buildMarginVerticalVariants(theme),
133
+ marginHorizontal: buildMarginHorizontalVariants(theme),
134
+ } as const,
135
+ });
136
+ }
137
+
138
+ // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
139
+ // transform on native cannot resolve function calls to extract variant structures.
140
+ export const radioButtonStyles = StyleSheet.create((theme: Theme) => {
141
+ // Apply extensions to main visual elements
142
+
143
+ return applyExtensions('RadioButton', theme, {container: createContainerStyles(theme),
144
+ radio: createRadioStyles(theme),
145
+ radioDot: createRadioDotStyles(theme),
146
+ // Additional styles (merged from return)
147
+ // Minor utility styles
148
+ label: {
149
+ color: theme.colors.text.primary,
150
+ variants: {
151
+ size: buildSizeVariants(theme, 'radioButton', (size) => ({
152
+ fontSize: size.fontSize,
153
+ })),
154
+ disabled: {
155
+ true: { opacity: 0.5 },
156
+ false: { opacity: 1 },
157
+ },
158
+ },
159
+ },
160
+ groupContainer: {
161
+ gap: 4,
162
+ variants: {
163
+ orientation: {
164
+ horizontal: {
165
+ flexDirection: 'row',
166
+ flexWrap: 'wrap',
167
+ gap: 16,
168
+ },
169
+ vertical: {
170
+ flexDirection: 'column',
171
+ },
172
+ },
173
+ },
174
+ }});
175
+ });
@@ -1,172 +1,108 @@
1
+ /**
2
+ * RadioButton styles using defineStyle with dynamic props.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import {
5
- buildMarginVariants,
6
- buildMarginVerticalVariants,
7
- buildMarginHorizontalVariants,
8
- } from '../utils/buildViewStyleVariants';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
7
+ import { ViewStyleSize } from '../utils/viewStyleProps';
9
8
 
10
- type RadioButtonSize = Size;
11
- type RadioButtonIntent = Intent;
12
- type RadioGroupOrientation = 'horizontal' | 'vertical';
13
-
14
- type RadioButtonVariants = {
15
- size: RadioButtonSize;
16
- intent: RadioButtonIntent;
17
- checked: boolean;
18
- disabled: boolean;
19
- }
9
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
10
+ void StyleSheet;
20
11
 
21
- type RadioGroupVariants = {
22
- orientation: RadioGroupOrientation;
23
- }
12
+ // Wrap theme for $iterator support
13
+ type Theme = ThemeStyleWrapper<BaseTheme>;
24
14
 
25
- export type ExpandedRadioButtonStyles = StylesheetStyles<keyof RadioButtonVariants>;
26
- export type ExpandedRadioGroupStyles = StylesheetStyles<keyof RadioGroupVariants>;
27
-
28
- export type RadioButtonStylesheet = {
29
- container: ExpandedRadioButtonStyles;
30
- radio: ExpandedRadioButtonStyles;
31
- radioDot: ExpandedRadioButtonStyles;
32
- label: ExpandedRadioButtonStyles;
33
- groupContainer: ExpandedRadioGroupStyles;
34
- }
15
+ type RadioGroupOrientation = 'horizontal' | 'vertical';
35
16
 
36
- function createRadioSizeVariants(theme: Theme) {
37
- return buildSizeVariants(theme, 'radioButton', (size) => ({
38
- width: size.radioSize,
39
- height: size.radioSize,
40
- }));
41
- }
17
+ export type RadioButtonDynamicProps = {
18
+ size?: Size;
19
+ intent?: Intent;
20
+ checked?: boolean;
21
+ disabled?: boolean;
22
+ orientation?: RadioGroupOrientation;
23
+ margin?: ViewStyleSize;
24
+ marginVertical?: ViewStyleSize;
25
+ marginHorizontal?: ViewStyleSize;
26
+ };
42
27
 
43
- function createCheckedVariants(theme: Theme, intent: RadioButtonIntent) {
44
- const intentValue = theme.intents[intent];
45
- return {
46
- true: {
47
- borderColor: intentValue.primary,
48
- },
49
- false: {
50
- borderColor: theme.colors.border.primary,
28
+ /**
29
+ * RadioButton styles with intent/checked/disabled handling.
30
+ */
31
+ export const radioButtonStyles = defineStyle('RadioButton', (theme: Theme) => ({
32
+ container: (_props: RadioButtonDynamicProps) => ({
33
+ flexDirection: 'row' as const,
34
+ alignItems: 'center' as const,
35
+ paddingVertical: 4,
36
+ variants: {
37
+ size: {
38
+ gap: theme.sizes.$radioButton.gap,
39
+ },
40
+ margin: {
41
+ margin: theme.sizes.$view.padding,
42
+ },
43
+ marginVertical: {
44
+ marginVertical: theme.sizes.$view.padding,
45
+ },
46
+ marginHorizontal: {
47
+ marginHorizontal: theme.sizes.$view.padding,
48
+ },
51
49
  },
52
- } as const;
53
- }
54
-
55
- function createRadioDotSizeVariants(theme: Theme) {
56
- return buildSizeVariants(theme, 'radioButton', (size) => ({
57
- width: size.radioDotSize,
58
- height: size.radioDotSize,
59
- }));
60
- }
50
+ }),
61
51
 
62
- function createRadioDotIntentColor(theme: Theme, intent: RadioButtonIntent) {
63
- return theme.intents[intent].primary;
64
- }
52
+ radio: ({ intent = 'primary', checked = false, disabled = false }: RadioButtonDynamicProps) => {
53
+ const intentValue = theme.intents[intent];
65
54
 
66
- function createRadioStyles(theme: Theme) {
67
- return ({ intent }: Partial<RadioButtonVariants>) => {
68
55
  return {
69
56
  borderRadius: 9999,
70
57
  borderWidth: 1.5,
71
- borderStyle: 'solid',
72
- alignItems: 'center',
73
- justifyContent: 'center',
74
- backgroundColor: theme.colors.surface.primary,
58
+ borderStyle: 'solid' as const,
59
+ alignItems: 'center' as const,
60
+ justifyContent: 'center' as const,
61
+ backgroundColor: disabled
62
+ ? theme.colors.surface.tertiary
63
+ : theme.colors.surface.primary,
64
+ borderColor: checked ? intentValue.primary : theme.colors.border.primary,
65
+ opacity: disabled ? 0.5 : 1,
75
66
  variants: {
76
- size: createRadioSizeVariants(theme),
77
- checked: createCheckedVariants(theme, intent),
78
- disabled: {
79
- true: {
80
- opacity: 0.5,
81
- backgroundColor: theme.colors.surface.tertiary,
82
- _web: {
83
- cursor: 'not-allowed',
84
- },
85
- },
86
- false: {
87
- opacity: 1,
88
- backgroundColor: theme.colors.surface.primary,
89
- _web: {
90
- cursor: 'pointer',
91
- _hover: {
92
- opacity: 0.8,
93
- },
94
- _active: {
95
- opacity: 0.6,
96
- },
97
- },
98
- },
67
+ size: {
68
+ width: theme.sizes.$radioButton.radioSize,
69
+ height: theme.sizes.$radioButton.radioSize,
99
70
  },
100
71
  },
101
72
  _web: {
102
73
  transition: 'all 0.2s ease',
74
+ cursor: disabled ? 'not-allowed' : 'pointer',
75
+ _hover: disabled ? {} : { opacity: 0.8 },
76
+ _active: disabled ? {} : { opacity: 0.6 },
103
77
  },
104
78
  } as const;
105
- }
106
- }
79
+ },
107
80
 
108
- function createRadioDotStyles(theme: Theme) {
109
- return ({ intent }: Partial<RadioButtonVariants>) => {
110
- return {
111
- borderRadius: 9999,
112
- backgroundColor: createRadioDotIntentColor(theme, intent),
113
- variants: {
114
- size: createRadioDotSizeVariants(theme),
81
+ radioDot: ({ intent = 'primary' }: RadioButtonDynamicProps) => ({
82
+ borderRadius: 9999,
83
+ backgroundColor: theme.intents[intent].primary,
84
+ variants: {
85
+ size: {
86
+ width: theme.sizes.$radioButton.radioDotSize,
87
+ height: theme.sizes.$radioButton.radioDotSize,
115
88
  },
116
- } as const;
117
- }
118
- }
89
+ },
90
+ }),
119
91
 
120
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
121
- // transform on native cannot resolve function calls to extract variant structures.
122
- export const radioButtonStyles = StyleSheet.create((theme: Theme) => {
123
- return {
124
- container: {
125
- flexDirection: 'row',
126
- alignItems: 'center',
127
- paddingVertical: 4,
128
- variants: {
129
- size: buildSizeVariants(theme, 'radioButton', (size) => ({
130
- gap: size.gap,
131
- })),
132
- // Spacing variants from FormInputStyleProps
133
- margin: buildMarginVariants(theme),
134
- marginVertical: buildMarginVerticalVariants(theme),
135
- marginHorizontal: buildMarginHorizontalVariants(theme),
136
- } as const,
137
- },
138
- radio: createRadioStyles(theme),
139
- radioDot: createRadioDotStyles(theme),
140
- label: {
92
+ label: ({ disabled = false }: RadioButtonDynamicProps) => ({
141
93
  color: theme.colors.text.primary,
94
+ opacity: disabled ? 0.5 : 1,
142
95
  variants: {
143
- size: buildSizeVariants(theme, 'radioButton', (size) => ({
144
- fontSize: size.fontSize,
145
- })),
146
- disabled: {
147
- true: {
148
- opacity: 0.5,
149
- },
150
- false: {
151
- opacity: 1,
152
- },
96
+ size: {
97
+ fontSize: theme.sizes.$radioButton.fontSize,
153
98
  },
154
99
  },
155
- },
156
- groupContainer: {
100
+ }),
101
+
102
+ groupContainer: ({ orientation = 'vertical' }: RadioButtonDynamicProps) => ({
157
103
  gap: 4,
158
- variants: {
159
- orientation: {
160
- horizontal: {
161
- flexDirection: 'row',
162
- flexWrap: 'wrap',
163
- gap: 16,
164
- },
165
- vertical: {
166
- flexDirection: 'column',
167
- },
168
- },
169
- },
170
- },
171
- };
172
- });
104
+ flexDirection: orientation === 'horizontal' ? ('row' as const) : ('column' as const),
105
+ flexWrap: orientation === 'horizontal' ? ('wrap' as const) : undefined,
106
+ ...(orientation === 'horizontal' ? { gap: 16 } : {}),
107
+ }),
108
+ }));
@@ -87,10 +87,10 @@ const RadioButton: React.FC<RadioButtonProps> = ({
87
87
  marginHorizontal,
88
88
  });
89
89
 
90
- const containerProps = getWebProps([radioButtonStyles.container, style]);
91
- const radioProps = getWebProps([radioButtonStyles.radio({ intent })]);
92
- const dotProps = getWebProps([radioButtonStyles.radioDot({ intent })]);
93
- const labelProps = getWebProps([radioButtonStyles.label]);
90
+ const containerProps = getWebProps([(radioButtonStyles.container as any)({}), style]);
91
+ const radioProps = getWebProps([(radioButtonStyles.radio as any)({ intent, checked, disabled })]);
92
+ const dotProps = getWebProps([(radioButtonStyles.radioDot as any)({ intent })]);
93
+ const labelProps = getWebProps([(radioButtonStyles.label as any)({ disabled })]);
94
94
 
95
95
  return (
96
96
  <button
@@ -0,0 +1,86 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, StylesheetStyles, Intent} from '@idealyst/theme';
3
+ import { applyExtensions } from '../extensions/applyExtension';
4
+
5
+ type SVGImageIntent = Intent;
6
+
7
+ type SVGImageVariants = {
8
+ intent: SVGImageIntent;
9
+ }
10
+
11
+ export type ExpandedSVGImageStyles = StylesheetStyles<keyof SVGImageVariants>;
12
+
13
+ export type SVGImageStylesheet = {
14
+ container: ExpandedSVGImageStyles;
15
+ image: ExpandedSVGImageStyles;
16
+ }
17
+
18
+ function createContainerIntentVariants(theme: Theme) {
19
+ return {
20
+ primary: {
21
+ filter: `brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)`,
22
+ },
23
+ success: {
24
+ filter: `brightness(0) saturate(100%) invert(64%) sepia(88%) saturate(3323%) hue-rotate(84deg) brightness(119%) contrast(119%)`,
25
+ },
26
+ error: {
27
+ filter: `brightness(0) saturate(100%) invert(23%) sepia(89%) saturate(7395%) hue-rotate(4deg) brightness(102%) contrast(118%)`,
28
+ },
29
+ warning: {
30
+ filter: `brightness(0) saturate(100%) invert(54%) sepia(98%) saturate(4341%) hue-rotate(21deg) brightness(101%) contrast(101%)`,
31
+ },
32
+ neutral: {
33
+ filter: `brightness(0) saturate(100%) invert(52%) sepia(23%) saturate(3207%) hue-rotate(314deg) brightness(99%) contrast(96%)`,
34
+ },
35
+ info: {
36
+ filter: `brightness(0) saturate(100%) invert(58%) sepia(96%) saturate(2582%) hue-rotate(165deg) brightness(99%) contrast(91%)`,
37
+ },
38
+ };
39
+ }
40
+
41
+ function createContainerNativeIntentVariants(theme: Theme) {
42
+ const variants: Record<SVGImageIntent, any> = {} as any;
43
+ for (const intent in theme.intents) {
44
+ variants[intent as SVGImageIntent] = {
45
+ tintColor: theme.intents[intent as SVGImageIntent].primary,
46
+ };
47
+ }
48
+ return variants;
49
+ }
50
+
51
+ // Style creators for extension support
52
+ function createContainerStyles(theme: Theme) {
53
+ return () => ({
54
+ alignItems: 'center' as const,
55
+ justifyContent: 'center' as const,
56
+ variants: {
57
+ intent: createContainerIntentVariants(theme),
58
+ },
59
+ _web: {
60
+ userSelect: 'none',
61
+ },
62
+ _native: {
63
+ variants: {
64
+ intent: createContainerNativeIntentVariants(theme),
65
+ },
66
+ },
67
+ });
68
+ }
69
+
70
+ // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
71
+ // transform on native cannot resolve function calls to extract variant structures.
72
+ // @ts-ignore - TS language server needs restart to pick up theme structure changes
73
+ export const svgImageStyles = StyleSheet.create((theme: Theme) => {
74
+ // Apply extensions to main visual elements
75
+
76
+ return applyExtensions('SVGImage', theme, {container: createContainerStyles(theme),
77
+ // Additional styles (merged from return)
78
+ // Minor utility styles (not extended)
79
+ image: {
80
+ _web: {
81
+ display: 'block',
82
+ maxWidth: '100%',
83
+ height: 'auto',
84
+ },
85
+ }});
86
+ });
@@ -1,78 +1,47 @@
1
+ /**
2
+ * SVGImage styles using defineStyle with dynamic intent handling.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent} from '@idealyst/theme';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent } from '@idealyst/theme';
3
7
 
4
- type SVGImageIntent = Intent;
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
5
10
 
6
- type SVGImageVariants = {
7
- intent: SVGImageIntent;
8
- }
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
9
13
 
10
- export type ExpandedSVGImageStyles = StylesheetStyles<keyof SVGImageVariants>;
14
+ export type SVGImageDynamicProps = {
15
+ intent?: Intent;
16
+ };
11
17
 
12
- export type SVGImageStylesheet = {
13
- container: ExpandedSVGImageStyles;
14
- image: ExpandedSVGImageStyles;
15
- }
16
-
17
- function createContainerIntentVariants(theme: Theme) {
18
- return {
19
- primary: {
20
- filter: `brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)`,
21
- },
22
- success: {
23
- filter: `brightness(0) saturate(100%) invert(64%) sepia(88%) saturate(3323%) hue-rotate(84deg) brightness(119%) contrast(119%)`,
24
- },
25
- error: {
26
- filter: `brightness(0) saturate(100%) invert(23%) sepia(89%) saturate(7395%) hue-rotate(4deg) brightness(102%) contrast(118%)`,
27
- },
28
- warning: {
29
- filter: `brightness(0) saturate(100%) invert(54%) sepia(98%) saturate(4341%) hue-rotate(21deg) brightness(101%) contrast(101%)`,
30
- },
31
- neutral: {
32
- filter: `brightness(0) saturate(100%) invert(52%) sepia(23%) saturate(3207%) hue-rotate(314deg) brightness(99%) contrast(96%)`,
33
- },
34
- info: {
35
- filter: `brightness(0) saturate(100%) invert(58%) sepia(96%) saturate(2582%) hue-rotate(165deg) brightness(99%) contrast(91%)`,
36
- },
37
- };
38
- }
39
-
40
- function createContainerNativeIntentVariants(theme: Theme) {
41
- const variants: Record<SVGImageIntent, any> = {} as any;
42
- for (const intent in theme.intents) {
43
- variants[intent as SVGImageIntent] = {
44
- tintColor: theme.intents[intent as SVGImageIntent].primary,
45
- };
46
- }
47
- return variants;
48
- }
49
-
50
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
51
- // transform on native cannot resolve function calls to extract variant structures.
52
- // @ts-ignore - TS language server needs restart to pick up theme structure changes
53
- export const svgImageStyles = StyleSheet.create((theme: Theme) => {
54
- return {
55
- container: {
56
- alignItems: 'center',
57
- justifyContent: 'center',
58
- variants: {
59
- intent: createContainerIntentVariants(theme),
60
- },
18
+ /**
19
+ * SVGImage styles with intent-based coloring.
20
+ * Uses CSS filters on web and tintColor on native.
21
+ */
22
+ export const svgImageStyles = defineStyle('SVGImage', (theme: Theme) => ({
23
+ container: ({ intent }: SVGImageDynamicProps) => ({
24
+ alignItems: 'center' as const,
25
+ justifyContent: 'center' as const,
26
+ // Native: use tintColor for intent
27
+ ...(intent ? { tintColor: theme.intents[intent].primary } : {}),
61
28
  _web: {
62
29
  userSelect: 'none',
63
- },
64
- _native: {
65
- variants: {
66
- intent: createContainerNativeIntentVariants(theme),
67
- },
68
- },
69
- },
70
- image: {
30
+ // Web: use CSS filters for intent coloring
31
+ ...(intent === 'primary' ? { filter: 'brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)' } : {}),
32
+ ...(intent === 'success' ? { filter: 'brightness(0) saturate(100%) invert(64%) sepia(88%) saturate(3323%) hue-rotate(84deg) brightness(119%) contrast(119%)' } : {}),
33
+ ...(intent === 'error' ? { filter: 'brightness(0) saturate(100%) invert(23%) sepia(89%) saturate(7395%) hue-rotate(4deg) brightness(102%) contrast(118%)' } : {}),
34
+ ...(intent === 'warning' ? { filter: 'brightness(0) saturate(100%) invert(54%) sepia(98%) saturate(4341%) hue-rotate(21deg) brightness(101%) contrast(101%)' } : {}),
35
+ ...(intent === 'neutral' ? { filter: 'brightness(0) saturate(100%) invert(52%) sepia(23%) saturate(3207%) hue-rotate(314deg) brightness(99%) contrast(96%)' } : {}),
36
+ ...(intent === 'info' ? { filter: 'brightness(0) saturate(100%) invert(58%) sepia(96%) saturate(2582%) hue-rotate(165deg) brightness(99%) contrast(91%)' } : {}),
37
+ },
38
+ }),
39
+
40
+ image: (_props: SVGImageDynamicProps) => ({
71
41
  _web: {
72
42
  display: 'block',
73
43
  maxWidth: '100%',
74
44
  height: 'auto',
75
45
  },
76
- },
77
- };
78
- });
46
+ }),
47
+ }));