@xaui/native 0.0.10 → 0.0.12
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/dist/autocomplete/index.cjs +151 -133
- package/dist/autocomplete/index.js +2 -2
- package/dist/avatar/index.cjs +355 -0
- package/dist/avatar/index.d.cts +123 -0
- package/dist/avatar/index.d.ts +123 -0
- package/dist/avatar/index.js +9 -0
- package/dist/badge/index.cjs +270 -0
- package/dist/badge/index.d.cts +94 -0
- package/dist/badge/index.d.ts +94 -0
- package/dist/badge/index.js +7 -0
- package/dist/button/index.cjs +4 -5
- package/dist/button/index.d.cts +17 -7
- package/dist/button/index.d.ts +17 -7
- package/dist/button/index.js +4 -5
- package/dist/chunk-4LFRYVSR.js +281 -0
- package/dist/{chunk-RE3CO277.js → chunk-CKGZOJVV.js} +423 -52
- package/dist/chunk-LM23DOX3.js +1647 -0
- package/dist/{chunk-SVYTCEGB.js → chunk-RL47NQAU.js} +1 -1
- package/dist/chunk-XJKA22BK.js +197 -0
- package/dist/datepicker/index.cjs +2429 -0
- package/dist/datepicker/index.d.cts +45 -0
- package/dist/datepicker/index.d.ts +45 -0
- package/dist/datepicker/index.js +9 -0
- package/dist/icon/index.cjs +439 -65
- package/dist/icon/index.d.cts +7 -1
- package/dist/icon/index.d.ts +7 -1
- package/dist/icon/index.js +8 -2
- package/dist/index.cjs +3367 -750
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +17 -3
- package/package.json +18 -1
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,10 @@ __export(src_exports, {
|
|
|
34
34
|
Alert: () => Alert,
|
|
35
35
|
Autocomplete: () => Autocomplete,
|
|
36
36
|
AutocompleteItem: () => AutocompleteItem,
|
|
37
|
+
Avatar: () => Avatar,
|
|
38
|
+
AvatarGroup: () => AvatarGroup,
|
|
39
|
+
Badge: () => Badge,
|
|
40
|
+
DatePicker: () => DatePicker,
|
|
37
41
|
Divider: () => Divider,
|
|
38
42
|
Typography: () => Typography
|
|
39
43
|
});
|
|
@@ -542,14 +546,477 @@ var Divider = ({
|
|
|
542
546
|
);
|
|
543
547
|
};
|
|
544
548
|
|
|
545
|
-
// src/components/
|
|
546
|
-
var
|
|
549
|
+
// src/components/avatar/avatar.tsx
|
|
550
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
551
|
+
var import_react_native11 = require("react-native");
|
|
552
|
+
|
|
553
|
+
// src/components/avatar/avatar.style.ts
|
|
554
|
+
var import_react_native10 = require("react-native");
|
|
555
|
+
var styles3 = import_react_native10.StyleSheet.create({
|
|
556
|
+
container: {
|
|
557
|
+
overflow: "hidden",
|
|
558
|
+
alignItems: "center",
|
|
559
|
+
justifyContent: "center"
|
|
560
|
+
},
|
|
561
|
+
image: {
|
|
562
|
+
width: "100%",
|
|
563
|
+
height: "100%"
|
|
564
|
+
},
|
|
565
|
+
fallback: {
|
|
566
|
+
alignItems: "center",
|
|
567
|
+
justifyContent: "center"
|
|
568
|
+
},
|
|
569
|
+
group: {
|
|
570
|
+
flexDirection: "row",
|
|
571
|
+
alignItems: "center"
|
|
572
|
+
},
|
|
573
|
+
grid: {
|
|
574
|
+
flexDirection: "row",
|
|
575
|
+
flexWrap: "wrap",
|
|
576
|
+
alignItems: "flex-start"
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// src/components/avatar/avatar.hook.ts
|
|
581
|
+
var import_react12 = require("react");
|
|
582
|
+
var import_core7 = require("@xaui/core");
|
|
583
|
+
var sizeMap = {
|
|
584
|
+
xs: 24,
|
|
585
|
+
sm: 32,
|
|
586
|
+
md: 40,
|
|
587
|
+
lg: 48
|
|
588
|
+
};
|
|
589
|
+
function resolveAvatarSize(size) {
|
|
590
|
+
if (typeof size === "number") {
|
|
591
|
+
return size;
|
|
592
|
+
}
|
|
593
|
+
return sizeMap[size];
|
|
594
|
+
}
|
|
595
|
+
function useAvatarSizeStyles(size) {
|
|
596
|
+
const theme = useXUITheme();
|
|
597
|
+
const resolvedSize = (0, import_react12.useMemo)(() => resolveAvatarSize(size), [size]);
|
|
598
|
+
const fontSize = (0, import_react12.useMemo)(() => {
|
|
599
|
+
if (typeof size === "number") {
|
|
600
|
+
return Math.max(10, Math.round(size * 0.4));
|
|
601
|
+
}
|
|
602
|
+
return theme.fontSizes[size];
|
|
603
|
+
}, [size, theme]);
|
|
604
|
+
return {
|
|
605
|
+
size: resolvedSize,
|
|
606
|
+
fontSize
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
function useAvatarRadiusStyles(radius, size) {
|
|
610
|
+
const theme = useXUITheme();
|
|
611
|
+
return (0, import_react12.useMemo)(() => {
|
|
612
|
+
if (radius === "full") {
|
|
613
|
+
return { borderRadius: size / 2 };
|
|
614
|
+
}
|
|
615
|
+
const radii = {
|
|
616
|
+
none: theme.borderRadius.none,
|
|
617
|
+
sm: theme.borderRadius.sm,
|
|
618
|
+
md: theme.borderRadius.md,
|
|
619
|
+
lg: theme.borderRadius.lg,
|
|
620
|
+
full: theme.borderRadius.full
|
|
621
|
+
};
|
|
622
|
+
return { borderRadius: radii[radius] };
|
|
623
|
+
}, [radius, size, theme]);
|
|
624
|
+
}
|
|
625
|
+
function useAvatarColors(themeColor, isDisabled) {
|
|
626
|
+
const theme = useXUITheme();
|
|
627
|
+
const safeThemeColor = (0, import_core7.getSafeThemeColor)(themeColor);
|
|
628
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
629
|
+
const backgroundColor = (0, import_react12.useMemo)(() => {
|
|
630
|
+
if (isDisabled) {
|
|
631
|
+
return theme.colors.background;
|
|
632
|
+
}
|
|
633
|
+
return colorScheme.background;
|
|
634
|
+
}, [colorScheme.background, isDisabled, theme.colors.background]);
|
|
635
|
+
const textColor = (0, import_react12.useMemo)(() => {
|
|
636
|
+
if (safeThemeColor === "default") {
|
|
637
|
+
return theme.colors.foreground;
|
|
638
|
+
}
|
|
639
|
+
return colorScheme.main;
|
|
640
|
+
}, [safeThemeColor, colorScheme.main, theme.colors.foreground]);
|
|
641
|
+
return {
|
|
642
|
+
backgroundColor,
|
|
643
|
+
textColor,
|
|
644
|
+
borderColor: colorScheme.main
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function getDefaultInitials(name) {
|
|
648
|
+
const trimmed = name.trim();
|
|
649
|
+
if (!trimmed) {
|
|
650
|
+
return "";
|
|
651
|
+
}
|
|
652
|
+
const parts = trimmed.split(/\s+/);
|
|
653
|
+
if (parts.length === 1) {
|
|
654
|
+
return parts[0].slice(0, 2).toUpperCase();
|
|
655
|
+
}
|
|
656
|
+
return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// src/components/avatar/avatar.tsx
|
|
660
|
+
var Avatar = ({
|
|
661
|
+
src,
|
|
662
|
+
name,
|
|
663
|
+
icon,
|
|
664
|
+
fallback,
|
|
665
|
+
size = "md",
|
|
666
|
+
radius = "full",
|
|
667
|
+
themeColor = "default",
|
|
668
|
+
isBordered = false,
|
|
669
|
+
isDisabled = false,
|
|
670
|
+
showFallback = false,
|
|
671
|
+
getInitials,
|
|
672
|
+
customAppearance
|
|
673
|
+
}) => {
|
|
674
|
+
const [isError, setIsError] = import_react13.default.useState(false);
|
|
675
|
+
const { size: resolvedSize, fontSize } = useAvatarSizeStyles(size);
|
|
676
|
+
const radiusStyles = useAvatarRadiusStyles(radius, resolvedSize);
|
|
677
|
+
const { backgroundColor, textColor, borderColor } = useAvatarColors(
|
|
678
|
+
themeColor,
|
|
679
|
+
isDisabled
|
|
680
|
+
);
|
|
681
|
+
const accessibilityLabel = name ?? "Avatar";
|
|
682
|
+
const shouldShowFallback = showFallback || !src || isError;
|
|
683
|
+
const initials = name ? (getInitials ?? getDefaultInitials)(name) : "";
|
|
684
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
685
|
+
import_react_native11.View,
|
|
686
|
+
{
|
|
687
|
+
style: [
|
|
688
|
+
styles3.container,
|
|
689
|
+
{
|
|
690
|
+
width: resolvedSize,
|
|
691
|
+
height: resolvedSize,
|
|
692
|
+
backgroundColor,
|
|
693
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
694
|
+
borderWidth: isBordered ? 1 : 0,
|
|
695
|
+
borderColor: isBordered ? borderColor : "transparent"
|
|
696
|
+
},
|
|
697
|
+
radiusStyles,
|
|
698
|
+
customAppearance?.container
|
|
699
|
+
],
|
|
700
|
+
accessible: true,
|
|
701
|
+
accessibilityRole: "image",
|
|
702
|
+
accessibilityLabel
|
|
703
|
+
},
|
|
704
|
+
!shouldShowFallback && src ? /* @__PURE__ */ import_react13.default.createElement(
|
|
705
|
+
import_react_native11.Image,
|
|
706
|
+
{
|
|
707
|
+
source: { uri: src },
|
|
708
|
+
style: [styles3.image, radiusStyles, customAppearance?.image],
|
|
709
|
+
accessibilityLabel,
|
|
710
|
+
onError: () => setIsError(true)
|
|
711
|
+
}
|
|
712
|
+
) : /* @__PURE__ */ import_react13.default.createElement(import_react_native11.View, { style: [styles3.fallback, { width: "100%", height: "100%" }] }, fallback ?? icon ?? /* @__PURE__ */ import_react13.default.createElement(
|
|
713
|
+
import_react_native11.Text,
|
|
714
|
+
{
|
|
715
|
+
style: [
|
|
716
|
+
{
|
|
717
|
+
color: textColor,
|
|
718
|
+
fontSize,
|
|
719
|
+
fontWeight: "600"
|
|
720
|
+
},
|
|
721
|
+
customAppearance?.text
|
|
722
|
+
]
|
|
723
|
+
},
|
|
724
|
+
initials
|
|
725
|
+
))
|
|
726
|
+
);
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
// src/components/avatar/avatar-group.tsx
|
|
730
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
547
731
|
var import_react_native12 = require("react-native");
|
|
732
|
+
var AvatarGroup = ({
|
|
733
|
+
children,
|
|
734
|
+
max,
|
|
735
|
+
total,
|
|
736
|
+
size = "md",
|
|
737
|
+
radius = "full",
|
|
738
|
+
themeColor = "default",
|
|
739
|
+
isBordered = false,
|
|
740
|
+
isDisabled = false,
|
|
741
|
+
isGrid = false,
|
|
742
|
+
renderCount,
|
|
743
|
+
customAppearance
|
|
744
|
+
}) => {
|
|
745
|
+
const theme = useXUITheme();
|
|
746
|
+
const resolvedSize = resolveAvatarSize(size);
|
|
747
|
+
const spacing = theme.spacing.xs;
|
|
748
|
+
const overlap = Math.round(resolvedSize * 0.28);
|
|
749
|
+
const allChildren = import_react14.default.Children.toArray(children).filter(
|
|
750
|
+
(child) => import_react14.default.isValidElement(child)
|
|
751
|
+
);
|
|
752
|
+
const totalCount = total ?? allChildren.length;
|
|
753
|
+
const maxCount = max ?? totalCount;
|
|
754
|
+
const visibleChildren = allChildren.slice(0, maxCount);
|
|
755
|
+
const remaining = Math.max(0, totalCount - maxCount);
|
|
756
|
+
const enhanced = visibleChildren.map((child, index) => {
|
|
757
|
+
const childProps = child.props;
|
|
758
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
759
|
+
import_react_native12.View,
|
|
760
|
+
{
|
|
761
|
+
key: child.key ?? index,
|
|
762
|
+
style: isGrid ? { marginRight: spacing, marginBottom: spacing } : { marginLeft: index === 0 ? 0 : -overlap, zIndex: index }
|
|
763
|
+
},
|
|
764
|
+
import_react14.default.cloneElement(child, {
|
|
765
|
+
size: childProps.size ?? size,
|
|
766
|
+
radius: childProps.radius ?? radius,
|
|
767
|
+
themeColor: childProps.themeColor ?? themeColor,
|
|
768
|
+
isBordered: childProps.isBordered ?? isBordered,
|
|
769
|
+
isDisabled: childProps.isDisabled ?? isDisabled
|
|
770
|
+
})
|
|
771
|
+
);
|
|
772
|
+
});
|
|
773
|
+
const countNode = remaining > 0 ? renderCount?.(remaining) ?? /* @__PURE__ */ import_react14.default.createElement(
|
|
774
|
+
Avatar,
|
|
775
|
+
{
|
|
776
|
+
name: `+${remaining}`,
|
|
777
|
+
showFallback: true,
|
|
778
|
+
size,
|
|
779
|
+
radius,
|
|
780
|
+
themeColor,
|
|
781
|
+
isBordered,
|
|
782
|
+
isDisabled,
|
|
783
|
+
fallback: /* @__PURE__ */ import_react14.default.createElement(
|
|
784
|
+
import_react_native12.Text,
|
|
785
|
+
{
|
|
786
|
+
style: {
|
|
787
|
+
color: theme.colors.foreground,
|
|
788
|
+
fontSize: Math.max(10, Math.round(resolvedSize * 0.35)),
|
|
789
|
+
fontWeight: "600"
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
"+",
|
|
793
|
+
remaining
|
|
794
|
+
)
|
|
795
|
+
}
|
|
796
|
+
) : null;
|
|
797
|
+
if (countNode) {
|
|
798
|
+
enhanced.push(
|
|
799
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
800
|
+
import_react_native12.View,
|
|
801
|
+
{
|
|
802
|
+
key: "avatar-count",
|
|
803
|
+
style: isGrid ? { marginRight: spacing, marginBottom: spacing } : {
|
|
804
|
+
marginLeft: enhanced.length === 0 ? 0 : -overlap,
|
|
805
|
+
zIndex: enhanced.length
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
countNode
|
|
809
|
+
)
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
813
|
+
import_react_native12.View,
|
|
814
|
+
{
|
|
815
|
+
style: [isGrid ? styles3.grid : styles3.group, customAppearance?.container],
|
|
816
|
+
accessible: true
|
|
817
|
+
},
|
|
818
|
+
enhanced
|
|
819
|
+
);
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
// src/components/badge/badge.tsx
|
|
823
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
824
|
+
var import_react_native14 = require("react-native");
|
|
825
|
+
|
|
826
|
+
// src/components/badge/badge.style.ts
|
|
827
|
+
var import_react_native13 = require("react-native");
|
|
828
|
+
var styles4 = import_react_native13.StyleSheet.create({
|
|
829
|
+
container: {
|
|
830
|
+
position: "relative",
|
|
831
|
+
alignSelf: "flex-start"
|
|
832
|
+
},
|
|
833
|
+
badge: {
|
|
834
|
+
position: "absolute",
|
|
835
|
+
alignItems: "center",
|
|
836
|
+
justifyContent: "center"
|
|
837
|
+
},
|
|
838
|
+
text: {
|
|
839
|
+
textAlign: "center",
|
|
840
|
+
fontWeight: "600",
|
|
841
|
+
includeFontPadding: false,
|
|
842
|
+
textAlignVertical: "center"
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// src/components/badge/badge.hook.ts
|
|
847
|
+
var import_react15 = require("react");
|
|
848
|
+
var import_core10 = require("@xaui/core");
|
|
849
|
+
var sizeMap2 = {
|
|
850
|
+
sm: { height: 16, minWidth: 16, dot: 8 },
|
|
851
|
+
md: { height: 20, minWidth: 20, dot: 10 },
|
|
852
|
+
lg: { height: 24, minWidth: 24, dot: 12 }
|
|
853
|
+
};
|
|
854
|
+
var fontSizeMap = {
|
|
855
|
+
sm: 9,
|
|
856
|
+
md: 10,
|
|
857
|
+
lg: 12
|
|
858
|
+
};
|
|
859
|
+
function useBadgeSizeStyles(size, isDot, isOneChar) {
|
|
860
|
+
const theme = useXUITheme();
|
|
861
|
+
return (0, import_react15.useMemo)(() => {
|
|
862
|
+
const { height, minWidth, dot } = sizeMap2[size];
|
|
863
|
+
const fontSize = fontSizeMap[size];
|
|
864
|
+
if (isDot) {
|
|
865
|
+
return {
|
|
866
|
+
height: dot,
|
|
867
|
+
minWidth: dot,
|
|
868
|
+
paddingHorizontal: 0,
|
|
869
|
+
fontSize
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
if (isOneChar) {
|
|
873
|
+
return {
|
|
874
|
+
height,
|
|
875
|
+
minWidth: height,
|
|
876
|
+
paddingHorizontal: 0,
|
|
877
|
+
fontSize
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
const paddingHorizontal = size === "sm" ? theme.spacing.xs : theme.spacing.sm;
|
|
881
|
+
return {
|
|
882
|
+
height,
|
|
883
|
+
minWidth,
|
|
884
|
+
paddingHorizontal,
|
|
885
|
+
fontSize
|
|
886
|
+
};
|
|
887
|
+
}, [isDot, isOneChar, size, theme]);
|
|
888
|
+
}
|
|
889
|
+
function useBadgeVariantStyles(themeColor, variant) {
|
|
890
|
+
const theme = useXUITheme();
|
|
891
|
+
const safeThemeColor = (0, import_core10.getSafeThemeColor)(themeColor);
|
|
892
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
893
|
+
return (0, import_react15.useMemo)(() => {
|
|
894
|
+
if (variant === "flat") {
|
|
895
|
+
return {
|
|
896
|
+
backgroundColor: colorScheme.background,
|
|
897
|
+
color: colorScheme.main
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
if (variant === "faded") {
|
|
901
|
+
return {
|
|
902
|
+
backgroundColor: (0, import_core10.withOpacity)(colorScheme.background, 0.7),
|
|
903
|
+
color: colorScheme.main
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
if (variant === "shadow") {
|
|
907
|
+
return {
|
|
908
|
+
backgroundColor: colorScheme.main,
|
|
909
|
+
color: colorScheme.foreground,
|
|
910
|
+
shadow: theme.shadows.sm
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
backgroundColor: colorScheme.main,
|
|
915
|
+
color: colorScheme.foreground
|
|
916
|
+
};
|
|
917
|
+
}, [colorScheme, theme, variant]);
|
|
918
|
+
}
|
|
919
|
+
function useBadgeRadiusStyles(radius, height) {
|
|
920
|
+
const theme = useXUITheme();
|
|
921
|
+
return (0, import_react15.useMemo)(() => {
|
|
922
|
+
if (radius === "full") {
|
|
923
|
+
return { borderRadius: height / 2 };
|
|
924
|
+
}
|
|
925
|
+
return { borderRadius: theme.borderRadius[radius] };
|
|
926
|
+
}, [height, radius, theme.borderRadius]);
|
|
927
|
+
}
|
|
928
|
+
function useBadgePlacementStyles(placement, height) {
|
|
929
|
+
return (0, import_react15.useMemo)(() => {
|
|
930
|
+
const offset = Math.round(height * 0.3);
|
|
931
|
+
switch (placement) {
|
|
932
|
+
case "top-left":
|
|
933
|
+
return { top: -offset, left: -offset };
|
|
934
|
+
case "bottom-right":
|
|
935
|
+
return { bottom: -offset, right: -offset };
|
|
936
|
+
case "bottom-left":
|
|
937
|
+
return { bottom: -offset, left: -offset };
|
|
938
|
+
case "top-right":
|
|
939
|
+
default:
|
|
940
|
+
return { top: -offset, right: -offset };
|
|
941
|
+
}
|
|
942
|
+
}, [height, placement]);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// src/components/badge/badge.tsx
|
|
946
|
+
var Badge = ({
|
|
947
|
+
children,
|
|
948
|
+
content,
|
|
949
|
+
themeColor = "primary",
|
|
950
|
+
variant = "solid",
|
|
951
|
+
size = "md",
|
|
952
|
+
radius = "full",
|
|
953
|
+
placement = "top-right",
|
|
954
|
+
showOutline = true,
|
|
955
|
+
disableOutline = false,
|
|
956
|
+
isInvisible = false,
|
|
957
|
+
isDot = false,
|
|
958
|
+
isOneChar = false,
|
|
959
|
+
disableAnimation = false,
|
|
960
|
+
customAppearance
|
|
961
|
+
}) => {
|
|
962
|
+
const shouldRender = !isInvisible && (isDot || content !== void 0);
|
|
963
|
+
if (!shouldRender && !children) {
|
|
964
|
+
return null;
|
|
965
|
+
}
|
|
966
|
+
const forceOneChar = isOneChar || radius === "full";
|
|
967
|
+
const sizeStyles = useBadgeSizeStyles(size, isDot, forceOneChar);
|
|
968
|
+
const variantStyles = useBadgeVariantStyles(themeColor, variant);
|
|
969
|
+
const radiusStyles = useBadgeRadiusStyles(radius, sizeStyles.height);
|
|
970
|
+
const placementStyles = useBadgePlacementStyles(placement, sizeStyles.height);
|
|
971
|
+
const outlineEnabled = disableOutline ? false : showOutline;
|
|
972
|
+
const outlineStyles = outlineEnabled ? { borderWidth: 1, borderColor: "#FFFFFF" } : { borderWidth: 0, borderColor: "transparent" };
|
|
973
|
+
const badgeContent = isDot ? null : content;
|
|
974
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react_native14.View, { style: [styles4.container, customAppearance?.container] }, children, shouldRender && /* @__PURE__ */ import_react16.default.createElement(
|
|
975
|
+
import_react_native14.View,
|
|
976
|
+
{
|
|
977
|
+
style: [
|
|
978
|
+
styles4.badge,
|
|
979
|
+
{
|
|
980
|
+
minWidth: sizeStyles.minWidth,
|
|
981
|
+
height: sizeStyles.height,
|
|
982
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
983
|
+
backgroundColor: variantStyles.backgroundColor,
|
|
984
|
+
opacity: disableAnimation ? 1 : 1
|
|
985
|
+
},
|
|
986
|
+
radiusStyles,
|
|
987
|
+
placementStyles,
|
|
988
|
+
outlineStyles,
|
|
989
|
+
variantStyles.shadow,
|
|
990
|
+
customAppearance?.badge
|
|
991
|
+
],
|
|
992
|
+
accessible: true,
|
|
993
|
+
accessibilityRole: "text"
|
|
994
|
+
},
|
|
995
|
+
badgeContent !== void 0 && badgeContent !== null && /* @__PURE__ */ import_react16.default.createElement(
|
|
996
|
+
import_react_native14.Text,
|
|
997
|
+
{
|
|
998
|
+
style: [
|
|
999
|
+
styles4.text,
|
|
1000
|
+
{
|
|
1001
|
+
fontSize: sizeStyles.fontSize,
|
|
1002
|
+
color: variantStyles.color
|
|
1003
|
+
},
|
|
1004
|
+
customAppearance?.text
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
badgeContent
|
|
1008
|
+
)
|
|
1009
|
+
));
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
// src/components/alert/alert.tsx
|
|
1013
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
1014
|
+
var import_react_native17 = require("react-native");
|
|
548
1015
|
var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"), 1);
|
|
549
1016
|
|
|
550
1017
|
// src/components/alert/alert.style.ts
|
|
551
|
-
var
|
|
552
|
-
var
|
|
1018
|
+
var import_react_native15 = require("react-native");
|
|
1019
|
+
var styles5 = import_react_native15.StyleSheet.create({
|
|
553
1020
|
container: {
|
|
554
1021
|
flexDirection: "row",
|
|
555
1022
|
alignItems: "center",
|
|
@@ -587,11 +1054,11 @@ var styles3 = import_react_native10.StyleSheet.create({
|
|
|
587
1054
|
});
|
|
588
1055
|
|
|
589
1056
|
// src/components/alert/alert.hook.ts
|
|
590
|
-
var
|
|
591
|
-
var
|
|
1057
|
+
var import_react17 = require("react");
|
|
1058
|
+
var import_core12 = require("@xaui/core");
|
|
592
1059
|
var useAlertColorScheme = (themeColor) => {
|
|
593
1060
|
const theme = useXUITheme();
|
|
594
|
-
const safeThemeColor = (0,
|
|
1061
|
+
const safeThemeColor = (0, import_core12.getSafeThemeColor)(themeColor);
|
|
595
1062
|
return {
|
|
596
1063
|
theme,
|
|
597
1064
|
colorScheme: theme.colors[safeThemeColor],
|
|
@@ -600,10 +1067,10 @@ var useAlertColorScheme = (themeColor) => {
|
|
|
600
1067
|
};
|
|
601
1068
|
var useAlertContainerStyles = (themeColor, variant) => {
|
|
602
1069
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
603
|
-
const containerStyles = (0,
|
|
604
|
-
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? (0,
|
|
1070
|
+
const containerStyles = (0, import_react17.useMemo)(() => {
|
|
1071
|
+
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? (0, import_core12.withOpacity)(colorScheme.background, 0.75) : "transparent";
|
|
605
1072
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
|
|
606
|
-
const borderColor = variant === "bordered" ? (0,
|
|
1073
|
+
const borderColor = variant === "bordered" ? (0, import_core12.withOpacity)(colorScheme.main, 0.75) : variant === "faded" ? (0, import_core12.withOpacity)(isDefault ? theme.colors.foreground : colorScheme.main, 0.25) : "transparent";
|
|
607
1074
|
return {
|
|
608
1075
|
backgroundColor,
|
|
609
1076
|
borderColor,
|
|
@@ -616,10 +1083,10 @@ var useAlertContainerStyles = (themeColor, variant) => {
|
|
|
616
1083
|
};
|
|
617
1084
|
var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
618
1085
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
619
|
-
const iconWrapperStyles = (0,
|
|
620
|
-
const backgroundColor = variant === "solid" ? (0,
|
|
1086
|
+
const iconWrapperStyles = (0, import_react17.useMemo)(() => {
|
|
1087
|
+
const backgroundColor = variant === "solid" ? (0, import_core12.withOpacity)(colorScheme.foreground, 0.16) : (0, import_core12.withOpacity)(isDefault ? theme.colors.foreground : colorScheme.main, 0.12);
|
|
621
1088
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
|
|
622
|
-
const borderColor = (0,
|
|
1089
|
+
const borderColor = (0, import_core12.withOpacity)(
|
|
623
1090
|
isDefault ? theme.colors.foreground : colorScheme.main,
|
|
624
1091
|
0.2
|
|
625
1092
|
);
|
|
@@ -633,7 +1100,7 @@ var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
|
633
1100
|
};
|
|
634
1101
|
var useAlertTextStyles = (themeColor, variant) => {
|
|
635
1102
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
636
|
-
const textStyles = (0,
|
|
1103
|
+
const textStyles = (0, import_react17.useMemo)(() => {
|
|
637
1104
|
const baseTextColor = variant === "solid" ? colorScheme.foreground : isDefault ? theme.colors.foreground : colorScheme.main;
|
|
638
1105
|
return {
|
|
639
1106
|
titleStyles: {
|
|
@@ -642,7 +1109,7 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
642
1109
|
fontWeight: theme.fontWeights.semibold
|
|
643
1110
|
},
|
|
644
1111
|
descriptionStyles: {
|
|
645
|
-
color: (0,
|
|
1112
|
+
color: (0, import_core12.withOpacity)(baseTextColor, 0.75),
|
|
646
1113
|
fontSize: theme.fontSizes.xs,
|
|
647
1114
|
fontWeight: theme.fontWeights.normal
|
|
648
1115
|
},
|
|
@@ -654,10 +1121,10 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
654
1121
|
};
|
|
655
1122
|
|
|
656
1123
|
// src/components/alert/alert-icons.tsx
|
|
657
|
-
var
|
|
1124
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
658
1125
|
var import_react_native_svg = __toESM(require("react-native-svg"), 1);
|
|
659
1126
|
function InfoIcon({ color, size }) {
|
|
660
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ import_react18.default.createElement(
|
|
661
1128
|
import_react_native_svg.Line,
|
|
662
1129
|
{
|
|
663
1130
|
x1: 12,
|
|
@@ -668,10 +1135,10 @@ function InfoIcon({ color, size }) {
|
|
|
668
1135
|
strokeWidth: 2,
|
|
669
1136
|
strokeLinecap: "round"
|
|
670
1137
|
}
|
|
671
|
-
), /* @__PURE__ */
|
|
1138
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 7, r: 1, fill: color }));
|
|
672
1139
|
}
|
|
673
1140
|
function SuccessIcon({ color, size }) {
|
|
674
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ import_react18.default.createElement(
|
|
675
1142
|
import_react_native_svg.Path,
|
|
676
1143
|
{
|
|
677
1144
|
d: "M7 12.5L10.2 15.5L17 9",
|
|
@@ -683,7 +1150,7 @@ function SuccessIcon({ color, size }) {
|
|
|
683
1150
|
));
|
|
684
1151
|
}
|
|
685
1152
|
function WarningIcon({ color, size }) {
|
|
686
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
687
1154
|
import_react_native_svg.Path,
|
|
688
1155
|
{
|
|
689
1156
|
d: "M12 3L22 20H2L12 3Z",
|
|
@@ -691,7 +1158,7 @@ function WarningIcon({ color, size }) {
|
|
|
691
1158
|
strokeWidth: 2,
|
|
692
1159
|
strokeLinejoin: "round"
|
|
693
1160
|
}
|
|
694
|
-
), /* @__PURE__ */
|
|
1161
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
695
1162
|
import_react_native_svg.Line,
|
|
696
1163
|
{
|
|
697
1164
|
x1: 12,
|
|
@@ -702,10 +1169,10 @@ function WarningIcon({ color, size }) {
|
|
|
702
1169
|
strokeWidth: 2,
|
|
703
1170
|
strokeLinecap: "round"
|
|
704
1171
|
}
|
|
705
|
-
), /* @__PURE__ */
|
|
1172
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 17, r: 1, fill: color }));
|
|
706
1173
|
}
|
|
707
1174
|
function DangerIcon({ color, size }) {
|
|
708
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ import_react18.default.createElement(
|
|
709
1176
|
import_react_native_svg.Line,
|
|
710
1177
|
{
|
|
711
1178
|
x1: 9,
|
|
@@ -716,7 +1183,7 @@ function DangerIcon({ color, size }) {
|
|
|
716
1183
|
strokeWidth: 2,
|
|
717
1184
|
strokeLinecap: "round"
|
|
718
1185
|
}
|
|
719
|
-
), /* @__PURE__ */
|
|
1186
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
720
1187
|
import_react_native_svg.Line,
|
|
721
1188
|
{
|
|
722
1189
|
x1: 15,
|
|
@@ -731,8 +1198,8 @@ function DangerIcon({ color, size }) {
|
|
|
731
1198
|
}
|
|
732
1199
|
|
|
733
1200
|
// src/components/icon/icons/close.tsx
|
|
734
|
-
var
|
|
735
|
-
var
|
|
1201
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
1202
|
+
var import_react_native16 = require("react-native");
|
|
736
1203
|
var import_react_native_svg2 = __toESM(require("react-native-svg"), 1);
|
|
737
1204
|
|
|
738
1205
|
// src/components/icon/icon.utils.ts
|
|
@@ -750,7 +1217,7 @@ var isThemeColor = (color) => {
|
|
|
750
1217
|
};
|
|
751
1218
|
|
|
752
1219
|
// src/components/icon/icons/close.tsx
|
|
753
|
-
var AnimatedPath =
|
|
1220
|
+
var AnimatedPath = import_react_native16.Animated.createAnimatedComponent(import_react_native_svg2.Path);
|
|
754
1221
|
var CloseIcon = ({
|
|
755
1222
|
variant = "baseline",
|
|
756
1223
|
size = 24,
|
|
@@ -758,24 +1225,24 @@ var CloseIcon = ({
|
|
|
758
1225
|
isAnimated = false
|
|
759
1226
|
}) => {
|
|
760
1227
|
const theme = useXUITheme();
|
|
761
|
-
const scaleAnim = (0,
|
|
762
|
-
const opacityAnim = (0,
|
|
763
|
-
const resolvedColor = (0,
|
|
1228
|
+
const scaleAnim = (0, import_react19.useRef)(new import_react_native16.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1229
|
+
const opacityAnim = (0, import_react19.useRef)(new import_react_native16.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1230
|
+
const resolvedColor = (0, import_react19.useMemo)(() => {
|
|
764
1231
|
if (typeof color === "string" && isThemeColor(color)) {
|
|
765
1232
|
return theme.colors[color].main;
|
|
766
1233
|
}
|
|
767
1234
|
return color;
|
|
768
1235
|
}, [color, theme]);
|
|
769
|
-
(0,
|
|
1236
|
+
(0, import_react19.useEffect)(() => {
|
|
770
1237
|
if (isAnimated) {
|
|
771
|
-
|
|
772
|
-
|
|
1238
|
+
import_react_native16.Animated.parallel([
|
|
1239
|
+
import_react_native16.Animated.spring(scaleAnim, {
|
|
773
1240
|
toValue: 1,
|
|
774
1241
|
useNativeDriver: true,
|
|
775
1242
|
tension: 50,
|
|
776
1243
|
friction: 7
|
|
777
1244
|
}),
|
|
778
|
-
|
|
1245
|
+
import_react_native16.Animated.timing(opacityAnim, {
|
|
779
1246
|
toValue: 1,
|
|
780
1247
|
duration: 200,
|
|
781
1248
|
useNativeDriver: true
|
|
@@ -787,7 +1254,7 @@ var CloseIcon = ({
|
|
|
787
1254
|
transform: [{ scale: scaleAnim }],
|
|
788
1255
|
opacity: opacityAnim
|
|
789
1256
|
} : void 0;
|
|
790
|
-
const renderBaseline = () => /* @__PURE__ */
|
|
1257
|
+
const renderBaseline = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
791
1258
|
AnimatedPath,
|
|
792
1259
|
{
|
|
793
1260
|
fill: resolvedColor,
|
|
@@ -795,7 +1262,7 @@ var CloseIcon = ({
|
|
|
795
1262
|
...animatedProps
|
|
796
1263
|
}
|
|
797
1264
|
);
|
|
798
|
-
const renderFilled = () => /* @__PURE__ */
|
|
1265
|
+
const renderFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
799
1266
|
AnimatedPath,
|
|
800
1267
|
{
|
|
801
1268
|
fill: resolvedColor,
|
|
@@ -803,14 +1270,14 @@ var CloseIcon = ({
|
|
|
803
1270
|
...animatedProps
|
|
804
1271
|
}
|
|
805
1272
|
);
|
|
806
|
-
const renderDuotone = () => /* @__PURE__ */
|
|
1273
|
+
const renderDuotone = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
807
1274
|
import_react_native_svg2.Path,
|
|
808
1275
|
{
|
|
809
1276
|
fill: resolvedColor,
|
|
810
1277
|
opacity: 0.3,
|
|
811
1278
|
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
812
1279
|
}
|
|
813
|
-
), /* @__PURE__ */
|
|
1280
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
814
1281
|
AnimatedPath,
|
|
815
1282
|
{
|
|
816
1283
|
fill: resolvedColor,
|
|
@@ -818,7 +1285,7 @@ var CloseIcon = ({
|
|
|
818
1285
|
...animatedProps
|
|
819
1286
|
}
|
|
820
1287
|
));
|
|
821
|
-
const renderRoundOutlined = () => /* @__PURE__ */
|
|
1288
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
822
1289
|
import_react_native_svg2.Circle,
|
|
823
1290
|
{
|
|
824
1291
|
cx: "256",
|
|
@@ -828,7 +1295,7 @@ var CloseIcon = ({
|
|
|
828
1295
|
stroke: resolvedColor,
|
|
829
1296
|
strokeWidth: 32
|
|
830
1297
|
}
|
|
831
|
-
), /* @__PURE__ */
|
|
1298
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
832
1299
|
AnimatedPath,
|
|
833
1300
|
{
|
|
834
1301
|
fill: resolvedColor,
|
|
@@ -836,7 +1303,7 @@ var CloseIcon = ({
|
|
|
836
1303
|
...animatedProps
|
|
837
1304
|
}
|
|
838
1305
|
));
|
|
839
|
-
const renderSquareOutlined = () => /* @__PURE__ */
|
|
1306
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
840
1307
|
import_react_native_svg2.Rect,
|
|
841
1308
|
{
|
|
842
1309
|
x: "64",
|
|
@@ -848,7 +1315,7 @@ var CloseIcon = ({
|
|
|
848
1315
|
stroke: resolvedColor,
|
|
849
1316
|
strokeWidth: 32
|
|
850
1317
|
}
|
|
851
|
-
), /* @__PURE__ */
|
|
1318
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
852
1319
|
AnimatedPath,
|
|
853
1320
|
{
|
|
854
1321
|
fill: resolvedColor,
|
|
@@ -856,7 +1323,7 @@ var CloseIcon = ({
|
|
|
856
1323
|
...animatedProps
|
|
857
1324
|
}
|
|
858
1325
|
));
|
|
859
|
-
const renderRoundFilled = () => /* @__PURE__ */
|
|
1326
|
+
const renderRoundFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
860
1327
|
AnimatedPath,
|
|
861
1328
|
{
|
|
862
1329
|
fill: resolvedColor,
|
|
@@ -864,7 +1331,7 @@ var CloseIcon = ({
|
|
|
864
1331
|
...animatedProps
|
|
865
1332
|
}
|
|
866
1333
|
);
|
|
867
|
-
const renderSquareFilled = () => /* @__PURE__ */
|
|
1334
|
+
const renderSquareFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
868
1335
|
AnimatedPath,
|
|
869
1336
|
{
|
|
870
1337
|
fill: resolvedColor,
|
|
@@ -891,7 +1358,7 @@ var CloseIcon = ({
|
|
|
891
1358
|
return renderBaseline();
|
|
892
1359
|
}
|
|
893
1360
|
};
|
|
894
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react_native_svg2.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
895
1362
|
};
|
|
896
1363
|
|
|
897
1364
|
// src/components/alert/alert.tsx
|
|
@@ -920,8 +1387,8 @@ var Alert = ({
|
|
|
920
1387
|
onClose,
|
|
921
1388
|
onVisibleChange
|
|
922
1389
|
}) => {
|
|
923
|
-
const [internalVisible, setInternalVisible] = (0,
|
|
924
|
-
const [shouldRender, setShouldRender] = (0,
|
|
1390
|
+
const [internalVisible, setInternalVisible] = (0, import_react20.useState)(isVisible ?? true);
|
|
1391
|
+
const [shouldRender, setShouldRender] = (0, import_react20.useState)(isVisible ?? true);
|
|
925
1392
|
const isControlled = typeof isVisible === "boolean";
|
|
926
1393
|
const visible = isControlled ? isVisible : internalVisible;
|
|
927
1394
|
const opacity = (0, import_react_native_reanimated3.useSharedValue)(1);
|
|
@@ -930,7 +1397,7 @@ var Alert = ({
|
|
|
930
1397
|
const containerStyles = useAlertContainerStyles(themeColor, variant);
|
|
931
1398
|
const iconWrapperStyles = useAlertIconWrapperStyles(themeColor, variant);
|
|
932
1399
|
const { titleStyles, descriptionStyles, iconColor, closeButtonColor } = useAlertTextStyles(themeColor, variant);
|
|
933
|
-
const finishClosing = (0,
|
|
1400
|
+
const finishClosing = (0, import_react20.useCallback)(() => {
|
|
934
1401
|
setShouldRender(false);
|
|
935
1402
|
if (!isControlled) {
|
|
936
1403
|
setInternalVisible(false);
|
|
@@ -938,7 +1405,7 @@ var Alert = ({
|
|
|
938
1405
|
onVisibleChange?.(false);
|
|
939
1406
|
onClose?.();
|
|
940
1407
|
}, [isControlled, onClose, onVisibleChange]);
|
|
941
|
-
const handleClose = (0,
|
|
1408
|
+
const handleClose = (0, import_react20.useCallback)(() => {
|
|
942
1409
|
if (!visible) return;
|
|
943
1410
|
opacity.value = (0, import_react_native_reanimated3.withTiming)(0, { duration: 250 });
|
|
944
1411
|
scale.value = (0, import_react_native_reanimated3.withTiming)(0.95, { duration: 250 }, (finished) => {
|
|
@@ -947,7 +1414,7 @@ var Alert = ({
|
|
|
947
1414
|
}
|
|
948
1415
|
});
|
|
949
1416
|
}, [finishClosing, opacity, scale, visible]);
|
|
950
|
-
(0,
|
|
1417
|
+
(0, import_react20.useEffect)(() => {
|
|
951
1418
|
if (visible && !shouldRender) {
|
|
952
1419
|
setShouldRender(true);
|
|
953
1420
|
opacity.value = 0;
|
|
@@ -968,22 +1435,22 @@ var Alert = ({
|
|
|
968
1435
|
const shouldShowClose = Boolean(closeButton || isClosable || onClose);
|
|
969
1436
|
const renderIcon = () => {
|
|
970
1437
|
if (hideIcon) return null;
|
|
971
|
-
if (icon && (0,
|
|
972
|
-
return (0,
|
|
1438
|
+
if (icon && (0, import_react20.isValidElement)(icon)) {
|
|
1439
|
+
return (0, import_react20.cloneElement)(icon, { color: iconColor, size: 22 });
|
|
973
1440
|
}
|
|
974
1441
|
if (icon) {
|
|
975
|
-
return /* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native17.Text, { style: [styles5.iconText, { color: iconColor }] }, icon);
|
|
976
1443
|
}
|
|
977
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ import_react20.default.createElement(IconComponent, { color: iconColor, size: 22 });
|
|
978
1445
|
};
|
|
979
1446
|
const renderContentText = (content) => {
|
|
980
1447
|
if (content === null || content === void 0) return null;
|
|
981
1448
|
if (typeof content === "string" || typeof content === "number") {
|
|
982
|
-
return /* @__PURE__ */
|
|
983
|
-
|
|
1449
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1450
|
+
import_react_native17.Text,
|
|
984
1451
|
{
|
|
985
1452
|
style: [
|
|
986
|
-
|
|
1453
|
+
styles5.description,
|
|
987
1454
|
descriptionStyles,
|
|
988
1455
|
customAppearance?.description
|
|
989
1456
|
]
|
|
@@ -993,20 +1460,20 @@ var Alert = ({
|
|
|
993
1460
|
}
|
|
994
1461
|
return content;
|
|
995
1462
|
};
|
|
996
|
-
const titleNode = (0,
|
|
1463
|
+
const titleNode = (0, import_react20.useMemo)(() => {
|
|
997
1464
|
if (title === null || title === void 0) return null;
|
|
998
1465
|
if (typeof title === "string" || typeof title === "number") {
|
|
999
|
-
return /* @__PURE__ */
|
|
1466
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native17.Text, { style: [styles5.title, titleStyles, customAppearance?.title] }, title);
|
|
1000
1467
|
}
|
|
1001
1468
|
return title;
|
|
1002
1469
|
}, [title, customAppearance?.title, titleStyles]);
|
|
1003
1470
|
const descriptionNode = renderContentText(description);
|
|
1004
1471
|
const childrenNode = renderContentText(children);
|
|
1005
|
-
const closeButtonNode = (0,
|
|
1472
|
+
const closeButtonNode = (0, import_react20.useMemo)(() => {
|
|
1006
1473
|
if (!closeButton) return null;
|
|
1007
|
-
if (!(0,
|
|
1474
|
+
if (!(0, import_react20.isValidElement)(closeButton)) return closeButton;
|
|
1008
1475
|
const existingOnPress = closeButton.props.onPress;
|
|
1009
|
-
return (0,
|
|
1476
|
+
return (0, import_react20.cloneElement)(closeButton, {
|
|
1010
1477
|
onPress: (event) => {
|
|
1011
1478
|
existingOnPress?.(event);
|
|
1012
1479
|
handleClose();
|
|
@@ -1014,58 +1481,58 @@ var Alert = ({
|
|
|
1014
1481
|
});
|
|
1015
1482
|
}, [closeButton, handleClose]);
|
|
1016
1483
|
if (!shouldRender) return null;
|
|
1017
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1018
1485
|
import_react_native_reanimated3.default.View,
|
|
1019
1486
|
{
|
|
1020
1487
|
accessibilityRole: "alert",
|
|
1021
1488
|
style: [
|
|
1022
|
-
|
|
1489
|
+
styles5.container,
|
|
1023
1490
|
containerStyles,
|
|
1024
1491
|
radiusStyles,
|
|
1025
1492
|
customAppearance?.container,
|
|
1026
1493
|
animatedStyle
|
|
1027
1494
|
]
|
|
1028
1495
|
},
|
|
1029
|
-
!hideIcon && /* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
shouldShowClose && /* @__PURE__ */
|
|
1032
|
-
|
|
1496
|
+
!hideIcon && /* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, { style: [styles5.iconWrapper, iconWrapperStyles] }, renderIcon()),
|
|
1497
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, { style: styles5.mainWrapper }, titleNode, descriptionNode, childrenNode && /* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, { style: styles5.extraContent }, childrenNode)),
|
|
1498
|
+
shouldShowClose && /* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, null, closeButtonNode ?? /* @__PURE__ */ import_react20.default.createElement(
|
|
1499
|
+
import_react_native17.Pressable,
|
|
1033
1500
|
{
|
|
1034
1501
|
accessibilityRole: "button",
|
|
1035
1502
|
accessibilityLabel: "Close",
|
|
1036
1503
|
onPress: handleClose,
|
|
1037
|
-
style:
|
|
1504
|
+
style: styles5.closeButton
|
|
1038
1505
|
},
|
|
1039
|
-
/* @__PURE__ */
|
|
1506
|
+
/* @__PURE__ */ import_react20.default.createElement(CloseIcon, { size: 20, color: closeButtonColor })
|
|
1040
1507
|
))
|
|
1041
1508
|
);
|
|
1042
1509
|
};
|
|
1043
1510
|
|
|
1044
1511
|
// src/components/autocomplete/autocomplete.tsx
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1512
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
1513
|
+
var import_react_native30 = require("react-native");
|
|
1047
1514
|
|
|
1048
1515
|
// src/components/autocomplete/autocomplete-context.ts
|
|
1049
|
-
var
|
|
1050
|
-
var AutocompleteContext = (0,
|
|
1516
|
+
var import_react21 = require("react");
|
|
1517
|
+
var AutocompleteContext = (0, import_react21.createContext)({
|
|
1051
1518
|
size: "md",
|
|
1052
1519
|
themeColor: "default",
|
|
1053
1520
|
isDisabled: false
|
|
1054
1521
|
});
|
|
1055
1522
|
|
|
1056
1523
|
// src/components/autocomplete/autocomplete.hook.ts
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1524
|
+
var import_react22 = require("react");
|
|
1525
|
+
var import_core15 = require("@xaui/core");
|
|
1059
1526
|
var import_palette2 = require("@xaui/core/palette");
|
|
1060
1527
|
var useAutocompleteColorScheme = (themeColor) => {
|
|
1061
1528
|
const theme = useXUITheme();
|
|
1062
|
-
const safeThemeColor = (0,
|
|
1529
|
+
const safeThemeColor = (0, import_core15.getSafeThemeColor)(themeColor);
|
|
1063
1530
|
const colorScheme = theme.colors[safeThemeColor];
|
|
1064
1531
|
return { theme, colorScheme };
|
|
1065
1532
|
};
|
|
1066
1533
|
var useAutocompleteSizeStyles = (size) => {
|
|
1067
1534
|
const theme = useXUITheme();
|
|
1068
|
-
return (0,
|
|
1535
|
+
return (0, import_react22.useMemo)(() => {
|
|
1069
1536
|
const sizes = {
|
|
1070
1537
|
xs: {
|
|
1071
1538
|
minHeight: 34,
|
|
@@ -1101,7 +1568,7 @@ var useAutocompleteSizeStyles = (size) => {
|
|
|
1101
1568
|
};
|
|
1102
1569
|
var useAutocompleteRadiusStyles = (radius) => {
|
|
1103
1570
|
const theme = useXUITheme();
|
|
1104
|
-
const radiusStyles = (0,
|
|
1571
|
+
const radiusStyles = (0, import_react22.useMemo)(() => {
|
|
1105
1572
|
const radii = {
|
|
1106
1573
|
none: theme.borderRadius.none,
|
|
1107
1574
|
sm: theme.borderRadius.sm,
|
|
@@ -1111,7 +1578,7 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
1111
1578
|
};
|
|
1112
1579
|
return { borderRadius: radii[radius] };
|
|
1113
1580
|
}, [radius, theme]);
|
|
1114
|
-
const listboxRadius = (0,
|
|
1581
|
+
const listboxRadius = (0, import_react22.useMemo)(() => {
|
|
1115
1582
|
const radii = {
|
|
1116
1583
|
none: theme.borderRadius.none,
|
|
1117
1584
|
sm: theme.borderRadius.sm,
|
|
@@ -1125,12 +1592,12 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
1125
1592
|
};
|
|
1126
1593
|
var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
1127
1594
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
1128
|
-
return (0,
|
|
1595
|
+
return (0, import_react22.useMemo)(() => {
|
|
1129
1596
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
1130
1597
|
if ((variant === "outlined" || variant === "faded") && themeColor === "default") {
|
|
1131
1598
|
borderColor = import_palette2.colors.gray[300];
|
|
1132
1599
|
}
|
|
1133
|
-
const
|
|
1600
|
+
const styles12 = {
|
|
1134
1601
|
outlined: {
|
|
1135
1602
|
backgroundColor: "transparent",
|
|
1136
1603
|
borderWidth: theme.borderWidth.md,
|
|
@@ -1155,12 +1622,12 @@ var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
1155
1622
|
borderColor
|
|
1156
1623
|
}
|
|
1157
1624
|
};
|
|
1158
|
-
return
|
|
1625
|
+
return styles12[variant];
|
|
1159
1626
|
}, [variant, theme, colorScheme, isInvalid, themeColor]);
|
|
1160
1627
|
};
|
|
1161
1628
|
var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
1162
1629
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
1163
|
-
return (0,
|
|
1630
|
+
return (0, import_react22.useMemo)(() => {
|
|
1164
1631
|
let baseColor = theme.colors.foreground;
|
|
1165
1632
|
if (isInvalid) {
|
|
1166
1633
|
baseColor = theme.colors.danger.main;
|
|
@@ -1175,7 +1642,7 @@ var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
|
1175
1642
|
};
|
|
1176
1643
|
var useAutocompleteHelperColor = (isInvalid) => {
|
|
1177
1644
|
const theme = useXUITheme();
|
|
1178
|
-
return (0,
|
|
1645
|
+
return (0, import_react22.useMemo)(() => {
|
|
1179
1646
|
if (isInvalid) {
|
|
1180
1647
|
return theme.colors.danger.main;
|
|
1181
1648
|
}
|
|
@@ -1184,8 +1651,8 @@ var useAutocompleteHelperColor = (isInvalid) => {
|
|
|
1184
1651
|
};
|
|
1185
1652
|
|
|
1186
1653
|
// src/components/autocomplete/autocomplete.style.ts
|
|
1187
|
-
var
|
|
1188
|
-
var
|
|
1654
|
+
var import_react_native18 = require("react-native");
|
|
1655
|
+
var styles6 = import_react_native18.StyleSheet.create({
|
|
1189
1656
|
container: {
|
|
1190
1657
|
gap: 6,
|
|
1191
1658
|
position: "relative"
|
|
@@ -1272,16 +1739,16 @@ var styles4 = import_react_native13.StyleSheet.create({
|
|
|
1272
1739
|
});
|
|
1273
1740
|
|
|
1274
1741
|
// src/components/autocomplete/autocomplete.state.hook.ts
|
|
1275
|
-
var
|
|
1742
|
+
var import_react23 = require("react");
|
|
1276
1743
|
var useAutocompleteOpenState = ({
|
|
1277
1744
|
isOpened,
|
|
1278
1745
|
isDisabled,
|
|
1279
1746
|
onOpenChange,
|
|
1280
1747
|
onClose
|
|
1281
1748
|
}) => {
|
|
1282
|
-
const [internalIsOpen, setInternalIsOpen] = (0,
|
|
1749
|
+
const [internalIsOpen, setInternalIsOpen] = (0, import_react23.useState)(false);
|
|
1283
1750
|
const isOpen = isOpened !== void 0 ? isOpened : internalIsOpen;
|
|
1284
|
-
const setOpen = (0,
|
|
1751
|
+
const setOpen = (0, import_react23.useCallback)(
|
|
1285
1752
|
(open) => {
|
|
1286
1753
|
if (isDisabled) {
|
|
1287
1754
|
return;
|
|
@@ -1304,9 +1771,9 @@ var useAutocompleteInputState = ({
|
|
|
1304
1771
|
selectedKey,
|
|
1305
1772
|
onInputChange
|
|
1306
1773
|
}) => {
|
|
1307
|
-
const [internalInputValue, setInternalInputValue] = (0,
|
|
1774
|
+
const [internalInputValue, setInternalInputValue] = (0, import_react23.useState)(defaultInputValue ?? "");
|
|
1308
1775
|
const currentInputValue = inputValue !== void 0 ? inputValue : internalInputValue;
|
|
1309
|
-
const updateInputValue = (0,
|
|
1776
|
+
const updateInputValue = (0, import_react23.useCallback)(
|
|
1310
1777
|
(value) => {
|
|
1311
1778
|
if (inputValue === void 0) {
|
|
1312
1779
|
setInternalInputValue(value);
|
|
@@ -1315,7 +1782,7 @@ var useAutocompleteInputState = ({
|
|
|
1315
1782
|
},
|
|
1316
1783
|
[inputValue, onInputChange]
|
|
1317
1784
|
);
|
|
1318
|
-
(0,
|
|
1785
|
+
(0, import_react23.useEffect)(() => {
|
|
1319
1786
|
if (selectedKey === null && inputValue === void 0) {
|
|
1320
1787
|
setInternalInputValue("");
|
|
1321
1788
|
}
|
|
@@ -1325,8 +1792,8 @@ var useAutocompleteInputState = ({
|
|
|
1325
1792
|
var useAutocompleteSelection = ({
|
|
1326
1793
|
onSelectionChange
|
|
1327
1794
|
}) => {
|
|
1328
|
-
const [currentSelectedKey, setCurrentSelectedKey] = (0,
|
|
1329
|
-
const updateSelection = (0,
|
|
1795
|
+
const [currentSelectedKey, setCurrentSelectedKey] = (0, import_react23.useState)(null);
|
|
1796
|
+
const updateSelection = (0, import_react23.useCallback)(
|
|
1330
1797
|
(key) => {
|
|
1331
1798
|
setCurrentSelectedKey(key);
|
|
1332
1799
|
onSelectionChange?.(key);
|
|
@@ -1350,14 +1817,14 @@ var defaultFilterFunction = (textValue, inputValue) => {
|
|
|
1350
1817
|
};
|
|
1351
1818
|
|
|
1352
1819
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.tsx
|
|
1353
|
-
var
|
|
1354
|
-
var
|
|
1820
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
1821
|
+
var import_react_native28 = require("react-native");
|
|
1355
1822
|
|
|
1356
1823
|
// src/components/select/checkmark-icon.tsx
|
|
1357
|
-
var
|
|
1824
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
1358
1825
|
var import_react_native_svg3 = __toESM(require("react-native-svg"), 1);
|
|
1359
1826
|
function CheckmarkIcon({ color, size }) {
|
|
1360
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ import_react24.default.createElement(import_react_native_svg3.default, { width: size, height: size, viewBox: "0 0 17 18", fill: "none" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
1361
1828
|
import_react_native_svg3.Polyline,
|
|
1362
1829
|
{
|
|
1363
1830
|
points: "1 9 7 14 15 4",
|
|
@@ -1370,14 +1837,14 @@ function CheckmarkIcon({ color, size }) {
|
|
|
1370
1837
|
}
|
|
1371
1838
|
|
|
1372
1839
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog-header.tsx
|
|
1373
|
-
var
|
|
1374
|
-
var
|
|
1840
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
1841
|
+
var import_react_native26 = require("react-native");
|
|
1375
1842
|
|
|
1376
1843
|
// src/components/icon/icons/arrow-back.tsx
|
|
1377
|
-
var
|
|
1378
|
-
var
|
|
1844
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
1845
|
+
var import_react_native19 = require("react-native");
|
|
1379
1846
|
var import_react_native_svg4 = __toESM(require("react-native-svg"), 1);
|
|
1380
|
-
var AnimatedPath2 =
|
|
1847
|
+
var AnimatedPath2 = import_react_native19.Animated.createAnimatedComponent(import_react_native_svg4.Path);
|
|
1381
1848
|
var ArrowBackIcon = ({
|
|
1382
1849
|
variant = "baseline",
|
|
1383
1850
|
size = 24,
|
|
@@ -1385,24 +1852,24 @@ var ArrowBackIcon = ({
|
|
|
1385
1852
|
isAnimated = false
|
|
1386
1853
|
}) => {
|
|
1387
1854
|
const theme = useXUITheme();
|
|
1388
|
-
const scaleAnim = (0,
|
|
1389
|
-
const opacityAnim = (0,
|
|
1390
|
-
const resolvedColor = (0,
|
|
1855
|
+
const scaleAnim = (0, import_react25.useRef)(new import_react_native19.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1856
|
+
const opacityAnim = (0, import_react25.useRef)(new import_react_native19.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1857
|
+
const resolvedColor = (0, import_react25.useMemo)(() => {
|
|
1391
1858
|
if (typeof color === "string" && isThemeColor(color)) {
|
|
1392
1859
|
return theme.colors[color].main;
|
|
1393
1860
|
}
|
|
1394
1861
|
return color;
|
|
1395
1862
|
}, [color, theme]);
|
|
1396
|
-
(0,
|
|
1863
|
+
(0, import_react25.useEffect)(() => {
|
|
1397
1864
|
if (isAnimated) {
|
|
1398
|
-
|
|
1399
|
-
|
|
1865
|
+
import_react_native19.Animated.parallel([
|
|
1866
|
+
import_react_native19.Animated.spring(scaleAnim, {
|
|
1400
1867
|
toValue: 1,
|
|
1401
1868
|
useNativeDriver: true,
|
|
1402
1869
|
tension: 50,
|
|
1403
1870
|
friction: 7
|
|
1404
1871
|
}),
|
|
1405
|
-
|
|
1872
|
+
import_react_native19.Animated.timing(opacityAnim, {
|
|
1406
1873
|
toValue: 1,
|
|
1407
1874
|
duration: 200,
|
|
1408
1875
|
useNativeDriver: true
|
|
@@ -1414,7 +1881,7 @@ var ArrowBackIcon = ({
|
|
|
1414
1881
|
transform: [{ scale: scaleAnim }],
|
|
1415
1882
|
opacity: opacityAnim
|
|
1416
1883
|
} : void 0;
|
|
1417
|
-
const renderArrow = () => /* @__PURE__ */
|
|
1884
|
+
const renderArrow = () => /* @__PURE__ */ import_react25.default.createElement(
|
|
1418
1885
|
AnimatedPath2,
|
|
1419
1886
|
{
|
|
1420
1887
|
fill: "none",
|
|
@@ -1426,7 +1893,7 @@ var ArrowBackIcon = ({
|
|
|
1426
1893
|
...animatedProps
|
|
1427
1894
|
}
|
|
1428
1895
|
);
|
|
1429
|
-
const renderDuotone = () => /* @__PURE__ */
|
|
1896
|
+
const renderDuotone = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1430
1897
|
import_react_native_svg4.Path,
|
|
1431
1898
|
{
|
|
1432
1899
|
fill: resolvedColor,
|
|
@@ -1434,7 +1901,7 @@ var ArrowBackIcon = ({
|
|
|
1434
1901
|
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
1435
1902
|
}
|
|
1436
1903
|
), renderArrow());
|
|
1437
|
-
const renderRoundOutlined = () => /* @__PURE__ */
|
|
1904
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1438
1905
|
import_react_native_svg4.Circle,
|
|
1439
1906
|
{
|
|
1440
1907
|
cx: "256",
|
|
@@ -1445,7 +1912,7 @@ var ArrowBackIcon = ({
|
|
|
1445
1912
|
strokeWidth: 32
|
|
1446
1913
|
}
|
|
1447
1914
|
), renderArrow());
|
|
1448
|
-
const renderSquareOutlined = () => /* @__PURE__ */
|
|
1915
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1449
1916
|
import_react_native_svg4.Rect,
|
|
1450
1917
|
{
|
|
1451
1918
|
x: "64",
|
|
@@ -1474,284 +1941,2608 @@ var ArrowBackIcon = ({
|
|
|
1474
1941
|
return renderArrow();
|
|
1475
1942
|
}
|
|
1476
1943
|
};
|
|
1477
|
-
return /* @__PURE__ */
|
|
1944
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_react_native_svg4.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
1478
1945
|
};
|
|
1479
1946
|
|
|
1480
|
-
// src/components/icon/icons/
|
|
1481
|
-
var
|
|
1482
|
-
var
|
|
1947
|
+
// src/components/icon/icons/calendar.tsx
|
|
1948
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
1949
|
+
var import_react_native20 = require("react-native");
|
|
1483
1950
|
var import_react_native_svg5 = __toESM(require("react-native-svg"), 1);
|
|
1484
|
-
var AnimatedPath3 =
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1951
|
+
var AnimatedPath3 = import_react_native20.Animated.createAnimatedComponent(import_react_native_svg5.Path);
|
|
1952
|
+
var CalendarIcon = ({
|
|
1953
|
+
variant = "baseline",
|
|
1954
|
+
size = 24,
|
|
1955
|
+
color = "default",
|
|
1956
|
+
isAnimated = false
|
|
1957
|
+
}) => {
|
|
1958
|
+
const theme = useXUITheme();
|
|
1959
|
+
const scaleAnim = (0, import_react26.useRef)(new import_react_native20.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1960
|
+
const opacityAnim = (0, import_react26.useRef)(new import_react_native20.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1961
|
+
const resolvedColor = (0, import_react26.useMemo)(() => {
|
|
1962
|
+
if (typeof color === "string" && isThemeColor(color)) {
|
|
1963
|
+
return theme.colors[color].main;
|
|
1964
|
+
}
|
|
1965
|
+
return color;
|
|
1966
|
+
}, [color, theme]);
|
|
1967
|
+
(0, import_react26.useEffect)(() => {
|
|
1968
|
+
if (isAnimated) {
|
|
1969
|
+
import_react_native20.Animated.parallel([
|
|
1970
|
+
import_react_native20.Animated.spring(scaleAnim, {
|
|
1971
|
+
toValue: 1,
|
|
1972
|
+
useNativeDriver: true,
|
|
1973
|
+
tension: 50,
|
|
1974
|
+
friction: 7
|
|
1975
|
+
}),
|
|
1976
|
+
import_react_native20.Animated.timing(opacityAnim, {
|
|
1977
|
+
toValue: 1,
|
|
1978
|
+
duration: 200,
|
|
1979
|
+
useNativeDriver: true
|
|
1980
|
+
})
|
|
1981
|
+
]).start();
|
|
1982
|
+
}
|
|
1983
|
+
}, [isAnimated, scaleAnim, opacityAnim]);
|
|
1984
|
+
const animatedProps = isAnimated ? {
|
|
1985
|
+
transform: [{ scale: scaleAnim }],
|
|
1986
|
+
opacity: opacityAnim
|
|
1987
|
+
} : void 0;
|
|
1988
|
+
const renderBaseline = () => /* @__PURE__ */ import_react26.default.createElement(
|
|
1989
|
+
AnimatedPath3,
|
|
1990
|
+
{
|
|
1991
|
+
fill: "none",
|
|
1992
|
+
stroke: resolvedColor,
|
|
1993
|
+
strokeLinecap: "round",
|
|
1994
|
+
strokeLinejoin: "round",
|
|
1995
|
+
strokeWidth: 32,
|
|
1996
|
+
d: "M48 112a48 48 0 0148-48h320a48 48 0 0148 48v320a48 48 0 01-48 48H96a48 48 0 01-48-48zm0 80h416M176 64v48M336 64v48",
|
|
1997
|
+
...animatedProps
|
|
1998
|
+
}
|
|
1999
|
+
);
|
|
2000
|
+
const renderFilled = () => /* @__PURE__ */ import_react26.default.createElement(
|
|
2001
|
+
AnimatedPath3,
|
|
2002
|
+
{
|
|
2003
|
+
fill: resolvedColor,
|
|
2004
|
+
d: "M416 64h-56V40a24 24 0 00-48 0v24H200V40a24 24 0 00-48 0v24H96a48 48 0 00-48 48v320a48 48 0 0048 48h320a48 48 0 0048-48V112a48 48 0 00-48-48zm0 368H96V208h320z",
|
|
2005
|
+
...animatedProps
|
|
2006
|
+
}
|
|
2007
|
+
);
|
|
2008
|
+
const renderDuotone = () => /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(
|
|
2009
|
+
import_react_native_svg5.Path,
|
|
2010
|
+
{
|
|
2011
|
+
fill: resolvedColor,
|
|
2012
|
+
opacity: 0.3,
|
|
2013
|
+
d: "M48 192h416v240a48 48 0 01-48 48H96a48 48 0 01-48-48z"
|
|
2014
|
+
}
|
|
2015
|
+
), renderBaseline());
|
|
2016
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(
|
|
2017
|
+
import_react_native_svg5.Circle,
|
|
2018
|
+
{
|
|
2019
|
+
cx: "256",
|
|
2020
|
+
cy: "256",
|
|
2021
|
+
r: "192",
|
|
2022
|
+
fill: "none",
|
|
2023
|
+
stroke: resolvedColor,
|
|
2024
|
+
strokeWidth: 32
|
|
2025
|
+
}
|
|
2026
|
+
), /* @__PURE__ */ import_react26.default.createElement(
|
|
2027
|
+
AnimatedPath3,
|
|
2028
|
+
{
|
|
2029
|
+
fill: "none",
|
|
2030
|
+
stroke: resolvedColor,
|
|
2031
|
+
strokeLinecap: "round",
|
|
2032
|
+
strokeLinejoin: "round",
|
|
2033
|
+
strokeWidth: 28,
|
|
2034
|
+
d: "M152 176a24 24 0 0124-24h160a24 24 0 0124 24v176a24 24 0 01-24 24H176a24 24 0 01-24-24zm0 48h208M208 152v32M304 152v32",
|
|
2035
|
+
...animatedProps
|
|
2036
|
+
}
|
|
2037
|
+
));
|
|
2038
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(
|
|
2039
|
+
import_react_native_svg5.Rect,
|
|
2040
|
+
{
|
|
2041
|
+
x: "64",
|
|
2042
|
+
y: "64",
|
|
2043
|
+
width: "384",
|
|
2044
|
+
height: "384",
|
|
2045
|
+
rx: "48",
|
|
2046
|
+
fill: "none",
|
|
2047
|
+
stroke: resolvedColor,
|
|
2048
|
+
strokeWidth: 32
|
|
2049
|
+
}
|
|
2050
|
+
), /* @__PURE__ */ import_react26.default.createElement(
|
|
2051
|
+
AnimatedPath3,
|
|
2052
|
+
{
|
|
2053
|
+
fill: "none",
|
|
2054
|
+
stroke: resolvedColor,
|
|
2055
|
+
strokeLinecap: "round",
|
|
2056
|
+
strokeLinejoin: "round",
|
|
2057
|
+
strokeWidth: 28,
|
|
2058
|
+
d: "M152 176a24 24 0 0124-24h160a24 24 0 0124 24v176a24 24 0 01-24 24H176a24 24 0 01-24-24zm0 48h208M208 152v32M304 152v32",
|
|
2059
|
+
...animatedProps
|
|
2060
|
+
}
|
|
2061
|
+
));
|
|
2062
|
+
const renderVariant = () => {
|
|
2063
|
+
switch (variant) {
|
|
2064
|
+
case "filled":
|
|
2065
|
+
return renderFilled();
|
|
2066
|
+
case "duotone":
|
|
2067
|
+
return renderDuotone();
|
|
2068
|
+
case "round-outlined":
|
|
2069
|
+
return renderRoundOutlined();
|
|
2070
|
+
case "square-outlined":
|
|
2071
|
+
return renderSquareOutlined();
|
|
2072
|
+
case "round-filled":
|
|
2073
|
+
case "square-filled":
|
|
2074
|
+
return renderFilled();
|
|
2075
|
+
case "baseline":
|
|
2076
|
+
default:
|
|
2077
|
+
return renderBaseline();
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
return /* @__PURE__ */ import_react26.default.createElement(import_react_native_svg5.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
// src/components/icon/icons/checkmark.tsx
|
|
2084
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
2085
|
+
var import_react_native21 = require("react-native");
|
|
2086
|
+
var import_react_native_svg6 = __toESM(require("react-native-svg"), 1);
|
|
2087
|
+
var AnimatedPath4 = import_react_native21.Animated.createAnimatedComponent(import_react_native_svg6.Path);
|
|
2088
|
+
|
|
2089
|
+
// src/components/icon/icons/chevron-down.tsx
|
|
2090
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
2091
|
+
var import_react_native22 = require("react-native");
|
|
2092
|
+
var import_react_native_svg7 = __toESM(require("react-native-svg"), 1);
|
|
2093
|
+
var AnimatedPath5 = import_react_native22.Animated.createAnimatedComponent(import_react_native_svg7.Path);
|
|
2094
|
+
var ChevronDownIcon = ({
|
|
2095
|
+
variant = "baseline",
|
|
2096
|
+
size = 24,
|
|
2097
|
+
color = "default",
|
|
2098
|
+
isAnimated = false
|
|
2099
|
+
}) => {
|
|
2100
|
+
const theme = useXUITheme();
|
|
2101
|
+
const scaleAnim = (0, import_react28.useRef)(new import_react_native22.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2102
|
+
const opacityAnim = (0, import_react28.useRef)(new import_react_native22.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2103
|
+
const resolvedColor = (0, import_react28.useMemo)(() => {
|
|
2104
|
+
if (typeof color === "string" && isThemeColor(color)) {
|
|
2105
|
+
return theme.colors[color].main;
|
|
2106
|
+
}
|
|
2107
|
+
return color;
|
|
2108
|
+
}, [color, theme]);
|
|
2109
|
+
(0, import_react28.useEffect)(() => {
|
|
2110
|
+
if (isAnimated) {
|
|
2111
|
+
import_react_native22.Animated.parallel([
|
|
2112
|
+
import_react_native22.Animated.spring(scaleAnim, {
|
|
2113
|
+
toValue: 1,
|
|
2114
|
+
useNativeDriver: true,
|
|
2115
|
+
tension: 50,
|
|
2116
|
+
friction: 7
|
|
2117
|
+
}),
|
|
2118
|
+
import_react_native22.Animated.timing(opacityAnim, {
|
|
2119
|
+
toValue: 1,
|
|
2120
|
+
duration: 200,
|
|
2121
|
+
useNativeDriver: true
|
|
2122
|
+
})
|
|
2123
|
+
]).start();
|
|
2124
|
+
}
|
|
2125
|
+
}, [isAnimated, scaleAnim, opacityAnim]);
|
|
2126
|
+
const animatedProps = isAnimated ? {
|
|
2127
|
+
transform: [{ scale: scaleAnim }],
|
|
2128
|
+
opacity: opacityAnim
|
|
2129
|
+
} : void 0;
|
|
2130
|
+
const renderBaseline = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
2131
|
+
AnimatedPath5,
|
|
2132
|
+
{
|
|
2133
|
+
fill: "none",
|
|
2134
|
+
stroke: resolvedColor,
|
|
2135
|
+
strokeLinecap: "round",
|
|
2136
|
+
strokeLinejoin: "round",
|
|
2137
|
+
strokeWidth: 48,
|
|
2138
|
+
d: "M112 184l144 144 144-144",
|
|
2139
|
+
...animatedProps
|
|
2140
|
+
}
|
|
2141
|
+
);
|
|
2142
|
+
const renderFilled = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
2143
|
+
AnimatedPath5,
|
|
2144
|
+
{
|
|
2145
|
+
fill: resolvedColor,
|
|
2146
|
+
d: "M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z",
|
|
2147
|
+
...animatedProps
|
|
2148
|
+
}
|
|
2149
|
+
);
|
|
2150
|
+
const renderDuotone = () => /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, /* @__PURE__ */ import_react28.default.createElement(
|
|
2151
|
+
import_react_native_svg7.Path,
|
|
2152
|
+
{
|
|
2153
|
+
fill: resolvedColor,
|
|
2154
|
+
opacity: 0.3,
|
|
2155
|
+
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
2156
|
+
}
|
|
2157
|
+
), /* @__PURE__ */ import_react28.default.createElement(
|
|
2158
|
+
AnimatedPath5,
|
|
2159
|
+
{
|
|
2160
|
+
fill: "none",
|
|
2161
|
+
stroke: resolvedColor,
|
|
2162
|
+
strokeLinecap: "round",
|
|
2163
|
+
strokeLinejoin: "round",
|
|
2164
|
+
strokeWidth: 48,
|
|
2165
|
+
d: "M112 184l144 144 144-144",
|
|
2166
|
+
...animatedProps
|
|
2167
|
+
}
|
|
2168
|
+
));
|
|
2169
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, /* @__PURE__ */ import_react28.default.createElement(
|
|
2170
|
+
import_react_native_svg7.Circle,
|
|
2171
|
+
{
|
|
2172
|
+
cx: "256",
|
|
2173
|
+
cy: "256",
|
|
2174
|
+
r: "192",
|
|
2175
|
+
fill: "none",
|
|
2176
|
+
stroke: resolvedColor,
|
|
2177
|
+
strokeWidth: 32
|
|
2178
|
+
}
|
|
2179
|
+
), /* @__PURE__ */ import_react28.default.createElement(
|
|
2180
|
+
AnimatedPath5,
|
|
2181
|
+
{
|
|
2182
|
+
fill: "none",
|
|
2183
|
+
stroke: resolvedColor,
|
|
2184
|
+
strokeLinecap: "round",
|
|
2185
|
+
strokeLinejoin: "round",
|
|
2186
|
+
strokeWidth: 48,
|
|
2187
|
+
d: "M112 184l144 144 144-144",
|
|
2188
|
+
...animatedProps
|
|
2189
|
+
}
|
|
2190
|
+
));
|
|
2191
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, /* @__PURE__ */ import_react28.default.createElement(
|
|
2192
|
+
import_react_native_svg7.Rect,
|
|
2193
|
+
{
|
|
2194
|
+
x: "64",
|
|
2195
|
+
y: "64",
|
|
2196
|
+
width: "384",
|
|
2197
|
+
height: "384",
|
|
2198
|
+
rx: "48",
|
|
2199
|
+
fill: "none",
|
|
2200
|
+
stroke: resolvedColor,
|
|
2201
|
+
strokeWidth: 32
|
|
2202
|
+
}
|
|
2203
|
+
), /* @__PURE__ */ import_react28.default.createElement(
|
|
2204
|
+
AnimatedPath5,
|
|
2205
|
+
{
|
|
2206
|
+
fill: "none",
|
|
2207
|
+
stroke: resolvedColor,
|
|
2208
|
+
strokeLinecap: "round",
|
|
2209
|
+
strokeLinejoin: "round",
|
|
2210
|
+
strokeWidth: 48,
|
|
2211
|
+
d: "M112 184l144 144 144-144",
|
|
2212
|
+
...animatedProps
|
|
2213
|
+
}
|
|
2214
|
+
));
|
|
2215
|
+
const renderRoundFilled = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
2216
|
+
AnimatedPath5,
|
|
2217
|
+
{
|
|
2218
|
+
fill: resolvedColor,
|
|
2219
|
+
d: "M464 256c0-114.87-93.13-208-208-208S48 141.13 48 256s93.13 208 208 208 208-93.13 208-208zm-100.69-28.69l-96 96a16 16 0 0 1-22.62 0l-96-96a16 16 0 0 1 22.62-22.62L256 289.37l84.69-84.68a16 16 0 0 1 22.62 22.62z",
|
|
2220
|
+
...animatedProps
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
const renderSquareFilled = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
2224
|
+
AnimatedPath5,
|
|
2225
|
+
{
|
|
2226
|
+
fill: resolvedColor,
|
|
2227
|
+
d: "M400 64H112a48 48 0 0 0-48 48v288a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V112a48 48 0 0 0-48-48zm-36.69 163.31l-96 96a16 16 0 0 1-22.62 0l-96-96a16 16 0 0 1 22.62-22.62L256 289.37l84.69-84.68a16 16 0 0 1 22.62 22.62z",
|
|
2228
|
+
...animatedProps
|
|
2229
|
+
}
|
|
2230
|
+
);
|
|
2231
|
+
const renderVariant = () => {
|
|
2232
|
+
switch (variant) {
|
|
2233
|
+
case "filled":
|
|
2234
|
+
return renderFilled();
|
|
2235
|
+
case "duotone":
|
|
2236
|
+
return renderDuotone();
|
|
2237
|
+
case "round-outlined":
|
|
2238
|
+
return renderRoundOutlined();
|
|
2239
|
+
case "square-outlined":
|
|
2240
|
+
return renderSquareOutlined();
|
|
2241
|
+
case "round-filled":
|
|
2242
|
+
return renderRoundFilled();
|
|
2243
|
+
case "square-filled":
|
|
2244
|
+
return renderSquareFilled();
|
|
2245
|
+
case "baseline":
|
|
2246
|
+
default:
|
|
2247
|
+
return renderBaseline();
|
|
2248
|
+
}
|
|
2249
|
+
};
|
|
2250
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_react_native_svg7.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
2251
|
+
};
|
|
2252
|
+
|
|
2253
|
+
// src/components/icon/icons/chevron-left.tsx
|
|
2254
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
2255
|
+
var import_react_native23 = require("react-native");
|
|
2256
|
+
var import_react_native_svg8 = __toESM(require("react-native-svg"), 1);
|
|
2257
|
+
var AnimatedPath6 = import_react_native23.Animated.createAnimatedComponent(import_react_native_svg8.Path);
|
|
2258
|
+
var ChevronLeftIcon = ({
|
|
2259
|
+
variant = "baseline",
|
|
2260
|
+
size = 24,
|
|
2261
|
+
color = "default",
|
|
2262
|
+
isAnimated = false
|
|
2263
|
+
}) => {
|
|
2264
|
+
const theme = useXUITheme();
|
|
2265
|
+
const scaleAnim = (0, import_react29.useRef)(new import_react_native23.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2266
|
+
const opacityAnim = (0, import_react29.useRef)(new import_react_native23.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2267
|
+
const resolvedColor = (0, import_react29.useMemo)(() => {
|
|
2268
|
+
if (typeof color === "string" && isThemeColor(color)) {
|
|
2269
|
+
return theme.colors[color].main;
|
|
2270
|
+
}
|
|
2271
|
+
return color;
|
|
2272
|
+
}, [color, theme]);
|
|
2273
|
+
(0, import_react29.useEffect)(() => {
|
|
2274
|
+
if (isAnimated) {
|
|
2275
|
+
import_react_native23.Animated.parallel([
|
|
2276
|
+
import_react_native23.Animated.spring(scaleAnim, {
|
|
2277
|
+
toValue: 1,
|
|
2278
|
+
useNativeDriver: true,
|
|
2279
|
+
tension: 50,
|
|
2280
|
+
friction: 7
|
|
2281
|
+
}),
|
|
2282
|
+
import_react_native23.Animated.timing(opacityAnim, {
|
|
2283
|
+
toValue: 1,
|
|
2284
|
+
duration: 200,
|
|
2285
|
+
useNativeDriver: true
|
|
2286
|
+
})
|
|
2287
|
+
]).start();
|
|
2288
|
+
}
|
|
2289
|
+
}, [isAnimated, scaleAnim, opacityAnim]);
|
|
2290
|
+
const animatedProps = isAnimated ? {
|
|
2291
|
+
transform: [{ scale: scaleAnim }],
|
|
2292
|
+
opacity: opacityAnim
|
|
2293
|
+
} : void 0;
|
|
2294
|
+
const renderBaseline = () => /* @__PURE__ */ import_react29.default.createElement(
|
|
2295
|
+
AnimatedPath6,
|
|
2296
|
+
{
|
|
2297
|
+
fill: "none",
|
|
2298
|
+
stroke: resolvedColor,
|
|
2299
|
+
strokeLinecap: "round",
|
|
2300
|
+
strokeLinejoin: "round",
|
|
2301
|
+
strokeWidth: 48,
|
|
2302
|
+
d: "M328 112L184 256l144 144",
|
|
2303
|
+
...animatedProps
|
|
2304
|
+
}
|
|
2305
|
+
);
|
|
2306
|
+
const renderFilled = () => /* @__PURE__ */ import_react29.default.createElement(
|
|
2307
|
+
AnimatedPath6,
|
|
2308
|
+
{
|
|
2309
|
+
fill: resolvedColor,
|
|
2310
|
+
d: "M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0s9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z",
|
|
2311
|
+
rotation: 90,
|
|
2312
|
+
origin: "256, 256",
|
|
2313
|
+
...animatedProps
|
|
2314
|
+
}
|
|
2315
|
+
);
|
|
2316
|
+
const renderDuotone = () => /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
2317
|
+
import_react_native_svg8.Path,
|
|
2318
|
+
{
|
|
2319
|
+
fill: resolvedColor,
|
|
2320
|
+
opacity: 0.3,
|
|
2321
|
+
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
2322
|
+
}
|
|
2323
|
+
), renderBaseline());
|
|
2324
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
2325
|
+
import_react_native_svg8.Circle,
|
|
2326
|
+
{
|
|
2327
|
+
cx: "256",
|
|
2328
|
+
cy: "256",
|
|
2329
|
+
r: "192",
|
|
2330
|
+
fill: "none",
|
|
2331
|
+
stroke: resolvedColor,
|
|
2332
|
+
strokeWidth: 32
|
|
2333
|
+
}
|
|
2334
|
+
), renderBaseline());
|
|
2335
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
2336
|
+
import_react_native_svg8.Rect,
|
|
2337
|
+
{
|
|
2338
|
+
x: "64",
|
|
2339
|
+
y: "64",
|
|
2340
|
+
width: "384",
|
|
2341
|
+
height: "384",
|
|
2342
|
+
rx: "48",
|
|
2343
|
+
fill: "none",
|
|
2344
|
+
stroke: resolvedColor,
|
|
2345
|
+
strokeWidth: 32
|
|
2346
|
+
}
|
|
2347
|
+
), renderBaseline());
|
|
2348
|
+
const renderVariant = () => {
|
|
2349
|
+
switch (variant) {
|
|
2350
|
+
case "filled":
|
|
2351
|
+
return renderFilled();
|
|
2352
|
+
case "duotone":
|
|
2353
|
+
return renderDuotone();
|
|
2354
|
+
case "round-outlined":
|
|
2355
|
+
return renderRoundOutlined();
|
|
2356
|
+
case "square-outlined":
|
|
2357
|
+
return renderSquareOutlined();
|
|
2358
|
+
case "round-filled":
|
|
2359
|
+
case "square-filled":
|
|
2360
|
+
return renderFilled();
|
|
2361
|
+
case "baseline":
|
|
2362
|
+
default:
|
|
2363
|
+
return renderBaseline();
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
return /* @__PURE__ */ import_react29.default.createElement(import_react_native_svg8.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
// src/components/icon/icons/chevron-right.tsx
|
|
2370
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
2371
|
+
var import_react_native24 = require("react-native");
|
|
2372
|
+
var import_react_native_svg9 = __toESM(require("react-native-svg"), 1);
|
|
2373
|
+
var AnimatedPath7 = import_react_native24.Animated.createAnimatedComponent(import_react_native_svg9.Path);
|
|
2374
|
+
var ChevronRightIcon = ({
|
|
2375
|
+
variant = "baseline",
|
|
2376
|
+
size = 24,
|
|
2377
|
+
color = "default",
|
|
2378
|
+
isAnimated = false
|
|
2379
|
+
}) => {
|
|
2380
|
+
const theme = useXUITheme();
|
|
2381
|
+
const scaleAnim = (0, import_react30.useRef)(new import_react_native24.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2382
|
+
const opacityAnim = (0, import_react30.useRef)(new import_react_native24.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
2383
|
+
const resolvedColor = (0, import_react30.useMemo)(() => {
|
|
2384
|
+
if (typeof color === "string" && isThemeColor(color)) {
|
|
2385
|
+
return theme.colors[color].main;
|
|
2386
|
+
}
|
|
2387
|
+
return color;
|
|
2388
|
+
}, [color, theme]);
|
|
2389
|
+
(0, import_react30.useEffect)(() => {
|
|
2390
|
+
if (isAnimated) {
|
|
2391
|
+
import_react_native24.Animated.parallel([
|
|
2392
|
+
import_react_native24.Animated.spring(scaleAnim, {
|
|
2393
|
+
toValue: 1,
|
|
2394
|
+
useNativeDriver: true,
|
|
2395
|
+
tension: 50,
|
|
2396
|
+
friction: 7
|
|
2397
|
+
}),
|
|
2398
|
+
import_react_native24.Animated.timing(opacityAnim, {
|
|
2399
|
+
toValue: 1,
|
|
2400
|
+
duration: 200,
|
|
2401
|
+
useNativeDriver: true
|
|
2402
|
+
})
|
|
2403
|
+
]).start();
|
|
2404
|
+
}
|
|
2405
|
+
}, [isAnimated, scaleAnim, opacityAnim]);
|
|
2406
|
+
const animatedProps = isAnimated ? {
|
|
2407
|
+
transform: [{ scale: scaleAnim }],
|
|
2408
|
+
opacity: opacityAnim
|
|
2409
|
+
} : void 0;
|
|
2410
|
+
const renderBaseline = () => /* @__PURE__ */ import_react30.default.createElement(
|
|
2411
|
+
AnimatedPath7,
|
|
2412
|
+
{
|
|
2413
|
+
fill: "none",
|
|
2414
|
+
stroke: resolvedColor,
|
|
2415
|
+
strokeLinecap: "round",
|
|
2416
|
+
strokeLinejoin: "round",
|
|
2417
|
+
strokeWidth: 48,
|
|
2418
|
+
d: "M184 112l144 144-144 144",
|
|
2419
|
+
...animatedProps
|
|
2420
|
+
}
|
|
2421
|
+
);
|
|
2422
|
+
const renderFilled = () => /* @__PURE__ */ import_react30.default.createElement(
|
|
2423
|
+
AnimatedPath7,
|
|
2424
|
+
{
|
|
2425
|
+
fill: resolvedColor,
|
|
2426
|
+
d: "M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z",
|
|
2427
|
+
rotation: -90,
|
|
2428
|
+
origin: "256, 256",
|
|
2429
|
+
...animatedProps
|
|
2430
|
+
}
|
|
2431
|
+
);
|
|
2432
|
+
const renderDuotone = () => /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, /* @__PURE__ */ import_react30.default.createElement(
|
|
2433
|
+
import_react_native_svg9.Path,
|
|
2434
|
+
{
|
|
2435
|
+
fill: resolvedColor,
|
|
2436
|
+
opacity: 0.3,
|
|
2437
|
+
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
2438
|
+
}
|
|
2439
|
+
), renderBaseline());
|
|
2440
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, /* @__PURE__ */ import_react30.default.createElement(
|
|
2441
|
+
import_react_native_svg9.Circle,
|
|
2442
|
+
{
|
|
2443
|
+
cx: "256",
|
|
2444
|
+
cy: "256",
|
|
2445
|
+
r: "192",
|
|
2446
|
+
fill: "none",
|
|
2447
|
+
stroke: resolvedColor,
|
|
2448
|
+
strokeWidth: 32
|
|
2449
|
+
}
|
|
2450
|
+
), renderBaseline());
|
|
2451
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, /* @__PURE__ */ import_react30.default.createElement(
|
|
2452
|
+
import_react_native_svg9.Rect,
|
|
2453
|
+
{
|
|
2454
|
+
x: "64",
|
|
2455
|
+
y: "64",
|
|
2456
|
+
width: "384",
|
|
2457
|
+
height: "384",
|
|
2458
|
+
rx: "48",
|
|
2459
|
+
fill: "none",
|
|
2460
|
+
stroke: resolvedColor,
|
|
2461
|
+
strokeWidth: 32
|
|
2462
|
+
}
|
|
2463
|
+
), renderBaseline());
|
|
2464
|
+
const renderVariant = () => {
|
|
2465
|
+
switch (variant) {
|
|
2466
|
+
case "filled":
|
|
2467
|
+
return renderFilled();
|
|
2468
|
+
case "duotone":
|
|
2469
|
+
return renderDuotone();
|
|
2470
|
+
case "round-outlined":
|
|
2471
|
+
return renderRoundOutlined();
|
|
2472
|
+
case "square-outlined":
|
|
2473
|
+
return renderSquareOutlined();
|
|
2474
|
+
case "round-filled":
|
|
2475
|
+
case "square-filled":
|
|
2476
|
+
return renderFilled();
|
|
2477
|
+
case "baseline":
|
|
2478
|
+
default:
|
|
2479
|
+
return renderBaseline();
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
2482
|
+
return /* @__PURE__ */ import_react30.default.createElement(import_react_native_svg9.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
2483
|
+
};
|
|
2484
|
+
|
|
2485
|
+
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.style.ts
|
|
2486
|
+
var import_react_native25 = require("react-native");
|
|
2487
|
+
var styles7 = import_react_native25.StyleSheet.create({
|
|
2488
|
+
backdrop: {
|
|
2489
|
+
...import_react_native25.StyleSheet.absoluteFillObject,
|
|
2490
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
2491
|
+
},
|
|
2492
|
+
dialogContainer: {
|
|
2493
|
+
flex: 1,
|
|
2494
|
+
zIndex: 1
|
|
2495
|
+
},
|
|
2496
|
+
container: {
|
|
2497
|
+
flex: 1,
|
|
2498
|
+
paddingTop: 55,
|
|
2499
|
+
paddingHorizontal: 16
|
|
2500
|
+
},
|
|
2501
|
+
header: {
|
|
2502
|
+
marginBottom: 12
|
|
2503
|
+
},
|
|
2504
|
+
titleRow: {
|
|
2505
|
+
flexDirection: "row",
|
|
2506
|
+
alignItems: "center",
|
|
2507
|
+
gap: 8,
|
|
2508
|
+
marginBottom: 16
|
|
2509
|
+
},
|
|
2510
|
+
backButton: {
|
|
2511
|
+
padding: 4
|
|
2512
|
+
},
|
|
2513
|
+
title: {
|
|
2514
|
+
fontSize: 20,
|
|
2515
|
+
fontWeight: "600"
|
|
2516
|
+
},
|
|
2517
|
+
inputContainer: {
|
|
2518
|
+
flexDirection: "row",
|
|
2519
|
+
alignItems: "center",
|
|
2520
|
+
gap: 8
|
|
2521
|
+
},
|
|
2522
|
+
inputWrapper: {
|
|
2523
|
+
flex: 1,
|
|
2524
|
+
flexDirection: "row",
|
|
2525
|
+
alignItems: "center",
|
|
2526
|
+
position: "relative"
|
|
2527
|
+
},
|
|
2528
|
+
input: {
|
|
2529
|
+
flex: 1,
|
|
2530
|
+
paddingVertical: 12,
|
|
2531
|
+
paddingHorizontal: 16,
|
|
2532
|
+
paddingRight: 40,
|
|
2533
|
+
borderRadius: 8,
|
|
2534
|
+
fontSize: 16
|
|
2535
|
+
},
|
|
2536
|
+
clearInputButton: {
|
|
2537
|
+
position: "absolute",
|
|
2538
|
+
right: 8,
|
|
2539
|
+
padding: 4
|
|
2540
|
+
},
|
|
2541
|
+
listContainer: {
|
|
2542
|
+
flex: 1
|
|
2543
|
+
},
|
|
2544
|
+
listContentContainer: {
|
|
2545
|
+
paddingBottom: 80
|
|
2546
|
+
},
|
|
2547
|
+
checkmarkButtonContainer: {
|
|
2548
|
+
position: "absolute",
|
|
2549
|
+
bottom: 24,
|
|
2550
|
+
right: 24
|
|
2551
|
+
},
|
|
2552
|
+
checkmarkButton: {
|
|
2553
|
+
width: 54,
|
|
2554
|
+
height: 54,
|
|
2555
|
+
borderRadius: 27,
|
|
2556
|
+
justifyContent: "center",
|
|
2557
|
+
alignItems: "center",
|
|
2558
|
+
elevation: 8
|
|
2559
|
+
}
|
|
2560
|
+
});
|
|
2561
|
+
|
|
2562
|
+
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog-header.tsx
|
|
2563
|
+
var addOpacityToColor = (color, opacity) => {
|
|
2564
|
+
const hex = color.replace("#", "");
|
|
2565
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
2566
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
2567
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
2568
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
2569
|
+
};
|
|
2570
|
+
var AutocompleteDialogHeader = ({
|
|
2571
|
+
title,
|
|
2572
|
+
inputValue,
|
|
2573
|
+
placeholder = "Search...",
|
|
2574
|
+
inputRef,
|
|
2575
|
+
inputAnimatedStyle,
|
|
2576
|
+
inputTextStyle,
|
|
2577
|
+
onInputChange,
|
|
2578
|
+
onClose,
|
|
2579
|
+
onCheckmarkPress,
|
|
2580
|
+
onFocus,
|
|
2581
|
+
onBlur
|
|
2582
|
+
}) => {
|
|
2583
|
+
const theme = useXUITheme();
|
|
2584
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_react_native26.View, { style: styles7.header }, title ? /* @__PURE__ */ import_react31.default.createElement(import_react_native26.View, { style: styles7.titleRow }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2585
|
+
import_react_native26.Pressable,
|
|
2586
|
+
{
|
|
2587
|
+
style: styles7.backButton,
|
|
2588
|
+
onPress: onClose,
|
|
2589
|
+
accessibilityLabel: "Back",
|
|
2590
|
+
accessibilityRole: "button"
|
|
2591
|
+
},
|
|
2592
|
+
/* @__PURE__ */ import_react31.default.createElement(ArrowBackIcon, { size: 20, color: theme.colors.foreground })
|
|
2593
|
+
), /* @__PURE__ */ import_react31.default.createElement(import_react_native26.Text, { style: [styles7.title, { color: theme.colors.foreground }] }, title)) : null, /* @__PURE__ */ import_react31.default.createElement(import_react_native26.View, { style: styles7.inputContainer }, /* @__PURE__ */ import_react31.default.createElement(import_react_native26.Animated.View, { style: [styles7.inputWrapper, inputAnimatedStyle] }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2594
|
+
import_react_native26.TextInput,
|
|
2595
|
+
{
|
|
2596
|
+
ref: inputRef,
|
|
2597
|
+
value: inputValue,
|
|
2598
|
+
onChangeText: onInputChange,
|
|
2599
|
+
placeholder,
|
|
2600
|
+
placeholderTextColor: addOpacityToColor(
|
|
2601
|
+
theme.colors.foreground,
|
|
2602
|
+
0.5
|
|
2603
|
+
),
|
|
2604
|
+
style: [
|
|
2605
|
+
styles7.input,
|
|
2606
|
+
{
|
|
2607
|
+
backgroundColor: theme.colors.default.background,
|
|
2608
|
+
color: theme.colors.foreground
|
|
2609
|
+
},
|
|
2610
|
+
inputTextStyle
|
|
2611
|
+
],
|
|
2612
|
+
autoFocus: true,
|
|
2613
|
+
returnKeyType: "done",
|
|
2614
|
+
onSubmitEditing: onCheckmarkPress,
|
|
2615
|
+
onFocus,
|
|
2616
|
+
onBlur
|
|
2617
|
+
}
|
|
2618
|
+
), inputValue ? /* @__PURE__ */ import_react31.default.createElement(
|
|
2619
|
+
import_react_native26.Pressable,
|
|
2620
|
+
{
|
|
2621
|
+
style: styles7.clearInputButton,
|
|
2622
|
+
onPress: () => onInputChange?.(""),
|
|
2623
|
+
accessibilityLabel: "Clear input",
|
|
2624
|
+
accessibilityRole: "button"
|
|
2625
|
+
},
|
|
2626
|
+
/* @__PURE__ */ import_react31.default.createElement(CloseIcon, { color: theme.colors.foreground })
|
|
2627
|
+
) : null)));
|
|
2628
|
+
};
|
|
2629
|
+
|
|
2630
|
+
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.animation.ts
|
|
2631
|
+
var import_react32 = require("react");
|
|
2632
|
+
var import_react_native27 = require("react-native");
|
|
2633
|
+
var useAutocompleteDialogAnimation = ({
|
|
2634
|
+
visible,
|
|
2635
|
+
fadeAnim,
|
|
2636
|
+
slideAnim,
|
|
2637
|
+
scaleAnim
|
|
2638
|
+
}) => {
|
|
2639
|
+
(0, import_react32.useEffect)(() => {
|
|
2640
|
+
if (visible) {
|
|
2641
|
+
import_react_native27.Animated.parallel([
|
|
2642
|
+
import_react_native27.Animated.timing(fadeAnim, {
|
|
2643
|
+
toValue: 1,
|
|
2644
|
+
duration: 250,
|
|
2645
|
+
useNativeDriver: true
|
|
2646
|
+
}),
|
|
2647
|
+
import_react_native27.Animated.spring(slideAnim, {
|
|
2648
|
+
toValue: 1,
|
|
2649
|
+
useNativeDriver: true,
|
|
2650
|
+
tension: 65,
|
|
2651
|
+
friction: 10
|
|
2652
|
+
}),
|
|
2653
|
+
import_react_native27.Animated.spring(scaleAnim, {
|
|
2654
|
+
toValue: 1,
|
|
2655
|
+
useNativeDriver: true,
|
|
2656
|
+
tension: 50,
|
|
2657
|
+
friction: 8
|
|
2658
|
+
})
|
|
2659
|
+
]).start();
|
|
2660
|
+
} else {
|
|
2661
|
+
fadeAnim.setValue(0);
|
|
2662
|
+
slideAnim.setValue(0);
|
|
2663
|
+
scaleAnim.setValue(0);
|
|
2664
|
+
}
|
|
2665
|
+
}, [visible, fadeAnim, slideAnim, scaleAnim]);
|
|
2666
|
+
};
|
|
2667
|
+
|
|
2668
|
+
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.tsx
|
|
2669
|
+
var AutocompleteDialog = ({
|
|
2670
|
+
visible,
|
|
2671
|
+
inputValue,
|
|
2672
|
+
placeholder = "Search...",
|
|
2673
|
+
title,
|
|
2674
|
+
themeColor = "primary",
|
|
2675
|
+
children,
|
|
2676
|
+
showCheckmark = true,
|
|
2677
|
+
checkmarkIcon,
|
|
2678
|
+
inputTextStyle,
|
|
2679
|
+
style,
|
|
2680
|
+
onInputChange,
|
|
2681
|
+
onClose,
|
|
2682
|
+
onCheckmark,
|
|
2683
|
+
onFocus,
|
|
2684
|
+
onBlur
|
|
2685
|
+
}) => {
|
|
2686
|
+
const theme = useXUITheme();
|
|
2687
|
+
const { width: screenWidth, height: screenHeight } = (0, import_react_native28.useWindowDimensions)();
|
|
2688
|
+
const fadeAnim = (0, import_react33.useRef)(new import_react_native28.Animated.Value(0)).current;
|
|
2689
|
+
const slideAnim = (0, import_react33.useRef)(new import_react_native28.Animated.Value(0)).current;
|
|
2690
|
+
const scaleAnim = (0, import_react33.useRef)(new import_react_native28.Animated.Value(0)).current;
|
|
2691
|
+
const inputRef = (0, import_react33.useRef)(null);
|
|
2692
|
+
const [keyboardHeight, setKeyboardHeight] = (0, import_react33.useState)(0);
|
|
2693
|
+
(0, import_react33.useEffect)(() => {
|
|
2694
|
+
const showEvent = import_react_native28.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
2695
|
+
const hideEvent = import_react_native28.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
2696
|
+
const showSub = import_react_native28.Keyboard.addListener(showEvent, (e) => {
|
|
2697
|
+
setKeyboardHeight(e.endCoordinates.height);
|
|
2698
|
+
});
|
|
2699
|
+
const hideSub = import_react_native28.Keyboard.addListener(hideEvent, () => {
|
|
2700
|
+
setKeyboardHeight(0);
|
|
2701
|
+
});
|
|
2702
|
+
return () => {
|
|
2703
|
+
showSub.remove();
|
|
2704
|
+
hideSub.remove();
|
|
2705
|
+
};
|
|
2706
|
+
}, []);
|
|
2707
|
+
const items = (0, import_react33.useMemo)(
|
|
2708
|
+
() => import_react33.default.Children.toArray(children).filter(
|
|
2709
|
+
import_react33.default.isValidElement
|
|
2710
|
+
),
|
|
2711
|
+
[children]
|
|
2712
|
+
);
|
|
2713
|
+
const checkmarkColor = theme.colors[themeColor].main;
|
|
2714
|
+
const checkmarkBackgroundColor = theme.colors[themeColor].background;
|
|
2715
|
+
useAutocompleteDialogAnimation({ visible, fadeAnim, slideAnim, scaleAnim });
|
|
2716
|
+
(0, import_react33.useEffect)(() => {
|
|
2717
|
+
if (!visible) return;
|
|
2718
|
+
const sub = import_react_native28.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
2719
|
+
onClose?.();
|
|
2720
|
+
return true;
|
|
2721
|
+
});
|
|
2722
|
+
return () => sub.remove();
|
|
2723
|
+
}, [visible, onClose]);
|
|
2724
|
+
const focusInput = (0, import_react33.useCallback)(() => {
|
|
2725
|
+
const delay = import_react_native28.Platform.OS === "android" ? 300 : 100;
|
|
2726
|
+
import_react_native28.InteractionManager.runAfterInteractions(() => {
|
|
2727
|
+
setTimeout(() => {
|
|
2728
|
+
inputRef.current?.focus();
|
|
2729
|
+
}, delay);
|
|
2730
|
+
});
|
|
2731
|
+
}, []);
|
|
2732
|
+
const handleCheckmarkPress = () => {
|
|
2733
|
+
onCheckmark?.();
|
|
2734
|
+
import_react_native28.Keyboard.dismiss();
|
|
2735
|
+
};
|
|
2736
|
+
(0, import_react33.useEffect)(() => {
|
|
2737
|
+
if (!visible) {
|
|
2738
|
+
import_react_native28.Keyboard.dismiss();
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
focusInput();
|
|
2742
|
+
}, [focusInput, visible]);
|
|
2743
|
+
const listBottomPadding = (0, import_react33.useMemo)(() => {
|
|
2744
|
+
const basePadding = showCheckmark ? 96 : 64;
|
|
2745
|
+
return (keyboardHeight > 0 ? keyboardHeight : 0) + basePadding;
|
|
2746
|
+
}, [keyboardHeight, showCheckmark]);
|
|
2747
|
+
if (!visible) return null;
|
|
2748
|
+
const overlayStyle = {
|
|
2749
|
+
position: "absolute",
|
|
2750
|
+
top: 0,
|
|
2751
|
+
left: 0,
|
|
2752
|
+
width: screenWidth,
|
|
2753
|
+
height: screenHeight
|
|
2754
|
+
};
|
|
2755
|
+
const containerAnimatedStyle = {
|
|
2756
|
+
transform: [
|
|
2757
|
+
{
|
|
2758
|
+
translateY: slideAnim.interpolate({
|
|
2759
|
+
inputRange: [0, 1],
|
|
2760
|
+
outputRange: [screenHeight, 0]
|
|
2761
|
+
})
|
|
2762
|
+
}
|
|
2763
|
+
]
|
|
2764
|
+
};
|
|
2765
|
+
const inputAnimatedStyle = {
|
|
2766
|
+
transform: [{ scaleX: scaleAnim }]
|
|
2767
|
+
};
|
|
2768
|
+
const listHeader = /* @__PURE__ */ import_react33.default.createElement(
|
|
2769
|
+
AutocompleteDialogHeader,
|
|
2770
|
+
{
|
|
2771
|
+
title,
|
|
2772
|
+
inputValue,
|
|
2773
|
+
placeholder,
|
|
2774
|
+
inputRef,
|
|
2775
|
+
inputAnimatedStyle,
|
|
2776
|
+
inputTextStyle,
|
|
2777
|
+
onInputChange,
|
|
2778
|
+
onClose,
|
|
2779
|
+
onCheckmarkPress: handleCheckmarkPress,
|
|
2780
|
+
onFocus,
|
|
2781
|
+
onBlur
|
|
2782
|
+
}
|
|
2783
|
+
);
|
|
2784
|
+
return /* @__PURE__ */ import_react33.default.createElement(Portal, null, /* @__PURE__ */ import_react33.default.createElement(import_react_native28.View, { style: [overlayStyle, style] }, /* @__PURE__ */ import_react33.default.createElement(import_react_native28.Animated.View, { style: [styles7.backdrop, { opacity: fadeAnim }] }), /* @__PURE__ */ import_react33.default.createElement(import_react_native28.Animated.View, { style: [styles7.dialogContainer, containerAnimatedStyle] }, /* @__PURE__ */ import_react33.default.createElement(
|
|
2785
|
+
import_react_native28.View,
|
|
2786
|
+
{
|
|
2787
|
+
style: [styles7.container, { backgroundColor: theme.colors.background }]
|
|
2788
|
+
},
|
|
2789
|
+
listHeader,
|
|
2790
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
2791
|
+
import_react_native28.FlatList,
|
|
2792
|
+
{
|
|
2793
|
+
data: items,
|
|
2794
|
+
renderItem: ({ item }) => item,
|
|
2795
|
+
keyExtractor: (_, index) => String(index),
|
|
2796
|
+
style: styles7.listContainer,
|
|
2797
|
+
contentContainerStyle: {
|
|
2798
|
+
paddingBottom: listBottomPadding
|
|
2799
|
+
},
|
|
2800
|
+
keyboardShouldPersistTaps: "always",
|
|
2801
|
+
keyboardDismissMode: "none",
|
|
2802
|
+
showsVerticalScrollIndicator: false
|
|
2803
|
+
}
|
|
2804
|
+
),
|
|
2805
|
+
showCheckmark ? /* @__PURE__ */ import_react33.default.createElement(import_react_native28.View, { style: styles7.checkmarkButtonContainer }, /* @__PURE__ */ import_react33.default.createElement(
|
|
2806
|
+
import_react_native28.Pressable,
|
|
2807
|
+
{
|
|
2808
|
+
style: [
|
|
2809
|
+
styles7.checkmarkButton,
|
|
2810
|
+
{ backgroundColor: checkmarkBackgroundColor }
|
|
2811
|
+
],
|
|
2812
|
+
onPress: handleCheckmarkPress,
|
|
2813
|
+
accessibilityLabel: "Confirm",
|
|
2814
|
+
accessibilityRole: "button"
|
|
2815
|
+
},
|
|
2816
|
+
checkmarkIcon ?? /* @__PURE__ */ import_react33.default.createElement(CheckmarkIcon, { color: checkmarkColor, size: 20 })
|
|
2817
|
+
)) : null
|
|
2818
|
+
))));
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2821
|
+
// src/components/autocomplete/autocomplete-trigger.tsx
|
|
2822
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
2823
|
+
var import_react_native29 = require("react-native");
|
|
2824
|
+
var AutocompleteTrigger = ({
|
|
2825
|
+
triggerRef,
|
|
2826
|
+
isDisabled,
|
|
2827
|
+
currentSelectedKey,
|
|
2828
|
+
currentInputValue,
|
|
2829
|
+
displayValue,
|
|
2830
|
+
sizeStyles,
|
|
2831
|
+
radiusStyles,
|
|
2832
|
+
variantStyles,
|
|
2833
|
+
theme,
|
|
2834
|
+
isClearable,
|
|
2835
|
+
label,
|
|
2836
|
+
labelText,
|
|
2837
|
+
isLabelInside,
|
|
2838
|
+
clearIcon,
|
|
2839
|
+
style,
|
|
2840
|
+
textStyle,
|
|
2841
|
+
onPress: handleTriggerPress,
|
|
2842
|
+
onClear: handleClear,
|
|
2843
|
+
onLayout: handleTriggerLayout
|
|
2844
|
+
}) => {
|
|
2845
|
+
const renderLabel = isLabelInside && label;
|
|
2846
|
+
return /* @__PURE__ */ import_react34.default.createElement(
|
|
2847
|
+
import_react_native29.Pressable,
|
|
2848
|
+
{
|
|
2849
|
+
ref: triggerRef,
|
|
2850
|
+
onPress: handleTriggerPress,
|
|
2851
|
+
onLayout: handleTriggerLayout,
|
|
2852
|
+
disabled: isDisabled,
|
|
2853
|
+
style: [
|
|
2854
|
+
styles6.trigger,
|
|
2855
|
+
{
|
|
2856
|
+
minHeight: sizeStyles.minHeight,
|
|
2857
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
2858
|
+
paddingVertical: sizeStyles.paddingVertical
|
|
2859
|
+
},
|
|
2860
|
+
radiusStyles,
|
|
2861
|
+
variantStyles,
|
|
2862
|
+
isDisabled && styles6.disabled,
|
|
2863
|
+
style
|
|
2864
|
+
],
|
|
2865
|
+
accessibilityLabel: labelText ?? (typeof label === "string" ? label : void 0),
|
|
2866
|
+
accessibilityRole: "button",
|
|
2867
|
+
accessibilityState: { disabled: isDisabled }
|
|
2868
|
+
},
|
|
2869
|
+
/* @__PURE__ */ import_react34.default.createElement(import_react_native29.View, { style: styles6.triggerContent }, isLabelInside && renderLabel, /* @__PURE__ */ import_react34.default.createElement(
|
|
2870
|
+
import_react_native29.Text,
|
|
2871
|
+
{
|
|
2872
|
+
style: [
|
|
2873
|
+
styles6.triggerText,
|
|
2874
|
+
{ fontSize: sizeStyles.fontSize, color: theme.colors.foreground },
|
|
2875
|
+
!currentSelectedKey && !currentInputValue && { opacity: 0.5 },
|
|
2876
|
+
textStyle
|
|
2877
|
+
],
|
|
2878
|
+
numberOfLines: 1,
|
|
2879
|
+
ellipsizeMode: "tail"
|
|
2880
|
+
},
|
|
2881
|
+
displayValue
|
|
2882
|
+
)),
|
|
2883
|
+
isClearable && (currentSelectedKey || currentInputValue) ? /* @__PURE__ */ import_react34.default.createElement(
|
|
2884
|
+
import_react_native29.TouchableOpacity,
|
|
2885
|
+
{
|
|
2886
|
+
onPress: handleClear,
|
|
2887
|
+
style: styles6.clearButton,
|
|
2888
|
+
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
2889
|
+
},
|
|
2890
|
+
clearIcon ?? /* @__PURE__ */ import_react34.default.createElement(CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
2891
|
+
) : null
|
|
2892
|
+
);
|
|
2893
|
+
};
|
|
2894
|
+
|
|
2895
|
+
// src/components/autocomplete/autocomplete.tsx
|
|
2896
|
+
var defaultPlaceholder = "Search...";
|
|
2897
|
+
var Autocomplete = ({
|
|
2898
|
+
children,
|
|
2899
|
+
variant = "flat",
|
|
2900
|
+
themeColor = "default",
|
|
2901
|
+
size = "md",
|
|
2902
|
+
radius = "md",
|
|
2903
|
+
placeholder = defaultPlaceholder,
|
|
2904
|
+
labelPlacement = "outside",
|
|
2905
|
+
label,
|
|
2906
|
+
description,
|
|
2907
|
+
errorMessage,
|
|
2908
|
+
clearIcon,
|
|
2909
|
+
fullWidth = false,
|
|
2910
|
+
isDisabled = false,
|
|
2911
|
+
isInvalid = false,
|
|
2912
|
+
isClearable = true,
|
|
2913
|
+
allowsCustomValue = false,
|
|
2914
|
+
forceSelection = false,
|
|
2915
|
+
allowsEmptyCollection = true,
|
|
2916
|
+
disableLocalFilter = false,
|
|
2917
|
+
inputValue,
|
|
2918
|
+
defaultInputValue,
|
|
2919
|
+
customAppearance,
|
|
2920
|
+
onClose,
|
|
2921
|
+
onOpenChange,
|
|
2922
|
+
onSelectionChange,
|
|
2923
|
+
onInputChange,
|
|
2924
|
+
onClear
|
|
2925
|
+
}) => {
|
|
2926
|
+
const { currentSelectedKey, updateSelection } = useAutocompleteSelection({
|
|
2927
|
+
onSelectionChange
|
|
2928
|
+
});
|
|
2929
|
+
const { currentInputValue, updateInputValue } = useAutocompleteInputState({
|
|
2930
|
+
inputValue,
|
|
2931
|
+
defaultInputValue,
|
|
2932
|
+
selectedKey: currentSelectedKey,
|
|
2933
|
+
onInputChange
|
|
2934
|
+
});
|
|
2935
|
+
const { isOpen, setOpen } = useAutocompleteOpenState({
|
|
2936
|
+
isOpened: void 0,
|
|
2937
|
+
isDisabled,
|
|
2938
|
+
onOpenChange,
|
|
2939
|
+
onClose
|
|
2940
|
+
});
|
|
2941
|
+
const triggerRef = (0, import_react35.useRef)(null);
|
|
2942
|
+
const [triggerLayout, setTriggerLayout] = (0, import_react35.useState)();
|
|
2943
|
+
const handleTriggerLayout = (0, import_react35.useCallback)(() => {
|
|
2944
|
+
triggerRef.current?.measureInWindow((x, y, width, height) => {
|
|
2945
|
+
setTriggerLayout({ x, y, width, height });
|
|
2946
|
+
});
|
|
2947
|
+
}, []);
|
|
2948
|
+
const items = (0, import_react35.useMemo)(() => {
|
|
2949
|
+
const elements = import_react35.default.Children.toArray(children).filter(Boolean);
|
|
2950
|
+
return elements.map((child, index) => {
|
|
2951
|
+
if (!import_react35.default.isValidElement(child)) {
|
|
2952
|
+
return null;
|
|
2953
|
+
}
|
|
2954
|
+
const key = child.props.value ?? String(index);
|
|
2955
|
+
const labelText = getTextValue(child.props.label) ?? key;
|
|
2956
|
+
return {
|
|
2957
|
+
key,
|
|
2958
|
+
element: child,
|
|
2959
|
+
labelText
|
|
2960
|
+
};
|
|
2961
|
+
}).filter((item) => item !== null);
|
|
2962
|
+
}, [children]);
|
|
2963
|
+
const filteredItems = (0, import_react35.useMemo)(() => {
|
|
2964
|
+
if (disableLocalFilter || !currentInputValue.trim()) {
|
|
2965
|
+
return items;
|
|
2966
|
+
}
|
|
2967
|
+
return items.filter(
|
|
2968
|
+
(item) => defaultFilterFunction(item.labelText, currentInputValue)
|
|
2969
|
+
);
|
|
2970
|
+
}, [disableLocalFilter, items, currentInputValue]);
|
|
2971
|
+
const theme = useXUITheme();
|
|
2972
|
+
const sizeStyles = useAutocompleteSizeStyles(size);
|
|
2973
|
+
const { radiusStyles } = useAutocompleteRadiusStyles(radius);
|
|
2974
|
+
const variantStyles = useAutocompleteVariantStyles(themeColor, variant, isInvalid);
|
|
2975
|
+
const labelStyle = useAutocompleteLabelStyle(
|
|
2976
|
+
themeColor,
|
|
2977
|
+
isInvalid,
|
|
2978
|
+
sizeStyles.labelSize
|
|
2979
|
+
);
|
|
2980
|
+
const helperColor = useAutocompleteHelperColor(isInvalid);
|
|
2981
|
+
const selectedItem = items.find((item) => item.key === currentSelectedKey);
|
|
2982
|
+
const displayValue = forceSelection ? selectedItem?.labelText || placeholder : currentInputValue || placeholder;
|
|
2983
|
+
const handleInputChange = (0, import_react35.useCallback)(
|
|
2984
|
+
(text) => {
|
|
2985
|
+
updateInputValue(text);
|
|
2986
|
+
const selectedLabel = selectedItem?.labelText ?? "";
|
|
2987
|
+
const shouldClearSelection = !text.trim() && !allowsCustomValue || currentSelectedKey !== null && text !== selectedLabel;
|
|
2988
|
+
if (shouldClearSelection) {
|
|
2989
|
+
updateSelection(null);
|
|
2990
|
+
}
|
|
2991
|
+
},
|
|
2992
|
+
[
|
|
2993
|
+
updateInputValue,
|
|
2994
|
+
allowsCustomValue,
|
|
2995
|
+
updateSelection,
|
|
2996
|
+
selectedItem,
|
|
2997
|
+
currentSelectedKey
|
|
2998
|
+
]
|
|
2999
|
+
);
|
|
3000
|
+
const handleItemSelection = (0, import_react35.useCallback)(
|
|
3001
|
+
(key, itemLabel) => {
|
|
3002
|
+
if (isDisabled) {
|
|
3003
|
+
return;
|
|
3004
|
+
}
|
|
3005
|
+
updateSelection(key);
|
|
3006
|
+
updateInputValue(itemLabel);
|
|
3007
|
+
setTimeout(() => {
|
|
3008
|
+
import_react_native30.Keyboard.dismiss();
|
|
3009
|
+
setOpen(false);
|
|
3010
|
+
}, 50);
|
|
3011
|
+
},
|
|
3012
|
+
[isDisabled, updateSelection, updateInputValue, setOpen]
|
|
3013
|
+
);
|
|
3014
|
+
const handleCheckmark = (0, import_react35.useCallback)(() => {
|
|
3015
|
+
setOpen(false);
|
|
3016
|
+
}, [setOpen]);
|
|
3017
|
+
const handleClear = (0, import_react35.useCallback)(() => {
|
|
3018
|
+
if (isDisabled) {
|
|
3019
|
+
return;
|
|
3020
|
+
}
|
|
3021
|
+
updateSelection(null);
|
|
3022
|
+
updateInputValue("");
|
|
3023
|
+
onClear?.();
|
|
3024
|
+
}, [isDisabled, updateSelection, updateInputValue, onClear]);
|
|
3025
|
+
const handleTriggerPress = (0, import_react35.useCallback)(() => {
|
|
3026
|
+
if (!isDisabled) {
|
|
3027
|
+
if (selectedItem && !currentInputValue) {
|
|
3028
|
+
updateInputValue(selectedItem.labelText);
|
|
3029
|
+
}
|
|
3030
|
+
setOpen(true);
|
|
3031
|
+
}
|
|
3032
|
+
}, [isDisabled, setOpen, selectedItem, currentInputValue, updateInputValue]);
|
|
3033
|
+
const listItems = filteredItems.map((item) => {
|
|
3034
|
+
const itemProps = item.element.props;
|
|
3035
|
+
const itemDisabled = isDisabled || itemProps.isDisabled;
|
|
3036
|
+
const itemSelected = itemProps.isSelected ?? currentSelectedKey === item.key;
|
|
3037
|
+
const handleItemSelected = () => {
|
|
3038
|
+
if (itemDisabled || itemProps.isReadOnly) {
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3041
|
+
handleItemSelection(item.key, item.labelText);
|
|
3042
|
+
itemProps.onSelected?.();
|
|
3043
|
+
};
|
|
3044
|
+
return import_react35.default.cloneElement(item.element, {
|
|
3045
|
+
key: item.key,
|
|
3046
|
+
isDisabled: itemDisabled,
|
|
3047
|
+
isSelected: itemSelected,
|
|
3048
|
+
onSelected: handleItemSelected
|
|
3049
|
+
});
|
|
3050
|
+
});
|
|
3051
|
+
const showEmptyMessage = !allowsEmptyCollection && listItems.length === 0;
|
|
3052
|
+
const isLabelInside = labelPlacement === "inside";
|
|
3053
|
+
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
3054
|
+
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
3055
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ import_react35.default.createElement(import_react_native30.Text, { style: [styles6.label, labelStyle] }, label) : /* @__PURE__ */ import_react35.default.createElement(import_react_native30.View, null, label) : null;
|
|
3056
|
+
const shouldShowHelper = Boolean(description || errorMessage);
|
|
3057
|
+
const helperContent = isInvalid && errorMessage ? errorMessage : description;
|
|
3058
|
+
const triggerContent = /* @__PURE__ */ import_react35.default.createElement(
|
|
3059
|
+
AutocompleteTrigger,
|
|
3060
|
+
{
|
|
3061
|
+
triggerRef,
|
|
3062
|
+
isDisabled,
|
|
3063
|
+
currentSelectedKey,
|
|
3064
|
+
currentInputValue,
|
|
3065
|
+
displayValue,
|
|
3066
|
+
sizeStyles,
|
|
3067
|
+
radiusStyles,
|
|
3068
|
+
variantStyles,
|
|
3069
|
+
theme,
|
|
3070
|
+
isClearable,
|
|
3071
|
+
label: renderLabel,
|
|
3072
|
+
labelText: typeof label === "string" ? label : void 0,
|
|
3073
|
+
isLabelInside,
|
|
3074
|
+
clearIcon,
|
|
3075
|
+
style: customAppearance?.container,
|
|
3076
|
+
textStyle: customAppearance?.text,
|
|
3077
|
+
onPress: handleTriggerPress,
|
|
3078
|
+
onClear: handleClear,
|
|
3079
|
+
onLayout: handleTriggerLayout
|
|
3080
|
+
}
|
|
3081
|
+
);
|
|
3082
|
+
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
3083
|
+
return /* @__PURE__ */ import_react35.default.createElement(import_react_native30.View, { style: [styles6.container, fullWidth ? styles6.fullWidth : styles6.minWidth] }, isLabelOutside && labelBlock, isLabelOutsideLeft ? /* @__PURE__ */ import_react35.default.createElement(import_react_native30.View, { style: styles6.outsideLeftRow }, renderLabel, triggerContent) : triggerContent, shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */ import_react35.default.createElement(import_react_native30.Text, { style: [styles6.helperText, { color: helperColor }] }, helperContent) : /* @__PURE__ */ import_react35.default.createElement(import_react_native30.View, null, helperContent) : null, /* @__PURE__ */ import_react35.default.createElement(
|
|
3084
|
+
AutocompleteDialog,
|
|
3085
|
+
{
|
|
3086
|
+
visible: isOpen,
|
|
3087
|
+
inputValue: currentInputValue,
|
|
3088
|
+
placeholder,
|
|
3089
|
+
title: typeof label === "string" ? label : void 0,
|
|
3090
|
+
themeColor,
|
|
3091
|
+
_triggerLayout: triggerLayout,
|
|
3092
|
+
showCheckmark: false,
|
|
3093
|
+
onInputChange: handleInputChange,
|
|
3094
|
+
onClose: () => setOpen(false),
|
|
3095
|
+
onCheckmark: handleCheckmark
|
|
3096
|
+
},
|
|
3097
|
+
/* @__PURE__ */ import_react35.default.createElement(AutocompleteContext.Provider, { value: { size, themeColor, isDisabled } }, showEmptyMessage ? /* @__PURE__ */ import_react35.default.createElement(import_react_native30.Text, { style: [styles6.emptyMessage, { color: theme.colors.foreground }] }, "No results found") : listItems)
|
|
3098
|
+
));
|
|
3099
|
+
};
|
|
3100
|
+
|
|
3101
|
+
// src/components/autocomplete/autocomplete-item.tsx
|
|
3102
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
3103
|
+
var import_react_native32 = require("react-native");
|
|
3104
|
+
|
|
3105
|
+
// src/components/autocomplete/autocomplete-item.style.ts
|
|
3106
|
+
var import_react_native31 = require("react-native");
|
|
3107
|
+
var styles8 = import_react_native31.StyleSheet.create({
|
|
3108
|
+
item: {
|
|
3109
|
+
flexDirection: "row",
|
|
3110
|
+
alignItems: "center",
|
|
3111
|
+
gap: 8
|
|
3112
|
+
},
|
|
3113
|
+
content: {
|
|
3114
|
+
flex: 1,
|
|
3115
|
+
gap: 2
|
|
3116
|
+
},
|
|
3117
|
+
title: {
|
|
3118
|
+
fontWeight: "500"
|
|
3119
|
+
},
|
|
3120
|
+
description: {
|
|
3121
|
+
opacity: 0.7
|
|
3122
|
+
},
|
|
3123
|
+
disabled: {
|
|
3124
|
+
opacity: 0.5
|
|
3125
|
+
}
|
|
3126
|
+
});
|
|
3127
|
+
|
|
3128
|
+
// src/components/autocomplete/autocomplete-item.hook.ts
|
|
3129
|
+
var import_react36 = require("react");
|
|
3130
|
+
var import_core26 = require("@xaui/core");
|
|
3131
|
+
var useAutocompleteItemSizeStyles = (size) => {
|
|
3132
|
+
const theme = useXUITheme();
|
|
3133
|
+
return (0, import_react36.useMemo)(() => {
|
|
3134
|
+
const sizes = {
|
|
3135
|
+
xs: {
|
|
3136
|
+
paddingVertical: theme.spacing.sm,
|
|
3137
|
+
paddingHorizontal: theme.spacing.sm,
|
|
3138
|
+
titleSize: theme.fontSizes.xs,
|
|
3139
|
+
descriptionSize: theme.fontSizes.xs
|
|
3140
|
+
},
|
|
3141
|
+
sm: {
|
|
3142
|
+
paddingVertical: theme.spacing.sm,
|
|
3143
|
+
paddingHorizontal: theme.spacing.sm,
|
|
3144
|
+
titleSize: theme.fontSizes.sm,
|
|
3145
|
+
descriptionSize: theme.fontSizes.xs
|
|
3146
|
+
},
|
|
3147
|
+
md: {
|
|
3148
|
+
paddingVertical: theme.spacing.sm,
|
|
3149
|
+
paddingHorizontal: theme.spacing.sm,
|
|
3150
|
+
titleSize: theme.fontSizes.md,
|
|
3151
|
+
descriptionSize: theme.fontSizes.xs
|
|
3152
|
+
},
|
|
3153
|
+
lg: {
|
|
3154
|
+
paddingVertical: theme.spacing.sm,
|
|
3155
|
+
paddingHorizontal: theme.spacing.sm,
|
|
3156
|
+
titleSize: theme.fontSizes.lg,
|
|
3157
|
+
descriptionSize: theme.fontSizes.md
|
|
3158
|
+
}
|
|
3159
|
+
};
|
|
3160
|
+
return sizes[size];
|
|
3161
|
+
}, [size, theme]);
|
|
3162
|
+
};
|
|
3163
|
+
var useAutocompleteItemBackgroundColor = (themeColor, isSelected) => {
|
|
3164
|
+
const theme = useXUITheme();
|
|
3165
|
+
const safeThemeColor = (0, import_core26.getSafeThemeColor)(themeColor);
|
|
3166
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
3167
|
+
return (0, import_react36.useMemo)(() => {
|
|
3168
|
+
return "transparent";
|
|
3169
|
+
}, [isSelected, colorScheme]);
|
|
3170
|
+
};
|
|
3171
|
+
var useAutocompleteItemTextColors = () => {
|
|
3172
|
+
const theme = useXUITheme();
|
|
3173
|
+
return (0, import_react36.useMemo)(() => {
|
|
3174
|
+
return {
|
|
3175
|
+
textColor: theme.colors.foreground,
|
|
3176
|
+
descriptionColor: theme.colors.foreground
|
|
3177
|
+
};
|
|
3178
|
+
}, [theme]);
|
|
3179
|
+
};
|
|
3180
|
+
var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
3181
|
+
const theme = useXUITheme();
|
|
3182
|
+
const safeThemeColor = (0, import_core26.getSafeThemeColor)(themeColor);
|
|
3183
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
3184
|
+
return (0, import_react36.useMemo)(() => {
|
|
3185
|
+
if (themeColor === "default") {
|
|
3186
|
+
return theme.colors.primary.main;
|
|
3187
|
+
}
|
|
3188
|
+
return colorScheme.main;
|
|
3189
|
+
}, [themeColor, colorScheme, theme]);
|
|
3190
|
+
};
|
|
3191
|
+
var useAutocompleteItemStyles = (isSelected, _isDisabled) => {
|
|
3192
|
+
const context = (0, import_react36.useContext)(AutocompleteContext);
|
|
3193
|
+
const backgroundColor = useAutocompleteItemBackgroundColor(
|
|
3194
|
+
context.themeColor,
|
|
3195
|
+
isSelected
|
|
3196
|
+
);
|
|
3197
|
+
const { textColor, descriptionColor } = useAutocompleteItemTextColors();
|
|
3198
|
+
const checkmarkColor = useAutocompleteItemCheckmarkColor(context.themeColor);
|
|
3199
|
+
return {
|
|
3200
|
+
backgroundColor,
|
|
3201
|
+
labelColor: textColor,
|
|
3202
|
+
descriptionColor,
|
|
3203
|
+
checkmarkColor
|
|
3204
|
+
};
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
// src/components/autocomplete/autocomplete-item.tsx
|
|
3208
|
+
var defaultSize = "md";
|
|
3209
|
+
var AutocompleteItem = ({
|
|
3210
|
+
label,
|
|
3211
|
+
description,
|
|
3212
|
+
startContent,
|
|
3213
|
+
endContent,
|
|
3214
|
+
selectedIcon: _selectedIcon,
|
|
3215
|
+
isDisabled = false,
|
|
3216
|
+
isSelected = false,
|
|
3217
|
+
isReadOnly = false,
|
|
3218
|
+
customAppearance,
|
|
3219
|
+
onSelected
|
|
3220
|
+
}) => {
|
|
3221
|
+
const context = (0, import_react37.useContext)(AutocompleteContext);
|
|
3222
|
+
const size = context?.size ?? defaultSize;
|
|
3223
|
+
const isItemDisabled = context?.isDisabled ? true : isDisabled;
|
|
3224
|
+
const sizeStyles = useAutocompleteItemSizeStyles(size);
|
|
3225
|
+
const { backgroundColor, labelColor, descriptionColor } = useAutocompleteItemStyles(isSelected, isItemDisabled);
|
|
3226
|
+
const handlePress = () => {
|
|
3227
|
+
if (isItemDisabled || isReadOnly) {
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
onSelected?.();
|
|
3231
|
+
};
|
|
3232
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
|
3233
|
+
import_react_native32.Pressable,
|
|
3234
|
+
{
|
|
3235
|
+
onPress: handlePress,
|
|
3236
|
+
disabled: isItemDisabled,
|
|
3237
|
+
style: [
|
|
3238
|
+
styles8.item,
|
|
3239
|
+
{
|
|
3240
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
3241
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
3242
|
+
backgroundColor
|
|
3243
|
+
},
|
|
3244
|
+
isItemDisabled && styles8.disabled,
|
|
3245
|
+
customAppearance?.container
|
|
3246
|
+
]
|
|
3247
|
+
},
|
|
3248
|
+
startContent,
|
|
3249
|
+
/* @__PURE__ */ import_react37.default.createElement(import_react_native32.View, { style: styles8.content }, /* @__PURE__ */ import_react37.default.createElement(
|
|
3250
|
+
import_react_native32.Text,
|
|
3251
|
+
{
|
|
3252
|
+
style: [
|
|
3253
|
+
styles8.title,
|
|
3254
|
+
{ fontSize: sizeStyles.titleSize, color: labelColor },
|
|
3255
|
+
customAppearance?.text
|
|
3256
|
+
]
|
|
3257
|
+
},
|
|
3258
|
+
label
|
|
3259
|
+
), description && /* @__PURE__ */ import_react37.default.createElement(
|
|
3260
|
+
import_react_native32.Text,
|
|
3261
|
+
{
|
|
3262
|
+
style: [
|
|
3263
|
+
styles8.description,
|
|
3264
|
+
{ fontSize: sizeStyles.descriptionSize, color: descriptionColor }
|
|
3265
|
+
]
|
|
3266
|
+
},
|
|
3267
|
+
description
|
|
3268
|
+
)),
|
|
3269
|
+
endContent
|
|
3270
|
+
);
|
|
3271
|
+
};
|
|
3272
|
+
|
|
3273
|
+
// src/components/datepicker/datepicker.tsx
|
|
3274
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
3275
|
+
var import_react_native42 = require("react-native");
|
|
3276
|
+
|
|
3277
|
+
// src/components/datepicker/datepicker.hook.ts
|
|
3278
|
+
var import_react38 = require("react");
|
|
3279
|
+
var import_core28 = require("@xaui/core");
|
|
3280
|
+
var import_palette3 = require("@xaui/core/palette");
|
|
3281
|
+
var useDatePickerColorScheme = (themeColor) => {
|
|
3282
|
+
const theme = useXUITheme();
|
|
3283
|
+
const safeThemeColor = (0, import_core28.getSafeThemeColor)(themeColor);
|
|
3284
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
3285
|
+
return { theme, colorScheme };
|
|
3286
|
+
};
|
|
3287
|
+
var useDatePickerSizeStyles = (size) => {
|
|
3288
|
+
const theme = useXUITheme();
|
|
3289
|
+
return (0, import_react38.useMemo)(() => {
|
|
3290
|
+
const sizes = {
|
|
3291
|
+
xs: {
|
|
3292
|
+
minHeight: 34,
|
|
3293
|
+
paddingHorizontal: theme.spacing.sm,
|
|
3294
|
+
paddingVertical: theme.spacing.xs,
|
|
3295
|
+
fontSize: theme.fontSizes.xs,
|
|
3296
|
+
labelSize: theme.fontSizes.xs
|
|
3297
|
+
},
|
|
3298
|
+
sm: {
|
|
3299
|
+
minHeight: 38,
|
|
3300
|
+
paddingHorizontal: theme.spacing.md,
|
|
3301
|
+
paddingVertical: theme.spacing.xs,
|
|
3302
|
+
fontSize: theme.fontSizes.sm,
|
|
3303
|
+
labelSize: theme.fontSizes.xs
|
|
3304
|
+
},
|
|
3305
|
+
md: {
|
|
3306
|
+
minHeight: 42,
|
|
3307
|
+
paddingHorizontal: theme.spacing.md,
|
|
3308
|
+
paddingVertical: theme.spacing.sm,
|
|
3309
|
+
fontSize: theme.fontSizes.md,
|
|
3310
|
+
labelSize: theme.fontSizes.sm
|
|
3311
|
+
},
|
|
3312
|
+
lg: {
|
|
3313
|
+
minHeight: 50,
|
|
3314
|
+
paddingHorizontal: theme.spacing.lg,
|
|
3315
|
+
paddingVertical: theme.spacing.md,
|
|
3316
|
+
fontSize: theme.fontSizes.lg,
|
|
3317
|
+
labelSize: theme.fontSizes.md
|
|
3318
|
+
}
|
|
3319
|
+
};
|
|
3320
|
+
return sizes[size];
|
|
3321
|
+
}, [size, theme]);
|
|
3322
|
+
};
|
|
3323
|
+
var useDatePickerRadiusStyles = (radius) => {
|
|
3324
|
+
const theme = useXUITheme();
|
|
3325
|
+
return (0, import_react38.useMemo)(() => {
|
|
3326
|
+
const radii = {
|
|
3327
|
+
none: theme.borderRadius.none,
|
|
3328
|
+
sm: theme.borderRadius.sm,
|
|
3329
|
+
md: theme.borderRadius.md,
|
|
3330
|
+
lg: theme.borderRadius.lg,
|
|
3331
|
+
full: theme.borderRadius.full
|
|
3332
|
+
};
|
|
3333
|
+
return { borderRadius: radii[radius] };
|
|
3334
|
+
}, [radius, theme]);
|
|
3335
|
+
};
|
|
3336
|
+
var useDatePickerVariantStyles = (themeColor, variant, isInvalid) => {
|
|
3337
|
+
const { theme, colorScheme } = useDatePickerColorScheme(themeColor);
|
|
3338
|
+
return (0, import_react38.useMemo)(() => {
|
|
3339
|
+
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
3340
|
+
if ((variant === "outlined" || variant === "faded") && themeColor === "default") {
|
|
3341
|
+
borderColor = import_palette3.colors.gray[300];
|
|
3342
|
+
}
|
|
3343
|
+
const variantStyles = {
|
|
3344
|
+
outlined: {
|
|
3345
|
+
backgroundColor: "transparent",
|
|
3346
|
+
borderWidth: theme.borderWidth.md,
|
|
3347
|
+
borderColor
|
|
3348
|
+
},
|
|
3349
|
+
flat: {
|
|
3350
|
+
backgroundColor: colorScheme.background,
|
|
3351
|
+
borderWidth: 0
|
|
3352
|
+
},
|
|
3353
|
+
light: {
|
|
3354
|
+
backgroundColor: "transparent",
|
|
3355
|
+
borderWidth: 0
|
|
3356
|
+
},
|
|
3357
|
+
faded: {
|
|
3358
|
+
backgroundColor: `${colorScheme.background}90`,
|
|
3359
|
+
borderWidth: theme.borderWidth.md,
|
|
3360
|
+
borderColor
|
|
3361
|
+
},
|
|
3362
|
+
underlined: {
|
|
3363
|
+
backgroundColor: "transparent",
|
|
3364
|
+
borderBottomWidth: theme.borderWidth.md,
|
|
3365
|
+
borderColor
|
|
3366
|
+
}
|
|
3367
|
+
};
|
|
3368
|
+
return variantStyles[variant];
|
|
3369
|
+
}, [variant, theme, colorScheme, isInvalid, themeColor]);
|
|
3370
|
+
};
|
|
3371
|
+
var useDatePickerLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
3372
|
+
const { theme, colorScheme } = useDatePickerColorScheme(themeColor);
|
|
3373
|
+
return (0, import_react38.useMemo)(() => {
|
|
3374
|
+
let baseColor = theme.colors.foreground;
|
|
3375
|
+
if (isInvalid) {
|
|
3376
|
+
baseColor = theme.colors.danger.main;
|
|
3377
|
+
} else if (themeColor !== "default") {
|
|
3378
|
+
baseColor = colorScheme.main;
|
|
3379
|
+
}
|
|
3380
|
+
return {
|
|
3381
|
+
fontSize: labelSize,
|
|
3382
|
+
color: baseColor
|
|
3383
|
+
};
|
|
3384
|
+
}, [isInvalid, labelSize, theme, themeColor, colorScheme]);
|
|
3385
|
+
};
|
|
3386
|
+
var useDatePickerHelperColor = (isInvalid) => {
|
|
3387
|
+
const theme = useXUITheme();
|
|
3388
|
+
return (0, import_react38.useMemo)(() => {
|
|
3389
|
+
if (isInvalid) {
|
|
3390
|
+
return theme.colors.danger.main;
|
|
3391
|
+
}
|
|
3392
|
+
return import_palette3.colors.gray[600];
|
|
3393
|
+
}, [isInvalid, theme]);
|
|
3394
|
+
};
|
|
3395
|
+
|
|
3396
|
+
// src/components/datepicker/datepicker.state.hook.ts
|
|
3397
|
+
var import_react39 = require("react");
|
|
3398
|
+
var useDatePickerState = ({
|
|
3399
|
+
value,
|
|
3400
|
+
defaultValue,
|
|
3401
|
+
onChange
|
|
3402
|
+
}) => {
|
|
3403
|
+
const [internalValue, setInternalValue] = (0, import_react39.useState)(
|
|
3404
|
+
defaultValue ?? null
|
|
3405
|
+
);
|
|
3406
|
+
const selectedDate = value !== void 0 ? value : internalValue;
|
|
3407
|
+
const updateDate = (0, import_react39.useCallback)(
|
|
3408
|
+
(date) => {
|
|
3409
|
+
if (value === void 0) {
|
|
3410
|
+
setInternalValue(date);
|
|
3411
|
+
}
|
|
3412
|
+
onChange?.(date);
|
|
3413
|
+
},
|
|
3414
|
+
[value, onChange]
|
|
3415
|
+
);
|
|
3416
|
+
return { selectedDate, updateDate };
|
|
3417
|
+
};
|
|
3418
|
+
var useDatePickerOpenState = ({
|
|
3419
|
+
isDisabled,
|
|
3420
|
+
onOpenChange,
|
|
3421
|
+
onOpen,
|
|
3422
|
+
onClose
|
|
3423
|
+
}) => {
|
|
3424
|
+
const [isOpen, setInternalOpen] = (0, import_react39.useState)(false);
|
|
3425
|
+
const setOpen = (0, import_react39.useCallback)(
|
|
3426
|
+
(open) => {
|
|
3427
|
+
if (isDisabled && open) return;
|
|
3428
|
+
setInternalOpen(open);
|
|
3429
|
+
onOpenChange?.(open);
|
|
3430
|
+
if (open) {
|
|
3431
|
+
onOpen?.();
|
|
3432
|
+
} else {
|
|
3433
|
+
onClose?.();
|
|
3434
|
+
}
|
|
3435
|
+
},
|
|
3436
|
+
[isDisabled, onOpenChange, onOpen, onClose]
|
|
3437
|
+
);
|
|
3438
|
+
return { isOpen, setOpen };
|
|
3439
|
+
};
|
|
3440
|
+
var useDatePickerViewState = (initialDate) => {
|
|
3441
|
+
const now = /* @__PURE__ */ new Date();
|
|
3442
|
+
const [viewDate, setViewDate] = (0, import_react39.useState)(initialDate ?? now);
|
|
3443
|
+
const [viewMode, setViewMode] = (0, import_react39.useState)("calendar");
|
|
3444
|
+
const goToPreviousMonth = (0, import_react39.useCallback)(() => {
|
|
3445
|
+
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() - 1, 1));
|
|
3446
|
+
}, []);
|
|
3447
|
+
const goToNextMonth = (0, import_react39.useCallback)(() => {
|
|
3448
|
+
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + 1, 1));
|
|
3449
|
+
}, []);
|
|
3450
|
+
const goToYear = (0, import_react39.useCallback)((year) => {
|
|
3451
|
+
setViewDate((prev) => new Date(year, prev.getMonth(), 1));
|
|
3452
|
+
setViewMode("month");
|
|
3453
|
+
}, []);
|
|
3454
|
+
const goToMonth = (0, import_react39.useCallback)((month) => {
|
|
3455
|
+
setViewDate((prev) => new Date(prev.getFullYear(), month, 1));
|
|
3456
|
+
setViewMode("calendar");
|
|
3457
|
+
}, []);
|
|
3458
|
+
const goToToday = (0, import_react39.useCallback)(() => {
|
|
3459
|
+
setViewDate(/* @__PURE__ */ new Date());
|
|
3460
|
+
setViewMode("calendar");
|
|
3461
|
+
}, []);
|
|
3462
|
+
const toggleYearPicker = (0, import_react39.useCallback)(() => {
|
|
3463
|
+
setViewMode((prev) => prev === "year" ? "calendar" : "year");
|
|
3464
|
+
}, []);
|
|
3465
|
+
const syncViewToDate = (0, import_react39.useCallback)((date) => {
|
|
3466
|
+
setViewDate(date);
|
|
3467
|
+
}, []);
|
|
3468
|
+
return {
|
|
3469
|
+
viewDate,
|
|
3470
|
+
viewMode,
|
|
3471
|
+
goToPreviousMonth,
|
|
3472
|
+
goToNextMonth,
|
|
3473
|
+
goToYear,
|
|
3474
|
+
goToMonth,
|
|
3475
|
+
goToToday,
|
|
3476
|
+
toggleYearPicker,
|
|
3477
|
+
syncViewToDate
|
|
3478
|
+
};
|
|
3479
|
+
};
|
|
3480
|
+
|
|
3481
|
+
// src/components/datepicker/datepicker.utils.ts
|
|
3482
|
+
var getWeekdayNames = (locale, firstDayOfWeek) => {
|
|
3483
|
+
const baseDate = new Date(2024, 0, 1);
|
|
3484
|
+
const dayIndex = baseDate.getDay();
|
|
3485
|
+
const offset = firstDayOfWeek - dayIndex;
|
|
3486
|
+
const days = [];
|
|
3487
|
+
for (let i = 0; i < 7; i++) {
|
|
3488
|
+
const date = new Date(2024, 0, 1 + offset + i);
|
|
3489
|
+
days.push(
|
|
3490
|
+
date.toLocaleDateString(locale, { weekday: "short" }).slice(0, 2)
|
|
3491
|
+
);
|
|
3492
|
+
}
|
|
3493
|
+
return days;
|
|
3494
|
+
};
|
|
3495
|
+
var getMonthNames = (locale) => {
|
|
3496
|
+
const months = [];
|
|
3497
|
+
for (let i = 0; i < 12; i++) {
|
|
3498
|
+
const date = new Date(2024, i, 1);
|
|
3499
|
+
months.push(date.toLocaleDateString(locale, { month: "long" }));
|
|
3500
|
+
}
|
|
3501
|
+
return months;
|
|
3502
|
+
};
|
|
3503
|
+
var getMonthName = (month, locale) => {
|
|
3504
|
+
const date = new Date(2024, month, 1);
|
|
3505
|
+
return date.toLocaleDateString(locale, { month: "long" });
|
|
3506
|
+
};
|
|
3507
|
+
var formatDate = (date, locale) => {
|
|
3508
|
+
return date.toLocaleDateString(locale, {
|
|
3509
|
+
year: "numeric",
|
|
3510
|
+
month: "short",
|
|
3511
|
+
day: "numeric"
|
|
3512
|
+
});
|
|
3513
|
+
};
|
|
3514
|
+
var isSameDay = (a, b) => {
|
|
3515
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
3516
|
+
};
|
|
3517
|
+
var isToday = (date) => {
|
|
3518
|
+
return isSameDay(date, /* @__PURE__ */ new Date());
|
|
3519
|
+
};
|
|
3520
|
+
var isDateInRange = (date, minDate, maxDate) => {
|
|
3521
|
+
const normalized = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
3522
|
+
if (minDate) {
|
|
3523
|
+
const minNormalized = new Date(
|
|
3524
|
+
minDate.getFullYear(),
|
|
3525
|
+
minDate.getMonth(),
|
|
3526
|
+
minDate.getDate()
|
|
3527
|
+
);
|
|
3528
|
+
if (normalized < minNormalized) return false;
|
|
3529
|
+
}
|
|
3530
|
+
if (maxDate) {
|
|
3531
|
+
const maxNormalized = new Date(
|
|
3532
|
+
maxDate.getFullYear(),
|
|
3533
|
+
maxDate.getMonth(),
|
|
3534
|
+
maxDate.getDate()
|
|
3535
|
+
);
|
|
3536
|
+
if (normalized > maxNormalized) return false;
|
|
3537
|
+
}
|
|
3538
|
+
return true;
|
|
3539
|
+
};
|
|
3540
|
+
var getCalendarDays = (year, month, firstDayOfWeek, minDate, maxDate) => {
|
|
3541
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
3542
|
+
const lastOfMonth = new Date(year, month + 1, 0);
|
|
3543
|
+
const daysInMonth = lastOfMonth.getDate();
|
|
3544
|
+
let startDayOfWeek = firstOfMonth.getDay() - firstDayOfWeek;
|
|
3545
|
+
if (startDayOfWeek < 0) startDayOfWeek += 7;
|
|
3546
|
+
const days = [];
|
|
3547
|
+
const prevMonth = new Date(year, month, 0);
|
|
3548
|
+
const prevMonthDays = prevMonth.getDate();
|
|
3549
|
+
for (let i = startDayOfWeek - 1; i >= 0; i--) {
|
|
3550
|
+
const day = prevMonthDays - i;
|
|
3551
|
+
const date = new Date(year, month - 1, day);
|
|
3552
|
+
days.push({
|
|
3553
|
+
date,
|
|
3554
|
+
day,
|
|
3555
|
+
isCurrentMonth: false,
|
|
3556
|
+
isToday: isToday(date),
|
|
3557
|
+
isDisabled: !isDateInRange(date, minDate, maxDate)
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
for (let day = 1; day <= daysInMonth; day++) {
|
|
3561
|
+
const date = new Date(year, month, day);
|
|
3562
|
+
days.push({
|
|
3563
|
+
date,
|
|
3564
|
+
day,
|
|
3565
|
+
isCurrentMonth: true,
|
|
3566
|
+
isToday: isToday(date),
|
|
3567
|
+
isDisabled: !isDateInRange(date, minDate, maxDate)
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
const remainingSlots = 42 - days.length;
|
|
3571
|
+
for (let day = 1; day <= remainingSlots; day++) {
|
|
3572
|
+
const date = new Date(year, month + 1, day);
|
|
3573
|
+
days.push({
|
|
3574
|
+
date,
|
|
3575
|
+
day,
|
|
3576
|
+
isCurrentMonth: false,
|
|
3577
|
+
isToday: isToday(date),
|
|
3578
|
+
isDisabled: !isDateInRange(date, minDate, maxDate)
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
return days;
|
|
3582
|
+
};
|
|
3583
|
+
var getYearRange = (minDate, maxDate) => {
|
|
3584
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3585
|
+
const startYear = minDate ? minDate.getFullYear() : currentYear - 50;
|
|
3586
|
+
const endYear = maxDate ? maxDate.getFullYear() : currentYear + 50;
|
|
3587
|
+
const years = [];
|
|
3588
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
3589
|
+
years.push(year);
|
|
3590
|
+
}
|
|
3591
|
+
return years;
|
|
3592
|
+
};
|
|
3593
|
+
var LOCALE_LABELS = {
|
|
3594
|
+
fr: { selectDate: "Choisir une date", today: "Aujourd'hui", confirm: "OK" },
|
|
3595
|
+
de: { selectDate: "Datum ausw\xE4hlen", today: "Heute", confirm: "OK" },
|
|
3596
|
+
es: { selectDate: "Seleccionar fecha", today: "Hoy", confirm: "OK" },
|
|
3597
|
+
it: { selectDate: "Seleziona data", today: "Oggi", confirm: "OK" },
|
|
3598
|
+
pt: { selectDate: "Selecionar data", today: "Hoje", confirm: "OK" },
|
|
3599
|
+
nl: { selectDate: "Datum selecteren", today: "Vandaag", confirm: "OK" },
|
|
3600
|
+
pl: { selectDate: "Wybierz dat\u0119", today: "Dzisiaj", confirm: "OK" },
|
|
3601
|
+
ru: { selectDate: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443", today: "\u0421\u0435\u0433\u043E\u0434\u043D\u044F", confirm: "OK" },
|
|
3602
|
+
ja: { selectDate: "\u65E5\u4ED8\u3092\u9078\u629E", today: "\u4ECA\u65E5", confirm: "OK" },
|
|
3603
|
+
ko: { selectDate: "\uB0A0\uC9DC \uC120\uD0DD", today: "\uC624\uB298", confirm: "\uD655\uC778" },
|
|
3604
|
+
zh: { selectDate: "\u9009\u62E9\u65E5\u671F", today: "\u4ECA\u5929", confirm: "\u786E\u5B9A" },
|
|
3605
|
+
ar: { selectDate: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062A\u0627\u0631\u064A\u062E", today: "\u0627\u0644\u064A\u0648\u0645", confirm: "\u0645\u0648\u0627\u0641\u0642" },
|
|
3606
|
+
tr: { selectDate: "Tarih se\xE7in", today: "Bug\xFCn", confirm: "Tamam" }
|
|
3607
|
+
};
|
|
3608
|
+
var DEFAULT_LABELS = {
|
|
3609
|
+
selectDate: "Select date",
|
|
3610
|
+
today: "Today",
|
|
3611
|
+
confirm: "OK"
|
|
3612
|
+
};
|
|
3613
|
+
var getDatePickerLabels = (locale) => {
|
|
3614
|
+
const baseLocale = locale.split("-")[0].toLowerCase();
|
|
3615
|
+
return LOCALE_LABELS[baseLocale] ?? DEFAULT_LABELS;
|
|
3616
|
+
};
|
|
3617
|
+
var getFirstDayOfWeek = (locale) => {
|
|
3618
|
+
const mondayLocales = [
|
|
3619
|
+
"fr",
|
|
3620
|
+
"de",
|
|
3621
|
+
"es",
|
|
3622
|
+
"it",
|
|
3623
|
+
"pt",
|
|
3624
|
+
"nl",
|
|
3625
|
+
"pl",
|
|
3626
|
+
"ru",
|
|
3627
|
+
"sv",
|
|
3628
|
+
"da",
|
|
3629
|
+
"fi",
|
|
3630
|
+
"nb",
|
|
3631
|
+
"nn",
|
|
3632
|
+
"cs",
|
|
3633
|
+
"sk",
|
|
3634
|
+
"hu",
|
|
3635
|
+
"ro",
|
|
3636
|
+
"bg",
|
|
3637
|
+
"hr",
|
|
3638
|
+
"sl",
|
|
3639
|
+
"uk",
|
|
3640
|
+
"tr",
|
|
3641
|
+
"el",
|
|
3642
|
+
"et",
|
|
3643
|
+
"lt",
|
|
3644
|
+
"lv"
|
|
3645
|
+
];
|
|
3646
|
+
const baseLocale = locale.split("-")[0].toLowerCase();
|
|
3647
|
+
return mondayLocales.includes(baseLocale) ? 1 : 0;
|
|
3648
|
+
};
|
|
3649
|
+
|
|
3650
|
+
// src/components/datepicker/datepicker.style.ts
|
|
3651
|
+
var import_react_native33 = require("react-native");
|
|
3652
|
+
var styles9 = import_react_native33.StyleSheet.create({
|
|
3653
|
+
container: {
|
|
3654
|
+
gap: 6,
|
|
3655
|
+
position: "relative"
|
|
3656
|
+
},
|
|
3657
|
+
fullWidth: {
|
|
3658
|
+
flexShrink: 1,
|
|
3659
|
+
flexBasis: "auto",
|
|
3660
|
+
width: "100%"
|
|
3661
|
+
},
|
|
3662
|
+
minWidth: {
|
|
3663
|
+
minWidth: 170
|
|
3664
|
+
},
|
|
3665
|
+
label: {
|
|
3666
|
+
fontWeight: "500"
|
|
3667
|
+
},
|
|
3668
|
+
trigger: {
|
|
3669
|
+
flexDirection: "row",
|
|
3670
|
+
alignItems: "center",
|
|
3671
|
+
justifyContent: "space-between",
|
|
3672
|
+
gap: 8
|
|
3673
|
+
},
|
|
3674
|
+
triggerContent: {
|
|
3675
|
+
flexDirection: "row",
|
|
3676
|
+
alignItems: "center",
|
|
3677
|
+
flex: 1,
|
|
3678
|
+
gap: 8
|
|
3679
|
+
},
|
|
3680
|
+
triggerText: {
|
|
3681
|
+
flex: 1
|
|
3682
|
+
},
|
|
3683
|
+
clearButton: {
|
|
3684
|
+
padding: 2,
|
|
3685
|
+
paddingLeft: 4,
|
|
3686
|
+
marginRight: -4
|
|
3687
|
+
},
|
|
3688
|
+
helperText: {
|
|
3689
|
+
fontSize: 12
|
|
3690
|
+
},
|
|
3691
|
+
disabled: {
|
|
3692
|
+
opacity: 0.5
|
|
3693
|
+
},
|
|
3694
|
+
outsideLeftRow: {
|
|
3695
|
+
flexDirection: "row",
|
|
3696
|
+
alignItems: "center",
|
|
3697
|
+
gap: 12
|
|
3698
|
+
}
|
|
3699
|
+
});
|
|
3700
|
+
|
|
3701
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog.tsx
|
|
3702
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
3703
|
+
var import_react_native40 = require("react-native");
|
|
3704
|
+
var import_react_native_gesture_handler2 = require("react-native-gesture-handler");
|
|
3705
|
+
|
|
3706
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog.animation.ts
|
|
3707
|
+
var import_react40 = require("react");
|
|
3708
|
+
var import_react_native34 = require("react-native");
|
|
3709
|
+
var useDatePickerDialogAnimation = ({
|
|
3710
|
+
visible,
|
|
3711
|
+
fadeAnim,
|
|
3712
|
+
slideAnim,
|
|
3713
|
+
scaleAnim,
|
|
3714
|
+
onCloseComplete
|
|
3715
|
+
}) => {
|
|
3716
|
+
const [shouldRender, setShouldRender] = (0, import_react40.useState)(false);
|
|
3717
|
+
const isClosingRef = (0, import_react40.useRef)(false);
|
|
3718
|
+
(0, import_react40.useEffect)(() => {
|
|
3719
|
+
if (visible) {
|
|
3720
|
+
setShouldRender(true);
|
|
3721
|
+
isClosingRef.current = false;
|
|
3722
|
+
import_react_native34.Animated.parallel([
|
|
3723
|
+
import_react_native34.Animated.timing(fadeAnim, {
|
|
3724
|
+
toValue: 1,
|
|
3725
|
+
duration: 220,
|
|
3726
|
+
useNativeDriver: true
|
|
3727
|
+
}),
|
|
3728
|
+
import_react_native34.Animated.spring(slideAnim, {
|
|
3729
|
+
toValue: 1,
|
|
3730
|
+
useNativeDriver: true,
|
|
3731
|
+
damping: 20,
|
|
3732
|
+
stiffness: 300,
|
|
3733
|
+
mass: 0.8
|
|
3734
|
+
}),
|
|
3735
|
+
import_react_native34.Animated.spring(scaleAnim, {
|
|
3736
|
+
toValue: 1,
|
|
3737
|
+
useNativeDriver: true,
|
|
3738
|
+
damping: 18,
|
|
3739
|
+
stiffness: 280,
|
|
3740
|
+
mass: 0.8
|
|
3741
|
+
})
|
|
3742
|
+
]).start();
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3745
|
+
if (!shouldRender || isClosingRef.current) return;
|
|
3746
|
+
isClosingRef.current = true;
|
|
3747
|
+
import_react_native34.Animated.parallel([
|
|
3748
|
+
import_react_native34.Animated.timing(fadeAnim, {
|
|
3749
|
+
toValue: 0,
|
|
3750
|
+
duration: 180,
|
|
3751
|
+
easing: import_react_native34.Easing.out(import_react_native34.Easing.ease),
|
|
3752
|
+
useNativeDriver: true
|
|
3753
|
+
}),
|
|
3754
|
+
import_react_native34.Animated.timing(slideAnim, {
|
|
3755
|
+
toValue: 0,
|
|
3756
|
+
duration: 180,
|
|
3757
|
+
easing: import_react_native34.Easing.out(import_react_native34.Easing.ease),
|
|
3758
|
+
useNativeDriver: true
|
|
3759
|
+
}),
|
|
3760
|
+
import_react_native34.Animated.timing(scaleAnim, {
|
|
3761
|
+
toValue: 0,
|
|
3762
|
+
duration: 180,
|
|
3763
|
+
easing: import_react_native34.Easing.out(import_react_native34.Easing.ease),
|
|
3764
|
+
useNativeDriver: true
|
|
3765
|
+
})
|
|
3766
|
+
]).start(() => {
|
|
3767
|
+
setShouldRender(false);
|
|
3768
|
+
isClosingRef.current = false;
|
|
3769
|
+
onCloseComplete();
|
|
3770
|
+
});
|
|
3771
|
+
}, [visible, fadeAnim, slideAnim, scaleAnim, shouldRender, onCloseComplete]);
|
|
3772
|
+
return { shouldRender };
|
|
3773
|
+
};
|
|
3774
|
+
var useViewTransitionAnimation = ({
|
|
3775
|
+
fadeAnim
|
|
3776
|
+
}) => {
|
|
3777
|
+
const animate = (0, import_react40.useCallback)(() => {
|
|
3778
|
+
fadeAnim.setValue(0);
|
|
3779
|
+
import_react_native34.Animated.timing(fadeAnim, {
|
|
3780
|
+
toValue: 1,
|
|
3781
|
+
duration: 200,
|
|
3782
|
+
useNativeDriver: true
|
|
3783
|
+
}).start();
|
|
3784
|
+
}, [fadeAnim]);
|
|
3785
|
+
return { animate };
|
|
3786
|
+
};
|
|
3787
|
+
var useMonthSlideAnimation = ({
|
|
3788
|
+
slideAnim,
|
|
3789
|
+
fadeAnim
|
|
3790
|
+
}) => {
|
|
3791
|
+
const animate = (0, import_react40.useCallback)(
|
|
3792
|
+
(direction) => {
|
|
3793
|
+
const startX = direction === "right" ? 60 : -60;
|
|
3794
|
+
slideAnim.setValue(startX);
|
|
3795
|
+
fadeAnim.setValue(0);
|
|
3796
|
+
import_react_native34.Animated.parallel([
|
|
3797
|
+
import_react_native34.Animated.spring(slideAnim, {
|
|
3798
|
+
toValue: 0,
|
|
3799
|
+
useNativeDriver: true,
|
|
3800
|
+
damping: 22,
|
|
3801
|
+
stiffness: 280,
|
|
3802
|
+
mass: 0.7
|
|
3803
|
+
}),
|
|
3804
|
+
import_react_native34.Animated.timing(fadeAnim, {
|
|
3805
|
+
toValue: 1,
|
|
3806
|
+
duration: 180,
|
|
3807
|
+
useNativeDriver: true
|
|
3808
|
+
})
|
|
3809
|
+
]).start();
|
|
3810
|
+
},
|
|
3811
|
+
[slideAnim, fadeAnim]
|
|
3812
|
+
);
|
|
3813
|
+
return { animate };
|
|
3814
|
+
};
|
|
3815
|
+
|
|
3816
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog-calendar.tsx
|
|
3817
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
3818
|
+
var import_react_native36 = require("react-native");
|
|
3819
|
+
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
3820
|
+
|
|
3821
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog.style.ts
|
|
3822
|
+
var import_react_native35 = require("react-native");
|
|
3823
|
+
var styles10 = import_react_native35.StyleSheet.create({
|
|
3824
|
+
backdrop: {
|
|
3825
|
+
...import_react_native35.StyleSheet.absoluteFillObject,
|
|
3826
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
1502
3827
|
},
|
|
1503
|
-
|
|
3828
|
+
dialogContainer: {
|
|
1504
3829
|
flex: 1,
|
|
1505
|
-
|
|
1506
|
-
|
|
3830
|
+
justifyContent: "center",
|
|
3831
|
+
alignItems: "center",
|
|
3832
|
+
zIndex: 1,
|
|
3833
|
+
paddingHorizontal: 24
|
|
3834
|
+
},
|
|
3835
|
+
container: {
|
|
3836
|
+
width: "100%",
|
|
3837
|
+
maxWidth: 360,
|
|
3838
|
+
borderRadius: 16,
|
|
3839
|
+
overflow: "hidden",
|
|
3840
|
+
elevation: 6,
|
|
3841
|
+
shadowColor: "#000",
|
|
3842
|
+
shadowOffset: { width: 0, height: 2 },
|
|
3843
|
+
shadowOpacity: 0.25,
|
|
3844
|
+
shadowRadius: 8
|
|
1507
3845
|
},
|
|
1508
3846
|
header: {
|
|
1509
|
-
|
|
3847
|
+
paddingHorizontal: 24,
|
|
3848
|
+
paddingTop: 16,
|
|
3849
|
+
paddingBottom: 12
|
|
1510
3850
|
},
|
|
1511
|
-
|
|
3851
|
+
headerLabel: {
|
|
3852
|
+
fontSize: 12,
|
|
3853
|
+
fontWeight: "500",
|
|
3854
|
+
textTransform: "uppercase",
|
|
3855
|
+
letterSpacing: 0.5,
|
|
3856
|
+
marginBottom: 8
|
|
3857
|
+
},
|
|
3858
|
+
headerDateRow: {
|
|
1512
3859
|
flexDirection: "row",
|
|
1513
3860
|
alignItems: "center",
|
|
1514
|
-
|
|
1515
|
-
marginBottom: 16
|
|
3861
|
+
justifyContent: "space-between"
|
|
1516
3862
|
},
|
|
1517
|
-
|
|
1518
|
-
|
|
3863
|
+
headerDate: {
|
|
3864
|
+
fontSize: 24,
|
|
3865
|
+
fontWeight: "400"
|
|
1519
3866
|
},
|
|
1520
|
-
|
|
1521
|
-
|
|
3867
|
+
navigationRow: {
|
|
3868
|
+
flexDirection: "row",
|
|
3869
|
+
alignItems: "center",
|
|
3870
|
+
justifyContent: "space-between",
|
|
3871
|
+
paddingHorizontal: 12,
|
|
3872
|
+
paddingVertical: 8
|
|
3873
|
+
},
|
|
3874
|
+
monthYearButton: {
|
|
3875
|
+
flexDirection: "row",
|
|
3876
|
+
alignItems: "center",
|
|
3877
|
+
gap: 4,
|
|
3878
|
+
paddingVertical: 8,
|
|
3879
|
+
paddingHorizontal: 12,
|
|
3880
|
+
borderRadius: 20
|
|
3881
|
+
},
|
|
3882
|
+
monthYearText: {
|
|
3883
|
+
fontSize: 14,
|
|
1522
3884
|
fontWeight: "600"
|
|
1523
3885
|
},
|
|
1524
|
-
|
|
3886
|
+
navButtons: {
|
|
1525
3887
|
flexDirection: "row",
|
|
1526
3888
|
alignItems: "center",
|
|
1527
|
-
gap:
|
|
3889
|
+
gap: 4
|
|
1528
3890
|
},
|
|
1529
|
-
|
|
1530
|
-
|
|
3891
|
+
navButton: {
|
|
3892
|
+
padding: 8,
|
|
3893
|
+
borderRadius: 20
|
|
3894
|
+
},
|
|
3895
|
+
calendarGrid: {
|
|
3896
|
+
paddingHorizontal: 12
|
|
3897
|
+
},
|
|
3898
|
+
weekdayRow: {
|
|
3899
|
+
flexDirection: "row",
|
|
3900
|
+
justifyContent: "space-around",
|
|
3901
|
+
marginBottom: 4
|
|
3902
|
+
},
|
|
3903
|
+
weekdayCell: {
|
|
3904
|
+
width: 44,
|
|
3905
|
+
height: 32,
|
|
3906
|
+
justifyContent: "center",
|
|
3907
|
+
alignItems: "center"
|
|
3908
|
+
},
|
|
3909
|
+
weekdayText: {
|
|
3910
|
+
fontSize: 12,
|
|
3911
|
+
fontWeight: "500"
|
|
3912
|
+
},
|
|
3913
|
+
dayRow: {
|
|
3914
|
+
flexDirection: "row",
|
|
3915
|
+
justifyContent: "space-around"
|
|
3916
|
+
},
|
|
3917
|
+
dayCell: {
|
|
3918
|
+
width: 44,
|
|
3919
|
+
height: 44,
|
|
3920
|
+
justifyContent: "center",
|
|
3921
|
+
alignItems: "center",
|
|
3922
|
+
borderRadius: 22
|
|
3923
|
+
},
|
|
3924
|
+
dayText: {
|
|
3925
|
+
fontSize: 14
|
|
3926
|
+
},
|
|
3927
|
+
todayCell: {
|
|
3928
|
+
borderWidth: 1
|
|
3929
|
+
},
|
|
3930
|
+
selectedCell: {
|
|
3931
|
+
borderWidth: 0
|
|
3932
|
+
},
|
|
3933
|
+
selectedCellInner: {
|
|
3934
|
+
width: 44,
|
|
3935
|
+
height: 44,
|
|
3936
|
+
justifyContent: "center",
|
|
3937
|
+
alignItems: "center",
|
|
3938
|
+
borderRadius: 22
|
|
3939
|
+
},
|
|
3940
|
+
disabledText: {
|
|
3941
|
+
opacity: 0.3
|
|
3942
|
+
},
|
|
3943
|
+
otherMonthText: {
|
|
3944
|
+
opacity: 0.4
|
|
3945
|
+
},
|
|
3946
|
+
footer: {
|
|
1531
3947
|
flexDirection: "row",
|
|
3948
|
+
justifyContent: "flex-end",
|
|
1532
3949
|
alignItems: "center",
|
|
1533
|
-
|
|
3950
|
+
gap: 8,
|
|
3951
|
+
paddingHorizontal: 12,
|
|
3952
|
+
paddingVertical: 12
|
|
1534
3953
|
},
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
paddingVertical: 12,
|
|
3954
|
+
footerButton: {
|
|
3955
|
+
paddingVertical: 10,
|
|
1538
3956
|
paddingHorizontal: 16,
|
|
1539
|
-
|
|
1540
|
-
borderRadius: 8,
|
|
1541
|
-
fontSize: 16
|
|
3957
|
+
borderRadius: 20
|
|
1542
3958
|
},
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
padding: 4
|
|
3959
|
+
footerButtonText: {
|
|
3960
|
+
fontSize: 14,
|
|
3961
|
+
fontWeight: "600"
|
|
1547
3962
|
},
|
|
1548
|
-
|
|
1549
|
-
|
|
3963
|
+
yearPickerContainer: {
|
|
3964
|
+
paddingHorizontal: 12,
|
|
3965
|
+
height: 280
|
|
1550
3966
|
},
|
|
1551
|
-
|
|
1552
|
-
|
|
3967
|
+
yearGrid: {
|
|
3968
|
+
flexDirection: "row",
|
|
3969
|
+
flexWrap: "wrap",
|
|
3970
|
+
justifyContent: "center",
|
|
3971
|
+
gap: 4
|
|
1553
3972
|
},
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
3973
|
+
yearCell: {
|
|
3974
|
+
width: 76,
|
|
3975
|
+
height: 44,
|
|
3976
|
+
justifyContent: "center",
|
|
3977
|
+
alignItems: "center",
|
|
3978
|
+
borderRadius: 22,
|
|
3979
|
+
margin: 2
|
|
1558
3980
|
},
|
|
1559
|
-
|
|
1560
|
-
width:
|
|
1561
|
-
height:
|
|
1562
|
-
borderRadius: 27,
|
|
3981
|
+
yearCellInner: {
|
|
3982
|
+
width: 76,
|
|
3983
|
+
height: 44,
|
|
1563
3984
|
justifyContent: "center",
|
|
1564
3985
|
alignItems: "center",
|
|
1565
|
-
|
|
3986
|
+
borderRadius: 22
|
|
3987
|
+
},
|
|
3988
|
+
yearText: {
|
|
3989
|
+
fontSize: 14
|
|
3990
|
+
},
|
|
3991
|
+
monthPickerContainer: {
|
|
3992
|
+
paddingHorizontal: 24,
|
|
3993
|
+
paddingVertical: 8
|
|
3994
|
+
},
|
|
3995
|
+
monthGrid: {
|
|
3996
|
+
flexDirection: "row",
|
|
3997
|
+
flexWrap: "wrap",
|
|
3998
|
+
justifyContent: "center",
|
|
3999
|
+
gap: 8
|
|
4000
|
+
},
|
|
4001
|
+
monthCell: {
|
|
4002
|
+
width: 90,
|
|
4003
|
+
height: 44,
|
|
4004
|
+
justifyContent: "center",
|
|
4005
|
+
alignItems: "center",
|
|
4006
|
+
borderRadius: 22
|
|
4007
|
+
},
|
|
4008
|
+
monthCellInner: {
|
|
4009
|
+
width: 90,
|
|
4010
|
+
height: 44,
|
|
4011
|
+
justifyContent: "center",
|
|
4012
|
+
alignItems: "center",
|
|
4013
|
+
borderRadius: 22
|
|
4014
|
+
},
|
|
4015
|
+
monthText: {
|
|
4016
|
+
fontSize: 14
|
|
1566
4017
|
}
|
|
1567
4018
|
});
|
|
1568
4019
|
|
|
1569
|
-
// src/components/dialogs/
|
|
1570
|
-
var
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
4020
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog-calendar.tsx
|
|
4021
|
+
var AnimatedDayCell = ({
|
|
4022
|
+
isSelected,
|
|
4023
|
+
isToday: isToday2,
|
|
4024
|
+
isCurrentMonth,
|
|
4025
|
+
isDisabled,
|
|
4026
|
+
day,
|
|
4027
|
+
date,
|
|
4028
|
+
locale,
|
|
4029
|
+
themeColor,
|
|
4030
|
+
onSelectDay
|
|
4031
|
+
}) => {
|
|
4032
|
+
const theme = useXUITheme();
|
|
4033
|
+
const colorScheme = theme.colors[themeColor] ?? theme.colors.primary;
|
|
4034
|
+
const isDefault = themeColor === "default";
|
|
4035
|
+
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
4036
|
+
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
4037
|
+
const scaleAnim = (0, import_react41.useRef)(new import_react_native36.Animated.Value(isSelected ? 1 : 0)).current;
|
|
4038
|
+
(0, import_react41.useEffect)(() => {
|
|
4039
|
+
if (isSelected) {
|
|
4040
|
+
scaleAnim.setValue(0.92);
|
|
4041
|
+
import_react_native36.Animated.spring(scaleAnim, {
|
|
4042
|
+
toValue: 1,
|
|
4043
|
+
useNativeDriver: true,
|
|
4044
|
+
damping: 20,
|
|
4045
|
+
stiffness: 300,
|
|
4046
|
+
mass: 0.6
|
|
4047
|
+
}).start();
|
|
4048
|
+
} else {
|
|
4049
|
+
scaleAnim.setValue(0);
|
|
4050
|
+
}
|
|
4051
|
+
}, [isSelected, scaleAnim]);
|
|
4052
|
+
const animatedStyle = isSelected ? { transform: [{ scale: scaleAnim }] } : void 0;
|
|
4053
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
|
4054
|
+
import_react_native36.Pressable,
|
|
4055
|
+
{
|
|
4056
|
+
style: [
|
|
4057
|
+
styles10.dayCell,
|
|
4058
|
+
isToday2 && !isSelected && {
|
|
4059
|
+
...styles10.todayCell,
|
|
4060
|
+
borderColor: accentColor
|
|
4061
|
+
}
|
|
4062
|
+
],
|
|
4063
|
+
onPress: () => {
|
|
4064
|
+
if (!isDisabled) {
|
|
4065
|
+
onSelectDay(date);
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
4068
|
+
disabled: isDisabled,
|
|
4069
|
+
accessibilityLabel: date.toLocaleDateString(locale),
|
|
4070
|
+
accessibilityRole: "button",
|
|
4071
|
+
accessibilityState: {
|
|
4072
|
+
selected: isSelected,
|
|
4073
|
+
disabled: isDisabled
|
|
4074
|
+
}
|
|
4075
|
+
},
|
|
4076
|
+
isSelected ? /* @__PURE__ */ import_react41.default.createElement(
|
|
4077
|
+
import_react_native36.Animated.View,
|
|
4078
|
+
{
|
|
4079
|
+
style: [
|
|
4080
|
+
styles10.selectedCellInner,
|
|
4081
|
+
{ backgroundColor: accentColor },
|
|
4082
|
+
animatedStyle
|
|
4083
|
+
]
|
|
4084
|
+
},
|
|
4085
|
+
/* @__PURE__ */ import_react41.default.createElement(import_react_native36.Text, { style: [styles10.dayText, { color: accentFg }] }, day)
|
|
4086
|
+
) : /* @__PURE__ */ import_react41.default.createElement(
|
|
4087
|
+
import_react_native36.Text,
|
|
4088
|
+
{
|
|
4089
|
+
style: [
|
|
4090
|
+
styles10.dayText,
|
|
4091
|
+
{ color: theme.colors.foreground },
|
|
4092
|
+
!isCurrentMonth && styles10.otherMonthText,
|
|
4093
|
+
isDisabled && styles10.disabledText,
|
|
4094
|
+
isToday2 && {
|
|
4095
|
+
color: accentColor,
|
|
4096
|
+
fontWeight: "600"
|
|
4097
|
+
}
|
|
4098
|
+
]
|
|
4099
|
+
},
|
|
4100
|
+
day
|
|
4101
|
+
)
|
|
4102
|
+
);
|
|
1576
4103
|
};
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
onBlur
|
|
4104
|
+
var DatePickerDialogCalendar = ({
|
|
4105
|
+
viewDate,
|
|
4106
|
+
selectedDate,
|
|
4107
|
+
locale,
|
|
4108
|
+
firstDayOfWeek,
|
|
4109
|
+
themeColor,
|
|
4110
|
+
minDate,
|
|
4111
|
+
maxDate,
|
|
4112
|
+
onSelectDay,
|
|
4113
|
+
onPreviousMonth,
|
|
4114
|
+
onNextMonth
|
|
1589
4115
|
}) => {
|
|
1590
4116
|
const theme = useXUITheme();
|
|
1591
|
-
|
|
1592
|
-
|
|
4117
|
+
const swipeHandledRef = (0, import_react41.useRef)(false);
|
|
4118
|
+
const weekdays = (0, import_react41.useMemo)(
|
|
4119
|
+
() => getWeekdayNames(locale, firstDayOfWeek),
|
|
4120
|
+
[locale, firstDayOfWeek]
|
|
4121
|
+
);
|
|
4122
|
+
const days = (0, import_react41.useMemo)(
|
|
4123
|
+
() => getCalendarDays(
|
|
4124
|
+
viewDate.getFullYear(),
|
|
4125
|
+
viewDate.getMonth(),
|
|
4126
|
+
firstDayOfWeek,
|
|
4127
|
+
minDate,
|
|
4128
|
+
maxDate
|
|
4129
|
+
),
|
|
4130
|
+
[viewDate, firstDayOfWeek, minDate, maxDate]
|
|
4131
|
+
);
|
|
4132
|
+
const weeks = (0, import_react41.useMemo)(() => {
|
|
4133
|
+
const result = [];
|
|
4134
|
+
for (let i = 0; i < days.length; i += 7) {
|
|
4135
|
+
result.push(days.slice(i, i + 7));
|
|
4136
|
+
}
|
|
4137
|
+
return result;
|
|
4138
|
+
}, [days]);
|
|
4139
|
+
const onSwipeEnd = (event) => {
|
|
4140
|
+
const { state, translationX, velocityX } = event.nativeEvent;
|
|
4141
|
+
if (state !== import_react_native_gesture_handler.State.END || swipeHandledRef.current) return;
|
|
4142
|
+
const shouldSwipe = Math.abs(translationX) > 40 || Math.abs(velocityX) > 600;
|
|
4143
|
+
if (!shouldSwipe) return;
|
|
4144
|
+
swipeHandledRef.current = true;
|
|
4145
|
+
if (translationX < 0) {
|
|
4146
|
+
onNextMonth();
|
|
4147
|
+
} else {
|
|
4148
|
+
onPreviousMonth();
|
|
4149
|
+
}
|
|
4150
|
+
};
|
|
4151
|
+
const onSwipeStateChange = (event) => {
|
|
4152
|
+
if (event.nativeEvent.state === import_react_native_gesture_handler.State.BEGAN) {
|
|
4153
|
+
swipeHandledRef.current = false;
|
|
4154
|
+
}
|
|
4155
|
+
onSwipeEnd(event);
|
|
4156
|
+
};
|
|
4157
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
|
4158
|
+
import_react_native_gesture_handler.PanGestureHandler,
|
|
1593
4159
|
{
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
4160
|
+
activeOffsetX: [-12, 12],
|
|
4161
|
+
failOffsetY: [-12, 12],
|
|
4162
|
+
onHandlerStateChange: onSwipeStateChange
|
|
4163
|
+
},
|
|
4164
|
+
/* @__PURE__ */ import_react41.default.createElement(import_react_native36.View, { style: styles10.calendarGrid }, /* @__PURE__ */ import_react41.default.createElement(import_react_native36.View, { style: styles10.weekdayRow }, weekdays.map((day, index) => /* @__PURE__ */ import_react41.default.createElement(import_react_native36.View, { key: index, style: styles10.weekdayCell }, /* @__PURE__ */ import_react41.default.createElement(
|
|
4165
|
+
import_react_native36.Text,
|
|
4166
|
+
{
|
|
4167
|
+
style: [
|
|
4168
|
+
styles10.weekdayText,
|
|
4169
|
+
{ color: theme.colors.foreground, opacity: 0.6 }
|
|
4170
|
+
]
|
|
4171
|
+
},
|
|
4172
|
+
day
|
|
4173
|
+
)))), weeks.map((week, weekIndex) => /* @__PURE__ */ import_react41.default.createElement(import_react_native36.View, { key: weekIndex, style: styles10.dayRow }, week.map((dayInfo, dayIndex) => /* @__PURE__ */ import_react41.default.createElement(
|
|
4174
|
+
AnimatedDayCell,
|
|
4175
|
+
{
|
|
4176
|
+
key: dayIndex,
|
|
4177
|
+
isSelected: !!(selectedDate && isSameDay(dayInfo.date, selectedDate)),
|
|
4178
|
+
isToday: dayInfo.isToday,
|
|
4179
|
+
isCurrentMonth: dayInfo.isCurrentMonth,
|
|
4180
|
+
isDisabled: dayInfo.isDisabled,
|
|
4181
|
+
day: dayInfo.day,
|
|
4182
|
+
date: dayInfo.date,
|
|
4183
|
+
locale,
|
|
4184
|
+
themeColor,
|
|
4185
|
+
onSelectDay
|
|
4186
|
+
}
|
|
4187
|
+
)))))
|
|
4188
|
+
);
|
|
4189
|
+
};
|
|
4190
|
+
|
|
4191
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog-header.tsx
|
|
4192
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
4193
|
+
var import_react_native37 = require("react-native");
|
|
4194
|
+
var DatePickerDialogHeader = ({
|
|
4195
|
+
viewDate,
|
|
4196
|
+
selectedDate,
|
|
4197
|
+
locale,
|
|
4198
|
+
themeColor,
|
|
4199
|
+
selectDateLabel,
|
|
4200
|
+
onClearValue,
|
|
4201
|
+
onPreviousMonth,
|
|
4202
|
+
onNextMonth,
|
|
4203
|
+
onToggleYearPicker
|
|
4204
|
+
}) => {
|
|
4205
|
+
const theme = useXUITheme();
|
|
4206
|
+
const colorScheme = theme.colors[themeColor] ?? theme.colors.primary;
|
|
4207
|
+
const dateText = (0, import_react42.useMemo)(() => {
|
|
4208
|
+
if (!selectedDate) return "---";
|
|
4209
|
+
return formatDate(selectedDate, locale);
|
|
4210
|
+
}, [selectedDate, locale]);
|
|
4211
|
+
const monthYearLabel = (0, import_react42.useMemo)(() => {
|
|
4212
|
+
const month = getMonthName(viewDate.getMonth(), locale);
|
|
4213
|
+
return `${month} ${viewDate.getFullYear()}`;
|
|
4214
|
+
}, [viewDate, locale]);
|
|
4215
|
+
return /* @__PURE__ */ import_react42.default.createElement(import_react42.default.Fragment, null, /* @__PURE__ */ import_react42.default.createElement(import_react_native37.View, { style: [styles10.header, { backgroundColor: colorScheme.main }] }, /* @__PURE__ */ import_react42.default.createElement(import_react_native37.Text, { style: [styles10.headerLabel, { color: colorScheme.foreground }] }, selectDateLabel), /* @__PURE__ */ import_react42.default.createElement(import_react_native37.View, { style: styles10.headerDateRow }, /* @__PURE__ */ import_react42.default.createElement(import_react_native37.Text, { style: [styles10.headerDate, { color: colorScheme.foreground }] }, dateText), /* @__PURE__ */ import_react42.default.createElement(
|
|
4216
|
+
import_react_native37.Pressable,
|
|
4217
|
+
{
|
|
4218
|
+
onPress: onClearValue,
|
|
4219
|
+
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 },
|
|
4220
|
+
accessibilityLabel: "Clear date",
|
|
1597
4221
|
accessibilityRole: "button"
|
|
1598
4222
|
},
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
)
|
|
1601
|
-
|
|
4223
|
+
/* @__PURE__ */ import_react42.default.createElement(CloseIcon, { size: 20, color: colorScheme.foreground })
|
|
4224
|
+
))), /* @__PURE__ */ import_react42.default.createElement(import_react_native37.View, { style: styles10.navigationRow }, /* @__PURE__ */ import_react42.default.createElement(
|
|
4225
|
+
import_react_native37.Pressable,
|
|
1602
4226
|
{
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
}
|
|
1625
|
-
), inputValue ? /* @__PURE__ */ import_react23.default.createElement(
|
|
1626
|
-
import_react_native18.Pressable,
|
|
4227
|
+
style: styles10.monthYearButton,
|
|
4228
|
+
onPress: onToggleYearPicker,
|
|
4229
|
+
accessibilityLabel: `${monthYearLabel}, tap to change`,
|
|
4230
|
+
accessibilityRole: "button"
|
|
4231
|
+
},
|
|
4232
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
4233
|
+
import_react_native37.Text,
|
|
4234
|
+
{
|
|
4235
|
+
style: [styles10.monthYearText, { color: theme.colors.foreground }]
|
|
4236
|
+
},
|
|
4237
|
+
monthYearLabel
|
|
4238
|
+
),
|
|
4239
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
4240
|
+
ChevronDownIcon,
|
|
4241
|
+
{
|
|
4242
|
+
size: 18,
|
|
4243
|
+
color: theme.colors.foreground
|
|
4244
|
+
}
|
|
4245
|
+
)
|
|
4246
|
+
), /* @__PURE__ */ import_react42.default.createElement(import_react_native37.View, { style: styles10.navButtons }, /* @__PURE__ */ import_react42.default.createElement(
|
|
4247
|
+
import_react_native37.Pressable,
|
|
1627
4248
|
{
|
|
1628
|
-
style:
|
|
1629
|
-
onPress:
|
|
1630
|
-
accessibilityLabel: "
|
|
4249
|
+
style: styles10.navButton,
|
|
4250
|
+
onPress: onPreviousMonth,
|
|
4251
|
+
accessibilityLabel: "Previous month",
|
|
1631
4252
|
accessibilityRole: "button"
|
|
1632
4253
|
},
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
)
|
|
4254
|
+
/* @__PURE__ */ import_react42.default.createElement(ChevronLeftIcon, { size: 20, color: theme.colors.foreground })
|
|
4255
|
+
), /* @__PURE__ */ import_react42.default.createElement(
|
|
4256
|
+
import_react_native37.Pressable,
|
|
4257
|
+
{
|
|
4258
|
+
style: styles10.navButton,
|
|
4259
|
+
onPress: onNextMonth,
|
|
4260
|
+
accessibilityLabel: "Next month",
|
|
4261
|
+
accessibilityRole: "button"
|
|
4262
|
+
},
|
|
4263
|
+
/* @__PURE__ */ import_react42.default.createElement(ChevronRightIcon, { size: 20, color: theme.colors.foreground })
|
|
4264
|
+
))));
|
|
4265
|
+
};
|
|
4266
|
+
|
|
4267
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog-month-picker.tsx
|
|
4268
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
4269
|
+
var import_react_native38 = require("react-native");
|
|
4270
|
+
var DatePickerDialogMonthPicker = ({ viewDate, locale, themeColor, onSelectMonth }) => {
|
|
4271
|
+
const theme = useXUITheme();
|
|
4272
|
+
const colorScheme = theme.colors[themeColor] ?? theme.colors.primary;
|
|
4273
|
+
const isDefault = themeColor === "default";
|
|
4274
|
+
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
4275
|
+
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
4276
|
+
const months = (0, import_react43.useMemo)(() => getMonthNames(locale), [locale]);
|
|
4277
|
+
const currentMonth = viewDate.getMonth();
|
|
4278
|
+
const groupAnim = (0, import_react43.useRef)(new import_react_native38.Animated.Value(0)).current;
|
|
4279
|
+
(0, import_react43.useEffect)(() => {
|
|
4280
|
+
groupAnim.setValue(0);
|
|
4281
|
+
import_react_native38.Animated.timing(groupAnim, {
|
|
4282
|
+
toValue: 1,
|
|
4283
|
+
duration: 220,
|
|
4284
|
+
easing: import_react_native38.Easing.out(import_react_native38.Easing.cubic),
|
|
4285
|
+
useNativeDriver: true
|
|
4286
|
+
}).start();
|
|
4287
|
+
}, [groupAnim]);
|
|
4288
|
+
return /* @__PURE__ */ import_react43.default.createElement(import_react_native38.View, { style: styles10.monthPickerContainer }, /* @__PURE__ */ import_react43.default.createElement(
|
|
4289
|
+
import_react_native38.Animated.View,
|
|
4290
|
+
{
|
|
4291
|
+
style: {
|
|
4292
|
+
opacity: groupAnim,
|
|
4293
|
+
transform: [
|
|
4294
|
+
{
|
|
4295
|
+
translateY: groupAnim.interpolate({
|
|
4296
|
+
inputRange: [0, 1],
|
|
4297
|
+
outputRange: [12, 0]
|
|
4298
|
+
})
|
|
4299
|
+
}
|
|
4300
|
+
]
|
|
4301
|
+
}
|
|
4302
|
+
},
|
|
4303
|
+
/* @__PURE__ */ import_react43.default.createElement(import_react_native38.View, { style: styles10.monthGrid }, months.map((name, index) => {
|
|
4304
|
+
const isCurrentMonth = index === currentMonth;
|
|
4305
|
+
return /* @__PURE__ */ import_react43.default.createElement(
|
|
4306
|
+
import_react_native38.Pressable,
|
|
4307
|
+
{
|
|
4308
|
+
key: index,
|
|
4309
|
+
style: [
|
|
4310
|
+
styles10.monthCell,
|
|
4311
|
+
isCurrentMonth && { backgroundColor: accentColor }
|
|
4312
|
+
],
|
|
4313
|
+
onPress: () => onSelectMonth(index),
|
|
4314
|
+
accessibilityLabel: name,
|
|
4315
|
+
accessibilityRole: "button",
|
|
4316
|
+
accessibilityState: { selected: isCurrentMonth }
|
|
4317
|
+
},
|
|
4318
|
+
/* @__PURE__ */ import_react43.default.createElement(
|
|
4319
|
+
import_react_native38.Text,
|
|
4320
|
+
{
|
|
4321
|
+
style: [
|
|
4322
|
+
styles10.monthText,
|
|
4323
|
+
{ color: theme.colors.foreground },
|
|
4324
|
+
isCurrentMonth && {
|
|
4325
|
+
color: accentFg,
|
|
4326
|
+
fontWeight: "600"
|
|
4327
|
+
}
|
|
4328
|
+
]
|
|
4329
|
+
},
|
|
4330
|
+
name
|
|
4331
|
+
)
|
|
4332
|
+
);
|
|
4333
|
+
}))
|
|
4334
|
+
));
|
|
1635
4335
|
};
|
|
1636
4336
|
|
|
1637
|
-
// src/components/dialogs/
|
|
1638
|
-
var
|
|
1639
|
-
var
|
|
1640
|
-
var
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
4337
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog-year-picker.tsx
|
|
4338
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
4339
|
+
var import_react_native39 = require("react-native");
|
|
4340
|
+
var ITEM_HEIGHT = 48;
|
|
4341
|
+
var NUM_COLUMNS = 4;
|
|
4342
|
+
var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSelectYear }) => {
|
|
4343
|
+
const listRef = (0, import_react44.useRef)(null);
|
|
4344
|
+
const groupAnim = (0, import_react44.useRef)(new import_react_native39.Animated.Value(0)).current;
|
|
4345
|
+
const theme = useXUITheme();
|
|
4346
|
+
const colorScheme = theme.colors[themeColor] ?? theme.colors.primary;
|
|
4347
|
+
const isDefault = themeColor === "default";
|
|
4348
|
+
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
4349
|
+
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
4350
|
+
const years = (0, import_react44.useMemo)(
|
|
4351
|
+
() => getYearRange(minDate, maxDate),
|
|
4352
|
+
[minDate, maxDate]
|
|
4353
|
+
);
|
|
4354
|
+
const currentYear = viewDate.getFullYear();
|
|
4355
|
+
const initialIndex = (0, import_react44.useMemo)(() => {
|
|
4356
|
+
const index = years.indexOf(currentYear);
|
|
4357
|
+
const rowIndex = Math.floor(index / NUM_COLUMNS);
|
|
4358
|
+
return Math.max(0, rowIndex);
|
|
4359
|
+
}, [years, currentYear]);
|
|
4360
|
+
(0, import_react44.useEffect)(() => {
|
|
4361
|
+
groupAnim.setValue(0);
|
|
4362
|
+
import_react_native39.Animated.timing(groupAnim, {
|
|
4363
|
+
toValue: 1,
|
|
4364
|
+
duration: 220,
|
|
4365
|
+
easing: import_react_native39.Easing.out(import_react_native39.Easing.cubic),
|
|
4366
|
+
useNativeDriver: true
|
|
4367
|
+
}).start();
|
|
4368
|
+
}, [groupAnim]);
|
|
4369
|
+
const getItemLayout = (0, import_react44.useCallback)(
|
|
4370
|
+
(_, index) => ({
|
|
4371
|
+
length: ITEM_HEIGHT,
|
|
4372
|
+
offset: ITEM_HEIGHT * index,
|
|
4373
|
+
index
|
|
4374
|
+
}),
|
|
4375
|
+
[]
|
|
4376
|
+
);
|
|
4377
|
+
const renderYear = (0, import_react44.useCallback)(
|
|
4378
|
+
({ item }) => {
|
|
4379
|
+
const isCurrentYear = item === currentYear;
|
|
4380
|
+
return /* @__PURE__ */ import_react44.default.createElement(
|
|
4381
|
+
import_react_native39.Pressable,
|
|
4382
|
+
{
|
|
4383
|
+
style: [
|
|
4384
|
+
styles10.yearCell,
|
|
4385
|
+
isCurrentYear && { backgroundColor: accentColor }
|
|
4386
|
+
],
|
|
4387
|
+
onPress: () => onSelectYear(item),
|
|
4388
|
+
accessibilityLabel: `${item}`,
|
|
4389
|
+
accessibilityRole: "button",
|
|
4390
|
+
accessibilityState: { selected: isCurrentYear }
|
|
4391
|
+
},
|
|
4392
|
+
/* @__PURE__ */ import_react44.default.createElement(
|
|
4393
|
+
import_react_native39.Text,
|
|
4394
|
+
{
|
|
4395
|
+
style: [
|
|
4396
|
+
styles10.yearText,
|
|
4397
|
+
{ color: theme.colors.foreground },
|
|
4398
|
+
isCurrentYear && {
|
|
4399
|
+
color: accentFg,
|
|
4400
|
+
fontWeight: "600"
|
|
4401
|
+
}
|
|
4402
|
+
]
|
|
4403
|
+
},
|
|
4404
|
+
item
|
|
4405
|
+
)
|
|
4406
|
+
);
|
|
4407
|
+
},
|
|
4408
|
+
[currentYear, onSelectYear, accentColor, accentFg, theme.colors.foreground]
|
|
4409
|
+
);
|
|
4410
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react_native39.View, { style: styles10.yearPickerContainer }, /* @__PURE__ */ import_react44.default.createElement(
|
|
4411
|
+
import_react_native39.Animated.View,
|
|
4412
|
+
{
|
|
4413
|
+
style: {
|
|
4414
|
+
opacity: groupAnim,
|
|
4415
|
+
transform: [
|
|
4416
|
+
{
|
|
4417
|
+
translateY: groupAnim.interpolate({
|
|
4418
|
+
inputRange: [0, 1],
|
|
4419
|
+
outputRange: [12, 0]
|
|
4420
|
+
})
|
|
4421
|
+
}
|
|
4422
|
+
]
|
|
4423
|
+
}
|
|
4424
|
+
},
|
|
4425
|
+
/* @__PURE__ */ import_react44.default.createElement(
|
|
4426
|
+
import_react_native39.FlatList,
|
|
4427
|
+
{
|
|
4428
|
+
ref: listRef,
|
|
4429
|
+
data: years,
|
|
4430
|
+
renderItem: renderYear,
|
|
4431
|
+
keyExtractor: (item) => String(item),
|
|
4432
|
+
numColumns: NUM_COLUMNS,
|
|
4433
|
+
getItemLayout,
|
|
4434
|
+
initialScrollIndex: initialIndex,
|
|
4435
|
+
showsVerticalScrollIndicator: false,
|
|
4436
|
+
columnWrapperStyle: { justifyContent: "center" }
|
|
4437
|
+
}
|
|
4438
|
+
)
|
|
4439
|
+
));
|
|
1673
4440
|
};
|
|
1674
4441
|
|
|
1675
|
-
// src/components/dialogs/
|
|
1676
|
-
var
|
|
4442
|
+
// src/components/dialogs/datepicker-dialog/datepicker-dialog.tsx
|
|
4443
|
+
var DatePickerDialog = ({
|
|
1677
4444
|
visible,
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
4445
|
+
selectedDate,
|
|
4446
|
+
locale,
|
|
4447
|
+
firstDayOfWeek,
|
|
1681
4448
|
themeColor = "primary",
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
checkmarkIcon,
|
|
1685
|
-
inputTextStyle,
|
|
4449
|
+
minDate,
|
|
4450
|
+
maxDate,
|
|
1686
4451
|
style,
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
4452
|
+
todayLabel,
|
|
4453
|
+
confirmLabel,
|
|
4454
|
+
onDateSelect,
|
|
4455
|
+
onClearValue,
|
|
4456
|
+
onClose
|
|
1692
4457
|
}) => {
|
|
1693
4458
|
const theme = useXUITheme();
|
|
1694
|
-
const { width: screenWidth, height: screenHeight } = (0,
|
|
1695
|
-
const fadeAnim = (0,
|
|
1696
|
-
const slideAnim = (0,
|
|
1697
|
-
const scaleAnim = (0,
|
|
1698
|
-
const
|
|
1699
|
-
const
|
|
1700
|
-
(0,
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
4459
|
+
const { width: screenWidth, height: screenHeight } = (0, import_react_native40.useWindowDimensions)();
|
|
4460
|
+
const fadeAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(0)).current;
|
|
4461
|
+
const slideAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(0)).current;
|
|
4462
|
+
const scaleAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(0)).current;
|
|
4463
|
+
const viewFadeAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(1)).current;
|
|
4464
|
+
const monthSlideXAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(0)).current;
|
|
4465
|
+
const monthFadeAnim = (0, import_react45.useRef)(new import_react_native40.Animated.Value(1)).current;
|
|
4466
|
+
const colorScheme = theme.colors[themeColor] ?? theme.colors.primary;
|
|
4467
|
+
const isDefault = themeColor === "default";
|
|
4468
|
+
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
4469
|
+
const labels = getDatePickerLabels(locale);
|
|
4470
|
+
const resolvedTodayLabel = todayLabel ?? labels.today;
|
|
4471
|
+
const resolvedConfirmLabel = confirmLabel ?? labels.confirm;
|
|
4472
|
+
const {
|
|
4473
|
+
viewDate,
|
|
4474
|
+
viewMode,
|
|
4475
|
+
goToPreviousMonth,
|
|
4476
|
+
goToNextMonth,
|
|
4477
|
+
goToYear,
|
|
4478
|
+
goToMonth,
|
|
4479
|
+
goToToday,
|
|
4480
|
+
toggleYearPicker,
|
|
4481
|
+
syncViewToDate
|
|
4482
|
+
} = useDatePickerViewState(selectedDate);
|
|
4483
|
+
const onCloseComplete = (0, import_react45.useCallback)(() => {
|
|
4484
|
+
fadeAnim.setValue(0);
|
|
4485
|
+
slideAnim.setValue(0);
|
|
4486
|
+
scaleAnim.setValue(0);
|
|
4487
|
+
viewFadeAnim.setValue(1);
|
|
4488
|
+
monthSlideXAnim.setValue(0);
|
|
4489
|
+
monthFadeAnim.setValue(1);
|
|
4490
|
+
}, [fadeAnim, slideAnim, scaleAnim, viewFadeAnim, monthSlideXAnim, monthFadeAnim]);
|
|
4491
|
+
const { shouldRender } = useDatePickerDialogAnimation({
|
|
4492
|
+
visible,
|
|
4493
|
+
fadeAnim,
|
|
4494
|
+
slideAnim,
|
|
4495
|
+
scaleAnim,
|
|
4496
|
+
onCloseComplete
|
|
4497
|
+
});
|
|
4498
|
+
const { animate: animateViewTransition } = useViewTransitionAnimation({
|
|
4499
|
+
fadeAnim: viewFadeAnim
|
|
4500
|
+
});
|
|
4501
|
+
const { animate: animateMonthSlide } = useMonthSlideAnimation({
|
|
4502
|
+
slideAnim: monthSlideXAnim,
|
|
4503
|
+
fadeAnim: monthFadeAnim
|
|
4504
|
+
});
|
|
4505
|
+
const prevViewModeRef = (0, import_react45.useRef)(viewMode);
|
|
4506
|
+
(0, import_react45.useEffect)(() => {
|
|
4507
|
+
if (prevViewModeRef.current !== viewMode) {
|
|
4508
|
+
prevViewModeRef.current = viewMode;
|
|
4509
|
+
animateViewTransition();
|
|
4510
|
+
}
|
|
4511
|
+
}, [viewMode, animateViewTransition]);
|
|
4512
|
+
(0, import_react45.useEffect)(() => {
|
|
4513
|
+
if (visible && selectedDate) {
|
|
4514
|
+
syncViewToDate(selectedDate);
|
|
4515
|
+
}
|
|
4516
|
+
}, [visible, selectedDate, syncViewToDate]);
|
|
4517
|
+
(0, import_react45.useEffect)(() => {
|
|
1724
4518
|
if (!visible) return;
|
|
1725
|
-
const sub =
|
|
1726
|
-
onClose
|
|
4519
|
+
const sub = import_react_native40.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
4520
|
+
onClose();
|
|
1727
4521
|
return true;
|
|
1728
4522
|
});
|
|
1729
4523
|
return () => sub.remove();
|
|
1730
4524
|
}, [visible, onClose]);
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
}, []);
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
return (keyboardHeight > 0 ? keyboardHeight : 0) + basePadding;
|
|
1753
|
-
}, [keyboardHeight, showCheckmark]);
|
|
1754
|
-
if (!visible) return null;
|
|
4525
|
+
const handlePreviousMonth = (0, import_react45.useCallback)(() => {
|
|
4526
|
+
goToPreviousMonth();
|
|
4527
|
+
animateMonthSlide("left");
|
|
4528
|
+
}, [goToPreviousMonth, animateMonthSlide]);
|
|
4529
|
+
const handleNextMonth = (0, import_react45.useCallback)(() => {
|
|
4530
|
+
goToNextMonth();
|
|
4531
|
+
animateMonthSlide("right");
|
|
4532
|
+
}, [goToNextMonth, animateMonthSlide]);
|
|
4533
|
+
const handleDaySelect = (0, import_react45.useCallback)(
|
|
4534
|
+
(date) => {
|
|
4535
|
+
onDateSelect(date);
|
|
4536
|
+
},
|
|
4537
|
+
[onDateSelect]
|
|
4538
|
+
);
|
|
4539
|
+
const handleTodayPress = (0, import_react45.useCallback)(() => {
|
|
4540
|
+
const today = /* @__PURE__ */ new Date();
|
|
4541
|
+
if (!isDateInRange(today, minDate, maxDate)) return;
|
|
4542
|
+
goToToday();
|
|
4543
|
+
onDateSelect(today);
|
|
4544
|
+
}, [goToToday, onDateSelect, minDate, maxDate]);
|
|
4545
|
+
if (!shouldRender) return null;
|
|
1755
4546
|
const overlayStyle = {
|
|
1756
4547
|
position: "absolute",
|
|
1757
4548
|
top: 0,
|
|
@@ -1760,79 +4551,139 @@ var AutocompleteDialog = ({
|
|
|
1760
4551
|
height: screenHeight
|
|
1761
4552
|
};
|
|
1762
4553
|
const containerAnimatedStyle = {
|
|
4554
|
+
opacity: fadeAnim,
|
|
1763
4555
|
transform: [
|
|
4556
|
+
{
|
|
4557
|
+
scale: scaleAnim.interpolate({
|
|
4558
|
+
inputRange: [0, 1],
|
|
4559
|
+
outputRange: [0.92, 1]
|
|
4560
|
+
})
|
|
4561
|
+
},
|
|
1764
4562
|
{
|
|
1765
4563
|
translateY: slideAnim.interpolate({
|
|
1766
4564
|
inputRange: [0, 1],
|
|
1767
|
-
outputRange: [
|
|
4565
|
+
outputRange: [40, 0]
|
|
1768
4566
|
})
|
|
1769
4567
|
}
|
|
1770
4568
|
]
|
|
1771
4569
|
};
|
|
1772
|
-
const
|
|
1773
|
-
|
|
4570
|
+
const viewTransitionStyle = {
|
|
4571
|
+
opacity: viewFadeAnim,
|
|
4572
|
+
transform: [
|
|
4573
|
+
{
|
|
4574
|
+
translateY: viewFadeAnim.interpolate({
|
|
4575
|
+
inputRange: [0, 1],
|
|
4576
|
+
outputRange: [8, 0]
|
|
4577
|
+
})
|
|
4578
|
+
}
|
|
4579
|
+
]
|
|
1774
4580
|
};
|
|
1775
|
-
const
|
|
1776
|
-
|
|
4581
|
+
const monthSlideStyle = {
|
|
4582
|
+
opacity: monthFadeAnim,
|
|
4583
|
+
transform: [{ translateX: monthSlideXAnim }]
|
|
4584
|
+
};
|
|
4585
|
+
const renderContent = () => {
|
|
4586
|
+
switch (viewMode) {
|
|
4587
|
+
case "year":
|
|
4588
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
|
4589
|
+
DatePickerDialogYearPicker,
|
|
4590
|
+
{
|
|
4591
|
+
viewDate,
|
|
4592
|
+
themeColor,
|
|
4593
|
+
minDate,
|
|
4594
|
+
maxDate,
|
|
4595
|
+
onSelectYear: goToYear
|
|
4596
|
+
}
|
|
4597
|
+
);
|
|
4598
|
+
case "month":
|
|
4599
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
|
4600
|
+
DatePickerDialogMonthPicker,
|
|
4601
|
+
{
|
|
4602
|
+
viewDate,
|
|
4603
|
+
locale,
|
|
4604
|
+
themeColor,
|
|
4605
|
+
onSelectMonth: goToMonth
|
|
4606
|
+
}
|
|
4607
|
+
);
|
|
4608
|
+
case "calendar":
|
|
4609
|
+
default:
|
|
4610
|
+
return /* @__PURE__ */ import_react45.default.createElement(import_react_native40.Animated.View, { style: [viewTransitionStyle, monthSlideStyle] }, /* @__PURE__ */ import_react45.default.createElement(
|
|
4611
|
+
DatePickerDialogCalendar,
|
|
4612
|
+
{
|
|
4613
|
+
viewDate,
|
|
4614
|
+
selectedDate,
|
|
4615
|
+
locale,
|
|
4616
|
+
firstDayOfWeek,
|
|
4617
|
+
themeColor,
|
|
4618
|
+
minDate,
|
|
4619
|
+
maxDate,
|
|
4620
|
+
onSelectDay: handleDaySelect,
|
|
4621
|
+
onPreviousMonth: handlePreviousMonth,
|
|
4622
|
+
onNextMonth: handleNextMonth
|
|
4623
|
+
}
|
|
4624
|
+
));
|
|
4625
|
+
}
|
|
4626
|
+
};
|
|
4627
|
+
return /* @__PURE__ */ import_react45.default.createElement(Portal, null, /* @__PURE__ */ import_react45.default.createElement(import_react_native_gesture_handler2.GestureHandlerRootView, { style: [overlayStyle, style] }, /* @__PURE__ */ import_react45.default.createElement(import_react_native40.View, { style: overlayStyle }, /* @__PURE__ */ import_react45.default.createElement(import_react_native40.Animated.View, { style: [styles10.backdrop, { opacity: fadeAnim }] }, /* @__PURE__ */ import_react45.default.createElement(
|
|
4628
|
+
import_react_native40.Pressable,
|
|
1777
4629
|
{
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
inputAnimatedStyle,
|
|
1783
|
-
inputTextStyle,
|
|
1784
|
-
onInputChange,
|
|
1785
|
-
onClose,
|
|
1786
|
-
onCheckmarkPress: handleCheckmarkPress,
|
|
1787
|
-
onFocus,
|
|
1788
|
-
onBlur
|
|
4630
|
+
style: { flex: 1 },
|
|
4631
|
+
onPress: onClose,
|
|
4632
|
+
accessibilityLabel: "Close calendar",
|
|
4633
|
+
accessibilityRole: "button"
|
|
1789
4634
|
}
|
|
1790
|
-
)
|
|
1791
|
-
|
|
1792
|
-
import_react_native20.View,
|
|
4635
|
+
)), /* @__PURE__ */ import_react45.default.createElement(import_react_native40.Animated.View, { style: [styles10.dialogContainer, containerAnimatedStyle] }, /* @__PURE__ */ import_react45.default.createElement(
|
|
4636
|
+
import_react_native40.View,
|
|
1793
4637
|
{
|
|
1794
|
-
style: [
|
|
4638
|
+
style: [
|
|
4639
|
+
styles10.container,
|
|
4640
|
+
{ backgroundColor: theme.colors.background }
|
|
4641
|
+
]
|
|
1795
4642
|
},
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
import_react_native20.FlatList,
|
|
4643
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
|
4644
|
+
DatePickerDialogHeader,
|
|
1799
4645
|
{
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
showsVerticalScrollIndicator: false
|
|
4646
|
+
viewDate,
|
|
4647
|
+
selectedDate,
|
|
4648
|
+
locale,
|
|
4649
|
+
themeColor,
|
|
4650
|
+
selectDateLabel: labels.selectDate,
|
|
4651
|
+
onClearValue,
|
|
4652
|
+
onPreviousMonth: handlePreviousMonth,
|
|
4653
|
+
onNextMonth: handleNextMonth,
|
|
4654
|
+
onToggleYearPicker: toggleYearPicker
|
|
1810
4655
|
}
|
|
1811
4656
|
),
|
|
1812
|
-
|
|
1813
|
-
|
|
4657
|
+
renderContent(),
|
|
4658
|
+
/* @__PURE__ */ import_react45.default.createElement(import_react_native40.View, { style: styles10.footer }, /* @__PURE__ */ import_react45.default.createElement(
|
|
4659
|
+
import_react_native40.Pressable,
|
|
1814
4660
|
{
|
|
1815
|
-
style:
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
],
|
|
1819
|
-
onPress: handleCheckmarkPress,
|
|
1820
|
-
accessibilityLabel: "Confirm",
|
|
4661
|
+
style: styles10.footerButton,
|
|
4662
|
+
onPress: handleTodayPress,
|
|
4663
|
+
accessibilityLabel: resolvedTodayLabel,
|
|
1821
4664
|
accessibilityRole: "button"
|
|
1822
4665
|
},
|
|
1823
|
-
|
|
1824
|
-
)
|
|
1825
|
-
|
|
4666
|
+
/* @__PURE__ */ import_react45.default.createElement(import_react_native40.Text, { style: [styles10.footerButtonText, { color: accentColor }] }, resolvedTodayLabel)
|
|
4667
|
+
), /* @__PURE__ */ import_react45.default.createElement(
|
|
4668
|
+
import_react_native40.Pressable,
|
|
4669
|
+
{
|
|
4670
|
+
style: styles10.footerButton,
|
|
4671
|
+
onPress: onClose,
|
|
4672
|
+
accessibilityLabel: resolvedConfirmLabel,
|
|
4673
|
+
accessibilityRole: "button"
|
|
4674
|
+
},
|
|
4675
|
+
/* @__PURE__ */ import_react45.default.createElement(import_react_native40.Text, { style: [styles10.footerButtonText, { color: accentColor }] }, resolvedConfirmLabel)
|
|
4676
|
+
))
|
|
4677
|
+
)))));
|
|
1826
4678
|
};
|
|
1827
4679
|
|
|
1828
|
-
// src/components/
|
|
1829
|
-
var
|
|
1830
|
-
var
|
|
1831
|
-
var
|
|
4680
|
+
// src/components/datepicker/datepicker-trigger.tsx
|
|
4681
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
4682
|
+
var import_react_native41 = require("react-native");
|
|
4683
|
+
var DatePickerTrigger = ({
|
|
1832
4684
|
triggerRef,
|
|
1833
4685
|
isDisabled,
|
|
1834
|
-
|
|
1835
|
-
currentInputValue,
|
|
4686
|
+
hasValue,
|
|
1836
4687
|
displayValue,
|
|
1837
4688
|
sizeStyles,
|
|
1838
4689
|
radiusStyles,
|
|
@@ -1842,7 +4693,7 @@ var AutocompleteTrigger = ({
|
|
|
1842
4693
|
label,
|
|
1843
4694
|
labelText,
|
|
1844
4695
|
isLabelInside,
|
|
1845
|
-
|
|
4696
|
+
calendarIcon,
|
|
1846
4697
|
style,
|
|
1847
4698
|
textStyle,
|
|
1848
4699
|
onPress: handleTriggerPress,
|
|
@@ -1850,15 +4701,15 @@ var AutocompleteTrigger = ({
|
|
|
1850
4701
|
onLayout: handleTriggerLayout
|
|
1851
4702
|
}) => {
|
|
1852
4703
|
const renderLabel = isLabelInside && label;
|
|
1853
|
-
return /* @__PURE__ */
|
|
1854
|
-
|
|
4704
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
4705
|
+
import_react_native41.Pressable,
|
|
1855
4706
|
{
|
|
1856
4707
|
ref: triggerRef,
|
|
1857
4708
|
onPress: handleTriggerPress,
|
|
1858
4709
|
onLayout: handleTriggerLayout,
|
|
1859
4710
|
disabled: isDisabled,
|
|
1860
4711
|
style: [
|
|
1861
|
-
|
|
4712
|
+
styles9.trigger,
|
|
1862
4713
|
{
|
|
1863
4714
|
minHeight: sizeStyles.minHeight,
|
|
1864
4715
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
@@ -1866,20 +4717,20 @@ var AutocompleteTrigger = ({
|
|
|
1866
4717
|
},
|
|
1867
4718
|
radiusStyles,
|
|
1868
4719
|
variantStyles,
|
|
1869
|
-
isDisabled &&
|
|
4720
|
+
isDisabled && styles9.disabled,
|
|
1870
4721
|
style
|
|
1871
4722
|
],
|
|
1872
4723
|
accessibilityLabel: labelText ?? (typeof label === "string" ? label : void 0),
|
|
1873
4724
|
accessibilityRole: "button",
|
|
1874
4725
|
accessibilityState: { disabled: isDisabled }
|
|
1875
4726
|
},
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
|
|
4727
|
+
/* @__PURE__ */ import_react46.default.createElement(import_react_native41.View, { style: styles9.triggerContent }, isLabelInside && renderLabel, /* @__PURE__ */ import_react46.default.createElement(
|
|
4728
|
+
import_react_native41.Text,
|
|
1878
4729
|
{
|
|
1879
4730
|
style: [
|
|
1880
|
-
|
|
4731
|
+
styles9.triggerText,
|
|
1881
4732
|
{ fontSize: sizeStyles.fontSize, color: theme.colors.foreground },
|
|
1882
|
-
!
|
|
4733
|
+
!hasValue && { opacity: 0.5 },
|
|
1883
4734
|
textStyle
|
|
1884
4735
|
],
|
|
1885
4736
|
numberOfLines: 1,
|
|
@@ -1887,188 +4738,109 @@ var AutocompleteTrigger = ({
|
|
|
1887
4738
|
},
|
|
1888
4739
|
displayValue
|
|
1889
4740
|
)),
|
|
1890
|
-
isClearable &&
|
|
1891
|
-
|
|
4741
|
+
isClearable && hasValue ? /* @__PURE__ */ import_react46.default.createElement(
|
|
4742
|
+
import_react_native41.TouchableOpacity,
|
|
1892
4743
|
{
|
|
1893
4744
|
onPress: handleClear,
|
|
1894
|
-
style:
|
|
4745
|
+
style: styles9.clearButton,
|
|
1895
4746
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
1896
4747
|
},
|
|
1897
|
-
|
|
1898
|
-
) :
|
|
4748
|
+
/* @__PURE__ */ import_react46.default.createElement(CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
4749
|
+
) : calendarIcon ?? /* @__PURE__ */ import_react46.default.createElement(CalendarIcon, { color: theme.colors.foreground, size: 20 })
|
|
1899
4750
|
);
|
|
1900
4751
|
};
|
|
1901
4752
|
|
|
1902
|
-
// src/components/
|
|
1903
|
-
var
|
|
1904
|
-
|
|
1905
|
-
|
|
4753
|
+
// src/components/datepicker/datepicker.tsx
|
|
4754
|
+
var DatePicker = ({
|
|
4755
|
+
value,
|
|
4756
|
+
defaultValue,
|
|
4757
|
+
onChange,
|
|
4758
|
+
locale = "en",
|
|
4759
|
+
minDate,
|
|
4760
|
+
maxDate,
|
|
4761
|
+
firstDayOfWeek: firstDayOfWeekProp,
|
|
1906
4762
|
variant = "flat",
|
|
1907
4763
|
themeColor = "default",
|
|
1908
4764
|
size = "md",
|
|
1909
4765
|
radius = "md",
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
isClearable = true,
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
customAppearance,
|
|
1927
|
-
onClose,
|
|
1928
|
-
onOpenChange,
|
|
1929
|
-
onSelectionChange,
|
|
1930
|
-
onInputChange,
|
|
1931
|
-
onClear
|
|
1932
|
-
}) => {
|
|
1933
|
-
const { currentSelectedKey, updateSelection } = useAutocompleteSelection({
|
|
1934
|
-
onSelectionChange
|
|
1935
|
-
});
|
|
1936
|
-
const { currentInputValue, updateInputValue } = useAutocompleteInputState({
|
|
1937
|
-
inputValue,
|
|
1938
|
-
defaultInputValue,
|
|
1939
|
-
selectedKey: currentSelectedKey,
|
|
1940
|
-
onInputChange
|
|
1941
|
-
});
|
|
1942
|
-
const { isOpen, setOpen } = useAutocompleteOpenState({
|
|
1943
|
-
isOpened: void 0,
|
|
1944
|
-
isDisabled,
|
|
1945
|
-
onOpenChange,
|
|
1946
|
-
onClose
|
|
1947
|
-
});
|
|
1948
|
-
const triggerRef = (0, import_react27.useRef)(null);
|
|
1949
|
-
const [triggerLayout, setTriggerLayout] = (0, import_react27.useState)();
|
|
1950
|
-
const handleTriggerLayout = (0, import_react27.useCallback)(() => {
|
|
1951
|
-
triggerRef.current?.measureInWindow((x, y, width, height) => {
|
|
1952
|
-
setTriggerLayout({ x, y, width, height });
|
|
1953
|
-
});
|
|
1954
|
-
}, []);
|
|
1955
|
-
const items = (0, import_react27.useMemo)(() => {
|
|
1956
|
-
const elements = import_react27.default.Children.toArray(children).filter(Boolean);
|
|
1957
|
-
return elements.map((child, index) => {
|
|
1958
|
-
if (!import_react27.default.isValidElement(child)) {
|
|
1959
|
-
return null;
|
|
1960
|
-
}
|
|
1961
|
-
const key = child.props.value ?? String(index);
|
|
1962
|
-
const labelText = getTextValue(child.props.label) ?? key;
|
|
1963
|
-
return {
|
|
1964
|
-
key,
|
|
1965
|
-
element: child,
|
|
1966
|
-
labelText
|
|
1967
|
-
};
|
|
1968
|
-
}).filter((item) => item !== null);
|
|
1969
|
-
}, [children]);
|
|
1970
|
-
const filteredItems = (0, import_react27.useMemo)(() => {
|
|
1971
|
-
if (disableLocalFilter || !currentInputValue.trim()) {
|
|
1972
|
-
return items;
|
|
1973
|
-
}
|
|
1974
|
-
return items.filter(
|
|
1975
|
-
(item) => defaultFilterFunction(item.labelText, currentInputValue)
|
|
1976
|
-
);
|
|
1977
|
-
}, [disableLocalFilter, items, currentInputValue]);
|
|
4766
|
+
label,
|
|
4767
|
+
placeholder = "Select a date",
|
|
4768
|
+
description,
|
|
4769
|
+
errorMessage,
|
|
4770
|
+
labelPlacement = "outside",
|
|
4771
|
+
fullWidth = false,
|
|
4772
|
+
isDisabled = false,
|
|
4773
|
+
isInvalid = false,
|
|
4774
|
+
isReadOnly = false,
|
|
4775
|
+
isClearable = true,
|
|
4776
|
+
customAppearance,
|
|
4777
|
+
calendarIcon,
|
|
4778
|
+
onOpen,
|
|
4779
|
+
onClose,
|
|
4780
|
+
onOpenChange
|
|
4781
|
+
}) => {
|
|
1978
4782
|
const theme = useXUITheme();
|
|
1979
|
-
const
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
4783
|
+
const { selectedDate, updateDate } = useDatePickerState({
|
|
4784
|
+
value,
|
|
4785
|
+
defaultValue,
|
|
4786
|
+
onChange
|
|
4787
|
+
});
|
|
4788
|
+
const { isOpen, setOpen } = useDatePickerOpenState({
|
|
4789
|
+
isDisabled: isDisabled || isReadOnly,
|
|
4790
|
+
onOpenChange,
|
|
4791
|
+
onOpen,
|
|
4792
|
+
onClose
|
|
4793
|
+
});
|
|
4794
|
+
const triggerRef = (0, import_react47.useRef)(null);
|
|
4795
|
+
const handleTriggerLayout = (0, import_react47.useCallback)(() => {
|
|
4796
|
+
}, []);
|
|
4797
|
+
const firstDayOfWeek = (0, import_react47.useMemo)(
|
|
4798
|
+
() => firstDayOfWeekProp ?? getFirstDayOfWeek(locale),
|
|
4799
|
+
[firstDayOfWeekProp, locale]
|
|
4800
|
+
);
|
|
4801
|
+
const sizeStyles = useDatePickerSizeStyles(size);
|
|
4802
|
+
const radiusStyles = useDatePickerRadiusStyles(radius);
|
|
4803
|
+
const variantStyles = useDatePickerVariantStyles(themeColor, variant, isInvalid);
|
|
4804
|
+
const labelStyle = useDatePickerLabelStyle(
|
|
1983
4805
|
themeColor,
|
|
1984
4806
|
isInvalid,
|
|
1985
4807
|
sizeStyles.labelSize
|
|
1986
4808
|
);
|
|
1987
|
-
const helperColor =
|
|
1988
|
-
const
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
currentSelectedKey
|
|
2005
|
-
]
|
|
2006
|
-
);
|
|
2007
|
-
const handleItemSelection = (0, import_react27.useCallback)(
|
|
2008
|
-
(key, itemLabel) => {
|
|
2009
|
-
if (isDisabled) {
|
|
2010
|
-
return;
|
|
2011
|
-
}
|
|
2012
|
-
updateSelection(key);
|
|
2013
|
-
updateInputValue(itemLabel);
|
|
2014
|
-
setTimeout(() => {
|
|
2015
|
-
import_react_native22.Keyboard.dismiss();
|
|
2016
|
-
setOpen(false);
|
|
2017
|
-
}, 50);
|
|
4809
|
+
const helperColor = useDatePickerHelperColor(isInvalid);
|
|
4810
|
+
const displayValue = (0, import_react47.useMemo)(() => {
|
|
4811
|
+
if (!selectedDate) return placeholder;
|
|
4812
|
+
return formatDate(selectedDate, locale);
|
|
4813
|
+
}, [selectedDate, locale, placeholder]);
|
|
4814
|
+
const handleTriggerPress = (0, import_react47.useCallback)(() => {
|
|
4815
|
+
if (!isDisabled && !isReadOnly) {
|
|
4816
|
+
setOpen(true);
|
|
4817
|
+
}
|
|
4818
|
+
}, [isDisabled, isReadOnly, setOpen]);
|
|
4819
|
+
const handleClear = (0, import_react47.useCallback)(() => {
|
|
4820
|
+
if (isDisabled || isReadOnly) return;
|
|
4821
|
+
updateDate(null);
|
|
4822
|
+
}, [isDisabled, isReadOnly, updateDate]);
|
|
4823
|
+
const handleDateSelect = (0, import_react47.useCallback)(
|
|
4824
|
+
(date) => {
|
|
4825
|
+
updateDate(date);
|
|
2018
4826
|
},
|
|
2019
|
-
[
|
|
4827
|
+
[updateDate]
|
|
2020
4828
|
);
|
|
2021
|
-
const
|
|
4829
|
+
const handleClose = (0, import_react47.useCallback)(() => {
|
|
2022
4830
|
setOpen(false);
|
|
2023
4831
|
}, [setOpen]);
|
|
2024
|
-
const handleClear = (0, import_react27.useCallback)(() => {
|
|
2025
|
-
if (isDisabled) {
|
|
2026
|
-
return;
|
|
2027
|
-
}
|
|
2028
|
-
updateSelection(null);
|
|
2029
|
-
updateInputValue("");
|
|
2030
|
-
onClear?.();
|
|
2031
|
-
}, [isDisabled, updateSelection, updateInputValue, onClear]);
|
|
2032
|
-
const handleTriggerPress = (0, import_react27.useCallback)(() => {
|
|
2033
|
-
if (!isDisabled) {
|
|
2034
|
-
if (selectedItem && !currentInputValue) {
|
|
2035
|
-
updateInputValue(selectedItem.labelText);
|
|
2036
|
-
}
|
|
2037
|
-
setOpen(true);
|
|
2038
|
-
}
|
|
2039
|
-
}, [isDisabled, setOpen, selectedItem, currentInputValue, updateInputValue]);
|
|
2040
|
-
const listItems = filteredItems.map((item) => {
|
|
2041
|
-
const itemProps = item.element.props;
|
|
2042
|
-
const itemDisabled = isDisabled || itemProps.isDisabled;
|
|
2043
|
-
const itemSelected = itemProps.isSelected ?? currentSelectedKey === item.key;
|
|
2044
|
-
const handleItemSelected = () => {
|
|
2045
|
-
if (itemDisabled || itemProps.isReadOnly) {
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
handleItemSelection(item.key, item.labelText);
|
|
2049
|
-
itemProps.onSelected?.();
|
|
2050
|
-
};
|
|
2051
|
-
return import_react27.default.cloneElement(item.element, {
|
|
2052
|
-
key: item.key,
|
|
2053
|
-
isDisabled: itemDisabled,
|
|
2054
|
-
isSelected: itemSelected,
|
|
2055
|
-
onSelected: handleItemSelected
|
|
2056
|
-
});
|
|
2057
|
-
});
|
|
2058
|
-
const showEmptyMessage = !allowsEmptyCollection && listItems.length === 0;
|
|
2059
4832
|
const isLabelInside = labelPlacement === "inside";
|
|
2060
4833
|
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
2061
4834
|
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
2062
|
-
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */
|
|
4835
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ import_react47.default.createElement(import_react_native42.Text, { style: [styles9.label, labelStyle] }, label) : /* @__PURE__ */ import_react47.default.createElement(import_react_native42.View, null, label) : null;
|
|
2063
4836
|
const shouldShowHelper = Boolean(description || errorMessage);
|
|
2064
4837
|
const helperContent = isInvalid && errorMessage ? errorMessage : description;
|
|
2065
|
-
const triggerContent = /* @__PURE__ */
|
|
2066
|
-
|
|
4838
|
+
const triggerContent = /* @__PURE__ */ import_react47.default.createElement(
|
|
4839
|
+
DatePickerTrigger,
|
|
2067
4840
|
{
|
|
2068
4841
|
triggerRef,
|
|
2069
|
-
isDisabled,
|
|
2070
|
-
|
|
2071
|
-
currentInputValue,
|
|
4842
|
+
isDisabled: isDisabled || isReadOnly,
|
|
4843
|
+
hasValue: !!selectedDate,
|
|
2072
4844
|
displayValue,
|
|
2073
4845
|
sizeStyles,
|
|
2074
4846
|
radiusStyles,
|
|
@@ -2078,8 +4850,8 @@ var Autocomplete = ({
|
|
|
2078
4850
|
label: renderLabel,
|
|
2079
4851
|
labelText: typeof label === "string" ? label : void 0,
|
|
2080
4852
|
isLabelInside,
|
|
2081
|
-
|
|
2082
|
-
style: customAppearance?.
|
|
4853
|
+
calendarIcon,
|
|
4854
|
+
style: customAppearance?.trigger,
|
|
2083
4855
|
textStyle: customAppearance?.text,
|
|
2084
4856
|
onPress: handleTriggerPress,
|
|
2085
4857
|
onClear: handleClear,
|
|
@@ -2087,211 +4859,52 @@ var Autocomplete = ({
|
|
|
2087
4859
|
}
|
|
2088
4860
|
);
|
|
2089
4861
|
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
2090
|
-
return /* @__PURE__ */
|
|
2091
|
-
|
|
2092
|
-
{
|
|
2093
|
-
visible: isOpen,
|
|
2094
|
-
inputValue: currentInputValue,
|
|
2095
|
-
placeholder,
|
|
2096
|
-
title: typeof label === "string" ? label : void 0,
|
|
2097
|
-
themeColor,
|
|
2098
|
-
_triggerLayout: triggerLayout,
|
|
2099
|
-
showCheckmark: false,
|
|
2100
|
-
onInputChange: handleInputChange,
|
|
2101
|
-
onClose: () => setOpen(false),
|
|
2102
|
-
onCheckmark: handleCheckmark
|
|
2103
|
-
},
|
|
2104
|
-
/* @__PURE__ */ import_react27.default.createElement(AutocompleteContext.Provider, { value: { size, themeColor, isDisabled } }, showEmptyMessage ? /* @__PURE__ */ import_react27.default.createElement(import_react_native22.Text, { style: [styles4.emptyMessage, { color: theme.colors.foreground }] }, "No results found") : listItems)
|
|
2105
|
-
));
|
|
2106
|
-
};
|
|
2107
|
-
|
|
2108
|
-
// src/components/autocomplete/autocomplete-item.tsx
|
|
2109
|
-
var import_react29 = __toESM(require("react"), 1);
|
|
2110
|
-
var import_react_native24 = require("react-native");
|
|
2111
|
-
|
|
2112
|
-
// src/components/autocomplete/autocomplete-item.style.ts
|
|
2113
|
-
var import_react_native23 = require("react-native");
|
|
2114
|
-
var styles6 = import_react_native23.StyleSheet.create({
|
|
2115
|
-
item: {
|
|
2116
|
-
flexDirection: "row",
|
|
2117
|
-
alignItems: "center",
|
|
2118
|
-
gap: 8
|
|
2119
|
-
},
|
|
2120
|
-
content: {
|
|
2121
|
-
flex: 1,
|
|
2122
|
-
gap: 2
|
|
2123
|
-
},
|
|
2124
|
-
title: {
|
|
2125
|
-
fontWeight: "500"
|
|
2126
|
-
},
|
|
2127
|
-
description: {
|
|
2128
|
-
opacity: 0.7
|
|
2129
|
-
},
|
|
2130
|
-
disabled: {
|
|
2131
|
-
opacity: 0.5
|
|
2132
|
-
}
|
|
2133
|
-
});
|
|
2134
|
-
|
|
2135
|
-
// src/components/autocomplete/autocomplete-item.hook.ts
|
|
2136
|
-
var import_react28 = require("react");
|
|
2137
|
-
var import_core18 = require("@xaui/core");
|
|
2138
|
-
var useAutocompleteItemSizeStyles = (size) => {
|
|
2139
|
-
const theme = useXUITheme();
|
|
2140
|
-
return (0, import_react28.useMemo)(() => {
|
|
2141
|
-
const sizes = {
|
|
2142
|
-
xs: {
|
|
2143
|
-
paddingVertical: theme.spacing.sm,
|
|
2144
|
-
paddingHorizontal: theme.spacing.sm,
|
|
2145
|
-
titleSize: theme.fontSizes.xs,
|
|
2146
|
-
descriptionSize: theme.fontSizes.xs
|
|
2147
|
-
},
|
|
2148
|
-
sm: {
|
|
2149
|
-
paddingVertical: theme.spacing.sm,
|
|
2150
|
-
paddingHorizontal: theme.spacing.sm,
|
|
2151
|
-
titleSize: theme.fontSizes.sm,
|
|
2152
|
-
descriptionSize: theme.fontSizes.xs
|
|
2153
|
-
},
|
|
2154
|
-
md: {
|
|
2155
|
-
paddingVertical: theme.spacing.sm,
|
|
2156
|
-
paddingHorizontal: theme.spacing.sm,
|
|
2157
|
-
titleSize: theme.fontSizes.md,
|
|
2158
|
-
descriptionSize: theme.fontSizes.xs
|
|
2159
|
-
},
|
|
2160
|
-
lg: {
|
|
2161
|
-
paddingVertical: theme.spacing.sm,
|
|
2162
|
-
paddingHorizontal: theme.spacing.sm,
|
|
2163
|
-
titleSize: theme.fontSizes.lg,
|
|
2164
|
-
descriptionSize: theme.fontSizes.md
|
|
2165
|
-
}
|
|
2166
|
-
};
|
|
2167
|
-
return sizes[size];
|
|
2168
|
-
}, [size, theme]);
|
|
2169
|
-
};
|
|
2170
|
-
var useAutocompleteItemBackgroundColor = (themeColor, isSelected) => {
|
|
2171
|
-
const theme = useXUITheme();
|
|
2172
|
-
const safeThemeColor = (0, import_core18.getSafeThemeColor)(themeColor);
|
|
2173
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
2174
|
-
return (0, import_react28.useMemo)(() => {
|
|
2175
|
-
return "transparent";
|
|
2176
|
-
}, [isSelected, colorScheme]);
|
|
2177
|
-
};
|
|
2178
|
-
var useAutocompleteItemTextColors = () => {
|
|
2179
|
-
const theme = useXUITheme();
|
|
2180
|
-
return (0, import_react28.useMemo)(() => {
|
|
2181
|
-
return {
|
|
2182
|
-
textColor: theme.colors.foreground,
|
|
2183
|
-
descriptionColor: theme.colors.foreground
|
|
2184
|
-
};
|
|
2185
|
-
}, [theme]);
|
|
2186
|
-
};
|
|
2187
|
-
var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
2188
|
-
const theme = useXUITheme();
|
|
2189
|
-
const safeThemeColor = (0, import_core18.getSafeThemeColor)(themeColor);
|
|
2190
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
2191
|
-
return (0, import_react28.useMemo)(() => {
|
|
2192
|
-
if (themeColor === "default") {
|
|
2193
|
-
return theme.colors.primary.main;
|
|
2194
|
-
}
|
|
2195
|
-
return colorScheme.main;
|
|
2196
|
-
}, [themeColor, colorScheme, theme]);
|
|
2197
|
-
};
|
|
2198
|
-
var useAutocompleteItemStyles = (isSelected, _isDisabled) => {
|
|
2199
|
-
const context = (0, import_react28.useContext)(AutocompleteContext);
|
|
2200
|
-
const backgroundColor = useAutocompleteItemBackgroundColor(
|
|
2201
|
-
context.themeColor,
|
|
2202
|
-
isSelected
|
|
2203
|
-
);
|
|
2204
|
-
const { textColor, descriptionColor } = useAutocompleteItemTextColors();
|
|
2205
|
-
const checkmarkColor = useAutocompleteItemCheckmarkColor(context.themeColor);
|
|
2206
|
-
return {
|
|
2207
|
-
backgroundColor,
|
|
2208
|
-
labelColor: textColor,
|
|
2209
|
-
descriptionColor,
|
|
2210
|
-
checkmarkColor
|
|
2211
|
-
};
|
|
2212
|
-
};
|
|
2213
|
-
|
|
2214
|
-
// src/components/autocomplete/autocomplete-item.tsx
|
|
2215
|
-
var defaultSize = "md";
|
|
2216
|
-
var AutocompleteItem = ({
|
|
2217
|
-
label,
|
|
2218
|
-
description,
|
|
2219
|
-
startContent,
|
|
2220
|
-
endContent,
|
|
2221
|
-
selectedIcon: _selectedIcon,
|
|
2222
|
-
isDisabled = false,
|
|
2223
|
-
isSelected = false,
|
|
2224
|
-
isReadOnly = false,
|
|
2225
|
-
customAppearance,
|
|
2226
|
-
onSelected
|
|
2227
|
-
}) => {
|
|
2228
|
-
const context = (0, import_react29.useContext)(AutocompleteContext);
|
|
2229
|
-
const size = context?.size ?? defaultSize;
|
|
2230
|
-
const isItemDisabled = context?.isDisabled ? true : isDisabled;
|
|
2231
|
-
const sizeStyles = useAutocompleteItemSizeStyles(size);
|
|
2232
|
-
const { backgroundColor, labelColor, descriptionColor } = useAutocompleteItemStyles(isSelected, isItemDisabled);
|
|
2233
|
-
const handlePress = () => {
|
|
2234
|
-
if (isItemDisabled || isReadOnly) {
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
|
-
onSelected?.();
|
|
2238
|
-
};
|
|
2239
|
-
return /* @__PURE__ */ import_react29.default.createElement(
|
|
2240
|
-
import_react_native24.Pressable,
|
|
4862
|
+
return /* @__PURE__ */ import_react47.default.createElement(
|
|
4863
|
+
import_react_native42.View,
|
|
2241
4864
|
{
|
|
2242
|
-
onPress: handlePress,
|
|
2243
|
-
disabled: isItemDisabled,
|
|
2244
4865
|
style: [
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
2248
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
2249
|
-
backgroundColor
|
|
2250
|
-
},
|
|
2251
|
-
isItemDisabled && styles6.disabled,
|
|
4866
|
+
styles9.container,
|
|
4867
|
+
fullWidth ? styles9.fullWidth : styles9.minWidth,
|
|
2252
4868
|
customAppearance?.container
|
|
2253
4869
|
]
|
|
2254
4870
|
},
|
|
2255
|
-
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
styles6.title,
|
|
2261
|
-
{ fontSize: sizeStyles.titleSize, color: labelColor },
|
|
2262
|
-
customAppearance?.text
|
|
2263
|
-
]
|
|
2264
|
-
},
|
|
2265
|
-
label
|
|
2266
|
-
), description && /* @__PURE__ */ import_react29.default.createElement(
|
|
2267
|
-
import_react_native24.Text,
|
|
4871
|
+
isLabelOutside && labelBlock,
|
|
4872
|
+
isLabelOutsideLeft ? /* @__PURE__ */ import_react47.default.createElement(import_react_native42.View, { style: styles9.outsideLeftRow }, renderLabel, triggerContent) : triggerContent,
|
|
4873
|
+
shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */ import_react47.default.createElement(import_react_native42.Text, { style: [styles9.helperText, { color: helperColor }] }, helperContent) : /* @__PURE__ */ import_react47.default.createElement(import_react_native42.View, null, helperContent) : null,
|
|
4874
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
|
4875
|
+
DatePickerDialog,
|
|
2268
4876
|
{
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
4877
|
+
visible: isOpen,
|
|
4878
|
+
selectedDate,
|
|
4879
|
+
locale,
|
|
4880
|
+
firstDayOfWeek,
|
|
4881
|
+
themeColor,
|
|
4882
|
+
minDate,
|
|
4883
|
+
maxDate,
|
|
4884
|
+
style: customAppearance?.calendar,
|
|
4885
|
+
onDateSelect: handleDateSelect,
|
|
4886
|
+
onClearValue: handleClear,
|
|
4887
|
+
onClose: handleClose
|
|
4888
|
+
}
|
|
4889
|
+
)
|
|
2277
4890
|
);
|
|
2278
4891
|
};
|
|
2279
4892
|
|
|
2280
4893
|
// src/components/typography/typography.tsx
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
4894
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
4895
|
+
var import_react_native44 = require("react-native");
|
|
2283
4896
|
|
|
2284
4897
|
// src/components/typography/typography.style.ts
|
|
2285
|
-
var
|
|
2286
|
-
var
|
|
4898
|
+
var import_react_native43 = require("react-native");
|
|
4899
|
+
var styles11 = import_react_native43.StyleSheet.create({
|
|
2287
4900
|
text: {
|
|
2288
4901
|
includeFontPadding: false
|
|
2289
4902
|
}
|
|
2290
4903
|
});
|
|
2291
4904
|
|
|
2292
4905
|
// src/components/typography/typography.hook.ts
|
|
2293
|
-
var
|
|
2294
|
-
var
|
|
4906
|
+
var import_react48 = require("react");
|
|
4907
|
+
var import_core37 = require("@xaui/core");
|
|
2295
4908
|
var knownVariants = {
|
|
2296
4909
|
caption: true,
|
|
2297
4910
|
headlineLarge: true,
|
|
@@ -2309,18 +4922,18 @@ var isKnownVariant = (variant) => {
|
|
|
2309
4922
|
};
|
|
2310
4923
|
var useTypographyColor = (themeColor) => {
|
|
2311
4924
|
const theme = useXUITheme();
|
|
2312
|
-
const color = (0,
|
|
4925
|
+
const color = (0, import_react48.useMemo)(() => {
|
|
2313
4926
|
if (themeColor === "default") {
|
|
2314
4927
|
return theme.colors.foreground;
|
|
2315
4928
|
}
|
|
2316
|
-
const safeThemeColor = (0,
|
|
4929
|
+
const safeThemeColor = (0, import_core37.getSafeThemeColor)(themeColor);
|
|
2317
4930
|
return theme.colors[safeThemeColor].main;
|
|
2318
4931
|
}, [theme, themeColor]);
|
|
2319
4932
|
return color;
|
|
2320
4933
|
};
|
|
2321
4934
|
var useTypographyVariantStyles = (variant) => {
|
|
2322
4935
|
const theme = useXUITheme();
|
|
2323
|
-
const variantStyles = (0,
|
|
4936
|
+
const variantStyles = (0, import_react48.useMemo)(() => {
|
|
2324
4937
|
if (!isKnownVariant(variant)) {
|
|
2325
4938
|
return {
|
|
2326
4939
|
fontFamily: theme.fontFamilies.body,
|
|
@@ -2328,7 +4941,7 @@ var useTypographyVariantStyles = (variant) => {
|
|
|
2328
4941
|
fontWeight: theme.fontWeights.normal
|
|
2329
4942
|
};
|
|
2330
4943
|
}
|
|
2331
|
-
const
|
|
4944
|
+
const styles12 = {
|
|
2332
4945
|
caption: {
|
|
2333
4946
|
fontFamily: theme.fontFamilies.body,
|
|
2334
4947
|
fontSize: theme.fontSizes.xs,
|
|
@@ -2380,7 +4993,7 @@ var useTypographyVariantStyles = (variant) => {
|
|
|
2380
4993
|
fontWeight: theme.fontWeights.normal
|
|
2381
4994
|
}
|
|
2382
4995
|
};
|
|
2383
|
-
return
|
|
4996
|
+
return styles12[variant];
|
|
2384
4997
|
}, [theme, variant]);
|
|
2385
4998
|
return variantStyles;
|
|
2386
4999
|
};
|
|
@@ -2398,18 +5011,18 @@ var Typography = ({
|
|
|
2398
5011
|
const color = useTypographyColor(themeColor);
|
|
2399
5012
|
const variantStyles = useTypographyVariantStyles(variant);
|
|
2400
5013
|
const colorStyle = { color };
|
|
2401
|
-
const ellipsizeMode = (0,
|
|
5014
|
+
const ellipsizeMode = (0, import_react49.useMemo)(() => {
|
|
2402
5015
|
if (!maxLines) return void 0;
|
|
2403
5016
|
if (overflow === "clip") return "clip";
|
|
2404
5017
|
return "tail";
|
|
2405
5018
|
}, [maxLines, overflow]);
|
|
2406
|
-
return /* @__PURE__ */
|
|
2407
|
-
|
|
5019
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
5020
|
+
import_react_native44.Text,
|
|
2408
5021
|
{
|
|
2409
5022
|
numberOfLines: maxLines,
|
|
2410
5023
|
ellipsizeMode,
|
|
2411
5024
|
style: [
|
|
2412
|
-
|
|
5025
|
+
styles11.text,
|
|
2413
5026
|
variantStyles,
|
|
2414
5027
|
align && { textAlign: align },
|
|
2415
5028
|
colorStyle,
|
|
@@ -2425,6 +5038,10 @@ var Typography = ({
|
|
|
2425
5038
|
Alert,
|
|
2426
5039
|
Autocomplete,
|
|
2427
5040
|
AutocompleteItem,
|
|
5041
|
+
Avatar,
|
|
5042
|
+
AvatarGroup,
|
|
5043
|
+
Badge,
|
|
5044
|
+
DatePicker,
|
|
2428
5045
|
Divider,
|
|
2429
5046
|
Typography
|
|
2430
5047
|
});
|