@idealyst/components 1.1.7 → 1.1.9

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 (129) hide show
  1. package/package.json +3 -3
  2. package/plugin/web.js +280 -532
  3. package/src/Accordion/Accordion.native.tsx +8 -6
  4. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  5. package/src/Accordion/Accordion.styles.tsx +102 -236
  6. package/src/Accordion/Accordion.web.tsx +1 -3
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
  9. package/src/Alert/Alert.native.tsx +16 -6
  10. package/src/Alert/Alert.styles.old.tsx +209 -0
  11. package/src/Alert/Alert.styles.tsx +67 -149
  12. package/src/Alert/Alert.web.tsx +3 -4
  13. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  14. package/src/Avatar/Avatar.styles.tsx +35 -80
  15. package/src/Badge/Badge.styles.old.tsx +157 -0
  16. package/src/Badge/Badge.styles.tsx +61 -121
  17. package/src/Badge/Badge.web.tsx +8 -15
  18. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  19. package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
  20. package/src/Breadcrumb/Breadcrumb.web.tsx +31 -30
  21. package/src/Button/Button.native.tsx +14 -21
  22. package/src/Button/Button.styles.tsx +103 -140
  23. package/src/Button/Button.web.tsx +9 -19
  24. package/src/Card/Card.native.tsx +7 -11
  25. package/src/Card/Card.styles.old.tsx +160 -0
  26. package/src/Card/Card.styles.tsx +105 -142
  27. package/src/Card/Card.web.tsx +5 -4
  28. package/src/Checkbox/Checkbox.native.tsx +9 -5
  29. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  30. package/src/Checkbox/Checkbox.styles.tsx +104 -216
  31. package/src/Checkbox/Checkbox.web.tsx +7 -8
  32. package/src/Chip/Chip.styles.old.tsx +184 -0
  33. package/src/Chip/Chip.styles.tsx +34 -72
  34. package/src/Chip/Chip.web.tsx +3 -5
  35. package/src/Dialog/Dialog.native.tsx +7 -4
  36. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  37. package/src/Dialog/Dialog.styles.tsx +69 -133
  38. package/src/Dialog/Dialog.web.tsx +3 -3
  39. package/src/Dialog/types.ts +1 -1
  40. package/src/Divider/Divider.styles.old.tsx +172 -0
  41. package/src/Divider/Divider.styles.tsx +62 -84
  42. package/src/Icon/Icon.native.tsx +8 -8
  43. package/src/Icon/Icon.styles.old.tsx +81 -0
  44. package/src/Icon/Icon.styles.tsx +52 -66
  45. package/src/Icon/Icon.web.tsx +62 -21
  46. package/src/Icon/IconRegistry.native.ts +41 -0
  47. package/src/Icon/IconRegistry.ts +107 -0
  48. package/src/Icon/IconSvg/IconSvg.web.tsx +28 -5
  49. package/src/Icon/icon-resolver.ts +12 -43
  50. package/src/Icon/index.native.ts +2 -1
  51. package/src/Icon/index.ts +1 -0
  52. package/src/Icon/index.web.ts +1 -0
  53. package/src/Image/Image.styles.old.tsx +69 -0
  54. package/src/Image/Image.styles.tsx +46 -60
  55. package/src/Input/Input.native.tsx +138 -53
  56. package/src/Input/Input.styles.old.tsx +289 -0
  57. package/src/Input/Input.styles.tsx +134 -232
  58. package/src/Input/Input.web.tsx +5 -8
  59. package/src/List/List.native.tsx +5 -2
  60. package/src/List/List.styles.old.tsx +242 -0
  61. package/src/List/List.styles.tsx +179 -215
  62. package/src/List/ListItem.native.tsx +16 -11
  63. package/src/List/ListItem.web.tsx +26 -16
  64. package/src/Menu/Menu.styles.old.tsx +197 -0
  65. package/src/Menu/Menu.styles.tsx +68 -150
  66. package/src/Menu/MenuItem.native.tsx +5 -3
  67. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  68. package/src/Menu/MenuItem.styles.tsx +57 -89
  69. package/src/Menu/MenuItem.web.tsx +10 -7
  70. package/src/Popover/Popover.native.tsx +10 -4
  71. package/src/Popover/Popover.styles.old.tsx +135 -0
  72. package/src/Popover/Popover.styles.tsx +51 -112
  73. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  74. package/src/Pressable/Pressable.styles.tsx +35 -27
  75. package/src/Progress/Progress.styles.old.tsx +200 -0
  76. package/src/Progress/Progress.styles.tsx +75 -164
  77. package/src/RadioButton/RadioButton.native.tsx +4 -3
  78. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  79. package/src/RadioButton/RadioButton.styles.tsx +83 -154
  80. package/src/RadioButton/RadioButton.web.tsx +2 -2
  81. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  82. package/src/SVGImage/SVGImage.styles.tsx +35 -78
  83. package/src/Screen/Screen.native.tsx +19 -26
  84. package/src/Screen/Screen.styles.old.tsx +87 -0
  85. package/src/Screen/Screen.styles.tsx +103 -68
  86. package/src/Screen/Screen.web.tsx +2 -2
  87. package/src/Select/Select.native.tsx +42 -33
  88. package/src/Select/Select.styles.old.tsx +353 -0
  89. package/src/Select/Select.styles.tsx +214 -300
  90. package/src/Select/Select.web.tsx +45 -33
  91. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  92. package/src/Skeleton/Skeleton.styles.tsx +29 -53
  93. package/src/Slider/Slider.styles.old.tsx +259 -0
  94. package/src/Slider/Slider.styles.tsx +153 -234
  95. package/src/Slider/Slider.web.tsx +2 -4
  96. package/src/Switch/Switch.native.tsx +9 -7
  97. package/src/Switch/Switch.styles.old.tsx +203 -0
  98. package/src/Switch/Switch.styles.tsx +101 -174
  99. package/src/Switch/Switch.web.tsx +7 -8
  100. package/src/TabBar/TabBar.native.tsx +3 -2
  101. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  102. package/src/TabBar/TabBar.styles.tsx +145 -279
  103. package/src/Table/Table.native.tsx +180 -68
  104. package/src/Table/Table.styles.old.tsx +311 -0
  105. package/src/Table/Table.styles.tsx +140 -281
  106. package/src/Table/Table.web.tsx +169 -70
  107. package/src/Text/Text.native.tsx +1 -3
  108. package/src/Text/Text.style.demo.tsx +16 -0
  109. package/src/Text/Text.styles.old.tsx +219 -0
  110. package/src/Text/Text.styles.tsx +94 -84
  111. package/src/Text/Text.web.tsx +3 -2
  112. package/src/Text/index.ts +1 -0
  113. package/src/TextArea/TextArea.native.tsx +21 -8
  114. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  115. package/src/TextArea/TextArea.styles.tsx +87 -187
  116. package/src/TextArea/TextArea.web.tsx +17 -6
  117. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  118. package/src/Tooltip/Tooltip.styles.tsx +32 -56
  119. package/src/Video/Video.styles.old.tsx +51 -0
  120. package/src/Video/Video.styles.tsx +32 -44
  121. package/src/View/View.native.tsx +41 -13
  122. package/src/View/View.styles.old.tsx +125 -0
  123. package/src/View/View.styles.tsx +76 -106
  124. package/src/View/View.web.tsx +5 -21
  125. package/src/View/types.ts +31 -3
  126. package/src/examples/ButtonExamples.tsx +20 -0
  127. package/src/examples/CardExamples.tsx +0 -6
  128. package/src/extensions/extendComponent.ts +61 -0
  129. package/src/index.ts +1 -1
@@ -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,179 +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';
9
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
7
+ import { ViewStyleSize } from '../utils/viewStyleProps';
10
8
 
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
- }
9
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
10
+ void StyleSheet;
21
11
 
22
- type RadioGroupVariants = {
23
- orientation: RadioGroupOrientation;
24
- }
12
+ // Wrap theme for $iterator support
13
+ type Theme = ThemeStyleWrapper<BaseTheme>;
25
14
 
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
- }
15
+ type RadioGroupOrientation = 'horizontal' | 'vertical';
36
16
 
37
- function createRadioSizeVariants(theme: Theme) {
38
- return buildSizeVariants(theme, 'radioButton', (size) => ({
39
- width: size.radioSize,
40
- height: size.radioSize,
41
- }));
42
- }
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
+ };
43
27
 
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,
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
+ },
52
49
  },
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
- }
50
+ }),
62
51
 
63
- function createRadioDotIntentColor(theme: Theme, intent: RadioButtonIntent) {
64
- return theme.intents[intent].primary;
65
- }
52
+ radio: ({ intent = 'primary', checked = false, disabled = false }: RadioButtonDynamicProps) => {
53
+ const intentValue = theme.intents[intent];
66
54
 
67
- function createRadioStyles(theme: Theme) {
68
- return ({ intent }: Partial<RadioButtonVariants>) => {
69
55
  return {
70
56
  borderRadius: 9999,
71
57
  borderWidth: 1.5,
72
- borderStyle: 'solid',
73
- alignItems: 'center',
74
- justifyContent: 'center',
75
- 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,
76
66
  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
- },
67
+ size: {
68
+ width: theme.sizes.$radioButton.radioSize,
69
+ height: theme.sizes.$radioButton.radioSize,
100
70
  },
101
71
  },
102
72
  _web: {
103
73
  transition: 'all 0.2s ease',
74
+ cursor: disabled ? 'not-allowed' : 'pointer',
75
+ _hover: disabled ? {} : { opacity: 0.8 },
76
+ _active: disabled ? {} : { opacity: 0.6 },
104
77
  },
105
78
  } 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
- }
79
+ },
120
80
 
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,
81
+ radioDot: ({ intent = 'primary' }: RadioButtonDynamicProps) => ({
82
+ borderRadius: 9999,
83
+ backgroundColor: theme.intents[intent].primary,
127
84
  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
- const extended = applyExtensions('RadioButton', theme, {
143
- container: createContainerStyles(theme),
144
- radio: createRadioStyles(theme),
145
- radioDot: createRadioDotStyles(theme),
146
- });
147
-
148
- return {
149
- ...extended,
150
- // Minor utility styles
151
- label: {
152
- color: theme.colors.text.primary,
153
- variants: {
154
- size: buildSizeVariants(theme, 'radioButton', (size) => ({
155
- fontSize: size.fontSize,
156
- })),
157
- disabled: {
158
- true: { opacity: 0.5 },
159
- false: { opacity: 1 },
160
- },
85
+ size: {
86
+ width: theme.sizes.$radioButton.radioDotSize,
87
+ height: theme.sizes.$radioButton.radioDotSize,
161
88
  },
162
89
  },
163
- groupContainer: {
164
- gap: 4,
165
- variants: {
166
- orientation: {
167
- horizontal: {
168
- flexDirection: 'row',
169
- flexWrap: 'wrap',
170
- gap: 16,
171
- },
172
- vertical: {
173
- flexDirection: 'column',
174
- },
175
- },
90
+ }),
91
+
92
+ label: ({ disabled = false }: RadioButtonDynamicProps) => ({
93
+ color: theme.colors.text.primary,
94
+ opacity: disabled ? 0.5 : 1,
95
+ variants: {
96
+ size: {
97
+ fontSize: theme.sizes.$radioButton.fontSize,
176
98
  },
177
99
  },
178
- };
179
- });
100
+ }),
101
+
102
+ groupContainer: ({ orientation = 'vertical' }: RadioButtonDynamicProps) => ({
103
+ gap: 4,
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
+ }));
@@ -88,9 +88,9 @@ const RadioButton: React.FC<RadioButtonProps> = ({
88
88
  });
89
89
 
90
90
  const containerProps = getWebProps([(radioButtonStyles.container as any)({}), style]);
91
- const radioProps = getWebProps([(radioButtonStyles.radio as any)({ intent })]);
91
+ const radioProps = getWebProps([(radioButtonStyles.radio as any)({ intent, checked, disabled })]);
92
92
  const dotProps = getWebProps([(radioButtonStyles.radioDot as any)({ intent })]);
93
- const labelProps = getWebProps([radioButtonStyles.label]);
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,90 +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';
3
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent } from '@idealyst/theme';
4
7
 
5
- type SVGImageIntent = Intent;
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
6
10
 
7
- type SVGImageVariants = {
8
- intent: SVGImageIntent;
9
- }
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
10
13
 
11
- export type ExpandedSVGImageStyles = StylesheetStyles<keyof SVGImageVariants>;
14
+ export type SVGImageDynamicProps = {
15
+ intent?: Intent;
16
+ };
12
17
 
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 () => ({
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) => ({
54
24
  alignItems: 'center' as const,
55
25
  justifyContent: 'center' as const,
56
- variants: {
57
- intent: createContainerIntentVariants(theme),
58
- },
26
+ // Native: use tintColor for intent
27
+ ...(intent ? { tintColor: theme.intents[intent].primary } : {}),
59
28
  _web: {
60
29
  userSelect: 'none',
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%)' } : {}),
61
37
  },
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
- const extended = applyExtensions('SVGImage', theme, {
76
- container: createContainerStyles(theme),
77
- });
38
+ }),
78
39
 
79
- return {
80
- ...extended,
81
- // Minor utility styles (not extended)
82
- image: {
83
- _web: {
84
- display: 'block',
85
- maxWidth: '100%',
86
- height: 'auto',
87
- },
40
+ image: (_props: SVGImageDynamicProps) => ({
41
+ _web: {
42
+ display: 'block',
43
+ maxWidth: '100%',
44
+ height: 'auto',
88
45
  },
89
- };
90
- });
46
+ }),
47
+ }));