@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
@@ -3,112 +3,112 @@ import { Screen, View, Text } from '../index';
3
3
  export const ViewExamples = () => {
4
4
  return (
5
5
  <Screen background="primary" padding="lg">
6
- <View spacing="none">
7
- <Text size="lg" weight="bold" align="center">
6
+ <View gap="xl">
7
+ <Text typography="h4" align="center">
8
8
  View Examples
9
9
  </Text>
10
10
 
11
11
  {/* Spacing Examples */}
12
- <View spacing="md">
13
- <Text size="md" weight="semibold">Spacing Variants</Text>
12
+ <View gap="md">
13
+ <Text typography="subtitle1">Spacing Variants</Text>
14
14
  <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>
15
- <View spacing="none" background="secondary" border="thin">
16
- <Text size="sm">None</Text>
15
+ <View background="secondary" border="thin">
16
+ <Text typography="body2">None</Text>
17
17
  </View>
18
- <View spacing="xs" background="secondary" border="thin">
19
- <Text size="sm">XS</Text>
18
+ <View gap="xs" background="secondary" border="thin">
19
+ <Text typography="body2">XS</Text>
20
20
  </View>
21
- <View spacing="sm" background="secondary" border="thin">
22
- <Text size="sm">SM</Text>
21
+ <View gap="sm" background="secondary" border="thin">
22
+ <Text typography="body2">SM</Text>
23
23
  </View>
24
- <View spacing="md" background="secondary" border="thin">
25
- <Text size="sm">MD</Text>
24
+ <View gap="md" background="secondary" border="thin">
25
+ <Text typography="body2">MD</Text>
26
26
  </View>
27
- <View spacing="lg" background="secondary" border="thin">
28
- <Text size="sm">LG</Text>
27
+ <View gap="lg" background="secondary" border="thin">
28
+ <Text typography="body2">LG</Text>
29
29
  </View>
30
- <View spacing="xl" background="secondary" border="thin">
31
- <Text size="sm">XL</Text>
30
+ <View gap="xl" background="secondary" border="thin">
31
+ <Text typography="body2">XL</Text>
32
32
  </View>
33
33
  </View>
34
34
  </View>
35
35
 
36
36
  {/* Background Examples */}
37
- <View spacing="md">
38
- <Text size="md" weight="semibold">Background Variants</Text>
37
+ <View gap="md">
38
+ <Text typography="subtitle1">Background Variants</Text>
39
39
  <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
40
- <View background="transparent" border="thin" spacing="sm" radius="sm">
41
- <Text size="sm" color="primary">Transparent</Text>
40
+ <View background="transparent" border="thin" gap="sm" radius="sm">
41
+ <Text typography="body2" color="primary">Transparent</Text>
42
42
  </View>
43
- <View background="primary" spacing="sm" radius="sm">
44
- <Text size="sm" color="primary">Primary</Text>
43
+ <View background="primary" gap="sm" radius="sm">
44
+ <Text typography="body2" color="primary">Primary</Text>
45
45
  </View>
46
- <View background="secondary" spacing="sm" radius="sm">
47
- <Text size="sm" color="secondary">Secondary</Text>
46
+ <View background="secondary" gap="sm" radius="sm">
47
+ <Text typography="caption" color="secondary">Secondary</Text>
48
48
  </View>
49
- <View background="tertiary" spacing="sm" radius="sm">
50
- <Text size="sm" color="tertiary">Tertiary</Text>
49
+ <View background="tertiary" gap="sm" radius="sm">
50
+ <Text typography="body2" color="tertiary">Tertiary</Text>
51
51
  </View>
52
- <View background="inverse" spacing="sm" radius="sm">
53
- <Text size="sm" color="inverse">Inverse (of primary)</Text>
52
+ <View background="inverse" gap="sm" radius="sm">
53
+ <Text typography="body2" color="inverse">Inverse (of primary)</Text>
54
54
  </View>
55
- <View background="inverse-secondary" spacing="sm" radius="sm">
56
- <Text size="sm" color="inverse-secondary">Inverse Secondary</Text>
55
+ <View background="inverse-secondary" gap="sm" radius="sm">
56
+ <Text typography="body2" color="inverse-secondary">Inverse Secondary</Text>
57
57
  </View>
58
- <View background="inverse-tertiary" spacing="sm" radius="sm">
59
- <Text size="sm" color="inverse-tertiary">Inverse Tertiary</Text>
58
+ <View background="inverse-tertiary" gap="sm" radius="sm">
59
+ <Text typography="body2" color="inverse-tertiary">Inverse Tertiary</Text>
60
60
  </View>
61
61
  </View>
62
62
  </View>
63
63
 
64
64
  {/* Border Radius Examples */}
65
- <View spacing="md">
66
- <Text size="md" weight="semibold">Border Radius</Text>
65
+ <View gap="md">
66
+ <Text typography="subtitle1">Border Radius</Text>
67
67
  <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
68
- <View radius="none" background="inverse" spacing="sm">
69
- <Text size="sm" color="inverse">None</Text>
68
+ <View radius="none" background="inverse" gap="sm">
69
+ <Text typography="body2" color="inverse">None</Text>
70
70
  </View>
71
- <View radius="xs" background="inverse" spacing="sm">
72
- <Text size="sm" color="inverse">XS</Text>
71
+ <View radius="xs" background="inverse" gap="sm">
72
+ <Text typography="body2" color="inverse">XS</Text>
73
73
  </View>
74
- <View radius="sm" background="inverse" spacing="sm">
75
- <Text size="sm" color="inverse">SM</Text>
74
+ <View radius="sm" background="inverse" gap="sm">
75
+ <Text typography="body2" color="inverse">SM</Text>
76
76
  </View>
77
- <View radius="md" background="inverse" spacing="sm">
78
- <Text size="sm" color="inverse">MD</Text>
77
+ <View radius="md" background="inverse" gap="sm">
78
+ <Text typography="body2" color="inverse">MD</Text>
79
79
  </View>
80
- <View radius="lg" background="inverse" spacing="sm">
81
- <Text size="sm" color="inverse">LG</Text>
80
+ <View radius="lg" background="inverse" gap="sm">
81
+ <Text typography="body2" color="inverse">LG</Text>
82
82
  </View>
83
- <View radius="xl" background="inverse" spacing="sm">
84
- <Text size="sm" color="inverse">XL</Text>
83
+ <View radius="xl" background="inverse" gap="sm">
84
+ <Text typography="body2" color="inverse">XL</Text>
85
85
  </View>
86
86
  </View>
87
87
  </View>
88
88
 
89
89
  {/* Border Examples */}
90
- <View spacing="md">
91
- <Text size="md" weight="semibold">Border Variants</Text>
90
+ <View gap="md">
91
+ <Text typography="subtitle1">Border Variants</Text>
92
92
  <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
93
- <View border="none" background="secondary" spacing="sm" radius="sm">
94
- <Text size="sm">None</Text>
93
+ <View border="none" background="secondary" gap="sm" radius="sm">
94
+ <Text typography="body2">None</Text>
95
95
  </View>
96
- <View border="thin" background="secondary" spacing="sm" radius="sm">
97
- <Text size="sm">Thin</Text>
96
+ <View border="thin" background="secondary" gap="sm" radius="sm">
97
+ <Text typography="body2">Thin</Text>
98
98
  </View>
99
- <View border="thick" background="secondary" spacing="sm" radius="sm">
100
- <Text size="sm">Thick</Text>
99
+ <View border="thick" background="secondary" gap="sm" radius="sm">
100
+ <Text typography="body2">Thick</Text>
101
101
  </View>
102
102
  </View>
103
103
  </View>
104
104
 
105
105
  {/* Layout Examples */}
106
- <View spacing="md">
107
- <Text size="md" weight="semibold">Layout Examples</Text>
108
- <View spacing="sm" style={{ gap: 10 }}>
106
+ <View gap="md">
107
+ <Text typography="subtitle1">Layout Examples</Text>
108
+ <View gap="sm" style={{ gap: 10 }}>
109
109
  <View
110
110
  background="secondary"
111
- spacing="md"
111
+ gap="md"
112
112
  radius="md"
113
113
  border="thin"
114
114
  style={{ flexDirection: 'row', justifyContent: 'space-between' }}
@@ -120,7 +120,7 @@ export const ViewExamples = () => {
120
120
 
121
121
  <View
122
122
  background="secondary"
123
- spacing="md"
123
+ gap="md"
124
124
  radius="md"
125
125
  border="thin"
126
126
  style={{ flexDirection: 'column', alignItems: 'center' }}
package/src/index.ts CHANGED
@@ -145,4 +145,8 @@ export { useMergeRefs };
145
145
  // Event utilities
146
146
  export * from './utils/events';
147
147
 
148
+ // View style utilities for custom components
149
+ export * from './utils/viewStyleProps';
150
+ export * from './utils/buildViewStyleVariants';
151
+
148
152
  export type { AppTheme } from '@idealyst/theme';
@@ -0,0 +1,148 @@
1
+ import { Theme, Size, Styles } from '@idealyst/theme';
2
+
3
+ /**
4
+ * Builds gap variants from theme.sizes.view
5
+ * Uses the 'spacing' value from ViewSizeValue
6
+ */
7
+ export function buildGapVariants(theme: Theme): Record<Size, Styles> {
8
+ const variants = {} as Record<Size, Styles>;
9
+ for (const size in theme.sizes.view) {
10
+ variants[size as Size] = {
11
+ gap: theme.sizes.view[size as Size].spacing,
12
+ };
13
+ }
14
+ return variants;
15
+ }
16
+
17
+ /**
18
+ * Builds padding variants from theme.sizes.view
19
+ * Uses the 'padding' value from ViewSizeValue
20
+ */
21
+ export function buildPaddingVariants(theme: Theme): Record<Size, Styles> {
22
+ const variants = {} as Record<Size, Styles>;
23
+ for (const size in theme.sizes.view) {
24
+ variants[size as Size] = {
25
+ padding: theme.sizes.view[size as Size].padding,
26
+ };
27
+ }
28
+ return variants;
29
+ }
30
+
31
+ /**
32
+ * Builds paddingVertical variants from theme.sizes.view
33
+ */
34
+ export function buildPaddingVerticalVariants(theme: Theme): Record<Size, Styles> {
35
+ const variants = {} as Record<Size, Styles>;
36
+ for (const size in theme.sizes.view) {
37
+ variants[size as Size] = {
38
+ paddingVertical: theme.sizes.view[size as Size].padding,
39
+ };
40
+ }
41
+ return variants;
42
+ }
43
+
44
+ /**
45
+ * Builds paddingHorizontal variants from theme.sizes.view
46
+ */
47
+ export function buildPaddingHorizontalVariants(theme: Theme): Record<Size, Styles> {
48
+ const variants = {} as Record<Size, Styles>;
49
+ for (const size in theme.sizes.view) {
50
+ variants[size as Size] = {
51
+ paddingHorizontal: theme.sizes.view[size as Size].padding,
52
+ };
53
+ }
54
+ return variants;
55
+ }
56
+
57
+ /**
58
+ * Builds margin variants from theme.sizes.view
59
+ * Uses the 'spacing' value from ViewSizeValue (same as gap)
60
+ */
61
+ export function buildMarginVariants(theme: Theme): Record<Size, Styles> {
62
+ const variants = {} as Record<Size, Styles>;
63
+ for (const size in theme.sizes.view) {
64
+ variants[size as Size] = {
65
+ margin: theme.sizes.view[size as Size].spacing,
66
+ };
67
+ }
68
+ return variants;
69
+ }
70
+
71
+ /**
72
+ * Builds marginVertical variants from theme.sizes.view
73
+ */
74
+ export function buildMarginVerticalVariants(theme: Theme): Record<Size, Styles> {
75
+ const variants = {} as Record<Size, Styles>;
76
+ for (const size in theme.sizes.view) {
77
+ variants[size as Size] = {
78
+ marginVertical: theme.sizes.view[size as Size].spacing,
79
+ };
80
+ }
81
+ return variants;
82
+ }
83
+
84
+ /**
85
+ * Builds marginHorizontal variants from theme.sizes.view
86
+ */
87
+ export function buildMarginHorizontalVariants(theme: Theme): Record<Size, Styles> {
88
+ const variants = {} as Record<Size, Styles>;
89
+ for (const size in theme.sizes.view) {
90
+ variants[size as Size] = {
91
+ marginHorizontal: theme.sizes.view[size as Size].spacing,
92
+ };
93
+ }
94
+ return variants;
95
+ }
96
+
97
+ /**
98
+ * Convenience function to build all container style variants at once
99
+ * Returns all gap, padding, and margin variants
100
+ */
101
+ export function buildContainerStyleVariants(theme: Theme) {
102
+ return {
103
+ gap: buildGapVariants(theme),
104
+ padding: buildPaddingVariants(theme),
105
+ paddingVertical: buildPaddingVerticalVariants(theme),
106
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
107
+ margin: buildMarginVariants(theme),
108
+ marginVertical: buildMarginVerticalVariants(theme),
109
+ marginHorizontal: buildMarginHorizontalVariants(theme),
110
+ };
111
+ }
112
+
113
+ /**
114
+ * Convenience function to build padding-only variants
115
+ * For components that only need padding support
116
+ */
117
+ export function buildPaddingStyleVariants(theme: Theme) {
118
+ return {
119
+ padding: buildPaddingVariants(theme),
120
+ paddingVertical: buildPaddingVerticalVariants(theme),
121
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
122
+ };
123
+ }
124
+
125
+ /**
126
+ * Convenience function to build margin-only variants
127
+ * For form input components that only need margin support
128
+ */
129
+ export function buildMarginStyleVariants(theme: Theme) {
130
+ return {
131
+ margin: buildMarginVariants(theme),
132
+ marginVertical: buildMarginVerticalVariants(theme),
133
+ marginHorizontal: buildMarginHorizontalVariants(theme),
134
+ };
135
+ }
136
+
137
+ /**
138
+ * Convenience function to build text spacing variants (gap + padding)
139
+ * For Text component
140
+ */
141
+ export function buildTextSpacingVariants(theme: Theme) {
142
+ return {
143
+ gap: buildGapVariants(theme),
144
+ padding: buildPaddingVariants(theme),
145
+ paddingVertical: buildPaddingVerticalVariants(theme),
146
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
147
+ };
148
+ }
@@ -0,0 +1,63 @@
1
+ import { Size } from '@idealyst/theme';
2
+
3
+ /**
4
+ * Size variant type for view style props.
5
+ * undefined = no variant applied (inherits default or no style)
6
+ */
7
+ export type ViewStyleSize = Size;
8
+
9
+ /**
10
+ * Gap style props - for controlling gap/spacing between children
11
+ */
12
+ export interface GapStyleProps {
13
+ /** Gap between children (uses theme.sizes.view[size].spacing) */
14
+ gap?: ViewStyleSize;
15
+ }
16
+
17
+ /**
18
+ * Padding style props - for controlling internal spacing
19
+ */
20
+ export interface PaddingStyleProps {
21
+ /** Padding on all sides (uses theme.sizes.view[size].padding) */
22
+ padding?: ViewStyleSize;
23
+ /** Vertical padding (top + bottom) */
24
+ paddingVertical?: ViewStyleSize;
25
+ /** Horizontal padding (left + right) */
26
+ paddingHorizontal?: ViewStyleSize;
27
+ }
28
+
29
+ /**
30
+ * Margin style props - for controlling external spacing
31
+ */
32
+ export interface MarginStyleProps {
33
+ /** Margin on all sides (uses theme.sizes.view[size].spacing) */
34
+ margin?: ViewStyleSize;
35
+ /** Vertical margin (top + bottom) */
36
+ marginVertical?: ViewStyleSize;
37
+ /** Horizontal margin (left + right) */
38
+ marginHorizontal?: ViewStyleSize;
39
+ }
40
+
41
+ /**
42
+ * Full container style props - includes all spacing options
43
+ * For: View, Card, Screen, List, Accordion, Table, TabBar
44
+ */
45
+ export interface ContainerStyleProps extends GapStyleProps, PaddingStyleProps, MarginStyleProps {}
46
+
47
+ /**
48
+ * Text spacing style props - gap + padding only
49
+ * For: Text (gap for inline elements, padding for block-level)
50
+ */
51
+ export interface TextSpacingStyleProps extends GapStyleProps, PaddingStyleProps {}
52
+
53
+ /**
54
+ * Pressable style props - padding only
55
+ * For: Pressable
56
+ */
57
+ export interface PressableSpacingStyleProps extends PaddingStyleProps {}
58
+
59
+ /**
60
+ * Form input style props - margin only
61
+ * For: Input, Select, TextArea, Checkbox, RadioButton, Switch, Slider
62
+ */
63
+ export interface FormInputStyleProps extends MarginStyleProps {}