@xaui/native 0.0.10 → 0.0.11
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.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-XJKA22BK.js +197 -0
- package/dist/index.cjs +716 -247
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -3
- package/package.json +11 -1
- package/dist/{chunk-SVYTCEGB.js → chunk-W7JJVPK5.js} +3 -3
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,9 @@ __export(src_exports, {
|
|
|
34
34
|
Alert: () => Alert,
|
|
35
35
|
Autocomplete: () => Autocomplete,
|
|
36
36
|
AutocompleteItem: () => AutocompleteItem,
|
|
37
|
+
Avatar: () => Avatar,
|
|
38
|
+
AvatarGroup: () => AvatarGroup,
|
|
39
|
+
Badge: () => Badge,
|
|
37
40
|
Divider: () => Divider,
|
|
38
41
|
Typography: () => Typography
|
|
39
42
|
});
|
|
@@ -542,14 +545,477 @@ var Divider = ({
|
|
|
542
545
|
);
|
|
543
546
|
};
|
|
544
547
|
|
|
545
|
-
// src/components/
|
|
546
|
-
var
|
|
548
|
+
// src/components/avatar/avatar.tsx
|
|
549
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
550
|
+
var import_react_native11 = require("react-native");
|
|
551
|
+
|
|
552
|
+
// src/components/avatar/avatar.style.ts
|
|
553
|
+
var import_react_native10 = require("react-native");
|
|
554
|
+
var styles3 = import_react_native10.StyleSheet.create({
|
|
555
|
+
container: {
|
|
556
|
+
overflow: "hidden",
|
|
557
|
+
alignItems: "center",
|
|
558
|
+
justifyContent: "center"
|
|
559
|
+
},
|
|
560
|
+
image: {
|
|
561
|
+
width: "100%",
|
|
562
|
+
height: "100%"
|
|
563
|
+
},
|
|
564
|
+
fallback: {
|
|
565
|
+
alignItems: "center",
|
|
566
|
+
justifyContent: "center"
|
|
567
|
+
},
|
|
568
|
+
group: {
|
|
569
|
+
flexDirection: "row",
|
|
570
|
+
alignItems: "center"
|
|
571
|
+
},
|
|
572
|
+
grid: {
|
|
573
|
+
flexDirection: "row",
|
|
574
|
+
flexWrap: "wrap",
|
|
575
|
+
alignItems: "flex-start"
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
// src/components/avatar/avatar.hook.ts
|
|
580
|
+
var import_react12 = require("react");
|
|
581
|
+
var import_core7 = require("@xaui/core");
|
|
582
|
+
var sizeMap = {
|
|
583
|
+
xs: 24,
|
|
584
|
+
sm: 32,
|
|
585
|
+
md: 40,
|
|
586
|
+
lg: 48
|
|
587
|
+
};
|
|
588
|
+
function resolveAvatarSize(size) {
|
|
589
|
+
if (typeof size === "number") {
|
|
590
|
+
return size;
|
|
591
|
+
}
|
|
592
|
+
return sizeMap[size];
|
|
593
|
+
}
|
|
594
|
+
function useAvatarSizeStyles(size) {
|
|
595
|
+
const theme = useXUITheme();
|
|
596
|
+
const resolvedSize = (0, import_react12.useMemo)(() => resolveAvatarSize(size), [size]);
|
|
597
|
+
const fontSize = (0, import_react12.useMemo)(() => {
|
|
598
|
+
if (typeof size === "number") {
|
|
599
|
+
return Math.max(10, Math.round(size * 0.4));
|
|
600
|
+
}
|
|
601
|
+
return theme.fontSizes[size];
|
|
602
|
+
}, [size, theme]);
|
|
603
|
+
return {
|
|
604
|
+
size: resolvedSize,
|
|
605
|
+
fontSize
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function useAvatarRadiusStyles(radius, size) {
|
|
609
|
+
const theme = useXUITheme();
|
|
610
|
+
return (0, import_react12.useMemo)(() => {
|
|
611
|
+
if (radius === "full") {
|
|
612
|
+
return { borderRadius: size / 2 };
|
|
613
|
+
}
|
|
614
|
+
const radii = {
|
|
615
|
+
none: theme.borderRadius.none,
|
|
616
|
+
sm: theme.borderRadius.sm,
|
|
617
|
+
md: theme.borderRadius.md,
|
|
618
|
+
lg: theme.borderRadius.lg,
|
|
619
|
+
full: theme.borderRadius.full
|
|
620
|
+
};
|
|
621
|
+
return { borderRadius: radii[radius] };
|
|
622
|
+
}, [radius, size, theme]);
|
|
623
|
+
}
|
|
624
|
+
function useAvatarColors(themeColor, isDisabled) {
|
|
625
|
+
const theme = useXUITheme();
|
|
626
|
+
const safeThemeColor = (0, import_core7.getSafeThemeColor)(themeColor);
|
|
627
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
628
|
+
const backgroundColor = (0, import_react12.useMemo)(() => {
|
|
629
|
+
if (isDisabled) {
|
|
630
|
+
return theme.colors.background;
|
|
631
|
+
}
|
|
632
|
+
return colorScheme.background;
|
|
633
|
+
}, [colorScheme.background, isDisabled, theme.colors.background]);
|
|
634
|
+
const textColor = (0, import_react12.useMemo)(() => {
|
|
635
|
+
if (safeThemeColor === "default") {
|
|
636
|
+
return theme.colors.foreground;
|
|
637
|
+
}
|
|
638
|
+
return colorScheme.main;
|
|
639
|
+
}, [safeThemeColor, colorScheme.main, theme.colors.foreground]);
|
|
640
|
+
return {
|
|
641
|
+
backgroundColor,
|
|
642
|
+
textColor,
|
|
643
|
+
borderColor: colorScheme.main
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function getDefaultInitials(name) {
|
|
647
|
+
const trimmed = name.trim();
|
|
648
|
+
if (!trimmed) {
|
|
649
|
+
return "";
|
|
650
|
+
}
|
|
651
|
+
const parts = trimmed.split(/\s+/);
|
|
652
|
+
if (parts.length === 1) {
|
|
653
|
+
return parts[0].slice(0, 2).toUpperCase();
|
|
654
|
+
}
|
|
655
|
+
return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// src/components/avatar/avatar.tsx
|
|
659
|
+
var Avatar = ({
|
|
660
|
+
src,
|
|
661
|
+
name,
|
|
662
|
+
icon,
|
|
663
|
+
fallback,
|
|
664
|
+
size = "md",
|
|
665
|
+
radius = "full",
|
|
666
|
+
themeColor = "default",
|
|
667
|
+
isBordered = false,
|
|
668
|
+
isDisabled = false,
|
|
669
|
+
showFallback = false,
|
|
670
|
+
getInitials,
|
|
671
|
+
customAppearance
|
|
672
|
+
}) => {
|
|
673
|
+
const [isError, setIsError] = import_react13.default.useState(false);
|
|
674
|
+
const { size: resolvedSize, fontSize } = useAvatarSizeStyles(size);
|
|
675
|
+
const radiusStyles = useAvatarRadiusStyles(radius, resolvedSize);
|
|
676
|
+
const { backgroundColor, textColor, borderColor } = useAvatarColors(
|
|
677
|
+
themeColor,
|
|
678
|
+
isDisabled
|
|
679
|
+
);
|
|
680
|
+
const accessibilityLabel = name ?? "Avatar";
|
|
681
|
+
const shouldShowFallback = showFallback || !src || isError;
|
|
682
|
+
const initials = name ? (getInitials ?? getDefaultInitials)(name) : "";
|
|
683
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
684
|
+
import_react_native11.View,
|
|
685
|
+
{
|
|
686
|
+
style: [
|
|
687
|
+
styles3.container,
|
|
688
|
+
{
|
|
689
|
+
width: resolvedSize,
|
|
690
|
+
height: resolvedSize,
|
|
691
|
+
backgroundColor,
|
|
692
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
693
|
+
borderWidth: isBordered ? 1 : 0,
|
|
694
|
+
borderColor: isBordered ? borderColor : "transparent"
|
|
695
|
+
},
|
|
696
|
+
radiusStyles,
|
|
697
|
+
customAppearance?.container
|
|
698
|
+
],
|
|
699
|
+
accessible: true,
|
|
700
|
+
accessibilityRole: "image",
|
|
701
|
+
accessibilityLabel
|
|
702
|
+
},
|
|
703
|
+
!shouldShowFallback && src ? /* @__PURE__ */ import_react13.default.createElement(
|
|
704
|
+
import_react_native11.Image,
|
|
705
|
+
{
|
|
706
|
+
source: { uri: src },
|
|
707
|
+
style: [styles3.image, radiusStyles, customAppearance?.image],
|
|
708
|
+
accessibilityLabel,
|
|
709
|
+
onError: () => setIsError(true)
|
|
710
|
+
}
|
|
711
|
+
) : /* @__PURE__ */ import_react13.default.createElement(import_react_native11.View, { style: [styles3.fallback, { width: "100%", height: "100%" }] }, fallback ?? icon ?? /* @__PURE__ */ import_react13.default.createElement(
|
|
712
|
+
import_react_native11.Text,
|
|
713
|
+
{
|
|
714
|
+
style: [
|
|
715
|
+
{
|
|
716
|
+
color: textColor,
|
|
717
|
+
fontSize,
|
|
718
|
+
fontWeight: "600"
|
|
719
|
+
},
|
|
720
|
+
customAppearance?.text
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
initials
|
|
724
|
+
))
|
|
725
|
+
);
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// src/components/avatar/avatar-group.tsx
|
|
729
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
547
730
|
var import_react_native12 = require("react-native");
|
|
731
|
+
var AvatarGroup = ({
|
|
732
|
+
children,
|
|
733
|
+
max,
|
|
734
|
+
total,
|
|
735
|
+
size = "md",
|
|
736
|
+
radius = "full",
|
|
737
|
+
themeColor = "default",
|
|
738
|
+
isBordered = false,
|
|
739
|
+
isDisabled = false,
|
|
740
|
+
isGrid = false,
|
|
741
|
+
renderCount,
|
|
742
|
+
customAppearance
|
|
743
|
+
}) => {
|
|
744
|
+
const theme = useXUITheme();
|
|
745
|
+
const resolvedSize = resolveAvatarSize(size);
|
|
746
|
+
const spacing = theme.spacing.xs;
|
|
747
|
+
const overlap = Math.round(resolvedSize * 0.28);
|
|
748
|
+
const allChildren = import_react14.default.Children.toArray(children).filter(
|
|
749
|
+
(child) => import_react14.default.isValidElement(child)
|
|
750
|
+
);
|
|
751
|
+
const totalCount = total ?? allChildren.length;
|
|
752
|
+
const maxCount = max ?? totalCount;
|
|
753
|
+
const visibleChildren = allChildren.slice(0, maxCount);
|
|
754
|
+
const remaining = Math.max(0, totalCount - maxCount);
|
|
755
|
+
const enhanced = visibleChildren.map((child, index) => {
|
|
756
|
+
const childProps = child.props;
|
|
757
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
758
|
+
import_react_native12.View,
|
|
759
|
+
{
|
|
760
|
+
key: child.key ?? index,
|
|
761
|
+
style: isGrid ? { marginRight: spacing, marginBottom: spacing } : { marginLeft: index === 0 ? 0 : -overlap, zIndex: index }
|
|
762
|
+
},
|
|
763
|
+
import_react14.default.cloneElement(child, {
|
|
764
|
+
size: childProps.size ?? size,
|
|
765
|
+
radius: childProps.radius ?? radius,
|
|
766
|
+
themeColor: childProps.themeColor ?? themeColor,
|
|
767
|
+
isBordered: childProps.isBordered ?? isBordered,
|
|
768
|
+
isDisabled: childProps.isDisabled ?? isDisabled
|
|
769
|
+
})
|
|
770
|
+
);
|
|
771
|
+
});
|
|
772
|
+
const countNode = remaining > 0 ? renderCount?.(remaining) ?? /* @__PURE__ */ import_react14.default.createElement(
|
|
773
|
+
Avatar,
|
|
774
|
+
{
|
|
775
|
+
name: `+${remaining}`,
|
|
776
|
+
showFallback: true,
|
|
777
|
+
size,
|
|
778
|
+
radius,
|
|
779
|
+
themeColor,
|
|
780
|
+
isBordered,
|
|
781
|
+
isDisabled,
|
|
782
|
+
fallback: /* @__PURE__ */ import_react14.default.createElement(
|
|
783
|
+
import_react_native12.Text,
|
|
784
|
+
{
|
|
785
|
+
style: {
|
|
786
|
+
color: theme.colors.foreground,
|
|
787
|
+
fontSize: Math.max(10, Math.round(resolvedSize * 0.35)),
|
|
788
|
+
fontWeight: "600"
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
"+",
|
|
792
|
+
remaining
|
|
793
|
+
)
|
|
794
|
+
}
|
|
795
|
+
) : null;
|
|
796
|
+
if (countNode) {
|
|
797
|
+
enhanced.push(
|
|
798
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
799
|
+
import_react_native12.View,
|
|
800
|
+
{
|
|
801
|
+
key: "avatar-count",
|
|
802
|
+
style: isGrid ? { marginRight: spacing, marginBottom: spacing } : {
|
|
803
|
+
marginLeft: enhanced.length === 0 ? 0 : -overlap,
|
|
804
|
+
zIndex: enhanced.length
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
countNode
|
|
808
|
+
)
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
812
|
+
import_react_native12.View,
|
|
813
|
+
{
|
|
814
|
+
style: [isGrid ? styles3.grid : styles3.group, customAppearance?.container],
|
|
815
|
+
accessible: true
|
|
816
|
+
},
|
|
817
|
+
enhanced
|
|
818
|
+
);
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
// src/components/badge/badge.tsx
|
|
822
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
823
|
+
var import_react_native14 = require("react-native");
|
|
824
|
+
|
|
825
|
+
// src/components/badge/badge.style.ts
|
|
826
|
+
var import_react_native13 = require("react-native");
|
|
827
|
+
var styles4 = import_react_native13.StyleSheet.create({
|
|
828
|
+
container: {
|
|
829
|
+
position: "relative",
|
|
830
|
+
alignSelf: "flex-start"
|
|
831
|
+
},
|
|
832
|
+
badge: {
|
|
833
|
+
position: "absolute",
|
|
834
|
+
alignItems: "center",
|
|
835
|
+
justifyContent: "center"
|
|
836
|
+
},
|
|
837
|
+
text: {
|
|
838
|
+
textAlign: "center",
|
|
839
|
+
fontWeight: "600",
|
|
840
|
+
includeFontPadding: false,
|
|
841
|
+
textAlignVertical: "center"
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
// src/components/badge/badge.hook.ts
|
|
846
|
+
var import_react15 = require("react");
|
|
847
|
+
var import_core10 = require("@xaui/core");
|
|
848
|
+
var sizeMap2 = {
|
|
849
|
+
sm: { height: 16, minWidth: 16, dot: 8 },
|
|
850
|
+
md: { height: 20, minWidth: 20, dot: 10 },
|
|
851
|
+
lg: { height: 24, minWidth: 24, dot: 12 }
|
|
852
|
+
};
|
|
853
|
+
var fontSizeMap = {
|
|
854
|
+
sm: 9,
|
|
855
|
+
md: 10,
|
|
856
|
+
lg: 12
|
|
857
|
+
};
|
|
858
|
+
function useBadgeSizeStyles(size, isDot, isOneChar) {
|
|
859
|
+
const theme = useXUITheme();
|
|
860
|
+
return (0, import_react15.useMemo)(() => {
|
|
861
|
+
const { height, minWidth, dot } = sizeMap2[size];
|
|
862
|
+
const fontSize = fontSizeMap[size];
|
|
863
|
+
if (isDot) {
|
|
864
|
+
return {
|
|
865
|
+
height: dot,
|
|
866
|
+
minWidth: dot,
|
|
867
|
+
paddingHorizontal: 0,
|
|
868
|
+
fontSize
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
if (isOneChar) {
|
|
872
|
+
return {
|
|
873
|
+
height,
|
|
874
|
+
minWidth: height,
|
|
875
|
+
paddingHorizontal: 0,
|
|
876
|
+
fontSize
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
const paddingHorizontal = size === "sm" ? theme.spacing.xs : theme.spacing.sm;
|
|
880
|
+
return {
|
|
881
|
+
height,
|
|
882
|
+
minWidth,
|
|
883
|
+
paddingHorizontal,
|
|
884
|
+
fontSize
|
|
885
|
+
};
|
|
886
|
+
}, [isDot, isOneChar, size, theme]);
|
|
887
|
+
}
|
|
888
|
+
function useBadgeVariantStyles(themeColor, variant) {
|
|
889
|
+
const theme = useXUITheme();
|
|
890
|
+
const safeThemeColor = (0, import_core10.getSafeThemeColor)(themeColor);
|
|
891
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
892
|
+
return (0, import_react15.useMemo)(() => {
|
|
893
|
+
if (variant === "flat") {
|
|
894
|
+
return {
|
|
895
|
+
backgroundColor: colorScheme.background,
|
|
896
|
+
color: colorScheme.main
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
if (variant === "faded") {
|
|
900
|
+
return {
|
|
901
|
+
backgroundColor: (0, import_core10.withOpacity)(colorScheme.background, 0.7),
|
|
902
|
+
color: colorScheme.main
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
if (variant === "shadow") {
|
|
906
|
+
return {
|
|
907
|
+
backgroundColor: colorScheme.main,
|
|
908
|
+
color: colorScheme.foreground,
|
|
909
|
+
shadow: theme.shadows.sm
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
return {
|
|
913
|
+
backgroundColor: colorScheme.main,
|
|
914
|
+
color: colorScheme.foreground
|
|
915
|
+
};
|
|
916
|
+
}, [colorScheme, theme, variant]);
|
|
917
|
+
}
|
|
918
|
+
function useBadgeRadiusStyles(radius, height) {
|
|
919
|
+
const theme = useXUITheme();
|
|
920
|
+
return (0, import_react15.useMemo)(() => {
|
|
921
|
+
if (radius === "full") {
|
|
922
|
+
return { borderRadius: height / 2 };
|
|
923
|
+
}
|
|
924
|
+
return { borderRadius: theme.borderRadius[radius] };
|
|
925
|
+
}, [height, radius, theme.borderRadius]);
|
|
926
|
+
}
|
|
927
|
+
function useBadgePlacementStyles(placement, height) {
|
|
928
|
+
return (0, import_react15.useMemo)(() => {
|
|
929
|
+
const offset = Math.round(height * 0.3);
|
|
930
|
+
switch (placement) {
|
|
931
|
+
case "top-left":
|
|
932
|
+
return { top: -offset, left: -offset };
|
|
933
|
+
case "bottom-right":
|
|
934
|
+
return { bottom: -offset, right: -offset };
|
|
935
|
+
case "bottom-left":
|
|
936
|
+
return { bottom: -offset, left: -offset };
|
|
937
|
+
case "top-right":
|
|
938
|
+
default:
|
|
939
|
+
return { top: -offset, right: -offset };
|
|
940
|
+
}
|
|
941
|
+
}, [height, placement]);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// src/components/badge/badge.tsx
|
|
945
|
+
var Badge = ({
|
|
946
|
+
children,
|
|
947
|
+
content,
|
|
948
|
+
themeColor = "primary",
|
|
949
|
+
variant = "solid",
|
|
950
|
+
size = "md",
|
|
951
|
+
radius = "full",
|
|
952
|
+
placement = "top-right",
|
|
953
|
+
showOutline = true,
|
|
954
|
+
disableOutline = false,
|
|
955
|
+
isInvisible = false,
|
|
956
|
+
isDot = false,
|
|
957
|
+
isOneChar = false,
|
|
958
|
+
disableAnimation = false,
|
|
959
|
+
customAppearance
|
|
960
|
+
}) => {
|
|
961
|
+
const shouldRender = !isInvisible && (isDot || content !== void 0);
|
|
962
|
+
if (!shouldRender && !children) {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
const forceOneChar = isOneChar || radius === "full";
|
|
966
|
+
const sizeStyles = useBadgeSizeStyles(size, isDot, forceOneChar);
|
|
967
|
+
const variantStyles = useBadgeVariantStyles(themeColor, variant);
|
|
968
|
+
const radiusStyles = useBadgeRadiusStyles(radius, sizeStyles.height);
|
|
969
|
+
const placementStyles = useBadgePlacementStyles(placement, sizeStyles.height);
|
|
970
|
+
const outlineEnabled = disableOutline ? false : showOutline;
|
|
971
|
+
const outlineStyles = outlineEnabled ? { borderWidth: 1, borderColor: "#FFFFFF" } : { borderWidth: 0, borderColor: "transparent" };
|
|
972
|
+
const badgeContent = isDot ? null : content;
|
|
973
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react_native14.View, { style: [styles4.container, customAppearance?.container] }, children, shouldRender && /* @__PURE__ */ import_react16.default.createElement(
|
|
974
|
+
import_react_native14.View,
|
|
975
|
+
{
|
|
976
|
+
style: [
|
|
977
|
+
styles4.badge,
|
|
978
|
+
{
|
|
979
|
+
minWidth: sizeStyles.minWidth,
|
|
980
|
+
height: sizeStyles.height,
|
|
981
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
982
|
+
backgroundColor: variantStyles.backgroundColor,
|
|
983
|
+
opacity: disableAnimation ? 1 : 1
|
|
984
|
+
},
|
|
985
|
+
radiusStyles,
|
|
986
|
+
placementStyles,
|
|
987
|
+
outlineStyles,
|
|
988
|
+
variantStyles.shadow,
|
|
989
|
+
customAppearance?.badge
|
|
990
|
+
],
|
|
991
|
+
accessible: true,
|
|
992
|
+
accessibilityRole: "text"
|
|
993
|
+
},
|
|
994
|
+
badgeContent !== void 0 && badgeContent !== null && /* @__PURE__ */ import_react16.default.createElement(
|
|
995
|
+
import_react_native14.Text,
|
|
996
|
+
{
|
|
997
|
+
style: [
|
|
998
|
+
styles4.text,
|
|
999
|
+
{
|
|
1000
|
+
fontSize: sizeStyles.fontSize,
|
|
1001
|
+
color: variantStyles.color
|
|
1002
|
+
},
|
|
1003
|
+
customAppearance?.text
|
|
1004
|
+
]
|
|
1005
|
+
},
|
|
1006
|
+
badgeContent
|
|
1007
|
+
)
|
|
1008
|
+
));
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
// src/components/alert/alert.tsx
|
|
1012
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
1013
|
+
var import_react_native17 = require("react-native");
|
|
548
1014
|
var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"), 1);
|
|
549
1015
|
|
|
550
1016
|
// src/components/alert/alert.style.ts
|
|
551
|
-
var
|
|
552
|
-
var
|
|
1017
|
+
var import_react_native15 = require("react-native");
|
|
1018
|
+
var styles5 = import_react_native15.StyleSheet.create({
|
|
553
1019
|
container: {
|
|
554
1020
|
flexDirection: "row",
|
|
555
1021
|
alignItems: "center",
|
|
@@ -587,11 +1053,11 @@ var styles3 = import_react_native10.StyleSheet.create({
|
|
|
587
1053
|
});
|
|
588
1054
|
|
|
589
1055
|
// src/components/alert/alert.hook.ts
|
|
590
|
-
var
|
|
591
|
-
var
|
|
1056
|
+
var import_react17 = require("react");
|
|
1057
|
+
var import_core12 = require("@xaui/core");
|
|
592
1058
|
var useAlertColorScheme = (themeColor) => {
|
|
593
1059
|
const theme = useXUITheme();
|
|
594
|
-
const safeThemeColor = (0,
|
|
1060
|
+
const safeThemeColor = (0, import_core12.getSafeThemeColor)(themeColor);
|
|
595
1061
|
return {
|
|
596
1062
|
theme,
|
|
597
1063
|
colorScheme: theme.colors[safeThemeColor],
|
|
@@ -600,10 +1066,10 @@ var useAlertColorScheme = (themeColor) => {
|
|
|
600
1066
|
};
|
|
601
1067
|
var useAlertContainerStyles = (themeColor, variant) => {
|
|
602
1068
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
603
|
-
const containerStyles = (0,
|
|
604
|
-
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? (0,
|
|
1069
|
+
const containerStyles = (0, import_react17.useMemo)(() => {
|
|
1070
|
+
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? (0, import_core12.withOpacity)(colorScheme.background, 0.75) : "transparent";
|
|
605
1071
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
|
|
606
|
-
const borderColor = variant === "bordered" ? (0,
|
|
1072
|
+
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
1073
|
return {
|
|
608
1074
|
backgroundColor,
|
|
609
1075
|
borderColor,
|
|
@@ -616,10 +1082,10 @@ var useAlertContainerStyles = (themeColor, variant) => {
|
|
|
616
1082
|
};
|
|
617
1083
|
var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
618
1084
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
619
|
-
const iconWrapperStyles = (0,
|
|
620
|
-
const backgroundColor = variant === "solid" ? (0,
|
|
1085
|
+
const iconWrapperStyles = (0, import_react17.useMemo)(() => {
|
|
1086
|
+
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
1087
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
|
|
622
|
-
const borderColor = (0,
|
|
1088
|
+
const borderColor = (0, import_core12.withOpacity)(
|
|
623
1089
|
isDefault ? theme.colors.foreground : colorScheme.main,
|
|
624
1090
|
0.2
|
|
625
1091
|
);
|
|
@@ -633,7 +1099,7 @@ var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
|
633
1099
|
};
|
|
634
1100
|
var useAlertTextStyles = (themeColor, variant) => {
|
|
635
1101
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
636
|
-
const textStyles = (0,
|
|
1102
|
+
const textStyles = (0, import_react17.useMemo)(() => {
|
|
637
1103
|
const baseTextColor = variant === "solid" ? colorScheme.foreground : isDefault ? theme.colors.foreground : colorScheme.main;
|
|
638
1104
|
return {
|
|
639
1105
|
titleStyles: {
|
|
@@ -642,7 +1108,7 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
642
1108
|
fontWeight: theme.fontWeights.semibold
|
|
643
1109
|
},
|
|
644
1110
|
descriptionStyles: {
|
|
645
|
-
color: (0,
|
|
1111
|
+
color: (0, import_core12.withOpacity)(baseTextColor, 0.75),
|
|
646
1112
|
fontSize: theme.fontSizes.xs,
|
|
647
1113
|
fontWeight: theme.fontWeights.normal
|
|
648
1114
|
},
|
|
@@ -654,10 +1120,10 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
654
1120
|
};
|
|
655
1121
|
|
|
656
1122
|
// src/components/alert/alert-icons.tsx
|
|
657
|
-
var
|
|
1123
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
658
1124
|
var import_react_native_svg = __toESM(require("react-native-svg"), 1);
|
|
659
1125
|
function InfoIcon({ color, size }) {
|
|
660
|
-
return /* @__PURE__ */
|
|
1126
|
+
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
1127
|
import_react_native_svg.Line,
|
|
662
1128
|
{
|
|
663
1129
|
x1: 12,
|
|
@@ -668,10 +1134,10 @@ function InfoIcon({ color, size }) {
|
|
|
668
1134
|
strokeWidth: 2,
|
|
669
1135
|
strokeLinecap: "round"
|
|
670
1136
|
}
|
|
671
|
-
), /* @__PURE__ */
|
|
1137
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 7, r: 1, fill: color }));
|
|
672
1138
|
}
|
|
673
1139
|
function SuccessIcon({ color, size }) {
|
|
674
|
-
return /* @__PURE__ */
|
|
1140
|
+
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
1141
|
import_react_native_svg.Path,
|
|
676
1142
|
{
|
|
677
1143
|
d: "M7 12.5L10.2 15.5L17 9",
|
|
@@ -683,7 +1149,7 @@ function SuccessIcon({ color, size }) {
|
|
|
683
1149
|
));
|
|
684
1150
|
}
|
|
685
1151
|
function WarningIcon({ color, size }) {
|
|
686
|
-
return /* @__PURE__ */
|
|
1152
|
+
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
1153
|
import_react_native_svg.Path,
|
|
688
1154
|
{
|
|
689
1155
|
d: "M12 3L22 20H2L12 3Z",
|
|
@@ -691,7 +1157,7 @@ function WarningIcon({ color, size }) {
|
|
|
691
1157
|
strokeWidth: 2,
|
|
692
1158
|
strokeLinejoin: "round"
|
|
693
1159
|
}
|
|
694
|
-
), /* @__PURE__ */
|
|
1160
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
695
1161
|
import_react_native_svg.Line,
|
|
696
1162
|
{
|
|
697
1163
|
x1: 12,
|
|
@@ -702,10 +1168,10 @@ function WarningIcon({ color, size }) {
|
|
|
702
1168
|
strokeWidth: 2,
|
|
703
1169
|
strokeLinecap: "round"
|
|
704
1170
|
}
|
|
705
|
-
), /* @__PURE__ */
|
|
1171
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native_svg.Circle, { cx: 12, cy: 17, r: 1, fill: color }));
|
|
706
1172
|
}
|
|
707
1173
|
function DangerIcon({ color, size }) {
|
|
708
|
-
return /* @__PURE__ */
|
|
1174
|
+
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
1175
|
import_react_native_svg.Line,
|
|
710
1176
|
{
|
|
711
1177
|
x1: 9,
|
|
@@ -716,7 +1182,7 @@ function DangerIcon({ color, size }) {
|
|
|
716
1182
|
strokeWidth: 2,
|
|
717
1183
|
strokeLinecap: "round"
|
|
718
1184
|
}
|
|
719
|
-
), /* @__PURE__ */
|
|
1185
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
720
1186
|
import_react_native_svg.Line,
|
|
721
1187
|
{
|
|
722
1188
|
x1: 15,
|
|
@@ -731,8 +1197,8 @@ function DangerIcon({ color, size }) {
|
|
|
731
1197
|
}
|
|
732
1198
|
|
|
733
1199
|
// src/components/icon/icons/close.tsx
|
|
734
|
-
var
|
|
735
|
-
var
|
|
1200
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
1201
|
+
var import_react_native16 = require("react-native");
|
|
736
1202
|
var import_react_native_svg2 = __toESM(require("react-native-svg"), 1);
|
|
737
1203
|
|
|
738
1204
|
// src/components/icon/icon.utils.ts
|
|
@@ -750,7 +1216,7 @@ var isThemeColor = (color) => {
|
|
|
750
1216
|
};
|
|
751
1217
|
|
|
752
1218
|
// src/components/icon/icons/close.tsx
|
|
753
|
-
var AnimatedPath =
|
|
1219
|
+
var AnimatedPath = import_react_native16.Animated.createAnimatedComponent(import_react_native_svg2.Path);
|
|
754
1220
|
var CloseIcon = ({
|
|
755
1221
|
variant = "baseline",
|
|
756
1222
|
size = 24,
|
|
@@ -758,24 +1224,24 @@ var CloseIcon = ({
|
|
|
758
1224
|
isAnimated = false
|
|
759
1225
|
}) => {
|
|
760
1226
|
const theme = useXUITheme();
|
|
761
|
-
const scaleAnim = (0,
|
|
762
|
-
const opacityAnim = (0,
|
|
763
|
-
const resolvedColor = (0,
|
|
1227
|
+
const scaleAnim = (0, import_react19.useRef)(new import_react_native16.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1228
|
+
const opacityAnim = (0, import_react19.useRef)(new import_react_native16.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1229
|
+
const resolvedColor = (0, import_react19.useMemo)(() => {
|
|
764
1230
|
if (typeof color === "string" && isThemeColor(color)) {
|
|
765
1231
|
return theme.colors[color].main;
|
|
766
1232
|
}
|
|
767
1233
|
return color;
|
|
768
1234
|
}, [color, theme]);
|
|
769
|
-
(0,
|
|
1235
|
+
(0, import_react19.useEffect)(() => {
|
|
770
1236
|
if (isAnimated) {
|
|
771
|
-
|
|
772
|
-
|
|
1237
|
+
import_react_native16.Animated.parallel([
|
|
1238
|
+
import_react_native16.Animated.spring(scaleAnim, {
|
|
773
1239
|
toValue: 1,
|
|
774
1240
|
useNativeDriver: true,
|
|
775
1241
|
tension: 50,
|
|
776
1242
|
friction: 7
|
|
777
1243
|
}),
|
|
778
|
-
|
|
1244
|
+
import_react_native16.Animated.timing(opacityAnim, {
|
|
779
1245
|
toValue: 1,
|
|
780
1246
|
duration: 200,
|
|
781
1247
|
useNativeDriver: true
|
|
@@ -787,7 +1253,7 @@ var CloseIcon = ({
|
|
|
787
1253
|
transform: [{ scale: scaleAnim }],
|
|
788
1254
|
opacity: opacityAnim
|
|
789
1255
|
} : void 0;
|
|
790
|
-
const renderBaseline = () => /* @__PURE__ */
|
|
1256
|
+
const renderBaseline = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
791
1257
|
AnimatedPath,
|
|
792
1258
|
{
|
|
793
1259
|
fill: resolvedColor,
|
|
@@ -795,7 +1261,7 @@ var CloseIcon = ({
|
|
|
795
1261
|
...animatedProps
|
|
796
1262
|
}
|
|
797
1263
|
);
|
|
798
|
-
const renderFilled = () => /* @__PURE__ */
|
|
1264
|
+
const renderFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
799
1265
|
AnimatedPath,
|
|
800
1266
|
{
|
|
801
1267
|
fill: resolvedColor,
|
|
@@ -803,14 +1269,14 @@ var CloseIcon = ({
|
|
|
803
1269
|
...animatedProps
|
|
804
1270
|
}
|
|
805
1271
|
);
|
|
806
|
-
const renderDuotone = () => /* @__PURE__ */
|
|
1272
|
+
const renderDuotone = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
807
1273
|
import_react_native_svg2.Path,
|
|
808
1274
|
{
|
|
809
1275
|
fill: resolvedColor,
|
|
810
1276
|
opacity: 0.3,
|
|
811
1277
|
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
812
1278
|
}
|
|
813
|
-
), /* @__PURE__ */
|
|
1279
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
814
1280
|
AnimatedPath,
|
|
815
1281
|
{
|
|
816
1282
|
fill: resolvedColor,
|
|
@@ -818,7 +1284,7 @@ var CloseIcon = ({
|
|
|
818
1284
|
...animatedProps
|
|
819
1285
|
}
|
|
820
1286
|
));
|
|
821
|
-
const renderRoundOutlined = () => /* @__PURE__ */
|
|
1287
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
822
1288
|
import_react_native_svg2.Circle,
|
|
823
1289
|
{
|
|
824
1290
|
cx: "256",
|
|
@@ -828,7 +1294,7 @@ var CloseIcon = ({
|
|
|
828
1294
|
stroke: resolvedColor,
|
|
829
1295
|
strokeWidth: 32
|
|
830
1296
|
}
|
|
831
|
-
), /* @__PURE__ */
|
|
1297
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
832
1298
|
AnimatedPath,
|
|
833
1299
|
{
|
|
834
1300
|
fill: resolvedColor,
|
|
@@ -836,7 +1302,7 @@ var CloseIcon = ({
|
|
|
836
1302
|
...animatedProps
|
|
837
1303
|
}
|
|
838
1304
|
));
|
|
839
|
-
const renderSquareOutlined = () => /* @__PURE__ */
|
|
1305
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
840
1306
|
import_react_native_svg2.Rect,
|
|
841
1307
|
{
|
|
842
1308
|
x: "64",
|
|
@@ -848,7 +1314,7 @@ var CloseIcon = ({
|
|
|
848
1314
|
stroke: resolvedColor,
|
|
849
1315
|
strokeWidth: 32
|
|
850
1316
|
}
|
|
851
|
-
), /* @__PURE__ */
|
|
1317
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
852
1318
|
AnimatedPath,
|
|
853
1319
|
{
|
|
854
1320
|
fill: resolvedColor,
|
|
@@ -856,7 +1322,7 @@ var CloseIcon = ({
|
|
|
856
1322
|
...animatedProps
|
|
857
1323
|
}
|
|
858
1324
|
));
|
|
859
|
-
const renderRoundFilled = () => /* @__PURE__ */
|
|
1325
|
+
const renderRoundFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
860
1326
|
AnimatedPath,
|
|
861
1327
|
{
|
|
862
1328
|
fill: resolvedColor,
|
|
@@ -864,7 +1330,7 @@ var CloseIcon = ({
|
|
|
864
1330
|
...animatedProps
|
|
865
1331
|
}
|
|
866
1332
|
);
|
|
867
|
-
const renderSquareFilled = () => /* @__PURE__ */
|
|
1333
|
+
const renderSquareFilled = () => /* @__PURE__ */ import_react19.default.createElement(
|
|
868
1334
|
AnimatedPath,
|
|
869
1335
|
{
|
|
870
1336
|
fill: resolvedColor,
|
|
@@ -891,7 +1357,7 @@ var CloseIcon = ({
|
|
|
891
1357
|
return renderBaseline();
|
|
892
1358
|
}
|
|
893
1359
|
};
|
|
894
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react_native_svg2.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
895
1361
|
};
|
|
896
1362
|
|
|
897
1363
|
// src/components/alert/alert.tsx
|
|
@@ -920,8 +1386,8 @@ var Alert = ({
|
|
|
920
1386
|
onClose,
|
|
921
1387
|
onVisibleChange
|
|
922
1388
|
}) => {
|
|
923
|
-
const [internalVisible, setInternalVisible] = (0,
|
|
924
|
-
const [shouldRender, setShouldRender] = (0,
|
|
1389
|
+
const [internalVisible, setInternalVisible] = (0, import_react20.useState)(isVisible ?? true);
|
|
1390
|
+
const [shouldRender, setShouldRender] = (0, import_react20.useState)(isVisible ?? true);
|
|
925
1391
|
const isControlled = typeof isVisible === "boolean";
|
|
926
1392
|
const visible = isControlled ? isVisible : internalVisible;
|
|
927
1393
|
const opacity = (0, import_react_native_reanimated3.useSharedValue)(1);
|
|
@@ -930,7 +1396,7 @@ var Alert = ({
|
|
|
930
1396
|
const containerStyles = useAlertContainerStyles(themeColor, variant);
|
|
931
1397
|
const iconWrapperStyles = useAlertIconWrapperStyles(themeColor, variant);
|
|
932
1398
|
const { titleStyles, descriptionStyles, iconColor, closeButtonColor } = useAlertTextStyles(themeColor, variant);
|
|
933
|
-
const finishClosing = (0,
|
|
1399
|
+
const finishClosing = (0, import_react20.useCallback)(() => {
|
|
934
1400
|
setShouldRender(false);
|
|
935
1401
|
if (!isControlled) {
|
|
936
1402
|
setInternalVisible(false);
|
|
@@ -938,7 +1404,7 @@ var Alert = ({
|
|
|
938
1404
|
onVisibleChange?.(false);
|
|
939
1405
|
onClose?.();
|
|
940
1406
|
}, [isControlled, onClose, onVisibleChange]);
|
|
941
|
-
const handleClose = (0,
|
|
1407
|
+
const handleClose = (0, import_react20.useCallback)(() => {
|
|
942
1408
|
if (!visible) return;
|
|
943
1409
|
opacity.value = (0, import_react_native_reanimated3.withTiming)(0, { duration: 250 });
|
|
944
1410
|
scale.value = (0, import_react_native_reanimated3.withTiming)(0.95, { duration: 250 }, (finished) => {
|
|
@@ -947,7 +1413,7 @@ var Alert = ({
|
|
|
947
1413
|
}
|
|
948
1414
|
});
|
|
949
1415
|
}, [finishClosing, opacity, scale, visible]);
|
|
950
|
-
(0,
|
|
1416
|
+
(0, import_react20.useEffect)(() => {
|
|
951
1417
|
if (visible && !shouldRender) {
|
|
952
1418
|
setShouldRender(true);
|
|
953
1419
|
opacity.value = 0;
|
|
@@ -968,22 +1434,22 @@ var Alert = ({
|
|
|
968
1434
|
const shouldShowClose = Boolean(closeButton || isClosable || onClose);
|
|
969
1435
|
const renderIcon = () => {
|
|
970
1436
|
if (hideIcon) return null;
|
|
971
|
-
if (icon && (0,
|
|
972
|
-
return (0,
|
|
1437
|
+
if (icon && (0, import_react20.isValidElement)(icon)) {
|
|
1438
|
+
return (0, import_react20.cloneElement)(icon, { color: iconColor, size: 22 });
|
|
973
1439
|
}
|
|
974
1440
|
if (icon) {
|
|
975
|
-
return /* @__PURE__ */
|
|
1441
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native17.Text, { style: [styles5.iconText, { color: iconColor }] }, icon);
|
|
976
1442
|
}
|
|
977
|
-
return /* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ import_react20.default.createElement(IconComponent, { color: iconColor, size: 22 });
|
|
978
1444
|
};
|
|
979
1445
|
const renderContentText = (content) => {
|
|
980
1446
|
if (content === null || content === void 0) return null;
|
|
981
1447
|
if (typeof content === "string" || typeof content === "number") {
|
|
982
|
-
return /* @__PURE__ */
|
|
983
|
-
|
|
1448
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1449
|
+
import_react_native17.Text,
|
|
984
1450
|
{
|
|
985
1451
|
style: [
|
|
986
|
-
|
|
1452
|
+
styles5.description,
|
|
987
1453
|
descriptionStyles,
|
|
988
1454
|
customAppearance?.description
|
|
989
1455
|
]
|
|
@@ -993,20 +1459,20 @@ var Alert = ({
|
|
|
993
1459
|
}
|
|
994
1460
|
return content;
|
|
995
1461
|
};
|
|
996
|
-
const titleNode = (0,
|
|
1462
|
+
const titleNode = (0, import_react20.useMemo)(() => {
|
|
997
1463
|
if (title === null || title === void 0) return null;
|
|
998
1464
|
if (typeof title === "string" || typeof title === "number") {
|
|
999
|
-
return /* @__PURE__ */
|
|
1465
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native17.Text, { style: [styles5.title, titleStyles, customAppearance?.title] }, title);
|
|
1000
1466
|
}
|
|
1001
1467
|
return title;
|
|
1002
1468
|
}, [title, customAppearance?.title, titleStyles]);
|
|
1003
1469
|
const descriptionNode = renderContentText(description);
|
|
1004
1470
|
const childrenNode = renderContentText(children);
|
|
1005
|
-
const closeButtonNode = (0,
|
|
1471
|
+
const closeButtonNode = (0, import_react20.useMemo)(() => {
|
|
1006
1472
|
if (!closeButton) return null;
|
|
1007
|
-
if (!(0,
|
|
1473
|
+
if (!(0, import_react20.isValidElement)(closeButton)) return closeButton;
|
|
1008
1474
|
const existingOnPress = closeButton.props.onPress;
|
|
1009
|
-
return (0,
|
|
1475
|
+
return (0, import_react20.cloneElement)(closeButton, {
|
|
1010
1476
|
onPress: (event) => {
|
|
1011
1477
|
existingOnPress?.(event);
|
|
1012
1478
|
handleClose();
|
|
@@ -1014,58 +1480,58 @@ var Alert = ({
|
|
|
1014
1480
|
});
|
|
1015
1481
|
}, [closeButton, handleClose]);
|
|
1016
1482
|
if (!shouldRender) return null;
|
|
1017
|
-
return /* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1018
1484
|
import_react_native_reanimated3.default.View,
|
|
1019
1485
|
{
|
|
1020
1486
|
accessibilityRole: "alert",
|
|
1021
1487
|
style: [
|
|
1022
|
-
|
|
1488
|
+
styles5.container,
|
|
1023
1489
|
containerStyles,
|
|
1024
1490
|
radiusStyles,
|
|
1025
1491
|
customAppearance?.container,
|
|
1026
1492
|
animatedStyle
|
|
1027
1493
|
]
|
|
1028
1494
|
},
|
|
1029
|
-
!hideIcon && /* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
shouldShowClose && /* @__PURE__ */
|
|
1032
|
-
|
|
1495
|
+
!hideIcon && /* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, { style: [styles5.iconWrapper, iconWrapperStyles] }, renderIcon()),
|
|
1496
|
+
/* @__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)),
|
|
1497
|
+
shouldShowClose && /* @__PURE__ */ import_react20.default.createElement(import_react_native17.View, null, closeButtonNode ?? /* @__PURE__ */ import_react20.default.createElement(
|
|
1498
|
+
import_react_native17.Pressable,
|
|
1033
1499
|
{
|
|
1034
1500
|
accessibilityRole: "button",
|
|
1035
1501
|
accessibilityLabel: "Close",
|
|
1036
1502
|
onPress: handleClose,
|
|
1037
|
-
style:
|
|
1503
|
+
style: styles5.closeButton
|
|
1038
1504
|
},
|
|
1039
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ import_react20.default.createElement(CloseIcon, { size: 20, color: closeButtonColor })
|
|
1040
1506
|
))
|
|
1041
1507
|
);
|
|
1042
1508
|
};
|
|
1043
1509
|
|
|
1044
1510
|
// src/components/autocomplete/autocomplete.tsx
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1511
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
1512
|
+
var import_react_native27 = require("react-native");
|
|
1047
1513
|
|
|
1048
1514
|
// src/components/autocomplete/autocomplete-context.ts
|
|
1049
|
-
var
|
|
1050
|
-
var AutocompleteContext = (0,
|
|
1515
|
+
var import_react21 = require("react");
|
|
1516
|
+
var AutocompleteContext = (0, import_react21.createContext)({
|
|
1051
1517
|
size: "md",
|
|
1052
1518
|
themeColor: "default",
|
|
1053
1519
|
isDisabled: false
|
|
1054
1520
|
});
|
|
1055
1521
|
|
|
1056
1522
|
// src/components/autocomplete/autocomplete.hook.ts
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1523
|
+
var import_react22 = require("react");
|
|
1524
|
+
var import_core15 = require("@xaui/core");
|
|
1059
1525
|
var import_palette2 = require("@xaui/core/palette");
|
|
1060
1526
|
var useAutocompleteColorScheme = (themeColor) => {
|
|
1061
1527
|
const theme = useXUITheme();
|
|
1062
|
-
const safeThemeColor = (0,
|
|
1528
|
+
const safeThemeColor = (0, import_core15.getSafeThemeColor)(themeColor);
|
|
1063
1529
|
const colorScheme = theme.colors[safeThemeColor];
|
|
1064
1530
|
return { theme, colorScheme };
|
|
1065
1531
|
};
|
|
1066
1532
|
var useAutocompleteSizeStyles = (size) => {
|
|
1067
1533
|
const theme = useXUITheme();
|
|
1068
|
-
return (0,
|
|
1534
|
+
return (0, import_react22.useMemo)(() => {
|
|
1069
1535
|
const sizes = {
|
|
1070
1536
|
xs: {
|
|
1071
1537
|
minHeight: 34,
|
|
@@ -1101,7 +1567,7 @@ var useAutocompleteSizeStyles = (size) => {
|
|
|
1101
1567
|
};
|
|
1102
1568
|
var useAutocompleteRadiusStyles = (radius) => {
|
|
1103
1569
|
const theme = useXUITheme();
|
|
1104
|
-
const radiusStyles = (0,
|
|
1570
|
+
const radiusStyles = (0, import_react22.useMemo)(() => {
|
|
1105
1571
|
const radii = {
|
|
1106
1572
|
none: theme.borderRadius.none,
|
|
1107
1573
|
sm: theme.borderRadius.sm,
|
|
@@ -1111,7 +1577,7 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
1111
1577
|
};
|
|
1112
1578
|
return { borderRadius: radii[radius] };
|
|
1113
1579
|
}, [radius, theme]);
|
|
1114
|
-
const listboxRadius = (0,
|
|
1580
|
+
const listboxRadius = (0, import_react22.useMemo)(() => {
|
|
1115
1581
|
const radii = {
|
|
1116
1582
|
none: theme.borderRadius.none,
|
|
1117
1583
|
sm: theme.borderRadius.sm,
|
|
@@ -1125,12 +1591,12 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
1125
1591
|
};
|
|
1126
1592
|
var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
1127
1593
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
1128
|
-
return (0,
|
|
1594
|
+
return (0, import_react22.useMemo)(() => {
|
|
1129
1595
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
1130
1596
|
if ((variant === "outlined" || variant === "faded") && themeColor === "default") {
|
|
1131
1597
|
borderColor = import_palette2.colors.gray[300];
|
|
1132
1598
|
}
|
|
1133
|
-
const
|
|
1599
|
+
const styles10 = {
|
|
1134
1600
|
outlined: {
|
|
1135
1601
|
backgroundColor: "transparent",
|
|
1136
1602
|
borderWidth: theme.borderWidth.md,
|
|
@@ -1155,12 +1621,12 @@ var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
1155
1621
|
borderColor
|
|
1156
1622
|
}
|
|
1157
1623
|
};
|
|
1158
|
-
return
|
|
1624
|
+
return styles10[variant];
|
|
1159
1625
|
}, [variant, theme, colorScheme, isInvalid, themeColor]);
|
|
1160
1626
|
};
|
|
1161
1627
|
var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
1162
1628
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
1163
|
-
return (0,
|
|
1629
|
+
return (0, import_react22.useMemo)(() => {
|
|
1164
1630
|
let baseColor = theme.colors.foreground;
|
|
1165
1631
|
if (isInvalid) {
|
|
1166
1632
|
baseColor = theme.colors.danger.main;
|
|
@@ -1175,7 +1641,7 @@ var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
|
1175
1641
|
};
|
|
1176
1642
|
var useAutocompleteHelperColor = (isInvalid) => {
|
|
1177
1643
|
const theme = useXUITheme();
|
|
1178
|
-
return (0,
|
|
1644
|
+
return (0, import_react22.useMemo)(() => {
|
|
1179
1645
|
if (isInvalid) {
|
|
1180
1646
|
return theme.colors.danger.main;
|
|
1181
1647
|
}
|
|
@@ -1184,8 +1650,8 @@ var useAutocompleteHelperColor = (isInvalid) => {
|
|
|
1184
1650
|
};
|
|
1185
1651
|
|
|
1186
1652
|
// src/components/autocomplete/autocomplete.style.ts
|
|
1187
|
-
var
|
|
1188
|
-
var
|
|
1653
|
+
var import_react_native18 = require("react-native");
|
|
1654
|
+
var styles6 = import_react_native18.StyleSheet.create({
|
|
1189
1655
|
container: {
|
|
1190
1656
|
gap: 6,
|
|
1191
1657
|
position: "relative"
|
|
@@ -1272,16 +1738,16 @@ var styles4 = import_react_native13.StyleSheet.create({
|
|
|
1272
1738
|
});
|
|
1273
1739
|
|
|
1274
1740
|
// src/components/autocomplete/autocomplete.state.hook.ts
|
|
1275
|
-
var
|
|
1741
|
+
var import_react23 = require("react");
|
|
1276
1742
|
var useAutocompleteOpenState = ({
|
|
1277
1743
|
isOpened,
|
|
1278
1744
|
isDisabled,
|
|
1279
1745
|
onOpenChange,
|
|
1280
1746
|
onClose
|
|
1281
1747
|
}) => {
|
|
1282
|
-
const [internalIsOpen, setInternalIsOpen] = (0,
|
|
1748
|
+
const [internalIsOpen, setInternalIsOpen] = (0, import_react23.useState)(false);
|
|
1283
1749
|
const isOpen = isOpened !== void 0 ? isOpened : internalIsOpen;
|
|
1284
|
-
const setOpen = (0,
|
|
1750
|
+
const setOpen = (0, import_react23.useCallback)(
|
|
1285
1751
|
(open) => {
|
|
1286
1752
|
if (isDisabled) {
|
|
1287
1753
|
return;
|
|
@@ -1304,9 +1770,9 @@ var useAutocompleteInputState = ({
|
|
|
1304
1770
|
selectedKey,
|
|
1305
1771
|
onInputChange
|
|
1306
1772
|
}) => {
|
|
1307
|
-
const [internalInputValue, setInternalInputValue] = (0,
|
|
1773
|
+
const [internalInputValue, setInternalInputValue] = (0, import_react23.useState)(defaultInputValue ?? "");
|
|
1308
1774
|
const currentInputValue = inputValue !== void 0 ? inputValue : internalInputValue;
|
|
1309
|
-
const updateInputValue = (0,
|
|
1775
|
+
const updateInputValue = (0, import_react23.useCallback)(
|
|
1310
1776
|
(value) => {
|
|
1311
1777
|
if (inputValue === void 0) {
|
|
1312
1778
|
setInternalInputValue(value);
|
|
@@ -1315,7 +1781,7 @@ var useAutocompleteInputState = ({
|
|
|
1315
1781
|
},
|
|
1316
1782
|
[inputValue, onInputChange]
|
|
1317
1783
|
);
|
|
1318
|
-
(0,
|
|
1784
|
+
(0, import_react23.useEffect)(() => {
|
|
1319
1785
|
if (selectedKey === null && inputValue === void 0) {
|
|
1320
1786
|
setInternalInputValue("");
|
|
1321
1787
|
}
|
|
@@ -1325,8 +1791,8 @@ var useAutocompleteInputState = ({
|
|
|
1325
1791
|
var useAutocompleteSelection = ({
|
|
1326
1792
|
onSelectionChange
|
|
1327
1793
|
}) => {
|
|
1328
|
-
const [currentSelectedKey, setCurrentSelectedKey] = (0,
|
|
1329
|
-
const updateSelection = (0,
|
|
1794
|
+
const [currentSelectedKey, setCurrentSelectedKey] = (0, import_react23.useState)(null);
|
|
1795
|
+
const updateSelection = (0, import_react23.useCallback)(
|
|
1330
1796
|
(key) => {
|
|
1331
1797
|
setCurrentSelectedKey(key);
|
|
1332
1798
|
onSelectionChange?.(key);
|
|
@@ -1350,14 +1816,14 @@ var defaultFilterFunction = (textValue, inputValue) => {
|
|
|
1350
1816
|
};
|
|
1351
1817
|
|
|
1352
1818
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.tsx
|
|
1353
|
-
var
|
|
1354
|
-
var
|
|
1819
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
1820
|
+
var import_react_native25 = require("react-native");
|
|
1355
1821
|
|
|
1356
1822
|
// src/components/select/checkmark-icon.tsx
|
|
1357
|
-
var
|
|
1823
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
1358
1824
|
var import_react_native_svg3 = __toESM(require("react-native-svg"), 1);
|
|
1359
1825
|
function CheckmarkIcon({ color, size }) {
|
|
1360
|
-
return /* @__PURE__ */
|
|
1826
|
+
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
1827
|
import_react_native_svg3.Polyline,
|
|
1362
1828
|
{
|
|
1363
1829
|
points: "1 9 7 14 15 4",
|
|
@@ -1370,14 +1836,14 @@ function CheckmarkIcon({ color, size }) {
|
|
|
1370
1836
|
}
|
|
1371
1837
|
|
|
1372
1838
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog-header.tsx
|
|
1373
|
-
var
|
|
1374
|
-
var
|
|
1839
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
1840
|
+
var import_react_native23 = require("react-native");
|
|
1375
1841
|
|
|
1376
1842
|
// src/components/icon/icons/arrow-back.tsx
|
|
1377
|
-
var
|
|
1378
|
-
var
|
|
1843
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
1844
|
+
var import_react_native19 = require("react-native");
|
|
1379
1845
|
var import_react_native_svg4 = __toESM(require("react-native-svg"), 1);
|
|
1380
|
-
var AnimatedPath2 =
|
|
1846
|
+
var AnimatedPath2 = import_react_native19.Animated.createAnimatedComponent(import_react_native_svg4.Path);
|
|
1381
1847
|
var ArrowBackIcon = ({
|
|
1382
1848
|
variant = "baseline",
|
|
1383
1849
|
size = 24,
|
|
@@ -1385,24 +1851,24 @@ var ArrowBackIcon = ({
|
|
|
1385
1851
|
isAnimated = false
|
|
1386
1852
|
}) => {
|
|
1387
1853
|
const theme = useXUITheme();
|
|
1388
|
-
const scaleAnim = (0,
|
|
1389
|
-
const opacityAnim = (0,
|
|
1390
|
-
const resolvedColor = (0,
|
|
1854
|
+
const scaleAnim = (0, import_react25.useRef)(new import_react_native19.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1855
|
+
const opacityAnim = (0, import_react25.useRef)(new import_react_native19.Animated.Value(isAnimated ? 0 : 1)).current;
|
|
1856
|
+
const resolvedColor = (0, import_react25.useMemo)(() => {
|
|
1391
1857
|
if (typeof color === "string" && isThemeColor(color)) {
|
|
1392
1858
|
return theme.colors[color].main;
|
|
1393
1859
|
}
|
|
1394
1860
|
return color;
|
|
1395
1861
|
}, [color, theme]);
|
|
1396
|
-
(0,
|
|
1862
|
+
(0, import_react25.useEffect)(() => {
|
|
1397
1863
|
if (isAnimated) {
|
|
1398
|
-
|
|
1399
|
-
|
|
1864
|
+
import_react_native19.Animated.parallel([
|
|
1865
|
+
import_react_native19.Animated.spring(scaleAnim, {
|
|
1400
1866
|
toValue: 1,
|
|
1401
1867
|
useNativeDriver: true,
|
|
1402
1868
|
tension: 50,
|
|
1403
1869
|
friction: 7
|
|
1404
1870
|
}),
|
|
1405
|
-
|
|
1871
|
+
import_react_native19.Animated.timing(opacityAnim, {
|
|
1406
1872
|
toValue: 1,
|
|
1407
1873
|
duration: 200,
|
|
1408
1874
|
useNativeDriver: true
|
|
@@ -1414,7 +1880,7 @@ var ArrowBackIcon = ({
|
|
|
1414
1880
|
transform: [{ scale: scaleAnim }],
|
|
1415
1881
|
opacity: opacityAnim
|
|
1416
1882
|
} : void 0;
|
|
1417
|
-
const renderArrow = () => /* @__PURE__ */
|
|
1883
|
+
const renderArrow = () => /* @__PURE__ */ import_react25.default.createElement(
|
|
1418
1884
|
AnimatedPath2,
|
|
1419
1885
|
{
|
|
1420
1886
|
fill: "none",
|
|
@@ -1426,7 +1892,7 @@ var ArrowBackIcon = ({
|
|
|
1426
1892
|
...animatedProps
|
|
1427
1893
|
}
|
|
1428
1894
|
);
|
|
1429
|
-
const renderDuotone = () => /* @__PURE__ */
|
|
1895
|
+
const renderDuotone = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1430
1896
|
import_react_native_svg4.Path,
|
|
1431
1897
|
{
|
|
1432
1898
|
fill: resolvedColor,
|
|
@@ -1434,7 +1900,7 @@ var ArrowBackIcon = ({
|
|
|
1434
1900
|
d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48z"
|
|
1435
1901
|
}
|
|
1436
1902
|
), renderArrow());
|
|
1437
|
-
const renderRoundOutlined = () => /* @__PURE__ */
|
|
1903
|
+
const renderRoundOutlined = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1438
1904
|
import_react_native_svg4.Circle,
|
|
1439
1905
|
{
|
|
1440
1906
|
cx: "256",
|
|
@@ -1445,7 +1911,7 @@ var ArrowBackIcon = ({
|
|
|
1445
1911
|
strokeWidth: 32
|
|
1446
1912
|
}
|
|
1447
1913
|
), renderArrow());
|
|
1448
|
-
const renderSquareOutlined = () => /* @__PURE__ */
|
|
1914
|
+
const renderSquareOutlined = () => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1449
1915
|
import_react_native_svg4.Rect,
|
|
1450
1916
|
{
|
|
1451
1917
|
x: "64",
|
|
@@ -1474,26 +1940,26 @@ var ArrowBackIcon = ({
|
|
|
1474
1940
|
return renderArrow();
|
|
1475
1941
|
}
|
|
1476
1942
|
};
|
|
1477
|
-
return /* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_react_native_svg4.default, { width: size, height: size, viewBox: "0 0 512 512" }, renderVariant());
|
|
1478
1944
|
};
|
|
1479
1945
|
|
|
1480
1946
|
// src/components/icon/icons/checkmark.tsx
|
|
1481
|
-
var
|
|
1482
|
-
var
|
|
1947
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
1948
|
+
var import_react_native20 = require("react-native");
|
|
1483
1949
|
var import_react_native_svg5 = __toESM(require("react-native-svg"), 1);
|
|
1484
|
-
var AnimatedPath3 =
|
|
1950
|
+
var AnimatedPath3 = import_react_native20.Animated.createAnimatedComponent(import_react_native_svg5.Path);
|
|
1485
1951
|
|
|
1486
1952
|
// src/components/icon/icons/chevron-down.tsx
|
|
1487
|
-
var
|
|
1488
|
-
var
|
|
1953
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
1954
|
+
var import_react_native21 = require("react-native");
|
|
1489
1955
|
var import_react_native_svg6 = __toESM(require("react-native-svg"), 1);
|
|
1490
|
-
var AnimatedPath4 =
|
|
1956
|
+
var AnimatedPath4 = import_react_native21.Animated.createAnimatedComponent(import_react_native_svg6.Path);
|
|
1491
1957
|
|
|
1492
1958
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.style.ts
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1959
|
+
var import_react_native22 = require("react-native");
|
|
1960
|
+
var styles7 = import_react_native22.StyleSheet.create({
|
|
1495
1961
|
backdrop: {
|
|
1496
|
-
...
|
|
1962
|
+
...import_react_native22.StyleSheet.absoluteFillObject,
|
|
1497
1963
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
1498
1964
|
},
|
|
1499
1965
|
dialogContainer: {
|
|
@@ -1588,17 +2054,17 @@ var AutocompleteDialogHeader = ({
|
|
|
1588
2054
|
onBlur
|
|
1589
2055
|
}) => {
|
|
1590
2056
|
const theme = useXUITheme();
|
|
1591
|
-
return /* @__PURE__ */
|
|
1592
|
-
|
|
2057
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_react_native23.View, { style: styles7.header }, title ? /* @__PURE__ */ import_react28.default.createElement(import_react_native23.View, { style: styles7.titleRow }, /* @__PURE__ */ import_react28.default.createElement(
|
|
2058
|
+
import_react_native23.Pressable,
|
|
1593
2059
|
{
|
|
1594
|
-
style:
|
|
2060
|
+
style: styles7.backButton,
|
|
1595
2061
|
onPress: onClose,
|
|
1596
2062
|
accessibilityLabel: "Back",
|
|
1597
2063
|
accessibilityRole: "button"
|
|
1598
2064
|
},
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
), /* @__PURE__ */
|
|
1601
|
-
|
|
2065
|
+
/* @__PURE__ */ import_react28.default.createElement(ArrowBackIcon, { size: 20, color: theme.colors.foreground })
|
|
2066
|
+
), /* @__PURE__ */ import_react28.default.createElement(import_react_native23.Text, { style: [styles7.title, { color: theme.colors.foreground }] }, title)) : null, /* @__PURE__ */ import_react28.default.createElement(import_react_native23.View, { style: styles7.inputContainer }, /* @__PURE__ */ import_react28.default.createElement(import_react_native23.Animated.View, { style: [styles7.inputWrapper, inputAnimatedStyle] }, /* @__PURE__ */ import_react28.default.createElement(
|
|
2067
|
+
import_react_native23.TextInput,
|
|
1602
2068
|
{
|
|
1603
2069
|
ref: inputRef,
|
|
1604
2070
|
value: inputValue,
|
|
@@ -1609,7 +2075,7 @@ var AutocompleteDialogHeader = ({
|
|
|
1609
2075
|
0.5
|
|
1610
2076
|
),
|
|
1611
2077
|
style: [
|
|
1612
|
-
|
|
2078
|
+
styles7.input,
|
|
1613
2079
|
{
|
|
1614
2080
|
backgroundColor: theme.colors.default.background,
|
|
1615
2081
|
color: theme.colors.foreground
|
|
@@ -1622,42 +2088,42 @@ var AutocompleteDialogHeader = ({
|
|
|
1622
2088
|
onFocus,
|
|
1623
2089
|
onBlur
|
|
1624
2090
|
}
|
|
1625
|
-
), inputValue ? /* @__PURE__ */
|
|
1626
|
-
|
|
2091
|
+
), inputValue ? /* @__PURE__ */ import_react28.default.createElement(
|
|
2092
|
+
import_react_native23.Pressable,
|
|
1627
2093
|
{
|
|
1628
|
-
style:
|
|
2094
|
+
style: styles7.clearInputButton,
|
|
1629
2095
|
onPress: () => onInputChange?.(""),
|
|
1630
2096
|
accessibilityLabel: "Clear input",
|
|
1631
2097
|
accessibilityRole: "button"
|
|
1632
2098
|
},
|
|
1633
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ import_react28.default.createElement(CloseIcon, { color: theme.colors.foreground })
|
|
1634
2100
|
) : null)));
|
|
1635
2101
|
};
|
|
1636
2102
|
|
|
1637
2103
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.animation.ts
|
|
1638
|
-
var
|
|
1639
|
-
var
|
|
2104
|
+
var import_react29 = require("react");
|
|
2105
|
+
var import_react_native24 = require("react-native");
|
|
1640
2106
|
var useAutocompleteDialogAnimation = ({
|
|
1641
2107
|
visible,
|
|
1642
2108
|
fadeAnim,
|
|
1643
2109
|
slideAnim,
|
|
1644
2110
|
scaleAnim
|
|
1645
2111
|
}) => {
|
|
1646
|
-
(0,
|
|
2112
|
+
(0, import_react29.useEffect)(() => {
|
|
1647
2113
|
if (visible) {
|
|
1648
|
-
|
|
1649
|
-
|
|
2114
|
+
import_react_native24.Animated.parallel([
|
|
2115
|
+
import_react_native24.Animated.timing(fadeAnim, {
|
|
1650
2116
|
toValue: 1,
|
|
1651
2117
|
duration: 250,
|
|
1652
2118
|
useNativeDriver: true
|
|
1653
2119
|
}),
|
|
1654
|
-
|
|
2120
|
+
import_react_native24.Animated.spring(slideAnim, {
|
|
1655
2121
|
toValue: 1,
|
|
1656
2122
|
useNativeDriver: true,
|
|
1657
2123
|
tension: 65,
|
|
1658
2124
|
friction: 10
|
|
1659
2125
|
}),
|
|
1660
|
-
|
|
2126
|
+
import_react_native24.Animated.spring(scaleAnim, {
|
|
1661
2127
|
toValue: 1,
|
|
1662
2128
|
useNativeDriver: true,
|
|
1663
2129
|
tension: 50,
|
|
@@ -1691,19 +2157,19 @@ var AutocompleteDialog = ({
|
|
|
1691
2157
|
onBlur
|
|
1692
2158
|
}) => {
|
|
1693
2159
|
const theme = useXUITheme();
|
|
1694
|
-
const { width: screenWidth, height: screenHeight } = (0,
|
|
1695
|
-
const fadeAnim = (0,
|
|
1696
|
-
const slideAnim = (0,
|
|
1697
|
-
const scaleAnim = (0,
|
|
1698
|
-
const inputRef = (0,
|
|
1699
|
-
const [keyboardHeight, setKeyboardHeight] = (0,
|
|
1700
|
-
(0,
|
|
1701
|
-
const showEvent =
|
|
1702
|
-
const hideEvent =
|
|
1703
|
-
const showSub =
|
|
2160
|
+
const { width: screenWidth, height: screenHeight } = (0, import_react_native25.useWindowDimensions)();
|
|
2161
|
+
const fadeAnim = (0, import_react30.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
2162
|
+
const slideAnim = (0, import_react30.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
2163
|
+
const scaleAnim = (0, import_react30.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
2164
|
+
const inputRef = (0, import_react30.useRef)(null);
|
|
2165
|
+
const [keyboardHeight, setKeyboardHeight] = (0, import_react30.useState)(0);
|
|
2166
|
+
(0, import_react30.useEffect)(() => {
|
|
2167
|
+
const showEvent = import_react_native25.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
2168
|
+
const hideEvent = import_react_native25.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
2169
|
+
const showSub = import_react_native25.Keyboard.addListener(showEvent, (e) => {
|
|
1704
2170
|
setKeyboardHeight(e.endCoordinates.height);
|
|
1705
2171
|
});
|
|
1706
|
-
const hideSub =
|
|
2172
|
+
const hideSub = import_react_native25.Keyboard.addListener(hideEvent, () => {
|
|
1707
2173
|
setKeyboardHeight(0);
|
|
1708
2174
|
});
|
|
1709
2175
|
return () => {
|
|
@@ -1711,26 +2177,26 @@ var AutocompleteDialog = ({
|
|
|
1711
2177
|
hideSub.remove();
|
|
1712
2178
|
};
|
|
1713
2179
|
}, []);
|
|
1714
|
-
const items = (0,
|
|
1715
|
-
() =>
|
|
1716
|
-
|
|
2180
|
+
const items = (0, import_react30.useMemo)(
|
|
2181
|
+
() => import_react30.default.Children.toArray(children).filter(
|
|
2182
|
+
import_react30.default.isValidElement
|
|
1717
2183
|
),
|
|
1718
2184
|
[children]
|
|
1719
2185
|
);
|
|
1720
2186
|
const checkmarkColor = theme.colors[themeColor].main;
|
|
1721
2187
|
const checkmarkBackgroundColor = theme.colors[themeColor].background;
|
|
1722
2188
|
useAutocompleteDialogAnimation({ visible, fadeAnim, slideAnim, scaleAnim });
|
|
1723
|
-
(0,
|
|
2189
|
+
(0, import_react30.useEffect)(() => {
|
|
1724
2190
|
if (!visible) return;
|
|
1725
|
-
const sub =
|
|
2191
|
+
const sub = import_react_native25.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
1726
2192
|
onClose?.();
|
|
1727
2193
|
return true;
|
|
1728
2194
|
});
|
|
1729
2195
|
return () => sub.remove();
|
|
1730
2196
|
}, [visible, onClose]);
|
|
1731
|
-
const focusInput = (0,
|
|
1732
|
-
const delay =
|
|
1733
|
-
|
|
2197
|
+
const focusInput = (0, import_react30.useCallback)(() => {
|
|
2198
|
+
const delay = import_react_native25.Platform.OS === "android" ? 300 : 100;
|
|
2199
|
+
import_react_native25.InteractionManager.runAfterInteractions(() => {
|
|
1734
2200
|
setTimeout(() => {
|
|
1735
2201
|
inputRef.current?.focus();
|
|
1736
2202
|
}, delay);
|
|
@@ -1738,16 +2204,16 @@ var AutocompleteDialog = ({
|
|
|
1738
2204
|
}, []);
|
|
1739
2205
|
const handleCheckmarkPress = () => {
|
|
1740
2206
|
onCheckmark?.();
|
|
1741
|
-
|
|
2207
|
+
import_react_native25.Keyboard.dismiss();
|
|
1742
2208
|
};
|
|
1743
|
-
(0,
|
|
2209
|
+
(0, import_react30.useEffect)(() => {
|
|
1744
2210
|
if (!visible) {
|
|
1745
|
-
|
|
2211
|
+
import_react_native25.Keyboard.dismiss();
|
|
1746
2212
|
return;
|
|
1747
2213
|
}
|
|
1748
2214
|
focusInput();
|
|
1749
2215
|
}, [focusInput, visible]);
|
|
1750
|
-
const listBottomPadding = (0,
|
|
2216
|
+
const listBottomPadding = (0, import_react30.useMemo)(() => {
|
|
1751
2217
|
const basePadding = showCheckmark ? 96 : 64;
|
|
1752
2218
|
return (keyboardHeight > 0 ? keyboardHeight : 0) + basePadding;
|
|
1753
2219
|
}, [keyboardHeight, showCheckmark]);
|
|
@@ -1772,7 +2238,7 @@ var AutocompleteDialog = ({
|
|
|
1772
2238
|
const inputAnimatedStyle = {
|
|
1773
2239
|
transform: [{ scaleX: scaleAnim }]
|
|
1774
2240
|
};
|
|
1775
|
-
const listHeader = /* @__PURE__ */
|
|
2241
|
+
const listHeader = /* @__PURE__ */ import_react30.default.createElement(
|
|
1776
2242
|
AutocompleteDialogHeader,
|
|
1777
2243
|
{
|
|
1778
2244
|
title,
|
|
@@ -1788,19 +2254,19 @@ var AutocompleteDialog = ({
|
|
|
1788
2254
|
onBlur
|
|
1789
2255
|
}
|
|
1790
2256
|
);
|
|
1791
|
-
return /* @__PURE__ */
|
|
1792
|
-
|
|
2257
|
+
return /* @__PURE__ */ import_react30.default.createElement(Portal, null, /* @__PURE__ */ import_react30.default.createElement(import_react_native25.View, { style: [overlayStyle, style] }, /* @__PURE__ */ import_react30.default.createElement(import_react_native25.Animated.View, { style: [styles7.backdrop, { opacity: fadeAnim }] }), /* @__PURE__ */ import_react30.default.createElement(import_react_native25.Animated.View, { style: [styles7.dialogContainer, containerAnimatedStyle] }, /* @__PURE__ */ import_react30.default.createElement(
|
|
2258
|
+
import_react_native25.View,
|
|
1793
2259
|
{
|
|
1794
|
-
style: [
|
|
2260
|
+
style: [styles7.container, { backgroundColor: theme.colors.background }]
|
|
1795
2261
|
},
|
|
1796
2262
|
listHeader,
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
|
|
2263
|
+
/* @__PURE__ */ import_react30.default.createElement(
|
|
2264
|
+
import_react_native25.FlatList,
|
|
1799
2265
|
{
|
|
1800
2266
|
data: items,
|
|
1801
2267
|
renderItem: ({ item }) => item,
|
|
1802
2268
|
keyExtractor: (_, index) => String(index),
|
|
1803
|
-
style:
|
|
2269
|
+
style: styles7.listContainer,
|
|
1804
2270
|
contentContainerStyle: {
|
|
1805
2271
|
paddingBottom: listBottomPadding
|
|
1806
2272
|
},
|
|
@@ -1809,25 +2275,25 @@ var AutocompleteDialog = ({
|
|
|
1809
2275
|
showsVerticalScrollIndicator: false
|
|
1810
2276
|
}
|
|
1811
2277
|
),
|
|
1812
|
-
showCheckmark ? /* @__PURE__ */
|
|
1813
|
-
|
|
2278
|
+
showCheckmark ? /* @__PURE__ */ import_react30.default.createElement(import_react_native25.View, { style: styles7.checkmarkButtonContainer }, /* @__PURE__ */ import_react30.default.createElement(
|
|
2279
|
+
import_react_native25.Pressable,
|
|
1814
2280
|
{
|
|
1815
2281
|
style: [
|
|
1816
|
-
|
|
2282
|
+
styles7.checkmarkButton,
|
|
1817
2283
|
{ backgroundColor: checkmarkBackgroundColor }
|
|
1818
2284
|
],
|
|
1819
2285
|
onPress: handleCheckmarkPress,
|
|
1820
2286
|
accessibilityLabel: "Confirm",
|
|
1821
2287
|
accessibilityRole: "button"
|
|
1822
2288
|
},
|
|
1823
|
-
checkmarkIcon ?? /* @__PURE__ */
|
|
2289
|
+
checkmarkIcon ?? /* @__PURE__ */ import_react30.default.createElement(CheckmarkIcon, { color: checkmarkColor, size: 20 })
|
|
1824
2290
|
)) : null
|
|
1825
2291
|
))));
|
|
1826
2292
|
};
|
|
1827
2293
|
|
|
1828
2294
|
// src/components/autocomplete/autocomplete-trigger.tsx
|
|
1829
|
-
var
|
|
1830
|
-
var
|
|
2295
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
2296
|
+
var import_react_native26 = require("react-native");
|
|
1831
2297
|
var AutocompleteTrigger = ({
|
|
1832
2298
|
triggerRef,
|
|
1833
2299
|
isDisabled,
|
|
@@ -1850,15 +2316,15 @@ var AutocompleteTrigger = ({
|
|
|
1850
2316
|
onLayout: handleTriggerLayout
|
|
1851
2317
|
}) => {
|
|
1852
2318
|
const renderLabel = isLabelInside && label;
|
|
1853
|
-
return /* @__PURE__ */
|
|
1854
|
-
|
|
2319
|
+
return /* @__PURE__ */ import_react31.default.createElement(
|
|
2320
|
+
import_react_native26.Pressable,
|
|
1855
2321
|
{
|
|
1856
2322
|
ref: triggerRef,
|
|
1857
2323
|
onPress: handleTriggerPress,
|
|
1858
2324
|
onLayout: handleTriggerLayout,
|
|
1859
2325
|
disabled: isDisabled,
|
|
1860
2326
|
style: [
|
|
1861
|
-
|
|
2327
|
+
styles6.trigger,
|
|
1862
2328
|
{
|
|
1863
2329
|
minHeight: sizeStyles.minHeight,
|
|
1864
2330
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
@@ -1866,18 +2332,18 @@ var AutocompleteTrigger = ({
|
|
|
1866
2332
|
},
|
|
1867
2333
|
radiusStyles,
|
|
1868
2334
|
variantStyles,
|
|
1869
|
-
isDisabled &&
|
|
2335
|
+
isDisabled && styles6.disabled,
|
|
1870
2336
|
style
|
|
1871
2337
|
],
|
|
1872
2338
|
accessibilityLabel: labelText ?? (typeof label === "string" ? label : void 0),
|
|
1873
2339
|
accessibilityRole: "button",
|
|
1874
2340
|
accessibilityState: { disabled: isDisabled }
|
|
1875
2341
|
},
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
|
|
2342
|
+
/* @__PURE__ */ import_react31.default.createElement(import_react_native26.View, { style: styles6.triggerContent }, isLabelInside && renderLabel, /* @__PURE__ */ import_react31.default.createElement(
|
|
2343
|
+
import_react_native26.Text,
|
|
1878
2344
|
{
|
|
1879
2345
|
style: [
|
|
1880
|
-
|
|
2346
|
+
styles6.triggerText,
|
|
1881
2347
|
{ fontSize: sizeStyles.fontSize, color: theme.colors.foreground },
|
|
1882
2348
|
!currentSelectedKey && !currentInputValue && { opacity: 0.5 },
|
|
1883
2349
|
textStyle
|
|
@@ -1887,14 +2353,14 @@ var AutocompleteTrigger = ({
|
|
|
1887
2353
|
},
|
|
1888
2354
|
displayValue
|
|
1889
2355
|
)),
|
|
1890
|
-
isClearable && (currentSelectedKey || currentInputValue) ? /* @__PURE__ */
|
|
1891
|
-
|
|
2356
|
+
isClearable && (currentSelectedKey || currentInputValue) ? /* @__PURE__ */ import_react31.default.createElement(
|
|
2357
|
+
import_react_native26.TouchableOpacity,
|
|
1892
2358
|
{
|
|
1893
2359
|
onPress: handleClear,
|
|
1894
|
-
style:
|
|
2360
|
+
style: styles6.clearButton,
|
|
1895
2361
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
1896
2362
|
},
|
|
1897
|
-
clearIcon ?? /* @__PURE__ */
|
|
2363
|
+
clearIcon ?? /* @__PURE__ */ import_react31.default.createElement(CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
1898
2364
|
) : null
|
|
1899
2365
|
);
|
|
1900
2366
|
};
|
|
@@ -1945,17 +2411,17 @@ var Autocomplete = ({
|
|
|
1945
2411
|
onOpenChange,
|
|
1946
2412
|
onClose
|
|
1947
2413
|
});
|
|
1948
|
-
const triggerRef = (0,
|
|
1949
|
-
const [triggerLayout, setTriggerLayout] = (0,
|
|
1950
|
-
const handleTriggerLayout = (0,
|
|
2414
|
+
const triggerRef = (0, import_react32.useRef)(null);
|
|
2415
|
+
const [triggerLayout, setTriggerLayout] = (0, import_react32.useState)();
|
|
2416
|
+
const handleTriggerLayout = (0, import_react32.useCallback)(() => {
|
|
1951
2417
|
triggerRef.current?.measureInWindow((x, y, width, height) => {
|
|
1952
2418
|
setTriggerLayout({ x, y, width, height });
|
|
1953
2419
|
});
|
|
1954
2420
|
}, []);
|
|
1955
|
-
const items = (0,
|
|
1956
|
-
const elements =
|
|
2421
|
+
const items = (0, import_react32.useMemo)(() => {
|
|
2422
|
+
const elements = import_react32.default.Children.toArray(children).filter(Boolean);
|
|
1957
2423
|
return elements.map((child, index) => {
|
|
1958
|
-
if (!
|
|
2424
|
+
if (!import_react32.default.isValidElement(child)) {
|
|
1959
2425
|
return null;
|
|
1960
2426
|
}
|
|
1961
2427
|
const key = child.props.value ?? String(index);
|
|
@@ -1967,7 +2433,7 @@ var Autocomplete = ({
|
|
|
1967
2433
|
};
|
|
1968
2434
|
}).filter((item) => item !== null);
|
|
1969
2435
|
}, [children]);
|
|
1970
|
-
const filteredItems = (0,
|
|
2436
|
+
const filteredItems = (0, import_react32.useMemo)(() => {
|
|
1971
2437
|
if (disableLocalFilter || !currentInputValue.trim()) {
|
|
1972
2438
|
return items;
|
|
1973
2439
|
}
|
|
@@ -1987,7 +2453,7 @@ var Autocomplete = ({
|
|
|
1987
2453
|
const helperColor = useAutocompleteHelperColor(isInvalid);
|
|
1988
2454
|
const selectedItem = items.find((item) => item.key === currentSelectedKey);
|
|
1989
2455
|
const displayValue = forceSelection ? selectedItem?.labelText || placeholder : currentInputValue || placeholder;
|
|
1990
|
-
const handleInputChange = (0,
|
|
2456
|
+
const handleInputChange = (0, import_react32.useCallback)(
|
|
1991
2457
|
(text) => {
|
|
1992
2458
|
updateInputValue(text);
|
|
1993
2459
|
const selectedLabel = selectedItem?.labelText ?? "";
|
|
@@ -2004,7 +2470,7 @@ var Autocomplete = ({
|
|
|
2004
2470
|
currentSelectedKey
|
|
2005
2471
|
]
|
|
2006
2472
|
);
|
|
2007
|
-
const handleItemSelection = (0,
|
|
2473
|
+
const handleItemSelection = (0, import_react32.useCallback)(
|
|
2008
2474
|
(key, itemLabel) => {
|
|
2009
2475
|
if (isDisabled) {
|
|
2010
2476
|
return;
|
|
@@ -2012,16 +2478,16 @@ var Autocomplete = ({
|
|
|
2012
2478
|
updateSelection(key);
|
|
2013
2479
|
updateInputValue(itemLabel);
|
|
2014
2480
|
setTimeout(() => {
|
|
2015
|
-
|
|
2481
|
+
import_react_native27.Keyboard.dismiss();
|
|
2016
2482
|
setOpen(false);
|
|
2017
2483
|
}, 50);
|
|
2018
2484
|
},
|
|
2019
2485
|
[isDisabled, updateSelection, updateInputValue, setOpen]
|
|
2020
2486
|
);
|
|
2021
|
-
const handleCheckmark = (0,
|
|
2487
|
+
const handleCheckmark = (0, import_react32.useCallback)(() => {
|
|
2022
2488
|
setOpen(false);
|
|
2023
2489
|
}, [setOpen]);
|
|
2024
|
-
const handleClear = (0,
|
|
2490
|
+
const handleClear = (0, import_react32.useCallback)(() => {
|
|
2025
2491
|
if (isDisabled) {
|
|
2026
2492
|
return;
|
|
2027
2493
|
}
|
|
@@ -2029,7 +2495,7 @@ var Autocomplete = ({
|
|
|
2029
2495
|
updateInputValue("");
|
|
2030
2496
|
onClear?.();
|
|
2031
2497
|
}, [isDisabled, updateSelection, updateInputValue, onClear]);
|
|
2032
|
-
const handleTriggerPress = (0,
|
|
2498
|
+
const handleTriggerPress = (0, import_react32.useCallback)(() => {
|
|
2033
2499
|
if (!isDisabled) {
|
|
2034
2500
|
if (selectedItem && !currentInputValue) {
|
|
2035
2501
|
updateInputValue(selectedItem.labelText);
|
|
@@ -2048,7 +2514,7 @@ var Autocomplete = ({
|
|
|
2048
2514
|
handleItemSelection(item.key, item.labelText);
|
|
2049
2515
|
itemProps.onSelected?.();
|
|
2050
2516
|
};
|
|
2051
|
-
return
|
|
2517
|
+
return import_react32.default.cloneElement(item.element, {
|
|
2052
2518
|
key: item.key,
|
|
2053
2519
|
isDisabled: itemDisabled,
|
|
2054
2520
|
isSelected: itemSelected,
|
|
@@ -2059,10 +2525,10 @@ var Autocomplete = ({
|
|
|
2059
2525
|
const isLabelInside = labelPlacement === "inside";
|
|
2060
2526
|
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
2061
2527
|
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
2062
|
-
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */
|
|
2528
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ import_react32.default.createElement(import_react_native27.Text, { style: [styles6.label, labelStyle] }, label) : /* @__PURE__ */ import_react32.default.createElement(import_react_native27.View, null, label) : null;
|
|
2063
2529
|
const shouldShowHelper = Boolean(description || errorMessage);
|
|
2064
2530
|
const helperContent = isInvalid && errorMessage ? errorMessage : description;
|
|
2065
|
-
const triggerContent = /* @__PURE__ */
|
|
2531
|
+
const triggerContent = /* @__PURE__ */ import_react32.default.createElement(
|
|
2066
2532
|
AutocompleteTrigger,
|
|
2067
2533
|
{
|
|
2068
2534
|
triggerRef,
|
|
@@ -2087,7 +2553,7 @@ var Autocomplete = ({
|
|
|
2087
2553
|
}
|
|
2088
2554
|
);
|
|
2089
2555
|
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
2090
|
-
return /* @__PURE__ */
|
|
2556
|
+
return /* @__PURE__ */ import_react32.default.createElement(import_react_native27.View, { style: [styles6.container, fullWidth ? styles6.fullWidth : styles6.minWidth] }, isLabelOutside && labelBlock, isLabelOutsideLeft ? /* @__PURE__ */ import_react32.default.createElement(import_react_native27.View, { style: styles6.outsideLeftRow }, renderLabel, triggerContent) : triggerContent, shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */ import_react32.default.createElement(import_react_native27.Text, { style: [styles6.helperText, { color: helperColor }] }, helperContent) : /* @__PURE__ */ import_react32.default.createElement(import_react_native27.View, null, helperContent) : null, /* @__PURE__ */ import_react32.default.createElement(
|
|
2091
2557
|
AutocompleteDialog,
|
|
2092
2558
|
{
|
|
2093
2559
|
visible: isOpen,
|
|
@@ -2101,17 +2567,17 @@ var Autocomplete = ({
|
|
|
2101
2567
|
onClose: () => setOpen(false),
|
|
2102
2568
|
onCheckmark: handleCheckmark
|
|
2103
2569
|
},
|
|
2104
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ import_react32.default.createElement(AutocompleteContext.Provider, { value: { size, themeColor, isDisabled } }, showEmptyMessage ? /* @__PURE__ */ import_react32.default.createElement(import_react_native27.Text, { style: [styles6.emptyMessage, { color: theme.colors.foreground }] }, "No results found") : listItems)
|
|
2105
2571
|
));
|
|
2106
2572
|
};
|
|
2107
2573
|
|
|
2108
2574
|
// src/components/autocomplete/autocomplete-item.tsx
|
|
2109
|
-
var
|
|
2110
|
-
var
|
|
2575
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
2576
|
+
var import_react_native29 = require("react-native");
|
|
2111
2577
|
|
|
2112
2578
|
// src/components/autocomplete/autocomplete-item.style.ts
|
|
2113
|
-
var
|
|
2114
|
-
var
|
|
2579
|
+
var import_react_native28 = require("react-native");
|
|
2580
|
+
var styles8 = import_react_native28.StyleSheet.create({
|
|
2115
2581
|
item: {
|
|
2116
2582
|
flexDirection: "row",
|
|
2117
2583
|
alignItems: "center",
|
|
@@ -2133,11 +2599,11 @@ var styles6 = import_react_native23.StyleSheet.create({
|
|
|
2133
2599
|
});
|
|
2134
2600
|
|
|
2135
2601
|
// src/components/autocomplete/autocomplete-item.hook.ts
|
|
2136
|
-
var
|
|
2137
|
-
var
|
|
2602
|
+
var import_react33 = require("react");
|
|
2603
|
+
var import_core23 = require("@xaui/core");
|
|
2138
2604
|
var useAutocompleteItemSizeStyles = (size) => {
|
|
2139
2605
|
const theme = useXUITheme();
|
|
2140
|
-
return (0,
|
|
2606
|
+
return (0, import_react33.useMemo)(() => {
|
|
2141
2607
|
const sizes = {
|
|
2142
2608
|
xs: {
|
|
2143
2609
|
paddingVertical: theme.spacing.sm,
|
|
@@ -2169,15 +2635,15 @@ var useAutocompleteItemSizeStyles = (size) => {
|
|
|
2169
2635
|
};
|
|
2170
2636
|
var useAutocompleteItemBackgroundColor = (themeColor, isSelected) => {
|
|
2171
2637
|
const theme = useXUITheme();
|
|
2172
|
-
const safeThemeColor = (0,
|
|
2638
|
+
const safeThemeColor = (0, import_core23.getSafeThemeColor)(themeColor);
|
|
2173
2639
|
const colorScheme = theme.colors[safeThemeColor];
|
|
2174
|
-
return (0,
|
|
2640
|
+
return (0, import_react33.useMemo)(() => {
|
|
2175
2641
|
return "transparent";
|
|
2176
2642
|
}, [isSelected, colorScheme]);
|
|
2177
2643
|
};
|
|
2178
2644
|
var useAutocompleteItemTextColors = () => {
|
|
2179
2645
|
const theme = useXUITheme();
|
|
2180
|
-
return (0,
|
|
2646
|
+
return (0, import_react33.useMemo)(() => {
|
|
2181
2647
|
return {
|
|
2182
2648
|
textColor: theme.colors.foreground,
|
|
2183
2649
|
descriptionColor: theme.colors.foreground
|
|
@@ -2186,9 +2652,9 @@ var useAutocompleteItemTextColors = () => {
|
|
|
2186
2652
|
};
|
|
2187
2653
|
var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
2188
2654
|
const theme = useXUITheme();
|
|
2189
|
-
const safeThemeColor = (0,
|
|
2655
|
+
const safeThemeColor = (0, import_core23.getSafeThemeColor)(themeColor);
|
|
2190
2656
|
const colorScheme = theme.colors[safeThemeColor];
|
|
2191
|
-
return (0,
|
|
2657
|
+
return (0, import_react33.useMemo)(() => {
|
|
2192
2658
|
if (themeColor === "default") {
|
|
2193
2659
|
return theme.colors.primary.main;
|
|
2194
2660
|
}
|
|
@@ -2196,7 +2662,7 @@ var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
|
2196
2662
|
}, [themeColor, colorScheme, theme]);
|
|
2197
2663
|
};
|
|
2198
2664
|
var useAutocompleteItemStyles = (isSelected, _isDisabled) => {
|
|
2199
|
-
const context = (0,
|
|
2665
|
+
const context = (0, import_react33.useContext)(AutocompleteContext);
|
|
2200
2666
|
const backgroundColor = useAutocompleteItemBackgroundColor(
|
|
2201
2667
|
context.themeColor,
|
|
2202
2668
|
isSelected
|
|
@@ -2225,7 +2691,7 @@ var AutocompleteItem = ({
|
|
|
2225
2691
|
customAppearance,
|
|
2226
2692
|
onSelected
|
|
2227
2693
|
}) => {
|
|
2228
|
-
const context = (0,
|
|
2694
|
+
const context = (0, import_react34.useContext)(AutocompleteContext);
|
|
2229
2695
|
const size = context?.size ?? defaultSize;
|
|
2230
2696
|
const isItemDisabled = context?.isDisabled ? true : isDisabled;
|
|
2231
2697
|
const sizeStyles = useAutocompleteItemSizeStyles(size);
|
|
@@ -2236,38 +2702,38 @@ var AutocompleteItem = ({
|
|
|
2236
2702
|
}
|
|
2237
2703
|
onSelected?.();
|
|
2238
2704
|
};
|
|
2239
|
-
return /* @__PURE__ */
|
|
2240
|
-
|
|
2705
|
+
return /* @__PURE__ */ import_react34.default.createElement(
|
|
2706
|
+
import_react_native29.Pressable,
|
|
2241
2707
|
{
|
|
2242
2708
|
onPress: handlePress,
|
|
2243
2709
|
disabled: isItemDisabled,
|
|
2244
2710
|
style: [
|
|
2245
|
-
|
|
2711
|
+
styles8.item,
|
|
2246
2712
|
{
|
|
2247
2713
|
paddingVertical: sizeStyles.paddingVertical,
|
|
2248
2714
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
2249
2715
|
backgroundColor
|
|
2250
2716
|
},
|
|
2251
|
-
isItemDisabled &&
|
|
2717
|
+
isItemDisabled && styles8.disabled,
|
|
2252
2718
|
customAppearance?.container
|
|
2253
2719
|
]
|
|
2254
2720
|
},
|
|
2255
2721
|
startContent,
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
|
|
2722
|
+
/* @__PURE__ */ import_react34.default.createElement(import_react_native29.View, { style: styles8.content }, /* @__PURE__ */ import_react34.default.createElement(
|
|
2723
|
+
import_react_native29.Text,
|
|
2258
2724
|
{
|
|
2259
2725
|
style: [
|
|
2260
|
-
|
|
2726
|
+
styles8.title,
|
|
2261
2727
|
{ fontSize: sizeStyles.titleSize, color: labelColor },
|
|
2262
2728
|
customAppearance?.text
|
|
2263
2729
|
]
|
|
2264
2730
|
},
|
|
2265
2731
|
label
|
|
2266
|
-
), description && /* @__PURE__ */
|
|
2267
|
-
|
|
2732
|
+
), description && /* @__PURE__ */ import_react34.default.createElement(
|
|
2733
|
+
import_react_native29.Text,
|
|
2268
2734
|
{
|
|
2269
2735
|
style: [
|
|
2270
|
-
|
|
2736
|
+
styles8.description,
|
|
2271
2737
|
{ fontSize: sizeStyles.descriptionSize, color: descriptionColor }
|
|
2272
2738
|
]
|
|
2273
2739
|
},
|
|
@@ -2278,20 +2744,20 @@ var AutocompleteItem = ({
|
|
|
2278
2744
|
};
|
|
2279
2745
|
|
|
2280
2746
|
// src/components/typography/typography.tsx
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
2747
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
2748
|
+
var import_react_native31 = require("react-native");
|
|
2283
2749
|
|
|
2284
2750
|
// src/components/typography/typography.style.ts
|
|
2285
|
-
var
|
|
2286
|
-
var
|
|
2751
|
+
var import_react_native30 = require("react-native");
|
|
2752
|
+
var styles9 = import_react_native30.StyleSheet.create({
|
|
2287
2753
|
text: {
|
|
2288
2754
|
includeFontPadding: false
|
|
2289
2755
|
}
|
|
2290
2756
|
});
|
|
2291
2757
|
|
|
2292
2758
|
// src/components/typography/typography.hook.ts
|
|
2293
|
-
var
|
|
2294
|
-
var
|
|
2759
|
+
var import_react35 = require("react");
|
|
2760
|
+
var import_core26 = require("@xaui/core");
|
|
2295
2761
|
var knownVariants = {
|
|
2296
2762
|
caption: true,
|
|
2297
2763
|
headlineLarge: true,
|
|
@@ -2309,18 +2775,18 @@ var isKnownVariant = (variant) => {
|
|
|
2309
2775
|
};
|
|
2310
2776
|
var useTypographyColor = (themeColor) => {
|
|
2311
2777
|
const theme = useXUITheme();
|
|
2312
|
-
const color = (0,
|
|
2778
|
+
const color = (0, import_react35.useMemo)(() => {
|
|
2313
2779
|
if (themeColor === "default") {
|
|
2314
2780
|
return theme.colors.foreground;
|
|
2315
2781
|
}
|
|
2316
|
-
const safeThemeColor = (0,
|
|
2782
|
+
const safeThemeColor = (0, import_core26.getSafeThemeColor)(themeColor);
|
|
2317
2783
|
return theme.colors[safeThemeColor].main;
|
|
2318
2784
|
}, [theme, themeColor]);
|
|
2319
2785
|
return color;
|
|
2320
2786
|
};
|
|
2321
2787
|
var useTypographyVariantStyles = (variant) => {
|
|
2322
2788
|
const theme = useXUITheme();
|
|
2323
|
-
const variantStyles = (0,
|
|
2789
|
+
const variantStyles = (0, import_react35.useMemo)(() => {
|
|
2324
2790
|
if (!isKnownVariant(variant)) {
|
|
2325
2791
|
return {
|
|
2326
2792
|
fontFamily: theme.fontFamilies.body,
|
|
@@ -2328,7 +2794,7 @@ var useTypographyVariantStyles = (variant) => {
|
|
|
2328
2794
|
fontWeight: theme.fontWeights.normal
|
|
2329
2795
|
};
|
|
2330
2796
|
}
|
|
2331
|
-
const
|
|
2797
|
+
const styles10 = {
|
|
2332
2798
|
caption: {
|
|
2333
2799
|
fontFamily: theme.fontFamilies.body,
|
|
2334
2800
|
fontSize: theme.fontSizes.xs,
|
|
@@ -2380,7 +2846,7 @@ var useTypographyVariantStyles = (variant) => {
|
|
|
2380
2846
|
fontWeight: theme.fontWeights.normal
|
|
2381
2847
|
}
|
|
2382
2848
|
};
|
|
2383
|
-
return
|
|
2849
|
+
return styles10[variant];
|
|
2384
2850
|
}, [theme, variant]);
|
|
2385
2851
|
return variantStyles;
|
|
2386
2852
|
};
|
|
@@ -2398,18 +2864,18 @@ var Typography = ({
|
|
|
2398
2864
|
const color = useTypographyColor(themeColor);
|
|
2399
2865
|
const variantStyles = useTypographyVariantStyles(variant);
|
|
2400
2866
|
const colorStyle = { color };
|
|
2401
|
-
const ellipsizeMode = (0,
|
|
2867
|
+
const ellipsizeMode = (0, import_react36.useMemo)(() => {
|
|
2402
2868
|
if (!maxLines) return void 0;
|
|
2403
2869
|
if (overflow === "clip") return "clip";
|
|
2404
2870
|
return "tail";
|
|
2405
2871
|
}, [maxLines, overflow]);
|
|
2406
|
-
return /* @__PURE__ */
|
|
2407
|
-
|
|
2872
|
+
return /* @__PURE__ */ import_react36.default.createElement(
|
|
2873
|
+
import_react_native31.Text,
|
|
2408
2874
|
{
|
|
2409
2875
|
numberOfLines: maxLines,
|
|
2410
2876
|
ellipsizeMode,
|
|
2411
2877
|
style: [
|
|
2412
|
-
|
|
2878
|
+
styles9.text,
|
|
2413
2879
|
variantStyles,
|
|
2414
2880
|
align && { textAlign: align },
|
|
2415
2881
|
colorStyle,
|
|
@@ -2425,6 +2891,9 @@ var Typography = ({
|
|
|
2425
2891
|
Alert,
|
|
2426
2892
|
Autocomplete,
|
|
2427
2893
|
AutocompleteItem,
|
|
2894
|
+
Avatar,
|
|
2895
|
+
AvatarGroup,
|
|
2896
|
+
Badge,
|
|
2428
2897
|
Divider,
|
|
2429
2898
|
Typography
|
|
2430
2899
|
});
|