@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
@@ -133,20 +133,20 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(({
133
133
  });
134
134
 
135
135
  const backdropProps = getWebProps([
136
- dialogStyles.backdrop,
136
+ (dialogStyles.backdrop as any)({}),
137
137
  { opacity: isVisible ? 1 : 0 }
138
138
  ]);
139
139
  const containerProps = getWebProps([
140
- dialogStyles.container,
140
+ (dialogStyles.container as any)({}),
141
141
  style as any,
142
142
  isVisible
143
143
  ? { opacity: 1, transform: 'scale(1) translateY(0px)' }
144
144
  : { opacity: 0, transform: 'scale(0.96) translateY(-4px)' }
145
145
  ]);
146
- const headerProps = getWebProps([dialogStyles.header]);
146
+ const headerProps = getWebProps([(dialogStyles.header as any)({})]);
147
147
  const titleProps = getWebProps([dialogStyles.title]);
148
148
  const closeButtonProps = getWebProps([dialogStyles.closeButton]);
149
- const contentProps = getWebProps([dialogStyles.content]);
149
+ const contentProps = getWebProps([(dialogStyles.content as any)({})]);
150
150
 
151
151
  const mergedBackdropRef = useMergeRefs(ref, backdropProps.ref);
152
152
 
@@ -16,21 +16,30 @@ const Divider = forwardRef<View, DividerProps>(({
16
16
  accessibilityLabel,
17
17
  id,
18
18
  }, ref) => {
19
- // Apply variants for main divider
19
+ // Apply variants for container, content (orientation, spacing)
20
20
  dividerStyles.useVariants({
21
+ orientation,
22
+ spacing,
23
+ length: typeof length === 'number' ? 'auto' : length,
24
+ });
25
+
26
+ // Get dynamic divider style
27
+ const dividerStyle = (dividerStyles.divider as any)({
21
28
  orientation,
22
29
  thickness,
23
- type: type as any,
30
+ type,
24
31
  intent,
25
- length: typeof length === 'number' ? 'auto' : length,
26
32
  spacing,
27
33
  });
28
34
 
29
- // Get the current styles for color and dimensions
30
- const dividerStyle = dividerStyles.divider;
31
-
32
- // Get thickness value
33
- const getThickness = () => {
35
+ // Get dynamic line style
36
+ const lineStyle = (dividerStyles.line as any)({
37
+ orientation,
38
+ thickness,
39
+ });
40
+
41
+ // Get thickness value for dashed/dotted border handling on native
42
+ const getThicknessValue = () => {
34
43
  switch (thickness) {
35
44
  case 'thin': return 1;
36
45
  case 'md': return 2;
@@ -39,11 +48,11 @@ const Divider = forwardRef<View, DividerProps>(({
39
48
  }
40
49
  };
41
50
 
42
- // For dashed/dotted variants, use border instead of background
43
- const getDashedStyle = () => {
51
+ // For dashed/dotted variants on native, we need to use border instead of background
52
+ const getNativeDashedStyle = () => {
44
53
  if (type === 'dashed' || type === 'dotted') {
45
- const actualThickness = getThickness();
46
-
54
+ const actualThickness = getThicknessValue();
55
+
47
56
  return {
48
57
  backgroundColor: 'transparent',
49
58
  borderStyle: type,
@@ -53,15 +62,11 @@ const Divider = forwardRef<View, DividerProps>(({
53
62
  borderBottomWidth: 0,
54
63
  borderLeftWidth: 0,
55
64
  borderRightWidth: 0,
56
- width: '100%',
57
- height: actualThickness,
58
65
  } : {
59
66
  borderLeftWidth: actualThickness,
60
67
  borderTopWidth: 0,
61
68
  borderBottomWidth: 0,
62
69
  borderRightWidth: 0,
63
- height: '100%',
64
- width: actualThickness,
65
70
  }),
66
71
  };
67
72
  }
@@ -70,66 +75,48 @@ const Divider = forwardRef<View, DividerProps>(({
70
75
 
71
76
  // If no children, render simple divider
72
77
  if (!children) {
73
- if (type === 'dashed' || type === 'dotted') {
74
- return (
75
- <View
76
- ref={ref}
77
- nativeID={id}
78
- style={[
79
- dividerStyle,
80
- getDashedStyle(),
81
- style,
82
- ]}
83
- testID={testID}
84
- accessibilityLabel={accessibilityLabel || "divider"}
85
- />
86
- );
87
- }
88
-
89
78
  return (
90
79
  <View
91
80
  ref={ref}
92
81
  nativeID={id}
93
- style={[dividerStyles.divider, style]}
82
+ style={[dividerStyle, getNativeDashedStyle(), style]}
94
83
  testID={testID}
95
84
  accessibilityLabel={accessibilityLabel || "divider"}
96
85
  />
97
86
  );
98
87
  }
99
88
 
100
- // For lines with content, create a simple dashed line
89
+ // For lines with content, create line segments
101
90
  const renderLineSegment = () => {
102
91
  if (type === 'dashed' || type === 'dotted') {
103
- const actualThickness = getThickness();
104
-
92
+ const actualThickness = getThicknessValue();
93
+
105
94
  return (
106
95
  <View
107
96
  style={[
108
- dividerStyles.line,
97
+ lineStyle,
109
98
  {
110
99
  backgroundColor: 'transparent',
111
100
  borderStyle: type,
112
- borderColor: dividerStyles.line.backgroundColor,
101
+ borderColor: lineStyle.backgroundColor,
113
102
  ...(orientation === 'horizontal' ? {
114
103
  borderTopWidth: actualThickness,
115
104
  borderBottomWidth: 0,
116
105
  borderLeftWidth: 0,
117
106
  borderRightWidth: 0,
118
- height: actualThickness,
119
107
  } : {
120
108
  borderLeftWidth: actualThickness,
121
109
  borderTopWidth: 0,
122
110
  borderBottomWidth: 0,
123
111
  borderRightWidth: 0,
124
- width: actualThickness,
125
112
  }),
126
113
  },
127
114
  ]}
128
115
  />
129
116
  );
130
117
  }
131
-
132
- return <View style={dividerStyles.line} />;
118
+
119
+ return <View style={lineStyle} />;
133
120
  };
134
121
 
135
122
  return (
@@ -0,0 +1,172 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, Intent } from '@idealyst/theme';
3
+ import { applyExtensions } from '../extensions/applyExtension';
4
+
5
+ type DividerOrientation = 'horizontal' | 'vertical';
6
+ type DividerThickness = 'thin' | 'md' | 'thick';
7
+ type DividerType = 'solid' | 'dashed' | 'dotted';
8
+ type DividerIntent = Intent | 'secondary' | 'neutral' | 'info';
9
+ type DividerLength = 'full' | 'auto';
10
+ type DividerSpacing = 'none' | 'sm' | 'md' | 'lg';
11
+
12
+ type DividerDynamicProps = {
13
+ orientation?: DividerOrientation;
14
+ thickness?: DividerThickness;
15
+ type?: DividerType;
16
+ intent?: DividerIntent;
17
+ spacing?: DividerSpacing;
18
+ };
19
+
20
+ type LineDynamicProps = {
21
+ orientation?: DividerOrientation;
22
+ thickness?: DividerThickness;
23
+ };
24
+
25
+ function getIntentColor(theme: Theme, intent: DividerIntent): string {
26
+ if (intent === 'secondary') return theme.colors.border.primary;
27
+ if (intent === 'neutral') return theme.colors.border.secondary;
28
+ if (intent === 'info') return theme.intents.primary.primary;
29
+ return theme.intents[intent as Intent].primary;
30
+ }
31
+
32
+ function getThicknessValue(thickness: DividerThickness): number {
33
+ switch (thickness) {
34
+ case 'thin': return 1;
35
+ case 'md': return 2;
36
+ case 'thick': return 4;
37
+ default: return 1;
38
+ }
39
+ }
40
+
41
+ function getSpacingValue(spacing: DividerSpacing): number {
42
+ switch (spacing) {
43
+ case 'none': return 0;
44
+ case 'sm': return 8;
45
+ case 'md': return 16;
46
+ case 'lg': return 24;
47
+ default: return 0;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Create dynamic divider styles
53
+ */
54
+ function createDividerStyles(theme: Theme) {
55
+ return ({
56
+ orientation = 'horizontal',
57
+ thickness = 'thin',
58
+ type = 'solid',
59
+ intent = 'neutral',
60
+ spacing = 'md'
61
+ }: DividerDynamicProps) => {
62
+ const color = getIntentColor(theme, intent);
63
+ const thicknessValue = getThicknessValue(thickness);
64
+ const spacingValue = getSpacingValue(spacing);
65
+
66
+ const isHorizontal = orientation === 'horizontal';
67
+ const isDashedOrDotted = type === 'dashed' || type === 'dotted';
68
+
69
+ // Base dimension styles based on orientation and thickness
70
+ const dimensionStyles = isHorizontal
71
+ ? { width: '100%', height: thicknessValue, flexDirection: 'row' as const }
72
+ : { width: thicknessValue, height: '100%', flexDirection: 'column' as const };
73
+
74
+ // Spacing styles based on orientation
75
+ const spacingStyles = isHorizontal
76
+ ? { marginVertical: spacingValue }
77
+ : { marginHorizontal: spacingValue };
78
+
79
+ // Web-specific border styles for dashed/dotted
80
+ const webBorderStyles = isDashedOrDotted ? {
81
+ border: 'none',
82
+ backgroundColor: 'transparent',
83
+ ...(isHorizontal
84
+ ? { borderTop: `${thicknessValue}px ${type} ${color}` }
85
+ : { borderLeft: `${thicknessValue}px ${type} ${color}` }
86
+ ),
87
+ } : {};
88
+
89
+ return {
90
+ backgroundColor: isDashedOrDotted ? 'transparent' : color,
91
+ ...dimensionStyles,
92
+ ...spacingStyles,
93
+ variants: {
94
+ length: {
95
+ full: {},
96
+ auto: {},
97
+ },
98
+ },
99
+ _web: webBorderStyles,
100
+ } as const;
101
+ };
102
+ }
103
+
104
+ /**
105
+ * Create dynamic line styles (for dividers with content)
106
+ */
107
+ function createLineStyles(theme: Theme) {
108
+ return ({ orientation = 'horizontal', thickness = 'thin' }: LineDynamicProps) => {
109
+ const thicknessValue = getThicknessValue(thickness);
110
+ const isHorizontal = orientation === 'horizontal';
111
+
112
+ return {
113
+ backgroundColor: theme.colors.border.secondary,
114
+ flex: 1,
115
+ ...(isHorizontal
116
+ ? { height: thicknessValue }
117
+ : { width: thicknessValue }
118
+ ),
119
+ } as const;
120
+ };
121
+ }
122
+
123
+ // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
124
+ // transform on native cannot resolve function calls to extract variant structures.
125
+ export const dividerStyles = StyleSheet.create((theme: Theme) => {
126
+ // Apply extensions to main visual elements
127
+
128
+ return applyExtensions('Divider', theme, {divider: createDividerStyles(theme),
129
+ // Additional styles (merged from return)
130
+ // Minor utility styles (not extended)
131
+ container: {
132
+ alignItems: 'center',
133
+ justifyContent: 'center',
134
+ display: 'flex',
135
+ variants: {
136
+ orientation: {
137
+ horizontal: {
138
+ flexDirection: 'row',
139
+ width: '100%',
140
+ },
141
+ vertical: {
142
+ flexDirection: 'column',
143
+ height: '100%',
144
+ },
145
+ },
146
+ spacing: {
147
+ none: { gap: 0 },
148
+ xs: { gap: 4 },
149
+ sm: { gap: 8 },
150
+ md: { gap: 16 },
151
+ lg: { gap: 24 },
152
+ xl: { gap: 32 },
153
+ },
154
+ },
155
+ },
156
+ content: {
157
+ backgroundColor: theme.colors.surface.primary,
158
+ color: theme.colors.text.secondary,
159
+ fontSize: 14,
160
+ variants: {
161
+ orientation: {
162
+ horizontal: {
163
+ paddingHorizontal: 8,
164
+ },
165
+ vertical: {
166
+ paddingVertical: 8,
167
+ },
168
+ },
169
+ },
170
+ },
171
+ line: createLineStyles(theme)});
172
+ });