@sudobility/components-rn 1.0.37 → 1.0.39

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.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from './ui/Checkbox';
25
25
  export * from './ui/Switch';
26
26
  export * from './ui/HelperText';
27
27
  export * from './ui/Select';
28
+ export * from './ui/PopupSelect';
28
29
  export * from './ui/SearchInput';
29
30
  export * from './ui/NumberInput';
30
31
  export * from './ui/Text';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;A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AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAG9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC;;;GAGG;AACH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,MAAM,GACP,MAAM,oBAAoB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { clsx } from "clsx";
2
2
  import * as React from "react";
3
3
  import React__default, { useState, useRef, useCallback, useEffect, createContext, useContext } from "react";
4
- import { Animated, View, Text as Text$1, Pressable, ActivityIndicator, TextInput, Dimensions, Modal as Modal$1, SafeAreaView, FlatList, Image, KeyboardAvoidingView, ScrollView, Platform, PanResponder, Linking, TouchableWithoutFeedback, useWindowDimensions, StyleSheet, RefreshControl, UIManager, LayoutAnimation, Alert as Alert$1 } from "react-native";
4
+ import { Animated, View, Text as Text$1, Pressable, ActivityIndicator, TextInput, Dimensions, Modal as Modal$1, SafeAreaView, FlatList, StyleSheet, TouchableOpacity, Image, KeyboardAvoidingView, ScrollView, Platform, PanResponder, Linking, TouchableWithoutFeedback, useWindowDimensions, RefreshControl, UIManager, LayoutAnimation, Alert as Alert$1 } from "react-native";
5
5
  import { cva } from "class-variance-authority";
6
6
  import { variants, getCardVariantColors, textVariants } from "@sudobility/design";
7
7
  import { colors, designTokens, textVariants as textVariants2, variants as variants2 } from "@sudobility/design";
8
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
8
9
  function cn(...inputs) {
9
10
  return clsx(inputs);
10
11
  }
@@ -2836,6 +2837,203 @@ const SelectTrigger = Select;
2836
2837
  const SelectValue = ({
2837
2838
  placeholder = "Select..."
2838
2839
  }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Text$1, { className: "text-gray-400 dark:text-gray-500", children: placeholder });
2840
+ const ItemSeparator = () => /* @__PURE__ */ jsxRuntimeExports.jsx(View, { style: styles$4.separator });
2841
+ const PopupSelect = ({
2842
+ value,
2843
+ onValueChange,
2844
+ options,
2845
+ placeholder = "Select...",
2846
+ title = "Select",
2847
+ disabled = false,
2848
+ triggerStyle,
2849
+ triggerTextStyle
2850
+ }) => {
2851
+ const insets = useSafeAreaInsets();
2852
+ const [modalVisible, setModalVisible] = useState(false);
2853
+ const selectedOption = options.find((opt) => opt.value === value);
2854
+ const handleSelect = useCallback(
2855
+ (optionValue) => {
2856
+ onValueChange == null ? void 0 : onValueChange(optionValue);
2857
+ setModalVisible(false);
2858
+ },
2859
+ [onValueChange]
2860
+ );
2861
+ const renderOption = ({ item }) => {
2862
+ const isSelected = item.value === value;
2863
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2864
+ TouchableOpacity,
2865
+ {
2866
+ style: [styles$4.optionItem, isSelected && styles$4.optionItemSelected],
2867
+ onPress: () => !item.disabled && handleSelect(item.value),
2868
+ disabled: item.disabled,
2869
+ activeOpacity: 0.7,
2870
+ children: [
2871
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2872
+ Text$1,
2873
+ {
2874
+ style: [
2875
+ styles$4.optionLabel,
2876
+ isSelected && styles$4.optionLabelSelected,
2877
+ item.disabled && styles$4.optionDisabled
2878
+ ],
2879
+ children: item.label
2880
+ }
2881
+ ),
2882
+ isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx(Text$1, { style: styles$4.checkmark, children: "✓" })
2883
+ ]
2884
+ }
2885
+ );
2886
+ };
2887
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2888
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
2889
+ TouchableOpacity,
2890
+ {
2891
+ style: [
2892
+ styles$4.trigger,
2893
+ disabled && styles$4.triggerDisabled,
2894
+ triggerStyle
2895
+ ],
2896
+ onPress: () => !disabled && setModalVisible(true),
2897
+ activeOpacity: 0.7,
2898
+ children: [
2899
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2900
+ Text$1,
2901
+ {
2902
+ style: [
2903
+ styles$4.triggerText,
2904
+ !selectedOption && styles$4.triggerPlaceholder,
2905
+ triggerTextStyle
2906
+ ],
2907
+ numberOfLines: 1,
2908
+ children: (selectedOption == null ? void 0 : selectedOption.label) ?? placeholder
2909
+ }
2910
+ ),
2911
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text$1, { style: styles$4.triggerArrow, children: "▼" })
2912
+ ]
2913
+ }
2914
+ ),
2915
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2916
+ Modal$1,
2917
+ {
2918
+ visible: modalVisible,
2919
+ animationType: "slide",
2920
+ presentationStyle: "pageSheet",
2921
+ onRequestClose: () => setModalVisible(false),
2922
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { style: [styles$4.modalContainer, { paddingTop: insets.top }], children: [
2923
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { style: styles$4.modalHeader, children: [
2924
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text$1, { style: styles$4.modalTitle, children: title }),
2925
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2926
+ Pressable,
2927
+ {
2928
+ style: styles$4.closeButton,
2929
+ onPress: () => setModalVisible(false),
2930
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text$1, { style: styles$4.closeButtonText, children: "Done" })
2931
+ }
2932
+ )
2933
+ ] }),
2934
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2935
+ FlatList,
2936
+ {
2937
+ data: options,
2938
+ keyExtractor: (item) => item.value,
2939
+ renderItem: renderOption,
2940
+ contentContainerStyle: styles$4.listContent,
2941
+ ItemSeparatorComponent: ItemSeparator
2942
+ }
2943
+ )
2944
+ ] })
2945
+ }
2946
+ )
2947
+ ] });
2948
+ };
2949
+ const styles$4 = StyleSheet.create({
2950
+ trigger: {
2951
+ flexDirection: "row",
2952
+ alignItems: "center",
2953
+ justifyContent: "space-between",
2954
+ borderWidth: 1,
2955
+ borderColor: "#d1d5db",
2956
+ borderRadius: 8,
2957
+ paddingHorizontal: 12,
2958
+ paddingVertical: 12,
2959
+ backgroundColor: "#ffffff"
2960
+ },
2961
+ triggerDisabled: {
2962
+ opacity: 0.5
2963
+ },
2964
+ triggerText: {
2965
+ flex: 1,
2966
+ fontSize: 16,
2967
+ color: "#1a1a1a"
2968
+ },
2969
+ triggerPlaceholder: {
2970
+ color: "#9ca3af"
2971
+ },
2972
+ triggerArrow: {
2973
+ fontSize: 10,
2974
+ color: "#9ca3af",
2975
+ marginLeft: 8
2976
+ },
2977
+ modalContainer: {
2978
+ flex: 1,
2979
+ backgroundColor: "#ffffff"
2980
+ },
2981
+ modalHeader: {
2982
+ flexDirection: "row",
2983
+ justifyContent: "space-between",
2984
+ alignItems: "center",
2985
+ paddingHorizontal: 16,
2986
+ paddingVertical: 12,
2987
+ borderBottomWidth: 1,
2988
+ borderBottomColor: "#e9ecef"
2989
+ },
2990
+ modalTitle: {
2991
+ fontSize: 18,
2992
+ fontWeight: "600",
2993
+ color: "#1a1a1a"
2994
+ },
2995
+ closeButton: {
2996
+ padding: 8
2997
+ },
2998
+ closeButtonText: {
2999
+ fontSize: 16,
3000
+ fontWeight: "600",
3001
+ color: "#3b82f6"
3002
+ },
3003
+ listContent: {
3004
+ padding: 16
3005
+ },
3006
+ optionItem: {
3007
+ flexDirection: "row",
3008
+ alignItems: "center",
3009
+ padding: 16,
3010
+ backgroundColor: "#f8f9fa",
3011
+ borderRadius: 12
3012
+ },
3013
+ optionItemSelected: {
3014
+ backgroundColor: "#e0f2fe"
3015
+ },
3016
+ optionLabel: {
3017
+ flex: 1,
3018
+ fontSize: 16,
3019
+ color: "#1a1a1a"
3020
+ },
3021
+ optionLabelSelected: {
3022
+ fontWeight: "600",
3023
+ color: "#3b82f6"
3024
+ },
3025
+ optionDisabled: {
3026
+ opacity: 0.5
3027
+ },
3028
+ checkmark: {
3029
+ fontSize: 18,
3030
+ color: "#3b82f6",
3031
+ fontWeight: "bold"
3032
+ },
3033
+ separator: {
3034
+ height: 8
3035
+ }
3036
+ });
2839
3037
  const SearchInput = ({
2840
3038
  value: controlledValue,
2841
3039
  onChangeText,
@@ -10625,7 +10823,7 @@ function VirtualList({
10625
10823
  },
10626
10824
  [renderItem]
10627
10825
  );
10628
- const ItemSeparator = React.useCallback(() => {
10826
+ const ItemSeparator2 = React.useCallback(() => {
10629
10827
  if (!showSeparator) return null;
10630
10828
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10631
10829
  View,
@@ -10667,7 +10865,7 @@ function VirtualList({
10667
10865
  horizontal,
10668
10866
  showsVerticalScrollIndicator: !horizontal,
10669
10867
  showsHorizontalScrollIndicator: horizontal,
10670
- ItemSeparatorComponent: showSeparator ? ItemSeparator : void 0,
10868
+ ItemSeparatorComponent: showSeparator ? ItemSeparator2 : void 0,
10671
10869
  ListEmptyComponent: ListEmpty,
10672
10870
  onRefresh,
10673
10871
  refreshing,
@@ -10829,6 +11027,7 @@ export {
10829
11027
  Pagination,
10830
11028
  PhoneInput,
10831
11029
  Popover,
11030
+ PopupSelect,
10832
11031
  Progress,
10833
11032
  ProgressBar,
10834
11033
  ProgressCircle,