@xaui/native 0.0.27 → 0.0.29
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +71 -127
- package/dist/menu/index.d.cts +8 -0
- package/dist/menu/index.d.ts +8 -0
- package/dist/menu/index.js +15 -3
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +6 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/menubox/index.cjs
CHANGED
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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-HSPTLUFA.cjs');
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
__export(menubox_exports, {
|
|
33
|
-
MenuBox: () => MenuBox,
|
|
34
|
-
MenuBoxItem: () => MenuBoxItem
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(menubox_exports);
|
|
3
|
+
|
|
4
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
37
5
|
|
|
38
6
|
// src/components/menubox/menubox.tsx
|
|
39
|
-
var
|
|
40
|
-
var
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
+
var _reactnative = require('react-native');
|
|
41
9
|
|
|
42
10
|
// src/components/menubox/menubox-context.ts
|
|
43
|
-
|
|
44
|
-
var MenuBoxContext = (0,
|
|
11
|
+
|
|
12
|
+
var MenuBoxContext = _react.createContext.call(void 0, null);
|
|
45
13
|
|
|
46
14
|
// src/components/menubox/menubox.style.ts
|
|
47
|
-
|
|
48
|
-
var styles =
|
|
15
|
+
|
|
16
|
+
var styles = _reactnative.StyleSheet.create({
|
|
49
17
|
container: {
|
|
50
18
|
overflow: "hidden"
|
|
51
19
|
},
|
|
@@ -73,45 +41,6 @@ var styles = import_react_native.StyleSheet.create({
|
|
|
73
41
|
}
|
|
74
42
|
});
|
|
75
43
|
|
|
76
|
-
// src/core/theme-context.tsx
|
|
77
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
78
|
-
var import_react_native3 = require("react-native");
|
|
79
|
-
var import_theme = require("@xaui/core/theme");
|
|
80
|
-
var import_palette = require("@xaui/core/palette");
|
|
81
|
-
|
|
82
|
-
// src/core/portal/portal.tsx
|
|
83
|
-
var import_react3 = require("react");
|
|
84
|
-
|
|
85
|
-
// src/core/portal/portal-context.ts
|
|
86
|
-
var import_react2 = require("react");
|
|
87
|
-
var PortalContext = (0, import_react2.createContext)(null);
|
|
88
|
-
|
|
89
|
-
// src/core/portal/portal-host.tsx
|
|
90
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
91
|
-
var import_react_native2 = require("react-native");
|
|
92
|
-
var hostStyles = import_react_native2.StyleSheet.create({
|
|
93
|
-
container: {
|
|
94
|
-
flex: 1
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// src/core/theme-context.tsx
|
|
99
|
-
var XUIThemeContext = (0, import_react5.createContext)(null);
|
|
100
|
-
|
|
101
|
-
// src/core/theme-hooks.ts
|
|
102
|
-
var import_react6 = require("react");
|
|
103
|
-
var import_react_native4 = require("react-native");
|
|
104
|
-
function useXUITheme() {
|
|
105
|
-
const theme = (0, import_react6.useContext)(XUIThemeContext);
|
|
106
|
-
if (!theme) {
|
|
107
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
108
|
-
}
|
|
109
|
-
return theme;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// src/core/index.ts
|
|
113
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
114
|
-
|
|
115
44
|
// src/components/menubox/menubox.tsx
|
|
116
45
|
var MenuBox = ({
|
|
117
46
|
children,
|
|
@@ -122,12 +51,12 @@ var MenuBox = ({
|
|
|
122
51
|
style,
|
|
123
52
|
backgroundColor
|
|
124
53
|
}) => {
|
|
125
|
-
const theme = useXUITheme();
|
|
126
|
-
const itemCount =
|
|
127
|
-
const itemKeys = (0,
|
|
54
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
55
|
+
const itemCount = _react.Children.count(children);
|
|
56
|
+
const itemKeys = _react.useMemo.call(void 0, () => {
|
|
128
57
|
const keys = [];
|
|
129
|
-
|
|
130
|
-
if ((0,
|
|
58
|
+
_react.Children.forEach(children, (child) => {
|
|
59
|
+
if (_react.isValidElement.call(void 0, child)) {
|
|
131
60
|
const props = child.props;
|
|
132
61
|
if (props.itemKey) {
|
|
133
62
|
keys.push(props.itemKey);
|
|
@@ -139,8 +68,8 @@ var MenuBox = ({
|
|
|
139
68
|
const getItemIndex = (itemKey) => {
|
|
140
69
|
return itemKeys.indexOf(itemKey);
|
|
141
70
|
};
|
|
142
|
-
const bgColor = backgroundColor
|
|
143
|
-
const contextValue = (0,
|
|
71
|
+
const bgColor = _nullishCoalesce(backgroundColor, () => ( theme.colors.default.background));
|
|
72
|
+
const contextValue = _react.useMemo.call(void 0,
|
|
144
73
|
() => ({
|
|
145
74
|
size,
|
|
146
75
|
radius,
|
|
@@ -152,18 +81,18 @@ var MenuBox = ({
|
|
|
152
81
|
}),
|
|
153
82
|
[size, radius, themeColor, bgColor, itemCount, spacing, getItemIndex]
|
|
154
83
|
);
|
|
155
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ _react2.default.createElement(MenuBoxContext.Provider, { value: contextValue }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, style] }, children));
|
|
156
85
|
};
|
|
157
86
|
|
|
158
87
|
// src/components/menubox/menubox-item.tsx
|
|
159
|
-
|
|
160
|
-
|
|
88
|
+
|
|
89
|
+
|
|
161
90
|
|
|
162
91
|
// src/components/menubox/menubox.hook.ts
|
|
163
|
-
|
|
92
|
+
|
|
164
93
|
var useMenuBoxItemSizeStyles = (size) => {
|
|
165
|
-
const theme = useXUITheme();
|
|
166
|
-
return (0,
|
|
94
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
95
|
+
return _react.useMemo.call(void 0, () => {
|
|
167
96
|
const sizes = {
|
|
168
97
|
xs: {
|
|
169
98
|
paddingVertical: theme.spacing.sm,
|
|
@@ -194,8 +123,8 @@ var useMenuBoxItemSizeStyles = (size) => {
|
|
|
194
123
|
}, [size, theme]);
|
|
195
124
|
};
|
|
196
125
|
var useMenuBoxRadiusStyles = (radius, isFirst, isLast) => {
|
|
197
|
-
const theme = useXUITheme();
|
|
198
|
-
return (0,
|
|
126
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
127
|
+
return _react.useMemo.call(void 0, () => {
|
|
199
128
|
const radiusMap = {
|
|
200
129
|
none: theme.borderRadius.none,
|
|
201
130
|
sm: theme.borderRadius.md,
|
|
@@ -214,16 +143,16 @@ var useMenuBoxRadiusStyles = (radius, isFirst, isLast) => {
|
|
|
214
143
|
};
|
|
215
144
|
|
|
216
145
|
// src/components/menubox/menubox.animation.ts
|
|
217
|
-
|
|
146
|
+
|
|
218
147
|
var runMenuBoxPressInAnimation = (animatedScale, animatedOpacity) => {
|
|
219
|
-
|
|
220
|
-
|
|
148
|
+
_reactnative.Animated.parallel([
|
|
149
|
+
_reactnative.Animated.spring(animatedScale, {
|
|
221
150
|
toValue: 0.99,
|
|
222
151
|
useNativeDriver: true,
|
|
223
152
|
speed: 50,
|
|
224
153
|
bounciness: 0
|
|
225
154
|
}),
|
|
226
|
-
|
|
155
|
+
_reactnative.Animated.timing(animatedOpacity, {
|
|
227
156
|
toValue: 0.8,
|
|
228
157
|
duration: 100,
|
|
229
158
|
useNativeDriver: true
|
|
@@ -231,14 +160,14 @@ var runMenuBoxPressInAnimation = (animatedScale, animatedOpacity) => {
|
|
|
231
160
|
]).start();
|
|
232
161
|
};
|
|
233
162
|
var runMenuBoxPressOutAnimation = (animatedScale, animatedOpacity) => {
|
|
234
|
-
|
|
235
|
-
|
|
163
|
+
_reactnative.Animated.parallel([
|
|
164
|
+
_reactnative.Animated.spring(animatedScale, {
|
|
236
165
|
toValue: 1,
|
|
237
166
|
useNativeDriver: true,
|
|
238
167
|
speed: 50,
|
|
239
168
|
bounciness: 0
|
|
240
169
|
}),
|
|
241
|
-
|
|
170
|
+
_reactnative.Animated.timing(animatedOpacity, {
|
|
242
171
|
toValue: 1,
|
|
243
172
|
duration: 100,
|
|
244
173
|
useNativeDriver: true
|
|
@@ -248,10 +177,10 @@ var runMenuBoxPressOutAnimation = (animatedScale, animatedOpacity) => {
|
|
|
248
177
|
|
|
249
178
|
// src/components/menubox/menubox-item.tsx
|
|
250
179
|
var MenuBoxItem = (props) => {
|
|
251
|
-
const context = (0,
|
|
252
|
-
const theme = useXUITheme();
|
|
253
|
-
const animatedScale =
|
|
254
|
-
const animatedOpacity =
|
|
180
|
+
const context = _react.useContext.call(void 0, MenuBoxContext);
|
|
181
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
182
|
+
const animatedScale = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
|
|
183
|
+
const animatedOpacity = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
|
|
255
184
|
const {
|
|
256
185
|
itemKey,
|
|
257
186
|
title,
|
|
@@ -262,12 +191,12 @@ var MenuBoxItem = (props) => {
|
|
|
262
191
|
customAppearance,
|
|
263
192
|
onPress
|
|
264
193
|
} = props;
|
|
265
|
-
const size = context
|
|
266
|
-
const radius = context
|
|
267
|
-
const itemBackgroundColor = context
|
|
268
|
-
const spacing = context
|
|
269
|
-
const itemCount = context
|
|
270
|
-
const index = context
|
|
194
|
+
const size = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _ => _.size]), () => ( "md"));
|
|
195
|
+
const radius = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _2 => _2.radius]), () => ( "lg"));
|
|
196
|
+
const itemBackgroundColor = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _3 => _3.backgroundColor]), () => ( (theme.mode === "dark" ? theme.colors.default.background : theme.colors.background)));
|
|
197
|
+
const spacing = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _4 => _4.spacing]), () => ( 0));
|
|
198
|
+
const itemCount = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _5 => _5.itemCount]), () => ( 1));
|
|
199
|
+
const index = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _6 => _6.getItemIndex, 'call', _7 => _7(itemKey)]), () => ( 0));
|
|
271
200
|
const isFirst = index === 0;
|
|
272
201
|
const isLast = index === itemCount - 1;
|
|
273
202
|
const sizeStyles = useMenuBoxItemSizeStyles(size);
|
|
@@ -278,7 +207,7 @@ var MenuBoxItem = (props) => {
|
|
|
278
207
|
if (isDisabled) {
|
|
279
208
|
return;
|
|
280
209
|
}
|
|
281
|
-
onPress
|
|
210
|
+
_optionalChain([onPress, 'optionalCall', _8 => _8({})]);
|
|
282
211
|
};
|
|
283
212
|
const handlePressIn = () => {
|
|
284
213
|
if (!isDisabled) {
|
|
@@ -292,13 +221,13 @@ var MenuBoxItem = (props) => {
|
|
|
292
221
|
};
|
|
293
222
|
const renderTitle = () => {
|
|
294
223
|
if (typeof title === "string" || typeof title === "number") {
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
|
|
224
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
225
|
+
_reactnative.Text,
|
|
297
226
|
{
|
|
298
227
|
style: [
|
|
299
228
|
styles.title,
|
|
300
229
|
{ fontSize: sizeStyles.titleSize, color: titleColor },
|
|
301
|
-
customAppearance
|
|
230
|
+
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.title])
|
|
302
231
|
],
|
|
303
232
|
numberOfLines: 1
|
|
304
233
|
},
|
|
@@ -310,13 +239,13 @@ var MenuBoxItem = (props) => {
|
|
|
310
239
|
const renderDescription = () => {
|
|
311
240
|
if (!description) return null;
|
|
312
241
|
if (typeof description === "string" || typeof description === "number") {
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
-
|
|
242
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
243
|
+
_reactnative.Text,
|
|
315
244
|
{
|
|
316
245
|
style: [
|
|
317
246
|
styles.description,
|
|
318
247
|
{ fontSize: sizeStyles.descriptionSize, color: descriptionColor },
|
|
319
|
-
customAppearance
|
|
248
|
+
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.description])
|
|
320
249
|
],
|
|
321
250
|
numberOfLines: 1
|
|
322
251
|
},
|
|
@@ -325,8 +254,8 @@ var MenuBoxItem = (props) => {
|
|
|
325
254
|
}
|
|
326
255
|
return description;
|
|
327
256
|
};
|
|
328
|
-
const content = /* @__PURE__ */
|
|
329
|
-
|
|
257
|
+
const content = /* @__PURE__ */ _react2.default.createElement(
|
|
258
|
+
_reactnative.Animated.View,
|
|
330
259
|
{
|
|
331
260
|
style: [
|
|
332
261
|
styles.item,
|
|
@@ -339,15 +268,15 @@ var MenuBoxItem = (props) => {
|
|
|
339
268
|
},
|
|
340
269
|
radiusStyles,
|
|
341
270
|
isDisabled && styles.disabled,
|
|
342
|
-
customAppearance
|
|
271
|
+
_optionalChain([customAppearance, 'optionalAccess', _11 => _11.container])
|
|
343
272
|
]
|
|
344
273
|
},
|
|
345
|
-
startContent && /* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
endContent && /* @__PURE__ */
|
|
274
|
+
startContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _optionalChain([customAppearance, 'optionalAccess', _12 => _12.content]) }, startContent),
|
|
275
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.content, _optionalChain([customAppearance, 'optionalAccess', _13 => _13.content])] }, renderTitle(), renderDescription()),
|
|
276
|
+
endContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _optionalChain([customAppearance, 'optionalAccess', _14 => _14.content]) }, endContent)
|
|
348
277
|
);
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
|
|
278
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
279
|
+
_reactnative.Pressable,
|
|
351
280
|
{
|
|
352
281
|
onPress: handlePress,
|
|
353
282
|
onPressIn: handlePressIn,
|
|
@@ -362,8 +291,7 @@ var MenuBoxItem = (props) => {
|
|
|
362
291
|
content
|
|
363
292
|
);
|
|
364
293
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
});
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
exports.MenuBox = MenuBox; exports.MenuBoxItem = MenuBoxItem;
|
package/dist/menubox/index.js
CHANGED
package/dist/pager/index.cjs
CHANGED
|
@@ -1,47 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/components/pager/index.ts
|
|
31
|
-
var pager_exports = {};
|
|
32
|
-
__export(pager_exports, {
|
|
33
|
-
Pager: () => Pager,
|
|
34
|
-
PagerItem: () => PagerItem
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(pager_exports);
|
|
37
|
-
|
|
38
|
-
// src/components/pager/pager.tsx
|
|
39
|
-
var import_react = __toESM(require("react"), 1);
|
|
40
|
-
var import_react_native2 = require("react-native");
|
|
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; }// src/components/pager/pager.tsx
|
|
2
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
3
|
+
var _reactnative = require('react-native');
|
|
41
4
|
|
|
42
5
|
// src/components/pager/pager.style.ts
|
|
43
|
-
|
|
44
|
-
var styles =
|
|
6
|
+
|
|
7
|
+
var styles = _reactnative.StyleSheet.create({
|
|
45
8
|
container: {
|
|
46
9
|
width: "100%"
|
|
47
10
|
},
|
|
@@ -94,8 +57,8 @@ function clampPage(page, max) {
|
|
|
94
57
|
return Math.max(0, Math.min(page, max));
|
|
95
58
|
}
|
|
96
59
|
function toPages(children) {
|
|
97
|
-
return
|
|
98
|
-
if (!
|
|
60
|
+
return _react2.default.Children.toArray(children).flatMap((child, index) => {
|
|
61
|
+
if (!_react2.default.isValidElement(child) || child.type !== PagerItem) {
|
|
99
62
|
return [];
|
|
100
63
|
}
|
|
101
64
|
return [
|
|
@@ -119,45 +82,45 @@ var Pager = ({
|
|
|
119
82
|
customAppearance
|
|
120
83
|
}) => {
|
|
121
84
|
const isPagerFullscreen = isFullscreen || isfullscreen === true;
|
|
122
|
-
const pages = (0,
|
|
85
|
+
const pages = _react.useMemo.call(void 0, () => toPages(children), [children]);
|
|
123
86
|
const maxPage = Math.max(0, pages.length - 1);
|
|
124
87
|
const isControlled = controlledPage !== void 0;
|
|
125
|
-
const [internalPage, setInternalPage] = (0,
|
|
126
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
127
|
-
const scrollViewRef = (0,
|
|
128
|
-
const initialScrollAppliedRef = (0,
|
|
88
|
+
const [internalPage, setInternalPage] = _react.useState.call(void 0, clampPage(defaultPage, maxPage));
|
|
89
|
+
const [containerWidth, setContainerWidth] = _react.useState.call(void 0, 0);
|
|
90
|
+
const scrollViewRef = _react.useRef.call(void 0, null);
|
|
91
|
+
const initialScrollAppliedRef = _react.useRef.call(void 0, false);
|
|
129
92
|
const activePage = clampPage(
|
|
130
|
-
isControlled ? controlledPage
|
|
93
|
+
isControlled ? _nullishCoalesce(controlledPage, () => ( 0)) : internalPage,
|
|
131
94
|
maxPage
|
|
132
95
|
);
|
|
133
|
-
(0,
|
|
96
|
+
_react.useEffect.call(void 0, () => {
|
|
134
97
|
if (isControlled || pages.length === 0) return;
|
|
135
98
|
setInternalPage((prev) => clampPage(prev, maxPage));
|
|
136
99
|
}, [isControlled, maxPage, pages.length]);
|
|
137
|
-
(0,
|
|
100
|
+
_react.useEffect.call(void 0, () => {
|
|
138
101
|
if (containerWidth <= 0) return;
|
|
139
102
|
if (pages.length <= 1) return;
|
|
140
103
|
const x = activePage * containerWidth;
|
|
141
104
|
if (!initialScrollAppliedRef.current) {
|
|
142
105
|
initialScrollAppliedRef.current = true;
|
|
143
|
-
scrollViewRef.current
|
|
106
|
+
_optionalChain([scrollViewRef, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.scrollTo, 'call', _4 => _4({ x, animated: false })]);
|
|
144
107
|
return;
|
|
145
108
|
}
|
|
146
|
-
scrollViewRef.current
|
|
109
|
+
_optionalChain([scrollViewRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.scrollTo, 'call', _7 => _7({ x, animated: true })]);
|
|
147
110
|
}, [activePage, containerWidth, pages.length]);
|
|
148
|
-
const handleLayout = (0,
|
|
111
|
+
const handleLayout = _react.useCallback.call(void 0, (event) => {
|
|
149
112
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
150
113
|
}, []);
|
|
151
|
-
const commitPageChange = (0,
|
|
114
|
+
const commitPageChange = _react.useCallback.call(void 0,
|
|
152
115
|
(nextPage) => {
|
|
153
116
|
if (!isControlled) {
|
|
154
117
|
setInternalPage(nextPage);
|
|
155
118
|
}
|
|
156
|
-
onPageChange
|
|
119
|
+
_optionalChain([onPageChange, 'optionalCall', _8 => _8(nextPage)]);
|
|
157
120
|
},
|
|
158
121
|
[isControlled, onPageChange]
|
|
159
122
|
);
|
|
160
|
-
const handleMomentumScrollEnd = (0,
|
|
123
|
+
const handleMomentumScrollEnd = _react.useCallback.call(void 0,
|
|
161
124
|
(event) => {
|
|
162
125
|
if (containerWidth <= 0 || pages.length === 0) return;
|
|
163
126
|
const rawPage = Math.round(event.nativeEvent.contentOffset.x / containerWidth);
|
|
@@ -168,18 +131,18 @@ var Pager = ({
|
|
|
168
131
|
},
|
|
169
132
|
[activePage, commitPageChange, containerWidth, maxPage, pages.length]
|
|
170
133
|
);
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
|
|
134
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
135
|
+
_reactnative.View,
|
|
173
136
|
{
|
|
174
137
|
onLayout: handleLayout,
|
|
175
138
|
style: [
|
|
176
139
|
styles.container,
|
|
177
140
|
isPagerFullscreen && styles.fullscreenContainer,
|
|
178
|
-
customAppearance
|
|
141
|
+
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.container])
|
|
179
142
|
]
|
|
180
143
|
},
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
|
|
144
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
145
|
+
_reactnative.ScrollView,
|
|
183
146
|
{
|
|
184
147
|
ref: scrollViewRef,
|
|
185
148
|
horizontal: true,
|
|
@@ -189,46 +152,46 @@ var Pager = ({
|
|
|
189
152
|
onMomentumScrollEnd: handleMomentumScrollEnd,
|
|
190
153
|
style: [
|
|
191
154
|
isPagerFullscreen && styles.fullscreenScrollView,
|
|
192
|
-
customAppearance
|
|
155
|
+
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.scrollView])
|
|
193
156
|
]
|
|
194
157
|
},
|
|
195
|
-
pages.map((pagerPage) => /* @__PURE__ */
|
|
196
|
-
|
|
158
|
+
pages.map((pagerPage) => /* @__PURE__ */ _react2.default.createElement(
|
|
159
|
+
_reactnative.View,
|
|
197
160
|
{
|
|
198
161
|
key: pagerPage.key,
|
|
199
162
|
style: [
|
|
200
163
|
styles.page,
|
|
201
164
|
isPagerFullscreen && styles.fullscreenPage,
|
|
202
|
-
customAppearance
|
|
165
|
+
_optionalChain([customAppearance, 'optionalAccess', _11 => _11.page]),
|
|
203
166
|
containerWidth > 0 && { width: containerWidth }
|
|
204
167
|
]
|
|
205
168
|
},
|
|
206
169
|
pagerPage.content
|
|
207
170
|
))
|
|
208
171
|
),
|
|
209
|
-
showIndicator && pages.length > 1 && /* @__PURE__ */
|
|
210
|
-
|
|
172
|
+
showIndicator && pages.length > 1 && /* @__PURE__ */ _react2.default.createElement(
|
|
173
|
+
_reactnative.View,
|
|
211
174
|
{
|
|
212
175
|
style: [
|
|
213
176
|
styles.indicatorContainer,
|
|
214
|
-
customAppearance
|
|
177
|
+
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.indicatorContainer]),
|
|
215
178
|
isPagerFullscreen && styles.fullscreenIndicatorContainer
|
|
216
179
|
]
|
|
217
180
|
},
|
|
218
181
|
pages.map((_, index) => {
|
|
219
182
|
const isActive = index === activePage;
|
|
220
183
|
if (renderIndicator) {
|
|
221
|
-
return /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, { key: `indicator-${String(index)}` }, renderIndicator({ index, isActive, total: pages.length }));
|
|
222
185
|
}
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
|
|
186
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
187
|
+
_reactnative.View,
|
|
225
188
|
{
|
|
226
189
|
key: `indicator-${String(index)}`,
|
|
227
190
|
style: [
|
|
228
191
|
styles.indicator,
|
|
229
|
-
customAppearance
|
|
192
|
+
_optionalChain([customAppearance, 'optionalAccess', _13 => _13.indicator]),
|
|
230
193
|
isActive && styles.activeIndicator,
|
|
231
|
-
isActive && customAppearance
|
|
194
|
+
isActive && _optionalChain([customAppearance, 'optionalAccess', _14 => _14.activeIndicator])
|
|
232
195
|
]
|
|
233
196
|
}
|
|
234
197
|
);
|
|
@@ -236,8 +199,7 @@ var Pager = ({
|
|
|
236
199
|
)
|
|
237
200
|
);
|
|
238
201
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
exports.Pager = Pager; exports.PagerItem = PagerItem;
|