@idealyst/components 1.0.99 → 1.1.0

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 (106) hide show
  1. package/package.json +4 -4
  2. package/src/Accordion/Accordion.native.tsx +15 -0
  3. package/src/Accordion/Accordion.styles.tsx +17 -0
  4. package/src/Accordion/Accordion.web.tsx +15 -0
  5. package/src/Accordion/types.ts +2 -1
  6. package/src/Button/Button.native.tsx +55 -2
  7. package/src/Button/Button.styles.tsx +22 -0
  8. package/src/Button/Button.web.tsx +6 -2
  9. package/src/Button/types.ts +15 -0
  10. package/src/Card/Card.native.tsx +18 -5
  11. package/src/Card/Card.styles.tsx +123 -131
  12. package/src/Card/Card.web.tsx +17 -4
  13. package/src/Card/types.ts +3 -8
  14. package/src/Checkbox/Checkbox.native.tsx +7 -0
  15. package/src/Checkbox/Checkbox.styles.tsx +11 -0
  16. package/src/Checkbox/Checkbox.web.tsx +7 -0
  17. package/src/Checkbox/types.ts +2 -1
  18. package/src/Input/Input.native.tsx +7 -0
  19. package/src/Input/Input.styles.tsx +9 -0
  20. package/src/Input/Input.web.tsx +7 -0
  21. package/src/Input/types.ts +2 -1
  22. package/src/List/List.native.tsx +15 -0
  23. package/src/List/List.styles.tsx +17 -0
  24. package/src/List/List.web.tsx +15 -0
  25. package/src/List/types.ts +2 -1
  26. package/src/Pressable/Pressable.native.tsx +13 -1
  27. package/src/Pressable/Pressable.styles.tsx +24 -0
  28. package/src/Pressable/Pressable.web.tsx +24 -6
  29. package/src/Pressable/types.ts +3 -2
  30. package/src/RadioButton/RadioButton.native.tsx +7 -0
  31. package/src/RadioButton/RadioButton.styles.tsx +9 -0
  32. package/src/RadioButton/RadioButton.web.tsx +7 -0
  33. package/src/RadioButton/types.ts +2 -1
  34. package/src/Screen/Screen.native.tsx +25 -12
  35. package/src/Screen/Screen.styles.tsx +28 -16
  36. package/src/Screen/Screen.web.tsx +16 -3
  37. package/src/Screen/types.ts +4 -8
  38. package/src/Select/Select.native.tsx +7 -0
  39. package/src/Select/Select.styles.tsx +11 -0
  40. package/src/Select/Select.web.tsx +7 -0
  41. package/src/Select/types.ts +2 -1
  42. package/src/Slider/Slider.native.tsx +7 -0
  43. package/src/Slider/Slider.styles.tsx +11 -0
  44. package/src/Slider/Slider.web.tsx +7 -0
  45. package/src/Slider/types.ts +2 -1
  46. package/src/Switch/Switch.native.tsx +7 -0
  47. package/src/Switch/Switch.styles.tsx +11 -0
  48. package/src/Switch/Switch.web.tsx +7 -0
  49. package/src/Switch/types.ts +2 -1
  50. package/src/TabBar/TabBar.native.tsx +19 -1
  51. package/src/TabBar/TabBar.styles.tsx +17 -0
  52. package/src/TabBar/TabBar.web.tsx +20 -1
  53. package/src/TabBar/types.ts +2 -1
  54. package/src/Table/Table.native.tsx +15 -0
  55. package/src/Table/Table.styles.tsx +27 -0
  56. package/src/Table/Table.web.tsx +15 -0
  57. package/src/Table/types.ts +2 -1
  58. package/src/Text/Text.native.tsx +14 -3
  59. package/src/Text/Text.styles.tsx +36 -12
  60. package/src/Text/Text.web.tsx +15 -4
  61. package/src/Text/types.ts +15 -4
  62. package/src/TextArea/TextArea.native.tsx +7 -0
  63. package/src/TextArea/TextArea.styles.tsx +11 -0
  64. package/src/TextArea/TextArea.web.tsx +7 -0
  65. package/src/TextArea/types.ts +2 -1
  66. package/src/View/View.native.tsx +35 -12
  67. package/src/View/View.styles.tsx +78 -75
  68. package/src/View/View.web.tsx +18 -9
  69. package/src/View/types.ts +8 -23
  70. package/src/examples/AccordionExamples.tsx +32 -32
  71. package/src/examples/AlertExamples.tsx +42 -42
  72. package/src/examples/AvatarExamples.tsx +18 -18
  73. package/src/examples/BadgeExamples.tsx +30 -30
  74. package/src/examples/BreadcrumbExamples.tsx +64 -64
  75. package/src/examples/ButtonExamples.tsx +128 -16
  76. package/src/examples/CardExamples.tsx +28 -28
  77. package/src/examples/CheckboxExamples.tsx +25 -25
  78. package/src/examples/ChipExamples.tsx +17 -17
  79. package/src/examples/DialogExamples.tsx +17 -17
  80. package/src/examples/DividerExamples.tsx +21 -21
  81. package/src/examples/IconExamples.tsx +113 -113
  82. package/src/examples/ImageExamples.tsx +34 -34
  83. package/src/examples/InputExamples.tsx +20 -20
  84. package/src/examples/LinkExamples.tsx +23 -23
  85. package/src/examples/ListExamples.tsx +42 -42
  86. package/src/examples/MenuExamples.tsx +15 -15
  87. package/src/examples/PopoverExamples.tsx +23 -23
  88. package/src/examples/ProgressExamples.tsx +41 -41
  89. package/src/examples/RadioButtonExamples.tsx +21 -21
  90. package/src/examples/SVGImageExamples.tsx +25 -25
  91. package/src/examples/ScreenExamples.tsx +41 -41
  92. package/src/examples/SelectExamples.tsx +59 -59
  93. package/src/examples/SkeletonExamples.tsx +30 -30
  94. package/src/examples/SliderExamples.tsx +54 -54
  95. package/src/examples/SwitchExamples.tsx +20 -20
  96. package/src/examples/TabBarExamples.tsx +26 -26
  97. package/src/examples/TableExamples.tsx +36 -36
  98. package/src/examples/TextAreaExamples.tsx +25 -25
  99. package/src/examples/TextExamples.tsx +61 -66
  100. package/src/examples/ThemeExtensionExamples.tsx +12 -12
  101. package/src/examples/TooltipExamples.tsx +21 -21
  102. package/src/examples/VideoExamples.tsx +28 -28
  103. package/src/examples/ViewExamples.tsx +59 -59
  104. package/src/index.ts +4 -0
  105. package/src/utils/buildViewStyleVariants.ts +148 -0
  106. package/src/utils/viewStyleProps.ts +63 -0
@@ -5,24 +5,35 @@ import { textStyles } from './Text.styles';
5
5
 
6
6
  const Text = forwardRef<RNText, TextProps>(({
7
7
  children,
8
+ typography,
8
9
  size = 'md',
9
10
  weight = 'normal',
10
11
  color,
11
12
  align = 'left',
13
+ // Spacing variants from TextSpacingStyleProps
14
+ gap,
15
+ padding,
16
+ paddingVertical,
17
+ paddingHorizontal,
12
18
  style,
13
19
  testID,
14
20
  }, ref) => {
21
+ // When typography is set, it overrides size and weight (handled in styles)
15
22
  textStyles.useVariants({
16
- size,
17
- weight,
23
+ size: typography ? 'md' : size, // Use default when typography is set (will be overridden)
24
+ weight: typography ? 'normal' : weight, // Use default when typography is set (will be overridden)
18
25
  align,
26
+ gap,
27
+ padding,
28
+ paddingVertical,
29
+ paddingHorizontal,
19
30
  });
20
31
 
21
32
  return (
22
33
  <RNText
23
34
  ref={ref}
24
35
  style={[
25
- textStyles.text({ color }),
36
+ textStyles.text({ color, typography }),
26
37
  style,
27
38
  ]}
28
39
  testID={testID}
@@ -1,21 +1,23 @@
1
1
  import { StyleSheet } from "react-native-unistyles";
2
- import { Theme, StylesheetStyles, Styles, DynamicStyles } from '@idealyst/theme';
2
+ import { Theme } from '@idealyst/theme';
3
3
  import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import { TextAlignVariant, TextColorVariant, TextSizeVariant, TextWeightVariant } from "./types";
4
+ import {
5
+ buildGapVariants,
6
+ buildPaddingVariants,
7
+ buildPaddingVerticalVariants,
8
+ buildPaddingHorizontalVariants,
9
+ } from '../utils/buildViewStyleVariants';
10
+ import { TextAlignVariant, TextColorVariant, TextSizeVariant, TextWeightVariant, TextTypographyVariant } from "./types";
5
11
 
6
12
  type TextVariants = {
7
13
  size: TextSizeVariant;
8
14
  weight: TextWeightVariant;
9
15
  align: TextAlignVariant;
10
- color: TextColorVariant;
11
- }
12
-
13
- export type TextStylesheet = {
14
- text: DynamicStyles<keyof TextVariants>;
15
16
  }
16
17
 
17
18
  /**
18
- * Create size variants for text
19
+ * Create size variants for text (legacy)
20
+ * @deprecated Use typography prop instead
19
21
  */
20
22
  function createSizeVariants(theme: Theme): any {
21
23
  return buildSizeVariants(theme, 'text', (size) => ({
@@ -24,10 +26,17 @@ function createSizeVariants(theme: Theme): any {
24
26
  }));
25
27
  }
26
28
 
29
+ type TextStyleParams = {
30
+ color?: TextColorVariant;
31
+ typography?: TextTypographyVariant;
32
+ }
33
+
27
34
  function createTextStyles(theme: Theme) {
28
- return ({ color }: Partial<TextVariants>) => {
35
+ return ({ color, typography }: TextStyleParams) => {
29
36
  const colorValue = theme.colors.text[color] || theme.colors.text.primary;
30
- return {
37
+
38
+ // Base styles
39
+ const baseStyles: any = {
31
40
  margin: 0,
32
41
  padding: 0,
33
42
  color: colorValue,
@@ -61,12 +70,27 @@ function createTextStyles(theme: Theme) {
61
70
  textAlign: 'right',
62
71
  },
63
72
  } as const,
73
+ // Spacing variants from TextSpacingStyleProps
74
+ gap: buildGapVariants(theme),
75
+ padding: buildPaddingVariants(theme),
76
+ paddingVertical: buildPaddingVerticalVariants(theme),
77
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
64
78
  } as const,
65
79
  _web: {
66
80
  fontFamily: 'inherit',
67
81
  lineHeight: 'inherit',
68
82
  },
69
- } as const;
83
+ };
84
+
85
+ // If typography is set, apply typography styles (overrides size/weight variants)
86
+ if (typography && theme.sizes.typography[typography]) {
87
+ const typo = theme.sizes.typography[typography];
88
+ baseStyles.fontSize = typo.fontSize;
89
+ baseStyles.lineHeight = typo.lineHeight;
90
+ baseStyles.fontWeight = typo.fontWeight;
91
+ }
92
+
93
+ return baseStyles;
70
94
  }
71
95
  }
72
96
 
@@ -75,5 +99,5 @@ function createTextStyles(theme: Theme) {
75
99
  export const textStyles = StyleSheet.create((theme: Theme) => {
76
100
  return {
77
101
  text: createTextStyles(theme),
78
- } as TextStylesheet;
102
+ };
79
103
  });
@@ -6,22 +6,33 @@ import useMergeRefs from '../hooks/useMergeRefs';
6
6
 
7
7
  const Text = forwardRef<HTMLSpanElement, TextProps>(({
8
8
  children,
9
+ typography,
9
10
  size = 'md',
10
11
  weight = 'normal',
11
12
  color = 'primary',
12
13
  align = 'left',
14
+ // Spacing variants from TextSpacingStyleProps
15
+ gap,
16
+ padding,
17
+ paddingVertical,
18
+ paddingHorizontal,
13
19
  style,
14
20
  testID,
15
21
  }, ref) => {
22
+ // When typography is set, it overrides size and weight (handled in styles)
16
23
  textStyles.useVariants({
17
- size,
18
- weight,
24
+ size: typography ? 'md' : size, // Use default when typography is set (will be overridden)
25
+ weight: typography ? 'normal' : weight, // Use default when typography is set (will be overridden)
19
26
  align,
27
+ gap,
28
+ padding,
29
+ paddingVertical,
30
+ paddingHorizontal,
20
31
  });
21
32
 
22
- // Create the style array following the official documentation pattern
33
+ // Create the style array - pass typography to dynamic style function
23
34
  const textStyleArray = [
24
- textStyles.text({ color }),
35
+ textStyles.text({ color, typography }),
25
36
  style,
26
37
  ];
27
38
 
package/src/Text/types.ts CHANGED
@@ -1,26 +1,37 @@
1
- import { Text } from '@idealyst/theme';
1
+ import { Text, Typography } from '@idealyst/theme';
2
2
  import type { ReactNode } from 'react';
3
3
  import type { StyleProp, TextStyle } from 'react-native';
4
+ import { TextSpacingStyleProps } from '../utils/viewStyleProps';
4
5
 
5
6
  // Component-specific type aliases for future extensibility
6
7
  export type TextColorVariant = Text;
7
8
  export type TextSizeVariant = 'sm' | 'md' | 'lg' | 'xl'; // Using sm/md/lg/xl for consistency
8
9
  export type TextWeightVariant = 'light' | 'normal' | 'medium' | 'semibold' | 'bold';
9
10
  export type TextAlignVariant = 'left' | 'center' | 'right';
11
+ export type TextTypographyVariant = Typography;
10
12
 
11
- export interface TextProps {
13
+ export interface TextProps extends TextSpacingStyleProps {
12
14
  /**
13
15
  * The text content to display
14
16
  */
15
17
  children: ReactNode;
16
18
 
19
+ /**
20
+ * Typography variant for semantic text styling.
21
+ * Automatically sets fontSize, lineHeight, and fontWeight.
22
+ * When set, overrides size and weight props.
23
+ */
24
+ typography?: TextTypographyVariant;
25
+
17
26
  /**
18
27
  * The size variant of the text
28
+ * @deprecated Use `typography` prop instead for semantic text styling (e.g., 'h1', 'body1', 'caption')
19
29
  */
20
30
  size?: TextSizeVariant;
21
31
 
22
32
  /**
23
- * The weight of the text
33
+ * The weight of the text.
34
+ * Note: When `typography` is set, this is ignored as typography includes fontWeight.
24
35
  */
25
36
  weight?: TextWeightVariant;
26
37
 
@@ -43,4 +54,4 @@ export interface TextProps {
43
54
  * Test ID for testing
44
55
  */
45
56
  testID?: string;
46
- }
57
+ }
@@ -21,6 +21,10 @@ const TextArea = forwardRef<TextInput, TextAreaProps>(({
21
21
  showCharacterCount = false,
22
22
  intent = 'primary',
23
23
  size = 'md',
24
+ // Spacing variants from FormInputStyleProps
25
+ margin,
26
+ marginVertical,
27
+ marginHorizontal,
24
28
  style,
25
29
  textareaStyle,
26
30
  testID,
@@ -40,6 +44,9 @@ const TextArea = forwardRef<TextInput, TextAreaProps>(({
40
44
  resize: 'none',
41
45
  isNearLimit: maxLength ? value.length >= maxLength * 0.9 : false,
42
46
  isAtLimit: maxLength ? value.length >= maxLength : false,
47
+ margin,
48
+ marginVertical,
49
+ marginHorizontal,
43
50
  });
44
51
 
45
52
  const handleChange = (newValue: string) => {
@@ -1,6 +1,11 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
2
  import { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
3
3
  import { buildSizeVariants } from '../utils/buildSizeVariants';
4
+ import {
5
+ buildMarginVariants,
6
+ buildMarginVerticalVariants,
7
+ buildMarginHorizontalVariants,
8
+ } from '../utils/buildViewStyleVariants';
4
9
  import { TextAreaIntentVariant } from './types';
5
10
 
6
11
 
@@ -116,6 +121,12 @@ export const textAreaStyles = StyleSheet.create((theme: Theme) => {
116
121
  display: 'flex',
117
122
  flexDirection: 'column',
118
123
  gap: 4,
124
+ variants: {
125
+ // Spacing variants from FormInputStyleProps
126
+ margin: buildMarginVariants(theme),
127
+ marginVertical: buildMarginVerticalVariants(theme),
128
+ marginHorizontal: buildMarginHorizontalVariants(theme),
129
+ },
119
130
  },
120
131
  label: {
121
132
  fontSize: 14,
@@ -22,6 +22,10 @@ const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(({
22
22
  showCharacterCount = false,
23
23
  intent = 'primary',
24
24
  size = 'md',
25
+ // Spacing variants from FormInputStyleProps
26
+ margin,
27
+ marginVertical,
28
+ marginHorizontal,
25
29
  style,
26
30
  textareaStyle,
27
31
  testID,
@@ -41,6 +45,9 @@ const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(({
41
45
  resize,
42
46
  isNearLimit: maxLength ? value.length >= maxLength * 0.9 : false,
43
47
  isAtLimit: maxLength ? value.length >= maxLength : false,
48
+ margin,
49
+ marginVertical,
50
+ marginHorizontal,
44
51
  });
45
52
 
46
53
  const containerProps = getWebProps([textAreaStyles.container, style as any]);
@@ -1,12 +1,13 @@
1
1
  import { Intent, Size } from '@idealyst/theme';
2
2
  import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
3
+ import { FormInputStyleProps } from '../utils/viewStyleProps';
3
4
 
4
5
  // Component-specific type aliases for future extensibility
5
6
  export type TextAreaIntentVariant = Intent;
6
7
  export type TextAreaSizeVariant = Size;
7
8
  export type TextAreaResizeVariant = 'none' | 'vertical' | 'horizontal' | 'both';
8
9
 
9
- export interface TextAreaProps {
10
+ export interface TextAreaProps extends FormInputStyleProps {
10
11
  value?: string;
11
12
  defaultValue?: string;
12
13
  onChange?: (value: string) => void;
@@ -1,46 +1,69 @@
1
1
  import React, { forwardRef } from 'react';
2
- import { View as RNView, ViewStyle } from 'react-native';
2
+ import { View as RNView, ScrollView as RNScrollView, ViewStyle } from 'react-native';
3
3
  import { ViewProps } from './types';
4
4
  import { viewStyles } from './View.styles';
5
5
 
6
- const View = forwardRef<RNView, ViewProps>(({
6
+ const View = forwardRef<RNView | RNScrollView, ViewProps>(({
7
7
  children,
8
- spacing = 'none',
9
- marginVariant = 'none',
10
8
  background = 'transparent',
11
9
  radius = 'none',
12
10
  border = 'none',
13
- backgroundColor,
11
+ // Spacing variants from ContainerStyleProps
12
+ gap,
14
13
  padding,
14
+ paddingVertical,
15
+ paddingHorizontal,
15
16
  margin,
17
+ marginVertical,
18
+ marginHorizontal,
19
+ // Override props
20
+ backgroundColor,
16
21
  borderRadius,
17
22
  borderWidth,
18
23
  borderColor,
24
+ scrollable = false,
19
25
  style,
20
26
  testID,
21
27
  }, ref) => {
22
28
  viewStyles.useVariants({
23
- spacing,
24
29
  background,
25
30
  radius,
26
31
  border,
32
+ gap,
33
+ padding,
34
+ paddingVertical,
35
+ paddingHorizontal,
36
+ margin,
37
+ marginVertical,
38
+ marginHorizontal,
27
39
  });
28
40
 
29
41
  const getStyles = (): ViewStyle => {
30
42
  const baseStyles: ViewStyle = {};
31
-
43
+
32
44
  if (backgroundColor) baseStyles.backgroundColor = backgroundColor;
33
- if (padding !== undefined) baseStyles.padding = padding;
34
- if (margin !== undefined) baseStyles.margin = margin;
35
45
  if (borderRadius !== undefined) baseStyles.borderRadius = borderRadius;
36
46
  if (borderWidth !== undefined) baseStyles.borderWidth = borderWidth;
37
47
  if (borderColor) baseStyles.borderColor = borderColor;
38
-
48
+
39
49
  return baseStyles;
40
50
  };
41
51
 
52
+ if (scrollable) {
53
+ return (
54
+ <RNScrollView
55
+ ref={ref as any}
56
+ style={[{ flex: 1 }, style]}
57
+ contentContainerStyle={[viewStyles.view, getStyles()]}
58
+ testID={testID}
59
+ >
60
+ {children}
61
+ </RNScrollView>
62
+ );
63
+ }
64
+
42
65
  return (
43
- <RNView ref={ref} style={[viewStyles.view, getStyles(), style]} testID={testID}>
66
+ <RNView ref={ref as any} style={[viewStyles.view, getStyles(), style]} testID={testID}>
44
67
  {children}
45
68
  </RNView>
46
69
  );
@@ -48,4 +71,4 @@ const View = forwardRef<RNView, ViewProps>(({
48
71
 
49
72
  View.displayName = 'View';
50
73
 
51
- export default View;
74
+ export default View;
@@ -1,92 +1,89 @@
1
-
2
1
  import { StyleSheet } from 'react-native-unistyles';
3
- import { Theme, StylesheetStyles, Surface} from '@idealyst/theme';
4
- import { buildSizeVariants } from '../utils/buildSizeVariants';
5
- import { ViewBackgroundVariant, ViewBorderVariant, ViewRadiusVariant, ViewSpacingVariant } from './types';
2
+ import { Theme, StylesheetStyles, Surface } from '@idealyst/theme';
3
+ import {
4
+ buildGapVariants,
5
+ buildPaddingVariants,
6
+ buildPaddingVerticalVariants,
7
+ buildPaddingHorizontalVariants,
8
+ buildMarginVariants,
9
+ buildMarginVerticalVariants,
10
+ buildMarginHorizontalVariants,
11
+ } from '../utils/buildViewStyleVariants';
12
+ import { ViewBackgroundVariant, ViewBorderVariant, ViewRadiusVariant } from './types';
13
+ import { ViewStyleSize } from '../utils/viewStyleProps';
6
14
 
7
15
  type ViewVariants = {
8
- spacing: ViewSpacingVariant;
9
- background: ViewBackgroundVariant;
10
- radius: ViewRadiusVariant;
11
- border: ViewBorderVariant;
12
- }
16
+ background: ViewBackgroundVariant;
17
+ radius: ViewRadiusVariant;
18
+ border: ViewBorderVariant;
19
+ gap: ViewStyleSize;
20
+ padding: ViewStyleSize;
21
+ paddingVertical: ViewStyleSize;
22
+ paddingHorizontal: ViewStyleSize;
23
+ margin: ViewStyleSize;
24
+ marginVertical: ViewStyleSize;
25
+ marginHorizontal: ViewStyleSize;
26
+ };
13
27
 
14
28
  export type ExpandedViewStyles = StylesheetStyles<keyof ViewVariants>;
15
29
 
16
30
  export type ViewStylesheet = {
17
- view: ExpandedViewStyles;
18
- }
19
-
20
- /**
21
- * Create spacing variants for view
22
- */
23
- function createSpacingVariants(theme: Theme) {
24
- const spacingVariants = buildSizeVariants(theme, 'view', (size) => ({
25
- padding: size.padding,
26
- gap: size.spacing,
27
- }));
28
-
29
- spacingVariants['none'] = {
30
- padding: 0,
31
- gap: 0,
32
- };
33
-
34
- return spacingVariants as Record<ViewSpacingVariant, Partial<ExpandedViewStyles>>;
35
- }
31
+ view: ExpandedViewStyles;
32
+ };
36
33
 
37
34
  /**
38
35
  * Create background variants for view
39
36
  */
40
37
  function createBackgroundVariants(theme: Theme) {
41
- const variants: any = {
42
- transparent: {
43
- backgroundColor: 'transparent',
44
- },
45
- };
38
+ const variants: any = {
39
+ transparent: {
40
+ backgroundColor: 'transparent',
41
+ },
42
+ };
46
43
 
47
- // Add all surface colors programmatically
48
- for (const surface in theme.colors.surface) {
49
- variants[surface] = {
50
- backgroundColor: theme.colors.surface[surface as Surface],
51
- };
52
- }
44
+ // Add all surface colors programmatically
45
+ for (const surface in theme.colors.surface) {
46
+ variants[surface] = {
47
+ backgroundColor: theme.colors.surface[surface as Surface],
48
+ };
49
+ }
53
50
 
54
- return variants;
51
+ return variants;
55
52
  }
56
53
 
57
54
  /**
58
55
  * Create radius variants for view
59
56
  */
60
57
  function createRadiusVariants() {
61
- return {
62
- none: { borderRadius: 0 },
63
- xs: { borderRadius: 2 },
64
- sm: { borderRadius: 4 },
65
- md: { borderRadius: 8 },
66
- lg: { borderRadius: 12 },
67
- xl: { borderRadius: 16 },
68
- } as const;
58
+ return {
59
+ none: { borderRadius: 0 },
60
+ xs: { borderRadius: 2 },
61
+ sm: { borderRadius: 4 },
62
+ md: { borderRadius: 8 },
63
+ lg: { borderRadius: 12 },
64
+ xl: { borderRadius: 16 },
65
+ } as const;
69
66
  }
70
67
 
71
68
  /**
72
69
  * Create border variants for view
73
70
  */
74
71
  function createBorderVariants(theme: Theme) {
75
- return {
76
- none: {
77
- borderWidth: 0,
78
- },
79
- thin: {
80
- borderWidth: 1,
81
- borderStyle: 'solid',
82
- borderColor: theme.colors['gray.300'],
83
- },
84
- thick: {
85
- borderWidth: 2,
86
- borderStyle: 'solid',
87
- borderColor: theme.colors['gray.300'],
88
- },
89
- } as const;
72
+ return {
73
+ none: {
74
+ borderWidth: 0,
75
+ },
76
+ thin: {
77
+ borderWidth: 1,
78
+ borderStyle: 'solid',
79
+ borderColor: theme.colors['gray.300'],
80
+ },
81
+ thick: {
82
+ borderWidth: 2,
83
+ borderStyle: 'solid',
84
+ borderColor: theme.colors['gray.300'],
85
+ },
86
+ } as const;
90
87
  }
91
88
 
92
89
  // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
@@ -94,18 +91,24 @@ function createBorderVariants(theme: Theme) {
94
91
  export const viewStyles = StyleSheet.create((theme: Theme) => {
95
92
  return {
96
93
  view: {
94
+ display: 'flex',
95
+ variants: {
96
+ background: createBackgroundVariants(theme),
97
+ radius: createRadiusVariants(),
98
+ border: createBorderVariants(theme),
99
+ gap: buildGapVariants(theme),
100
+ padding: buildPaddingVariants(theme),
101
+ paddingVertical: buildPaddingVerticalVariants(theme),
102
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
103
+ margin: buildMarginVariants(theme),
104
+ marginVertical: buildMarginVerticalVariants(theme),
105
+ marginHorizontal: buildMarginHorizontalVariants(theme),
106
+ },
107
+ _web: {
97
108
  display: 'flex',
98
- variants: {
99
- spacing: createSpacingVariants(theme),
100
- background: createBackgroundVariants(theme),
101
- radius: createRadiusVariants(),
102
- border: createBorderVariants(theme),
103
- },
104
- _web: {
105
- display: 'flex',
106
- flexDirection: 'column',
107
- boxSizing: 'border-box',
108
- },
109
+ flexDirection: 'column',
110
+ boxSizing: 'border-box',
111
+ },
109
112
  },
110
113
  };
111
- });
114
+ });
@@ -6,17 +6,23 @@ import useMergeRefs from '../hooks/useMergeRefs';
6
6
 
7
7
  const View = forwardRef<HTMLDivElement, ViewProps>(({
8
8
  children,
9
- spacing = 'none',
10
- marginVariant = 'none',
11
9
  background = 'transparent',
12
10
  radius = 'none',
13
11
  border = 'none',
14
- backgroundColor,
12
+ // Spacing variants from ContainerStyleProps
13
+ gap,
15
14
  padding,
15
+ paddingVertical,
16
+ paddingHorizontal,
16
17
  margin,
18
+ marginVertical,
19
+ marginHorizontal,
20
+ // Override props
21
+ backgroundColor,
17
22
  borderRadius,
18
23
  borderWidth,
19
24
  borderColor,
25
+ scrollable, // accepted but no-op on web - layout handles scrolling
20
26
  style,
21
27
  testID,
22
28
  }, ref) => {
@@ -24,28 +30,31 @@ const View = forwardRef<HTMLDivElement, ViewProps>(({
24
30
  background,
25
31
  radius,
26
32
  border,
27
- spacing,
33
+ gap,
34
+ padding,
35
+ paddingVertical,
36
+ paddingHorizontal,
37
+ margin,
38
+ marginVertical,
39
+ marginHorizontal,
28
40
  });
29
41
 
30
42
  // Create dynamic styles based on custom props (overrides variants)
31
43
  const dynamicStyles: any = {};
32
44
 
33
45
  if (backgroundColor) dynamicStyles.backgroundColor = backgroundColor;
34
- if (padding !== undefined) dynamicStyles.padding = padding;
35
- if (margin !== undefined) dynamicStyles.margin = margin;
36
46
  if (borderRadius !== undefined) dynamicStyles.borderRadius = borderRadius;
37
47
  if (borderWidth !== undefined) dynamicStyles.borderWidth = borderWidth;
38
48
  if (borderColor) dynamicStyles.borderColor = borderColor;
39
49
 
40
50
  /** @ts-ignore */
41
- const webProps = getWebProps(viewStyles.view);
51
+ const webProps = getWebProps([viewStyles.view, dynamicStyles, style as any]);
42
52
 
43
53
  const mergedRef = useMergeRefs(ref, webProps.ref);
44
54
 
45
55
  return (
46
56
  <div
47
57
  {...webProps}
48
- style={style as any}
49
58
  ref={mergedRef}
50
59
  data-testid={testID}
51
60
  >
@@ -56,4 +65,4 @@ const View = forwardRef<HTMLDivElement, ViewProps>(({
56
65
 
57
66
  View.displayName = 'View';
58
67
 
59
- export default View;
68
+ export default View;