@xaui/native 0.0.7 → 0.0.8

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.
@@ -0,0 +1,517 @@
1
+ import React, { ReactNode, ReactElement, ComponentType } from 'react';
2
+ import { ViewStyle, StyleProp, ColorValue, ScrollViewProps } from 'react-native';
3
+
4
+ type MainAxisAlignment = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
5
+ type CrossAxisAlignment = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
6
+ type RowProps = {
7
+ /**
8
+ * The content to render inside the row.
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * Main axis alignment for row items.
13
+ * @default 'start'
14
+ */
15
+ mainAxisAlignment?: MainAxisAlignment;
16
+ /**
17
+ * Cross axis alignment for row items.
18
+ * @default 'center'
19
+ */
20
+ crossAxisAlignment?: CrossAxisAlignment;
21
+ /**
22
+ * Spacing between children.
23
+ */
24
+ spacing?: number;
25
+ /**
26
+ * Reverse the row direction.
27
+ * @default false
28
+ */
29
+ reverse?: boolean;
30
+ /**
31
+ * Force the container to take the full width.
32
+ * @default false
33
+ */
34
+ fullWidth?: boolean;
35
+ /**
36
+ * Custom style for the row container.
37
+ */
38
+ style?: ViewStyle;
39
+ };
40
+ type ColumnProps = RowProps;
41
+
42
+ declare const Column: React.FC<ColumnProps>;
43
+
44
+ declare const Row: React.FC<RowProps>;
45
+
46
+ type SpacerProps = {
47
+ /**
48
+ * Flex factor for the spacer.
49
+ * @default 1
50
+ */
51
+ flex?: number;
52
+ /**
53
+ * Custom style for the spacer.
54
+ */
55
+ style?: StyleProp<ViewStyle>;
56
+ };
57
+
58
+ declare const Spacer: React.FC<SpacerProps>;
59
+
60
+ type PaddingProps = {
61
+ /**
62
+ * Content to render inside the padding container.
63
+ */
64
+ children: ReactNode;
65
+ /**
66
+ * Padding on all sides.
67
+ */
68
+ all?: number;
69
+ /**
70
+ * Horizontal padding.
71
+ */
72
+ horizontal?: number;
73
+ /**
74
+ * Vertical padding.
75
+ */
76
+ vertical?: number;
77
+ /**
78
+ * Top padding.
79
+ */
80
+ top?: number;
81
+ /**
82
+ * Right padding.
83
+ */
84
+ right?: number;
85
+ /**
86
+ * Bottom padding.
87
+ */
88
+ bottom?: number;
89
+ /**
90
+ * Left padding.
91
+ */
92
+ left?: number;
93
+ /**
94
+ * Custom style for the padding container.
95
+ */
96
+ style?: StyleProp<ViewStyle>;
97
+ };
98
+
99
+ declare const Padding: React.FC<PaddingProps>;
100
+
101
+ type MarginProps = {
102
+ /**
103
+ * Content to render inside the margin container.
104
+ */
105
+ children: ReactNode;
106
+ /**
107
+ * Margin on all sides.
108
+ */
109
+ value?: number;
110
+ /**
111
+ * Horizontal margin.
112
+ */
113
+ horizontal?: number;
114
+ /**
115
+ * Vertical margin.
116
+ */
117
+ vertical?: number;
118
+ /**
119
+ * Top margin.
120
+ */
121
+ top?: number;
122
+ /**
123
+ * Right margin.
124
+ */
125
+ right?: number;
126
+ /**
127
+ * Bottom margin.
128
+ */
129
+ bottom?: number;
130
+ /**
131
+ * Left margin.
132
+ */
133
+ left?: number;
134
+ /**
135
+ * Custom style for the margin container.
136
+ */
137
+ style?: StyleProp<ViewStyle>;
138
+ };
139
+
140
+ declare const Margin: React.FC<MarginProps>;
141
+
142
+ type SizedBoxProps = {
143
+ /**
144
+ * Content to render inside the box.
145
+ */
146
+ children?: ReactNode;
147
+ /**
148
+ * Width of the box.
149
+ */
150
+ width?: number;
151
+ /**
152
+ * Height of the box.
153
+ */
154
+ height?: number;
155
+ /**
156
+ * Custom style for the box.
157
+ */
158
+ style?: StyleProp<ViewStyle>;
159
+ };
160
+
161
+ declare const SizedBox: React.FC<SizedBoxProps>;
162
+
163
+ type PositionedViewProps = {
164
+ /**
165
+ * Content to render inside the positioned container.
166
+ */
167
+ children: ReactNode;
168
+ /**
169
+ * Top offset.
170
+ */
171
+ top?: number;
172
+ /**
173
+ * Right offset.
174
+ */
175
+ right?: number;
176
+ /**
177
+ * Bottom offset.
178
+ */
179
+ bottom?: number;
180
+ /**
181
+ * Left offset.
182
+ */
183
+ left?: number;
184
+ /**
185
+ * Z-index for stacking context.
186
+ */
187
+ zIndex?: number;
188
+ /**
189
+ * Custom style for the positioned container.
190
+ */
191
+ style?: StyleProp<ViewStyle>;
192
+ };
193
+
194
+ declare const PositionedView: React.FC<PositionedViewProps>;
195
+
196
+ type BlurViewProps = {
197
+ children: ReactNode;
198
+ unlockable?: boolean;
199
+ intensity?: number;
200
+ overlayColor?: ColorValue;
201
+ style?: StyleProp<ViewStyle>;
202
+ };
203
+
204
+ declare const BlurView: React.FC<BlurViewProps>;
205
+
206
+ type GridProps = {
207
+ /**
208
+ * The grid items to render.
209
+ */
210
+ children: ReactNode;
211
+ /**
212
+ * Number of columns in the grid.
213
+ * @default 2
214
+ */
215
+ columns?: number;
216
+ /**
217
+ * Spacing between rows and columns.
218
+ */
219
+ spacing?: number;
220
+ /**
221
+ * Spacing between rows.
222
+ */
223
+ rowSpacing?: number;
224
+ /**
225
+ * Spacing between columns.
226
+ */
227
+ columnSpacing?: number;
228
+ /**
229
+ * Custom style for the grid container.
230
+ */
231
+ style?: StyleProp<ViewStyle>;
232
+ /**
233
+ * Custom style for each grid item.
234
+ */
235
+ itemStyle?: StyleProp<ViewStyle>;
236
+ };
237
+
238
+ declare const Grid: React.FC<GridProps>;
239
+
240
+ type GridItemProps = {
241
+ /**
242
+ * The content to render inside the grid item.
243
+ */
244
+ children: ReactNode;
245
+ /**
246
+ * Number of columns to span.
247
+ * @default 1
248
+ */
249
+ span?: number;
250
+ /**
251
+ * Custom style for the grid item.
252
+ */
253
+ style?: StyleProp<ViewStyle>;
254
+ };
255
+
256
+ declare const GridItem: React.FC<GridItemProps>;
257
+
258
+ type GridBuilderRenderItem<T> = (info: {
259
+ item: T;
260
+ index: number;
261
+ }) => ReactElement | null;
262
+ type GridBuilderItemBuilder<T> = (info: {
263
+ item?: T;
264
+ index: number;
265
+ }) => ReactElement | null;
266
+ type GridBuilderProps<T> = {
267
+ /**
268
+ * Data to render in the grid.
269
+ */
270
+ data?: readonly T[];
271
+ /**
272
+ * Number of items to render (Flutter-style).
273
+ */
274
+ itemCount?: number;
275
+ /**
276
+ * Render function for each item.
277
+ */
278
+ renderItem?: GridBuilderRenderItem<T>;
279
+ /**
280
+ * Builder function for each item (Flutter-style).
281
+ */
282
+ itemBuilder?: GridBuilderItemBuilder<T>;
283
+ /**
284
+ * Extract a stable key for each item.
285
+ */
286
+ keyExtractor?: (item: T, index: number) => string;
287
+ /**
288
+ * Number of columns in the grid.
289
+ * @default 2
290
+ */
291
+ columns?: number;
292
+ /**
293
+ * Spacing between rows and columns.
294
+ */
295
+ spacing?: number;
296
+ /**
297
+ * Spacing between rows.
298
+ */
299
+ rowSpacing?: number;
300
+ /**
301
+ * Spacing between columns.
302
+ */
303
+ columnSpacing?: number;
304
+ /**
305
+ * Custom style for the grid container.
306
+ */
307
+ style?: StyleProp<ViewStyle>;
308
+ /**
309
+ * Custom style for each grid item container.
310
+ */
311
+ itemStyle?: StyleProp<ViewStyle>;
312
+ /**
313
+ * Enable or disable scrolling.
314
+ */
315
+ scrollEnabled?: boolean;
316
+ /**
317
+ * Called when the scroll reaches the end.
318
+ */
319
+ onEndReached?: () => void;
320
+ /**
321
+ * Distance from end (as a fraction of the viewport height).
322
+ * @default 0.1
323
+ */
324
+ onEndReachedThreshold?: number;
325
+ /**
326
+ * Content container style for the list.
327
+ */
328
+ contentContainerStyle?: StyleProp<ViewStyle>;
329
+ /**
330
+ * Optional header element.
331
+ */
332
+ header?: ReactElement | ComponentType<any> | null;
333
+ /**
334
+ * Optional footer element.
335
+ */
336
+ footer?: ReactElement | ComponentType<any> | null;
337
+ };
338
+
339
+ declare const GridBuilder: {
340
+ <T>({ data, itemCount, renderItem, itemBuilder, keyExtractor, columns, spacing, rowSpacing, columnSpacing, style, itemStyle, scrollEnabled, onEndReached, onEndReachedThreshold, contentContainerStyle, header, footer, }: GridBuilderProps<T>): React.JSX.Element | null;
341
+ displayName: string;
342
+ };
343
+
344
+ type ConditionalViewAnimation = 'fade' | 'scale';
345
+ type ConditionalViewProps = {
346
+ /**
347
+ * Whether the view is visible.
348
+ */
349
+ isVisible: boolean;
350
+ /**
351
+ * The content to render when visible.
352
+ */
353
+ children: ReactNode;
354
+ /**
355
+ * The animation to use when the view appears.
356
+ * @default 'fade'
357
+ */
358
+ animation?: ConditionalViewAnimation;
359
+ /**
360
+ * Disable animations entirely.
361
+ * @default false
362
+ */
363
+ disableAnimation?: boolean;
364
+ };
365
+
366
+ declare const ConditionalView: React.FC<ConditionalViewProps>;
367
+
368
+ type MasonryGridProps = {
369
+ /**
370
+ * Items to render inside the masonry grid.
371
+ */
372
+ children: ReactNode;
373
+ /**
374
+ * Number of columns.
375
+ * @default 2
376
+ */
377
+ columns?: number;
378
+ /**
379
+ * Spacing between rows and columns.
380
+ */
381
+ spacing?: number;
382
+ /**
383
+ * Spacing between rows.
384
+ */
385
+ rowSpacing?: number;
386
+ /**
387
+ * Spacing between columns.
388
+ */
389
+ columnSpacing?: number;
390
+ /**
391
+ * Custom style for the grid container.
392
+ */
393
+ style?: StyleProp<ViewStyle>;
394
+ /**
395
+ * Custom style for each column container.
396
+ */
397
+ columnStyle?: StyleProp<ViewStyle>;
398
+ };
399
+
400
+ declare const MasonryGrid: React.FC<MasonryGridProps>;
401
+
402
+ type MasonryGridItemProps = {
403
+ /**
404
+ * The content to render inside the masonry item.
405
+ */
406
+ children: ReactNode;
407
+ /**
408
+ * Custom style for the masonry item container.
409
+ */
410
+ style?: StyleProp<ViewStyle>;
411
+ };
412
+
413
+ declare const MasonryGridItem: React.FC<MasonryGridItemProps>;
414
+
415
+ type MasonryGridBuilderRenderItem<T> = (info: {
416
+ item: T;
417
+ index: number;
418
+ }) => ReactElement | null;
419
+ type MasonryGridBuilderItemBuilder<T> = (info: {
420
+ item?: T;
421
+ index: number;
422
+ }) => ReactElement | null;
423
+ type MasonryGridBuilderProps<T> = {
424
+ /**
425
+ * Data to render in the masonry grid.
426
+ */
427
+ data?: readonly T[];
428
+ /**
429
+ * Number of items to render (Flutter-style).
430
+ */
431
+ itemCount?: number;
432
+ /**
433
+ * Render function for each item.
434
+ */
435
+ renderItem?: MasonryGridBuilderRenderItem<T>;
436
+ /**
437
+ * Builder function for each item (Flutter-style).
438
+ */
439
+ itemBuilder?: MasonryGridBuilderItemBuilder<T>;
440
+ /**
441
+ * Extract a stable key for each item.
442
+ */
443
+ keyExtractor?: (item: T, index: number) => string;
444
+ /**
445
+ * Number of columns.
446
+ * @default 2
447
+ */
448
+ columns?: number;
449
+ /**
450
+ * Spacing between rows and columns.
451
+ */
452
+ spacing?: number;
453
+ /**
454
+ * Spacing between rows.
455
+ */
456
+ rowSpacing?: number;
457
+ /**
458
+ * Spacing between columns.
459
+ */
460
+ columnSpacing?: number;
461
+ /**
462
+ * Custom style for the masonry container.
463
+ */
464
+ style?: StyleProp<ViewStyle>;
465
+ /**
466
+ * Custom style for each column container.
467
+ */
468
+ columnStyle?: StyleProp<ViewStyle>;
469
+ /**
470
+ * Called when the scroll reaches the end.
471
+ */
472
+ onEndReached?: () => void;
473
+ /**
474
+ * Distance from end (as a fraction of the viewport height).
475
+ * @default 0.1
476
+ */
477
+ onEndReachedThreshold?: number;
478
+ /**
479
+ * Optional header element.
480
+ */
481
+ header?: ReactNode;
482
+ /**
483
+ * Optional footer element.
484
+ */
485
+ footer?: ReactNode;
486
+ /**
487
+ * Content container style for the ScrollView.
488
+ */
489
+ contentContainerStyle?: StyleProp<ViewStyle>;
490
+ /**
491
+ * Enable or disable scrolling.
492
+ */
493
+ scrollEnabled?: boolean;
494
+ /**
495
+ * Show the vertical scroll indicator.
496
+ */
497
+ showsVerticalScrollIndicator?: boolean;
498
+ /**
499
+ * Show the horizontal scroll indicator.
500
+ */
501
+ showsHorizontalScrollIndicator?: boolean;
502
+ /**
503
+ * Enable or disable bouncing.
504
+ */
505
+ bounces?: boolean;
506
+ /**
507
+ * Scroll handler called alongside internal infinite-scroll logic.
508
+ */
509
+ onScroll?: ScrollViewProps['onScroll'];
510
+ };
511
+
512
+ declare const MasonryGridBuilder: {
513
+ <T>({ data, itemCount, renderItem, itemBuilder, keyExtractor, columns, spacing, rowSpacing, columnSpacing, style, columnStyle, onEndReached, onEndReachedThreshold, header, footer, scrollEnabled, contentContainerStyle, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, bounces, onScroll, }: MasonryGridBuilderProps<T>): React.JSX.Element | null;
514
+ displayName: string;
515
+ };
516
+
517
+ export { BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps };