@xaui/native 0.0.26 → 0.0.28
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 +59 -127
- package/dist/menu/index.js +2 -2
- 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 +7 -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/timepicker/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
BottomSheet
|
|
3
|
+
} from "../chunk-HC2SSHNU.js";
|
|
4
|
+
import "../chunk-DXXNBF5P.js";
|
|
5
|
+
import {
|
|
3
6
|
useXUITheme
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-LTKYHG5V.js";
|
|
5
8
|
|
|
6
9
|
// src/components/timepicker/timepicker.tsx
|
|
7
10
|
import React, { useEffect, useMemo as useMemo2, useState as useState2 } from "react";
|
|
@@ -683,370 +686,8 @@ var TimePicker = ({
|
|
|
683
686
|
};
|
|
684
687
|
|
|
685
688
|
// src/components/timepicker/timepicker-dialog.tsx
|
|
686
|
-
import
|
|
687
|
-
import { View as
|
|
688
|
-
|
|
689
|
-
// src/components/bottom-sheet/bottom-sheet.tsx
|
|
690
|
-
import React2 from "react";
|
|
691
|
-
import { Animated as Animated4, Pressable as Pressable2, View as View2 } from "react-native";
|
|
692
|
-
|
|
693
|
-
// src/components/bottom-sheet/bottom-sheet.hook.ts
|
|
694
|
-
import { useCallback, useEffect as useEffect2, useMemo as useMemo3, useRef, useState as useState3 } from "react";
|
|
695
|
-
import { Animated as Animated3, Dimensions, PanResponder } from "react-native";
|
|
696
|
-
import { getSafeThemeColor as getSafeThemeColor2 } from "@xaui/core";
|
|
697
|
-
|
|
698
|
-
// src/components/bottom-sheet/bottom-sheet.animation.ts
|
|
699
|
-
import { Animated as Animated2, Easing as Easing2 } from "react-native";
|
|
700
|
-
var SPRING_CONFIG = {
|
|
701
|
-
useNativeDriver: true,
|
|
702
|
-
speed: 14,
|
|
703
|
-
bounciness: 4
|
|
704
|
-
};
|
|
705
|
-
var TIMING_CONFIG = {
|
|
706
|
-
duration: 280,
|
|
707
|
-
easing: Easing2.bezier(0.2, 0, 0, 1),
|
|
708
|
-
useNativeDriver: true
|
|
709
|
-
};
|
|
710
|
-
var runOpenAnimation = (translateY, backdropOpacity, targetTranslateY) => {
|
|
711
|
-
const animation = Animated2.parallel([
|
|
712
|
-
Animated2.spring(translateY, {
|
|
713
|
-
...SPRING_CONFIG,
|
|
714
|
-
toValue: targetTranslateY
|
|
715
|
-
}),
|
|
716
|
-
Animated2.timing(backdropOpacity, {
|
|
717
|
-
...TIMING_CONFIG,
|
|
718
|
-
toValue: 1
|
|
719
|
-
})
|
|
720
|
-
]);
|
|
721
|
-
animation.start();
|
|
722
|
-
return animation;
|
|
723
|
-
};
|
|
724
|
-
var runCloseAnimation = (translateY, backdropOpacity, screenHeight, onComplete) => {
|
|
725
|
-
const animation = Animated2.parallel([
|
|
726
|
-
Animated2.timing(translateY, {
|
|
727
|
-
...TIMING_CONFIG,
|
|
728
|
-
toValue: screenHeight
|
|
729
|
-
}),
|
|
730
|
-
Animated2.timing(backdropOpacity, {
|
|
731
|
-
...TIMING_CONFIG,
|
|
732
|
-
toValue: 0
|
|
733
|
-
})
|
|
734
|
-
]);
|
|
735
|
-
animation.start(({ finished }) => {
|
|
736
|
-
if (finished && onComplete) {
|
|
737
|
-
onComplete();
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
return animation;
|
|
741
|
-
};
|
|
742
|
-
var runSnapAnimation = (translateY, targetTranslateY) => {
|
|
743
|
-
const animation = Animated2.spring(translateY, {
|
|
744
|
-
...SPRING_CONFIG,
|
|
745
|
-
toValue: targetTranslateY
|
|
746
|
-
});
|
|
747
|
-
animation.start();
|
|
748
|
-
return animation;
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
// src/components/bottom-sheet/bottom-sheet.hook.ts
|
|
752
|
-
var DISMISS_VELOCITY_THRESHOLD = 0.5;
|
|
753
|
-
var DISMISS_DISTANCE_FRACTION = 0.3;
|
|
754
|
-
var SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
755
|
-
var getTranslateYForSnap = (snapFraction) => SCREEN_HEIGHT * (1 - snapFraction);
|
|
756
|
-
var useBottomSheetAnimation = ({
|
|
757
|
-
isOpen,
|
|
758
|
-
snapPoints,
|
|
759
|
-
initialSnapIndex,
|
|
760
|
-
enableSwipeToDismiss,
|
|
761
|
-
disableAnimation,
|
|
762
|
-
onClose,
|
|
763
|
-
onSnapChange
|
|
764
|
-
}) => {
|
|
765
|
-
const [shouldRender, setShouldRender] = useState3(false);
|
|
766
|
-
const currentSnapIndex = useRef(initialSnapIndex);
|
|
767
|
-
const animationRef = useRef(null);
|
|
768
|
-
const translateY = useRef(new Animated3.Value(SCREEN_HEIGHT)).current;
|
|
769
|
-
const backdropOpacity = useRef(new Animated3.Value(0)).current;
|
|
770
|
-
const sortedSnapPoints = useMemo3(
|
|
771
|
-
() => [...snapPoints].sort((a, b) => a - b),
|
|
772
|
-
[snapPoints]
|
|
773
|
-
);
|
|
774
|
-
const snapTranslateValues = useMemo3(
|
|
775
|
-
() => sortedSnapPoints.map(getTranslateYForSnap),
|
|
776
|
-
[sortedSnapPoints]
|
|
777
|
-
);
|
|
778
|
-
const open = useCallback(() => {
|
|
779
|
-
setShouldRender(true);
|
|
780
|
-
const targetIndex = Math.min(initialSnapIndex, sortedSnapPoints.length - 1);
|
|
781
|
-
currentSnapIndex.current = targetIndex;
|
|
782
|
-
if (disableAnimation) {
|
|
783
|
-
translateY.setValue(snapTranslateValues[targetIndex]);
|
|
784
|
-
backdropOpacity.setValue(1);
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
translateY.setValue(SCREEN_HEIGHT);
|
|
788
|
-
backdropOpacity.setValue(0);
|
|
789
|
-
animationRef.current?.stop();
|
|
790
|
-
animationRef.current = runOpenAnimation(
|
|
791
|
-
translateY,
|
|
792
|
-
backdropOpacity,
|
|
793
|
-
snapTranslateValues[targetIndex]
|
|
794
|
-
);
|
|
795
|
-
}, [
|
|
796
|
-
initialSnapIndex,
|
|
797
|
-
sortedSnapPoints,
|
|
798
|
-
snapTranslateValues,
|
|
799
|
-
disableAnimation,
|
|
800
|
-
translateY,
|
|
801
|
-
backdropOpacity
|
|
802
|
-
]);
|
|
803
|
-
const close = useCallback(() => {
|
|
804
|
-
if (disableAnimation) {
|
|
805
|
-
translateY.setValue(SCREEN_HEIGHT);
|
|
806
|
-
backdropOpacity.setValue(0);
|
|
807
|
-
setShouldRender(false);
|
|
808
|
-
onClose?.();
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
animationRef.current?.stop();
|
|
812
|
-
animationRef.current = runCloseAnimation(
|
|
813
|
-
translateY,
|
|
814
|
-
backdropOpacity,
|
|
815
|
-
SCREEN_HEIGHT,
|
|
816
|
-
() => {
|
|
817
|
-
setShouldRender(false);
|
|
818
|
-
onClose?.();
|
|
819
|
-
}
|
|
820
|
-
);
|
|
821
|
-
}, [disableAnimation, translateY, backdropOpacity, onClose]);
|
|
822
|
-
const snapTo = useCallback(
|
|
823
|
-
(index) => {
|
|
824
|
-
const clampedIndex = Math.max(0, Math.min(index, sortedSnapPoints.length - 1));
|
|
825
|
-
currentSnapIndex.current = clampedIndex;
|
|
826
|
-
onSnapChange?.(clampedIndex);
|
|
827
|
-
if (disableAnimation) {
|
|
828
|
-
translateY.setValue(snapTranslateValues[clampedIndex]);
|
|
829
|
-
return;
|
|
830
|
-
}
|
|
831
|
-
animationRef.current?.stop();
|
|
832
|
-
animationRef.current = runSnapAnimation(
|
|
833
|
-
translateY,
|
|
834
|
-
snapTranslateValues[clampedIndex]
|
|
835
|
-
);
|
|
836
|
-
},
|
|
837
|
-
[
|
|
838
|
-
sortedSnapPoints,
|
|
839
|
-
snapTranslateValues,
|
|
840
|
-
disableAnimation,
|
|
841
|
-
translateY,
|
|
842
|
-
onSnapChange
|
|
843
|
-
]
|
|
844
|
-
);
|
|
845
|
-
useEffect2(() => {
|
|
846
|
-
if (isOpen) {
|
|
847
|
-
open();
|
|
848
|
-
} else if (shouldRender) {
|
|
849
|
-
close();
|
|
850
|
-
}
|
|
851
|
-
}, [isOpen]);
|
|
852
|
-
const panResponder = useMemo3(
|
|
853
|
-
() => PanResponder.create({
|
|
854
|
-
onStartShouldSetPanResponder: () => true,
|
|
855
|
-
onMoveShouldSetPanResponder: (_, gestureState) => Math.abs(gestureState.dy) > 5,
|
|
856
|
-
onPanResponderMove: (_, gestureState) => {
|
|
857
|
-
const currentTranslate = snapTranslateValues[currentSnapIndex.current];
|
|
858
|
-
const newTranslateY = currentTranslate + gestureState.dy;
|
|
859
|
-
const maxExpanded = snapTranslateValues[snapTranslateValues.length - 1];
|
|
860
|
-
const clamped = Math.max(maxExpanded, newTranslateY);
|
|
861
|
-
translateY.setValue(clamped);
|
|
862
|
-
},
|
|
863
|
-
onPanResponderRelease: (_, gestureState) => {
|
|
864
|
-
const currentTranslate = snapTranslateValues[currentSnapIndex.current];
|
|
865
|
-
const finalPosition = currentTranslate + gestureState.dy;
|
|
866
|
-
if (enableSwipeToDismiss && (gestureState.vy > DISMISS_VELOCITY_THRESHOLD || finalPosition > SCREEN_HEIGHT * (1 - sortedSnapPoints[0] * DISMISS_DISTANCE_FRACTION))) {
|
|
867
|
-
close();
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
870
|
-
if (gestureState.vy < -DISMISS_VELOCITY_THRESHOLD) {
|
|
871
|
-
const nextIndex = Math.min(
|
|
872
|
-
currentSnapIndex.current + 1,
|
|
873
|
-
sortedSnapPoints.length - 1
|
|
874
|
-
);
|
|
875
|
-
snapTo(nextIndex);
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
if (gestureState.vy > DISMISS_VELOCITY_THRESHOLD) {
|
|
879
|
-
const prevIndex = Math.max(currentSnapIndex.current - 1, 0);
|
|
880
|
-
if (prevIndex === currentSnapIndex.current && enableSwipeToDismiss) {
|
|
881
|
-
close();
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
snapTo(prevIndex);
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
let closestIndex = 0;
|
|
888
|
-
let minDistance = Infinity;
|
|
889
|
-
snapTranslateValues.forEach((snapVal, index) => {
|
|
890
|
-
const distance = Math.abs(finalPosition - snapVal);
|
|
891
|
-
if (distance < minDistance) {
|
|
892
|
-
minDistance = distance;
|
|
893
|
-
closestIndex = index;
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
snapTo(closestIndex);
|
|
897
|
-
}
|
|
898
|
-
}),
|
|
899
|
-
[
|
|
900
|
-
snapTranslateValues,
|
|
901
|
-
sortedSnapPoints,
|
|
902
|
-
enableSwipeToDismiss,
|
|
903
|
-
translateY,
|
|
904
|
-
close,
|
|
905
|
-
snapTo
|
|
906
|
-
]
|
|
907
|
-
);
|
|
908
|
-
return {
|
|
909
|
-
shouldRender,
|
|
910
|
-
translateY,
|
|
911
|
-
backdropOpacity,
|
|
912
|
-
panResponder,
|
|
913
|
-
close,
|
|
914
|
-
snapTo,
|
|
915
|
-
screenHeight: SCREEN_HEIGHT
|
|
916
|
-
};
|
|
917
|
-
};
|
|
918
|
-
var useBottomSheetStyles = (themeColor, radius) => {
|
|
919
|
-
const theme = useXUITheme();
|
|
920
|
-
const safeThemeColor = getSafeThemeColor2(themeColor);
|
|
921
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
922
|
-
const sheetStyles = useMemo3(
|
|
923
|
-
() => ({
|
|
924
|
-
backgroundColor: colorScheme.background ?? theme.colors.background ?? "#ffffff",
|
|
925
|
-
borderTopLeftRadius: theme.borderRadius[radius],
|
|
926
|
-
borderTopRightRadius: theme.borderRadius[radius]
|
|
927
|
-
}),
|
|
928
|
-
[theme, colorScheme, radius]
|
|
929
|
-
);
|
|
930
|
-
const handleIndicatorColor = useMemo3(
|
|
931
|
-
() => theme.mode === "dark" ? `${colorScheme.main}60` : `${colorScheme.main}40`,
|
|
932
|
-
[theme, colorScheme]
|
|
933
|
-
);
|
|
934
|
-
return { sheetStyles, handleIndicatorColor };
|
|
935
|
-
};
|
|
936
|
-
|
|
937
|
-
// src/components/bottom-sheet/bottom-sheet.style.ts
|
|
938
|
-
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
939
|
-
var styles2 = StyleSheet2.create({
|
|
940
|
-
backdrop: {
|
|
941
|
-
position: "absolute",
|
|
942
|
-
top: 0,
|
|
943
|
-
left: 0,
|
|
944
|
-
right: 0,
|
|
945
|
-
bottom: 0,
|
|
946
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
947
|
-
},
|
|
948
|
-
container: {
|
|
949
|
-
position: "absolute",
|
|
950
|
-
left: 0,
|
|
951
|
-
right: 0,
|
|
952
|
-
bottom: 0
|
|
953
|
-
},
|
|
954
|
-
sheet: {
|
|
955
|
-
overflow: "hidden"
|
|
956
|
-
},
|
|
957
|
-
handle: {
|
|
958
|
-
alignItems: "center",
|
|
959
|
-
justifyContent: "center",
|
|
960
|
-
paddingVertical: 10
|
|
961
|
-
},
|
|
962
|
-
handleIndicator: {
|
|
963
|
-
width: 36,
|
|
964
|
-
height: 4,
|
|
965
|
-
borderRadius: 2
|
|
966
|
-
},
|
|
967
|
-
content: {
|
|
968
|
-
flex: 1
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
// src/components/bottom-sheet/bottom-sheet.tsx
|
|
973
|
-
var BottomSheet = ({
|
|
974
|
-
children,
|
|
975
|
-
isOpen,
|
|
976
|
-
snapPoints = [0.4, 0.9],
|
|
977
|
-
initialSnapIndex = 0,
|
|
978
|
-
themeColor = "default",
|
|
979
|
-
radius = "lg",
|
|
980
|
-
showBackdrop = true,
|
|
981
|
-
closeOnBackdropPress = true,
|
|
982
|
-
enableSwipeToDismiss = true,
|
|
983
|
-
showHandle = true,
|
|
984
|
-
disableAnimation = false,
|
|
985
|
-
style,
|
|
986
|
-
handleContent,
|
|
987
|
-
onClose,
|
|
988
|
-
onSnapChange
|
|
989
|
-
}) => {
|
|
990
|
-
const {
|
|
991
|
-
shouldRender,
|
|
992
|
-
translateY,
|
|
993
|
-
backdropOpacity,
|
|
994
|
-
panResponder,
|
|
995
|
-
close,
|
|
996
|
-
screenHeight
|
|
997
|
-
} = useBottomSheetAnimation({
|
|
998
|
-
isOpen,
|
|
999
|
-
snapPoints,
|
|
1000
|
-
initialSnapIndex,
|
|
1001
|
-
enableSwipeToDismiss,
|
|
1002
|
-
disableAnimation,
|
|
1003
|
-
onClose,
|
|
1004
|
-
onSnapChange
|
|
1005
|
-
});
|
|
1006
|
-
const { sheetStyles, handleIndicatorColor } = useBottomSheetStyles(
|
|
1007
|
-
themeColor,
|
|
1008
|
-
radius
|
|
1009
|
-
);
|
|
1010
|
-
if (!shouldRender) {
|
|
1011
|
-
return null;
|
|
1012
|
-
}
|
|
1013
|
-
const handleBackdropPress = () => {
|
|
1014
|
-
if (closeOnBackdropPress) {
|
|
1015
|
-
close();
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
return /* @__PURE__ */ React2.createElement(Portal, null, showBackdrop && /* @__PURE__ */ React2.createElement(Animated4.View, { style: [styles2.backdrop, { opacity: backdropOpacity }] }, /* @__PURE__ */ React2.createElement(Pressable2, { style: styles2.backdrop, onPress: handleBackdropPress })), /* @__PURE__ */ React2.createElement(
|
|
1019
|
-
Animated4.View,
|
|
1020
|
-
{
|
|
1021
|
-
style: [
|
|
1022
|
-
styles2.container,
|
|
1023
|
-
{
|
|
1024
|
-
height: screenHeight,
|
|
1025
|
-
transform: [{ translateY }]
|
|
1026
|
-
}
|
|
1027
|
-
]
|
|
1028
|
-
},
|
|
1029
|
-
/* @__PURE__ */ React2.createElement(
|
|
1030
|
-
View2,
|
|
1031
|
-
{
|
|
1032
|
-
style: [styles2.sheet, { height: screenHeight }, sheetStyles, style],
|
|
1033
|
-
...panResponder.panHandlers
|
|
1034
|
-
},
|
|
1035
|
-
showHandle && /* @__PURE__ */ React2.createElement(View2, { style: styles2.handle }, handleContent ?? /* @__PURE__ */ React2.createElement(
|
|
1036
|
-
View2,
|
|
1037
|
-
{
|
|
1038
|
-
style: [
|
|
1039
|
-
styles2.handleIndicator,
|
|
1040
|
-
{ backgroundColor: handleIndicatorColor }
|
|
1041
|
-
]
|
|
1042
|
-
}
|
|
1043
|
-
)),
|
|
1044
|
-
/* @__PURE__ */ React2.createElement(View2, { style: styles2.content }, children)
|
|
1045
|
-
)
|
|
1046
|
-
));
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
// src/components/timepicker/timepicker-dialog.tsx
|
|
689
|
+
import React2, { useState as useState3 } from "react";
|
|
690
|
+
import { View as View2, Text as Text2, Pressable as Pressable2 } from "react-native";
|
|
1050
691
|
var TimePickerDialog = ({
|
|
1051
692
|
isOpen,
|
|
1052
693
|
onClose,
|
|
@@ -1059,7 +700,7 @@ var TimePickerDialog = ({
|
|
|
1059
700
|
onConfirm,
|
|
1060
701
|
onCancel
|
|
1061
702
|
}) => {
|
|
1062
|
-
const [tempValue, setTempValue] =
|
|
703
|
+
const [tempValue, setTempValue] = useState3(value);
|
|
1063
704
|
const colors = useTimePickerColors(themeColor);
|
|
1064
705
|
const handleChange = (time) => {
|
|
1065
706
|
setTempValue(time);
|
|
@@ -1075,7 +716,7 @@ var TimePickerDialog = ({
|
|
|
1075
716
|
onCancel?.();
|
|
1076
717
|
onClose();
|
|
1077
718
|
};
|
|
1078
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ React2.createElement(BottomSheet, { isOpen, onClose, snapPoints: [0.7] }, /* @__PURE__ */ React2.createElement(View2, null, /* @__PURE__ */ React2.createElement(
|
|
1079
720
|
TimePicker,
|
|
1080
721
|
{
|
|
1081
722
|
value: tempValue,
|
|
@@ -1083,26 +724,26 @@ var TimePickerDialog = ({
|
|
|
1083
724
|
is24Hour,
|
|
1084
725
|
themeColor
|
|
1085
726
|
}
|
|
1086
|
-
), /* @__PURE__ */
|
|
1087
|
-
|
|
727
|
+
), /* @__PURE__ */ React2.createElement(View2, { style: styles.actions }, /* @__PURE__ */ React2.createElement(
|
|
728
|
+
Pressable2,
|
|
1088
729
|
{
|
|
1089
730
|
onPress: handleCancel,
|
|
1090
731
|
style: [styles.actionButton, { backgroundColor: "transparent" }]
|
|
1091
732
|
},
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
), /* @__PURE__ */
|
|
1094
|
-
|
|
733
|
+
/* @__PURE__ */ React2.createElement(Text2, { style: [styles.actionButtonText, { color: colors.primary }] }, cancelText)
|
|
734
|
+
), /* @__PURE__ */ React2.createElement(
|
|
735
|
+
Pressable2,
|
|
1095
736
|
{
|
|
1096
737
|
onPress: handleConfirm,
|
|
1097
738
|
style: [styles.actionButton, { backgroundColor: "transparent" }]
|
|
1098
739
|
},
|
|
1099
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ React2.createElement(Text2, { style: [styles.actionButtonText, { color: colors.primary }] }, confirmText)
|
|
1100
741
|
))));
|
|
1101
742
|
};
|
|
1102
743
|
|
|
1103
744
|
// src/components/timepicker/timepicker-trigger.tsx
|
|
1104
|
-
import
|
|
1105
|
-
import { Pressable as
|
|
745
|
+
import React3, { useMemo as useMemo3 } from "react";
|
|
746
|
+
import { Pressable as Pressable3, Text as Text3, TouchableOpacity, View as View3 } from "react-native";
|
|
1106
747
|
import { CloseIcon, TimeIcon } from "@xaui/icons";
|
|
1107
748
|
var TimePickerTrigger = ({
|
|
1108
749
|
value,
|
|
@@ -1121,7 +762,7 @@ var TimePickerTrigger = ({
|
|
|
1121
762
|
const theme = useXUITheme();
|
|
1122
763
|
const colors = useTimePickerColors(themeColor);
|
|
1123
764
|
const hasValue = Boolean(value);
|
|
1124
|
-
const displayValue =
|
|
765
|
+
const displayValue = useMemo3(() => {
|
|
1125
766
|
if (!value) return placeholder;
|
|
1126
767
|
return formatTimeValue(value, is24Hour);
|
|
1127
768
|
}, [value, placeholder, is24Hour]);
|
|
@@ -1133,8 +774,8 @@ var TimePickerTrigger = ({
|
|
|
1133
774
|
color: hasValue ? theme.colors.foreground : colors.textSecondary
|
|
1134
775
|
};
|
|
1135
776
|
const isBlocked = isDisabled || isReadOnly;
|
|
1136
|
-
return /* @__PURE__ */
|
|
1137
|
-
|
|
777
|
+
return /* @__PURE__ */ React3.createElement(
|
|
778
|
+
Pressable3,
|
|
1138
779
|
{
|
|
1139
780
|
onPress: isBlocked ? void 0 : onPress,
|
|
1140
781
|
disabled: isBlocked,
|
|
@@ -1142,7 +783,7 @@ var TimePickerTrigger = ({
|
|
|
1142
783
|
accessibilityRole: "button",
|
|
1143
784
|
accessibilityState: { disabled: isBlocked }
|
|
1144
785
|
},
|
|
1145
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ React3.createElement(View3, { style: styles.triggerContent }, /* @__PURE__ */ React3.createElement(
|
|
1146
787
|
Text3,
|
|
1147
788
|
{
|
|
1148
789
|
style: [styles.triggerText, triggerTextStyle, textStyle],
|
|
@@ -1151,15 +792,15 @@ var TimePickerTrigger = ({
|
|
|
1151
792
|
},
|
|
1152
793
|
displayValue
|
|
1153
794
|
)),
|
|
1154
|
-
isClearable && hasValue && !isBlocked ? /* @__PURE__ */
|
|
795
|
+
isClearable && hasValue && !isBlocked ? /* @__PURE__ */ React3.createElement(
|
|
1155
796
|
TouchableOpacity,
|
|
1156
797
|
{
|
|
1157
798
|
onPress: onClear,
|
|
1158
799
|
style: styles.clearButton,
|
|
1159
800
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
1160
801
|
},
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
) : icon ?? /* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ React3.createElement(CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
803
|
+
) : icon ?? /* @__PURE__ */ React3.createElement(TimeIcon, { color: theme.colors.foreground, size: 20 })
|
|
1163
804
|
);
|
|
1164
805
|
};
|
|
1165
806
|
export {
|