@xaui/native 0.2.6 → 0.2.7
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.
- package/dist/color-picker/index.cjs +1 -4
- package/dist/color-picker/index.js +1 -4
- package/dist/dialog/index.cjs +28 -37
- package/dist/dialog/index.js +28 -37
- package/dist/picker/index.cjs +20 -26
- package/dist/picker/index.js +20 -26
- package/dist/snackbar/index.cjs +19 -3
- package/dist/snackbar/index.js +19 -3
- package/dist/snippet/index.cjs +6 -1
- package/dist/snippet/index.js +6 -1
- package/dist/view/index.cjs +119 -55
- package/dist/view/index.d.cts +81 -37
- package/dist/view/index.d.ts +81 -37
- package/dist/view/index.js +206 -142
- package/package.json +3 -3
package/dist/view/index.js
CHANGED
|
@@ -152,7 +152,9 @@ var buildStyle = (props) => ({
|
|
|
152
152
|
...props.borderRadius !== void 0 && resolveBorderRadius(props.borderRadius),
|
|
153
153
|
...props.border !== void 0 && resolveBorder(props.border),
|
|
154
154
|
...props.shadow !== void 0 && resolveShadow(props.shadow),
|
|
155
|
-
...props.transform !== void 0 && {
|
|
155
|
+
...props.transform !== void 0 && {
|
|
156
|
+
transform: resolveTransform(props.transform)
|
|
157
|
+
}
|
|
156
158
|
});
|
|
157
159
|
var Container = (props) => {
|
|
158
160
|
const {
|
|
@@ -205,7 +207,7 @@ var Container = (props) => {
|
|
|
205
207
|
};
|
|
206
208
|
Container.displayName = "Container";
|
|
207
209
|
|
|
208
|
-
// src/components/view/
|
|
210
|
+
// src/components/view/flex/flex.tsx
|
|
209
211
|
import React2 from "react";
|
|
210
212
|
import { View as View2 } from "react-native";
|
|
211
213
|
|
|
@@ -214,94 +216,109 @@ var MAIN_AXIS_JUSTIFY_MAP = {
|
|
|
214
216
|
start: "flex-start",
|
|
215
217
|
center: "center",
|
|
216
218
|
end: "flex-end",
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
spaceBetween: "space-between",
|
|
220
|
+
spaceAround: "space-around",
|
|
221
|
+
spaceEvenly: "space-evenly"
|
|
220
222
|
};
|
|
221
223
|
var CROSS_AXIS_ALIGN_MAP = {
|
|
222
224
|
start: "flex-start",
|
|
223
225
|
center: "center",
|
|
224
226
|
end: "flex-end",
|
|
225
|
-
stretch: "stretch"
|
|
226
|
-
baseline: "baseline"
|
|
227
|
+
stretch: "stretch"
|
|
227
228
|
};
|
|
228
|
-
var resolveMainAxisAlignment = (alignment) =>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return
|
|
229
|
+
var resolveMainAxisAlignment = (alignment) => MAIN_AXIS_JUSTIFY_MAP[alignment ?? "start"];
|
|
230
|
+
var resolveCrossAxisAlignment = (alignment) => CROSS_AXIS_ALIGN_MAP[alignment ?? "center"];
|
|
231
|
+
var resolveMainAxisSize = (size = "max", direction) => {
|
|
232
|
+
if (size === "min") return {};
|
|
233
|
+
return direction === "vertical" ? { flex: 1 } : { width: "100%" };
|
|
233
234
|
};
|
|
234
235
|
|
|
235
|
-
// src/components/view/
|
|
236
|
-
var
|
|
236
|
+
// src/components/view/flex/flex.tsx
|
|
237
|
+
var Flex = ({
|
|
237
238
|
children,
|
|
239
|
+
direction,
|
|
238
240
|
mainAxisAlignment,
|
|
239
241
|
crossAxisAlignment,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
mainAxisSize,
|
|
243
|
+
wrap = false,
|
|
244
|
+
gap,
|
|
245
|
+
reversed = false,
|
|
246
|
+
flex,
|
|
243
247
|
style,
|
|
244
|
-
|
|
248
|
+
testID
|
|
245
249
|
}) => {
|
|
246
|
-
const
|
|
247
|
-
const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
|
|
250
|
+
const flexDir = direction === "horizontal" ? reversed ? "row-reverse" : "row" : reversed ? "column-reverse" : "column";
|
|
248
251
|
return /* @__PURE__ */ React2.createElement(
|
|
249
252
|
View2,
|
|
250
253
|
{
|
|
254
|
+
testID,
|
|
251
255
|
style: [
|
|
256
|
+
resolveMainAxisSize(mainAxisSize, direction),
|
|
252
257
|
{
|
|
253
|
-
|
|
254
|
-
flexDirection: reverse ? "column-reverse" : "column",
|
|
258
|
+
flexDirection: flexDir,
|
|
255
259
|
justifyContent: resolveMainAxisAlignment(mainAxisAlignment),
|
|
256
|
-
alignItems: resolveCrossAxisAlignment(crossAxisAlignment)
|
|
260
|
+
alignItems: resolveCrossAxisAlignment(crossAxisAlignment),
|
|
261
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
262
|
+
...gap !== void 0 && { gap },
|
|
263
|
+
...flex !== void 0 && { flex }
|
|
257
264
|
},
|
|
258
|
-
fullWidthStyle,
|
|
259
|
-
gapStyle,
|
|
260
265
|
style
|
|
261
266
|
]
|
|
262
267
|
},
|
|
263
268
|
children
|
|
264
269
|
);
|
|
265
270
|
};
|
|
271
|
+
Flex.displayName = "Flex";
|
|
266
272
|
|
|
267
|
-
// src/components/view/
|
|
273
|
+
// src/components/view/column/column.tsx
|
|
268
274
|
import React3 from "react";
|
|
275
|
+
var Column = (props) => /* @__PURE__ */ React3.createElement(Flex, { ...props, direction: "vertical" });
|
|
276
|
+
Column.displayName = "Column";
|
|
277
|
+
|
|
278
|
+
// src/components/view/row/row.tsx
|
|
279
|
+
import React4 from "react";
|
|
280
|
+
var Row = (props) => /* @__PURE__ */ React4.createElement(Flex, { ...props, direction: "horizontal" });
|
|
281
|
+
Row.displayName = "Row";
|
|
282
|
+
|
|
283
|
+
// src/components/view/expanded/expanded.tsx
|
|
284
|
+
import React5 from "react";
|
|
269
285
|
import { View as View3 } from "react-native";
|
|
270
|
-
var
|
|
286
|
+
var Expanded = ({
|
|
271
287
|
children,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
style
|
|
278
|
-
}) => {
|
|
279
|
-
const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
|
|
280
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
281
|
-
return /* @__PURE__ */ React3.createElement(
|
|
282
|
-
View3,
|
|
283
|
-
{
|
|
284
|
-
style: [
|
|
285
|
-
{
|
|
286
|
-
flexDirection: reverse ? "row-reverse" : "row",
|
|
287
|
-
justifyContent: resolveMainAxisAlignment(mainAxisAlignment),
|
|
288
|
-
alignItems: resolveCrossAxisAlignment(crossAxisAlignment)
|
|
289
|
-
},
|
|
290
|
-
fullWidthStyle,
|
|
291
|
-
gapStyle,
|
|
292
|
-
style
|
|
293
|
-
]
|
|
294
|
-
},
|
|
295
|
-
children
|
|
296
|
-
);
|
|
297
|
-
};
|
|
288
|
+
flex = 1,
|
|
289
|
+
style,
|
|
290
|
+
testID
|
|
291
|
+
}) => /* @__PURE__ */ React5.createElement(View3, { testID, style: [{ flex }, style] }, children);
|
|
292
|
+
Expanded.displayName = "Expanded";
|
|
298
293
|
|
|
299
|
-
// src/components/view/
|
|
300
|
-
import
|
|
294
|
+
// src/components/view/flexible/flexible.tsx
|
|
295
|
+
import React6 from "react";
|
|
301
296
|
import { View as View4 } from "react-native";
|
|
297
|
+
var Flexible = ({
|
|
298
|
+
children,
|
|
299
|
+
flex = 1,
|
|
300
|
+
fit = "loose",
|
|
301
|
+
style,
|
|
302
|
+
testID
|
|
303
|
+
}) => /* @__PURE__ */ React6.createElement(
|
|
304
|
+
View4,
|
|
305
|
+
{
|
|
306
|
+
testID,
|
|
307
|
+
style: [
|
|
308
|
+
fit === "tight" ? { flex } : { flexGrow: flex, flexShrink: 1, flexBasis: "auto" },
|
|
309
|
+
style
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
children
|
|
313
|
+
);
|
|
314
|
+
Flexible.displayName = "Flexible";
|
|
315
|
+
|
|
316
|
+
// src/components/view/spacer/spacer.tsx
|
|
317
|
+
import React7 from "react";
|
|
318
|
+
import { View as View5 } from "react-native";
|
|
302
319
|
var Spacer = ({ flex = 1, style }) => {
|
|
303
|
-
return /* @__PURE__ */
|
|
304
|
-
|
|
320
|
+
return /* @__PURE__ */ React7.createElement(
|
|
321
|
+
View5,
|
|
305
322
|
{
|
|
306
323
|
style: [
|
|
307
324
|
{
|
|
@@ -316,21 +333,54 @@ var Spacer = ({ flex = 1, style }) => {
|
|
|
316
333
|
};
|
|
317
334
|
Spacer.displayName = "Spacer";
|
|
318
335
|
|
|
336
|
+
// src/components/view/wrap/wrap.tsx
|
|
337
|
+
import React8 from "react";
|
|
338
|
+
import { View as View6 } from "react-native";
|
|
339
|
+
var Wrap = ({
|
|
340
|
+
children,
|
|
341
|
+
direction = "horizontal",
|
|
342
|
+
alignment,
|
|
343
|
+
runAlignment,
|
|
344
|
+
spacing = 0,
|
|
345
|
+
runSpacing = 0,
|
|
346
|
+
style,
|
|
347
|
+
testID
|
|
348
|
+
}) => /* @__PURE__ */ React8.createElement(
|
|
349
|
+
View6,
|
|
350
|
+
{
|
|
351
|
+
testID,
|
|
352
|
+
style: [
|
|
353
|
+
{
|
|
354
|
+
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
355
|
+
flexWrap: "wrap",
|
|
356
|
+
justifyContent: resolveMainAxisAlignment(alignment),
|
|
357
|
+
alignContent: resolveMainAxisAlignment(runAlignment),
|
|
358
|
+
gap: spacing,
|
|
359
|
+
rowGap: direction === "horizontal" ? runSpacing : spacing,
|
|
360
|
+
columnGap: direction === "horizontal" ? spacing : runSpacing
|
|
361
|
+
},
|
|
362
|
+
style
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
children
|
|
366
|
+
);
|
|
367
|
+
Wrap.displayName = "Wrap";
|
|
368
|
+
|
|
319
369
|
// src/components/view/padding/padding.tsx
|
|
320
|
-
import
|
|
321
|
-
import { View as
|
|
322
|
-
var Padding = ({ children, padding, style }) => /* @__PURE__ */
|
|
370
|
+
import React9 from "react";
|
|
371
|
+
import { View as View7 } from "react-native";
|
|
372
|
+
var Padding = ({ children, padding, style }) => /* @__PURE__ */ React9.createElement(View7, { style: [resolveEdgeInsets(padding, "padding"), style] }, children);
|
|
323
373
|
Padding.displayName = "Padding";
|
|
324
374
|
|
|
325
375
|
// src/components/view/margin/margin.tsx
|
|
326
|
-
import
|
|
327
|
-
import { View as
|
|
328
|
-
var Margin = ({ children, margin, style }) => /* @__PURE__ */
|
|
376
|
+
import React10 from "react";
|
|
377
|
+
import { View as View8 } from "react-native";
|
|
378
|
+
var Margin = ({ children, margin, style }) => /* @__PURE__ */ React10.createElement(View8, { style: [resolveEdgeInsets(margin, "margin"), style] }, children);
|
|
329
379
|
Margin.displayName = "Margin";
|
|
330
380
|
|
|
331
381
|
// src/components/view/sized-box/sized-box.tsx
|
|
332
|
-
import
|
|
333
|
-
import { View as
|
|
382
|
+
import React11 from "react";
|
|
383
|
+
import { View as View9 } from "react-native";
|
|
334
384
|
var SizedBox = ({
|
|
335
385
|
children,
|
|
336
386
|
width,
|
|
@@ -341,25 +391,32 @@ var SizedBox = ({
|
|
|
341
391
|
testID
|
|
342
392
|
}) => {
|
|
343
393
|
if (shrink) {
|
|
344
|
-
return /* @__PURE__ */
|
|
394
|
+
return /* @__PURE__ */ React11.createElement(
|
|
395
|
+
View9,
|
|
396
|
+
{
|
|
397
|
+
testID,
|
|
398
|
+
style: [{ width: 0, height: 0, overflow: "hidden" }, style]
|
|
399
|
+
},
|
|
400
|
+
children
|
|
401
|
+
);
|
|
345
402
|
}
|
|
346
403
|
if (expand) {
|
|
347
|
-
return /* @__PURE__ */
|
|
404
|
+
return /* @__PURE__ */ React11.createElement(View9, { testID, style: [{ flex: 1, alignSelf: "stretch" }, style] }, children);
|
|
348
405
|
}
|
|
349
|
-
return /* @__PURE__ */
|
|
406
|
+
return /* @__PURE__ */ React11.createElement(View9, { testID, style: [{ width, height }, style] }, children);
|
|
350
407
|
};
|
|
351
408
|
SizedBox.displayName = "SizedBox";
|
|
352
409
|
|
|
353
410
|
// src/components/view/constrained-box/constrained-box.tsx
|
|
354
|
-
import
|
|
355
|
-
import { View as
|
|
411
|
+
import React12 from "react";
|
|
412
|
+
import { View as View10 } from "react-native";
|
|
356
413
|
var ConstrainedBox = ({
|
|
357
414
|
children,
|
|
358
415
|
constraints,
|
|
359
416
|
style,
|
|
360
417
|
testID
|
|
361
|
-
}) => /* @__PURE__ */
|
|
362
|
-
|
|
418
|
+
}) => /* @__PURE__ */ React12.createElement(
|
|
419
|
+
View10,
|
|
363
420
|
{
|
|
364
421
|
testID,
|
|
365
422
|
style: [
|
|
@@ -377,8 +434,8 @@ var ConstrainedBox = ({
|
|
|
377
434
|
ConstrainedBox.displayName = "ConstrainedBox";
|
|
378
435
|
|
|
379
436
|
// src/components/view/fractionally-sized-box/fractionally-sized-box.tsx
|
|
380
|
-
import
|
|
381
|
-
import { View as
|
|
437
|
+
import React13 from "react";
|
|
438
|
+
import { View as View11 } from "react-native";
|
|
382
439
|
var FractionallySizedBox = ({
|
|
383
440
|
children,
|
|
384
441
|
widthFactor,
|
|
@@ -391,13 +448,13 @@ var FractionallySizedBox = ({
|
|
|
391
448
|
if (widthFactor !== void 0) sizedStyle.width = `${widthFactor * 100}%`;
|
|
392
449
|
if (heightFactor !== void 0) sizedStyle.height = `${heightFactor * 100}%`;
|
|
393
450
|
const alignStyle = alignment ? resolveAlignment(alignment) : {};
|
|
394
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ React13.createElement(View11, { testID, style: [sizedStyle, alignStyle, style] }, children);
|
|
395
452
|
};
|
|
396
453
|
FractionallySizedBox.displayName = "FractionallySizedBox";
|
|
397
454
|
|
|
398
455
|
// src/components/view/positioned-view/positioned-view.tsx
|
|
399
|
-
import
|
|
400
|
-
import { View as
|
|
456
|
+
import React14 from "react";
|
|
457
|
+
import { View as View12 } from "react-native";
|
|
401
458
|
var PositionedView = ({
|
|
402
459
|
children,
|
|
403
460
|
top,
|
|
@@ -407,8 +464,8 @@ var PositionedView = ({
|
|
|
407
464
|
zIndex,
|
|
408
465
|
style
|
|
409
466
|
}) => {
|
|
410
|
-
return /* @__PURE__ */
|
|
411
|
-
|
|
467
|
+
return /* @__PURE__ */ React14.createElement(
|
|
468
|
+
View12,
|
|
412
469
|
{
|
|
413
470
|
style: [
|
|
414
471
|
{
|
|
@@ -428,8 +485,8 @@ var PositionedView = ({
|
|
|
428
485
|
PositionedView.displayName = "PositionedView";
|
|
429
486
|
|
|
430
487
|
// src/components/view/blur-view/blur-view.tsx
|
|
431
|
-
import
|
|
432
|
-
import { Animated, StyleSheet, View as
|
|
488
|
+
import React15, { useEffect, useRef } from "react";
|
|
489
|
+
import { Animated, StyleSheet, View as View13 } from "react-native";
|
|
433
490
|
var styles = StyleSheet.create({
|
|
434
491
|
container: {
|
|
435
492
|
position: "relative"
|
|
@@ -469,20 +526,20 @@ var BlurView = ({
|
|
|
469
526
|
overlayAnim.setValue(overlayOpacity);
|
|
470
527
|
scaleAnim.setValue(0.98);
|
|
471
528
|
}, [overlayAnim, overlayOpacity, scaleAnim, unlockable]);
|
|
472
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ React15.createElement(View13, { style: [styles.container, style] }, /* @__PURE__ */ React15.createElement(Animated.View, { style: { transform: [{ scale: scaleAnim }] } }, children), /* @__PURE__ */ React15.createElement(
|
|
473
530
|
Animated.View,
|
|
474
531
|
{
|
|
475
532
|
pointerEvents: unlockable ? "none" : "auto",
|
|
476
533
|
style: [styles.overlay, { opacity: overlayAnim }]
|
|
477
534
|
},
|
|
478
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ React15.createElement(View13, { style: [styles.overlay, { backgroundColor: overlayColor }] })
|
|
479
536
|
));
|
|
480
537
|
};
|
|
481
538
|
BlurView.displayName = "BlurView";
|
|
482
539
|
|
|
483
540
|
// src/components/view/rounded-view/rounded-view.tsx
|
|
484
|
-
import
|
|
485
|
-
import { View as
|
|
541
|
+
import React16 from "react";
|
|
542
|
+
import { View as View14 } from "react-native";
|
|
486
543
|
|
|
487
544
|
// src/components/view/rounded-view/rounded-view.hook.ts
|
|
488
545
|
import { useMemo } from "react";
|
|
@@ -536,8 +593,8 @@ var RoundedView = ({
|
|
|
536
593
|
bottomLeft,
|
|
537
594
|
bottomRight
|
|
538
595
|
});
|
|
539
|
-
return /* @__PURE__ */
|
|
540
|
-
|
|
596
|
+
return /* @__PURE__ */ React16.createElement(
|
|
597
|
+
View14,
|
|
541
598
|
{
|
|
542
599
|
style: [
|
|
543
600
|
borderRadiusStyle,
|
|
@@ -552,8 +609,8 @@ var RoundedView = ({
|
|
|
552
609
|
};
|
|
553
610
|
|
|
554
611
|
// src/components/view/aspect-ratio/aspect-ratio.tsx
|
|
555
|
-
import
|
|
556
|
-
import { View as
|
|
612
|
+
import React17 from "react";
|
|
613
|
+
import { View as View15 } from "react-native";
|
|
557
614
|
var AspectRatio = ({
|
|
558
615
|
children,
|
|
559
616
|
ratio,
|
|
@@ -563,8 +620,8 @@ var AspectRatio = ({
|
|
|
563
620
|
testID
|
|
564
621
|
}) => {
|
|
565
622
|
const alignStyle = alignment ? resolveAlignment(alignment) : {};
|
|
566
|
-
return /* @__PURE__ */
|
|
567
|
-
|
|
623
|
+
return /* @__PURE__ */ React17.createElement(
|
|
624
|
+
View15,
|
|
568
625
|
{
|
|
569
626
|
testID,
|
|
570
627
|
style: [
|
|
@@ -582,8 +639,8 @@ var AspectRatio = ({
|
|
|
582
639
|
AspectRatio.displayName = "AspectRatio";
|
|
583
640
|
|
|
584
641
|
// src/components/view/surface/surface.tsx
|
|
585
|
-
import
|
|
586
|
-
import { View as
|
|
642
|
+
import React18 from "react";
|
|
643
|
+
import { View as View16 } from "react-native";
|
|
587
644
|
import { getSafeThemeColor } from "@xaui/core";
|
|
588
645
|
var resolveBackgroundColor = (color, theme) => {
|
|
589
646
|
if (color === "background" || color === "foreground") {
|
|
@@ -603,8 +660,8 @@ var Surface = ({
|
|
|
603
660
|
const theme = useXUITheme();
|
|
604
661
|
const radiusStyle = useBorderRadiusStyles(radius);
|
|
605
662
|
const background = resolveBackgroundColor(themeColor, theme);
|
|
606
|
-
return /* @__PURE__ */
|
|
607
|
-
|
|
663
|
+
return /* @__PURE__ */ React18.createElement(
|
|
664
|
+
View16,
|
|
608
665
|
{
|
|
609
666
|
style: [
|
|
610
667
|
radiusStyle,
|
|
@@ -622,8 +679,8 @@ var Surface = ({
|
|
|
622
679
|
Surface.displayName = "Surface";
|
|
623
680
|
|
|
624
681
|
// src/components/view/screen/screen.tsx
|
|
625
|
-
import
|
|
626
|
-
import { View as
|
|
682
|
+
import React19 from "react";
|
|
683
|
+
import { View as View17 } from "react-native";
|
|
627
684
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
628
685
|
var Screen = ({
|
|
629
686
|
children,
|
|
@@ -634,36 +691,39 @@ var Screen = ({
|
|
|
634
691
|
}) => {
|
|
635
692
|
const theme = useXUITheme();
|
|
636
693
|
const resolvedBackgroundColor = backgroundColor ?? theme.colors.background;
|
|
637
|
-
const containerStyle = [
|
|
694
|
+
const containerStyle = [
|
|
695
|
+
{ flex: 1, backgroundColor: resolvedBackgroundColor, padding },
|
|
696
|
+
style
|
|
697
|
+
];
|
|
638
698
|
if (safeArea) {
|
|
639
|
-
return /* @__PURE__ */
|
|
699
|
+
return /* @__PURE__ */ React19.createElement(SafeAreaView, { style: containerStyle }, children);
|
|
640
700
|
}
|
|
641
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ React19.createElement(View17, { style: containerStyle }, children);
|
|
642
702
|
};
|
|
643
703
|
Screen.displayName = "Screen";
|
|
644
704
|
|
|
645
705
|
// src/components/view/align/align.tsx
|
|
646
|
-
import
|
|
647
|
-
import { View as
|
|
648
|
-
var Align = ({ children, alignment, style }) => /* @__PURE__ */
|
|
706
|
+
import React20 from "react";
|
|
707
|
+
import { View as View18 } from "react-native";
|
|
708
|
+
var Align = ({ children, alignment, style }) => /* @__PURE__ */ React20.createElement(View18, { style: [{ flex: 1 }, resolveAlignment(alignment), style] }, children);
|
|
649
709
|
Align.displayName = "Align";
|
|
650
710
|
|
|
651
711
|
// src/components/view/center/center.tsx
|
|
652
|
-
import
|
|
653
|
-
var Center = ({ children, style }) => /* @__PURE__ */
|
|
712
|
+
import React21 from "react";
|
|
713
|
+
var Center = ({ children, style }) => /* @__PURE__ */ React21.createElement(Align, { alignment: "center", style }, children);
|
|
654
714
|
Center.displayName = "Center";
|
|
655
715
|
|
|
656
716
|
// src/components/view/grid/grid.tsx
|
|
657
|
-
import
|
|
717
|
+
import React23, { useMemo as useMemo2, useState } from "react";
|
|
658
718
|
import {
|
|
659
|
-
View as
|
|
719
|
+
View as View20
|
|
660
720
|
} from "react-native";
|
|
661
721
|
|
|
662
722
|
// src/components/view/grid/grid-item.tsx
|
|
663
|
-
import
|
|
664
|
-
import { View as
|
|
723
|
+
import React22 from "react";
|
|
724
|
+
import { View as View19 } from "react-native";
|
|
665
725
|
var GridItem = ({ children, style }) => {
|
|
666
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ React22.createElement(View19, { style }, children);
|
|
667
727
|
};
|
|
668
728
|
GridItem.displayName = "GridItem";
|
|
669
729
|
|
|
@@ -677,7 +737,7 @@ var getSafeSpan = (span, columns) => {
|
|
|
677
737
|
return Math.min(Math.floor(span), columns);
|
|
678
738
|
};
|
|
679
739
|
var isGridItemElement = (child) => {
|
|
680
|
-
if (!
|
|
740
|
+
if (!React23.isValidElement(child)) return false;
|
|
681
741
|
if (child.type === GridItem) return true;
|
|
682
742
|
const displayName = child.type.displayName;
|
|
683
743
|
return displayName === "GridItem";
|
|
@@ -696,15 +756,15 @@ var Grid = ({
|
|
|
696
756
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
697
757
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
698
758
|
const itemWidth = `${100 / safeColumns}%`;
|
|
699
|
-
const items =
|
|
759
|
+
const items = React23.Children.toArray(children);
|
|
700
760
|
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
701
761
|
const baseItemWidth = useMemo2(() => {
|
|
702
762
|
if (!containerWidth) return void 0;
|
|
703
763
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
704
764
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
705
765
|
let currentColumn = 0;
|
|
706
|
-
return /* @__PURE__ */
|
|
707
|
-
|
|
766
|
+
return /* @__PURE__ */ React23.createElement(
|
|
767
|
+
View20,
|
|
708
768
|
{
|
|
709
769
|
style: [
|
|
710
770
|
{
|
|
@@ -721,7 +781,7 @@ var Grid = ({
|
|
|
721
781
|
}
|
|
722
782
|
},
|
|
723
783
|
items.map((child, index) => {
|
|
724
|
-
const key =
|
|
784
|
+
const key = React23.isValidElement(child) && child.key ? child.key : `grid-${index}`;
|
|
725
785
|
const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
|
|
726
786
|
const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
|
|
727
787
|
if (currentColumn + span > safeColumns) {
|
|
@@ -741,7 +801,7 @@ var Grid = ({
|
|
|
741
801
|
itemStyle,
|
|
742
802
|
child.props.style
|
|
743
803
|
];
|
|
744
|
-
const element2 =
|
|
804
|
+
const element2 = React23.cloneElement(child, {
|
|
745
805
|
key,
|
|
746
806
|
style: mergedStyle
|
|
747
807
|
});
|
|
@@ -749,8 +809,8 @@ var Grid = ({
|
|
|
749
809
|
return element2;
|
|
750
810
|
}
|
|
751
811
|
const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
|
|
752
|
-
const element = /* @__PURE__ */
|
|
753
|
-
|
|
812
|
+
const element = /* @__PURE__ */ React23.createElement(
|
|
813
|
+
View20,
|
|
754
814
|
{
|
|
755
815
|
key,
|
|
756
816
|
style: [
|
|
@@ -773,11 +833,11 @@ var Grid = ({
|
|
|
773
833
|
};
|
|
774
834
|
|
|
775
835
|
// src/components/view/grid/grid-builder.tsx
|
|
776
|
-
import
|
|
836
|
+
import React24, { useMemo as useMemo3 } from "react";
|
|
777
837
|
import {
|
|
778
838
|
FlatList,
|
|
779
839
|
StyleSheet as StyleSheet2,
|
|
780
|
-
View as
|
|
840
|
+
View as View21
|
|
781
841
|
} from "react-native";
|
|
782
842
|
var getSafeColumns2 = (columns) => {
|
|
783
843
|
if (!columns || columns <= 0) return 1;
|
|
@@ -864,7 +924,7 @@ var GridBuilder = ({
|
|
|
864
924
|
},
|
|
865
925
|
itemStyle
|
|
866
926
|
];
|
|
867
|
-
return /* @__PURE__ */
|
|
927
|
+
return /* @__PURE__ */ React24.createElement(View21, { style: placeholderStyle, pointerEvents: "none" });
|
|
868
928
|
}
|
|
869
929
|
const element = resolvedRenderer({ item: item.item, index: item.index });
|
|
870
930
|
if (element === null) return null;
|
|
@@ -880,7 +940,7 @@ var GridBuilder = ({
|
|
|
880
940
|
},
|
|
881
941
|
itemStyle
|
|
882
942
|
];
|
|
883
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React24.createElement(View21, { style: wrapperStyle }, element);
|
|
884
944
|
};
|
|
885
945
|
const flattenedStyle = StyleSheet2.flatten(style) ?? {};
|
|
886
946
|
const {
|
|
@@ -901,7 +961,7 @@ var GridBuilder = ({
|
|
|
901
961
|
...columnGap !== void 0 ? { columnGap } : {}
|
|
902
962
|
};
|
|
903
963
|
const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
|
|
904
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ React24.createElement(
|
|
905
965
|
FlatList,
|
|
906
966
|
{
|
|
907
967
|
data: paddedData,
|
|
@@ -921,7 +981,7 @@ var GridBuilder = ({
|
|
|
921
981
|
GridBuilder.displayName = "GridBuilder";
|
|
922
982
|
|
|
923
983
|
// src/components/view/conditional/conditional-view.tsx
|
|
924
|
-
import
|
|
984
|
+
import React25, { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
|
|
925
985
|
import { Animated as Animated3 } from "react-native";
|
|
926
986
|
|
|
927
987
|
// src/components/view/conditional/conditional-view.utils.ts
|
|
@@ -1073,18 +1133,18 @@ var ConditionalView = ({
|
|
|
1073
1133
|
if (!shouldRender) {
|
|
1074
1134
|
return null;
|
|
1075
1135
|
}
|
|
1076
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ React25.createElement(Animated3.View, { style: animatedStyle }, children);
|
|
1077
1137
|
};
|
|
1078
1138
|
|
|
1079
1139
|
// src/components/view/masonry-grid/masonry-grid.tsx
|
|
1080
|
-
import
|
|
1081
|
-
import { View as
|
|
1140
|
+
import React26, { useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
|
|
1141
|
+
import { View as View22 } from "react-native";
|
|
1082
1142
|
var getSafeColumns3 = (columns) => {
|
|
1083
1143
|
if (!columns || columns <= 0) return 1;
|
|
1084
1144
|
return Math.floor(columns);
|
|
1085
1145
|
};
|
|
1086
1146
|
var getItemKey = (child, index) => {
|
|
1087
|
-
return
|
|
1147
|
+
return React26.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
|
|
1088
1148
|
};
|
|
1089
1149
|
var MasonryGrid = ({
|
|
1090
1150
|
children,
|
|
@@ -1107,7 +1167,7 @@ var MasonryGrid = ({
|
|
|
1107
1167
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
1108
1168
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
1109
1169
|
const items = useMemo5(
|
|
1110
|
-
() =>
|
|
1170
|
+
() => React26.Children.toArray(children).map((child, index) => ({
|
|
1111
1171
|
key: getItemKey(child, index),
|
|
1112
1172
|
element: child
|
|
1113
1173
|
})),
|
|
@@ -1124,8 +1184,8 @@ var MasonryGrid = ({
|
|
|
1124
1184
|
});
|
|
1125
1185
|
return buckets;
|
|
1126
1186
|
}, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
|
|
1127
|
-
return /* @__PURE__ */
|
|
1128
|
-
|
|
1187
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1188
|
+
View22,
|
|
1129
1189
|
{
|
|
1130
1190
|
style: [
|
|
1131
1191
|
{
|
|
@@ -1148,10 +1208,10 @@ var MasonryGrid = ({
|
|
|
1148
1208
|
},
|
|
1149
1209
|
columnStyle
|
|
1150
1210
|
];
|
|
1151
|
-
return /* @__PURE__ */
|
|
1211
|
+
return /* @__PURE__ */ React26.createElement(View22, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
|
|
1152
1212
|
const isLastRow = index === column.length - 1;
|
|
1153
|
-
return /* @__PURE__ */
|
|
1154
|
-
|
|
1213
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1214
|
+
View22,
|
|
1155
1215
|
{
|
|
1156
1216
|
key: item.key,
|
|
1157
1217
|
style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
|
|
@@ -1170,18 +1230,18 @@ var MasonryGrid = ({
|
|
|
1170
1230
|
};
|
|
1171
1231
|
|
|
1172
1232
|
// src/components/view/masonry-grid/masonry-grid-item.tsx
|
|
1173
|
-
import
|
|
1174
|
-
import { View as
|
|
1233
|
+
import React27 from "react";
|
|
1234
|
+
import { View as View23 } from "react-native";
|
|
1175
1235
|
var MasonryGridItem = ({
|
|
1176
1236
|
children,
|
|
1177
1237
|
style
|
|
1178
1238
|
}) => {
|
|
1179
|
-
return /* @__PURE__ */
|
|
1239
|
+
return /* @__PURE__ */ React27.createElement(View23, { style }, children);
|
|
1180
1240
|
};
|
|
1181
1241
|
MasonryGridItem.displayName = "MasonryGridItem";
|
|
1182
1242
|
|
|
1183
1243
|
// src/components/view/masonry-grid/masonry-grid-builder.tsx
|
|
1184
|
-
import
|
|
1244
|
+
import React28, { useMemo as useMemo6, useRef as useRef4 } from "react";
|
|
1185
1245
|
import {
|
|
1186
1246
|
ScrollView
|
|
1187
1247
|
} from "react-native";
|
|
@@ -1241,7 +1301,7 @@ var MasonryGridBuilder = ({
|
|
|
1241
1301
|
onEndReached();
|
|
1242
1302
|
}
|
|
1243
1303
|
};
|
|
1244
|
-
return /* @__PURE__ */
|
|
1304
|
+
return /* @__PURE__ */ React28.createElement(
|
|
1245
1305
|
ScrollView,
|
|
1246
1306
|
{
|
|
1247
1307
|
scrollEventThrottle: 16,
|
|
@@ -1253,7 +1313,7 @@ var MasonryGridBuilder = ({
|
|
|
1253
1313
|
onScroll: handleScroll
|
|
1254
1314
|
},
|
|
1255
1315
|
header,
|
|
1256
|
-
/* @__PURE__ */
|
|
1316
|
+
/* @__PURE__ */ React28.createElement(
|
|
1257
1317
|
MasonryGrid,
|
|
1258
1318
|
{
|
|
1259
1319
|
columns,
|
|
@@ -1263,7 +1323,7 @@ var MasonryGridBuilder = ({
|
|
|
1263
1323
|
style: [{ width: "100%" }, style],
|
|
1264
1324
|
columnStyle
|
|
1265
1325
|
},
|
|
1266
|
-
resolvedData.map((item, index) => /* @__PURE__ */
|
|
1326
|
+
resolvedData.map((item, index) => /* @__PURE__ */ React28.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
|
|
1267
1327
|
),
|
|
1268
1328
|
footer
|
|
1269
1329
|
);
|
|
@@ -1278,6 +1338,9 @@ export {
|
|
|
1278
1338
|
ConditionalView,
|
|
1279
1339
|
ConstrainedBox,
|
|
1280
1340
|
Container,
|
|
1341
|
+
Expanded,
|
|
1342
|
+
Flex,
|
|
1343
|
+
Flexible,
|
|
1281
1344
|
FractionallySizedBox,
|
|
1282
1345
|
Grid,
|
|
1283
1346
|
GridBuilder,
|
|
@@ -1293,5 +1356,6 @@ export {
|
|
|
1293
1356
|
Screen,
|
|
1294
1357
|
SizedBox,
|
|
1295
1358
|
Spacer,
|
|
1296
|
-
Surface
|
|
1359
|
+
Surface,
|
|
1360
|
+
Wrap
|
|
1297
1361
|
};
|