@xaui/native 0.0.21 → 0.0.24
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/README.md +195 -2
- package/dist/alert/index.js +1 -2
- package/dist/app-bar/index.cjs +217 -0
- package/dist/app-bar/index.d.cts +52 -0
- package/dist/app-bar/index.d.ts +52 -0
- package/dist/app-bar/index.js +142 -0
- package/dist/autocomplete/index.js +48 -36
- package/dist/avatar/index.js +1 -2
- package/dist/badge/index.js +1 -2
- package/dist/bottom-sheet/index.js +1 -2
- package/dist/bottom-tab-bar/index.cjs +571 -0
- package/dist/bottom-tab-bar/index.d.cts +211 -0
- package/dist/bottom-tab-bar/index.d.ts +211 -0
- package/dist/bottom-tab-bar/index.js +497 -0
- package/dist/button/index.d.cts +102 -5
- package/dist/button/index.d.ts +102 -5
- package/dist/button/index.js +2 -3
- package/dist/button.type-j1ZdkkSl.d.cts +4 -0
- package/dist/button.type-j1ZdkkSl.d.ts +4 -0
- package/dist/card/index.cjs +2 -0
- package/dist/card/index.d.cts +6 -1
- package/dist/card/index.d.ts +6 -1
- package/dist/card/index.js +4 -2
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +1067 -0
- package/dist/chart/index.d.cts +218 -0
- package/dist/chart/index.d.ts +218 -0
- package/dist/chart/index.js +1026 -0
- package/dist/checkbox/index.js +1 -2
- package/dist/chip/index.js +1 -2
- package/dist/chunk-3XSXTM3G.js +661 -0
- package/dist/chunk-4KSZLONZ.js +79 -0
- package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
- package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
- package/dist/chunk-I4V5Y5GD.js +76 -0
- package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
- package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
- package/dist/chunk-URBEEDFX.js +79 -0
- package/dist/core/index.js +3 -5
- package/dist/datepicker/index.js +1 -2
- package/dist/divider/index.js +2 -3
- package/dist/drawer/index.cjs +310 -0
- package/dist/drawer/index.d.cts +58 -0
- package/dist/drawer/index.d.ts +58 -0
- package/dist/drawer/index.js +236 -0
- package/dist/{accordion → expansion-panel}/index.cjs +45 -45
- package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
- package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
- package/dist/{accordion → expansion-panel}/index.js +40 -41
- package/dist/fab/index.d.cts +3 -3
- package/dist/fab/index.d.ts +3 -3
- package/dist/fab/index.js +3 -4
- package/dist/fab-menu/index.d.cts +2 -2
- package/dist/fab-menu/index.d.ts +2 -2
- package/dist/fab-menu/index.js +3 -4
- package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
- package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
- package/dist/feature-discovery/index.cjs +531 -0
- package/dist/feature-discovery/index.d.cts +82 -0
- package/dist/feature-discovery/index.d.ts +82 -0
- package/dist/feature-discovery/index.js +464 -0
- package/dist/indicator/index.js +2 -3
- package/dist/input/index.cjs +258 -164
- package/dist/input/index.d.cts +15 -1
- package/dist/input/index.d.ts +15 -1
- package/dist/input/index.js +219 -126
- package/dist/list/index.js +1 -2
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +369 -0
- package/dist/menubox/index.d.cts +98 -0
- package/dist/menubox/index.d.ts +98 -0
- package/dist/menubox/index.js +296 -0
- package/dist/pager/index.cjs +243 -0
- package/dist/pager/index.d.cts +93 -0
- package/dist/pager/index.d.ts +93 -0
- package/dist/pager/index.js +205 -0
- package/dist/progress/index.js +1 -2
- package/dist/radio/index.cjs +537 -0
- package/dist/radio/index.d.cts +145 -0
- package/dist/radio/index.d.ts +145 -0
- package/dist/radio/index.js +464 -0
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.js +22 -10
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +655 -0
- package/dist/slider/index.d.cts +171 -0
- package/dist/slider/index.d.ts +171 -0
- package/dist/slider/index.js +575 -0
- package/dist/stepper/index.cjs +624 -0
- package/dist/stepper/index.d.cts +137 -0
- package/dist/stepper/index.d.ts +137 -0
- package/dist/stepper/index.js +549 -0
- package/dist/switch/index.js +1 -2
- package/dist/tabs/index.cjs +523 -0
- package/dist/tabs/index.d.cts +176 -0
- package/dist/tabs/index.d.ts +176 -0
- package/dist/tabs/index.js +438 -0
- package/dist/timepicker/index.cjs +1280 -0
- package/dist/timepicker/index.d.cts +215 -0
- package/dist/timepicker/index.d.ts +215 -0
- package/dist/timepicker/index.js +1181 -0
- package/dist/toolbar/index.cjs +395 -0
- package/dist/toolbar/index.d.cts +100 -0
- package/dist/toolbar/index.d.ts +100 -0
- package/dist/toolbar/index.js +325 -0
- package/dist/typography/index.js +1 -2
- package/dist/view/index.cjs +16 -2
- package/dist/view/index.js +16 -2
- package/package.json +73 -8
- package/dist/button.type-D8tzEBo7.d.ts +0 -104
- package/dist/button.type-ikaWzhIg.d.cts +0 -104
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-JEGEPGVU.js +0 -287
|
@@ -0,0 +1,369 @@
|
|
|
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);
|
|
29
|
+
|
|
30
|
+
// src/components/menubox/index.ts
|
|
31
|
+
var menubox_exports = {};
|
|
32
|
+
__export(menubox_exports, {
|
|
33
|
+
MenuBox: () => MenuBox,
|
|
34
|
+
MenuBoxItem: () => MenuBoxItem
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(menubox_exports);
|
|
37
|
+
|
|
38
|
+
// src/components/menubox/menubox.tsx
|
|
39
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
40
|
+
var import_react_native5 = require("react-native");
|
|
41
|
+
|
|
42
|
+
// src/components/menubox/menubox-context.ts
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
var MenuBoxContext = (0, import_react.createContext)(null);
|
|
45
|
+
|
|
46
|
+
// src/components/menubox/menubox.style.ts
|
|
47
|
+
var import_react_native = require("react-native");
|
|
48
|
+
var styles = import_react_native.StyleSheet.create({
|
|
49
|
+
container: {
|
|
50
|
+
overflow: "hidden"
|
|
51
|
+
},
|
|
52
|
+
item: {
|
|
53
|
+
flexDirection: "row",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
gap: 12
|
|
56
|
+
},
|
|
57
|
+
content: {
|
|
58
|
+
flex: 1,
|
|
59
|
+
gap: 2
|
|
60
|
+
},
|
|
61
|
+
title: {
|
|
62
|
+
fontWeight: "500"
|
|
63
|
+
},
|
|
64
|
+
description: {
|
|
65
|
+
opacity: 0.6
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
opacity: 0.5
|
|
69
|
+
},
|
|
70
|
+
divider: {
|
|
71
|
+
height: 1,
|
|
72
|
+
marginLeft: 56
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
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
|
+
// src/components/menubox/menubox.tsx
|
|
116
|
+
var MenuBox = ({
|
|
117
|
+
children,
|
|
118
|
+
size = "md",
|
|
119
|
+
radius = "lg",
|
|
120
|
+
themeColor = "default",
|
|
121
|
+
spacing = 0,
|
|
122
|
+
style,
|
|
123
|
+
backgroundColor
|
|
124
|
+
}) => {
|
|
125
|
+
const theme = useXUITheme();
|
|
126
|
+
const itemCount = import_react7.Children.count(children);
|
|
127
|
+
const itemKeys = (0, import_react7.useMemo)(() => {
|
|
128
|
+
const keys = [];
|
|
129
|
+
import_react7.Children.forEach(children, (child) => {
|
|
130
|
+
if ((0, import_react7.isValidElement)(child)) {
|
|
131
|
+
const props = child.props;
|
|
132
|
+
if (props.itemKey) {
|
|
133
|
+
keys.push(props.itemKey);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return keys;
|
|
138
|
+
}, [children]);
|
|
139
|
+
const getItemIndex = (itemKey) => {
|
|
140
|
+
return itemKeys.indexOf(itemKey);
|
|
141
|
+
};
|
|
142
|
+
const bgColor = backgroundColor ?? theme.colors.default.background;
|
|
143
|
+
const contextValue = (0, import_react7.useMemo)(
|
|
144
|
+
() => ({
|
|
145
|
+
size,
|
|
146
|
+
radius,
|
|
147
|
+
themeColor,
|
|
148
|
+
backgroundColor: bgColor,
|
|
149
|
+
itemCount,
|
|
150
|
+
spacing,
|
|
151
|
+
getItemIndex
|
|
152
|
+
}),
|
|
153
|
+
[size, radius, themeColor, bgColor, itemCount, spacing, getItemIndex]
|
|
154
|
+
);
|
|
155
|
+
return /* @__PURE__ */ import_react7.default.createElement(MenuBoxContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.container, style] }, children));
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// src/components/menubox/menubox-item.tsx
|
|
159
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
160
|
+
var import_react_native7 = require("react-native");
|
|
161
|
+
|
|
162
|
+
// src/components/menubox/menubox.hook.ts
|
|
163
|
+
var import_react8 = require("react");
|
|
164
|
+
var useMenuBoxItemSizeStyles = (size) => {
|
|
165
|
+
const theme = useXUITheme();
|
|
166
|
+
return (0, import_react8.useMemo)(() => {
|
|
167
|
+
const sizes = {
|
|
168
|
+
xs: {
|
|
169
|
+
paddingVertical: theme.spacing.sm,
|
|
170
|
+
paddingHorizontal: theme.spacing.sm,
|
|
171
|
+
titleSize: theme.fontSizes.xs,
|
|
172
|
+
descriptionSize: theme.fontSizes.xs
|
|
173
|
+
},
|
|
174
|
+
sm: {
|
|
175
|
+
paddingVertical: theme.spacing.sm,
|
|
176
|
+
paddingHorizontal: theme.spacing.md,
|
|
177
|
+
titleSize: theme.fontSizes.sm,
|
|
178
|
+
descriptionSize: theme.fontSizes.xs
|
|
179
|
+
},
|
|
180
|
+
md: {
|
|
181
|
+
paddingVertical: theme.spacing.md,
|
|
182
|
+
paddingHorizontal: theme.spacing.md,
|
|
183
|
+
titleSize: theme.fontSizes.md,
|
|
184
|
+
descriptionSize: theme.fontSizes.sm
|
|
185
|
+
},
|
|
186
|
+
lg: {
|
|
187
|
+
paddingVertical: theme.spacing.lg,
|
|
188
|
+
paddingHorizontal: theme.spacing.lg,
|
|
189
|
+
titleSize: theme.fontSizes.lg,
|
|
190
|
+
descriptionSize: theme.fontSizes.md
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
return sizes[size];
|
|
194
|
+
}, [size, theme]);
|
|
195
|
+
};
|
|
196
|
+
var useMenuBoxRadiusStyles = (radius, isFirst, isLast) => {
|
|
197
|
+
const theme = useXUITheme();
|
|
198
|
+
return (0, import_react8.useMemo)(() => {
|
|
199
|
+
const radiusMap = {
|
|
200
|
+
none: theme.borderRadius.none,
|
|
201
|
+
sm: theme.borderRadius.md,
|
|
202
|
+
md: theme.borderRadius.lg,
|
|
203
|
+
lg: theme.borderRadius.xl,
|
|
204
|
+
full: theme.borderRadius.full
|
|
205
|
+
};
|
|
206
|
+
const r = radiusMap[radius];
|
|
207
|
+
return {
|
|
208
|
+
borderTopLeftRadius: isFirst ? r : 0,
|
|
209
|
+
borderTopRightRadius: isFirst ? r : 0,
|
|
210
|
+
borderBottomLeftRadius: isLast ? r : 0,
|
|
211
|
+
borderBottomRightRadius: isLast ? r : 0
|
|
212
|
+
};
|
|
213
|
+
}, [radius, isFirst, isLast, theme]);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// src/components/menubox/menubox.animation.ts
|
|
217
|
+
var import_react_native6 = require("react-native");
|
|
218
|
+
var runMenuBoxPressInAnimation = (animatedScale, animatedOpacity) => {
|
|
219
|
+
import_react_native6.Animated.parallel([
|
|
220
|
+
import_react_native6.Animated.spring(animatedScale, {
|
|
221
|
+
toValue: 0.99,
|
|
222
|
+
useNativeDriver: true,
|
|
223
|
+
speed: 50,
|
|
224
|
+
bounciness: 0
|
|
225
|
+
}),
|
|
226
|
+
import_react_native6.Animated.timing(animatedOpacity, {
|
|
227
|
+
toValue: 0.8,
|
|
228
|
+
duration: 100,
|
|
229
|
+
useNativeDriver: true
|
|
230
|
+
})
|
|
231
|
+
]).start();
|
|
232
|
+
};
|
|
233
|
+
var runMenuBoxPressOutAnimation = (animatedScale, animatedOpacity) => {
|
|
234
|
+
import_react_native6.Animated.parallel([
|
|
235
|
+
import_react_native6.Animated.spring(animatedScale, {
|
|
236
|
+
toValue: 1,
|
|
237
|
+
useNativeDriver: true,
|
|
238
|
+
speed: 50,
|
|
239
|
+
bounciness: 0
|
|
240
|
+
}),
|
|
241
|
+
import_react_native6.Animated.timing(animatedOpacity, {
|
|
242
|
+
toValue: 1,
|
|
243
|
+
duration: 100,
|
|
244
|
+
useNativeDriver: true
|
|
245
|
+
})
|
|
246
|
+
]).start();
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/components/menubox/menubox-item.tsx
|
|
250
|
+
var MenuBoxItem = (props) => {
|
|
251
|
+
const context = (0, import_react9.useContext)(MenuBoxContext);
|
|
252
|
+
const theme = useXUITheme();
|
|
253
|
+
const animatedScale = import_react9.default.useRef(new import_react_native7.Animated.Value(1)).current;
|
|
254
|
+
const animatedOpacity = import_react9.default.useRef(new import_react_native7.Animated.Value(1)).current;
|
|
255
|
+
const {
|
|
256
|
+
itemKey,
|
|
257
|
+
title,
|
|
258
|
+
description,
|
|
259
|
+
startContent,
|
|
260
|
+
endContent,
|
|
261
|
+
isDisabled = false,
|
|
262
|
+
customAppearance,
|
|
263
|
+
onPress
|
|
264
|
+
} = props;
|
|
265
|
+
const size = context?.size ?? "md";
|
|
266
|
+
const radius = context?.radius ?? "lg";
|
|
267
|
+
const itemBackgroundColor = context?.backgroundColor ?? (theme.mode === "dark" ? theme.colors.default.background : theme.colors.background);
|
|
268
|
+
const spacing = context?.spacing ?? 0;
|
|
269
|
+
const itemCount = context?.itemCount ?? 1;
|
|
270
|
+
const index = context?.getItemIndex(itemKey) ?? 0;
|
|
271
|
+
const isFirst = index === 0;
|
|
272
|
+
const isLast = index === itemCount - 1;
|
|
273
|
+
const sizeStyles = useMenuBoxItemSizeStyles(size);
|
|
274
|
+
const radiusStyles = useMenuBoxRadiusStyles(radius, isFirst, isLast);
|
|
275
|
+
const titleColor = isDisabled ? theme.colors.foreground + "50" : theme.colors.foreground;
|
|
276
|
+
const descriptionColor = isDisabled ? theme.colors.foreground + "50" : theme.colors.foreground + "99";
|
|
277
|
+
const handlePress = () => {
|
|
278
|
+
if (isDisabled) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
onPress?.({});
|
|
282
|
+
};
|
|
283
|
+
const handlePressIn = () => {
|
|
284
|
+
if (!isDisabled) {
|
|
285
|
+
runMenuBoxPressInAnimation(animatedScale, animatedOpacity);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
const handlePressOut = () => {
|
|
289
|
+
if (!isDisabled) {
|
|
290
|
+
runMenuBoxPressOutAnimation(animatedScale, animatedOpacity);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
const renderTitle = () => {
|
|
294
|
+
if (typeof title === "string" || typeof title === "number") {
|
|
295
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
296
|
+
import_react_native7.Text,
|
|
297
|
+
{
|
|
298
|
+
style: [
|
|
299
|
+
styles.title,
|
|
300
|
+
{ fontSize: sizeStyles.titleSize, color: titleColor },
|
|
301
|
+
customAppearance?.title
|
|
302
|
+
],
|
|
303
|
+
numberOfLines: 1
|
|
304
|
+
},
|
|
305
|
+
title
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
return title;
|
|
309
|
+
};
|
|
310
|
+
const renderDescription = () => {
|
|
311
|
+
if (!description) return null;
|
|
312
|
+
if (typeof description === "string" || typeof description === "number") {
|
|
313
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
314
|
+
import_react_native7.Text,
|
|
315
|
+
{
|
|
316
|
+
style: [
|
|
317
|
+
styles.description,
|
|
318
|
+
{ fontSize: sizeStyles.descriptionSize, color: descriptionColor },
|
|
319
|
+
customAppearance?.description
|
|
320
|
+
],
|
|
321
|
+
numberOfLines: 1
|
|
322
|
+
},
|
|
323
|
+
description
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return description;
|
|
327
|
+
};
|
|
328
|
+
const content = /* @__PURE__ */ import_react9.default.createElement(
|
|
329
|
+
import_react_native7.Animated.View,
|
|
330
|
+
{
|
|
331
|
+
style: [
|
|
332
|
+
styles.item,
|
|
333
|
+
{
|
|
334
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
335
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
336
|
+
backgroundColor: itemBackgroundColor,
|
|
337
|
+
transform: [{ scale: animatedScale }],
|
|
338
|
+
opacity: animatedOpacity
|
|
339
|
+
},
|
|
340
|
+
radiusStyles,
|
|
341
|
+
isDisabled && styles.disabled,
|
|
342
|
+
customAppearance?.container
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
startContent && /* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: customAppearance?.content }, startContent),
|
|
346
|
+
/* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: [styles.content, customAppearance?.content] }, renderTitle(), renderDescription()),
|
|
347
|
+
endContent && /* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: customAppearance?.content }, endContent)
|
|
348
|
+
);
|
|
349
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
350
|
+
import_react_native7.Pressable,
|
|
351
|
+
{
|
|
352
|
+
onPress: handlePress,
|
|
353
|
+
onPressIn: handlePressIn,
|
|
354
|
+
onPressOut: handlePressOut,
|
|
355
|
+
disabled: isDisabled,
|
|
356
|
+
style: [
|
|
357
|
+
radiusStyles,
|
|
358
|
+
{ overflow: "hidden" },
|
|
359
|
+
!isLast && { marginBottom: spacing }
|
|
360
|
+
]
|
|
361
|
+
},
|
|
362
|
+
content
|
|
363
|
+
);
|
|
364
|
+
};
|
|
365
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
366
|
+
0 && (module.exports = {
|
|
367
|
+
MenuBox,
|
|
368
|
+
MenuBoxItem
|
|
369
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { S as Size, R as Radius, T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
4
|
+
|
|
5
|
+
type MenuBoxItemCustomAppearance = {
|
|
6
|
+
/**
|
|
7
|
+
* Custom styles for the item container
|
|
8
|
+
*/
|
|
9
|
+
container?: ViewStyle;
|
|
10
|
+
/**
|
|
11
|
+
* Custom styles for the content container
|
|
12
|
+
*/
|
|
13
|
+
content?: ViewStyle;
|
|
14
|
+
/**
|
|
15
|
+
* Custom styles for the title text
|
|
16
|
+
*/
|
|
17
|
+
title?: TextStyle;
|
|
18
|
+
/**
|
|
19
|
+
* Custom styles for the description text
|
|
20
|
+
*/
|
|
21
|
+
description?: TextStyle;
|
|
22
|
+
};
|
|
23
|
+
type MenuBoxItemProps = {
|
|
24
|
+
/**
|
|
25
|
+
* Unique key for the item
|
|
26
|
+
*/
|
|
27
|
+
itemKey: string;
|
|
28
|
+
/**
|
|
29
|
+
* Title text for the MenuBoxItem
|
|
30
|
+
*/
|
|
31
|
+
title: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Optional description text
|
|
34
|
+
*/
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Content to display at the start of the item (icon, avatar, etc.)
|
|
38
|
+
*/
|
|
39
|
+
startContent?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Content to display at the end of the item (chevron, badge, etc.)
|
|
42
|
+
*/
|
|
43
|
+
endContent?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the item is disabled
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
isDisabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Custom appearance styles for item parts
|
|
51
|
+
*/
|
|
52
|
+
customAppearance?: MenuBoxItemCustomAppearance;
|
|
53
|
+
/**
|
|
54
|
+
* Callback fired when the item is pressed
|
|
55
|
+
*/
|
|
56
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
57
|
+
};
|
|
58
|
+
type MenuBoxProps = {
|
|
59
|
+
/**
|
|
60
|
+
* MenuBox items (MenuBoxItem components)
|
|
61
|
+
*/
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Size of the menu items
|
|
65
|
+
* @default 'md'
|
|
66
|
+
*/
|
|
67
|
+
size?: Size;
|
|
68
|
+
/**
|
|
69
|
+
* Border radius for the container and items
|
|
70
|
+
* @default 'lg'
|
|
71
|
+
*/
|
|
72
|
+
radius?: Radius;
|
|
73
|
+
/**
|
|
74
|
+
* Theme color for pressed states
|
|
75
|
+
* @default 'default'
|
|
76
|
+
*/
|
|
77
|
+
themeColor?: ThemeColor;
|
|
78
|
+
/**
|
|
79
|
+
* Spacing between menu items in pixels
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
spacing?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Custom styles for the container
|
|
85
|
+
*/
|
|
86
|
+
style?: ViewStyle;
|
|
87
|
+
/**
|
|
88
|
+
* Background color for MenuBox items
|
|
89
|
+
* Uses `theme.colors.default.background` by default
|
|
90
|
+
*/
|
|
91
|
+
backgroundColor?: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare const MenuBox: React.FC<MenuBoxProps>;
|
|
95
|
+
|
|
96
|
+
declare const MenuBoxItem: React.FC<MenuBoxItemProps>;
|
|
97
|
+
|
|
98
|
+
export { MenuBox, MenuBoxItem, type MenuBoxItemCustomAppearance, type MenuBoxItemProps, type MenuBoxProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { S as Size, R as Radius, T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
4
|
+
|
|
5
|
+
type MenuBoxItemCustomAppearance = {
|
|
6
|
+
/**
|
|
7
|
+
* Custom styles for the item container
|
|
8
|
+
*/
|
|
9
|
+
container?: ViewStyle;
|
|
10
|
+
/**
|
|
11
|
+
* Custom styles for the content container
|
|
12
|
+
*/
|
|
13
|
+
content?: ViewStyle;
|
|
14
|
+
/**
|
|
15
|
+
* Custom styles for the title text
|
|
16
|
+
*/
|
|
17
|
+
title?: TextStyle;
|
|
18
|
+
/**
|
|
19
|
+
* Custom styles for the description text
|
|
20
|
+
*/
|
|
21
|
+
description?: TextStyle;
|
|
22
|
+
};
|
|
23
|
+
type MenuBoxItemProps = {
|
|
24
|
+
/**
|
|
25
|
+
* Unique key for the item
|
|
26
|
+
*/
|
|
27
|
+
itemKey: string;
|
|
28
|
+
/**
|
|
29
|
+
* Title text for the MenuBoxItem
|
|
30
|
+
*/
|
|
31
|
+
title: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Optional description text
|
|
34
|
+
*/
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Content to display at the start of the item (icon, avatar, etc.)
|
|
38
|
+
*/
|
|
39
|
+
startContent?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Content to display at the end of the item (chevron, badge, etc.)
|
|
42
|
+
*/
|
|
43
|
+
endContent?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the item is disabled
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
isDisabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Custom appearance styles for item parts
|
|
51
|
+
*/
|
|
52
|
+
customAppearance?: MenuBoxItemCustomAppearance;
|
|
53
|
+
/**
|
|
54
|
+
* Callback fired when the item is pressed
|
|
55
|
+
*/
|
|
56
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
57
|
+
};
|
|
58
|
+
type MenuBoxProps = {
|
|
59
|
+
/**
|
|
60
|
+
* MenuBox items (MenuBoxItem components)
|
|
61
|
+
*/
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Size of the menu items
|
|
65
|
+
* @default 'md'
|
|
66
|
+
*/
|
|
67
|
+
size?: Size;
|
|
68
|
+
/**
|
|
69
|
+
* Border radius for the container and items
|
|
70
|
+
* @default 'lg'
|
|
71
|
+
*/
|
|
72
|
+
radius?: Radius;
|
|
73
|
+
/**
|
|
74
|
+
* Theme color for pressed states
|
|
75
|
+
* @default 'default'
|
|
76
|
+
*/
|
|
77
|
+
themeColor?: ThemeColor;
|
|
78
|
+
/**
|
|
79
|
+
* Spacing between menu items in pixels
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
spacing?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Custom styles for the container
|
|
85
|
+
*/
|
|
86
|
+
style?: ViewStyle;
|
|
87
|
+
/**
|
|
88
|
+
* Background color for MenuBox items
|
|
89
|
+
* Uses `theme.colors.default.background` by default
|
|
90
|
+
*/
|
|
91
|
+
backgroundColor?: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare const MenuBox: React.FC<MenuBoxProps>;
|
|
95
|
+
|
|
96
|
+
declare const MenuBoxItem: React.FC<MenuBoxItemProps>;
|
|
97
|
+
|
|
98
|
+
export { MenuBox, MenuBoxItem, type MenuBoxItemCustomAppearance, type MenuBoxItemProps, type MenuBoxProps };
|