@xaui/native 0.0.16 → 0.0.18
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/accordion/index.cjs +1 -1
- package/dist/accordion/index.js +5 -4
- package/dist/alert/index.js +352 -3
- package/dist/autocomplete/index.cjs +5 -11
- package/dist/autocomplete/index.js +1122 -5
- package/dist/avatar/index.js +276 -4
- package/dist/badge/index.js +193 -3
- package/dist/bottom-sheet/index.cjs +9 -20
- package/dist/bottom-sheet/index.js +364 -3
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +429 -0
- package/dist/card/index.d.cts +186 -0
- package/dist/card/index.d.ts +186 -0
- package/dist/card/index.js +336 -0
- package/dist/carousel/index.cjs +458 -0
- package/dist/carousel/index.d.cts +147 -0
- package/dist/carousel/index.d.ts +147 -0
- package/dist/carousel/index.js +381 -0
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +2 -8
- package/dist/chip/index.js +497 -5
- package/dist/chunk-DXXNBF5P.js +7 -0
- package/dist/{chunk-MKHBEJLO.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/{chunk-II4QINLG.js → chunk-JEGEPGVU.js} +2 -2
- package/dist/{chunk-NBRASCX4.js → chunk-LTKYHG5V.js} +6 -13
- package/dist/{chunk-GNJIET26.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.js +1623 -3
- package/dist/divider/index.js +3 -2
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +4 -13
- package/dist/fab-menu/index.js +325 -6
- package/dist/index.cjs +0 -5709
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +0 -62
- package/dist/indicator/index.js +3 -2
- package/dist/menu/index.cjs +8 -7
- package/dist/menu/index.js +15 -9
- package/dist/progress/index.js +2 -1
- package/dist/segment-button/index.cjs +492 -0
- package/dist/segment-button/index.d.cts +141 -0
- package/dist/segment-button/index.d.ts +141 -0
- package/dist/segment-button/index.js +405 -0
- package/dist/select/index.js +2 -1
- package/dist/switch/index.js +2 -1
- package/dist/typography/index.js +146 -3
- package/dist/view/index.cjs +153 -78
- package/dist/view/index.d.cts +77 -1
- package/dist/view/index.d.ts +77 -1
- package/dist/view/index.js +125 -52
- package/package.json +16 -1
- package/dist/chunk-2T6FKPJW.js +0 -356
- package/dist/chunk-4LFRYVSR.js +0 -281
- package/dist/chunk-7OFTYKK4.js +0 -1627
- package/dist/chunk-EI5OMBFE.js +0 -338
- package/dist/chunk-GAOI4KIV.js +0 -379
- package/dist/chunk-NMZUPH3R.js +0 -1133
- package/dist/chunk-QLEQYKG5.js +0 -509
- package/dist/chunk-XJKA22BK.js +0 -197
- package/dist/chunk-ZYTBRHLJ.js +0 -150
package/dist/typography/index.js
CHANGED
|
@@ -1,7 +1,150 @@
|
|
|
1
|
+
import "../chunk-DXXNBF5P.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
|
|
3
|
+
useXUITheme
|
|
4
|
+
} from "../chunk-LTKYHG5V.js";
|
|
5
|
+
|
|
6
|
+
// src/components/typography/typography.tsx
|
|
7
|
+
import React, { useMemo as useMemo2 } from "react";
|
|
8
|
+
import { Text } from "react-native";
|
|
9
|
+
|
|
10
|
+
// src/components/typography/typography.style.ts
|
|
11
|
+
import { StyleSheet } from "react-native";
|
|
12
|
+
var styles = StyleSheet.create({
|
|
13
|
+
text: {
|
|
14
|
+
includeFontPadding: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// src/components/typography/typography.hook.ts
|
|
19
|
+
import { useMemo } from "react";
|
|
20
|
+
import { getSafeThemeColor } from "@xaui/core";
|
|
21
|
+
var knownVariants = {
|
|
22
|
+
caption: true,
|
|
23
|
+
headlineLarge: true,
|
|
24
|
+
headlineMedium: true,
|
|
25
|
+
headlineSmall: true,
|
|
26
|
+
subtitleLarge: true,
|
|
27
|
+
subtitleMedium: true,
|
|
28
|
+
subtitleSmall: true,
|
|
29
|
+
bodyLarge: true,
|
|
30
|
+
bodyMedium: true,
|
|
31
|
+
bodySmall: true
|
|
32
|
+
};
|
|
33
|
+
var isKnownVariant = (variant) => {
|
|
34
|
+
return Boolean(knownVariants[variant]);
|
|
35
|
+
};
|
|
36
|
+
var useTypographyColor = (themeColor) => {
|
|
37
|
+
const theme = useXUITheme();
|
|
38
|
+
const color = useMemo(() => {
|
|
39
|
+
if (themeColor === "default") {
|
|
40
|
+
return theme.colors.foreground;
|
|
41
|
+
}
|
|
42
|
+
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
43
|
+
return theme.colors[safeThemeColor].main;
|
|
44
|
+
}, [theme, themeColor]);
|
|
45
|
+
return color;
|
|
46
|
+
};
|
|
47
|
+
var useTypographyVariantStyles = (variant) => {
|
|
48
|
+
const theme = useXUITheme();
|
|
49
|
+
const variantStyles = useMemo(() => {
|
|
50
|
+
if (!isKnownVariant(variant)) {
|
|
51
|
+
return {
|
|
52
|
+
fontFamily: theme.fontFamilies.body,
|
|
53
|
+
fontSize: theme.fontSizes.md,
|
|
54
|
+
fontWeight: theme.fontWeights.normal
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const styles2 = {
|
|
58
|
+
caption: {
|
|
59
|
+
fontFamily: theme.fontFamilies.body,
|
|
60
|
+
fontSize: theme.fontSizes.xs,
|
|
61
|
+
fontWeight: theme.fontWeights.normal
|
|
62
|
+
},
|
|
63
|
+
headlineLarge: {
|
|
64
|
+
fontFamily: theme.fontFamilies.heading,
|
|
65
|
+
fontSize: theme.fontSizes["4xl"] + 3,
|
|
66
|
+
fontWeight: theme.fontWeights.bold
|
|
67
|
+
},
|
|
68
|
+
headlineMedium: {
|
|
69
|
+
fontFamily: theme.fontFamilies.heading,
|
|
70
|
+
fontSize: theme.fontSizes["3xl"] + 3,
|
|
71
|
+
fontWeight: theme.fontWeights.bold
|
|
72
|
+
},
|
|
73
|
+
headlineSmall: {
|
|
74
|
+
fontFamily: theme.fontFamilies.heading,
|
|
75
|
+
fontSize: theme.fontSizes["2xl"] + 3,
|
|
76
|
+
fontWeight: theme.fontWeights.semibold
|
|
77
|
+
},
|
|
78
|
+
subtitleLarge: {
|
|
79
|
+
fontFamily: theme.fontFamilies.body,
|
|
80
|
+
fontSize: theme.fontSizes.md + 5,
|
|
81
|
+
fontWeight: theme.fontWeights.medium
|
|
82
|
+
},
|
|
83
|
+
subtitleMedium: {
|
|
84
|
+
fontFamily: theme.fontFamilies.body,
|
|
85
|
+
fontSize: theme.fontSizes.sm + 5,
|
|
86
|
+
fontWeight: theme.fontWeights.medium
|
|
87
|
+
},
|
|
88
|
+
subtitleSmall: {
|
|
89
|
+
fontFamily: theme.fontFamilies.body,
|
|
90
|
+
fontSize: theme.fontSizes.xs + 5,
|
|
91
|
+
fontWeight: theme.fontWeights.medium
|
|
92
|
+
},
|
|
93
|
+
bodyLarge: {
|
|
94
|
+
fontFamily: theme.fontFamilies.body,
|
|
95
|
+
fontSize: theme.fontSizes.md,
|
|
96
|
+
fontWeight: theme.fontWeights.normal
|
|
97
|
+
},
|
|
98
|
+
bodyMedium: {
|
|
99
|
+
fontFamily: theme.fontFamilies.body,
|
|
100
|
+
fontSize: theme.fontSizes.sm,
|
|
101
|
+
fontWeight: theme.fontWeights.normal
|
|
102
|
+
},
|
|
103
|
+
bodySmall: {
|
|
104
|
+
fontFamily: theme.fontFamilies.body,
|
|
105
|
+
fontSize: theme.fontSizes.xs,
|
|
106
|
+
fontWeight: theme.fontWeights.normal
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return styles2[variant];
|
|
110
|
+
}, [theme, variant]);
|
|
111
|
+
return variantStyles;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/components/typography/typography.tsx
|
|
115
|
+
var Typography = ({
|
|
116
|
+
children,
|
|
117
|
+
align,
|
|
118
|
+
themeColor = "default",
|
|
119
|
+
variant = "bodyMedium",
|
|
120
|
+
maxLines,
|
|
121
|
+
overflow = "clip",
|
|
122
|
+
style
|
|
123
|
+
}) => {
|
|
124
|
+
const color = useTypographyColor(themeColor);
|
|
125
|
+
const variantStyles = useTypographyVariantStyles(variant);
|
|
126
|
+
const colorStyle = { color };
|
|
127
|
+
const ellipsizeMode = useMemo2(() => {
|
|
128
|
+
if (!maxLines) return void 0;
|
|
129
|
+
if (overflow === "clip") return "clip";
|
|
130
|
+
return "tail";
|
|
131
|
+
}, [maxLines, overflow]);
|
|
132
|
+
return /* @__PURE__ */ React.createElement(
|
|
133
|
+
Text,
|
|
134
|
+
{
|
|
135
|
+
numberOfLines: maxLines,
|
|
136
|
+
ellipsizeMode,
|
|
137
|
+
style: [
|
|
138
|
+
styles.text,
|
|
139
|
+
variantStyles,
|
|
140
|
+
align && { textAlign: align },
|
|
141
|
+
colorStyle,
|
|
142
|
+
style
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
children
|
|
146
|
+
);
|
|
147
|
+
};
|
|
5
148
|
export {
|
|
6
149
|
Typography
|
|
7
150
|
};
|
package/dist/view/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/components/view/index.ts
|
|
31
31
|
var view_exports = {};
|
|
32
32
|
__export(view_exports, {
|
|
33
|
+
AspectRatio: () => AspectRatio,
|
|
33
34
|
BlurView: () => BlurView,
|
|
34
35
|
Column: () => Column,
|
|
35
36
|
ConditionalView: () => ConditionalView,
|
|
@@ -42,6 +43,7 @@ __export(view_exports, {
|
|
|
42
43
|
MasonryGridItem: () => MasonryGridItem,
|
|
43
44
|
Padding: () => Padding,
|
|
44
45
|
PositionedView: () => PositionedView,
|
|
46
|
+
RoundedView: () => RoundedView,
|
|
45
47
|
Row: () => Row,
|
|
46
48
|
SizedBox: () => SizedBox,
|
|
47
49
|
Spacer: () => Spacer
|
|
@@ -343,15 +345,86 @@ var BlurView = ({
|
|
|
343
345
|
};
|
|
344
346
|
BlurView.displayName = "BlurView";
|
|
345
347
|
|
|
346
|
-
// src/components/view/
|
|
348
|
+
// src/components/view/rounded-view/rounded-view.tsx
|
|
347
349
|
var import_react10 = __toESM(require("react"), 1);
|
|
350
|
+
var import_react_native9 = require("react-native");
|
|
351
|
+
|
|
352
|
+
// src/components/view/rounded-view/rounded-view.hook.ts
|
|
353
|
+
var import_react9 = require("react");
|
|
354
|
+
var useRoundedViewStyle = (props) => {
|
|
355
|
+
const { all = 0, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = props;
|
|
356
|
+
return (0, import_react9.useMemo)(() => {
|
|
357
|
+
return {
|
|
358
|
+
borderTopLeftRadius: topLeft ?? top ?? left ?? all,
|
|
359
|
+
borderTopRightRadius: topRight ?? top ?? right ?? all,
|
|
360
|
+
borderBottomLeftRadius: bottomLeft ?? bottom ?? left ?? all,
|
|
361
|
+
borderBottomRightRadius: bottomRight ?? bottom ?? right ?? all
|
|
362
|
+
};
|
|
363
|
+
}, [all, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight]);
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// src/components/view/rounded-view/rounded-view.tsx
|
|
367
|
+
var RoundedView = ({
|
|
368
|
+
children,
|
|
369
|
+
all,
|
|
370
|
+
top,
|
|
371
|
+
bottom,
|
|
372
|
+
left,
|
|
373
|
+
right,
|
|
374
|
+
topLeft,
|
|
375
|
+
topRight,
|
|
376
|
+
bottomLeft,
|
|
377
|
+
bottomRight,
|
|
378
|
+
fullWidth = false,
|
|
379
|
+
backgroundColor,
|
|
380
|
+
style
|
|
381
|
+
}) => {
|
|
382
|
+
const borderRadiusStyle = useRoundedViewStyle({
|
|
383
|
+
all,
|
|
384
|
+
top,
|
|
385
|
+
bottom,
|
|
386
|
+
left,
|
|
387
|
+
right,
|
|
388
|
+
topLeft,
|
|
389
|
+
topRight,
|
|
390
|
+
bottomLeft,
|
|
391
|
+
bottomRight
|
|
392
|
+
});
|
|
393
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
394
|
+
import_react_native9.View,
|
|
395
|
+
{
|
|
396
|
+
style: [
|
|
397
|
+
borderRadiusStyle,
|
|
398
|
+
fullWidth && styles2.fullWidth,
|
|
399
|
+
backgroundColor && { backgroundColor },
|
|
400
|
+
style
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
children
|
|
404
|
+
);
|
|
405
|
+
};
|
|
406
|
+
var styles2 = import_react_native9.StyleSheet.create({
|
|
407
|
+
fullWidth: {
|
|
408
|
+
width: "100%"
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// src/components/view/aspect-ratio/aspect-ratio.tsx
|
|
413
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
348
414
|
var import_react_native10 = require("react-native");
|
|
415
|
+
var AspectRatio = ({ children, ratio, style }) => {
|
|
416
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_native10.View, { style: [{ aspectRatio: ratio }, style] }, children);
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
// src/components/view/grid/grid.tsx
|
|
420
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
421
|
+
var import_react_native12 = require("react-native");
|
|
349
422
|
|
|
350
423
|
// src/components/view/grid/grid-item.tsx
|
|
351
|
-
var
|
|
352
|
-
var
|
|
424
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
425
|
+
var import_react_native11 = require("react-native");
|
|
353
426
|
var GridItem = ({ children, style }) => {
|
|
354
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react_native11.View, { style }, children);
|
|
355
428
|
};
|
|
356
429
|
GridItem.displayName = "GridItem";
|
|
357
430
|
|
|
@@ -365,7 +438,7 @@ var getSafeSpan = (span, columns) => {
|
|
|
365
438
|
return Math.min(Math.floor(span), columns);
|
|
366
439
|
};
|
|
367
440
|
var isGridItemElement = (child) => {
|
|
368
|
-
if (!
|
|
441
|
+
if (!import_react13.default.isValidElement(child)) return false;
|
|
369
442
|
if (child.type === GridItem) return true;
|
|
370
443
|
const displayName = child.type.displayName;
|
|
371
444
|
return displayName === "GridItem";
|
|
@@ -379,20 +452,20 @@ var Grid = ({
|
|
|
379
452
|
style,
|
|
380
453
|
itemStyle
|
|
381
454
|
}) => {
|
|
382
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
455
|
+
const [containerWidth, setContainerWidth] = (0, import_react13.useState)();
|
|
383
456
|
const safeColumns = getSafeColumns(columns);
|
|
384
457
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
385
458
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
386
459
|
const itemWidth = `${100 / safeColumns}%`;
|
|
387
|
-
const items =
|
|
460
|
+
const items = import_react13.default.Children.toArray(children);
|
|
388
461
|
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
389
|
-
const baseItemWidth = (0,
|
|
462
|
+
const baseItemWidth = (0, import_react13.useMemo)(() => {
|
|
390
463
|
if (!containerWidth) return void 0;
|
|
391
464
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
392
465
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
393
466
|
let currentColumn = 0;
|
|
394
|
-
return /* @__PURE__ */
|
|
395
|
-
|
|
467
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
468
|
+
import_react_native12.View,
|
|
396
469
|
{
|
|
397
470
|
style: [
|
|
398
471
|
{
|
|
@@ -409,7 +482,7 @@ var Grid = ({
|
|
|
409
482
|
}
|
|
410
483
|
},
|
|
411
484
|
items.map((child, index) => {
|
|
412
|
-
const key =
|
|
485
|
+
const key = import_react13.default.isValidElement(child) && child.key ? child.key : `grid-${index}`;
|
|
413
486
|
const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
|
|
414
487
|
const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
|
|
415
488
|
if (currentColumn + span > safeColumns) {
|
|
@@ -429,7 +502,7 @@ var Grid = ({
|
|
|
429
502
|
itemStyle,
|
|
430
503
|
child.props.style
|
|
431
504
|
];
|
|
432
|
-
const element2 =
|
|
505
|
+
const element2 = import_react13.default.cloneElement(child, {
|
|
433
506
|
key,
|
|
434
507
|
style: mergedStyle
|
|
435
508
|
});
|
|
@@ -437,8 +510,8 @@ var Grid = ({
|
|
|
437
510
|
return element2;
|
|
438
511
|
}
|
|
439
512
|
const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
|
|
440
|
-
const element = /* @__PURE__ */
|
|
441
|
-
|
|
513
|
+
const element = /* @__PURE__ */ import_react13.default.createElement(
|
|
514
|
+
import_react_native12.View,
|
|
442
515
|
{
|
|
443
516
|
key,
|
|
444
517
|
style: [
|
|
@@ -461,8 +534,8 @@ var Grid = ({
|
|
|
461
534
|
};
|
|
462
535
|
|
|
463
536
|
// src/components/view/grid/grid-builder.tsx
|
|
464
|
-
var
|
|
465
|
-
var
|
|
537
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
538
|
+
var import_react_native13 = require("react-native");
|
|
466
539
|
var getSafeColumns2 = (columns) => {
|
|
467
540
|
if (!columns || columns <= 0) return 1;
|
|
468
541
|
return Math.floor(columns);
|
|
@@ -494,11 +567,11 @@ var GridBuilder = ({
|
|
|
494
567
|
const safeColumns = getSafeColumns2(columns);
|
|
495
568
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
496
569
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
497
|
-
const resolvedData = (0,
|
|
570
|
+
const resolvedData = (0, import_react14.useMemo)(
|
|
498
571
|
() => resolveGridData(data, itemCount),
|
|
499
572
|
[data, itemCount]
|
|
500
573
|
);
|
|
501
|
-
const paddedData = (0,
|
|
574
|
+
const paddedData = (0, import_react14.useMemo)(() => {
|
|
502
575
|
const remainder = resolvedData.length % safeColumns;
|
|
503
576
|
const placeholders = remainder === 0 ? 0 : safeColumns - remainder;
|
|
504
577
|
if (placeholders === 0)
|
|
@@ -519,12 +592,12 @@ var GridBuilder = ({
|
|
|
519
592
|
}))
|
|
520
593
|
];
|
|
521
594
|
}, [resolvedData, safeColumns]);
|
|
522
|
-
const resolvedKeyExtractor = (0,
|
|
595
|
+
const resolvedKeyExtractor = (0, import_react14.useMemo)(() => {
|
|
523
596
|
if (keyExtractor)
|
|
524
597
|
return (item, index) => item.type === "data" ? keyExtractor(item.item, item.index) : item.key ?? `placeholder-${index}`;
|
|
525
598
|
return (item, index) => item.type === "data" ? `grid-${item.index}` : item.key ?? `placeholder-${index}`;
|
|
526
599
|
}, [keyExtractor]);
|
|
527
|
-
const resolvedRenderer = (0,
|
|
600
|
+
const resolvedRenderer = (0, import_react14.useMemo)(() => {
|
|
528
601
|
if (renderItem) return renderItem;
|
|
529
602
|
if (itemBuilder)
|
|
530
603
|
return ({ item, index }) => itemBuilder({ item, index });
|
|
@@ -548,7 +621,7 @@ var GridBuilder = ({
|
|
|
548
621
|
},
|
|
549
622
|
itemStyle
|
|
550
623
|
];
|
|
551
|
-
return /* @__PURE__ */
|
|
624
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_native13.View, { style: placeholderStyle, pointerEvents: "none" });
|
|
552
625
|
}
|
|
553
626
|
const element = resolvedRenderer({ item: item.item, index: item.index });
|
|
554
627
|
if (element === null) return null;
|
|
@@ -564,9 +637,9 @@ var GridBuilder = ({
|
|
|
564
637
|
},
|
|
565
638
|
itemStyle
|
|
566
639
|
];
|
|
567
|
-
return /* @__PURE__ */
|
|
640
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_native13.View, { style: wrapperStyle }, element);
|
|
568
641
|
};
|
|
569
|
-
const flattenedStyle =
|
|
642
|
+
const flattenedStyle = import_react_native13.StyleSheet.flatten(style) ?? {};
|
|
570
643
|
const {
|
|
571
644
|
alignItems,
|
|
572
645
|
justifyContent,
|
|
@@ -585,8 +658,8 @@ var GridBuilder = ({
|
|
|
585
658
|
...columnGap !== void 0 ? { columnGap } : {}
|
|
586
659
|
};
|
|
587
660
|
const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
|
|
588
|
-
return /* @__PURE__ */
|
|
589
|
-
|
|
661
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
662
|
+
import_react_native13.FlatList,
|
|
590
663
|
{
|
|
591
664
|
data: paddedData,
|
|
592
665
|
renderItem: renderGridItem,
|
|
@@ -605,8 +678,8 @@ var GridBuilder = ({
|
|
|
605
678
|
GridBuilder.displayName = "GridBuilder";
|
|
606
679
|
|
|
607
680
|
// src/components/view/conditional/conditional-view.tsx
|
|
608
|
-
var
|
|
609
|
-
var
|
|
681
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
682
|
+
var import_react_native15 = require("react-native");
|
|
610
683
|
|
|
611
684
|
// src/components/view/conditional/conditional-view.utils.ts
|
|
612
685
|
var FINAL_VALUES = {
|
|
@@ -635,7 +708,7 @@ var getExitValues = (animation) => {
|
|
|
635
708
|
};
|
|
636
709
|
|
|
637
710
|
// src/components/view/conditional/conditional-view.animation.ts
|
|
638
|
-
var
|
|
711
|
+
var import_react_native14 = require("react-native");
|
|
639
712
|
var runConditionalViewAnimation = ({
|
|
640
713
|
opacity,
|
|
641
714
|
scale,
|
|
@@ -644,27 +717,27 @@ var runConditionalViewAnimation = ({
|
|
|
644
717
|
toValues,
|
|
645
718
|
onComplete
|
|
646
719
|
}) => {
|
|
647
|
-
const easing =
|
|
648
|
-
const animation =
|
|
649
|
-
|
|
720
|
+
const easing = import_react_native14.Easing.out(import_react_native14.Easing.cubic);
|
|
721
|
+
const animation = import_react_native14.Animated.parallel([
|
|
722
|
+
import_react_native14.Animated.timing(opacity, {
|
|
650
723
|
toValue: toValues.opacity,
|
|
651
724
|
duration: 800,
|
|
652
725
|
easing,
|
|
653
726
|
useNativeDriver: true
|
|
654
727
|
}),
|
|
655
|
-
|
|
728
|
+
import_react_native14.Animated.timing(scale, {
|
|
656
729
|
toValue: toValues.scale,
|
|
657
730
|
duration: 800,
|
|
658
731
|
easing,
|
|
659
732
|
useNativeDriver: true
|
|
660
733
|
}),
|
|
661
|
-
|
|
734
|
+
import_react_native14.Animated.timing(translateX, {
|
|
662
735
|
toValue: toValues.translateX,
|
|
663
736
|
duration: 800,
|
|
664
737
|
easing,
|
|
665
738
|
useNativeDriver: true
|
|
666
739
|
}),
|
|
667
|
-
|
|
740
|
+
import_react_native14.Animated.timing(translateY, {
|
|
668
741
|
toValue: toValues.translateY,
|
|
669
742
|
duration: 800,
|
|
670
743
|
easing,
|
|
@@ -686,34 +759,34 @@ var ConditionalView = ({
|
|
|
686
759
|
animation = "fade",
|
|
687
760
|
disableAnimation = false
|
|
688
761
|
}) => {
|
|
689
|
-
const [shouldRender, setShouldRender] = (0,
|
|
690
|
-
const animationRef = (0,
|
|
691
|
-
const initialValues = (0,
|
|
692
|
-
const exitValues = (0,
|
|
693
|
-
const opacity = (0,
|
|
694
|
-
new
|
|
762
|
+
const [shouldRender, setShouldRender] = (0, import_react15.useState)(isVisible);
|
|
763
|
+
const animationRef = (0, import_react15.useRef)(null);
|
|
764
|
+
const initialValues = (0, import_react15.useMemo)(() => getInitialValues(animation), [animation]);
|
|
765
|
+
const exitValues = (0, import_react15.useMemo)(() => getExitValues(animation), [animation]);
|
|
766
|
+
const opacity = (0, import_react15.useRef)(
|
|
767
|
+
new import_react_native15.Animated.Value(
|
|
695
768
|
disableAnimation ? FINAL_VALUES.opacity : initialValues.opacity
|
|
696
769
|
)
|
|
697
770
|
).current;
|
|
698
|
-
const scale = (0,
|
|
699
|
-
new
|
|
771
|
+
const scale = (0, import_react15.useRef)(
|
|
772
|
+
new import_react_native15.Animated.Value(disableAnimation ? FINAL_VALUES.scale : initialValues.scale)
|
|
700
773
|
).current;
|
|
701
|
-
const translateX = (0,
|
|
702
|
-
new
|
|
774
|
+
const translateX = (0, import_react15.useRef)(
|
|
775
|
+
new import_react_native15.Animated.Value(
|
|
703
776
|
disableAnimation ? FINAL_VALUES.translateX : initialValues.translateX
|
|
704
777
|
)
|
|
705
778
|
).current;
|
|
706
|
-
const translateY = (0,
|
|
707
|
-
new
|
|
779
|
+
const translateY = (0, import_react15.useRef)(
|
|
780
|
+
new import_react_native15.Animated.Value(
|
|
708
781
|
disableAnimation ? FINAL_VALUES.translateY : initialValues.translateY
|
|
709
782
|
)
|
|
710
783
|
).current;
|
|
711
|
-
(0,
|
|
784
|
+
(0, import_react15.useEffect)(() => {
|
|
712
785
|
if (isVisible) {
|
|
713
786
|
setShouldRender(true);
|
|
714
787
|
}
|
|
715
788
|
}, [isVisible]);
|
|
716
|
-
(0,
|
|
789
|
+
(0, import_react15.useEffect)(() => {
|
|
717
790
|
if (!shouldRender) return;
|
|
718
791
|
const startValues = isVisible ? disableAnimation ? FINAL_VALUES : initialValues : FINAL_VALUES;
|
|
719
792
|
const targetValues = isVisible ? FINAL_VALUES : exitValues;
|
|
@@ -747,7 +820,7 @@ var ConditionalView = ({
|
|
|
747
820
|
translateX,
|
|
748
821
|
translateY
|
|
749
822
|
]);
|
|
750
|
-
const animatedStyle = (0,
|
|
823
|
+
const animatedStyle = (0, import_react15.useMemo)(
|
|
751
824
|
() => ({
|
|
752
825
|
opacity,
|
|
753
826
|
transform: [{ translateX }, { translateY }, { scale }]
|
|
@@ -757,18 +830,18 @@ var ConditionalView = ({
|
|
|
757
830
|
if (!shouldRender) {
|
|
758
831
|
return null;
|
|
759
832
|
}
|
|
760
|
-
return /* @__PURE__ */
|
|
833
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_react_native15.Animated.View, { style: animatedStyle }, children);
|
|
761
834
|
};
|
|
762
835
|
|
|
763
836
|
// src/components/view/masonry-grid/masonry-grid.tsx
|
|
764
|
-
var
|
|
765
|
-
var
|
|
837
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
838
|
+
var import_react_native16 = require("react-native");
|
|
766
839
|
var getSafeColumns3 = (columns) => {
|
|
767
840
|
if (!columns || columns <= 0) return 1;
|
|
768
841
|
return Math.floor(columns);
|
|
769
842
|
};
|
|
770
843
|
var getItemKey = (child, index) => {
|
|
771
|
-
return
|
|
844
|
+
return import_react16.default.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
|
|
772
845
|
};
|
|
773
846
|
var MasonryGrid = ({
|
|
774
847
|
children,
|
|
@@ -779,25 +852,25 @@ var MasonryGrid = ({
|
|
|
779
852
|
style,
|
|
780
853
|
columnStyle
|
|
781
854
|
}) => {
|
|
782
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
783
|
-
const heightMapRef = (0,
|
|
784
|
-
const [layoutVersion, setLayoutVersion] = (0,
|
|
855
|
+
const [containerWidth, setContainerWidth] = (0, import_react16.useState)();
|
|
856
|
+
const heightMapRef = (0, import_react16.useRef)({});
|
|
857
|
+
const [layoutVersion, setLayoutVersion] = (0, import_react16.useState)(0);
|
|
785
858
|
const safeColumns = getSafeColumns3(columns);
|
|
786
859
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
787
860
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
788
861
|
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
789
|
-
const columnWidth = (0,
|
|
862
|
+
const columnWidth = (0, import_react16.useMemo)(() => {
|
|
790
863
|
if (!containerWidth) return void 0;
|
|
791
864
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
792
865
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
793
|
-
const items = (0,
|
|
794
|
-
() =>
|
|
866
|
+
const items = (0, import_react16.useMemo)(
|
|
867
|
+
() => import_react16.default.Children.toArray(children).map((child, index) => ({
|
|
795
868
|
key: getItemKey(child, index),
|
|
796
869
|
element: child
|
|
797
870
|
})),
|
|
798
871
|
[children]
|
|
799
872
|
);
|
|
800
|
-
const columnsItems = (0,
|
|
873
|
+
const columnsItems = (0, import_react16.useMemo)(() => {
|
|
801
874
|
const buckets = Array.from({ length: safeColumns }, () => []);
|
|
802
875
|
const heights = new Array(safeColumns).fill(0);
|
|
803
876
|
items.forEach((item) => {
|
|
@@ -808,8 +881,8 @@ var MasonryGrid = ({
|
|
|
808
881
|
});
|
|
809
882
|
return buckets;
|
|
810
883
|
}, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
|
|
811
|
-
return /* @__PURE__ */
|
|
812
|
-
|
|
884
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
885
|
+
import_react_native16.View,
|
|
813
886
|
{
|
|
814
887
|
style: [
|
|
815
888
|
{
|
|
@@ -832,10 +905,10 @@ var MasonryGrid = ({
|
|
|
832
905
|
},
|
|
833
906
|
columnStyle
|
|
834
907
|
];
|
|
835
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
|
|
836
909
|
const isLastRow = index === column.length - 1;
|
|
837
|
-
return /* @__PURE__ */
|
|
838
|
-
|
|
910
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
911
|
+
import_react_native16.View,
|
|
839
912
|
{
|
|
840
913
|
key: item.key,
|
|
841
914
|
style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
|
|
@@ -854,19 +927,19 @@ var MasonryGrid = ({
|
|
|
854
927
|
};
|
|
855
928
|
|
|
856
929
|
// src/components/view/masonry-grid/masonry-grid-item.tsx
|
|
857
|
-
var
|
|
858
|
-
var
|
|
930
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
931
|
+
var import_react_native17 = require("react-native");
|
|
859
932
|
var MasonryGridItem = ({
|
|
860
933
|
children,
|
|
861
934
|
style
|
|
862
935
|
}) => {
|
|
863
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ import_react17.default.createElement(import_react_native17.View, { style }, children);
|
|
864
937
|
};
|
|
865
938
|
MasonryGridItem.displayName = "MasonryGridItem";
|
|
866
939
|
|
|
867
940
|
// src/components/view/masonry-grid/masonry-grid-builder.tsx
|
|
868
|
-
var
|
|
869
|
-
var
|
|
941
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
942
|
+
var import_react_native18 = require("react-native");
|
|
870
943
|
var resolveMasonryData = (data, itemCount) => {
|
|
871
944
|
if (data) return data;
|
|
872
945
|
if (!itemCount || itemCount <= 0) return [];
|
|
@@ -895,21 +968,21 @@ var MasonryGridBuilder = ({
|
|
|
895
968
|
bounces,
|
|
896
969
|
onScroll
|
|
897
970
|
}) => {
|
|
898
|
-
const resolvedData = (0,
|
|
971
|
+
const resolvedData = (0, import_react18.useMemo)(
|
|
899
972
|
() => resolveMasonryData(data, itemCount),
|
|
900
973
|
[data, itemCount]
|
|
901
974
|
);
|
|
902
|
-
const resolvedKeyExtractor = (0,
|
|
975
|
+
const resolvedKeyExtractor = (0, import_react18.useMemo)(() => {
|
|
903
976
|
if (keyExtractor) return keyExtractor;
|
|
904
977
|
return (_, index) => `masonry-${index}`;
|
|
905
978
|
}, [keyExtractor]);
|
|
906
|
-
const resolvedRenderer = (0,
|
|
979
|
+
const resolvedRenderer = (0, import_react18.useMemo)(() => {
|
|
907
980
|
if (renderItem) return renderItem;
|
|
908
981
|
if (itemBuilder)
|
|
909
982
|
return ({ item, index }) => itemBuilder({ item, index });
|
|
910
983
|
return void 0;
|
|
911
984
|
}, [renderItem, itemBuilder]);
|
|
912
|
-
const lastEndReachedHeight = (0,
|
|
985
|
+
const lastEndReachedHeight = (0, import_react18.useRef)(0);
|
|
913
986
|
if (!resolvedRenderer) return null;
|
|
914
987
|
const handleScroll = (event) => {
|
|
915
988
|
onScroll?.(event);
|
|
@@ -923,8 +996,8 @@ var MasonryGridBuilder = ({
|
|
|
923
996
|
onEndReached();
|
|
924
997
|
}
|
|
925
998
|
};
|
|
926
|
-
return /* @__PURE__ */
|
|
927
|
-
|
|
999
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1000
|
+
import_react_native18.ScrollView,
|
|
928
1001
|
{
|
|
929
1002
|
scrollEventThrottle: 16,
|
|
930
1003
|
scrollEnabled,
|
|
@@ -935,7 +1008,7 @@ var MasonryGridBuilder = ({
|
|
|
935
1008
|
onScroll: handleScroll
|
|
936
1009
|
},
|
|
937
1010
|
header,
|
|
938
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
939
1012
|
MasonryGrid,
|
|
940
1013
|
{
|
|
941
1014
|
columns,
|
|
@@ -945,7 +1018,7 @@ var MasonryGridBuilder = ({
|
|
|
945
1018
|
style: [{ width: "100%" }, style],
|
|
946
1019
|
columnStyle
|
|
947
1020
|
},
|
|
948
|
-
resolvedData.map((item, index) => /* @__PURE__ */
|
|
1021
|
+
resolvedData.map((item, index) => /* @__PURE__ */ import_react18.default.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
|
|
949
1022
|
),
|
|
950
1023
|
footer
|
|
951
1024
|
);
|
|
@@ -953,6 +1026,7 @@ var MasonryGridBuilder = ({
|
|
|
953
1026
|
MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
954
1027
|
// Annotate the CommonJS export names for ESM import in node:
|
|
955
1028
|
0 && (module.exports = {
|
|
1029
|
+
AspectRatio,
|
|
956
1030
|
BlurView,
|
|
957
1031
|
Column,
|
|
958
1032
|
ConditionalView,
|
|
@@ -965,6 +1039,7 @@ MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
|
965
1039
|
MasonryGridItem,
|
|
966
1040
|
Padding,
|
|
967
1041
|
PositionedView,
|
|
1042
|
+
RoundedView,
|
|
968
1043
|
Row,
|
|
969
1044
|
SizedBox,
|
|
970
1045
|
Spacer
|