@sudobility/components-rn 1.0.36 → 1.0.38

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/index.cjs.js CHANGED
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const reactNative = require("react-native");
6
6
  const classVarianceAuthority = require("class-variance-authority");
7
7
  const design = require("@sudobility/design");
8
+ const reactNativeSafeAreaContext = require("react-native-safe-area-context");
8
9
  function _interopNamespaceDefault(e) {
9
10
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
11
  if (e) {
@@ -2853,6 +2854,203 @@ const SelectTrigger = Select;
2853
2854
  const SelectValue = ({
2854
2855
  placeholder = "Select..."
2855
2856
  }) => /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-gray-400 dark:text-gray-500", children: placeholder });
2857
+ const ItemSeparator = () => /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { style: styles$4.separator });
2858
+ const PopupSelect = ({
2859
+ value,
2860
+ onValueChange,
2861
+ options,
2862
+ placeholder = "Select...",
2863
+ title = "Select",
2864
+ disabled = false,
2865
+ triggerStyle,
2866
+ triggerTextStyle
2867
+ }) => {
2868
+ const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
2869
+ const [modalVisible, setModalVisible] = React.useState(false);
2870
+ const selectedOption = options.find((opt) => opt.value === value);
2871
+ const handleSelect = React.useCallback(
2872
+ (optionValue) => {
2873
+ onValueChange == null ? void 0 : onValueChange(optionValue);
2874
+ setModalVisible(false);
2875
+ },
2876
+ [onValueChange]
2877
+ );
2878
+ const renderOption = ({ item }) => {
2879
+ const isSelected = item.value === value;
2880
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2881
+ reactNative.TouchableOpacity,
2882
+ {
2883
+ style: [styles$4.optionItem, isSelected && styles$4.optionItemSelected],
2884
+ onPress: () => !item.disabled && handleSelect(item.value),
2885
+ disabled: item.disabled,
2886
+ activeOpacity: 0.7,
2887
+ children: [
2888
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2889
+ reactNative.Text,
2890
+ {
2891
+ style: [
2892
+ styles$4.optionLabel,
2893
+ isSelected && styles$4.optionLabelSelected,
2894
+ item.disabled && styles$4.optionDisabled
2895
+ ],
2896
+ children: item.label
2897
+ }
2898
+ ),
2899
+ isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { style: styles$4.checkmark, children: "✓" })
2900
+ ]
2901
+ }
2902
+ );
2903
+ };
2904
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2905
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
2906
+ reactNative.TouchableOpacity,
2907
+ {
2908
+ style: [
2909
+ styles$4.trigger,
2910
+ disabled && styles$4.triggerDisabled,
2911
+ triggerStyle
2912
+ ],
2913
+ onPress: () => !disabled && setModalVisible(true),
2914
+ activeOpacity: 0.7,
2915
+ children: [
2916
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2917
+ reactNative.Text,
2918
+ {
2919
+ style: [
2920
+ styles$4.triggerText,
2921
+ !selectedOption && styles$4.triggerPlaceholder,
2922
+ triggerTextStyle
2923
+ ],
2924
+ numberOfLines: 1,
2925
+ children: (selectedOption == null ? void 0 : selectedOption.label) ?? placeholder
2926
+ }
2927
+ ),
2928
+ /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { style: styles$4.triggerArrow, children: "▼" })
2929
+ ]
2930
+ }
2931
+ ),
2932
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2933
+ reactNative.Modal,
2934
+ {
2935
+ visible: modalVisible,
2936
+ animationType: "slide",
2937
+ presentationStyle: "pageSheet",
2938
+ onRequestClose: () => setModalVisible(false),
2939
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { style: [styles$4.modalContainer, { paddingTop: insets.top }], children: [
2940
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { style: styles$4.modalHeader, children: [
2941
+ /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { style: styles$4.modalTitle, children: title }),
2942
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2943
+ reactNative.Pressable,
2944
+ {
2945
+ style: styles$4.closeButton,
2946
+ onPress: () => setModalVisible(false),
2947
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { style: styles$4.closeButtonText, children: "Done" })
2948
+ }
2949
+ )
2950
+ ] }),
2951
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2952
+ reactNative.FlatList,
2953
+ {
2954
+ data: options,
2955
+ keyExtractor: (item) => item.value,
2956
+ renderItem: renderOption,
2957
+ contentContainerStyle: styles$4.listContent,
2958
+ ItemSeparatorComponent: ItemSeparator
2959
+ }
2960
+ )
2961
+ ] })
2962
+ }
2963
+ )
2964
+ ] });
2965
+ };
2966
+ const styles$4 = reactNative.StyleSheet.create({
2967
+ trigger: {
2968
+ flexDirection: "row",
2969
+ alignItems: "center",
2970
+ justifyContent: "space-between",
2971
+ borderWidth: 1,
2972
+ borderColor: "#d1d5db",
2973
+ borderRadius: 8,
2974
+ paddingHorizontal: 12,
2975
+ paddingVertical: 12,
2976
+ backgroundColor: "#ffffff"
2977
+ },
2978
+ triggerDisabled: {
2979
+ opacity: 0.5
2980
+ },
2981
+ triggerText: {
2982
+ flex: 1,
2983
+ fontSize: 16,
2984
+ color: "#1a1a1a"
2985
+ },
2986
+ triggerPlaceholder: {
2987
+ color: "#9ca3af"
2988
+ },
2989
+ triggerArrow: {
2990
+ fontSize: 10,
2991
+ color: "#9ca3af",
2992
+ marginLeft: 8
2993
+ },
2994
+ modalContainer: {
2995
+ flex: 1,
2996
+ backgroundColor: "#ffffff"
2997
+ },
2998
+ modalHeader: {
2999
+ flexDirection: "row",
3000
+ justifyContent: "space-between",
3001
+ alignItems: "center",
3002
+ paddingHorizontal: 16,
3003
+ paddingVertical: 12,
3004
+ borderBottomWidth: 1,
3005
+ borderBottomColor: "#e9ecef"
3006
+ },
3007
+ modalTitle: {
3008
+ fontSize: 18,
3009
+ fontWeight: "600",
3010
+ color: "#1a1a1a"
3011
+ },
3012
+ closeButton: {
3013
+ padding: 8
3014
+ },
3015
+ closeButtonText: {
3016
+ fontSize: 16,
3017
+ fontWeight: "600",
3018
+ color: "#3b82f6"
3019
+ },
3020
+ listContent: {
3021
+ padding: 16
3022
+ },
3023
+ optionItem: {
3024
+ flexDirection: "row",
3025
+ alignItems: "center",
3026
+ padding: 16,
3027
+ backgroundColor: "#f8f9fa",
3028
+ borderRadius: 12
3029
+ },
3030
+ optionItemSelected: {
3031
+ backgroundColor: "#e0f2fe"
3032
+ },
3033
+ optionLabel: {
3034
+ flex: 1,
3035
+ fontSize: 16,
3036
+ color: "#1a1a1a"
3037
+ },
3038
+ optionLabelSelected: {
3039
+ fontWeight: "600",
3040
+ color: "#3b82f6"
3041
+ },
3042
+ optionDisabled: {
3043
+ opacity: 0.5
3044
+ },
3045
+ checkmark: {
3046
+ fontSize: 18,
3047
+ color: "#3b82f6",
3048
+ fontWeight: "bold"
3049
+ },
3050
+ separator: {
3051
+ height: 8
3052
+ }
3053
+ });
2856
3054
  const SearchInput = ({
2857
3055
  value: controlledValue,
2858
3056
  onChangeText,
@@ -10642,7 +10840,7 @@ function VirtualList({
10642
10840
  },
10643
10841
  [renderItem]
10644
10842
  );
10645
- const ItemSeparator = React__namespace.useCallback(() => {
10843
+ const ItemSeparator2 = React__namespace.useCallback(() => {
10646
10844
  if (!showSeparator) return null;
10647
10845
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10648
10846
  reactNative.View,
@@ -10684,7 +10882,7 @@ function VirtualList({
10684
10882
  horizontal,
10685
10883
  showsVerticalScrollIndicator: !horizontal,
10686
10884
  showsHorizontalScrollIndicator: horizontal,
10687
- ItemSeparatorComponent: showSeparator ? ItemSeparator : void 0,
10885
+ ItemSeparatorComponent: showSeparator ? ItemSeparator2 : void 0,
10688
10886
  ListEmptyComponent: ListEmpty,
10689
10887
  onRefresh,
10690
10888
  refreshing,
@@ -10861,6 +11059,7 @@ exports.PageSectionHeader = PageSectionHeader;
10861
11059
  exports.Pagination = Pagination;
10862
11060
  exports.PhoneInput = PhoneInput;
10863
11061
  exports.Popover = Popover;
11062
+ exports.PopupSelect = PopupSelect;
10864
11063
  exports.Progress = Progress;
10865
11064
  exports.ProgressBar = ProgressBar;
10866
11065
  exports.ProgressCircle = ProgressCircle;