@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,395 @@
|
|
|
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/toolbar/index.ts
|
|
31
|
+
var toolbar_exports = {};
|
|
32
|
+
__export(toolbar_exports, {
|
|
33
|
+
Toolbar: () => Toolbar,
|
|
34
|
+
ToolbarAction: () => ToolbarAction
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(toolbar_exports);
|
|
37
|
+
|
|
38
|
+
// src/components/toolbar/toolbar.tsx
|
|
39
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
40
|
+
var import_react_native5 = require("react-native");
|
|
41
|
+
var import_react_native_reanimated = __toESM(require("react-native-reanimated"), 1);
|
|
42
|
+
|
|
43
|
+
// src/components/toolbar/toolbar.hook.ts
|
|
44
|
+
var import_react6 = require("react");
|
|
45
|
+
var import_core = require("@xaui/core");
|
|
46
|
+
|
|
47
|
+
// src/core/theme-context.tsx
|
|
48
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
49
|
+
var import_react_native2 = require("react-native");
|
|
50
|
+
var import_theme = require("@xaui/core/theme");
|
|
51
|
+
var import_palette = require("@xaui/core/palette");
|
|
52
|
+
|
|
53
|
+
// src/core/portal/portal.tsx
|
|
54
|
+
var import_react2 = require("react");
|
|
55
|
+
|
|
56
|
+
// src/core/portal/portal-context.ts
|
|
57
|
+
var import_react = require("react");
|
|
58
|
+
var PortalContext = (0, import_react.createContext)(null);
|
|
59
|
+
|
|
60
|
+
// src/core/portal/portal-host.tsx
|
|
61
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
62
|
+
var import_react_native = require("react-native");
|
|
63
|
+
var hostStyles = import_react_native.StyleSheet.create({
|
|
64
|
+
container: {
|
|
65
|
+
flex: 1
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// src/core/theme-context.tsx
|
|
70
|
+
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
71
|
+
|
|
72
|
+
// src/core/theme-hooks.ts
|
|
73
|
+
var import_react5 = require("react");
|
|
74
|
+
var import_react_native3 = require("react-native");
|
|
75
|
+
function useXUITheme() {
|
|
76
|
+
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
77
|
+
if (!theme) {
|
|
78
|
+
throw new Error("useXUITheme must be used within XUIProvider");
|
|
79
|
+
}
|
|
80
|
+
return theme;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/core/index.ts
|
|
84
|
+
var import_theme2 = require("@xaui/core/theme");
|
|
85
|
+
|
|
86
|
+
// src/components/toolbar/toolbar.hook.ts
|
|
87
|
+
var variantMap = {
|
|
88
|
+
floating: {
|
|
89
|
+
containerHeight: 72,
|
|
90
|
+
containerWidth: "auto",
|
|
91
|
+
iconSize: 26,
|
|
92
|
+
actionSize: 40,
|
|
93
|
+
borderRadius: 56,
|
|
94
|
+
paddingHorizontal: 16,
|
|
95
|
+
paddingVertical: 16,
|
|
96
|
+
gap: 0,
|
|
97
|
+
isElevated: true
|
|
98
|
+
},
|
|
99
|
+
docked: {
|
|
100
|
+
containerHeight: 72,
|
|
101
|
+
containerWidth: "auto",
|
|
102
|
+
iconSize: 26,
|
|
103
|
+
actionSize: 40,
|
|
104
|
+
borderRadius: 0,
|
|
105
|
+
paddingHorizontal: 16,
|
|
106
|
+
paddingVertical: 16,
|
|
107
|
+
gap: 0,
|
|
108
|
+
isElevated: false
|
|
109
|
+
},
|
|
110
|
+
vertical: {
|
|
111
|
+
containerHeight: "auto",
|
|
112
|
+
containerWidth: 80,
|
|
113
|
+
iconSize: 26,
|
|
114
|
+
actionSize: 40,
|
|
115
|
+
borderRadius: 0,
|
|
116
|
+
paddingHorizontal: 16,
|
|
117
|
+
paddingVertical: 16,
|
|
118
|
+
gap: 0,
|
|
119
|
+
isElevated: false
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var useToolbarVariantStyles = (variant, position) => {
|
|
123
|
+
return (0, import_react6.useMemo)(() => {
|
|
124
|
+
const baseStyles = variantMap[variant];
|
|
125
|
+
const isVertical = variant === "vertical";
|
|
126
|
+
return {
|
|
127
|
+
...baseStyles,
|
|
128
|
+
isVertical,
|
|
129
|
+
position
|
|
130
|
+
};
|
|
131
|
+
}, [variant, position]);
|
|
132
|
+
};
|
|
133
|
+
var useToolbarColors = (themeColor) => {
|
|
134
|
+
const theme = useXUITheme();
|
|
135
|
+
const colorScheme = theme.colors[(0, import_core.getSafeThemeColor)(themeColor)];
|
|
136
|
+
return (0, import_react6.useMemo)(() => {
|
|
137
|
+
return {
|
|
138
|
+
background: theme.mode === "dark" ? theme.colors.default.background : theme.colors.background,
|
|
139
|
+
divider: (0, import_core.withOpacity)(theme.colors.foreground, 0.1),
|
|
140
|
+
title: theme.colors.foreground,
|
|
141
|
+
subtitle: (0, import_core.withOpacity)(theme.colors.foreground, 0.72),
|
|
142
|
+
action: colorScheme.main,
|
|
143
|
+
pressed: (0, import_core.withOpacity)(colorScheme.main, 0.16),
|
|
144
|
+
shadow: (0, import_core.withOpacity)(theme.colors.foreground, 0.35)
|
|
145
|
+
};
|
|
146
|
+
}, [colorScheme.main, theme.colors, theme.mode]);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/components/toolbar/toolbar.style.ts
|
|
150
|
+
var import_react_native4 = require("react-native");
|
|
151
|
+
var styles = import_react_native4.StyleSheet.create({
|
|
152
|
+
container: {
|
|
153
|
+
position: "absolute",
|
|
154
|
+
zIndex: 40
|
|
155
|
+
},
|
|
156
|
+
top: {
|
|
157
|
+
top: 0,
|
|
158
|
+
left: 0,
|
|
159
|
+
right: 0
|
|
160
|
+
},
|
|
161
|
+
bottom: {
|
|
162
|
+
bottom: 0,
|
|
163
|
+
left: 0,
|
|
164
|
+
right: 0
|
|
165
|
+
},
|
|
166
|
+
left: {
|
|
167
|
+
left: 0,
|
|
168
|
+
top: 0,
|
|
169
|
+
bottom: 0
|
|
170
|
+
},
|
|
171
|
+
right: {
|
|
172
|
+
right: 0,
|
|
173
|
+
top: 0,
|
|
174
|
+
bottom: 0
|
|
175
|
+
},
|
|
176
|
+
floating: {
|
|
177
|
+
margin: 16
|
|
178
|
+
},
|
|
179
|
+
floatingBottom: {
|
|
180
|
+
marginBottom: 16
|
|
181
|
+
},
|
|
182
|
+
floatingTop: {
|
|
183
|
+
marginTop: 16
|
|
184
|
+
},
|
|
185
|
+
elevated: {
|
|
186
|
+
shadowOffset: { width: 0, height: 2 },
|
|
187
|
+
shadowOpacity: 0.15,
|
|
188
|
+
shadowRadius: 8,
|
|
189
|
+
elevation: 3
|
|
190
|
+
},
|
|
191
|
+
content: {
|
|
192
|
+
flexDirection: "row",
|
|
193
|
+
alignItems: "center"
|
|
194
|
+
},
|
|
195
|
+
contentVertical: {
|
|
196
|
+
flexDirection: "column",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
justifyContent: "center"
|
|
199
|
+
},
|
|
200
|
+
actions: {
|
|
201
|
+
flexDirection: "row",
|
|
202
|
+
alignItems: "center",
|
|
203
|
+
justifyContent: "space-between",
|
|
204
|
+
width: "100%"
|
|
205
|
+
},
|
|
206
|
+
actionsVertical: {
|
|
207
|
+
flexDirection: "column",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "space-between",
|
|
210
|
+
height: "100%"
|
|
211
|
+
},
|
|
212
|
+
actionButton: {
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
justifyContent: "center",
|
|
215
|
+
borderRadius: 999
|
|
216
|
+
},
|
|
217
|
+
disabledAction: {
|
|
218
|
+
opacity: 0.38
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// src/components/toolbar/toolbar-context.ts
|
|
223
|
+
var import_react7 = require("react");
|
|
224
|
+
var ToolbarContext = (0, import_react7.createContext)(null);
|
|
225
|
+
var useToolbarContext = () => {
|
|
226
|
+
return (0, import_react7.useContext)(ToolbarContext);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// src/components/toolbar/toolbar.tsx
|
|
230
|
+
var Toolbar = ({
|
|
231
|
+
variant = "docked",
|
|
232
|
+
position = "top",
|
|
233
|
+
isVisible = true,
|
|
234
|
+
themeColor = "primary",
|
|
235
|
+
showDivider = false,
|
|
236
|
+
isElevated,
|
|
237
|
+
children,
|
|
238
|
+
style,
|
|
239
|
+
customAppearance
|
|
240
|
+
}) => {
|
|
241
|
+
const variantStyles = useToolbarVariantStyles(variant, position);
|
|
242
|
+
const colors2 = useToolbarColors(themeColor);
|
|
243
|
+
const translateValue = (0, import_react_native_reanimated.useSharedValue)(
|
|
244
|
+
isVisible ? 0 : getInitialTranslate(position)
|
|
245
|
+
);
|
|
246
|
+
const opacityValue = (0, import_react_native_reanimated.useSharedValue)(isVisible ? 1 : 0);
|
|
247
|
+
(0, import_react8.useEffect)(() => {
|
|
248
|
+
if (isVisible) {
|
|
249
|
+
translateValue.value = (0, import_react_native_reanimated.withSpring)(0, {
|
|
250
|
+
damping: 20,
|
|
251
|
+
stiffness: 300
|
|
252
|
+
});
|
|
253
|
+
opacityValue.value = (0, import_react_native_reanimated.withTiming)(1, { duration: 200 });
|
|
254
|
+
} else {
|
|
255
|
+
translateValue.value = (0, import_react_native_reanimated.withSpring)(getInitialTranslate(position), {
|
|
256
|
+
damping: 20,
|
|
257
|
+
stiffness: 300
|
|
258
|
+
});
|
|
259
|
+
opacityValue.value = (0, import_react_native_reanimated.withTiming)(0, { duration: 200 });
|
|
260
|
+
}
|
|
261
|
+
}, [isVisible, position, translateValue, opacityValue]);
|
|
262
|
+
const animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => {
|
|
263
|
+
const transform = position === "left" || position === "right" ? [{ translateX: translateValue.value }] : [{ translateY: translateValue.value }];
|
|
264
|
+
return {
|
|
265
|
+
opacity: opacityValue.value,
|
|
266
|
+
transform
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
const isVertical = variantStyles.isVertical;
|
|
270
|
+
const shouldElevate = isElevated ?? variantStyles.isElevated;
|
|
271
|
+
const positionStyle = position === "top" ? styles.top : position === "bottom" ? styles.bottom : position === "left" ? styles.left : styles.right;
|
|
272
|
+
const floatingStyle = variant === "floating" ? [
|
|
273
|
+
styles.floating,
|
|
274
|
+
position === "bottom" && styles.floatingBottom,
|
|
275
|
+
position === "top" && styles.floatingTop
|
|
276
|
+
] : null;
|
|
277
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
278
|
+
ToolbarContext.Provider,
|
|
279
|
+
{
|
|
280
|
+
value: {
|
|
281
|
+
actionColor: colors2.action,
|
|
282
|
+
actionPressedColor: colors2.pressed,
|
|
283
|
+
iconSize: variantStyles.iconSize,
|
|
284
|
+
actionButtonSize: variantStyles.actionSize
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
288
|
+
import_react_native_reanimated.default.View,
|
|
289
|
+
{
|
|
290
|
+
style: [
|
|
291
|
+
styles.container,
|
|
292
|
+
positionStyle,
|
|
293
|
+
floatingStyle,
|
|
294
|
+
animatedStyle,
|
|
295
|
+
{
|
|
296
|
+
height: variantStyles.containerHeight,
|
|
297
|
+
width: variantStyles.containerWidth
|
|
298
|
+
},
|
|
299
|
+
style,
|
|
300
|
+
customAppearance?.container
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
304
|
+
import_react_native5.View,
|
|
305
|
+
{
|
|
306
|
+
style: [
|
|
307
|
+
isVertical ? styles.contentVertical : styles.content,
|
|
308
|
+
{
|
|
309
|
+
backgroundColor: colors2.background,
|
|
310
|
+
borderRadius: variantStyles.borderRadius,
|
|
311
|
+
paddingHorizontal: variantStyles.paddingHorizontal,
|
|
312
|
+
paddingVertical: variantStyles.paddingVertical,
|
|
313
|
+
borderBottomWidth: showDivider ? 1 : 0,
|
|
314
|
+
borderBottomColor: showDivider ? colors2.divider : "transparent",
|
|
315
|
+
height: "100%",
|
|
316
|
+
width: "100%"
|
|
317
|
+
},
|
|
318
|
+
shouldElevate && [styles.elevated, { shadowColor: colors2.shadow }],
|
|
319
|
+
customAppearance?.topRow
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
323
|
+
import_react_native5.View,
|
|
324
|
+
{
|
|
325
|
+
style: [
|
|
326
|
+
isVertical ? styles.actionsVertical : styles.actions,
|
|
327
|
+
{ gap: variantStyles.gap },
|
|
328
|
+
customAppearance?.actionsContainer
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
children
|
|
332
|
+
)
|
|
333
|
+
)
|
|
334
|
+
)
|
|
335
|
+
);
|
|
336
|
+
};
|
|
337
|
+
function getInitialTranslate(position) {
|
|
338
|
+
switch (position) {
|
|
339
|
+
case "top":
|
|
340
|
+
return -100;
|
|
341
|
+
case "bottom":
|
|
342
|
+
return 100;
|
|
343
|
+
case "left":
|
|
344
|
+
return -100;
|
|
345
|
+
case "right":
|
|
346
|
+
return 100;
|
|
347
|
+
default:
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// src/components/toolbar/toolbar-action.tsx
|
|
353
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
354
|
+
var import_react_native6 = require("react-native");
|
|
355
|
+
var ToolbarAction = ({
|
|
356
|
+
icon,
|
|
357
|
+
isDisabled = false,
|
|
358
|
+
style,
|
|
359
|
+
onPress,
|
|
360
|
+
onLongPress,
|
|
361
|
+
accessibilityLabel,
|
|
362
|
+
testID
|
|
363
|
+
}) => {
|
|
364
|
+
const context = useToolbarContext();
|
|
365
|
+
const iconNode = typeof icon === "function" ? icon({
|
|
366
|
+
color: context?.actionColor ?? "#000000",
|
|
367
|
+
size: context?.iconSize ?? 26
|
|
368
|
+
}) : icon;
|
|
369
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
370
|
+
import_react_native6.Pressable,
|
|
371
|
+
{
|
|
372
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
373
|
+
onLongPress: isDisabled ? void 0 : onLongPress,
|
|
374
|
+
accessibilityRole: "button",
|
|
375
|
+
accessibilityLabel,
|
|
376
|
+
testID,
|
|
377
|
+
style: ({ pressed }) => [
|
|
378
|
+
styles.actionButton,
|
|
379
|
+
{
|
|
380
|
+
width: context?.actionButtonSize ?? 40,
|
|
381
|
+
height: context?.actionButtonSize ?? 40,
|
|
382
|
+
backgroundColor: pressed ? context?.actionPressedColor ?? "transparent" : "transparent"
|
|
383
|
+
},
|
|
384
|
+
isDisabled && styles.disabledAction,
|
|
385
|
+
style
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
iconNode
|
|
389
|
+
);
|
|
390
|
+
};
|
|
391
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
392
|
+
0 && (module.exports = {
|
|
393
|
+
Toolbar,
|
|
394
|
+
ToolbarAction
|
|
395
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
4
|
+
|
|
5
|
+
type ToolbarVariant = 'floating' | 'docked' | 'vertical';
|
|
6
|
+
type ToolbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
7
|
+
type ToolbarActionRenderParams = {
|
|
8
|
+
color: string;
|
|
9
|
+
size: number;
|
|
10
|
+
};
|
|
11
|
+
type ToolbarActionProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Icon element or icon render function.
|
|
14
|
+
*/
|
|
15
|
+
icon: ReactNode | ((params: ToolbarActionRenderParams) => ReactNode);
|
|
16
|
+
/**
|
|
17
|
+
* Whether action is disabled.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Custom action style.
|
|
23
|
+
*/
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
/**
|
|
26
|
+
* Callback fired when action is pressed.
|
|
27
|
+
*/
|
|
28
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback fired when action is long-pressed.
|
|
31
|
+
*/
|
|
32
|
+
onLongPress?: (event: GestureResponderEvent) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Accessibility label for action.
|
|
35
|
+
*/
|
|
36
|
+
accessibilityLabel?: string;
|
|
37
|
+
/**
|
|
38
|
+
* testID for e2e tests.
|
|
39
|
+
*/
|
|
40
|
+
testID?: string;
|
|
41
|
+
};
|
|
42
|
+
type ToolbarCustomAppearance = {
|
|
43
|
+
container?: StyleProp<ViewStyle>;
|
|
44
|
+
topRow?: StyleProp<ViewStyle>;
|
|
45
|
+
actionsContainer?: StyleProp<ViewStyle>;
|
|
46
|
+
};
|
|
47
|
+
type ToolbarProps = {
|
|
48
|
+
/**
|
|
49
|
+
* Toolbar variant.
|
|
50
|
+
* - floating: rounded floating bar
|
|
51
|
+
* - docked: fixed bar without rounding
|
|
52
|
+
* - vertical: vertical bar (always centered)
|
|
53
|
+
* @default 'docked'
|
|
54
|
+
*/
|
|
55
|
+
variant?: ToolbarVariant;
|
|
56
|
+
/**
|
|
57
|
+
* Toolbar position.
|
|
58
|
+
* - For floating/docked: 'top' | 'bottom'
|
|
59
|
+
* - For vertical: 'left' | 'right'
|
|
60
|
+
* @default 'top'
|
|
61
|
+
*/
|
|
62
|
+
position?: ToolbarPosition;
|
|
63
|
+
/**
|
|
64
|
+
* Whether toolbar is visible (with animation).
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
isVisible?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Theme color used for accent and icon tint.
|
|
70
|
+
* @default 'primary'
|
|
71
|
+
*/
|
|
72
|
+
themeColor?: ThemeColor;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to render a divider.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
showDivider?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to show elevation shadow. If not provided, uses variant default.
|
|
80
|
+
*/
|
|
81
|
+
isElevated?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Toolbar action items.
|
|
84
|
+
*/
|
|
85
|
+
children?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Custom container style.
|
|
88
|
+
*/
|
|
89
|
+
style?: StyleProp<ViewStyle>;
|
|
90
|
+
/**
|
|
91
|
+
* Optional custom appearance styles.
|
|
92
|
+
*/
|
|
93
|
+
customAppearance?: ToolbarCustomAppearance;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
declare const Toolbar: React.FC<ToolbarProps>;
|
|
97
|
+
|
|
98
|
+
declare const ToolbarAction: React.FC<ToolbarActionProps>;
|
|
99
|
+
|
|
100
|
+
export { Toolbar, ToolbarAction, type ToolbarActionProps, type ToolbarActionRenderParams, type ToolbarCustomAppearance, type ToolbarPosition, type ToolbarProps, type ToolbarVariant };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
4
|
+
|
|
5
|
+
type ToolbarVariant = 'floating' | 'docked' | 'vertical';
|
|
6
|
+
type ToolbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
7
|
+
type ToolbarActionRenderParams = {
|
|
8
|
+
color: string;
|
|
9
|
+
size: number;
|
|
10
|
+
};
|
|
11
|
+
type ToolbarActionProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Icon element or icon render function.
|
|
14
|
+
*/
|
|
15
|
+
icon: ReactNode | ((params: ToolbarActionRenderParams) => ReactNode);
|
|
16
|
+
/**
|
|
17
|
+
* Whether action is disabled.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Custom action style.
|
|
23
|
+
*/
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
/**
|
|
26
|
+
* Callback fired when action is pressed.
|
|
27
|
+
*/
|
|
28
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback fired when action is long-pressed.
|
|
31
|
+
*/
|
|
32
|
+
onLongPress?: (event: GestureResponderEvent) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Accessibility label for action.
|
|
35
|
+
*/
|
|
36
|
+
accessibilityLabel?: string;
|
|
37
|
+
/**
|
|
38
|
+
* testID for e2e tests.
|
|
39
|
+
*/
|
|
40
|
+
testID?: string;
|
|
41
|
+
};
|
|
42
|
+
type ToolbarCustomAppearance = {
|
|
43
|
+
container?: StyleProp<ViewStyle>;
|
|
44
|
+
topRow?: StyleProp<ViewStyle>;
|
|
45
|
+
actionsContainer?: StyleProp<ViewStyle>;
|
|
46
|
+
};
|
|
47
|
+
type ToolbarProps = {
|
|
48
|
+
/**
|
|
49
|
+
* Toolbar variant.
|
|
50
|
+
* - floating: rounded floating bar
|
|
51
|
+
* - docked: fixed bar without rounding
|
|
52
|
+
* - vertical: vertical bar (always centered)
|
|
53
|
+
* @default 'docked'
|
|
54
|
+
*/
|
|
55
|
+
variant?: ToolbarVariant;
|
|
56
|
+
/**
|
|
57
|
+
* Toolbar position.
|
|
58
|
+
* - For floating/docked: 'top' | 'bottom'
|
|
59
|
+
* - For vertical: 'left' | 'right'
|
|
60
|
+
* @default 'top'
|
|
61
|
+
*/
|
|
62
|
+
position?: ToolbarPosition;
|
|
63
|
+
/**
|
|
64
|
+
* Whether toolbar is visible (with animation).
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
isVisible?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Theme color used for accent and icon tint.
|
|
70
|
+
* @default 'primary'
|
|
71
|
+
*/
|
|
72
|
+
themeColor?: ThemeColor;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to render a divider.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
showDivider?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to show elevation shadow. If not provided, uses variant default.
|
|
80
|
+
*/
|
|
81
|
+
isElevated?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Toolbar action items.
|
|
84
|
+
*/
|
|
85
|
+
children?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Custom container style.
|
|
88
|
+
*/
|
|
89
|
+
style?: StyleProp<ViewStyle>;
|
|
90
|
+
/**
|
|
91
|
+
* Optional custom appearance styles.
|
|
92
|
+
*/
|
|
93
|
+
customAppearance?: ToolbarCustomAppearance;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
declare const Toolbar: React.FC<ToolbarProps>;
|
|
97
|
+
|
|
98
|
+
declare const ToolbarAction: React.FC<ToolbarActionProps>;
|
|
99
|
+
|
|
100
|
+
export { Toolbar, ToolbarAction, type ToolbarActionProps, type ToolbarActionRenderParams, type ToolbarCustomAppearance, type ToolbarPosition, type ToolbarProps, type ToolbarVariant };
|