@particle-network/ui-native 0.0.2

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 (168) hide show
  1. package/README.md +57 -0
  2. package/dist/components/ProgressWrapper/index.d.ts +35 -0
  3. package/dist/components/ProgressWrapper/index.js +120 -0
  4. package/dist/components/Text/index.d.ts +2 -0
  5. package/dist/components/Text/index.js +2 -0
  6. package/dist/components/Text/text.d.ts +4 -0
  7. package/dist/components/Text/text.js +196 -0
  8. package/dist/components/Text/text.types.d.ts +109 -0
  9. package/dist/components/Text/text.types.js +77 -0
  10. package/dist/components/UXButton/button.d.ts +3 -0
  11. package/dist/components/UXButton/button.js +74 -0
  12. package/dist/components/UXButton/button.styles.d.ts +53 -0
  13. package/dist/components/UXButton/button.styles.js +157 -0
  14. package/dist/components/UXButton/button.types.d.ts +18 -0
  15. package/dist/components/UXButton/button.types.js +0 -0
  16. package/dist/components/UXButton/index.d.ts +2 -0
  17. package/dist/components/UXButton/index.js +1 -0
  18. package/dist/components/UXCheckbox/checkbox-group.d.ts +8 -0
  19. package/dist/components/UXCheckbox/checkbox-group.js +30 -0
  20. package/dist/components/UXCheckbox/checkbox.d.ts +10 -0
  21. package/dist/components/UXCheckbox/checkbox.js +78 -0
  22. package/dist/components/UXCheckbox/context.d.ts +8 -0
  23. package/dist/components/UXCheckbox/context.js +8 -0
  24. package/dist/components/UXCheckbox/index.d.ts +4 -0
  25. package/dist/components/UXCheckbox/index.js +3 -0
  26. package/dist/components/UXCheckbox/types.d.ts +6 -0
  27. package/dist/components/UXCheckbox/types.js +0 -0
  28. package/dist/components/UXChip/chip.d.ts +3 -0
  29. package/dist/components/UXChip/chip.js +48 -0
  30. package/dist/components/UXChip/index.d.ts +2 -0
  31. package/dist/components/UXChip/index.js +1 -0
  32. package/dist/components/UXChip/styles.d.ts +24 -0
  33. package/dist/components/UXChip/styles.js +70 -0
  34. package/dist/components/UXChip/types.d.ts +11 -0
  35. package/dist/components/UXChip/types.js +0 -0
  36. package/dist/components/UXDivider/index.d.ts +8 -0
  37. package/dist/components/UXDivider/index.js +34 -0
  38. package/dist/components/UXHint/index.d.ts +7 -0
  39. package/dist/components/UXHint/index.js +19 -0
  40. package/dist/components/UXModal/index.d.ts +24 -0
  41. package/dist/components/UXModal/index.js +271 -0
  42. package/dist/components/UXPressable/index.d.ts +4 -0
  43. package/dist/components/UXPressable/index.js +36 -0
  44. package/dist/components/UXRadio/context.d.ts +7 -0
  45. package/dist/components/UXRadio/context.js +10 -0
  46. package/dist/components/UXRadio/index.d.ts +2 -0
  47. package/dist/components/UXRadio/index.js +2 -0
  48. package/dist/components/UXRadio/radio-group.d.ts +5 -0
  49. package/dist/components/UXRadio/radio-group.js +21 -0
  50. package/dist/components/UXRadio/radio.d.ts +5 -0
  51. package/dist/components/UXRadio/radio.js +67 -0
  52. package/dist/components/UXRadio/types.d.ts +10 -0
  53. package/dist/components/UXRadio/types.js +0 -0
  54. package/dist/components/UXSwitch/index.d.ts +2 -0
  55. package/dist/components/UXSwitch/index.js +1 -0
  56. package/dist/components/UXSwitch/styles.d.ts +16 -0
  57. package/dist/components/UXSwitch/styles.js +58 -0
  58. package/dist/components/UXSwitch/switch.d.ts +3 -0
  59. package/dist/components/UXSwitch/switch.js +103 -0
  60. package/dist/components/UXSwitch/types.d.ts +11 -0
  61. package/dist/components/UXSwitch/types.js +0 -0
  62. package/dist/components/UXTabs/context.d.ts +5 -0
  63. package/dist/components/UXTabs/context.js +8 -0
  64. package/dist/components/UXTabs/index.d.ts +4 -0
  65. package/dist/components/UXTabs/index.js +3 -0
  66. package/dist/components/UXTabs/styles.d.ts +30 -0
  67. package/dist/components/UXTabs/styles.js +191 -0
  68. package/dist/components/UXTabs/tab.d.ts +3 -0
  69. package/dist/components/UXTabs/tab.js +55 -0
  70. package/dist/components/UXTabs/tabs.d.ts +3 -0
  71. package/dist/components/UXTabs/tabs.js +66 -0
  72. package/dist/components/UXTabs/types.d.ts +23 -0
  73. package/dist/components/UXTabs/types.js +0 -0
  74. package/dist/components/UXTooltip/index.d.ts +6 -0
  75. package/dist/components/UXTooltip/index.js +32 -0
  76. package/dist/components/UXTouchableOpacity/index.d.ts +4 -0
  77. package/dist/components/UXTouchableOpacity/index.js +24 -0
  78. package/dist/components/index.d.ts +22 -0
  79. package/dist/components/index.js +22 -0
  80. package/dist/components/input/index.d.ts +3 -0
  81. package/dist/components/input/index.js +2 -0
  82. package/dist/components/input/input.d.ts +3 -0
  83. package/dist/components/input/input.js +138 -0
  84. package/dist/components/input/number-input.d.ts +3 -0
  85. package/dist/components/input/number-input.js +231 -0
  86. package/dist/components/input/styles.d.ts +31 -0
  87. package/dist/components/input/styles.js +102 -0
  88. package/dist/components/input/types.d.ts +61 -0
  89. package/dist/components/input/types.js +0 -0
  90. package/dist/components/layout/Box/box.d.ts +12 -0
  91. package/dist/components/layout/Box/box.js +89 -0
  92. package/dist/components/layout/Box/index.d.ts +3 -0
  93. package/dist/components/layout/Box/index.js +2 -0
  94. package/dist/components/layout/Box/useBox.style.d.ts +3 -0
  95. package/dist/components/layout/Box/useBox.style.js +141 -0
  96. package/dist/components/layout/Box/useBox.type.d.ts +292 -0
  97. package/dist/components/layout/Box/useBox.type.js +0 -0
  98. package/dist/components/layout/Center.d.ts +5 -0
  99. package/dist/components/layout/Center.js +10 -0
  100. package/dist/components/layout/Circle.d.ts +7 -0
  101. package/dist/components/layout/Circle.js +14 -0
  102. package/dist/components/layout/Flex/flex.d.ts +6 -0
  103. package/dist/components/layout/Flex/flex.js +33 -0
  104. package/dist/components/layout/Flex/index.d.ts +4 -0
  105. package/dist/components/layout/Flex/index.js +3 -0
  106. package/dist/components/layout/Flex/useFlex.style.d.ts +3 -0
  107. package/dist/components/layout/Flex/useFlex.style.js +122 -0
  108. package/dist/components/layout/Flex/useFlex.type.d.ts +65 -0
  109. package/dist/components/layout/Flex/useFlex.type.js +0 -0
  110. package/dist/components/layout/Flex/useFlexBox.style.d.ts +134 -0
  111. package/dist/components/layout/Flex/useFlexBox.style.js +26 -0
  112. package/dist/components/layout/HStack.d.ts +5 -0
  113. package/dist/components/layout/HStack.js +11 -0
  114. package/dist/components/layout/Square.d.ts +9 -0
  115. package/dist/components/layout/Square.js +14 -0
  116. package/dist/components/layout/VStack.d.ts +5 -0
  117. package/dist/components/layout/VStack.js +14 -0
  118. package/dist/hooks/index.d.ts +5 -0
  119. package/dist/hooks/index.js +5 -0
  120. package/dist/hooks/useColors.d.ts +7 -0
  121. package/dist/hooks/useColors.js +18 -0
  122. package/dist/hooks/useKeyboard.d.ts +4 -0
  123. package/dist/hooks/useKeyboard.js +29 -0
  124. package/dist/hooks/useRadius.d.ts +7 -0
  125. package/dist/hooks/useRadius.js +16 -0
  126. package/dist/hooks/useSpacing.d.ts +7 -0
  127. package/dist/hooks/useSpacing.js +16 -0
  128. package/dist/hooks/useTheme.d.ts +5 -0
  129. package/dist/hooks/useTheme.js +6 -0
  130. package/dist/icons/CheckboxOffIcon.d.ts +4 -0
  131. package/dist/icons/CheckboxOffIcon.js +21 -0
  132. package/dist/icons/CheckboxOnIcon.d.ts +4 -0
  133. package/dist/icons/CheckboxOnIcon.js +26 -0
  134. package/dist/icons/DotIcon.d.ts +4 -0
  135. package/dist/icons/DotIcon.js +23 -0
  136. package/dist/icons/QuestionIcon.d.ts +4 -0
  137. package/dist/icons/QuestionIcon.js +30 -0
  138. package/dist/icons/RadioOffIcon.d.ts +4 -0
  139. package/dist/icons/RadioOffIcon.js +22 -0
  140. package/dist/icons/RadioOnIcon.d.ts +4 -0
  141. package/dist/icons/RadioOnIcon.js +42 -0
  142. package/dist/icons/types.d.ts +6 -0
  143. package/dist/icons/types.js +0 -0
  144. package/dist/index.d.ts +5 -0
  145. package/dist/index.js +4 -0
  146. package/dist/provider/ThemeContext.d.ts +3 -0
  147. package/dist/provider/ThemeContext.js +15 -0
  148. package/dist/provider/ThemeProvider.d.ts +10 -0
  149. package/dist/provider/ThemeProvider.js +31 -0
  150. package/dist/provider/index.d.ts +2 -0
  151. package/dist/provider/index.js +2 -0
  152. package/dist/theme/colors.d.ts +6 -0
  153. package/dist/theme/colors.js +17 -0
  154. package/dist/theme/index.d.ts +7 -0
  155. package/dist/theme/index.js +16 -0
  156. package/dist/theme/opacity.d.ts +2 -0
  157. package/dist/theme/opacity.js +3 -0
  158. package/dist/theme/radius.d.ts +3 -0
  159. package/dist/theme/radius.js +10 -0
  160. package/dist/theme/spacing.d.ts +3 -0
  161. package/dist/theme/spacing.js +10 -0
  162. package/dist/types/index.d.ts +1 -0
  163. package/dist/types/index.js +0 -0
  164. package/dist/types/theme.d.ts +17 -0
  165. package/dist/types/theme.js +0 -0
  166. package/dist/utils/triggerHapticFeedback.d.ts +5 -0
  167. package/dist/utils/triggerHapticFeedback.js +16 -0
  168. package/package.json +110 -0
@@ -0,0 +1,141 @@
1
+ import { useMemo } from "react";
2
+ import { ms as external_react_native_size_matters_ms } from "react-native-size-matters";
3
+ import { useColors, useRadius, useSpacing } from "../../../hooks/index.js";
4
+ const borderFunc = (value)=>{
5
+ if ('number' == typeof value) return external_react_native_size_matters_ms(value);
6
+ return value;
7
+ };
8
+ const useBoxStyle = (props)=>{
9
+ const { fullWidth, fullHeight, h, minH, maxH, w, minW, maxW, m, mt, mr, mb, ml, ms, me, mh, mv, p, pt, pr, pb, pl, ps, pe, ph, pv, borderStyle, border, borderTop, borderRight, borderBottom, borderLeft, borderStart, borderEnd, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderStartColor, borderEndColor, radius, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, topStartRadius, topEndRadius, bottomStartRadius, bottomEndRadius, position, top, right, bottom, left, start, end, bg, bgOpacity, opacity, zIndex, overflow } = props;
10
+ const { getColor } = useColors();
11
+ const { getSpacing } = useSpacing();
12
+ const { getRadius } = useRadius();
13
+ const boxStyle = useMemo(()=>{
14
+ const styleObj = {};
15
+ styleObj.width = fullWidth ? '100%' : getSpacing(w);
16
+ styleObj.height = fullHeight ? '100%' : getSpacing(h);
17
+ styleObj.minHeight = getSpacing(minH);
18
+ styleObj.maxHeight = getSpacing(maxH);
19
+ styleObj.minWidth = getSpacing(minW);
20
+ styleObj.maxWidth = getSpacing(maxW);
21
+ styleObj.margin = getSpacing(m);
22
+ styleObj.marginTop = getSpacing(mt);
23
+ styleObj.marginRight = getSpacing(mr);
24
+ styleObj.marginBottom = getSpacing(mb);
25
+ styleObj.marginLeft = getSpacing(ml);
26
+ styleObj.marginStart = getSpacing(ms);
27
+ styleObj.marginEnd = getSpacing(me);
28
+ styleObj.marginHorizontal = getSpacing(mh);
29
+ styleObj.marginVertical = getSpacing(mv);
30
+ styleObj.padding = getSpacing(p);
31
+ styleObj.paddingTop = getSpacing(pt);
32
+ styleObj.paddingRight = getSpacing(pr);
33
+ styleObj.paddingBottom = getSpacing(pb);
34
+ styleObj.paddingLeft = getSpacing(pl);
35
+ styleObj.paddingStart = getSpacing(ps);
36
+ styleObj.paddingEnd = getSpacing(pe);
37
+ styleObj.paddingHorizontal = getSpacing(ph);
38
+ styleObj.paddingVertical = getSpacing(pv);
39
+ styleObj.borderStyle = borderStyle;
40
+ styleObj.borderWidth = borderFunc(border);
41
+ styleObj.borderTopWidth = borderFunc(borderTop);
42
+ styleObj.borderRightWidth = borderFunc(borderRight);
43
+ styleObj.borderBottomWidth = borderFunc(borderBottom);
44
+ styleObj.borderLeftWidth = borderFunc(borderLeft);
45
+ styleObj.borderStartWidth = borderFunc(borderStart);
46
+ styleObj.borderEndWidth = borderFunc(borderEnd);
47
+ styleObj.borderColor = getColor(borderColor);
48
+ styleObj.borderTopColor = getColor(borderTopColor);
49
+ styleObj.borderRightColor = getColor(borderRightColor);
50
+ styleObj.borderBottomColor = getColor(borderBottomColor);
51
+ styleObj.borderLeftColor = getColor(borderLeftColor);
52
+ styleObj.borderStartColor = getColor(borderStartColor);
53
+ styleObj.borderEndColor = getColor(borderEndColor);
54
+ styleObj.borderRadius = getRadius(radius);
55
+ styleObj.borderTopLeftRadius = getRadius(topLeftRadius);
56
+ styleObj.borderTopRightRadius = getRadius(topRightRadius);
57
+ styleObj.borderBottomLeftRadius = getRadius(bottomLeftRadius);
58
+ styleObj.borderBottomRightRadius = getRadius(bottomRightRadius);
59
+ styleObj.borderTopStartRadius = getRadius(topStartRadius);
60
+ styleObj.borderTopEndRadius = getRadius(topEndRadius);
61
+ styleObj.borderBottomStartRadius = getRadius(bottomStartRadius);
62
+ styleObj.borderBottomEndRadius = getRadius(bottomEndRadius);
63
+ styleObj.position = position;
64
+ styleObj.top = getSpacing(top);
65
+ styleObj.right = getSpacing(right);
66
+ styleObj.bottom = getSpacing(bottom);
67
+ styleObj.left = getSpacing(left);
68
+ styleObj.start = getSpacing(start);
69
+ styleObj.end = getSpacing(end);
70
+ styleObj.backgroundColor = getColor(bg, bgOpacity);
71
+ styleObj.opacity = opacity;
72
+ styleObj.zIndex = zIndex;
73
+ styleObj.overflow = overflow;
74
+ return styleObj;
75
+ }, [
76
+ fullWidth,
77
+ fullHeight,
78
+ h,
79
+ minH,
80
+ maxH,
81
+ w,
82
+ minW,
83
+ maxW,
84
+ m,
85
+ mt,
86
+ mr,
87
+ mb,
88
+ ml,
89
+ ms,
90
+ me,
91
+ mh,
92
+ mv,
93
+ p,
94
+ pt,
95
+ pr,
96
+ pb,
97
+ pl,
98
+ ps,
99
+ pe,
100
+ ph,
101
+ pv,
102
+ borderStyle,
103
+ border,
104
+ borderTop,
105
+ borderRight,
106
+ borderBottom,
107
+ borderLeft,
108
+ borderStart,
109
+ borderEnd,
110
+ borderColor,
111
+ borderTopColor,
112
+ borderRightColor,
113
+ borderBottomColor,
114
+ borderLeftColor,
115
+ borderStartColor,
116
+ borderEndColor,
117
+ radius,
118
+ topLeftRadius,
119
+ topRightRadius,
120
+ bottomLeftRadius,
121
+ bottomRightRadius,
122
+ topStartRadius,
123
+ topEndRadius,
124
+ bottomStartRadius,
125
+ bottomEndRadius,
126
+ position,
127
+ top,
128
+ right,
129
+ bottom,
130
+ left,
131
+ start,
132
+ end,
133
+ bg,
134
+ bgOpacity,
135
+ opacity,
136
+ zIndex,
137
+ overflow
138
+ ]);
139
+ return boxStyle;
140
+ };
141
+ export { useBoxStyle };
@@ -0,0 +1,292 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ import type { RadiusType, SpacingType, UXColor } from '@particle-network/ui-shared';
3
+ export interface UseBoxProps {
4
+ /**
5
+ * Shorthand for the `width=100%` style property.
6
+ */
7
+ fullWidth?: boolean;
8
+ /**
9
+ * Shorthand for the `height=100%` style property.
10
+ */
11
+ fullHeight?: boolean;
12
+ /**
13
+ * Shorthand for the `height` style property.
14
+ */
15
+ h?: SpacingType;
16
+ /**
17
+ * Shorthand for the `minHeight` style property.
18
+ */
19
+ minH?: SpacingType;
20
+ /**
21
+ * Shorthand for the `maxHeight` style property.
22
+ */
23
+ maxH?: SpacingType;
24
+ /**
25
+ * Shorthand for the `width` style property.
26
+ */
27
+ w?: SpacingType;
28
+ /**
29
+ * Shorthand for the `minWidth` style property.
30
+ */
31
+ minW?: SpacingType;
32
+ /**
33
+ * Shorthand for the `maxWidth` style property.
34
+ */
35
+ maxW?: SpacingType;
36
+ /**
37
+ * Shorthand for the `margin` style property.
38
+ */
39
+ m?: SpacingType;
40
+ /**
41
+ * Shorthand for the `marginTop` style property.
42
+ */
43
+ mt?: SpacingType;
44
+ /**
45
+ * Shorthand for the `marginRight` style property.
46
+ */
47
+ mr?: SpacingType;
48
+ /**
49
+ * Shorthand for the `marginBottom` style property.
50
+ */
51
+ mb?: SpacingType;
52
+ /**
53
+ * Shorthand for the `marginLeft` style property.
54
+ */
55
+ ml?: SpacingType;
56
+ /**
57
+ * Shorthand for the `marginStart` style property.
58
+ */
59
+ ms?: SpacingType;
60
+ /**
61
+ * Shorthand for the `marginEnd` style property.
62
+ */
63
+ me?: SpacingType;
64
+ /**
65
+ * Shorthand for the `marginHorizontal` style property.
66
+ */
67
+ mh?: SpacingType;
68
+ /**
69
+ * Shorthand for the `marginVertical` style property.
70
+ */
71
+ mv?: SpacingType;
72
+ /**
73
+ * Shorthand for the `padding` style property.
74
+ */
75
+ p?: SpacingType;
76
+ /**
77
+ * Shorthand for the `paddingTop` style property.
78
+ */
79
+ pt?: SpacingType;
80
+ /**
81
+ * Shorthand for the `paddingRight` style property.
82
+ */
83
+ pr?: SpacingType;
84
+ /**
85
+ * Shorthand for the `paddingBottom` style property.
86
+ */
87
+ pb?: SpacingType;
88
+ /**
89
+ * Shorthand for the `paddingLeft` style property.
90
+ */
91
+ pl?: SpacingType;
92
+ /**
93
+ * Shorthand for the `paddingStart` style property.
94
+ */
95
+ ps?: SpacingType;
96
+ /**
97
+ * Shorthand for the `paddingEnd` style property.
98
+ */
99
+ pe?: SpacingType;
100
+ /**
101
+ * Shorthand for the `paddingHorizontal` style property.
102
+ */
103
+ ph?: SpacingType;
104
+ /**
105
+ * Shorthand for the `paddingVertical` style property.
106
+ */
107
+ pv?: SpacingType;
108
+ /**
109
+ * Shorthand for the `borderStyle` style property.
110
+ */
111
+ borderStyle?: ViewStyle['borderStyle'];
112
+ /**
113
+ * Shorthand for the `borderWidth` style property.
114
+ */
115
+ border?: ViewStyle['borderWidth'];
116
+ /**
117
+ * Shorthand for the `borderTopWidth` style property.
118
+ */
119
+ borderTop?: ViewStyle['borderTopWidth'];
120
+ /**
121
+ * Shorthand for the `borderRightWidth` style property.
122
+ */
123
+ borderRight?: ViewStyle['borderRightWidth'];
124
+ /**
125
+ * Shorthand for the `borderBottomWidth` style property.
126
+ */
127
+ borderBottom?: ViewStyle['borderBottomWidth'];
128
+ /**
129
+ * Shorthand for the `borderLeftWidth` style property.
130
+ */
131
+ borderLeft?: ViewStyle['borderLeftWidth'];
132
+ /**
133
+ * Shorthand for the `borderStartWidth` style property.
134
+ */
135
+ borderStart?: ViewStyle['borderStartWidth'];
136
+ /**
137
+ * Shorthand for the `borderEndWidth` style property.
138
+ */
139
+ borderEnd?: ViewStyle['borderEndWidth'];
140
+ /**
141
+ * Shorthand for the `borderColor` style property.
142
+ *
143
+ * | color | dark | light |
144
+ * | :--------- | :-------- | :-------- |
145
+ * | default | #FFFFFF | #000000 |
146
+ * | foreground | #FFFFFF | #000000 |
147
+ * | white | #FFFFFF | #FFFFFF |
148
+ * | secondary | #A1A1AA | #767A80 |
149
+ * | tertiary | #4E4E56 | #C0C0C9 |
150
+ * | primary | #D745FF | #000000 |
151
+ * | success | #45B167 | #2E9F4A |
152
+ * | danger | #E84A5A | #DE4A40 |
153
+ * | alert | #F57733 | #E65E16 |
154
+ * | warning | #FF9821 | #FF9821 |
155
+ * | gold | #FFB800 | #F38300 |
156
+ */
157
+ borderColor?: UXColor;
158
+ /**
159
+ * Shorthand for the `borderTopColor` style property.
160
+ */
161
+ borderTopColor?: UXColor;
162
+ /**
163
+ * Shorthand for the `borderRightColor` style property.
164
+ */
165
+ borderRightColor?: UXColor;
166
+ /**
167
+ * Shorthand for the `borderBottomColor` style property.
168
+ */
169
+ borderBottomColor?: UXColor;
170
+ /**
171
+ * Shorthand for the `borderLeftColor` style property.
172
+ */
173
+ borderLeftColor?: UXColor;
174
+ /**
175
+ * Shorthand for the `borderStartColor` style property.
176
+ */
177
+ borderStartColor?: UXColor;
178
+ /**
179
+ * Shorthand for the `borderEndColor` style property.
180
+ */
181
+ borderEndColor?: UXColor;
182
+ /**
183
+ * Shorthand for the `borderRadius` style property.
184
+ */
185
+ radius?: RadiusType;
186
+ /**
187
+ * Shorthand for the `borderTopLeftRadius` style property.
188
+ */
189
+ topLeftRadius?: RadiusType;
190
+ /**
191
+ * Shorthand for the `borderTopRightRadius` style property.
192
+ */
193
+ topRightRadius?: RadiusType;
194
+ /**
195
+ * Shorthand for the `borderBottomLeftRadius` style property.
196
+ */
197
+ bottomLeftRadius?: RadiusType;
198
+ /**
199
+ * Shorthand for the `borderBottomRightRadius` style property.
200
+ */
201
+ bottomRightRadius?: RadiusType;
202
+ /**
203
+ * Shorthand for the `borderTopStartRadius` style property.
204
+ */
205
+ topStartRadius?: RadiusType;
206
+ /**
207
+ * Shorthand for the `borderTopEndRadius` style property.
208
+ */
209
+ topEndRadius?: RadiusType;
210
+ /**
211
+ * Shorthand for the `borderBottomStartRadius` style property.
212
+ */
213
+ bottomStartRadius?: RadiusType;
214
+ /**
215
+ * Shorthand for the `borderBottomEndRadius` style property.
216
+ */
217
+ bottomEndRadius?: RadiusType;
218
+ /**
219
+ * Shorthand for the `position` style property.
220
+ */
221
+ position?: ViewStyle['position'];
222
+ /**
223
+ * Shorthand for the `top` style property.
224
+ */
225
+ top?: SpacingType;
226
+ /**
227
+ * Shorthand for the `right` style property.
228
+ */
229
+ right?: SpacingType;
230
+ /**
231
+ * Shorthand for the `bottom` style property.
232
+ */
233
+ bottom?: SpacingType;
234
+ /**
235
+ * Shorthand for the `left` style property.
236
+ */
237
+ left?: SpacingType;
238
+ /**
239
+ * Shorthand for the `start` style property.
240
+ */
241
+ start?: SpacingType;
242
+ /**
243
+ * Shorthand for the `end` style property.
244
+ */
245
+ end?: SpacingType;
246
+ /**
247
+ * Shorthand for the `backgroundColor` style property.
248
+ *
249
+ * - Background Color
250
+ * | color | dark | light |
251
+ * | :--------- | :----------- | :---------- |
252
+ * | bg-default | #000000 | #FFFFFF |
253
+ * | bg-200 | #1F1F23 | #E8E8ED |
254
+ * | bg-300 | #17171C | #F0F0F2 |
255
+ * | bg-400 | #0F0F0F | #F8F8FA |
256
+ * | divider | #282828 | #E0E0E6 |
257
+ * | transparent | transparent | transparent |
258
+ *
259
+ * - Foreground Color
260
+ * | color | dark | light |
261
+ * | :--------- | :-------- | :-------- |
262
+ * | default | #FFFFFF | #000000 |
263
+ * | foreground | #FFFFFF | #000000 |
264
+ * | white | #FFFFFF | #FFFFFF |
265
+ * | secondary | #A1A1AA | #767A80 |
266
+ * | tertiary | #4E4E56 | #C0C0C9 |
267
+ * | primary | #D745FF | #000000 |
268
+ * | success | #45B167 | #2E9F4A |
269
+ * | danger | #E84A5A | #DE4A40 |
270
+ * | alert | #F57733 | #E65E16 |
271
+ * | warning | #FF9821 | #FF9821 |
272
+ * | gold | #FFB800 | #F38300 |
273
+ */
274
+ bg?: UXColor;
275
+ /**
276
+ * 背景色透明度
277
+ * @example bgOpacity={0.2}
278
+ */
279
+ bgOpacity?: number;
280
+ /**
281
+ * Shorthand for the `opacity` style property.
282
+ */
283
+ opacity?: ViewStyle['opacity'];
284
+ /**
285
+ * Shorthand for the `zIndex` style property.
286
+ */
287
+ zIndex?: ViewStyle['zIndex'];
288
+ /**
289
+ * Shorthand for the `overflow` style property.
290
+ */
291
+ overflow?: ViewStyle['overflow'];
292
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { View } from 'react-native';
3
+ import { type FlexProps } from '..';
4
+ export type CenterProps = Omit<FlexProps, 'justify' | 'align'>;
5
+ export declare const Center: React.ForwardRefExoticComponent<CenterProps & React.RefAttributes<View>>;
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { Flex } from "../index.js";
4
+ const Center = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Flex, {
5
+ ref: ref,
6
+ center: true,
7
+ ...props
8
+ }));
9
+ Center.displayName = 'UXCenter';
10
+ export { Center };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { View } from 'react-native';
3
+ import { type SquareProps } from '..';
4
+ export type CircleProps = SquareProps;
5
+ export declare const Circle: React.ForwardRefExoticComponent<Omit<import("..").CenterProps, "h" | "w"> & {
6
+ size?: number;
7
+ } & React.RefAttributes<View>>;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { Square } from "../index.js";
4
+ const Circle = /*#__PURE__*/ forwardRef((props, ref)=>{
5
+ const { size, ...restProps } = props;
6
+ return /*#__PURE__*/ jsx(Square, {
7
+ ref: ref,
8
+ radius: "full",
9
+ size: size,
10
+ ...restProps
11
+ });
12
+ });
13
+ Circle.displayName = 'UXCircle';
14
+ export { Circle };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { View } from 'react-native';
3
+ import type { BoxProps } from '../Box';
4
+ import type { UseFlexProps } from './useFlex.type';
5
+ export type FlexProps = UseFlexProps & BoxProps;
6
+ export declare const Flex: React.ForwardRefExoticComponent<UseFlexProps & BoxProps & React.RefAttributes<View>>;
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { Box } from "../Box/index.js";
4
+ import { useFlexStyle } from "./useFlex.style.js";
5
+ const Flex = /*#__PURE__*/ forwardRef((props, ref)=>{
6
+ const { fill, vertical, gap, inline, center, direction = 'row', justify, items, self, content, wrap, basis, grow, shrink, style, ...restProps } = props;
7
+ const flexStyle = useFlexStyle({
8
+ fill,
9
+ vertical,
10
+ gap,
11
+ inline,
12
+ center,
13
+ direction,
14
+ justify,
15
+ items,
16
+ self,
17
+ content,
18
+ wrap,
19
+ basis,
20
+ grow,
21
+ shrink
22
+ });
23
+ return /*#__PURE__*/ jsx(Box, {
24
+ ref: ref,
25
+ style: [
26
+ flexStyle,
27
+ style
28
+ ],
29
+ ...restProps
30
+ });
31
+ });
32
+ Flex.displayName = 'UXFlex';
33
+ export { Flex };
@@ -0,0 +1,4 @@
1
+ export * from './flex';
2
+ export * from './useFlex.style';
3
+ export type * from './useFlex.type';
4
+ export * from './useFlexBox.style';
@@ -0,0 +1,3 @@
1
+ export * from "./flex.js";
2
+ export * from "./useFlex.style.js";
3
+ export * from "./useFlexBox.style.js";
@@ -0,0 +1,3 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ import type { UseFlexProps } from './useFlex.type';
3
+ export declare const useFlexStyle: (props: UseFlexProps) => ViewStyle;
@@ -0,0 +1,122 @@
1
+ import { useMemo } from "react";
2
+ import { useSpacing } from "../../../hooks/index.js";
3
+ const useFlexStyle = (props)=>{
4
+ const { fill, vertical, gap, inline, center, direction = 'row', justify, items, self, content, wrap, basis, grow, shrink } = props;
5
+ const { getSpacing } = useSpacing();
6
+ const flex = useMemo(()=>{
7
+ if ('boolean' == typeof fill) return fill ? 1 : void 0;
8
+ return fill;
9
+ }, [
10
+ fill
11
+ ]);
12
+ const flexGap = useMemo(()=>getSpacing(gap), [
13
+ gap
14
+ ]);
15
+ const flexDirection = useMemo(()=>{
16
+ if (inline) return 'row';
17
+ if (vertical) return 'column';
18
+ if ('col' === direction) return 'column';
19
+ if ('col-reverse' === direction) return 'column-reverse';
20
+ return direction;
21
+ }, [
22
+ inline,
23
+ vertical,
24
+ direction
25
+ ]);
26
+ const justifyContent = useMemo(()=>{
27
+ if (center) return 'center';
28
+ switch(justify){
29
+ case 'start':
30
+ return 'flex-start';
31
+ case 'end':
32
+ return 'flex-end';
33
+ case 'between':
34
+ return 'space-between';
35
+ case 'around':
36
+ return 'space-around';
37
+ case 'evenly':
38
+ return 'space-evenly';
39
+ default:
40
+ return justify;
41
+ }
42
+ }, [
43
+ center,
44
+ justify
45
+ ]);
46
+ const alignItems = useMemo(()=>{
47
+ if (center) return 'center';
48
+ switch(items){
49
+ case 'start':
50
+ return 'flex-start';
51
+ case 'end':
52
+ return 'flex-end';
53
+ default:
54
+ return items;
55
+ }
56
+ }, [
57
+ center,
58
+ items
59
+ ]);
60
+ const alignSelf = useMemo(()=>{
61
+ switch(self){
62
+ case 'start':
63
+ return 'flex-start';
64
+ case 'end':
65
+ return 'flex-end';
66
+ default:
67
+ return self;
68
+ }
69
+ }, [
70
+ self
71
+ ]);
72
+ const alignContent = useMemo(()=>{
73
+ switch(content){
74
+ case 'start':
75
+ return 'flex-start';
76
+ case 'end':
77
+ return 'flex-end';
78
+ case 'between':
79
+ return 'space-between';
80
+ case 'around':
81
+ return 'space-around';
82
+ default:
83
+ return content;
84
+ }
85
+ }, [
86
+ content
87
+ ]);
88
+ const flexWrap = useMemo(()=>{
89
+ if (!wrap) return;
90
+ if (true === wrap) return 'wrap';
91
+ return wrap;
92
+ }, [
93
+ wrap
94
+ ]);
95
+ const flexStyle = useMemo(()=>({
96
+ flex,
97
+ gap: flexGap,
98
+ flexDirection,
99
+ justifyContent,
100
+ alignItems,
101
+ alignSelf,
102
+ alignContent,
103
+ flexWrap,
104
+ flexBasis: basis,
105
+ flexGrow: grow,
106
+ flexShrink: shrink
107
+ }), [
108
+ flex,
109
+ flexGap,
110
+ flexDirection,
111
+ justifyContent,
112
+ alignItems,
113
+ alignSelf,
114
+ alignContent,
115
+ flexWrap,
116
+ basis,
117
+ grow,
118
+ shrink
119
+ ]);
120
+ return flexStyle;
121
+ };
122
+ export { useFlexStyle };