@xaui/native 0.2.7 → 0.9.1-alpha.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 (224) hide show
  1. package/dist/chunk-JDS6KGCM.cjs +791 -0
  2. package/dist/chunk-T3ZI2PZ6.js +791 -0
  3. package/dist/index.cjs +32 -1
  4. package/dist/index.d.cts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +32 -0
  7. package/dist/theme/index.cjs +32 -0
  8. package/dist/theme/index.d.cts +669 -0
  9. package/dist/theme/index.d.ts +669 -0
  10. package/dist/theme/index.js +32 -0
  11. package/package.json +26 -249
  12. package/README.md +0 -178
  13. package/dist/alert/index.cjs +0 -356
  14. package/dist/alert/index.d.cts +0 -90
  15. package/dist/alert/index.d.ts +0 -90
  16. package/dist/alert/index.js +0 -356
  17. package/dist/app-bar/index.cjs +0 -148
  18. package/dist/app-bar/index.d.cts +0 -59
  19. package/dist/app-bar/index.d.ts +0 -59
  20. package/dist/app-bar/index.js +0 -148
  21. package/dist/autocomplete/index.cjs +0 -1122
  22. package/dist/autocomplete/index.d.cts +0 -88
  23. package/dist/autocomplete/index.d.ts +0 -88
  24. package/dist/autocomplete/index.js +0 -1122
  25. package/dist/avatar/index.cjs +0 -281
  26. package/dist/avatar/index.d.cts +0 -123
  27. package/dist/avatar/index.d.ts +0 -123
  28. package/dist/avatar/index.js +0 -281
  29. package/dist/badge/index.cjs +0 -197
  30. package/dist/badge/index.d.cts +0 -94
  31. package/dist/badge/index.d.ts +0 -94
  32. package/dist/badge/index.js +0 -197
  33. package/dist/bottom-sheet/index.cjs +0 -9
  34. package/dist/bottom-sheet/index.d.cts +0 -84
  35. package/dist/bottom-sheet/index.d.ts +0 -84
  36. package/dist/bottom-sheet/index.js +0 -9
  37. package/dist/bottom-tab-bar/index.cjs +0 -497
  38. package/dist/bottom-tab-bar/index.d.cts +0 -211
  39. package/dist/bottom-tab-bar/index.d.ts +0 -211
  40. package/dist/bottom-tab-bar/index.js +0 -497
  41. package/dist/button/index.cjs +0 -392
  42. package/dist/button/index.d.cts +0 -174
  43. package/dist/button/index.d.ts +0 -174
  44. package/dist/button/index.js +0 -392
  45. package/dist/button.type-j1ZdkkSl.d.cts +0 -4
  46. package/dist/button.type-j1ZdkkSl.d.ts +0 -4
  47. package/dist/card/index.cjs +0 -338
  48. package/dist/card/index.d.cts +0 -191
  49. package/dist/card/index.d.ts +0 -191
  50. package/dist/card/index.js +0 -338
  51. package/dist/carousel/index.cjs +0 -381
  52. package/dist/carousel/index.d.cts +0 -147
  53. package/dist/carousel/index.d.ts +0 -147
  54. package/dist/carousel/index.js +0 -381
  55. package/dist/chart/index.cjs +0 -1026
  56. package/dist/chart/index.d.cts +0 -218
  57. package/dist/chart/index.d.ts +0 -218
  58. package/dist/chart/index.js +0 -1026
  59. package/dist/checkbox/index.cjs +0 -443
  60. package/dist/checkbox/index.d.cts +0 -73
  61. package/dist/checkbox/index.d.ts +0 -73
  62. package/dist/checkbox/index.js +0 -443
  63. package/dist/chip/index.cjs +0 -503
  64. package/dist/chip/index.d.cts +0 -195
  65. package/dist/chip/index.d.ts +0 -195
  66. package/dist/chip/index.js +0 -503
  67. package/dist/chunk-4JFWQ5XT.js +0 -368
  68. package/dist/chunk-56RPWZD2.cjs +0 -9
  69. package/dist/chunk-7UFBLUMV.cjs +0 -136
  70. package/dist/chunk-A45TVXU5.js +0 -337
  71. package/dist/chunk-BYWUAPC4.cjs +0 -368
  72. package/dist/chunk-DECMUMCI.js +0 -0
  73. package/dist/chunk-DHSTKO3K.cjs +0 -19
  74. package/dist/chunk-DJ4Q37UT.cjs +0 -75
  75. package/dist/chunk-EUQDGTST.cjs +0 -1
  76. package/dist/chunk-GBHQCAKW.js +0 -19
  77. package/dist/chunk-RBSA4NH4.js +0 -136
  78. package/dist/chunk-SHBDANQN.js +0 -9
  79. package/dist/chunk-UGEINZM7.cjs +0 -290
  80. package/dist/chunk-UU4HHBDN.js +0 -290
  81. package/dist/chunk-VSZEXOUN.js +0 -384
  82. package/dist/chunk-YIEUN3G5.cjs +0 -384
  83. package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
  84. package/dist/chunk-ZY7IUTAT.js +0 -75
  85. package/dist/color-picker/index.cjs +0 -457
  86. package/dist/color-picker/index.d.cts +0 -124
  87. package/dist/color-picker/index.d.ts +0 -124
  88. package/dist/color-picker/index.js +0 -457
  89. package/dist/core/index.cjs +0 -24
  90. package/dist/core/index.d.cts +0 -28
  91. package/dist/core/index.d.ts +0 -28
  92. package/dist/core/index.js +0 -24
  93. package/dist/datepicker/index.cjs +0 -1625
  94. package/dist/datepicker/index.d.cts +0 -45
  95. package/dist/datepicker/index.d.ts +0 -45
  96. package/dist/datepicker/index.js +0 -1625
  97. package/dist/dialog/index.cjs +0 -372
  98. package/dist/dialog/index.d.cts +0 -151
  99. package/dist/dialog/index.d.ts +0 -151
  100. package/dist/dialog/index.js +0 -372
  101. package/dist/divider/index.cjs +0 -8
  102. package/dist/divider/index.d.cts +0 -30
  103. package/dist/divider/index.d.ts +0 -30
  104. package/dist/divider/index.js +0 -8
  105. package/dist/drawer/index.cjs +0 -237
  106. package/dist/drawer/index.d.cts +0 -58
  107. package/dist/drawer/index.d.ts +0 -58
  108. package/dist/drawer/index.js +0 -237
  109. package/dist/expansion-panel/index.cjs +0 -441
  110. package/dist/expansion-panel/index.d.cts +0 -153
  111. package/dist/expansion-panel/index.d.ts +0 -153
  112. package/dist/expansion-panel/index.js +0 -441
  113. package/dist/fab/index.cjs +0 -9
  114. package/dist/fab/index.d.cts +0 -10
  115. package/dist/fab/index.d.ts +0 -10
  116. package/dist/fab/index.js +0 -9
  117. package/dist/fab-menu/index.cjs +0 -330
  118. package/dist/fab-menu/index.d.cts +0 -125
  119. package/dist/fab-menu/index.d.ts +0 -125
  120. package/dist/fab-menu/index.js +0 -330
  121. package/dist/fab.type-CkUHmXU_.d.ts +0 -86
  122. package/dist/fab.type-DN0vtAh6.d.cts +0 -86
  123. package/dist/feature-discovery/index.cjs +0 -464
  124. package/dist/feature-discovery/index.d.cts +0 -82
  125. package/dist/feature-discovery/index.d.ts +0 -82
  126. package/dist/feature-discovery/index.js +0 -464
  127. package/dist/indicator/index.cjs +0 -8
  128. package/dist/indicator/index.d.cts +0 -47
  129. package/dist/indicator/index.d.ts +0 -47
  130. package/dist/indicator/index.js +0 -8
  131. package/dist/input/index.cjs +0 -1462
  132. package/dist/input/index.d.cts +0 -522
  133. package/dist/input/index.d.ts +0 -522
  134. package/dist/input/index.js +0 -1462
  135. package/dist/input-trigger/index.cjs +0 -197
  136. package/dist/input-trigger/index.d.cts +0 -11
  137. package/dist/input-trigger/index.d.ts +0 -11
  138. package/dist/input-trigger/index.js +0 -197
  139. package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
  140. package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
  141. package/dist/list/index.cjs +0 -395
  142. package/dist/list/index.d.cts +0 -188
  143. package/dist/list/index.d.ts +0 -188
  144. package/dist/list/index.js +0 -395
  145. package/dist/menu/index.cjs +0 -316
  146. package/dist/menu/index.d.cts +0 -115
  147. package/dist/menu/index.d.ts +0 -115
  148. package/dist/menu/index.js +0 -316
  149. package/dist/menubox/index.cjs +0 -297
  150. package/dist/menubox/index.d.cts +0 -98
  151. package/dist/menubox/index.d.ts +0 -98
  152. package/dist/menubox/index.js +0 -297
  153. package/dist/pager/index.cjs +0 -205
  154. package/dist/pager/index.d.cts +0 -93
  155. package/dist/pager/index.d.ts +0 -93
  156. package/dist/pager/index.js +0 -205
  157. package/dist/picker/index.cjs +0 -244
  158. package/dist/picker/index.d.cts +0 -121
  159. package/dist/picker/index.d.ts +0 -121
  160. package/dist/picker/index.js +0 -244
  161. package/dist/progress/index.cjs +0 -219
  162. package/dist/progress/index.d.cts +0 -47
  163. package/dist/progress/index.d.ts +0 -47
  164. package/dist/progress/index.js +0 -219
  165. package/dist/radio/index.cjs +0 -465
  166. package/dist/radio/index.d.cts +0 -145
  167. package/dist/radio/index.d.ts +0 -145
  168. package/dist/radio/index.js +0 -465
  169. package/dist/refresh-control/index.cjs +0 -45
  170. package/dist/refresh-control/index.d.cts +0 -55
  171. package/dist/refresh-control/index.d.ts +0 -55
  172. package/dist/refresh-control/index.js +0 -45
  173. package/dist/segment-button/index.cjs +0 -405
  174. package/dist/segment-button/index.d.cts +0 -141
  175. package/dist/segment-button/index.d.ts +0 -141
  176. package/dist/segment-button/index.js +0 -405
  177. package/dist/select/index.cjs +0 -878
  178. package/dist/select/index.d.cts +0 -192
  179. package/dist/select/index.d.ts +0 -192
  180. package/dist/select/index.js +0 -878
  181. package/dist/skeleton/index.cjs +0 -89
  182. package/dist/skeleton/index.d.cts +0 -45
  183. package/dist/skeleton/index.d.ts +0 -45
  184. package/dist/skeleton/index.js +0 -89
  185. package/dist/slider/index.cjs +0 -576
  186. package/dist/slider/index.d.cts +0 -171
  187. package/dist/slider/index.d.ts +0 -171
  188. package/dist/slider/index.js +0 -576
  189. package/dist/snackbar/index.cjs +0 -436
  190. package/dist/snackbar/index.d.cts +0 -174
  191. package/dist/snackbar/index.d.ts +0 -174
  192. package/dist/snackbar/index.js +0 -436
  193. package/dist/snippet/index.cjs +0 -314
  194. package/dist/snippet/index.d.cts +0 -95
  195. package/dist/snippet/index.d.ts +0 -95
  196. package/dist/snippet/index.js +0 -314
  197. package/dist/stepper/index.cjs +0 -550
  198. package/dist/stepper/index.d.cts +0 -137
  199. package/dist/stepper/index.d.ts +0 -137
  200. package/dist/stepper/index.js +0 -550
  201. package/dist/switch/index.cjs +0 -358
  202. package/dist/switch/index.d.cts +0 -28
  203. package/dist/switch/index.d.ts +0 -28
  204. package/dist/switch/index.js +0 -358
  205. package/dist/tabs/index.cjs +0 -440
  206. package/dist/tabs/index.d.cts +0 -180
  207. package/dist/tabs/index.d.ts +0 -180
  208. package/dist/tabs/index.js +0 -440
  209. package/dist/timepicker/index.cjs +0 -823
  210. package/dist/timepicker/index.d.cts +0 -215
  211. package/dist/timepicker/index.d.ts +0 -215
  212. package/dist/timepicker/index.js +0 -823
  213. package/dist/toolbar/index.cjs +0 -333
  214. package/dist/toolbar/index.d.cts +0 -100
  215. package/dist/toolbar/index.d.ts +0 -100
  216. package/dist/toolbar/index.js +0 -333
  217. package/dist/typography/index.cjs +0 -238
  218. package/dist/typography/index.d.cts +0 -113
  219. package/dist/typography/index.d.ts +0 -113
  220. package/dist/typography/index.js +0 -238
  221. package/dist/view/index.cjs +0 -1361
  222. package/dist/view/index.d.cts +0 -833
  223. package/dist/view/index.d.ts +0 -833
  224. package/dist/view/index.js +0 -1361
@@ -1,281 +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(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-56RPWZD2.cjs');
2
-
3
-
4
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
5
-
6
- // src/components/avatar/avatar.tsx
7
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
8
- var _reactnative = require('react-native');
9
-
10
- // src/components/avatar/avatar.style.ts
11
-
12
- var styles = _reactnative.StyleSheet.create({
13
- container: {
14
- overflow: "hidden",
15
- alignItems: "center",
16
- justifyContent: "center"
17
- },
18
- image: {
19
- width: "100%",
20
- height: "100%"
21
- },
22
- fallback: {
23
- alignItems: "center",
24
- justifyContent: "center"
25
- },
26
- group: {
27
- flexDirection: "row",
28
- alignItems: "center"
29
- },
30
- grid: {
31
- flexDirection: "row",
32
- flexWrap: "wrap",
33
- alignItems: "flex-start"
34
- }
35
- });
36
-
37
- // src/components/avatar/avatar.hook.ts
38
-
39
- var _core = require('@xaui/core');
40
- var sizeMap = {
41
- xs: 24,
42
- sm: 32,
43
- md: 40,
44
- lg: 48
45
- };
46
- function resolveAvatarSize(size) {
47
- if (typeof size === "number") {
48
- return size;
49
- }
50
- return sizeMap[size];
51
- }
52
- function useAvatarSizeStyles(size) {
53
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
54
- const resolvedSize = _react.useMemo.call(void 0, () => resolveAvatarSize(size), [size]);
55
- const fontSize = _react.useMemo.call(void 0, () => {
56
- if (typeof size === "number") {
57
- return Math.max(10, Math.round(size * 0.4));
58
- }
59
- return theme.fontSizes[size];
60
- }, [size, theme]);
61
- return {
62
- size: resolvedSize,
63
- fontSize
64
- };
65
- }
66
- function useAvatarRadiusStyles(radius, size) {
67
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
68
- return _react.useMemo.call(void 0, () => {
69
- if (radius === "full") {
70
- return { borderRadius: size / 2 };
71
- }
72
- const radii = {
73
- none: theme.borderRadius.none,
74
- sm: theme.borderRadius.sm,
75
- md: theme.borderRadius.md,
76
- lg: theme.borderRadius.lg,
77
- full: theme.borderRadius.full
78
- };
79
- return { borderRadius: radii[radius] };
80
- }, [radius, size, theme]);
81
- }
82
- function useAvatarColors(themeColor, isDisabled) {
83
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
84
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
85
- const colorScheme = theme.colors[safeThemeColor];
86
- const backgroundColor = _react.useMemo.call(void 0, () => {
87
- if (isDisabled) {
88
- return theme.colors.background;
89
- }
90
- return colorScheme.container;
91
- }, [colorScheme.container, isDisabled, theme.colors.background]);
92
- const textColor = _react.useMemo.call(void 0, () => {
93
- if (safeThemeColor === "default") {
94
- return theme.colors.foreground;
95
- }
96
- return colorScheme.onContainer;
97
- }, [safeThemeColor, colorScheme.onContainer, theme.colors.foreground]);
98
- return {
99
- backgroundColor,
100
- textColor,
101
- borderColor: colorScheme.main
102
- };
103
- }
104
- function getDefaultInitials(name) {
105
- const trimmed = name.trim();
106
- if (!trimmed) {
107
- return "";
108
- }
109
- const parts = trimmed.split(/\s+/);
110
- if (parts.length === 1) {
111
- return parts[0].slice(0, 2).toUpperCase();
112
- }
113
- return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
114
- }
115
-
116
- // src/components/avatar/avatar.tsx
117
- var Avatar = ({
118
- src,
119
- name,
120
- icon,
121
- fallback,
122
- size = "md",
123
- radius = "full",
124
- themeColor = "default",
125
- isBordered = false,
126
- isDisabled = false,
127
- showFallback = false,
128
- getInitials,
129
- customAppearance
130
- }) => {
131
- const [isError, setIsError] = _react2.default.useState(false);
132
- const { size: resolvedSize, fontSize } = useAvatarSizeStyles(size);
133
- const radiusStyles = useAvatarRadiusStyles(radius, resolvedSize);
134
- const { backgroundColor, textColor, borderColor } = useAvatarColors(
135
- themeColor,
136
- isDisabled
137
- );
138
- const accessibilityLabel = _nullishCoalesce(name, () => ( "Avatar"));
139
- const shouldShowFallback = showFallback || !src || isError;
140
- const initials = name ? (_nullishCoalesce(getInitials, () => ( getDefaultInitials)))(name) : "";
141
- return /* @__PURE__ */ _react2.default.createElement(
142
- _reactnative.View,
143
- {
144
- style: [
145
- styles.container,
146
- {
147
- width: resolvedSize,
148
- height: resolvedSize,
149
- backgroundColor,
150
- opacity: isDisabled ? 0.6 : 1,
151
- borderWidth: isBordered ? 1 : 0,
152
- borderColor: isBordered ? borderColor : "transparent"
153
- },
154
- radiusStyles,
155
- _optionalChain([customAppearance, 'optionalAccess', _ => _.container])
156
- ],
157
- accessible: true,
158
- accessibilityRole: "image",
159
- accessibilityLabel
160
- },
161
- !shouldShowFallback && src ? /* @__PURE__ */ _react2.default.createElement(
162
- _reactnative.Image,
163
- {
164
- source: { uri: src },
165
- style: [styles.image, radiusStyles, _optionalChain([customAppearance, 'optionalAccess', _2 => _2.image])],
166
- accessibilityLabel,
167
- onError: () => setIsError(true)
168
- }
169
- ) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.fallback, { width: "100%", height: "100%" }] }, _nullishCoalesce(_nullishCoalesce(fallback, () => ( icon)), () => ( /* @__PURE__ */ _react2.default.createElement(
170
- _reactnative.Text,
171
- {
172
- style: [
173
- {
174
- color: textColor,
175
- fontSize,
176
- fontWeight: "600"
177
- },
178
- _optionalChain([customAppearance, 'optionalAccess', _3 => _3.text])
179
- ]
180
- },
181
- initials
182
- ))))
183
- );
184
- };
185
-
186
- // src/components/avatar/avatar-group.tsx
187
-
188
-
189
- var AvatarGroup = ({
190
- children,
191
- max,
192
- total,
193
- size = "md",
194
- radius = "full",
195
- themeColor = "default",
196
- isBordered = false,
197
- isDisabled = false,
198
- isGrid = false,
199
- renderCount,
200
- customAppearance
201
- }) => {
202
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
203
- const resolvedSize = resolveAvatarSize(size);
204
- const spacing = theme.spacing.xs;
205
- const overlap = Math.round(resolvedSize * 0.28);
206
- const allChildren = _react2.default.Children.toArray(children).filter(
207
- (child) => _react2.default.isValidElement(child)
208
- );
209
- const totalCount = _nullishCoalesce(total, () => ( allChildren.length));
210
- const maxCount = _nullishCoalesce(max, () => ( totalCount));
211
- const visibleChildren = allChildren.slice(0, maxCount);
212
- const remaining = Math.max(0, totalCount - maxCount);
213
- const enhanced = visibleChildren.map((child, index) => {
214
- const childProps = child.props;
215
- return /* @__PURE__ */ _react2.default.createElement(
216
- _reactnative.View,
217
- {
218
- key: _nullishCoalesce(child.key, () => ( index)),
219
- style: isGrid ? { marginRight: spacing, marginBottom: spacing } : { marginLeft: index === 0 ? 0 : -overlap, zIndex: index }
220
- },
221
- _react2.default.cloneElement(child, {
222
- size: _nullishCoalesce(childProps.size, () => ( size)),
223
- radius: _nullishCoalesce(childProps.radius, () => ( radius)),
224
- themeColor: _nullishCoalesce(childProps.themeColor, () => ( themeColor)),
225
- isBordered: _nullishCoalesce(childProps.isBordered, () => ( isBordered)),
226
- isDisabled: _nullishCoalesce(childProps.isDisabled, () => ( isDisabled))
227
- })
228
- );
229
- });
230
- const countNode = remaining > 0 ? _nullishCoalesce(_optionalChain([renderCount, 'optionalCall', _4 => _4(remaining)]), () => ( /* @__PURE__ */ _react2.default.createElement(
231
- Avatar,
232
- {
233
- name: `+${remaining}`,
234
- showFallback: true,
235
- size,
236
- radius,
237
- themeColor,
238
- isBordered,
239
- isDisabled,
240
- fallback: /* @__PURE__ */ _react2.default.createElement(
241
- _reactnative.Text,
242
- {
243
- style: {
244
- color: theme.colors.foreground,
245
- fontSize: Math.max(10, Math.round(resolvedSize * 0.35)),
246
- fontWeight: "600"
247
- }
248
- },
249
- "+",
250
- remaining
251
- )
252
- }
253
- ))) : null;
254
- if (countNode) {
255
- enhanced.push(
256
- /* @__PURE__ */ _react2.default.createElement(
257
- _reactnative.View,
258
- {
259
- key: "avatar-count",
260
- style: isGrid ? { marginRight: spacing, marginBottom: spacing } : {
261
- marginLeft: enhanced.length === 0 ? 0 : -overlap,
262
- zIndex: enhanced.length
263
- }
264
- },
265
- countNode
266
- )
267
- );
268
- }
269
- return /* @__PURE__ */ _react2.default.createElement(
270
- _reactnative.View,
271
- {
272
- style: [isGrid ? styles.grid : styles.group, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.container])],
273
- accessible: true
274
- },
275
- enhanced
276
- );
277
- };
278
-
279
-
280
-
281
- exports.Avatar = Avatar; exports.AvatarGroup = AvatarGroup;
@@ -1,123 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle, ImageStyle, TextStyle } from 'react-native';
3
- import { Size, Radius, ThemeColor } from '@xaui/core/types';
4
-
5
- type AvatarSize = Size | number;
6
- type AvatarCustomAppearance = {
7
- /**
8
- * Custom styles for the container
9
- */
10
- container?: ViewStyle;
11
- /**
12
- * Custom styles for the image
13
- */
14
- image?: ImageStyle;
15
- /**
16
- * Custom styles for the fallback text
17
- */
18
- text?: TextStyle;
19
- };
20
- type AvatarProps = {
21
- /**
22
- * Avatar image source URL.
23
- */
24
- src?: string;
25
- /**
26
- * Avatar name used for initials fallback.
27
- */
28
- name?: string;
29
- /**
30
- * Custom icon rendered when no image is available.
31
- */
32
- icon?: ReactNode;
33
- /**
34
- * Custom fallback rendered when no image is available.
35
- */
36
- fallback?: ReactNode;
37
- /**
38
- * Avatar size preset or custom number.
39
- * @default 'md'
40
- */
41
- size?: AvatarSize;
42
- /**
43
- * Avatar radius.
44
- * @default 'full'
45
- */
46
- radius?: Radius;
47
- /**
48
- * Theme color for avatar background and text.
49
- */
50
- themeColor?: ThemeColor;
51
- /**
52
- * Show border around avatar.
53
- */
54
- isBordered?: boolean;
55
- /**
56
- * Disabled state.
57
- */
58
- isDisabled?: boolean;
59
- /**
60
- * Show fallback content when image is missing or fails.
61
- * @default false
62
- */
63
- showFallback?: boolean;
64
- /**
65
- * Custom initials generator.
66
- */
67
- getInitials?: (name: string) => string;
68
- /**
69
- * Custom appearance styles for avatar parts
70
- */
71
- customAppearance?: AvatarCustomAppearance;
72
- };
73
- type AvatarGroupProps = {
74
- children?: ReactNode;
75
- /**
76
- * Max avatars to display before showing count.
77
- */
78
- max?: number;
79
- /**
80
- * Total avatars count if different from children length.
81
- */
82
- total?: number;
83
- /**
84
- * Shared avatar size.
85
- */
86
- size?: AvatarSize;
87
- /**
88
- * Shared avatar radius.
89
- */
90
- radius?: Radius;
91
- /**
92
- * Shared theme color.
93
- */
94
- themeColor?: ThemeColor;
95
- /**
96
- * Show border around avatars.
97
- */
98
- isBordered?: boolean;
99
- /**
100
- * Disabled state for all avatars.
101
- */
102
- isDisabled?: boolean;
103
- /**
104
- * Render avatars in a grid layout.
105
- */
106
- isGrid?: boolean;
107
- /**
108
- * Custom renderer for the count avatar.
109
- */
110
- renderCount?: (count: number) => ReactNode;
111
- /**
112
- * Custom appearance styles for group container
113
- */
114
- customAppearance?: {
115
- container?: ViewStyle;
116
- };
117
- };
118
-
119
- declare const Avatar: React.FC<AvatarProps>;
120
-
121
- declare const AvatarGroup: React.FC<AvatarGroupProps>;
122
-
123
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps };
@@ -1,123 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle, ImageStyle, TextStyle } from 'react-native';
3
- import { Size, Radius, ThemeColor } from '@xaui/core/types';
4
-
5
- type AvatarSize = Size | number;
6
- type AvatarCustomAppearance = {
7
- /**
8
- * Custom styles for the container
9
- */
10
- container?: ViewStyle;
11
- /**
12
- * Custom styles for the image
13
- */
14
- image?: ImageStyle;
15
- /**
16
- * Custom styles for the fallback text
17
- */
18
- text?: TextStyle;
19
- };
20
- type AvatarProps = {
21
- /**
22
- * Avatar image source URL.
23
- */
24
- src?: string;
25
- /**
26
- * Avatar name used for initials fallback.
27
- */
28
- name?: string;
29
- /**
30
- * Custom icon rendered when no image is available.
31
- */
32
- icon?: ReactNode;
33
- /**
34
- * Custom fallback rendered when no image is available.
35
- */
36
- fallback?: ReactNode;
37
- /**
38
- * Avatar size preset or custom number.
39
- * @default 'md'
40
- */
41
- size?: AvatarSize;
42
- /**
43
- * Avatar radius.
44
- * @default 'full'
45
- */
46
- radius?: Radius;
47
- /**
48
- * Theme color for avatar background and text.
49
- */
50
- themeColor?: ThemeColor;
51
- /**
52
- * Show border around avatar.
53
- */
54
- isBordered?: boolean;
55
- /**
56
- * Disabled state.
57
- */
58
- isDisabled?: boolean;
59
- /**
60
- * Show fallback content when image is missing or fails.
61
- * @default false
62
- */
63
- showFallback?: boolean;
64
- /**
65
- * Custom initials generator.
66
- */
67
- getInitials?: (name: string) => string;
68
- /**
69
- * Custom appearance styles for avatar parts
70
- */
71
- customAppearance?: AvatarCustomAppearance;
72
- };
73
- type AvatarGroupProps = {
74
- children?: ReactNode;
75
- /**
76
- * Max avatars to display before showing count.
77
- */
78
- max?: number;
79
- /**
80
- * Total avatars count if different from children length.
81
- */
82
- total?: number;
83
- /**
84
- * Shared avatar size.
85
- */
86
- size?: AvatarSize;
87
- /**
88
- * Shared avatar radius.
89
- */
90
- radius?: Radius;
91
- /**
92
- * Shared theme color.
93
- */
94
- themeColor?: ThemeColor;
95
- /**
96
- * Show border around avatars.
97
- */
98
- isBordered?: boolean;
99
- /**
100
- * Disabled state for all avatars.
101
- */
102
- isDisabled?: boolean;
103
- /**
104
- * Render avatars in a grid layout.
105
- */
106
- isGrid?: boolean;
107
- /**
108
- * Custom renderer for the count avatar.
109
- */
110
- renderCount?: (count: number) => ReactNode;
111
- /**
112
- * Custom appearance styles for group container
113
- */
114
- customAppearance?: {
115
- container?: ViewStyle;
116
- };
117
- };
118
-
119
- declare const Avatar: React.FC<AvatarProps>;
120
-
121
- declare const AvatarGroup: React.FC<AvatarGroupProps>;
122
-
123
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps };