@xaui/native 0.2.8 → 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.
- package/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/view/index.cjs
DELETED
|
@@ -1,1361 +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
|
-
|
|
5
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
6
|
-
|
|
7
|
-
// src/components/view/container/container.tsx
|
|
8
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
9
|
-
var _reactnative = require('react-native');
|
|
10
|
-
|
|
11
|
-
// src/components/view/container/container.utils.ts
|
|
12
|
-
var resolveEdgeInsets = (value, prefix) => {
|
|
13
|
-
if (typeof value === "number") {
|
|
14
|
-
return prefix === "padding" ? { padding: value } : { margin: value };
|
|
15
|
-
}
|
|
16
|
-
const style = {};
|
|
17
|
-
if (prefix === "padding") {
|
|
18
|
-
if (value.horizontal !== void 0) style.paddingHorizontal = value.horizontal;
|
|
19
|
-
if (value.vertical !== void 0) style.paddingVertical = value.vertical;
|
|
20
|
-
if (value.top !== void 0) style.paddingTop = value.top;
|
|
21
|
-
if (value.bottom !== void 0) style.paddingBottom = value.bottom;
|
|
22
|
-
if (value.left !== void 0) style.paddingLeft = value.left;
|
|
23
|
-
if (value.right !== void 0) style.paddingRight = value.right;
|
|
24
|
-
} else {
|
|
25
|
-
if (value.horizontal !== void 0) style.marginHorizontal = value.horizontal;
|
|
26
|
-
if (value.vertical !== void 0) style.marginVertical = value.vertical;
|
|
27
|
-
if (value.top !== void 0) style.marginTop = value.top;
|
|
28
|
-
if (value.bottom !== void 0) style.marginBottom = value.bottom;
|
|
29
|
-
if (value.left !== void 0) style.marginLeft = value.left;
|
|
30
|
-
if (value.right !== void 0) style.marginRight = value.right;
|
|
31
|
-
}
|
|
32
|
-
return style;
|
|
33
|
-
};
|
|
34
|
-
var ALIGNMENT_MAP = {
|
|
35
|
-
topLeft: { justifyContent: "flex-start", alignItems: "flex-start" },
|
|
36
|
-
topCenter: { justifyContent: "flex-start", alignItems: "center" },
|
|
37
|
-
topRight: { justifyContent: "flex-start", alignItems: "flex-end" },
|
|
38
|
-
centerLeft: { justifyContent: "center", alignItems: "flex-start" },
|
|
39
|
-
center: { justifyContent: "center", alignItems: "center" },
|
|
40
|
-
centerRight: { justifyContent: "center", alignItems: "flex-end" },
|
|
41
|
-
bottomLeft: { justifyContent: "flex-end", alignItems: "flex-start" },
|
|
42
|
-
bottomCenter: { justifyContent: "flex-end", alignItems: "center" },
|
|
43
|
-
bottomRight: { justifyContent: "flex-end", alignItems: "flex-end" }
|
|
44
|
-
};
|
|
45
|
-
var toFlexPosition = (v) => {
|
|
46
|
-
if (v <= 0) return "flex-start";
|
|
47
|
-
if (v >= 1) return "flex-end";
|
|
48
|
-
return "center";
|
|
49
|
-
};
|
|
50
|
-
var resolveAlignment = (value) => {
|
|
51
|
-
if (typeof value === "object") {
|
|
52
|
-
return {
|
|
53
|
-
justifyContent: toFlexPosition(value.y),
|
|
54
|
-
alignItems: toFlexPosition(value.x)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return _nullishCoalesce(ALIGNMENT_MAP[value], () => ( {
|
|
58
|
-
justifyContent: "flex-start",
|
|
59
|
-
alignItems: "flex-start"
|
|
60
|
-
}));
|
|
61
|
-
};
|
|
62
|
-
var resolveBorderRadius = (value) => {
|
|
63
|
-
if (typeof value === "number") {
|
|
64
|
-
return { borderRadius: value };
|
|
65
|
-
}
|
|
66
|
-
const style = {};
|
|
67
|
-
if (value.topLeft !== void 0) style.borderTopLeftRadius = value.topLeft;
|
|
68
|
-
if (value.topRight !== void 0) style.borderTopRightRadius = value.topRight;
|
|
69
|
-
if (value.bottomLeft !== void 0) style.borderBottomLeftRadius = value.bottomLeft;
|
|
70
|
-
if (value.bottomRight !== void 0)
|
|
71
|
-
style.borderBottomRightRadius = value.bottomRight;
|
|
72
|
-
return style;
|
|
73
|
-
};
|
|
74
|
-
var resolveBorderSide = (side, position) => {
|
|
75
|
-
const style = {};
|
|
76
|
-
if (position === "") {
|
|
77
|
-
if (side.width !== void 0) style.borderWidth = side.width;
|
|
78
|
-
if (side.color !== void 0) style.borderColor = side.color;
|
|
79
|
-
if (side.style !== void 0) style.borderStyle = side.style;
|
|
80
|
-
return style;
|
|
81
|
-
}
|
|
82
|
-
if (position === "Top") {
|
|
83
|
-
if (side.width !== void 0) style.borderTopWidth = side.width;
|
|
84
|
-
if (side.color !== void 0) style.borderTopColor = side.color;
|
|
85
|
-
} else if (position === "Bottom") {
|
|
86
|
-
if (side.width !== void 0) style.borderBottomWidth = side.width;
|
|
87
|
-
if (side.color !== void 0) style.borderBottomColor = side.color;
|
|
88
|
-
} else if (position === "Left") {
|
|
89
|
-
if (side.width !== void 0) style.borderLeftWidth = side.width;
|
|
90
|
-
if (side.color !== void 0) style.borderLeftColor = side.color;
|
|
91
|
-
} else {
|
|
92
|
-
if (side.width !== void 0) style.borderRightWidth = side.width;
|
|
93
|
-
if (side.color !== void 0) style.borderRightColor = side.color;
|
|
94
|
-
}
|
|
95
|
-
return style;
|
|
96
|
-
};
|
|
97
|
-
var resolveBorder = (value) => {
|
|
98
|
-
const dir = value;
|
|
99
|
-
if (dir.top !== void 0 || dir.bottom !== void 0 || dir.left !== void 0 || dir.right !== void 0) {
|
|
100
|
-
return {
|
|
101
|
-
...dir.top ? resolveBorderSide(dir.top, "Top") : {},
|
|
102
|
-
...dir.bottom ? resolveBorderSide(dir.bottom, "Bottom") : {},
|
|
103
|
-
...dir.left ? resolveBorderSide(dir.left, "Left") : {},
|
|
104
|
-
...dir.right ? resolveBorderSide(dir.right, "Right") : {}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return resolveBorderSide(value, "");
|
|
108
|
-
};
|
|
109
|
-
var resolveShadow = (value) => ({
|
|
110
|
-
shadowColor: _nullishCoalesce(value.color, () => ( "#000000")),
|
|
111
|
-
shadowOffset: {
|
|
112
|
-
width: _nullishCoalesce(_optionalChain([value, 'access', _2 => _2.offset, 'optionalAccess', _3 => _3.x]), () => ( 0)),
|
|
113
|
-
height: _nullishCoalesce(_optionalChain([value, 'access', _4 => _4.offset, 'optionalAccess', _5 => _5.y]), () => ( 4))
|
|
114
|
-
},
|
|
115
|
-
shadowOpacity: _nullishCoalesce(value.opacity, () => ( 0.1)),
|
|
116
|
-
shadowRadius: _nullishCoalesce(value.blur, () => ( 4)),
|
|
117
|
-
elevation: _nullishCoalesce(value.elevation, () => ( 2))
|
|
118
|
-
});
|
|
119
|
-
var resolveTransform = (value) => {
|
|
120
|
-
const transforms = [];
|
|
121
|
-
if (value.rotate !== void 0) transforms.push({ rotate: value.rotate });
|
|
122
|
-
if (value.rotateX !== void 0) transforms.push({ rotateX: value.rotateX });
|
|
123
|
-
if (value.rotateY !== void 0) transforms.push({ rotateY: value.rotateY });
|
|
124
|
-
if (value.scale !== void 0) transforms.push({ scale: value.scale });
|
|
125
|
-
if (value.scaleX !== void 0) transforms.push({ scaleX: value.scaleX });
|
|
126
|
-
if (value.scaleY !== void 0) transforms.push({ scaleY: value.scaleY });
|
|
127
|
-
if (value.translateX !== void 0)
|
|
128
|
-
transforms.push({ translateX: value.translateX });
|
|
129
|
-
if (value.translateY !== void 0)
|
|
130
|
-
transforms.push({ translateY: value.translateY });
|
|
131
|
-
if (value.skewX !== void 0) transforms.push({ skewX: value.skewX });
|
|
132
|
-
if (value.skewY !== void 0) transforms.push({ skewY: value.skewY });
|
|
133
|
-
return transforms;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// src/components/view/container/container.tsx
|
|
137
|
-
var buildStyle = (props) => ({
|
|
138
|
-
...props.width !== void 0 && { width: props.width },
|
|
139
|
-
...props.height !== void 0 && { height: props.height },
|
|
140
|
-
...props.minWidth !== void 0 && { minWidth: props.minWidth },
|
|
141
|
-
...props.maxWidth !== void 0 && { maxWidth: props.maxWidth },
|
|
142
|
-
...props.minHeight !== void 0 && { minHeight: props.minHeight },
|
|
143
|
-
...props.maxHeight !== void 0 && { maxHeight: props.maxHeight },
|
|
144
|
-
...props.aspectRatio !== void 0 && { aspectRatio: props.aspectRatio },
|
|
145
|
-
...props.flex !== void 0 && { flex: props.flex },
|
|
146
|
-
...props.color !== void 0 && { backgroundColor: props.color },
|
|
147
|
-
...props.clip && { overflow: "hidden" },
|
|
148
|
-
...props.opacity !== void 0 && { opacity: props.opacity },
|
|
149
|
-
...props.padding !== void 0 && resolveEdgeInsets(props.padding, "padding"),
|
|
150
|
-
...props.margin !== void 0 && resolveEdgeInsets(props.margin, "margin"),
|
|
151
|
-
...props.alignment !== void 0 && resolveAlignment(props.alignment),
|
|
152
|
-
...props.borderRadius !== void 0 && resolveBorderRadius(props.borderRadius),
|
|
153
|
-
...props.border !== void 0 && resolveBorder(props.border),
|
|
154
|
-
...props.shadow !== void 0 && resolveShadow(props.shadow),
|
|
155
|
-
...props.transform !== void 0 && {
|
|
156
|
-
transform: resolveTransform(props.transform)
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
var Container = (props) => {
|
|
160
|
-
const {
|
|
161
|
-
children,
|
|
162
|
-
onPress,
|
|
163
|
-
onLongPress,
|
|
164
|
-
onPressIn,
|
|
165
|
-
onPressOut,
|
|
166
|
-
disabled = false,
|
|
167
|
-
accessibilityLabel,
|
|
168
|
-
accessibilityRole,
|
|
169
|
-
accessibilityState,
|
|
170
|
-
accessible,
|
|
171
|
-
testID,
|
|
172
|
-
style
|
|
173
|
-
} = props;
|
|
174
|
-
const containerStyle = buildStyle(props);
|
|
175
|
-
const isInteractive = !!(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(onPress, () => ( onLongPress)), () => ( onPressIn)), () => ( onPressOut)));
|
|
176
|
-
if (isInteractive) {
|
|
177
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
178
|
-
_reactnative.Pressable,
|
|
179
|
-
{
|
|
180
|
-
onPress: disabled ? void 0 : onPress,
|
|
181
|
-
onLongPress: disabled ? void 0 : onLongPress,
|
|
182
|
-
onPressIn: disabled ? void 0 : onPressIn,
|
|
183
|
-
onPressOut: disabled ? void 0 : onPressOut,
|
|
184
|
-
disabled,
|
|
185
|
-
accessibilityLabel,
|
|
186
|
-
accessibilityRole,
|
|
187
|
-
accessibilityState,
|
|
188
|
-
accessible,
|
|
189
|
-
testID,
|
|
190
|
-
style: [containerStyle, style]
|
|
191
|
-
},
|
|
192
|
-
children
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
196
|
-
_reactnative.View,
|
|
197
|
-
{
|
|
198
|
-
accessibilityLabel,
|
|
199
|
-
accessibilityRole,
|
|
200
|
-
accessibilityState,
|
|
201
|
-
accessible,
|
|
202
|
-
testID,
|
|
203
|
-
style: [containerStyle, style]
|
|
204
|
-
},
|
|
205
|
-
children
|
|
206
|
-
);
|
|
207
|
-
};
|
|
208
|
-
Container.displayName = "Container";
|
|
209
|
-
|
|
210
|
-
// src/components/view/flex/flex.tsx
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// src/components/view/layout-utils.ts
|
|
215
|
-
var MAIN_AXIS_JUSTIFY_MAP = {
|
|
216
|
-
start: "flex-start",
|
|
217
|
-
center: "center",
|
|
218
|
-
end: "flex-end",
|
|
219
|
-
spaceBetween: "space-between",
|
|
220
|
-
spaceAround: "space-around",
|
|
221
|
-
spaceEvenly: "space-evenly"
|
|
222
|
-
};
|
|
223
|
-
var CROSS_AXIS_ALIGN_MAP = {
|
|
224
|
-
start: "flex-start",
|
|
225
|
-
center: "center",
|
|
226
|
-
end: "flex-end",
|
|
227
|
-
stretch: "stretch"
|
|
228
|
-
};
|
|
229
|
-
var resolveMainAxisAlignment = (alignment) => MAIN_AXIS_JUSTIFY_MAP[_nullishCoalesce(alignment, () => ( "start"))];
|
|
230
|
-
var resolveCrossAxisAlignment = (alignment) => CROSS_AXIS_ALIGN_MAP[_nullishCoalesce(alignment, () => ( "center"))];
|
|
231
|
-
var resolveMainAxisSize = (size = "max", direction) => {
|
|
232
|
-
if (size === "min") return {};
|
|
233
|
-
return direction === "vertical" ? { flex: 1 } : { width: "100%" };
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// src/components/view/flex/flex.tsx
|
|
237
|
-
var Flex = ({
|
|
238
|
-
children,
|
|
239
|
-
direction,
|
|
240
|
-
mainAxisAlignment,
|
|
241
|
-
crossAxisAlignment,
|
|
242
|
-
mainAxisSize,
|
|
243
|
-
wrap = false,
|
|
244
|
-
gap,
|
|
245
|
-
reversed = false,
|
|
246
|
-
flex,
|
|
247
|
-
style,
|
|
248
|
-
testID
|
|
249
|
-
}) => {
|
|
250
|
-
const flexDir = direction === "horizontal" ? reversed ? "row-reverse" : "row" : reversed ? "column-reverse" : "column";
|
|
251
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
252
|
-
_reactnative.View,
|
|
253
|
-
{
|
|
254
|
-
testID,
|
|
255
|
-
style: [
|
|
256
|
-
resolveMainAxisSize(mainAxisSize, direction),
|
|
257
|
-
{
|
|
258
|
-
flexDirection: flexDir,
|
|
259
|
-
justifyContent: resolveMainAxisAlignment(mainAxisAlignment),
|
|
260
|
-
alignItems: resolveCrossAxisAlignment(crossAxisAlignment),
|
|
261
|
-
flexWrap: wrap ? "wrap" : "nowrap",
|
|
262
|
-
...gap !== void 0 && { gap },
|
|
263
|
-
...flex !== void 0 && { flex }
|
|
264
|
-
},
|
|
265
|
-
style
|
|
266
|
-
]
|
|
267
|
-
},
|
|
268
|
-
children
|
|
269
|
-
);
|
|
270
|
-
};
|
|
271
|
-
Flex.displayName = "Flex";
|
|
272
|
-
|
|
273
|
-
// src/components/view/column/column.tsx
|
|
274
|
-
|
|
275
|
-
var Column = (props) => /* @__PURE__ */ _react2.default.createElement(Flex, { ...props, direction: "vertical" });
|
|
276
|
-
Column.displayName = "Column";
|
|
277
|
-
|
|
278
|
-
// src/components/view/row/row.tsx
|
|
279
|
-
|
|
280
|
-
var Row = (props) => /* @__PURE__ */ _react2.default.createElement(Flex, { ...props, direction: "horizontal" });
|
|
281
|
-
Row.displayName = "Row";
|
|
282
|
-
|
|
283
|
-
// src/components/view/expanded/expanded.tsx
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
var Expanded = ({
|
|
287
|
-
children,
|
|
288
|
-
flex = 1,
|
|
289
|
-
style,
|
|
290
|
-
testID
|
|
291
|
-
}) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { testID, style: [{ flex }, style] }, children);
|
|
292
|
-
Expanded.displayName = "Expanded";
|
|
293
|
-
|
|
294
|
-
// src/components/view/flexible/flexible.tsx
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var Flexible = ({
|
|
298
|
-
children,
|
|
299
|
-
flex = 1,
|
|
300
|
-
fit = "loose",
|
|
301
|
-
style,
|
|
302
|
-
testID
|
|
303
|
-
}) => /* @__PURE__ */ _react2.default.createElement(
|
|
304
|
-
_reactnative.View,
|
|
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
|
-
|
|
318
|
-
|
|
319
|
-
var Spacer = ({ flex = 1, style }) => {
|
|
320
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
321
|
-
_reactnative.View,
|
|
322
|
-
{
|
|
323
|
-
style: [
|
|
324
|
-
{
|
|
325
|
-
flexGrow: flex,
|
|
326
|
-
flexShrink: 1,
|
|
327
|
-
flexBasis: 0
|
|
328
|
-
},
|
|
329
|
-
style
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
);
|
|
333
|
-
};
|
|
334
|
-
Spacer.displayName = "Spacer";
|
|
335
|
-
|
|
336
|
-
// src/components/view/wrap/wrap.tsx
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
var Wrap = ({
|
|
340
|
-
children,
|
|
341
|
-
direction = "horizontal",
|
|
342
|
-
alignment,
|
|
343
|
-
runAlignment,
|
|
344
|
-
spacing = 0,
|
|
345
|
-
runSpacing = 0,
|
|
346
|
-
style,
|
|
347
|
-
testID
|
|
348
|
-
}) => /* @__PURE__ */ _react2.default.createElement(
|
|
349
|
-
_reactnative.View,
|
|
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
|
-
|
|
369
|
-
// src/components/view/padding/padding.tsx
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
var Padding = ({ children, padding, style }) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [resolveEdgeInsets(padding, "padding"), style] }, children);
|
|
373
|
-
Padding.displayName = "Padding";
|
|
374
|
-
|
|
375
|
-
// src/components/view/margin/margin.tsx
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
var Margin = ({ children, margin, style }) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [resolveEdgeInsets(margin, "margin"), style] }, children);
|
|
379
|
-
Margin.displayName = "Margin";
|
|
380
|
-
|
|
381
|
-
// src/components/view/sized-box/sized-box.tsx
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
var SizedBox = ({
|
|
385
|
-
children,
|
|
386
|
-
width,
|
|
387
|
-
height,
|
|
388
|
-
expand,
|
|
389
|
-
shrink,
|
|
390
|
-
style,
|
|
391
|
-
testID
|
|
392
|
-
}) => {
|
|
393
|
-
if (shrink) {
|
|
394
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
395
|
-
_reactnative.View,
|
|
396
|
-
{
|
|
397
|
-
testID,
|
|
398
|
-
style: [{ width: 0, height: 0, overflow: "hidden" }, style]
|
|
399
|
-
},
|
|
400
|
-
children
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
if (expand) {
|
|
404
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { testID, style: [{ flex: 1, alignSelf: "stretch" }, style] }, children);
|
|
405
|
-
}
|
|
406
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { testID, style: [{ width, height }, style] }, children);
|
|
407
|
-
};
|
|
408
|
-
SizedBox.displayName = "SizedBox";
|
|
409
|
-
|
|
410
|
-
// src/components/view/constrained-box/constrained-box.tsx
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
var ConstrainedBox = ({
|
|
414
|
-
children,
|
|
415
|
-
constraints,
|
|
416
|
-
style,
|
|
417
|
-
testID
|
|
418
|
-
}) => /* @__PURE__ */ _react2.default.createElement(
|
|
419
|
-
_reactnative.View,
|
|
420
|
-
{
|
|
421
|
-
testID,
|
|
422
|
-
style: [
|
|
423
|
-
{
|
|
424
|
-
minWidth: constraints.minWidth,
|
|
425
|
-
maxWidth: constraints.maxWidth,
|
|
426
|
-
minHeight: constraints.minHeight,
|
|
427
|
-
maxHeight: constraints.maxHeight
|
|
428
|
-
},
|
|
429
|
-
style
|
|
430
|
-
]
|
|
431
|
-
},
|
|
432
|
-
children
|
|
433
|
-
);
|
|
434
|
-
ConstrainedBox.displayName = "ConstrainedBox";
|
|
435
|
-
|
|
436
|
-
// src/components/view/fractionally-sized-box/fractionally-sized-box.tsx
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var FractionallySizedBox = ({
|
|
440
|
-
children,
|
|
441
|
-
widthFactor,
|
|
442
|
-
heightFactor,
|
|
443
|
-
alignment,
|
|
444
|
-
style,
|
|
445
|
-
testID
|
|
446
|
-
}) => {
|
|
447
|
-
const sizedStyle = {};
|
|
448
|
-
if (widthFactor !== void 0) sizedStyle.width = `${widthFactor * 100}%`;
|
|
449
|
-
if (heightFactor !== void 0) sizedStyle.height = `${heightFactor * 100}%`;
|
|
450
|
-
const alignStyle = alignment ? resolveAlignment(alignment) : {};
|
|
451
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { testID, style: [sizedStyle, alignStyle, style] }, children);
|
|
452
|
-
};
|
|
453
|
-
FractionallySizedBox.displayName = "FractionallySizedBox";
|
|
454
|
-
|
|
455
|
-
// src/components/view/positioned-view/positioned-view.tsx
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
var PositionedView = ({
|
|
459
|
-
children,
|
|
460
|
-
top,
|
|
461
|
-
right,
|
|
462
|
-
bottom,
|
|
463
|
-
left,
|
|
464
|
-
zIndex,
|
|
465
|
-
style
|
|
466
|
-
}) => {
|
|
467
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
468
|
-
_reactnative.View,
|
|
469
|
-
{
|
|
470
|
-
style: [
|
|
471
|
-
{
|
|
472
|
-
position: "absolute",
|
|
473
|
-
top,
|
|
474
|
-
right,
|
|
475
|
-
bottom,
|
|
476
|
-
left,
|
|
477
|
-
zIndex
|
|
478
|
-
},
|
|
479
|
-
style
|
|
480
|
-
]
|
|
481
|
-
},
|
|
482
|
-
children
|
|
483
|
-
);
|
|
484
|
-
};
|
|
485
|
-
PositionedView.displayName = "PositionedView";
|
|
486
|
-
|
|
487
|
-
// src/components/view/blur-view/blur-view.tsx
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var styles = _reactnative.StyleSheet.create({
|
|
491
|
-
container: {
|
|
492
|
-
position: "relative"
|
|
493
|
-
},
|
|
494
|
-
overlay: {
|
|
495
|
-
..._reactnative.StyleSheet.absoluteFillObject
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
var BlurView = ({
|
|
499
|
-
children,
|
|
500
|
-
unlockable = false,
|
|
501
|
-
intensity = 0.6,
|
|
502
|
-
overlayColor = "rgba(0, 0, 0, 0.12)",
|
|
503
|
-
style
|
|
504
|
-
}) => {
|
|
505
|
-
const overlayOpacity = Math.min(1, Math.max(0, intensity));
|
|
506
|
-
const overlayAnim = _react.useRef.call(void 0,
|
|
507
|
-
new _reactnative.Animated.Value(unlockable ? 0 : overlayOpacity)
|
|
508
|
-
).current;
|
|
509
|
-
const scaleAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(unlockable ? 1 : 0.98)).current;
|
|
510
|
-
_react.useEffect.call(void 0, () => {
|
|
511
|
-
if (unlockable) {
|
|
512
|
-
_reactnative.Animated.parallel([
|
|
513
|
-
_reactnative.Animated.timing(overlayAnim, {
|
|
514
|
-
toValue: 0,
|
|
515
|
-
duration: 220,
|
|
516
|
-
useNativeDriver: true
|
|
517
|
-
}),
|
|
518
|
-
_reactnative.Animated.timing(scaleAnim, {
|
|
519
|
-
toValue: 1,
|
|
520
|
-
duration: 220,
|
|
521
|
-
useNativeDriver: true
|
|
522
|
-
})
|
|
523
|
-
]).start();
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
overlayAnim.setValue(overlayOpacity);
|
|
527
|
-
scaleAnim.setValue(0.98);
|
|
528
|
-
}, [overlayAnim, overlayOpacity, scaleAnim, unlockable]);
|
|
529
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, style] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: { transform: [{ scale: scaleAnim }] } }, children), /* @__PURE__ */ _react2.default.createElement(
|
|
530
|
-
_reactnative.Animated.View,
|
|
531
|
-
{
|
|
532
|
-
pointerEvents: unlockable ? "none" : "auto",
|
|
533
|
-
style: [styles.overlay, { opacity: overlayAnim }]
|
|
534
|
-
},
|
|
535
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.overlay, { backgroundColor: overlayColor }] })
|
|
536
|
-
));
|
|
537
|
-
};
|
|
538
|
-
BlurView.displayName = "BlurView";
|
|
539
|
-
|
|
540
|
-
// src/components/view/rounded-view/rounded-view.tsx
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
// src/components/view/rounded-view/rounded-view.hook.ts
|
|
545
|
-
|
|
546
|
-
var useRoundedViewStyle = (props) => {
|
|
547
|
-
const {
|
|
548
|
-
all = 0,
|
|
549
|
-
top,
|
|
550
|
-
bottom,
|
|
551
|
-
left,
|
|
552
|
-
right,
|
|
553
|
-
topLeft,
|
|
554
|
-
topRight,
|
|
555
|
-
bottomLeft,
|
|
556
|
-
bottomRight
|
|
557
|
-
} = props;
|
|
558
|
-
return _react.useMemo.call(void 0, () => {
|
|
559
|
-
return {
|
|
560
|
-
borderTopLeftRadius: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(topLeft, () => ( top)), () => ( left)), () => ( all)),
|
|
561
|
-
borderTopRightRadius: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(topRight, () => ( top)), () => ( right)), () => ( all)),
|
|
562
|
-
borderBottomLeftRadius: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(bottomLeft, () => ( bottom)), () => ( left)), () => ( all)),
|
|
563
|
-
borderBottomRightRadius: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(bottomRight, () => ( bottom)), () => ( right)), () => ( all))
|
|
564
|
-
};
|
|
565
|
-
}, [all, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight]);
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
// src/components/view/rounded-view/rounded-view.tsx
|
|
569
|
-
var RoundedView = ({
|
|
570
|
-
children,
|
|
571
|
-
all,
|
|
572
|
-
top,
|
|
573
|
-
bottom,
|
|
574
|
-
left,
|
|
575
|
-
right,
|
|
576
|
-
topLeft,
|
|
577
|
-
topRight,
|
|
578
|
-
bottomLeft,
|
|
579
|
-
bottomRight,
|
|
580
|
-
fullWidth = false,
|
|
581
|
-
backgroundColor,
|
|
582
|
-
style,
|
|
583
|
-
noGrowth = false
|
|
584
|
-
}) => {
|
|
585
|
-
const borderRadiusStyle = useRoundedViewStyle({
|
|
586
|
-
all,
|
|
587
|
-
top,
|
|
588
|
-
bottom,
|
|
589
|
-
left,
|
|
590
|
-
right,
|
|
591
|
-
topLeft,
|
|
592
|
-
topRight,
|
|
593
|
-
bottomLeft,
|
|
594
|
-
bottomRight
|
|
595
|
-
});
|
|
596
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
597
|
-
_reactnative.View,
|
|
598
|
-
{
|
|
599
|
-
style: [
|
|
600
|
-
borderRadiusStyle,
|
|
601
|
-
fullWidth && { width: "100%" },
|
|
602
|
-
noGrowth ? void 0 : { flex: 1 },
|
|
603
|
-
backgroundColor && { backgroundColor },
|
|
604
|
-
style
|
|
605
|
-
]
|
|
606
|
-
},
|
|
607
|
-
children
|
|
608
|
-
);
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
// src/components/view/aspect-ratio/aspect-ratio.tsx
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
var AspectRatio = ({
|
|
615
|
-
children,
|
|
616
|
-
ratio,
|
|
617
|
-
alignment,
|
|
618
|
-
clip,
|
|
619
|
-
style,
|
|
620
|
-
testID
|
|
621
|
-
}) => {
|
|
622
|
-
const alignStyle = alignment ? resolveAlignment(alignment) : {};
|
|
623
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
624
|
-
_reactnative.View,
|
|
625
|
-
{
|
|
626
|
-
testID,
|
|
627
|
-
style: [
|
|
628
|
-
{
|
|
629
|
-
aspectRatio: ratio,
|
|
630
|
-
overflow: clip ? "hidden" : "visible"
|
|
631
|
-
},
|
|
632
|
-
alignStyle,
|
|
633
|
-
style
|
|
634
|
-
]
|
|
635
|
-
},
|
|
636
|
-
children
|
|
637
|
-
);
|
|
638
|
-
};
|
|
639
|
-
AspectRatio.displayName = "AspectRatio";
|
|
640
|
-
|
|
641
|
-
// src/components/view/surface/surface.tsx
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
var _core = require('@xaui/core');
|
|
645
|
-
var resolveBackgroundColor = (color, theme) => {
|
|
646
|
-
if (color === "background" || color === "foreground") {
|
|
647
|
-
return theme.colors[color];
|
|
648
|
-
}
|
|
649
|
-
const safeColor = _core.getSafeThemeColor.call(void 0, color);
|
|
650
|
-
return theme.colors[safeColor].container;
|
|
651
|
-
};
|
|
652
|
-
var Surface = ({
|
|
653
|
-
children,
|
|
654
|
-
themeColor = "background",
|
|
655
|
-
padding,
|
|
656
|
-
radius = "none",
|
|
657
|
-
fullWidth = false,
|
|
658
|
-
style
|
|
659
|
-
}) => {
|
|
660
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
661
|
-
const radiusStyle = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
662
|
-
const background = resolveBackgroundColor(themeColor, theme);
|
|
663
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
664
|
-
_reactnative.View,
|
|
665
|
-
{
|
|
666
|
-
style: [
|
|
667
|
-
radiusStyle,
|
|
668
|
-
fullWidth && { flexShrink: 1, flexBasis: "auto", width: "100%" },
|
|
669
|
-
{
|
|
670
|
-
backgroundColor: background,
|
|
671
|
-
padding
|
|
672
|
-
},
|
|
673
|
-
style
|
|
674
|
-
]
|
|
675
|
-
},
|
|
676
|
-
children
|
|
677
|
-
);
|
|
678
|
-
};
|
|
679
|
-
Surface.displayName = "Surface";
|
|
680
|
-
|
|
681
|
-
// src/components/view/screen/screen.tsx
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
var _reactnativesafeareacontext = require('react-native-safe-area-context');
|
|
685
|
-
var Screen = ({
|
|
686
|
-
children,
|
|
687
|
-
padding,
|
|
688
|
-
backgroundColor,
|
|
689
|
-
safeArea = false,
|
|
690
|
-
style
|
|
691
|
-
}) => {
|
|
692
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
693
|
-
const resolvedBackgroundColor = _nullishCoalesce(backgroundColor, () => ( theme.colors.background));
|
|
694
|
-
const containerStyle = [
|
|
695
|
-
{ flex: 1, backgroundColor: resolvedBackgroundColor, padding },
|
|
696
|
-
style
|
|
697
|
-
];
|
|
698
|
-
if (safeArea) {
|
|
699
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnativesafeareacontext.SafeAreaView, { style: containerStyle }, children);
|
|
700
|
-
}
|
|
701
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: containerStyle }, children);
|
|
702
|
-
};
|
|
703
|
-
Screen.displayName = "Screen";
|
|
704
|
-
|
|
705
|
-
// src/components/view/align/align.tsx
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
var Align = ({ children, alignment, style }) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [{ flex: 1 }, resolveAlignment(alignment), style] }, children);
|
|
709
|
-
Align.displayName = "Align";
|
|
710
|
-
|
|
711
|
-
// src/components/view/center/center.tsx
|
|
712
|
-
|
|
713
|
-
var Center = ({ children, style }) => /* @__PURE__ */ _react2.default.createElement(Align, { alignment: "center", style }, children);
|
|
714
|
-
Center.displayName = "Center";
|
|
715
|
-
|
|
716
|
-
// src/components/view/grid/grid.tsx
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
// src/components/view/grid/grid-item.tsx
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var GridItem = ({ children, style }) => {
|
|
726
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style }, children);
|
|
727
|
-
};
|
|
728
|
-
GridItem.displayName = "GridItem";
|
|
729
|
-
|
|
730
|
-
// src/components/view/grid/grid.tsx
|
|
731
|
-
var getSafeColumns = (columns) => {
|
|
732
|
-
if (!columns || columns <= 0) return 1;
|
|
733
|
-
return Math.floor(columns);
|
|
734
|
-
};
|
|
735
|
-
var getSafeSpan = (span, columns) => {
|
|
736
|
-
if (!span || span <= 0) return 1;
|
|
737
|
-
return Math.min(Math.floor(span), columns);
|
|
738
|
-
};
|
|
739
|
-
var isGridItemElement = (child) => {
|
|
740
|
-
if (!_react2.default.isValidElement(child)) return false;
|
|
741
|
-
if (child.type === GridItem) return true;
|
|
742
|
-
const displayName = child.type.displayName;
|
|
743
|
-
return displayName === "GridItem";
|
|
744
|
-
};
|
|
745
|
-
var Grid = ({
|
|
746
|
-
children,
|
|
747
|
-
columns = 2,
|
|
748
|
-
spacing,
|
|
749
|
-
rowSpacing,
|
|
750
|
-
columnSpacing,
|
|
751
|
-
style,
|
|
752
|
-
itemStyle
|
|
753
|
-
}) => {
|
|
754
|
-
const [containerWidth, setContainerWidth] = _react.useState.call(void 0, );
|
|
755
|
-
const safeColumns = getSafeColumns(columns);
|
|
756
|
-
const resolvedRowSpacing = _nullishCoalesce(_nullishCoalesce(rowSpacing, () => ( spacing)), () => ( 0));
|
|
757
|
-
const resolvedColumnSpacing = _nullishCoalesce(_nullishCoalesce(columnSpacing, () => ( spacing)), () => ( 0));
|
|
758
|
-
const itemWidth = `${100 / safeColumns}%`;
|
|
759
|
-
const items = _react2.default.Children.toArray(children);
|
|
760
|
-
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
761
|
-
const baseItemWidth = _react.useMemo.call(void 0, () => {
|
|
762
|
-
if (!containerWidth) return void 0;
|
|
763
|
-
return (containerWidth - totalColumnGap) / safeColumns;
|
|
764
|
-
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
765
|
-
let currentColumn = 0;
|
|
766
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
767
|
-
_reactnative.View,
|
|
768
|
-
{
|
|
769
|
-
style: [
|
|
770
|
-
{
|
|
771
|
-
flexDirection: "row",
|
|
772
|
-
flexWrap: "wrap",
|
|
773
|
-
rowGap: resolvedRowSpacing
|
|
774
|
-
},
|
|
775
|
-
style
|
|
776
|
-
],
|
|
777
|
-
onLayout: (event) => {
|
|
778
|
-
const nextWidth = event.nativeEvent.layout.width;
|
|
779
|
-
if (!nextWidth || nextWidth === containerWidth) return;
|
|
780
|
-
setContainerWidth(nextWidth);
|
|
781
|
-
}
|
|
782
|
-
},
|
|
783
|
-
items.map((child, index) => {
|
|
784
|
-
const key = _react2.default.isValidElement(child) && child.key ? child.key : `grid-${index}`;
|
|
785
|
-
const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
|
|
786
|
-
const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
|
|
787
|
-
if (currentColumn + span > safeColumns) {
|
|
788
|
-
currentColumn = 0;
|
|
789
|
-
}
|
|
790
|
-
const isEndOfRow = currentColumn + span >= safeColumns;
|
|
791
|
-
const marginRight = isEndOfRow ? 0 : resolvedColumnSpacing;
|
|
792
|
-
if (isGridItemElement(child)) {
|
|
793
|
-
const mergedStyle = [
|
|
794
|
-
{
|
|
795
|
-
flexBasis: spanWidth,
|
|
796
|
-
maxWidth: spanWidth,
|
|
797
|
-
flexGrow: 0,
|
|
798
|
-
flexShrink: 0,
|
|
799
|
-
marginRight
|
|
800
|
-
},
|
|
801
|
-
itemStyle,
|
|
802
|
-
child.props.style
|
|
803
|
-
];
|
|
804
|
-
const element2 = _react2.default.cloneElement(child, {
|
|
805
|
-
key,
|
|
806
|
-
style: mergedStyle
|
|
807
|
-
});
|
|
808
|
-
currentColumn = isEndOfRow ? 0 : currentColumn + span;
|
|
809
|
-
return element2;
|
|
810
|
-
}
|
|
811
|
-
const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
|
|
812
|
-
const element = /* @__PURE__ */ _react2.default.createElement(
|
|
813
|
-
_reactnative.View,
|
|
814
|
-
{
|
|
815
|
-
key,
|
|
816
|
-
style: [
|
|
817
|
-
{
|
|
818
|
-
flexBasis: defaultItemWidth,
|
|
819
|
-
maxWidth: defaultItemWidth,
|
|
820
|
-
flexGrow: 0,
|
|
821
|
-
flexShrink: 0,
|
|
822
|
-
marginRight
|
|
823
|
-
},
|
|
824
|
-
itemStyle
|
|
825
|
-
]
|
|
826
|
-
},
|
|
827
|
-
child
|
|
828
|
-
);
|
|
829
|
-
currentColumn = isEndOfRow ? 0 : currentColumn + span;
|
|
830
|
-
return element;
|
|
831
|
-
})
|
|
832
|
-
);
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
// src/components/view/grid/grid-builder.tsx
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
var getSafeColumns2 = (columns) => {
|
|
843
|
-
if (!columns || columns <= 0) return 1;
|
|
844
|
-
return Math.floor(columns);
|
|
845
|
-
};
|
|
846
|
-
var resolveGridData = (data, itemCount) => {
|
|
847
|
-
if (data) return data;
|
|
848
|
-
if (!itemCount || itemCount <= 0) return [];
|
|
849
|
-
return Array.from({ length: itemCount }, (_, index) => index);
|
|
850
|
-
};
|
|
851
|
-
var GridBuilder = ({
|
|
852
|
-
data,
|
|
853
|
-
itemCount,
|
|
854
|
-
renderItem,
|
|
855
|
-
itemBuilder,
|
|
856
|
-
keyExtractor,
|
|
857
|
-
columns = 2,
|
|
858
|
-
spacing,
|
|
859
|
-
rowSpacing,
|
|
860
|
-
columnSpacing,
|
|
861
|
-
style,
|
|
862
|
-
itemStyle,
|
|
863
|
-
scrollEnabled,
|
|
864
|
-
onEndReached,
|
|
865
|
-
onEndReachedThreshold = 0.1,
|
|
866
|
-
contentContainerStyle,
|
|
867
|
-
header,
|
|
868
|
-
footer
|
|
869
|
-
}) => {
|
|
870
|
-
const safeColumns = getSafeColumns2(columns);
|
|
871
|
-
const resolvedRowSpacing = _nullishCoalesce(_nullishCoalesce(rowSpacing, () => ( spacing)), () => ( 0));
|
|
872
|
-
const resolvedColumnSpacing = _nullishCoalesce(_nullishCoalesce(columnSpacing, () => ( spacing)), () => ( 0));
|
|
873
|
-
const resolvedData = _react.useMemo.call(void 0,
|
|
874
|
-
() => resolveGridData(data, itemCount),
|
|
875
|
-
[data, itemCount]
|
|
876
|
-
);
|
|
877
|
-
const paddedData = _react.useMemo.call(void 0, () => {
|
|
878
|
-
const remainder = resolvedData.length % safeColumns;
|
|
879
|
-
const placeholders = remainder === 0 ? 0 : safeColumns - remainder;
|
|
880
|
-
if (placeholders === 0)
|
|
881
|
-
return resolvedData.map((item, index) => ({
|
|
882
|
-
type: "data",
|
|
883
|
-
item,
|
|
884
|
-
index
|
|
885
|
-
}));
|
|
886
|
-
return [
|
|
887
|
-
...resolvedData.map((item, index) => ({
|
|
888
|
-
type: "data",
|
|
889
|
-
item,
|
|
890
|
-
index
|
|
891
|
-
})),
|
|
892
|
-
...Array.from({ length: placeholders }, (_, index) => ({
|
|
893
|
-
type: "placeholder",
|
|
894
|
-
key: `placeholder-${resolvedData.length + index}`
|
|
895
|
-
}))
|
|
896
|
-
];
|
|
897
|
-
}, [resolvedData, safeColumns]);
|
|
898
|
-
const resolvedKeyExtractor = _react.useMemo.call(void 0, () => {
|
|
899
|
-
if (keyExtractor)
|
|
900
|
-
return (item, index) => item.type === "data" ? keyExtractor(item.item, item.index) : _nullishCoalesce(item.key, () => ( `placeholder-${index}`));
|
|
901
|
-
return (item, index) => item.type === "data" ? `grid-${item.index}` : _nullishCoalesce(item.key, () => ( `placeholder-${index}`));
|
|
902
|
-
}, [keyExtractor]);
|
|
903
|
-
const resolvedRenderer = _react.useMemo.call(void 0, () => {
|
|
904
|
-
if (renderItem) return renderItem;
|
|
905
|
-
if (itemBuilder)
|
|
906
|
-
return ({ item, index }) => itemBuilder({ item, index });
|
|
907
|
-
return void 0;
|
|
908
|
-
}, [renderItem, itemBuilder]);
|
|
909
|
-
if (!resolvedRenderer) return null;
|
|
910
|
-
const renderGridItem = ({
|
|
911
|
-
item,
|
|
912
|
-
index
|
|
913
|
-
}) => {
|
|
914
|
-
if (item.type === "placeholder") {
|
|
915
|
-
const isLastColumn2 = (index + 1) % safeColumns === 0;
|
|
916
|
-
const totalItems2 = paddedData.length;
|
|
917
|
-
const lastRowStart2 = totalItems2 === 0 ? 0 : totalItems2 - (totalItems2 % safeColumns || safeColumns);
|
|
918
|
-
const isLastRow2 = index >= lastRowStart2;
|
|
919
|
-
const placeholderStyle = [
|
|
920
|
-
{
|
|
921
|
-
flex: 1,
|
|
922
|
-
marginRight: isLastColumn2 ? 0 : resolvedColumnSpacing,
|
|
923
|
-
marginBottom: isLastRow2 ? 0 : resolvedRowSpacing
|
|
924
|
-
},
|
|
925
|
-
itemStyle
|
|
926
|
-
];
|
|
927
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: placeholderStyle, pointerEvents: "none" });
|
|
928
|
-
}
|
|
929
|
-
const element = resolvedRenderer({ item: item.item, index: item.index });
|
|
930
|
-
if (element === null) return null;
|
|
931
|
-
const isLastColumn = (index + 1) % safeColumns === 0;
|
|
932
|
-
const totalItems = paddedData.length;
|
|
933
|
-
const lastRowStart = totalItems === 0 ? 0 : totalItems - (totalItems % safeColumns || safeColumns);
|
|
934
|
-
const isLastRow = index >= lastRowStart;
|
|
935
|
-
const wrapperStyle = [
|
|
936
|
-
{
|
|
937
|
-
flex: 1,
|
|
938
|
-
marginRight: isLastColumn ? 0 : resolvedColumnSpacing,
|
|
939
|
-
marginBottom: isLastRow ? 0 : resolvedRowSpacing
|
|
940
|
-
},
|
|
941
|
-
itemStyle
|
|
942
|
-
];
|
|
943
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: wrapperStyle }, element);
|
|
944
|
-
};
|
|
945
|
-
const flattenedStyle = _nullishCoalesce(_reactnative.StyleSheet.flatten(style), () => ( {}));
|
|
946
|
-
const {
|
|
947
|
-
alignItems,
|
|
948
|
-
justifyContent,
|
|
949
|
-
alignContent,
|
|
950
|
-
gap,
|
|
951
|
-
rowGap,
|
|
952
|
-
columnGap,
|
|
953
|
-
...restStyle
|
|
954
|
-
} = flattenedStyle;
|
|
955
|
-
const layoutStyle = {
|
|
956
|
-
...alignItems !== void 0 ? { alignItems } : {},
|
|
957
|
-
...justifyContent !== void 0 ? { justifyContent } : {},
|
|
958
|
-
...alignContent !== void 0 ? { alignContent } : {},
|
|
959
|
-
...gap !== void 0 ? { gap } : {},
|
|
960
|
-
...rowGap !== void 0 ? { rowGap } : {},
|
|
961
|
-
...columnGap !== void 0 ? { columnGap } : {}
|
|
962
|
-
};
|
|
963
|
-
const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
|
|
964
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
965
|
-
_reactnative.FlatList,
|
|
966
|
-
{
|
|
967
|
-
data: paddedData,
|
|
968
|
-
renderItem: renderGridItem,
|
|
969
|
-
keyExtractor: resolvedKeyExtractor,
|
|
970
|
-
numColumns: safeColumns,
|
|
971
|
-
scrollEnabled,
|
|
972
|
-
onEndReached,
|
|
973
|
-
onEndReachedThreshold,
|
|
974
|
-
contentContainerStyle: hasLayoutStyle ? [contentContainerStyle, layoutStyle] : contentContainerStyle,
|
|
975
|
-
ListHeaderComponent: header,
|
|
976
|
-
ListFooterComponent: footer,
|
|
977
|
-
style: Object.keys(restStyle).length > 0 ? restStyle : void 0
|
|
978
|
-
}
|
|
979
|
-
);
|
|
980
|
-
};
|
|
981
|
-
GridBuilder.displayName = "GridBuilder";
|
|
982
|
-
|
|
983
|
-
// src/components/view/conditional/conditional-view.tsx
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
// src/components/view/conditional/conditional-view.utils.ts
|
|
988
|
-
var FINAL_VALUES = {
|
|
989
|
-
opacity: 1,
|
|
990
|
-
scale: 1,
|
|
991
|
-
translateX: 0,
|
|
992
|
-
translateY: 0
|
|
993
|
-
};
|
|
994
|
-
var getInitialValues = (animation) => {
|
|
995
|
-
switch (animation) {
|
|
996
|
-
case "fade":
|
|
997
|
-
return { opacity: 0.5, scale: 1, translateX: 0, translateY: 0 };
|
|
998
|
-
case "scale":
|
|
999
|
-
default:
|
|
1000
|
-
return { opacity: 1, scale: 0.5, translateX: 0, translateY: 0 };
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
var getExitValues = (animation) => {
|
|
1004
|
-
switch (animation) {
|
|
1005
|
-
case "fade":
|
|
1006
|
-
return { opacity: 0.5, scale: 1, translateX: 0, translateY: 0 };
|
|
1007
|
-
case "scale":
|
|
1008
|
-
default:
|
|
1009
|
-
return getInitialValues(animation);
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
// src/components/view/conditional/conditional-view.animation.ts
|
|
1014
|
-
|
|
1015
|
-
var runConditionalViewAnimation = ({
|
|
1016
|
-
opacity,
|
|
1017
|
-
scale,
|
|
1018
|
-
translateX,
|
|
1019
|
-
translateY,
|
|
1020
|
-
toValues,
|
|
1021
|
-
onComplete
|
|
1022
|
-
}) => {
|
|
1023
|
-
const easing = _reactnative.Easing.out(_reactnative.Easing.cubic);
|
|
1024
|
-
const animation = _reactnative.Animated.parallel([
|
|
1025
|
-
_reactnative.Animated.timing(opacity, {
|
|
1026
|
-
toValue: toValues.opacity,
|
|
1027
|
-
duration: 800,
|
|
1028
|
-
easing,
|
|
1029
|
-
useNativeDriver: true
|
|
1030
|
-
}),
|
|
1031
|
-
_reactnative.Animated.timing(scale, {
|
|
1032
|
-
toValue: toValues.scale,
|
|
1033
|
-
duration: 800,
|
|
1034
|
-
easing,
|
|
1035
|
-
useNativeDriver: true
|
|
1036
|
-
}),
|
|
1037
|
-
_reactnative.Animated.timing(translateX, {
|
|
1038
|
-
toValue: toValues.translateX,
|
|
1039
|
-
duration: 800,
|
|
1040
|
-
easing,
|
|
1041
|
-
useNativeDriver: true
|
|
1042
|
-
}),
|
|
1043
|
-
_reactnative.Animated.timing(translateY, {
|
|
1044
|
-
toValue: toValues.translateY,
|
|
1045
|
-
duration: 800,
|
|
1046
|
-
easing,
|
|
1047
|
-
useNativeDriver: true
|
|
1048
|
-
})
|
|
1049
|
-
]);
|
|
1050
|
-
animation.start(({ finished }) => {
|
|
1051
|
-
if (finished) {
|
|
1052
|
-
_optionalChain([onComplete, 'optionalCall', _6 => _6()]);
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
return animation;
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
|
-
// src/components/view/conditional/conditional-view.tsx
|
|
1059
|
-
var ConditionalView = ({
|
|
1060
|
-
isVisible,
|
|
1061
|
-
children,
|
|
1062
|
-
animation = "fade",
|
|
1063
|
-
disableAnimation = false
|
|
1064
|
-
}) => {
|
|
1065
|
-
const [shouldRender, setShouldRender] = _react.useState.call(void 0, isVisible);
|
|
1066
|
-
const animationRef = _react.useRef.call(void 0, null);
|
|
1067
|
-
const initialValues = _react.useMemo.call(void 0, () => getInitialValues(animation), [animation]);
|
|
1068
|
-
const exitValues = _react.useMemo.call(void 0, () => getExitValues(animation), [animation]);
|
|
1069
|
-
const opacity = _react.useRef.call(void 0,
|
|
1070
|
-
new _reactnative.Animated.Value(
|
|
1071
|
-
disableAnimation ? FINAL_VALUES.opacity : initialValues.opacity
|
|
1072
|
-
)
|
|
1073
|
-
).current;
|
|
1074
|
-
const scale = _react.useRef.call(void 0,
|
|
1075
|
-
new _reactnative.Animated.Value(disableAnimation ? FINAL_VALUES.scale : initialValues.scale)
|
|
1076
|
-
).current;
|
|
1077
|
-
const translateX = _react.useRef.call(void 0,
|
|
1078
|
-
new _reactnative.Animated.Value(
|
|
1079
|
-
disableAnimation ? FINAL_VALUES.translateX : initialValues.translateX
|
|
1080
|
-
)
|
|
1081
|
-
).current;
|
|
1082
|
-
const translateY = _react.useRef.call(void 0,
|
|
1083
|
-
new _reactnative.Animated.Value(
|
|
1084
|
-
disableAnimation ? FINAL_VALUES.translateY : initialValues.translateY
|
|
1085
|
-
)
|
|
1086
|
-
).current;
|
|
1087
|
-
_react.useEffect.call(void 0, () => {
|
|
1088
|
-
if (isVisible) {
|
|
1089
|
-
setShouldRender(true);
|
|
1090
|
-
}
|
|
1091
|
-
}, [isVisible]);
|
|
1092
|
-
_react.useEffect.call(void 0, () => {
|
|
1093
|
-
if (!shouldRender) return;
|
|
1094
|
-
const startValues = isVisible ? disableAnimation ? FINAL_VALUES : initialValues : FINAL_VALUES;
|
|
1095
|
-
const targetValues = isVisible ? FINAL_VALUES : exitValues;
|
|
1096
|
-
opacity.setValue(startValues.opacity);
|
|
1097
|
-
scale.setValue(startValues.scale);
|
|
1098
|
-
translateX.setValue(startValues.translateX);
|
|
1099
|
-
translateY.setValue(startValues.translateY);
|
|
1100
|
-
if (disableAnimation) {
|
|
1101
|
-
if (!isVisible) {
|
|
1102
|
-
setShouldRender(false);
|
|
1103
|
-
}
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
_optionalChain([animationRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.stop, 'call', _9 => _9()]);
|
|
1107
|
-
animationRef.current = runConditionalViewAnimation({
|
|
1108
|
-
opacity,
|
|
1109
|
-
scale,
|
|
1110
|
-
translateX,
|
|
1111
|
-
translateY,
|
|
1112
|
-
toValues: targetValues,
|
|
1113
|
-
onComplete: !isVisible ? () => setShouldRender(false) : void 0
|
|
1114
|
-
});
|
|
1115
|
-
}, [
|
|
1116
|
-
isVisible,
|
|
1117
|
-
shouldRender,
|
|
1118
|
-
disableAnimation,
|
|
1119
|
-
initialValues,
|
|
1120
|
-
exitValues,
|
|
1121
|
-
opacity,
|
|
1122
|
-
scale,
|
|
1123
|
-
translateX,
|
|
1124
|
-
translateY
|
|
1125
|
-
]);
|
|
1126
|
-
const animatedStyle = _react.useMemo.call(void 0,
|
|
1127
|
-
() => ({
|
|
1128
|
-
opacity,
|
|
1129
|
-
transform: [{ translateX }, { translateY }, { scale }]
|
|
1130
|
-
}),
|
|
1131
|
-
[opacity, scale, translateX, translateY]
|
|
1132
|
-
);
|
|
1133
|
-
if (!shouldRender) {
|
|
1134
|
-
return null;
|
|
1135
|
-
}
|
|
1136
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: animatedStyle }, children);
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
// src/components/view/masonry-grid/masonry-grid.tsx
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
var getSafeColumns3 = (columns) => {
|
|
1143
|
-
if (!columns || columns <= 0) return 1;
|
|
1144
|
-
return Math.floor(columns);
|
|
1145
|
-
};
|
|
1146
|
-
var getItemKey = (child, index) => {
|
|
1147
|
-
return _react2.default.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
|
|
1148
|
-
};
|
|
1149
|
-
var MasonryGrid = ({
|
|
1150
|
-
children,
|
|
1151
|
-
columns = 2,
|
|
1152
|
-
spacing,
|
|
1153
|
-
rowSpacing,
|
|
1154
|
-
columnSpacing,
|
|
1155
|
-
style,
|
|
1156
|
-
columnStyle
|
|
1157
|
-
}) => {
|
|
1158
|
-
const [containerWidth, setContainerWidth] = _react.useState.call(void 0, );
|
|
1159
|
-
const heightMapRef = _react.useRef.call(void 0, {});
|
|
1160
|
-
const [layoutVersion, setLayoutVersion] = _react.useState.call(void 0, 0);
|
|
1161
|
-
const safeColumns = getSafeColumns3(columns);
|
|
1162
|
-
const resolvedRowSpacing = _nullishCoalesce(_nullishCoalesce(rowSpacing, () => ( spacing)), () => ( 0));
|
|
1163
|
-
const resolvedColumnSpacing = _nullishCoalesce(_nullishCoalesce(columnSpacing, () => ( spacing)), () => ( 0));
|
|
1164
|
-
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
1165
|
-
const columnWidth = _react.useMemo.call(void 0, () => {
|
|
1166
|
-
if (!containerWidth) return void 0;
|
|
1167
|
-
return (containerWidth - totalColumnGap) / safeColumns;
|
|
1168
|
-
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
1169
|
-
const items = _react.useMemo.call(void 0,
|
|
1170
|
-
() => _react2.default.Children.toArray(children).map((child, index) => ({
|
|
1171
|
-
key: getItemKey(child, index),
|
|
1172
|
-
element: child
|
|
1173
|
-
})),
|
|
1174
|
-
[children]
|
|
1175
|
-
);
|
|
1176
|
-
const columnsItems = _react.useMemo.call(void 0, () => {
|
|
1177
|
-
const buckets = Array.from({ length: safeColumns }, () => []);
|
|
1178
|
-
const heights = new Array(safeColumns).fill(0);
|
|
1179
|
-
items.forEach((item) => {
|
|
1180
|
-
const height = heightMapRef.current[item.key];
|
|
1181
|
-
const targetIndex = heights.indexOf(Math.min(...heights));
|
|
1182
|
-
buckets[targetIndex].push(item);
|
|
1183
|
-
heights[targetIndex] += (_nullishCoalesce(height, () => ( 0))) + resolvedRowSpacing;
|
|
1184
|
-
});
|
|
1185
|
-
return buckets;
|
|
1186
|
-
}, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
|
|
1187
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
1188
|
-
_reactnative.View,
|
|
1189
|
-
{
|
|
1190
|
-
style: [
|
|
1191
|
-
{
|
|
1192
|
-
flexDirection: "row"
|
|
1193
|
-
},
|
|
1194
|
-
style
|
|
1195
|
-
],
|
|
1196
|
-
onLayout: (event) => {
|
|
1197
|
-
const nextWidth = event.nativeEvent.layout.width;
|
|
1198
|
-
if (!nextWidth || nextWidth === containerWidth) return;
|
|
1199
|
-
setContainerWidth(nextWidth);
|
|
1200
|
-
}
|
|
1201
|
-
},
|
|
1202
|
-
columnsItems.map((column, columnIndex) => {
|
|
1203
|
-
const isLastColumn = columnIndex === columnsItems.length - 1;
|
|
1204
|
-
const columnStyles = [
|
|
1205
|
-
{
|
|
1206
|
-
width: columnWidth,
|
|
1207
|
-
marginRight: isLastColumn ? 0 : resolvedColumnSpacing
|
|
1208
|
-
},
|
|
1209
|
-
columnStyle
|
|
1210
|
-
];
|
|
1211
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
|
|
1212
|
-
const isLastRow = index === column.length - 1;
|
|
1213
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
1214
|
-
_reactnative.View,
|
|
1215
|
-
{
|
|
1216
|
-
key: item.key,
|
|
1217
|
-
style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
|
|
1218
|
-
onLayout: (event) => {
|
|
1219
|
-
const nextHeight = event.nativeEvent.layout.height;
|
|
1220
|
-
if (heightMapRef.current[item.key] === nextHeight) return;
|
|
1221
|
-
heightMapRef.current[item.key] = nextHeight;
|
|
1222
|
-
setLayoutVersion((value) => value + 1);
|
|
1223
|
-
}
|
|
1224
|
-
},
|
|
1225
|
-
item.element
|
|
1226
|
-
);
|
|
1227
|
-
}));
|
|
1228
|
-
})
|
|
1229
|
-
);
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
|
-
// src/components/view/masonry-grid/masonry-grid-item.tsx
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
var MasonryGridItem = ({
|
|
1236
|
-
children,
|
|
1237
|
-
style
|
|
1238
|
-
}) => {
|
|
1239
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style }, children);
|
|
1240
|
-
};
|
|
1241
|
-
MasonryGridItem.displayName = "MasonryGridItem";
|
|
1242
|
-
|
|
1243
|
-
// src/components/view/masonry-grid/masonry-grid-builder.tsx
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
var resolveMasonryData = (data, itemCount) => {
|
|
1249
|
-
if (data) return data;
|
|
1250
|
-
if (!itemCount || itemCount <= 0) return [];
|
|
1251
|
-
return Array.from({ length: itemCount }, (_, index) => index);
|
|
1252
|
-
};
|
|
1253
|
-
var MasonryGridBuilder = ({
|
|
1254
|
-
data,
|
|
1255
|
-
itemCount,
|
|
1256
|
-
renderItem,
|
|
1257
|
-
itemBuilder,
|
|
1258
|
-
keyExtractor,
|
|
1259
|
-
columns = 2,
|
|
1260
|
-
spacing,
|
|
1261
|
-
rowSpacing,
|
|
1262
|
-
columnSpacing,
|
|
1263
|
-
style,
|
|
1264
|
-
columnStyle,
|
|
1265
|
-
onEndReached,
|
|
1266
|
-
onEndReachedThreshold = 0.1,
|
|
1267
|
-
header,
|
|
1268
|
-
footer,
|
|
1269
|
-
scrollEnabled,
|
|
1270
|
-
contentContainerStyle,
|
|
1271
|
-
showsVerticalScrollIndicator,
|
|
1272
|
-
showsHorizontalScrollIndicator,
|
|
1273
|
-
bounces,
|
|
1274
|
-
onScroll
|
|
1275
|
-
}) => {
|
|
1276
|
-
const resolvedData = _react.useMemo.call(void 0,
|
|
1277
|
-
() => resolveMasonryData(data, itemCount),
|
|
1278
|
-
[data, itemCount]
|
|
1279
|
-
);
|
|
1280
|
-
const resolvedKeyExtractor = _react.useMemo.call(void 0, () => {
|
|
1281
|
-
if (keyExtractor) return keyExtractor;
|
|
1282
|
-
return (_, index) => `masonry-${index}`;
|
|
1283
|
-
}, [keyExtractor]);
|
|
1284
|
-
const resolvedRenderer = _react.useMemo.call(void 0, () => {
|
|
1285
|
-
if (renderItem) return renderItem;
|
|
1286
|
-
if (itemBuilder)
|
|
1287
|
-
return ({ item, index }) => itemBuilder({ item, index });
|
|
1288
|
-
return void 0;
|
|
1289
|
-
}, [renderItem, itemBuilder]);
|
|
1290
|
-
const lastEndReachedHeight = _react.useRef.call(void 0, 0);
|
|
1291
|
-
if (!resolvedRenderer) return null;
|
|
1292
|
-
const handleScroll = (event) => {
|
|
1293
|
-
_optionalChain([onScroll, 'optionalCall', _10 => _10(event)]);
|
|
1294
|
-
if (!onEndReached) return;
|
|
1295
|
-
const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent;
|
|
1296
|
-
if (!_optionalChain([layoutMeasurement, 'optionalAccess', _11 => _11.height])) return;
|
|
1297
|
-
const distanceFromEnd = contentSize.height - (layoutMeasurement.height + contentOffset.y);
|
|
1298
|
-
const threshold = onEndReachedThreshold * layoutMeasurement.height;
|
|
1299
|
-
if (distanceFromEnd <= threshold && contentSize.height !== lastEndReachedHeight.current) {
|
|
1300
|
-
lastEndReachedHeight.current = contentSize.height;
|
|
1301
|
-
onEndReached();
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
1305
|
-
_reactnative.ScrollView,
|
|
1306
|
-
{
|
|
1307
|
-
scrollEventThrottle: 16,
|
|
1308
|
-
scrollEnabled,
|
|
1309
|
-
contentContainerStyle,
|
|
1310
|
-
showsVerticalScrollIndicator,
|
|
1311
|
-
showsHorizontalScrollIndicator,
|
|
1312
|
-
bounces,
|
|
1313
|
-
onScroll: handleScroll
|
|
1314
|
-
},
|
|
1315
|
-
header,
|
|
1316
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
1317
|
-
MasonryGrid,
|
|
1318
|
-
{
|
|
1319
|
-
columns,
|
|
1320
|
-
spacing,
|
|
1321
|
-
rowSpacing,
|
|
1322
|
-
columnSpacing,
|
|
1323
|
-
style: [{ width: "100%" }, style],
|
|
1324
|
-
columnStyle
|
|
1325
|
-
},
|
|
1326
|
-
resolvedData.map((item, index) => /* @__PURE__ */ _react2.default.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
|
|
1327
|
-
),
|
|
1328
|
-
footer
|
|
1329
|
-
);
|
|
1330
|
-
};
|
|
1331
|
-
MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
exports.Align = Align; exports.AspectRatio = AspectRatio; exports.BlurView = BlurView; exports.Center = Center; exports.Column = Column; exports.ConditionalView = ConditionalView; exports.ConstrainedBox = ConstrainedBox; exports.Container = Container; exports.Expanded = Expanded; exports.Flex = Flex; exports.Flexible = Flexible; exports.FractionallySizedBox = FractionallySizedBox; exports.Grid = Grid; exports.GridBuilder = GridBuilder; exports.GridItem = GridItem; exports.Margin = Margin; exports.MasonryGrid = MasonryGrid; exports.MasonryGridBuilder = MasonryGridBuilder; exports.MasonryGridItem = MasonryGridItem; exports.Padding = Padding; exports.PositionedView = PositionedView; exports.RoundedView = RoundedView; exports.Row = Row; exports.Screen = Screen; exports.SizedBox = SizedBox; exports.Spacer = Spacer; exports.Surface = Surface; exports.Wrap = Wrap;
|