@xaui/native 0.2.8 → 0.9.1-alpha.1

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 (234) hide show
  1. package/dist/chunk-KFCORXWW.cjs +150 -0
  2. package/dist/chunk-M7P46XKI.cjs +100 -0
  3. package/dist/chunk-N357EQCZ.js +150 -0
  4. package/dist/chunk-NHPQQQ7P.cjs +734 -0
  5. package/dist/chunk-PBVPOX7D.js +734 -0
  6. package/dist/chunk-RBNCR5KB.js +100 -0
  7. package/dist/index.cjs +40 -1
  8. package/dist/index.d.cts +5 -2
  9. package/dist/index.d.ts +5 -2
  10. package/dist/index.js +40 -0
  11. package/dist/system/index.cjs +7 -0
  12. package/dist/system/index.d.cts +83 -0
  13. package/dist/system/index.d.ts +83 -0
  14. package/dist/system/index.js +7 -0
  15. package/dist/theme/index.cjs +36 -0
  16. package/dist/theme/index.d.cts +539 -0
  17. package/dist/theme/index.d.ts +539 -0
  18. package/dist/theme/index.js +36 -0
  19. package/dist/theme.type-B3ODSLbB.d.cts +153 -0
  20. package/dist/theme.type-B3ODSLbB.d.ts +153 -0
  21. package/package.json +30 -248
  22. package/README.md +0 -178
  23. package/dist/alert/index.cjs +0 -340
  24. package/dist/alert/index.d.cts +0 -46
  25. package/dist/alert/index.d.ts +0 -46
  26. package/dist/alert/index.js +0 -340
  27. package/dist/app-bar/index.cjs +0 -148
  28. package/dist/app-bar/index.d.cts +0 -59
  29. package/dist/app-bar/index.d.ts +0 -59
  30. package/dist/app-bar/index.js +0 -148
  31. package/dist/autocomplete/index.cjs +0 -1122
  32. package/dist/autocomplete/index.d.cts +0 -88
  33. package/dist/autocomplete/index.d.ts +0 -88
  34. package/dist/autocomplete/index.js +0 -1122
  35. package/dist/avatar/index.cjs +0 -281
  36. package/dist/avatar/index.d.cts +0 -123
  37. package/dist/avatar/index.d.ts +0 -123
  38. package/dist/avatar/index.js +0 -281
  39. package/dist/badge/index.cjs +0 -197
  40. package/dist/badge/index.d.cts +0 -94
  41. package/dist/badge/index.d.ts +0 -94
  42. package/dist/badge/index.js +0 -197
  43. package/dist/bottom-sheet/index.cjs +0 -9
  44. package/dist/bottom-sheet/index.d.cts +0 -84
  45. package/dist/bottom-sheet/index.d.ts +0 -84
  46. package/dist/bottom-sheet/index.js +0 -9
  47. package/dist/bottom-tab-bar/index.cjs +0 -497
  48. package/dist/bottom-tab-bar/index.d.cts +0 -211
  49. package/dist/bottom-tab-bar/index.d.ts +0 -211
  50. package/dist/bottom-tab-bar/index.js +0 -497
  51. package/dist/button/index.cjs +0 -392
  52. package/dist/button/index.d.cts +0 -174
  53. package/dist/button/index.d.ts +0 -174
  54. package/dist/button/index.js +0 -392
  55. package/dist/button.type-j1ZdkkSl.d.cts +0 -4
  56. package/dist/button.type-j1ZdkkSl.d.ts +0 -4
  57. package/dist/card/index.cjs +0 -338
  58. package/dist/card/index.d.cts +0 -191
  59. package/dist/card/index.d.ts +0 -191
  60. package/dist/card/index.js +0 -338
  61. package/dist/carousel/index.cjs +0 -381
  62. package/dist/carousel/index.d.cts +0 -147
  63. package/dist/carousel/index.d.ts +0 -147
  64. package/dist/carousel/index.js +0 -381
  65. package/dist/chart/index.cjs +0 -1026
  66. package/dist/chart/index.d.cts +0 -218
  67. package/dist/chart/index.d.ts +0 -218
  68. package/dist/chart/index.js +0 -1026
  69. package/dist/checkbox/index.cjs +0 -443
  70. package/dist/checkbox/index.d.cts +0 -73
  71. package/dist/checkbox/index.d.ts +0 -73
  72. package/dist/checkbox/index.js +0 -443
  73. package/dist/chip/index.cjs +0 -503
  74. package/dist/chip/index.d.cts +0 -195
  75. package/dist/chip/index.d.ts +0 -195
  76. package/dist/chip/index.js +0 -503
  77. package/dist/chunk-4JFWQ5XT.js +0 -368
  78. package/dist/chunk-56RPWZD2.cjs +0 -9
  79. package/dist/chunk-7UFBLUMV.cjs +0 -136
  80. package/dist/chunk-A45TVXU5.js +0 -337
  81. package/dist/chunk-BYWUAPC4.cjs +0 -368
  82. package/dist/chunk-DECMUMCI.js +0 -0
  83. package/dist/chunk-DHSTKO3K.cjs +0 -19
  84. package/dist/chunk-DJ4Q37UT.cjs +0 -75
  85. package/dist/chunk-EUQDGTST.cjs +0 -1
  86. package/dist/chunk-GBHQCAKW.js +0 -19
  87. package/dist/chunk-RBSA4NH4.js +0 -136
  88. package/dist/chunk-SHBDANQN.js +0 -9
  89. package/dist/chunk-UGEINZM7.cjs +0 -290
  90. package/dist/chunk-UU4HHBDN.js +0 -290
  91. package/dist/chunk-VSZEXOUN.js +0 -384
  92. package/dist/chunk-YIEUN3G5.cjs +0 -384
  93. package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
  94. package/dist/chunk-ZY7IUTAT.js +0 -75
  95. package/dist/color-picker/index.cjs +0 -457
  96. package/dist/color-picker/index.d.cts +0 -124
  97. package/dist/color-picker/index.d.ts +0 -124
  98. package/dist/color-picker/index.js +0 -457
  99. package/dist/core/index.cjs +0 -24
  100. package/dist/core/index.d.cts +0 -28
  101. package/dist/core/index.d.ts +0 -28
  102. package/dist/core/index.js +0 -24
  103. package/dist/datepicker/index.cjs +0 -1625
  104. package/dist/datepicker/index.d.cts +0 -45
  105. package/dist/datepicker/index.d.ts +0 -45
  106. package/dist/datepicker/index.js +0 -1625
  107. package/dist/dialog/index.cjs +0 -372
  108. package/dist/dialog/index.d.cts +0 -151
  109. package/dist/dialog/index.d.ts +0 -151
  110. package/dist/dialog/index.js +0 -372
  111. package/dist/divider/index.cjs +0 -8
  112. package/dist/divider/index.d.cts +0 -30
  113. package/dist/divider/index.d.ts +0 -30
  114. package/dist/divider/index.js +0 -8
  115. package/dist/drawer/index.cjs +0 -237
  116. package/dist/drawer/index.d.cts +0 -58
  117. package/dist/drawer/index.d.ts +0 -58
  118. package/dist/drawer/index.js +0 -237
  119. package/dist/expansion-panel/index.cjs +0 -441
  120. package/dist/expansion-panel/index.d.cts +0 -153
  121. package/dist/expansion-panel/index.d.ts +0 -153
  122. package/dist/expansion-panel/index.js +0 -441
  123. package/dist/fab/index.cjs +0 -9
  124. package/dist/fab/index.d.cts +0 -10
  125. package/dist/fab/index.d.ts +0 -10
  126. package/dist/fab/index.js +0 -9
  127. package/dist/fab-menu/index.cjs +0 -330
  128. package/dist/fab-menu/index.d.cts +0 -125
  129. package/dist/fab-menu/index.d.ts +0 -125
  130. package/dist/fab-menu/index.js +0 -330
  131. package/dist/fab.type-CkUHmXU_.d.ts +0 -86
  132. package/dist/fab.type-DN0vtAh6.d.cts +0 -86
  133. package/dist/feature-discovery/index.cjs +0 -464
  134. package/dist/feature-discovery/index.d.cts +0 -82
  135. package/dist/feature-discovery/index.d.ts +0 -82
  136. package/dist/feature-discovery/index.js +0 -464
  137. package/dist/indicator/index.cjs +0 -8
  138. package/dist/indicator/index.d.cts +0 -47
  139. package/dist/indicator/index.d.ts +0 -47
  140. package/dist/indicator/index.js +0 -8
  141. package/dist/input/index.cjs +0 -1462
  142. package/dist/input/index.d.cts +0 -522
  143. package/dist/input/index.d.ts +0 -522
  144. package/dist/input/index.js +0 -1462
  145. package/dist/input-trigger/index.cjs +0 -197
  146. package/dist/input-trigger/index.d.cts +0 -11
  147. package/dist/input-trigger/index.d.ts +0 -11
  148. package/dist/input-trigger/index.js +0 -197
  149. package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
  150. package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
  151. package/dist/list/index.cjs +0 -395
  152. package/dist/list/index.d.cts +0 -188
  153. package/dist/list/index.d.ts +0 -188
  154. package/dist/list/index.js +0 -395
  155. package/dist/menu/index.cjs +0 -316
  156. package/dist/menu/index.d.cts +0 -115
  157. package/dist/menu/index.d.ts +0 -115
  158. package/dist/menu/index.js +0 -316
  159. package/dist/menubox/index.cjs +0 -297
  160. package/dist/menubox/index.d.cts +0 -98
  161. package/dist/menubox/index.d.ts +0 -98
  162. package/dist/menubox/index.js +0 -297
  163. package/dist/pager/index.cjs +0 -205
  164. package/dist/pager/index.d.cts +0 -93
  165. package/dist/pager/index.d.ts +0 -93
  166. package/dist/pager/index.js +0 -205
  167. package/dist/picker/index.cjs +0 -244
  168. package/dist/picker/index.d.cts +0 -121
  169. package/dist/picker/index.d.ts +0 -121
  170. package/dist/picker/index.js +0 -244
  171. package/dist/progress/index.cjs +0 -219
  172. package/dist/progress/index.d.cts +0 -47
  173. package/dist/progress/index.d.ts +0 -47
  174. package/dist/progress/index.js +0 -219
  175. package/dist/radio/index.cjs +0 -465
  176. package/dist/radio/index.d.cts +0 -145
  177. package/dist/radio/index.d.ts +0 -145
  178. package/dist/radio/index.js +0 -465
  179. package/dist/refresh-control/index.cjs +0 -45
  180. package/dist/refresh-control/index.d.cts +0 -55
  181. package/dist/refresh-control/index.d.ts +0 -55
  182. package/dist/refresh-control/index.js +0 -45
  183. package/dist/segment-button/index.cjs +0 -405
  184. package/dist/segment-button/index.d.cts +0 -141
  185. package/dist/segment-button/index.d.ts +0 -141
  186. package/dist/segment-button/index.js +0 -405
  187. package/dist/select/index.cjs +0 -878
  188. package/dist/select/index.d.cts +0 -192
  189. package/dist/select/index.d.ts +0 -192
  190. package/dist/select/index.js +0 -878
  191. package/dist/skeleton/index.cjs +0 -89
  192. package/dist/skeleton/index.d.cts +0 -45
  193. package/dist/skeleton/index.d.ts +0 -45
  194. package/dist/skeleton/index.js +0 -89
  195. package/dist/slider/index.cjs +0 -576
  196. package/dist/slider/index.d.cts +0 -171
  197. package/dist/slider/index.d.ts +0 -171
  198. package/dist/slider/index.js +0 -576
  199. package/dist/snackbar/index.cjs +0 -436
  200. package/dist/snackbar/index.d.cts +0 -174
  201. package/dist/snackbar/index.d.ts +0 -174
  202. package/dist/snackbar/index.js +0 -436
  203. package/dist/snippet/index.cjs +0 -314
  204. package/dist/snippet/index.d.cts +0 -95
  205. package/dist/snippet/index.d.ts +0 -95
  206. package/dist/snippet/index.js +0 -314
  207. package/dist/stepper/index.cjs +0 -550
  208. package/dist/stepper/index.d.cts +0 -137
  209. package/dist/stepper/index.d.ts +0 -137
  210. package/dist/stepper/index.js +0 -550
  211. package/dist/switch/index.cjs +0 -358
  212. package/dist/switch/index.d.cts +0 -28
  213. package/dist/switch/index.d.ts +0 -28
  214. package/dist/switch/index.js +0 -358
  215. package/dist/tabs/index.cjs +0 -440
  216. package/dist/tabs/index.d.cts +0 -180
  217. package/dist/tabs/index.d.ts +0 -180
  218. package/dist/tabs/index.js +0 -440
  219. package/dist/timepicker/index.cjs +0 -823
  220. package/dist/timepicker/index.d.cts +0 -215
  221. package/dist/timepicker/index.d.ts +0 -215
  222. package/dist/timepicker/index.js +0 -823
  223. package/dist/toolbar/index.cjs +0 -333
  224. package/dist/toolbar/index.d.cts +0 -100
  225. package/dist/toolbar/index.d.ts +0 -100
  226. package/dist/toolbar/index.js +0 -333
  227. package/dist/typography/index.cjs +0 -238
  228. package/dist/typography/index.d.cts +0 -113
  229. package/dist/typography/index.d.ts +0 -113
  230. package/dist/typography/index.js +0 -238
  231. package/dist/view/index.cjs +0 -1361
  232. package/dist/view/index.d.cts +0 -833
  233. package/dist/view/index.d.ts +0 -833
  234. package/dist/view/index.js +0 -1361
@@ -1,333 +0,0 @@
1
- import "../chunk-SHBDANQN.js";
2
- import {
3
- useXUITheme
4
- } from "../chunk-RBSA4NH4.js";
5
-
6
- // src/components/toolbar/toolbar.tsx
7
- import React, { useEffect } from "react";
8
- import { View } from "react-native";
9
- import Animated, {
10
- Easing,
11
- useAnimatedStyle,
12
- useSharedValue,
13
- withTiming
14
- } from "react-native-reanimated";
15
-
16
- // src/components/toolbar/toolbar.hook.ts
17
- import { useMemo } from "react";
18
- import { getSafeThemeColor, withOpacity } from "@xaui/core";
19
- var variantMap = {
20
- floating: {
21
- containerHeight: 68,
22
- containerWidth: "auto",
23
- iconSize: 26,
24
- actionSize: 40,
25
- borderRadius: 56,
26
- paddingHorizontal: 16,
27
- paddingVertical: 14,
28
- gap: 0,
29
- isElevated: true
30
- },
31
- docked: {
32
- containerHeight: 68,
33
- containerWidth: "auto",
34
- iconSize: 26,
35
- actionSize: 40,
36
- borderRadius: 0,
37
- paddingHorizontal: 16,
38
- paddingVertical: 14,
39
- gap: 0,
40
- isElevated: false
41
- },
42
- vertical: {
43
- containerHeight: "auto",
44
- containerWidth: 80,
45
- iconSize: 26,
46
- actionSize: 40,
47
- borderRadius: 0,
48
- paddingHorizontal: 16,
49
- paddingVertical: 14,
50
- gap: 0,
51
- isElevated: false
52
- }
53
- };
54
- var useToolbarVariantStyles = (variant, position) => {
55
- return useMemo(() => {
56
- const baseStyles = variantMap[variant];
57
- const isVertical = variant === "vertical";
58
- return {
59
- ...baseStyles,
60
- isVertical,
61
- position
62
- };
63
- }, [variant, position]);
64
- };
65
- var useToolbarColors = (themeColor) => {
66
- const theme = useXUITheme();
67
- const colorScheme = theme.colors[getSafeThemeColor(themeColor)];
68
- return useMemo(() => {
69
- return {
70
- background: theme.mode === "dark" ? theme.colors.default.container : theme.colors.background,
71
- divider: withOpacity(theme.colors.foreground, 0.1),
72
- title: theme.colors.foreground,
73
- subtitle: withOpacity(theme.colors.foreground, 0.72),
74
- action: colorScheme.main,
75
- pressed: withOpacity(colorScheme.main, 0.16),
76
- shadow: withOpacity(theme.colors.foreground, 0.35)
77
- };
78
- }, [colorScheme.main, theme.colors, theme.mode]);
79
- };
80
-
81
- // src/components/toolbar/toolbar.style.ts
82
- import { StyleSheet } from "react-native";
83
- var styles = StyleSheet.create({
84
- container: {
85
- position: "absolute",
86
- zIndex: 40
87
- },
88
- top: {
89
- top: 0,
90
- left: 0,
91
- right: 0
92
- },
93
- bottom: {
94
- bottom: 0,
95
- left: 0,
96
- right: 0
97
- },
98
- left: {
99
- left: 0,
100
- top: 0,
101
- bottom: 0
102
- },
103
- right: {
104
- right: 0,
105
- top: 0,
106
- bottom: 0
107
- },
108
- floating: {
109
- margin: 16
110
- },
111
- floatingBottom: {
112
- marginBottom: 16
113
- },
114
- floatingTop: {
115
- marginTop: 16
116
- },
117
- elevated: {
118
- shadowOffset: { width: 0, height: 2 },
119
- shadowOpacity: 0.15,
120
- shadowRadius: 8,
121
- elevation: 3
122
- },
123
- content: {
124
- flexDirection: "row",
125
- alignItems: "center"
126
- },
127
- contentVertical: {
128
- flexDirection: "column",
129
- alignItems: "center",
130
- justifyContent: "center"
131
- },
132
- actions: {
133
- flexDirection: "row",
134
- alignItems: "center",
135
- justifyContent: "space-between",
136
- width: "100%"
137
- },
138
- actionsVertical: {
139
- flexDirection: "column",
140
- alignItems: "center",
141
- justifyContent: "space-between",
142
- height: "100%"
143
- },
144
- actionButton: {
145
- alignItems: "center",
146
- justifyContent: "center",
147
- borderRadius: 999
148
- },
149
- disabledAction: {
150
- opacity: 0.38
151
- }
152
- });
153
-
154
- // src/components/toolbar/toolbar-context.ts
155
- import { createContext, useContext } from "react";
156
- var ToolbarContext = createContext(null);
157
- var useToolbarContext = () => {
158
- return useContext(ToolbarContext);
159
- };
160
-
161
- // src/components/toolbar/toolbar.tsx
162
- var Toolbar = ({
163
- variant = "docked",
164
- position = "top",
165
- isVisible = true,
166
- themeColor = "primary",
167
- showDivider = false,
168
- isElevated,
169
- children,
170
- style,
171
- customAppearance
172
- }) => {
173
- const variantStyles = useToolbarVariantStyles(variant, position);
174
- const colors = useToolbarColors(themeColor);
175
- const translateValue = useSharedValue(
176
- isVisible ? 0 : getInitialTranslate(position)
177
- );
178
- const opacityValue = useSharedValue(isVisible ? 1 : 0);
179
- useEffect(() => {
180
- const nextTranslate = isVisible ? 0 : getInitialTranslate(position);
181
- if (isVisible) {
182
- translateValue.value = withTiming(nextTranslate, {
183
- duration: 220,
184
- easing: Easing.out(Easing.cubic)
185
- });
186
- opacityValue.value = withTiming(1, {
187
- duration: 200,
188
- easing: Easing.out(Easing.quad)
189
- });
190
- } else {
191
- translateValue.value = withTiming(nextTranslate, {
192
- duration: 180,
193
- easing: Easing.in(Easing.cubic)
194
- });
195
- opacityValue.value = withTiming(0, {
196
- duration: 150,
197
- easing: Easing.in(Easing.quad)
198
- });
199
- }
200
- }, [isVisible, position, translateValue, opacityValue]);
201
- const animatedStyle = useAnimatedStyle(() => {
202
- const transform = position === "left" || position === "right" ? [{ translateX: translateValue.value }] : [{ translateY: translateValue.value }];
203
- return {
204
- opacity: opacityValue.value,
205
- transform
206
- };
207
- });
208
- const isVertical = variantStyles.isVertical;
209
- const shouldElevate = isElevated ?? variantStyles.isElevated;
210
- const positionStyle = position === "top" ? styles.top : position === "bottom" ? styles.bottom : position === "left" ? styles.left : styles.right;
211
- const floatingStyle = variant === "floating" ? [
212
- styles.floating,
213
- position === "bottom" && styles.floatingBottom,
214
- position === "top" && styles.floatingTop
215
- ] : null;
216
- return /* @__PURE__ */ React.createElement(
217
- ToolbarContext.Provider,
218
- {
219
- value: {
220
- actionColor: colors.action,
221
- actionPressedColor: colors.pressed,
222
- iconSize: variantStyles.iconSize,
223
- actionButtonSize: variantStyles.actionSize
224
- }
225
- },
226
- /* @__PURE__ */ React.createElement(
227
- Animated.View,
228
- {
229
- style: [
230
- styles.container,
231
- positionStyle,
232
- floatingStyle,
233
- animatedStyle,
234
- {
235
- height: variantStyles.containerHeight,
236
- width: variantStyles.containerWidth
237
- },
238
- style,
239
- customAppearance?.container
240
- ]
241
- },
242
- /* @__PURE__ */ React.createElement(
243
- View,
244
- {
245
- style: [
246
- isVertical ? styles.contentVertical : styles.content,
247
- {
248
- backgroundColor: colors.background,
249
- borderRadius: variantStyles.borderRadius,
250
- paddingHorizontal: variantStyles.paddingHorizontal,
251
- paddingVertical: variantStyles.paddingVertical,
252
- borderBottomWidth: showDivider ? 1 : 0,
253
- borderBottomColor: showDivider ? colors.divider : "transparent",
254
- height: "100%",
255
- width: "100%"
256
- },
257
- shouldElevate && [styles.elevated, { shadowColor: colors.shadow }],
258
- customAppearance?.topRow
259
- ]
260
- },
261
- /* @__PURE__ */ React.createElement(
262
- View,
263
- {
264
- style: [
265
- isVertical ? styles.actionsVertical : styles.actions,
266
- { gap: variantStyles.gap },
267
- customAppearance?.actionsContainer
268
- ]
269
- },
270
- children
271
- )
272
- )
273
- )
274
- );
275
- };
276
- function getInitialTranslate(position) {
277
- switch (position) {
278
- case "top":
279
- return -24;
280
- case "bottom":
281
- return 24;
282
- case "left":
283
- return -24;
284
- case "right":
285
- return 24;
286
- default:
287
- return 0;
288
- }
289
- }
290
-
291
- // src/components/toolbar/toolbar-action.tsx
292
- import React2 from "react";
293
- import { Pressable } from "react-native";
294
- var ToolbarAction = ({
295
- icon,
296
- isDisabled = false,
297
- style,
298
- onPress,
299
- onLongPress,
300
- accessibilityLabel,
301
- testID
302
- }) => {
303
- const context = useToolbarContext();
304
- const iconNode = typeof icon === "function" ? icon({
305
- color: context?.actionColor ?? "#000000",
306
- size: context?.iconSize ?? 26
307
- }) : icon;
308
- return /* @__PURE__ */ React2.createElement(
309
- Pressable,
310
- {
311
- onPress: isDisabled ? void 0 : onPress,
312
- onLongPress: isDisabled ? void 0 : onLongPress,
313
- accessibilityRole: "button",
314
- accessibilityLabel,
315
- testID,
316
- style: ({ pressed }) => [
317
- styles.actionButton,
318
- {
319
- width: context?.actionButtonSize ?? 40,
320
- height: context?.actionButtonSize ?? 40,
321
- backgroundColor: pressed ? context?.actionPressedColor ?? "transparent" : "transparent"
322
- },
323
- isDisabled && styles.disabledAction,
324
- style
325
- ]
326
- },
327
- iconNode
328
- );
329
- };
330
- export {
331
- Toolbar,
332
- ToolbarAction
333
- };
@@ -1,238 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-56RPWZD2.cjs');
2
-
3
-
4
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
5
-
6
- // src/components/typography/typography.tsx
7
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
8
- var _reactnative = require('react-native');
9
-
10
- // src/components/typography/typography.style.ts
11
-
12
- var styles = _reactnative.StyleSheet.create({
13
- text: {
14
- includeFontPadding: false
15
- }
16
- });
17
-
18
- // src/components/typography/text-span.context.ts
19
-
20
- var TextSpanContext = _react.createContext.call(void 0, {});
21
- var useTextSpanInheritedStyle = () => {
22
- return _react.useContext.call(void 0, TextSpanContext);
23
- };
24
-
25
- // src/components/typography/typography.hook.ts
26
-
27
- var _core = require('@xaui/core');
28
- var knownVariants = {
29
- displayLarge: true,
30
- displayMedium: true,
31
- displaySmall: true,
32
- caption: true,
33
- headlineLarge: true,
34
- headlineMedium: true,
35
- headlineSmall: true,
36
- subtitleLarge: true,
37
- subtitleMedium: true,
38
- subtitleSmall: true,
39
- bodyLarge: true,
40
- bodyMedium: true,
41
- bodySmall: true
42
- };
43
- var isKnownVariant = (variant) => {
44
- return Boolean(knownVariants[variant]);
45
- };
46
- var useTypographyColor = (themeColor) => {
47
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
48
- const color = _react.useMemo.call(void 0, () => {
49
- if (themeColor === "default") {
50
- return theme.colors.foreground;
51
- }
52
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
53
- return theme.colors[safeThemeColor].main;
54
- }, [theme, themeColor]);
55
- return color;
56
- };
57
- var useTypographyVariantStyles = (variant) => {
58
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
59
- const variantStyles = _react.useMemo.call(void 0, () => {
60
- if (!isKnownVariant(variant)) {
61
- return {
62
- fontFamily: theme.fontFamilies.body,
63
- fontSize: theme.fontSizes.md,
64
- fontWeight: theme.fontWeights.normal
65
- };
66
- }
67
- const styles2 = {
68
- displayLarge: {
69
- fontFamily: theme.fontFamilies.heading,
70
- fontSize: 72,
71
- fontWeight: theme.fontWeights.semibold
72
- },
73
- displayMedium: {
74
- fontFamily: theme.fontFamilies.heading,
75
- fontSize: 57,
76
- fontWeight: theme.fontWeights.semibold
77
- },
78
- displaySmall: {
79
- fontFamily: theme.fontFamilies.heading,
80
- fontSize: 45,
81
- fontWeight: theme.fontWeights.semibold
82
- },
83
- caption: {
84
- fontFamily: theme.fontFamilies.body,
85
- fontSize: theme.fontSizes.xs,
86
- fontWeight: theme.fontWeights.normal
87
- },
88
- headlineLarge: {
89
- fontFamily: theme.fontFamilies.heading,
90
- fontSize: theme.fontSizes["4xl"] + 3,
91
- fontWeight: theme.fontWeights.bold
92
- },
93
- headlineMedium: {
94
- fontFamily: theme.fontFamilies.heading,
95
- fontSize: theme.fontSizes["3xl"] + 3,
96
- fontWeight: theme.fontWeights.bold
97
- },
98
- headlineSmall: {
99
- fontFamily: theme.fontFamilies.heading,
100
- fontSize: theme.fontSizes["2xl"] + 3,
101
- fontWeight: theme.fontWeights.semibold
102
- },
103
- subtitleLarge: {
104
- fontFamily: theme.fontFamilies.body,
105
- fontSize: theme.fontSizes.md + 5,
106
- fontWeight: theme.fontWeights.medium
107
- },
108
- subtitleMedium: {
109
- fontFamily: theme.fontFamilies.body,
110
- fontSize: theme.fontSizes.sm + 5,
111
- fontWeight: theme.fontWeights.medium
112
- },
113
- subtitleSmall: {
114
- fontFamily: theme.fontFamilies.body,
115
- fontSize: theme.fontSizes.xs + 5,
116
- fontWeight: theme.fontWeights.medium
117
- },
118
- bodyLarge: {
119
- fontFamily: theme.fontFamilies.body,
120
- fontSize: theme.fontSizes.md,
121
- fontWeight: theme.fontWeights.normal
122
- },
123
- bodyMedium: {
124
- fontFamily: theme.fontFamilies.body,
125
- fontSize: theme.fontSizes.sm,
126
- fontWeight: theme.fontWeights.normal
127
- },
128
- bodySmall: {
129
- fontFamily: theme.fontFamilies.body,
130
- fontSize: theme.fontSizes.xs,
131
- fontWeight: theme.fontWeights.normal
132
- }
133
- };
134
- return styles2[variant];
135
- }, [theme, variant]);
136
- return variantStyles;
137
- };
138
-
139
- // src/components/typography/typography.tsx
140
- var Typography = ({
141
- children,
142
- align,
143
- themeColor = "default",
144
- variant = "bodyMedium",
145
- maxLines,
146
- overflow = "clip",
147
- color,
148
- letterSpacing,
149
- lineHeight,
150
- fontWeight,
151
- fontStyle,
152
- textDecorationLine,
153
- textTransform,
154
- style
155
- }) => {
156
- const inheritedStyle = useTextSpanInheritedStyle();
157
- const themeColorValue = useTypographyColor(themeColor);
158
- const variantStyles = useTypographyVariantStyles(variant);
159
- const resolvedAlign = _nullishCoalesce(align, () => ( inheritedStyle.align));
160
- const textStyleOverrides = {
161
- color: _nullishCoalesce(_nullishCoalesce(color, () => ( inheritedStyle.color)), () => ( themeColorValue)),
162
- letterSpacing,
163
- lineHeight,
164
- fontWeight: _nullishCoalesce(fontWeight, () => ( inheritedStyle.fontWeight)),
165
- fontStyle: _nullishCoalesce(fontStyle, () => ( inheritedStyle.fontStyle)),
166
- textDecorationLine,
167
- textTransform: _nullishCoalesce(textTransform, () => ( inheritedStyle.textTransform))
168
- };
169
- const ellipsizeMode = _react.useMemo.call(void 0, () => {
170
- if (!maxLines) return void 0;
171
- if (overflow === "clip") return "clip";
172
- return "tail";
173
- }, [maxLines, overflow]);
174
- return /* @__PURE__ */ _react2.default.createElement(
175
- _reactnative.Text,
176
- {
177
- numberOfLines: maxLines,
178
- ellipsizeMode,
179
- style: [
180
- styles.text,
181
- variantStyles,
182
- resolvedAlign && { textAlign: resolvedAlign },
183
- textStyleOverrides,
184
- inheritedStyle.spacing != null ? { marginRight: inheritedStyle.spacing } : void 0,
185
- style
186
- ]
187
- },
188
- children
189
- );
190
- };
191
-
192
- // src/components/typography/text-span.tsx
193
-
194
-
195
- var alignToTextAlign = {
196
- left: "left",
197
- center: "center",
198
- right: "right",
199
- justify: "justify"
200
- };
201
- var TextSpan = ({
202
- children,
203
- color,
204
- fontWeight,
205
- fontStyle,
206
- textTransform,
207
- spacing,
208
- align,
209
- backgroundColor,
210
- style
211
- }) => {
212
- const inheritedTextStyle = {
213
- color,
214
- fontWeight,
215
- fontStyle,
216
- textTransform,
217
- align,
218
- spacing
219
- };
220
- return /* @__PURE__ */ _react2.default.createElement(TextSpanContext.Provider, { value: inheritedTextStyle }, /* @__PURE__ */ _react2.default.createElement(
221
- _reactnative.Text,
222
- {
223
- style: [
224
- {
225
- ...align ? { textAlign: alignToTextAlign[align] } : {},
226
- ...backgroundColor ? { backgroundColor } : {}
227
- },
228
- style
229
- ]
230
- },
231
- children
232
- ));
233
- };
234
- TextSpan.displayName = "TextSpan";
235
-
236
-
237
-
238
- exports.TextSpan = TextSpan; exports.Typography = Typography;
@@ -1,113 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { StyleProp, TextStyle } from 'react-native';
3
- import { ThemeColor } from '@xaui/core/types';
4
-
5
- type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
6
- type TypographyVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'caption' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'subtitleLarge' | 'subtitleMedium' | 'subtitleSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
7
- type TypographyProps = {
8
- /**
9
- * The content to display inside the typography component.
10
- */
11
- children: ReactNode;
12
- /**
13
- * The text alignment.
14
- */
15
- align?: TypographyAlign;
16
- /**
17
- * The theme color for the text.
18
- * @default 'default'
19
- */
20
- themeColor?: ThemeColor;
21
- /**
22
- * The typography variant.
23
- * @default 'bodyMedium'
24
- */
25
- variant?: TypographyVariant;
26
- /**
27
- * Maximum number of lines to display.
28
- */
29
- maxLines?: number;
30
- /**
31
- * How to handle text overflow when maxLines is set.
32
- * @default 'clip'
33
- */
34
- overflow?: 'clip' | 'ellipsis';
35
- /**
36
- * Custom styles for the text.
37
- */
38
- style?: StyleProp<TextStyle>;
39
- /**
40
- * Custom text color override.
41
- */
42
- color?: TextStyle['color'];
43
- /**
44
- * The spacing between characters.
45
- */
46
- letterSpacing?: number;
47
- /**
48
- * Line height for the text.
49
- */
50
- lineHeight?: TextStyle['lineHeight'];
51
- /**
52
- * The text weight.
53
- */
54
- fontWeight?: TextStyle['fontWeight'];
55
- /**
56
- * The text style.
57
- */
58
- fontStyle?: TextStyle['fontStyle'];
59
- /**
60
- * Text decoration line.
61
- */
62
- textDecorationLine?: TextStyle['textDecorationLine'];
63
- /**
64
- * Text transform mode.
65
- */
66
- textTransform?: TextStyle['textTransform'];
67
- };
68
-
69
- declare const Typography: React.FC<TypographyProps>;
70
-
71
- type TextSpanAlign = TypographyAlign;
72
- type TextSpanProps = {
73
- /**
74
- * The content to display inside the text span.
75
- */
76
- children: ReactNode;
77
- /**
78
- * Inherited text color for nested Typography.
79
- */
80
- color?: TextStyle['color'];
81
- /**
82
- * Inherited text weight for nested Typography.
83
- */
84
- fontWeight?: TextStyle['fontWeight'];
85
- /**
86
- * Inherited text style for nested Typography.
87
- */
88
- fontStyle?: TextStyle['fontStyle'];
89
- /**
90
- * Inherited text transform for nested Typography.
91
- */
92
- textTransform?: TextStyle['textTransform'];
93
- /**
94
- * Spacing between children.
95
- */
96
- spacing?: number;
97
- /**
98
- * Text alignment for all nested typography unless overridden.
99
- */
100
- align?: TextSpanAlign;
101
- /**
102
- * Background color for the text span container.
103
- */
104
- backgroundColor?: TextStyle['backgroundColor'];
105
- /**
106
- * Custom styles for the text span container.
107
- */
108
- style?: StyleProp<TextStyle>;
109
- };
110
-
111
- declare const TextSpan: React.FC<TextSpanProps>;
112
-
113
- export { TextSpan, type TextSpanAlign, type TextSpanProps, Typography, type TypographyAlign, type TypographyProps, type TypographyVariant };