@xaui/native 0.0.12 → 0.0.13
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 +8 -1
- package/dist/accordion/index.cjs +7 -2
- package/dist/accordion/index.js +7 -2
- package/dist/alert/index.cjs +25 -188
- package/dist/alert/index.js +1 -2
- package/dist/autocomplete/index.cjs +106 -403
- package/dist/autocomplete/index.js +1 -3
- package/dist/button/index.cjs +126 -4
- package/dist/button/index.d.cts +63 -1
- package/dist/button/index.d.ts +63 -1
- package/dist/button/index.js +117 -3
- package/dist/checkbox/index.cjs +5 -1
- package/dist/checkbox/index.js +5 -1
- package/dist/{chunk-OFYJYQ2M.js → chunk-2T6FKPJW.js} +1 -3
- package/dist/{chunk-LM23DOX3.js → chunk-7OFTYKK4.js} +13 -33
- package/dist/{chunk-63LRW4QD.js → chunk-MKHBEJLO.js} +8 -1
- package/dist/{chunk-RL47NQAU.js → chunk-NMZUPH3R.js} +7 -12
- package/dist/datepicker/index.cjs +115 -836
- package/dist/datepicker/index.js +1 -3
- package/dist/index.cjs +362 -1170
- package/dist/index.js +4 -6
- package/dist/indicator/index.cjs +8 -1
- package/dist/indicator/index.js +1 -1
- package/dist/menu/index.cjs +371 -0
- package/dist/menu/index.d.cts +107 -0
- package/dist/menu/index.d.ts +107 -0
- package/dist/menu/index.js +304 -0
- package/dist/select/index.cjs +40 -16
- package/dist/select/index.js +40 -16
- package/dist/view/index.cjs +12 -7
- package/dist/view/index.js +12 -7
- package/package.json +7 -6
- package/dist/chunk-CKGZOJVV.js +0 -815
- package/dist/chunk-SIXET7TJ.js +0 -172
- package/dist/icon/index.cjs +0 -1054
- package/dist/icon/index.d.cts +0 -42
- package/dist/icon/index.d.ts +0 -42
- package/dist/icon/index.js +0 -21
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useXUITheme
|
|
3
|
+
} from "../chunk-NBRASCX4.js";
|
|
4
|
+
|
|
5
|
+
// src/components/menu/menu.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import {
|
|
8
|
+
Animated as Animated2,
|
|
9
|
+
Modal,
|
|
10
|
+
Pressable,
|
|
11
|
+
ScrollView,
|
|
12
|
+
View
|
|
13
|
+
} from "react-native";
|
|
14
|
+
|
|
15
|
+
// src/components/menu/menu.style.ts
|
|
16
|
+
import { StyleSheet } from "react-native";
|
|
17
|
+
var SCREEN_INDENT = 8;
|
|
18
|
+
var MENU_GAP = 4;
|
|
19
|
+
var styles = StyleSheet.create({
|
|
20
|
+
wrapper: {
|
|
21
|
+
position: "absolute"
|
|
22
|
+
},
|
|
23
|
+
overlay: {
|
|
24
|
+
...StyleSheet.absoluteFillObject
|
|
25
|
+
},
|
|
26
|
+
menuContainer: {
|
|
27
|
+
position: "absolute",
|
|
28
|
+
paddingVertical: 8,
|
|
29
|
+
minWidth: 200,
|
|
30
|
+
maxWidth: 320
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var MENU_SCREEN_INDENT = SCREEN_INDENT;
|
|
34
|
+
var MENU_TRIGGER_GAP = MENU_GAP;
|
|
35
|
+
|
|
36
|
+
// src/components/menu/menu.hook.ts
|
|
37
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
38
|
+
import { Animated, Dimensions, Easing } from "react-native";
|
|
39
|
+
var useMenuTriggerMeasurements = (visible) => {
|
|
40
|
+
const triggerRef = useRef(null);
|
|
41
|
+
const [triggerPosition, setTriggerPosition] = useState(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!visible) {
|
|
44
|
+
setTriggerPosition(null);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const measureTrigger = (attempt) => {
|
|
48
|
+
triggerRef.current?.measure((_, __, width, height, pageX, pageY) => {
|
|
49
|
+
if ((width <= 0 || height <= 0) && attempt < 5) {
|
|
50
|
+
globalThis.requestAnimationFrame(() => measureTrigger(attempt + 1));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setTriggerPosition({
|
|
54
|
+
x: pageX,
|
|
55
|
+
y: pageY,
|
|
56
|
+
width: Math.max(0, width),
|
|
57
|
+
height: Math.max(0, height)
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const frameId = globalThis.setTimeout(() => measureTrigger(0), 0);
|
|
62
|
+
return () => globalThis.clearTimeout(frameId);
|
|
63
|
+
}, [visible]);
|
|
64
|
+
return { triggerRef, triggerPosition };
|
|
65
|
+
};
|
|
66
|
+
var useMenuContentLayout = (visible) => {
|
|
67
|
+
const [contentSize, setContentSize] = useState({ width: 0, height: 0 });
|
|
68
|
+
const [isMeasured, setIsMeasured] = useState(false);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!visible) {
|
|
71
|
+
setIsMeasured(false);
|
|
72
|
+
}
|
|
73
|
+
}, [visible]);
|
|
74
|
+
const handleContentLayout = useCallback((event) => {
|
|
75
|
+
const { width, height } = event.nativeEvent.layout;
|
|
76
|
+
if (width > 0 && height > 0) {
|
|
77
|
+
setContentSize({ width, height });
|
|
78
|
+
setIsMeasured(true);
|
|
79
|
+
}
|
|
80
|
+
}, []);
|
|
81
|
+
return { contentSize, handleContentLayout, isMeasured };
|
|
82
|
+
};
|
|
83
|
+
var useMenuPosition = (triggerPosition, contentSize, position) => {
|
|
84
|
+
return useMemo(() => {
|
|
85
|
+
if (!triggerPosition) return { top: 0, left: 0 };
|
|
86
|
+
const screenWidth = Dimensions.get("window").width;
|
|
87
|
+
const screenHeight = Dimensions.get("window").height;
|
|
88
|
+
let top;
|
|
89
|
+
let left = triggerPosition.x;
|
|
90
|
+
const hasEnoughSpaceBelow = triggerPosition.y + triggerPosition.height + contentSize.height <= screenHeight - MENU_SCREEN_INDENT;
|
|
91
|
+
const hasEnoughSpaceAbove = triggerPosition.y - contentSize.height >= MENU_SCREEN_INDENT;
|
|
92
|
+
if (position === "bottom") {
|
|
93
|
+
if (hasEnoughSpaceBelow) {
|
|
94
|
+
top = triggerPosition.y + triggerPosition.height + MENU_TRIGGER_GAP;
|
|
95
|
+
} else if (hasEnoughSpaceAbove) {
|
|
96
|
+
top = triggerPosition.y - contentSize.height - MENU_TRIGGER_GAP;
|
|
97
|
+
} else {
|
|
98
|
+
top = triggerPosition.y + triggerPosition.height + MENU_TRIGGER_GAP;
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
if (hasEnoughSpaceAbove) {
|
|
102
|
+
top = triggerPosition.y - contentSize.height - MENU_TRIGGER_GAP;
|
|
103
|
+
} else if (hasEnoughSpaceBelow) {
|
|
104
|
+
top = triggerPosition.y + triggerPosition.height + MENU_TRIGGER_GAP;
|
|
105
|
+
} else {
|
|
106
|
+
top = triggerPosition.y - contentSize.height - MENU_TRIGGER_GAP;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (contentSize.width > 0 && left + contentSize.width > screenWidth - MENU_SCREEN_INDENT) {
|
|
110
|
+
left = Math.max(
|
|
111
|
+
MENU_SCREEN_INDENT,
|
|
112
|
+
triggerPosition.x + triggerPosition.width - contentSize.width
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (left < MENU_SCREEN_INDENT) {
|
|
116
|
+
left = MENU_SCREEN_INDENT;
|
|
117
|
+
}
|
|
118
|
+
const maxTop = Math.max(MENU_SCREEN_INDENT, screenHeight - MENU_SCREEN_INDENT - contentSize.height);
|
|
119
|
+
const clampedTop = Math.min(maxTop, Math.max(MENU_SCREEN_INDENT, top));
|
|
120
|
+
return { top: clampedTop, left };
|
|
121
|
+
}, [triggerPosition, contentSize, position]);
|
|
122
|
+
};
|
|
123
|
+
var useMenuAnimation = (visible) => {
|
|
124
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
125
|
+
const scale = useRef(new Animated.Value(0)).current;
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!visible) return;
|
|
128
|
+
opacity.setValue(0);
|
|
129
|
+
scale.setValue(0);
|
|
130
|
+
Animated.parallel([
|
|
131
|
+
Animated.timing(opacity, {
|
|
132
|
+
toValue: 1,
|
|
133
|
+
duration: 200,
|
|
134
|
+
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
135
|
+
useNativeDriver: true
|
|
136
|
+
}),
|
|
137
|
+
Animated.spring(scale, {
|
|
138
|
+
toValue: 1,
|
|
139
|
+
friction: 9,
|
|
140
|
+
tension: 100,
|
|
141
|
+
useNativeDriver: true
|
|
142
|
+
})
|
|
143
|
+
]).start();
|
|
144
|
+
}, [visible, opacity, scale]);
|
|
145
|
+
return { opacity, scale };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/components/menu/menu.tsx
|
|
149
|
+
var Menu = ({
|
|
150
|
+
visible,
|
|
151
|
+
trigger,
|
|
152
|
+
position = "bottom",
|
|
153
|
+
onDismiss,
|
|
154
|
+
children,
|
|
155
|
+
customAppearance,
|
|
156
|
+
maxHeight = 280
|
|
157
|
+
}) => {
|
|
158
|
+
const theme = useXUITheme();
|
|
159
|
+
const { triggerRef, triggerPosition } = useMenuTriggerMeasurements(visible);
|
|
160
|
+
const { contentSize, handleContentLayout, isMeasured } = useMenuContentLayout(visible);
|
|
161
|
+
const menuPosition = useMenuPosition(triggerPosition, contentSize, position);
|
|
162
|
+
const { opacity, scale } = useMenuAnimation(visible);
|
|
163
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, { ref: triggerRef, collapsable: false }, trigger), /* @__PURE__ */ React.createElement(
|
|
164
|
+
Modal,
|
|
165
|
+
{
|
|
166
|
+
visible,
|
|
167
|
+
transparent: true,
|
|
168
|
+
animationType: "fade",
|
|
169
|
+
onRequestClose: onDismiss
|
|
170
|
+
},
|
|
171
|
+
/* @__PURE__ */ React.createElement(
|
|
172
|
+
Pressable,
|
|
173
|
+
{
|
|
174
|
+
style: [styles.overlay, customAppearance?.overlay],
|
|
175
|
+
onPress: onDismiss,
|
|
176
|
+
accessibilityRole: "button",
|
|
177
|
+
accessibilityLabel: "Close menu"
|
|
178
|
+
},
|
|
179
|
+
/* @__PURE__ */ React.createElement(
|
|
180
|
+
Animated2.View,
|
|
181
|
+
{
|
|
182
|
+
onLayout: handleContentLayout,
|
|
183
|
+
style: [
|
|
184
|
+
styles.menuContainer,
|
|
185
|
+
{
|
|
186
|
+
top: isMeasured ? menuPosition.top : -9999,
|
|
187
|
+
left: isMeasured ? menuPosition.left : -9999,
|
|
188
|
+
backgroundColor: theme.colors.background,
|
|
189
|
+
borderRadius: theme.borderRadius.md,
|
|
190
|
+
opacity: isMeasured ? opacity : 0,
|
|
191
|
+
transform: [{ scale }],
|
|
192
|
+
...theme.shadows.md
|
|
193
|
+
},
|
|
194
|
+
customAppearance?.container
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ React.createElement(Pressable, { onPress: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement(View, { style: customAppearance?.content }, /* @__PURE__ */ React.createElement(ScrollView, { style: { maxHeight } }, children)))
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
));
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// src/components/menu/menu-item.tsx
|
|
204
|
+
import React2 from "react";
|
|
205
|
+
import { Pressable as Pressable2, Text, View as View2 } from "react-native";
|
|
206
|
+
|
|
207
|
+
// src/components/menu/menu-item.style.ts
|
|
208
|
+
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
209
|
+
var MIN_WIDTH = 112;
|
|
210
|
+
var MAX_WIDTH = 280;
|
|
211
|
+
var styles2 = StyleSheet2.create({
|
|
212
|
+
container: {
|
|
213
|
+
minWidth: MIN_WIDTH,
|
|
214
|
+
maxWidth: MAX_WIDTH,
|
|
215
|
+
height: 48,
|
|
216
|
+
justifyContent: "center",
|
|
217
|
+
paddingHorizontal: 12
|
|
218
|
+
},
|
|
219
|
+
denseContainer: {
|
|
220
|
+
height: 32
|
|
221
|
+
},
|
|
222
|
+
row: {
|
|
223
|
+
flexDirection: "row",
|
|
224
|
+
alignItems: "center"
|
|
225
|
+
},
|
|
226
|
+
content: {
|
|
227
|
+
flex: 1,
|
|
228
|
+
justifyContent: "center"
|
|
229
|
+
},
|
|
230
|
+
titleText: {
|
|
231
|
+
fontSize: 16
|
|
232
|
+
},
|
|
233
|
+
startContent: {
|
|
234
|
+
width: 24,
|
|
235
|
+
marginRight: 12,
|
|
236
|
+
alignItems: "center",
|
|
237
|
+
justifyContent: "center"
|
|
238
|
+
},
|
|
239
|
+
endContent: {
|
|
240
|
+
width: 24,
|
|
241
|
+
marginLeft: 12,
|
|
242
|
+
alignItems: "center",
|
|
243
|
+
justifyContent: "center"
|
|
244
|
+
},
|
|
245
|
+
disabled: {
|
|
246
|
+
opacity: 0.5
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// src/components/menu/menu-item.tsx
|
|
251
|
+
var MenuItem = ({
|
|
252
|
+
title,
|
|
253
|
+
startContent,
|
|
254
|
+
endContent,
|
|
255
|
+
isDisabled = false,
|
|
256
|
+
dense = false,
|
|
257
|
+
onPress,
|
|
258
|
+
customAppearance,
|
|
259
|
+
accessibilityLabel
|
|
260
|
+
}) => {
|
|
261
|
+
const theme = useXUITheme();
|
|
262
|
+
const titleColor = isDisabled ? theme.colors.foreground + "50" : theme.colors.foreground;
|
|
263
|
+
const renderTitle = () => {
|
|
264
|
+
if (typeof title === "string" || typeof title === "number") {
|
|
265
|
+
return /* @__PURE__ */ React2.createElement(
|
|
266
|
+
Text,
|
|
267
|
+
{
|
|
268
|
+
style: [
|
|
269
|
+
styles2.titleText,
|
|
270
|
+
{ color: titleColor },
|
|
271
|
+
customAppearance?.title
|
|
272
|
+
],
|
|
273
|
+
numberOfLines: 1
|
|
274
|
+
},
|
|
275
|
+
title
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
return title;
|
|
279
|
+
};
|
|
280
|
+
return /* @__PURE__ */ React2.createElement(
|
|
281
|
+
Pressable2,
|
|
282
|
+
{
|
|
283
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
284
|
+
disabled: isDisabled,
|
|
285
|
+
accessibilityRole: "menuitem",
|
|
286
|
+
accessibilityLabel,
|
|
287
|
+
accessibilityState: { disabled: isDisabled },
|
|
288
|
+
style: ({ pressed }) => [
|
|
289
|
+
styles2.container,
|
|
290
|
+
dense && styles2.denseContainer,
|
|
291
|
+
isDisabled && styles2.disabled,
|
|
292
|
+
pressed && !isDisabled && {
|
|
293
|
+
backgroundColor: theme.colors.foreground + "10"
|
|
294
|
+
},
|
|
295
|
+
customAppearance?.container
|
|
296
|
+
]
|
|
297
|
+
},
|
|
298
|
+
/* @__PURE__ */ React2.createElement(View2, { style: [styles2.row, customAppearance?.content] }, startContent && /* @__PURE__ */ React2.createElement(View2, { style: styles2.startContent }, startContent), /* @__PURE__ */ React2.createElement(View2, { style: styles2.content }, renderTitle()), endContent && /* @__PURE__ */ React2.createElement(View2, { style: styles2.endContent }, endContent))
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
export {
|
|
302
|
+
Menu,
|
|
303
|
+
MenuItem
|
|
304
|
+
};
|
package/dist/select/index.cjs
CHANGED
|
@@ -326,7 +326,11 @@ var import_react_native6 = require("react-native");
|
|
|
326
326
|
var import_react8 = __toESM(require("react"), 1);
|
|
327
327
|
var import_react_native5 = require("react-native");
|
|
328
328
|
var import_react_native_svg = __toESM(require("react-native-svg"), 1);
|
|
329
|
-
function ChevronDownIcon({
|
|
329
|
+
function ChevronDownIcon({
|
|
330
|
+
color,
|
|
331
|
+
size,
|
|
332
|
+
isOpen = false
|
|
333
|
+
}) {
|
|
330
334
|
const rotation = (0, import_react8.useRef)(new import_react_native5.Animated.Value(isOpen ? 1 : 0)).current;
|
|
331
335
|
(0, import_react8.useEffect)(() => {
|
|
332
336
|
import_react_native5.Animated.timing(rotation, {
|
|
@@ -399,17 +403,25 @@ var SelectTrigger = ({
|
|
|
399
403
|
style
|
|
400
404
|
]
|
|
401
405
|
},
|
|
402
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
403
|
-
import_react_native6.
|
|
406
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
407
|
+
import_react_native6.View,
|
|
404
408
|
{
|
|
405
|
-
style: [
|
|
406
|
-
styles.valueText,
|
|
407
|
-
{ fontSize: sizeStyles.fontSize, color: valueColor },
|
|
408
|
-
textStyle
|
|
409
|
-
]
|
|
409
|
+
style: [styles.triggerContent, labelInside && styles.triggerContentColumn]
|
|
410
410
|
},
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
startContent,
|
|
412
|
+
/* @__PURE__ */ import_react9.default.createElement(import_react_native6.View, { style: styles.valueWrapper }, labelInside && labelNode, /* @__PURE__ */ import_react9.default.createElement(
|
|
413
|
+
import_react_native6.Text,
|
|
414
|
+
{
|
|
415
|
+
style: [
|
|
416
|
+
styles.valueText,
|
|
417
|
+
{ fontSize: sizeStyles.fontSize, color: valueColor },
|
|
418
|
+
textStyle
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
displayValue
|
|
422
|
+
)),
|
|
423
|
+
endContent
|
|
424
|
+
),
|
|
413
425
|
/* @__PURE__ */ import_react9.default.createElement(import_react_native6.View, { style: styles.endSlot }, showClear && onClear && /* @__PURE__ */ import_react9.default.createElement(import_react_native6.Pressable, { onPress: onClear, style: styles.clearButton }, /* @__PURE__ */ import_react9.default.createElement(import_react_native6.Text, { style: [styles.clearText, { color: selectorColor }] }, "x")), renderSelectorIcon)
|
|
414
426
|
));
|
|
415
427
|
};
|
|
@@ -511,7 +523,9 @@ var useSelectSelection = ({
|
|
|
511
523
|
var useSelectTriggerMeasurements = (isOpen) => {
|
|
512
524
|
const triggerRef = (0, import_react11.useRef)(null);
|
|
513
525
|
const [triggerWidth, setTriggerWidth] = (0, import_react11.useState)(null);
|
|
514
|
-
const [triggerPosition, setTriggerPosition] = (0, import_react11.useState)(
|
|
526
|
+
const [triggerPosition, setTriggerPosition] = (0, import_react11.useState)(
|
|
527
|
+
null
|
|
528
|
+
);
|
|
515
529
|
const handleTriggerLayout = (0, import_react11.useCallback)((event) => {
|
|
516
530
|
setTriggerWidth(event.nativeEvent.layout.width);
|
|
517
531
|
}, []);
|
|
@@ -739,13 +753,23 @@ var Select = ({
|
|
|
739
753
|
}
|
|
740
754
|
]
|
|
741
755
|
},
|
|
742
|
-
/* @__PURE__ */ import_react12.default.createElement(
|
|
743
|
-
import_react_native8.
|
|
756
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
757
|
+
import_react_native8.Pressable,
|
|
744
758
|
{
|
|
745
|
-
|
|
759
|
+
onPress: (event) => event.stopPropagation(),
|
|
760
|
+
style: { flex: 1 }
|
|
746
761
|
},
|
|
747
|
-
dialogTitle
|
|
748
|
-
|
|
762
|
+
/* @__PURE__ */ import_react12.default.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ import_react12.default.createElement(import_react_native8.View, { style: styles.listboxContent }, dialogTitle ? /* @__PURE__ */ import_react12.default.createElement(
|
|
763
|
+
import_react_native8.Text,
|
|
764
|
+
{
|
|
765
|
+
style: [
|
|
766
|
+
styles.dialogTitle,
|
|
767
|
+
{ color: theme.colors.foreground }
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
dialogTitle
|
|
771
|
+
) : null, /* @__PURE__ */ import_react12.default.createElement(import_react_native8.ScrollView, { style: { maxHeight: maxListboxHeight } }, listItems)))
|
|
772
|
+
)
|
|
749
773
|
))
|
|
750
774
|
));
|
|
751
775
|
};
|
package/dist/select/index.js
CHANGED
|
@@ -267,7 +267,11 @@ import {
|
|
|
267
267
|
import React, { useEffect, useRef } from "react";
|
|
268
268
|
import { Animated } from "react-native";
|
|
269
269
|
import Svg, { Path } from "react-native-svg";
|
|
270
|
-
function ChevronDownIcon({
|
|
270
|
+
function ChevronDownIcon({
|
|
271
|
+
color,
|
|
272
|
+
size,
|
|
273
|
+
isOpen = false
|
|
274
|
+
}) {
|
|
271
275
|
const rotation = useRef(new Animated.Value(isOpen ? 1 : 0)).current;
|
|
272
276
|
useEffect(() => {
|
|
273
277
|
Animated.timing(rotation, {
|
|
@@ -340,17 +344,25 @@ var SelectTrigger = ({
|
|
|
340
344
|
style
|
|
341
345
|
]
|
|
342
346
|
},
|
|
343
|
-
/* @__PURE__ */ React2.createElement(
|
|
344
|
-
|
|
347
|
+
/* @__PURE__ */ React2.createElement(
|
|
348
|
+
View,
|
|
345
349
|
{
|
|
346
|
-
style: [
|
|
347
|
-
styles.valueText,
|
|
348
|
-
{ fontSize: sizeStyles.fontSize, color: valueColor },
|
|
349
|
-
textStyle
|
|
350
|
-
]
|
|
350
|
+
style: [styles.triggerContent, labelInside && styles.triggerContentColumn]
|
|
351
351
|
},
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
startContent,
|
|
353
|
+
/* @__PURE__ */ React2.createElement(View, { style: styles.valueWrapper }, labelInside && labelNode, /* @__PURE__ */ React2.createElement(
|
|
354
|
+
Text,
|
|
355
|
+
{
|
|
356
|
+
style: [
|
|
357
|
+
styles.valueText,
|
|
358
|
+
{ fontSize: sizeStyles.fontSize, color: valueColor },
|
|
359
|
+
textStyle
|
|
360
|
+
]
|
|
361
|
+
},
|
|
362
|
+
displayValue
|
|
363
|
+
)),
|
|
364
|
+
endContent
|
|
365
|
+
),
|
|
354
366
|
/* @__PURE__ */ React2.createElement(View, { style: styles.endSlot }, showClear && onClear && /* @__PURE__ */ React2.createElement(Pressable, { onPress: onClear, style: styles.clearButton }, /* @__PURE__ */ React2.createElement(Text, { style: [styles.clearText, { color: selectorColor }] }, "x")), renderSelectorIcon)
|
|
355
367
|
));
|
|
356
368
|
};
|
|
@@ -452,7 +464,9 @@ var useSelectSelection = ({
|
|
|
452
464
|
var useSelectTriggerMeasurements = (isOpen) => {
|
|
453
465
|
const triggerRef = useRef3(null);
|
|
454
466
|
const [triggerWidth, setTriggerWidth] = useState(null);
|
|
455
|
-
const [triggerPosition, setTriggerPosition] = useState(
|
|
467
|
+
const [triggerPosition, setTriggerPosition] = useState(
|
|
468
|
+
null
|
|
469
|
+
);
|
|
456
470
|
const handleTriggerLayout = useCallback((event) => {
|
|
457
471
|
setTriggerWidth(event.nativeEvent.layout.width);
|
|
458
472
|
}, []);
|
|
@@ -680,13 +694,23 @@ var Select = ({
|
|
|
680
694
|
}
|
|
681
695
|
]
|
|
682
696
|
},
|
|
683
|
-
/* @__PURE__ */ React3.createElement(
|
|
684
|
-
|
|
697
|
+
/* @__PURE__ */ React3.createElement(
|
|
698
|
+
Pressable2,
|
|
685
699
|
{
|
|
686
|
-
|
|
700
|
+
onPress: (event) => event.stopPropagation(),
|
|
701
|
+
style: { flex: 1 }
|
|
687
702
|
},
|
|
688
|
-
dialogTitle
|
|
689
|
-
|
|
703
|
+
/* @__PURE__ */ React3.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ React3.createElement(View2, { style: styles.listboxContent }, dialogTitle ? /* @__PURE__ */ React3.createElement(
|
|
704
|
+
Text2,
|
|
705
|
+
{
|
|
706
|
+
style: [
|
|
707
|
+
styles.dialogTitle,
|
|
708
|
+
{ color: theme.colors.foreground }
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
dialogTitle
|
|
712
|
+
) : null, /* @__PURE__ */ React3.createElement(ScrollView, { style: { maxHeight: maxListboxHeight } }, listItems)))
|
|
713
|
+
)
|
|
690
714
|
))
|
|
691
715
|
));
|
|
692
716
|
};
|
package/dist/view/index.cjs
CHANGED
|
@@ -309,7 +309,9 @@ var BlurView = ({
|
|
|
309
309
|
style
|
|
310
310
|
}) => {
|
|
311
311
|
const overlayOpacity = Math.min(1, Math.max(0, intensity));
|
|
312
|
-
const overlayAnim = (0, import_react8.useRef)(
|
|
312
|
+
const overlayAnim = (0, import_react8.useRef)(
|
|
313
|
+
new import_react_native8.Animated.Value(unlockable ? 0 : overlayOpacity)
|
|
314
|
+
).current;
|
|
313
315
|
const scaleAnim = (0, import_react8.useRef)(new import_react_native8.Animated.Value(unlockable ? 1 : 0.98)).current;
|
|
314
316
|
(0, import_react8.useEffect)(() => {
|
|
315
317
|
if (unlockable) {
|
|
@@ -499,11 +501,12 @@ var GridBuilder = ({
|
|
|
499
501
|
const paddedData = (0, import_react11.useMemo)(() => {
|
|
500
502
|
const remainder = resolvedData.length % safeColumns;
|
|
501
503
|
const placeholders = remainder === 0 ? 0 : safeColumns - remainder;
|
|
502
|
-
if (placeholders === 0)
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
if (placeholders === 0)
|
|
505
|
+
return resolvedData.map((item, index) => ({
|
|
506
|
+
type: "data",
|
|
507
|
+
item,
|
|
508
|
+
index
|
|
509
|
+
}));
|
|
507
510
|
return [
|
|
508
511
|
...resolvedData.map((item, index) => ({
|
|
509
512
|
type: "data",
|
|
@@ -688,7 +691,9 @@ var ConditionalView = ({
|
|
|
688
691
|
const initialValues = (0, import_react12.useMemo)(() => getInitialValues(animation), [animation]);
|
|
689
692
|
const exitValues = (0, import_react12.useMemo)(() => getExitValues(animation), [animation]);
|
|
690
693
|
const opacity = (0, import_react12.useRef)(
|
|
691
|
-
new import_react_native13.Animated.Value(
|
|
694
|
+
new import_react_native13.Animated.Value(
|
|
695
|
+
disableAnimation ? FINAL_VALUES.opacity : initialValues.opacity
|
|
696
|
+
)
|
|
692
697
|
).current;
|
|
693
698
|
const scale = (0, import_react12.useRef)(
|
|
694
699
|
new import_react_native13.Animated.Value(disableAnimation ? FINAL_VALUES.scale : initialValues.scale)
|
package/dist/view/index.js
CHANGED
|
@@ -259,7 +259,9 @@ var BlurView = ({
|
|
|
259
259
|
style
|
|
260
260
|
}) => {
|
|
261
261
|
const overlayOpacity = Math.min(1, Math.max(0, intensity));
|
|
262
|
-
const overlayAnim = useRef(
|
|
262
|
+
const overlayAnim = useRef(
|
|
263
|
+
new Animated.Value(unlockable ? 0 : overlayOpacity)
|
|
264
|
+
).current;
|
|
263
265
|
const scaleAnim = useRef(new Animated.Value(unlockable ? 1 : 0.98)).current;
|
|
264
266
|
useEffect(() => {
|
|
265
267
|
if (unlockable) {
|
|
@@ -455,11 +457,12 @@ var GridBuilder = ({
|
|
|
455
457
|
const paddedData = useMemo2(() => {
|
|
456
458
|
const remainder = resolvedData.length % safeColumns;
|
|
457
459
|
const placeholders = remainder === 0 ? 0 : safeColumns - remainder;
|
|
458
|
-
if (placeholders === 0)
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
if (placeholders === 0)
|
|
461
|
+
return resolvedData.map((item, index) => ({
|
|
462
|
+
type: "data",
|
|
463
|
+
item,
|
|
464
|
+
index
|
|
465
|
+
}));
|
|
463
466
|
return [
|
|
464
467
|
...resolvedData.map((item, index) => ({
|
|
465
468
|
type: "data",
|
|
@@ -644,7 +647,9 @@ var ConditionalView = ({
|
|
|
644
647
|
const initialValues = useMemo3(() => getInitialValues(animation), [animation]);
|
|
645
648
|
const exitValues = useMemo3(() => getExitValues(animation), [animation]);
|
|
646
649
|
const opacity = useRef2(
|
|
647
|
-
new Animated3.Value(
|
|
650
|
+
new Animated3.Value(
|
|
651
|
+
disableAnimation ? FINAL_VALUES.opacity : initialValues.opacity
|
|
652
|
+
)
|
|
648
653
|
).current;
|
|
649
654
|
const scale = useRef2(
|
|
650
655
|
new Animated3.Value(disableAnimation ? FINAL_VALUES.scale : initialValues.scale)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaui/native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Flutter-inspired React Native UI components with native animations powered by React Native Reanimated",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
"import": "./dist/view/index.js",
|
|
103
103
|
"require": "./dist/view/index.js"
|
|
104
104
|
},
|
|
105
|
-
"./
|
|
106
|
-
"types": "./dist/
|
|
107
|
-
"import": "./dist/
|
|
108
|
-
"require": "./dist/
|
|
105
|
+
"./menu": {
|
|
106
|
+
"types": "./dist/menu/index.d.ts",
|
|
107
|
+
"import": "./dist/menu/index.js",
|
|
108
|
+
"require": "./dist/menu/index.js"
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"files": [
|
|
@@ -118,7 +118,8 @@
|
|
|
118
118
|
"directory": "packages/native"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@xaui/core": "0.1.7"
|
|
121
|
+
"@xaui/core": "0.1.7",
|
|
122
|
+
"@xaui/icons": "0.0.2"
|
|
122
123
|
},
|
|
123
124
|
"peerDependencies": {
|
|
124
125
|
"react": "^18.0.0 || ^19.0.0",
|