@kaushverse/pickify 1.2.7 → 1.2.8
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.mts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +140 -22
- package/dist/index.mjs +144 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -37,7 +37,7 @@ type PickerStyles = {
|
|
|
37
37
|
selectText?: TextStyle;
|
|
38
38
|
error?: TextStyle;
|
|
39
39
|
};
|
|
40
|
-
type Props = {
|
|
40
|
+
type Props$1 = {
|
|
41
41
|
labelStyle?: TextStyle;
|
|
42
42
|
selectBoxStyle?: ViewStyle;
|
|
43
43
|
selectTextStyle?: TextStyle;
|
|
@@ -57,7 +57,7 @@ type Props = {
|
|
|
57
57
|
onClose: () => void;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
declare function PickerModal({ visible, selectedValue, options, groups, styles, theme, renderTab, renderItem, renderContainer, onSelect, onClose, renderIcon, label, placeholder, error, labelStyle, selectBoxStyle, selectTextStyle, errorStyle, setVisible }: Props & {
|
|
60
|
+
declare function PickerModal({ visible, selectedValue, options, groups, styles, theme, renderTab, renderItem, renderContainer, onSelect, onClose, renderIcon, label, placeholder, error, labelStyle, selectBoxStyle, selectTextStyle, errorStyle, setVisible }: Props$1 & {
|
|
61
61
|
label?: string;
|
|
62
62
|
placeholder?: string;
|
|
63
63
|
error?: string;
|
|
@@ -178,6 +178,18 @@ type FloatingButtonRef = {
|
|
|
178
178
|
};
|
|
179
179
|
declare const FloatingButton: React$1.ForwardRefExoticComponent<FloatingButtonProps & React$1.RefAttributes<FloatingButtonRef>>;
|
|
180
180
|
|
|
181
|
+
type SearchItem = {
|
|
182
|
+
text: string;
|
|
183
|
+
color?: string;
|
|
184
|
+
};
|
|
185
|
+
type Props = {
|
|
186
|
+
data: SearchItem[];
|
|
187
|
+
onSearch?: (text: string) => void;
|
|
188
|
+
renderLeftIcon: () => React$1.ReactNode;
|
|
189
|
+
renderRightIcons?: () => React$1.ReactNode;
|
|
190
|
+
};
|
|
191
|
+
declare function AnimatedSearchBar({ data, onSearch, renderLeftIcon, renderRightIcons, }: Props): react_jsx_runtime.JSX.Element;
|
|
192
|
+
|
|
181
193
|
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
182
194
|
|
|
183
195
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, defaultOpen, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
@@ -186,4 +198,4 @@ declare const toggleValue: (arr: string[], value: string) => string[];
|
|
|
186
198
|
|
|
187
199
|
declare const groupOptions: (options: Option[], config: Record<string, string[]>) => Group[];
|
|
188
200
|
|
|
189
|
-
export { FloatingButton, type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type MultiPickerStyles, type Option, PickerModal, type PickerStyles, type Props, type Theme, groupOptions, toggleValue };
|
|
201
|
+
export { AnimatedSearchBar, FloatingButton, type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type MultiPickerStyles, type Option, PickerModal, type PickerStyles, type Props$1 as Props, type Theme, groupOptions, toggleValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ type PickerStyles = {
|
|
|
37
37
|
selectText?: TextStyle;
|
|
38
38
|
error?: TextStyle;
|
|
39
39
|
};
|
|
40
|
-
type Props = {
|
|
40
|
+
type Props$1 = {
|
|
41
41
|
labelStyle?: TextStyle;
|
|
42
42
|
selectBoxStyle?: ViewStyle;
|
|
43
43
|
selectTextStyle?: TextStyle;
|
|
@@ -57,7 +57,7 @@ type Props = {
|
|
|
57
57
|
onClose: () => void;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
declare function PickerModal({ visible, selectedValue, options, groups, styles, theme, renderTab, renderItem, renderContainer, onSelect, onClose, renderIcon, label, placeholder, error, labelStyle, selectBoxStyle, selectTextStyle, errorStyle, setVisible }: Props & {
|
|
60
|
+
declare function PickerModal({ visible, selectedValue, options, groups, styles, theme, renderTab, renderItem, renderContainer, onSelect, onClose, renderIcon, label, placeholder, error, labelStyle, selectBoxStyle, selectTextStyle, errorStyle, setVisible }: Props$1 & {
|
|
61
61
|
label?: string;
|
|
62
62
|
placeholder?: string;
|
|
63
63
|
error?: string;
|
|
@@ -178,6 +178,18 @@ type FloatingButtonRef = {
|
|
|
178
178
|
};
|
|
179
179
|
declare const FloatingButton: React$1.ForwardRefExoticComponent<FloatingButtonProps & React$1.RefAttributes<FloatingButtonRef>>;
|
|
180
180
|
|
|
181
|
+
type SearchItem = {
|
|
182
|
+
text: string;
|
|
183
|
+
color?: string;
|
|
184
|
+
};
|
|
185
|
+
type Props = {
|
|
186
|
+
data: SearchItem[];
|
|
187
|
+
onSearch?: (text: string) => void;
|
|
188
|
+
renderLeftIcon: () => React$1.ReactNode;
|
|
189
|
+
renderRightIcons?: () => React$1.ReactNode;
|
|
190
|
+
};
|
|
191
|
+
declare function AnimatedSearchBar({ data, onSearch, renderLeftIcon, renderRightIcons, }: Props): react_jsx_runtime.JSX.Element;
|
|
192
|
+
|
|
181
193
|
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
182
194
|
|
|
183
195
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, defaultOpen, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
@@ -186,4 +198,4 @@ declare const toggleValue: (arr: string[], value: string) => string[];
|
|
|
186
198
|
|
|
187
199
|
declare const groupOptions: (options: Option[], config: Record<string, string[]>) => Group[];
|
|
188
200
|
|
|
189
|
-
export { FloatingButton, type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type MultiPickerStyles, type Option, PickerModal, type PickerStyles, type Props, type Theme, groupOptions, toggleValue };
|
|
201
|
+
export { AnimatedSearchBar, FloatingButton, type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type MultiPickerStyles, type Option, PickerModal, type PickerStyles, type Props$1 as Props, type Theme, groupOptions, toggleValue };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AnimatedSearchBar: () => AnimatedSearchBar,
|
|
23
24
|
FloatingButton: () => FloatingButton_default,
|
|
24
25
|
MultiPickerGroup: () => MultiPickerGroup,
|
|
25
26
|
MultiPickerItem: () => MultiPickerItem,
|
|
@@ -40,7 +41,7 @@ function PickerModal({
|
|
|
40
41
|
selectedValue,
|
|
41
42
|
options,
|
|
42
43
|
groups = [],
|
|
43
|
-
styles:
|
|
44
|
+
styles: styles3,
|
|
44
45
|
theme,
|
|
45
46
|
renderTab,
|
|
46
47
|
renderItem,
|
|
@@ -98,7 +99,7 @@ function PickerModal({
|
|
|
98
99
|
style: [
|
|
99
100
|
defaultStyles.container,
|
|
100
101
|
{ backgroundColor: bg },
|
|
101
|
-
|
|
102
|
+
styles3?.container
|
|
102
103
|
],
|
|
103
104
|
children: [
|
|
104
105
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -107,10 +108,10 @@ function PickerModal({
|
|
|
107
108
|
style: [
|
|
108
109
|
defaultStyles.doneBtn,
|
|
109
110
|
{ backgroundColor: primary },
|
|
110
|
-
|
|
111
|
+
styles3?.doneBtn
|
|
111
112
|
],
|
|
112
113
|
onPress: handleClose,
|
|
113
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.doneText,
|
|
114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.doneText, styles3?.doneText], children: "Done" })
|
|
114
115
|
}
|
|
115
116
|
),
|
|
116
117
|
hasGroups && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: groups.map((tab, index) => {
|
|
@@ -123,7 +124,7 @@ function PickerModal({
|
|
|
123
124
|
{
|
|
124
125
|
style: [
|
|
125
126
|
defaultStyles.tab,
|
|
126
|
-
|
|
127
|
+
styles3?.tab,
|
|
127
128
|
isActive && { backgroundColor: primary }
|
|
128
129
|
],
|
|
129
130
|
onPress: () => setActiveTab(index),
|
|
@@ -133,7 +134,7 @@ function PickerModal({
|
|
|
133
134
|
style: [
|
|
134
135
|
defaultStyles.tabText,
|
|
135
136
|
{ color: isActive ? "#fff" : text },
|
|
136
|
-
|
|
137
|
+
styles3?.tabText
|
|
137
138
|
],
|
|
138
139
|
children: tab.label
|
|
139
140
|
}
|
|
@@ -164,14 +165,14 @@ function PickerModal({
|
|
|
164
165
|
}
|
|
165
166
|
);
|
|
166
167
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
167
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, { style:
|
|
168
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.label,
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, { style: styles3?.inputContainer, children: [
|
|
169
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.label, styles3?.label, labelStyle], children: label }),
|
|
169
170
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
170
171
|
import_react_native.TouchableOpacity,
|
|
171
172
|
{
|
|
172
173
|
style: [
|
|
173
174
|
defaultStyles.selectBox,
|
|
174
|
-
|
|
175
|
+
styles3?.selectBox,
|
|
175
176
|
selectBoxStyle,
|
|
176
177
|
error && { borderColor: "red" }
|
|
177
178
|
],
|
|
@@ -182,7 +183,7 @@ function PickerModal({
|
|
|
182
183
|
{
|
|
183
184
|
style: [
|
|
184
185
|
defaultStyles.selectText,
|
|
185
|
-
|
|
186
|
+
styles3?.selectText,
|
|
186
187
|
selectTextStyle
|
|
187
188
|
],
|
|
188
189
|
children: getLabel() || placeholder
|
|
@@ -196,7 +197,7 @@ function PickerModal({
|
|
|
196
197
|
]
|
|
197
198
|
}
|
|
198
199
|
),
|
|
199
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.error,
|
|
200
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.error, styles3?.error, errorStyle], children: error })
|
|
200
201
|
] }),
|
|
201
202
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Modal, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style: defaultStyles.modalOverlay, children: renderContainer ? renderContainer(content) : content }) })
|
|
202
203
|
] });
|
|
@@ -483,7 +484,7 @@ function MultiPickerModal({
|
|
|
483
484
|
renderInputIcon,
|
|
484
485
|
renderGroupIcon,
|
|
485
486
|
renderItemIcon,
|
|
486
|
-
styles:
|
|
487
|
+
styles: styles3
|
|
487
488
|
}) {
|
|
488
489
|
const [internalVisible, setInternalVisible] = (0, import_react3.useState)(false);
|
|
489
490
|
const [modalKey, setModalKey] = (0, import_react3.useState)(0);
|
|
@@ -544,7 +545,7 @@ function MultiPickerModal({
|
|
|
544
545
|
selected: selectedValues.includes(item.value),
|
|
545
546
|
onPress: () => handleSelect(item.value),
|
|
546
547
|
renderItemIcon,
|
|
547
|
-
styles:
|
|
548
|
+
styles: styles3?.item
|
|
548
549
|
},
|
|
549
550
|
item.value
|
|
550
551
|
))
|
|
@@ -559,7 +560,7 @@ function MultiPickerModal({
|
|
|
559
560
|
selected: selectedValues.includes(item.value),
|
|
560
561
|
onPress: () => handleSelect(item.value),
|
|
561
562
|
renderItemIcon,
|
|
562
|
-
styles:
|
|
563
|
+
styles: styles3?.item
|
|
563
564
|
},
|
|
564
565
|
item.value
|
|
565
566
|
));
|
|
@@ -575,11 +576,11 @@ function MultiPickerModal({
|
|
|
575
576
|
]
|
|
576
577
|
};
|
|
577
578
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
578
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.label,
|
|
579
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.label, styles3?.label], children: label }),
|
|
579
580
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
580
581
|
import_react_native4.TouchableOpacity,
|
|
581
582
|
{
|
|
582
|
-
style: [defaultStyles3.box,
|
|
583
|
+
style: [defaultStyles3.box, styles3?.selectBox],
|
|
583
584
|
onPress: open,
|
|
584
585
|
activeOpacity: 0.7,
|
|
585
586
|
children: [
|
|
@@ -588,7 +589,7 @@ function MultiPickerModal({
|
|
|
588
589
|
{
|
|
589
590
|
style: [
|
|
590
591
|
defaultStyles3.text,
|
|
591
|
-
|
|
592
|
+
styles3?.selectText,
|
|
592
593
|
!selectedValues?.length && defaultStyles3.placeholder
|
|
593
594
|
],
|
|
594
595
|
numberOfLines: 1,
|
|
@@ -603,7 +604,7 @@ function MultiPickerModal({
|
|
|
603
604
|
]
|
|
604
605
|
}
|
|
605
606
|
),
|
|
606
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.error,
|
|
607
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.error, styles3?.error], children: error }),
|
|
607
608
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
608
609
|
import_react_native4.Modal,
|
|
609
610
|
{
|
|
@@ -611,12 +612,12 @@ function MultiPickerModal({
|
|
|
611
612
|
transparent: true,
|
|
612
613
|
animationType: "none",
|
|
613
614
|
onRequestClose: close,
|
|
614
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: [defaultStyles3.overlay,
|
|
615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: [defaultStyles3.overlay, styles3?.overlay], children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
615
616
|
import_react_native4.Animated.View,
|
|
616
617
|
{
|
|
617
618
|
style: [
|
|
618
619
|
defaultStyles3.container,
|
|
619
|
-
|
|
620
|
+
styles3?.container,
|
|
620
621
|
modalAnimatedStyle
|
|
621
622
|
],
|
|
622
623
|
children: [
|
|
@@ -624,9 +625,9 @@ function MultiPickerModal({
|
|
|
624
625
|
import_react_native4.TouchableOpacity,
|
|
625
626
|
{
|
|
626
627
|
onPress: close,
|
|
627
|
-
style: [defaultStyles3.done,
|
|
628
|
+
style: [defaultStyles3.done, styles3?.doneBtn],
|
|
628
629
|
activeOpacity: 0.7,
|
|
629
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.doneText,
|
|
630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.doneText, styles3?.doneText], children: "Done" })
|
|
630
631
|
}
|
|
631
632
|
),
|
|
632
633
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -940,6 +941,122 @@ var defaultStyles4 = import_react_native5.StyleSheet.create({
|
|
|
940
941
|
});
|
|
941
942
|
var FloatingButton_default = FloatingButton;
|
|
942
943
|
|
|
944
|
+
// src/core/AnimatedSearchBar.tsx
|
|
945
|
+
var import_react5 = require("react");
|
|
946
|
+
var import_react_native6 = require("react-native");
|
|
947
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
948
|
+
function AnimatedSearchBar({
|
|
949
|
+
data,
|
|
950
|
+
onSearch,
|
|
951
|
+
renderLeftIcon,
|
|
952
|
+
renderRightIcons
|
|
953
|
+
}) {
|
|
954
|
+
const [index, setIndex] = (0, import_react5.useState)(0);
|
|
955
|
+
const translateY = (0, import_react5.useRef)(new import_react_native6.Animated.Value(20)).current;
|
|
956
|
+
const opacity = (0, import_react5.useRef)(new import_react_native6.Animated.Value(0)).current;
|
|
957
|
+
const animate = () => {
|
|
958
|
+
translateY.setValue(20);
|
|
959
|
+
opacity.setValue(0);
|
|
960
|
+
import_react_native6.Animated.sequence([
|
|
961
|
+
import_react_native6.Animated.parallel([
|
|
962
|
+
import_react_native6.Animated.timing(translateY, {
|
|
963
|
+
toValue: 0,
|
|
964
|
+
duration: 400,
|
|
965
|
+
useNativeDriver: true
|
|
966
|
+
}),
|
|
967
|
+
import_react_native6.Animated.timing(opacity, {
|
|
968
|
+
toValue: 1,
|
|
969
|
+
duration: 400,
|
|
970
|
+
useNativeDriver: true
|
|
971
|
+
})
|
|
972
|
+
]),
|
|
973
|
+
import_react_native6.Animated.delay(1200),
|
|
974
|
+
import_react_native6.Animated.parallel([
|
|
975
|
+
import_react_native6.Animated.timing(translateY, {
|
|
976
|
+
toValue: -20,
|
|
977
|
+
duration: 400,
|
|
978
|
+
useNativeDriver: true
|
|
979
|
+
}),
|
|
980
|
+
import_react_native6.Animated.timing(opacity, {
|
|
981
|
+
toValue: 0,
|
|
982
|
+
duration: 400,
|
|
983
|
+
useNativeDriver: true
|
|
984
|
+
})
|
|
985
|
+
])
|
|
986
|
+
]).start(() => {
|
|
987
|
+
setIndex((prev) => (prev + 1) % data.length);
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
(0, import_react5.useEffect)(() => {
|
|
991
|
+
if (data.length) animate();
|
|
992
|
+
}, [index]);
|
|
993
|
+
const current = data[index];
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native6.View, { style: styles2.container, children: [
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.View, { style: styles2.left, children: renderLeftIcon() }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native6.View, { style: styles2.inputContainer, children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
998
|
+
import_react_native6.TextInput,
|
|
999
|
+
{
|
|
1000
|
+
style: styles2.input,
|
|
1001
|
+
placeholder: "",
|
|
1002
|
+
onChangeText: onSearch
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1006
|
+
import_react_native6.Animated.Text,
|
|
1007
|
+
{
|
|
1008
|
+
style: [
|
|
1009
|
+
styles2.placeholder,
|
|
1010
|
+
{
|
|
1011
|
+
transform: [{ translateY }],
|
|
1012
|
+
opacity
|
|
1013
|
+
}
|
|
1014
|
+
],
|
|
1015
|
+
children: [
|
|
1016
|
+
"Search for",
|
|
1017
|
+
" ",
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.Animated.Text, { style: { color: current?.color || "#999" }, children: current?.text })
|
|
1019
|
+
]
|
|
1020
|
+
}
|
|
1021
|
+
)
|
|
1022
|
+
] }),
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.View, { style: styles2.right, children: renderRightIcons?.() })
|
|
1024
|
+
] });
|
|
1025
|
+
}
|
|
1026
|
+
var styles2 = import_react_native6.StyleSheet.create({
|
|
1027
|
+
container: {
|
|
1028
|
+
flexDirection: "row",
|
|
1029
|
+
alignItems: "center",
|
|
1030
|
+
backgroundColor: "#111",
|
|
1031
|
+
borderRadius: 12,
|
|
1032
|
+
paddingHorizontal: 10,
|
|
1033
|
+
height: 50
|
|
1034
|
+
},
|
|
1035
|
+
left: {
|
|
1036
|
+
paddingRight: 8,
|
|
1037
|
+
borderRightWidth: 1,
|
|
1038
|
+
borderColor: "#333"
|
|
1039
|
+
},
|
|
1040
|
+
inputContainer: {
|
|
1041
|
+
flex: 1,
|
|
1042
|
+
justifyContent: "center",
|
|
1043
|
+
paddingHorizontal: 10
|
|
1044
|
+
},
|
|
1045
|
+
input: {
|
|
1046
|
+
color: "#fff",
|
|
1047
|
+
height: "100%"
|
|
1048
|
+
},
|
|
1049
|
+
placeholder: {
|
|
1050
|
+
position: "absolute",
|
|
1051
|
+
color: "#888",
|
|
1052
|
+
fontSize: 14
|
|
1053
|
+
},
|
|
1054
|
+
right: {
|
|
1055
|
+
flexDirection: "row",
|
|
1056
|
+
gap: 10
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
|
|
943
1060
|
// src/utils/groupOptions.ts
|
|
944
1061
|
var groupOptions = (options, config) => {
|
|
945
1062
|
return Object.entries(config).map(([label, values]) => ({
|
|
@@ -949,6 +1066,7 @@ var groupOptions = (options, config) => {
|
|
|
949
1066
|
};
|
|
950
1067
|
// Annotate the CommonJS export names for ESM import in node:
|
|
951
1068
|
0 && (module.exports = {
|
|
1069
|
+
AnimatedSearchBar,
|
|
952
1070
|
FloatingButton,
|
|
953
1071
|
MultiPickerGroup,
|
|
954
1072
|
MultiPickerItem,
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ function PickerModal({
|
|
|
15
15
|
selectedValue,
|
|
16
16
|
options,
|
|
17
17
|
groups = [],
|
|
18
|
-
styles:
|
|
18
|
+
styles: styles3,
|
|
19
19
|
theme,
|
|
20
20
|
renderTab,
|
|
21
21
|
renderItem,
|
|
@@ -73,7 +73,7 @@ function PickerModal({
|
|
|
73
73
|
style: [
|
|
74
74
|
defaultStyles.container,
|
|
75
75
|
{ backgroundColor: bg },
|
|
76
|
-
|
|
76
|
+
styles3?.container
|
|
77
77
|
],
|
|
78
78
|
children: [
|
|
79
79
|
/* @__PURE__ */ jsx(
|
|
@@ -82,10 +82,10 @@ function PickerModal({
|
|
|
82
82
|
style: [
|
|
83
83
|
defaultStyles.doneBtn,
|
|
84
84
|
{ backgroundColor: primary },
|
|
85
|
-
|
|
85
|
+
styles3?.doneBtn
|
|
86
86
|
],
|
|
87
87
|
onPress: handleClose,
|
|
88
|
-
children: /* @__PURE__ */ jsx(Text, { style: [defaultStyles.doneText,
|
|
88
|
+
children: /* @__PURE__ */ jsx(Text, { style: [defaultStyles.doneText, styles3?.doneText], children: "Done" })
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
91
|
hasGroups && /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: groups.map((tab, index) => {
|
|
@@ -98,7 +98,7 @@ function PickerModal({
|
|
|
98
98
|
{
|
|
99
99
|
style: [
|
|
100
100
|
defaultStyles.tab,
|
|
101
|
-
|
|
101
|
+
styles3?.tab,
|
|
102
102
|
isActive && { backgroundColor: primary }
|
|
103
103
|
],
|
|
104
104
|
onPress: () => setActiveTab(index),
|
|
@@ -108,7 +108,7 @@ function PickerModal({
|
|
|
108
108
|
style: [
|
|
109
109
|
defaultStyles.tabText,
|
|
110
110
|
{ color: isActive ? "#fff" : text },
|
|
111
|
-
|
|
111
|
+
styles3?.tabText
|
|
112
112
|
],
|
|
113
113
|
children: tab.label
|
|
114
114
|
}
|
|
@@ -139,14 +139,14 @@ function PickerModal({
|
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
141
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
142
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
143
|
-
label && /* @__PURE__ */ jsx(Text, { style: [defaultStyles.label,
|
|
142
|
+
/* @__PURE__ */ jsxs(View, { style: styles3?.inputContainer, children: [
|
|
143
|
+
label && /* @__PURE__ */ jsx(Text, { style: [defaultStyles.label, styles3?.label, labelStyle], children: label }),
|
|
144
144
|
/* @__PURE__ */ jsxs(
|
|
145
145
|
TouchableOpacity,
|
|
146
146
|
{
|
|
147
147
|
style: [
|
|
148
148
|
defaultStyles.selectBox,
|
|
149
|
-
|
|
149
|
+
styles3?.selectBox,
|
|
150
150
|
selectBoxStyle,
|
|
151
151
|
error && { borderColor: "red" }
|
|
152
152
|
],
|
|
@@ -157,7 +157,7 @@ function PickerModal({
|
|
|
157
157
|
{
|
|
158
158
|
style: [
|
|
159
159
|
defaultStyles.selectText,
|
|
160
|
-
|
|
160
|
+
styles3?.selectText,
|
|
161
161
|
selectTextStyle
|
|
162
162
|
],
|
|
163
163
|
children: getLabel() || placeholder
|
|
@@ -171,7 +171,7 @@ function PickerModal({
|
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
error && /* @__PURE__ */ jsx(Text, { style: [defaultStyles.error,
|
|
174
|
+
error && /* @__PURE__ */ jsx(Text, { style: [defaultStyles.error, styles3?.error, errorStyle], children: error })
|
|
175
175
|
] }),
|
|
176
176
|
/* @__PURE__ */ jsx(Modal, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ jsx(View, { style: defaultStyles.modalOverlay, children: renderContainer ? renderContainer(content) : content }) })
|
|
177
177
|
] });
|
|
@@ -472,7 +472,7 @@ function MultiPickerModal({
|
|
|
472
472
|
renderInputIcon,
|
|
473
473
|
renderGroupIcon,
|
|
474
474
|
renderItemIcon,
|
|
475
|
-
styles:
|
|
475
|
+
styles: styles3
|
|
476
476
|
}) {
|
|
477
477
|
const [internalVisible, setInternalVisible] = useState3(false);
|
|
478
478
|
const [modalKey, setModalKey] = useState3(0);
|
|
@@ -533,7 +533,7 @@ function MultiPickerModal({
|
|
|
533
533
|
selected: selectedValues.includes(item.value),
|
|
534
534
|
onPress: () => handleSelect(item.value),
|
|
535
535
|
renderItemIcon,
|
|
536
|
-
styles:
|
|
536
|
+
styles: styles3?.item
|
|
537
537
|
},
|
|
538
538
|
item.value
|
|
539
539
|
))
|
|
@@ -548,7 +548,7 @@ function MultiPickerModal({
|
|
|
548
548
|
selected: selectedValues.includes(item.value),
|
|
549
549
|
onPress: () => handleSelect(item.value),
|
|
550
550
|
renderItemIcon,
|
|
551
|
-
styles:
|
|
551
|
+
styles: styles3?.item
|
|
552
552
|
},
|
|
553
553
|
item.value
|
|
554
554
|
));
|
|
@@ -564,11 +564,11 @@ function MultiPickerModal({
|
|
|
564
564
|
]
|
|
565
565
|
};
|
|
566
566
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
567
|
-
label && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.label,
|
|
567
|
+
label && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.label, styles3?.label], children: label }),
|
|
568
568
|
/* @__PURE__ */ jsxs4(
|
|
569
569
|
TouchableOpacity4,
|
|
570
570
|
{
|
|
571
|
-
style: [defaultStyles3.box,
|
|
571
|
+
style: [defaultStyles3.box, styles3?.selectBox],
|
|
572
572
|
onPress: open,
|
|
573
573
|
activeOpacity: 0.7,
|
|
574
574
|
children: [
|
|
@@ -577,7 +577,7 @@ function MultiPickerModal({
|
|
|
577
577
|
{
|
|
578
578
|
style: [
|
|
579
579
|
defaultStyles3.text,
|
|
580
|
-
|
|
580
|
+
styles3?.selectText,
|
|
581
581
|
!selectedValues?.length && defaultStyles3.placeholder
|
|
582
582
|
],
|
|
583
583
|
numberOfLines: 1,
|
|
@@ -592,7 +592,7 @@ function MultiPickerModal({
|
|
|
592
592
|
]
|
|
593
593
|
}
|
|
594
594
|
),
|
|
595
|
-
error && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.error,
|
|
595
|
+
error && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.error, styles3?.error], children: error }),
|
|
596
596
|
/* @__PURE__ */ jsx4(
|
|
597
597
|
Modal2,
|
|
598
598
|
{
|
|
@@ -600,12 +600,12 @@ function MultiPickerModal({
|
|
|
600
600
|
transparent: true,
|
|
601
601
|
animationType: "none",
|
|
602
602
|
onRequestClose: close,
|
|
603
|
-
children: /* @__PURE__ */ jsx4(View4, { style: [defaultStyles3.overlay,
|
|
603
|
+
children: /* @__PURE__ */ jsx4(View4, { style: [defaultStyles3.overlay, styles3?.overlay], children: /* @__PURE__ */ jsxs4(
|
|
604
604
|
Animated2.View,
|
|
605
605
|
{
|
|
606
606
|
style: [
|
|
607
607
|
defaultStyles3.container,
|
|
608
|
-
|
|
608
|
+
styles3?.container,
|
|
609
609
|
modalAnimatedStyle
|
|
610
610
|
],
|
|
611
611
|
children: [
|
|
@@ -613,9 +613,9 @@ function MultiPickerModal({
|
|
|
613
613
|
TouchableOpacity4,
|
|
614
614
|
{
|
|
615
615
|
onPress: close,
|
|
616
|
-
style: [defaultStyles3.done,
|
|
616
|
+
style: [defaultStyles3.done, styles3?.doneBtn],
|
|
617
617
|
activeOpacity: 0.7,
|
|
618
|
-
children: /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.doneText,
|
|
618
|
+
children: /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.doneText, styles3?.doneText], children: "Done" })
|
|
619
619
|
}
|
|
620
620
|
),
|
|
621
621
|
/* @__PURE__ */ jsx4(
|
|
@@ -940,6 +940,127 @@ var defaultStyles4 = StyleSheet5.create({
|
|
|
940
940
|
});
|
|
941
941
|
var FloatingButton_default = FloatingButton;
|
|
942
942
|
|
|
943
|
+
// src/core/AnimatedSearchBar.tsx
|
|
944
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
|
|
945
|
+
import {
|
|
946
|
+
View as View6,
|
|
947
|
+
TextInput,
|
|
948
|
+
Animated as Animated4,
|
|
949
|
+
StyleSheet as StyleSheet6
|
|
950
|
+
} from "react-native";
|
|
951
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
952
|
+
function AnimatedSearchBar({
|
|
953
|
+
data,
|
|
954
|
+
onSearch,
|
|
955
|
+
renderLeftIcon,
|
|
956
|
+
renderRightIcons
|
|
957
|
+
}) {
|
|
958
|
+
const [index, setIndex] = useState5(0);
|
|
959
|
+
const translateY = useRef4(new Animated4.Value(20)).current;
|
|
960
|
+
const opacity = useRef4(new Animated4.Value(0)).current;
|
|
961
|
+
const animate = () => {
|
|
962
|
+
translateY.setValue(20);
|
|
963
|
+
opacity.setValue(0);
|
|
964
|
+
Animated4.sequence([
|
|
965
|
+
Animated4.parallel([
|
|
966
|
+
Animated4.timing(translateY, {
|
|
967
|
+
toValue: 0,
|
|
968
|
+
duration: 400,
|
|
969
|
+
useNativeDriver: true
|
|
970
|
+
}),
|
|
971
|
+
Animated4.timing(opacity, {
|
|
972
|
+
toValue: 1,
|
|
973
|
+
duration: 400,
|
|
974
|
+
useNativeDriver: true
|
|
975
|
+
})
|
|
976
|
+
]),
|
|
977
|
+
Animated4.delay(1200),
|
|
978
|
+
Animated4.parallel([
|
|
979
|
+
Animated4.timing(translateY, {
|
|
980
|
+
toValue: -20,
|
|
981
|
+
duration: 400,
|
|
982
|
+
useNativeDriver: true
|
|
983
|
+
}),
|
|
984
|
+
Animated4.timing(opacity, {
|
|
985
|
+
toValue: 0,
|
|
986
|
+
duration: 400,
|
|
987
|
+
useNativeDriver: true
|
|
988
|
+
})
|
|
989
|
+
])
|
|
990
|
+
]).start(() => {
|
|
991
|
+
setIndex((prev) => (prev + 1) % data.length);
|
|
992
|
+
});
|
|
993
|
+
};
|
|
994
|
+
useEffect5(() => {
|
|
995
|
+
if (data.length) animate();
|
|
996
|
+
}, [index]);
|
|
997
|
+
const current = data[index];
|
|
998
|
+
return /* @__PURE__ */ jsxs6(View6, { style: styles2.container, children: [
|
|
999
|
+
/* @__PURE__ */ jsx6(View6, { style: styles2.left, children: renderLeftIcon() }),
|
|
1000
|
+
/* @__PURE__ */ jsxs6(View6, { style: styles2.inputContainer, children: [
|
|
1001
|
+
/* @__PURE__ */ jsx6(
|
|
1002
|
+
TextInput,
|
|
1003
|
+
{
|
|
1004
|
+
style: styles2.input,
|
|
1005
|
+
placeholder: "",
|
|
1006
|
+
onChangeText: onSearch
|
|
1007
|
+
}
|
|
1008
|
+
),
|
|
1009
|
+
/* @__PURE__ */ jsxs6(
|
|
1010
|
+
Animated4.Text,
|
|
1011
|
+
{
|
|
1012
|
+
style: [
|
|
1013
|
+
styles2.placeholder,
|
|
1014
|
+
{
|
|
1015
|
+
transform: [{ translateY }],
|
|
1016
|
+
opacity
|
|
1017
|
+
}
|
|
1018
|
+
],
|
|
1019
|
+
children: [
|
|
1020
|
+
"Search for",
|
|
1021
|
+
" ",
|
|
1022
|
+
/* @__PURE__ */ jsx6(Animated4.Text, { style: { color: current?.color || "#999" }, children: current?.text })
|
|
1023
|
+
]
|
|
1024
|
+
}
|
|
1025
|
+
)
|
|
1026
|
+
] }),
|
|
1027
|
+
/* @__PURE__ */ jsx6(View6, { style: styles2.right, children: renderRightIcons?.() })
|
|
1028
|
+
] });
|
|
1029
|
+
}
|
|
1030
|
+
var styles2 = StyleSheet6.create({
|
|
1031
|
+
container: {
|
|
1032
|
+
flexDirection: "row",
|
|
1033
|
+
alignItems: "center",
|
|
1034
|
+
backgroundColor: "#111",
|
|
1035
|
+
borderRadius: 12,
|
|
1036
|
+
paddingHorizontal: 10,
|
|
1037
|
+
height: 50
|
|
1038
|
+
},
|
|
1039
|
+
left: {
|
|
1040
|
+
paddingRight: 8,
|
|
1041
|
+
borderRightWidth: 1,
|
|
1042
|
+
borderColor: "#333"
|
|
1043
|
+
},
|
|
1044
|
+
inputContainer: {
|
|
1045
|
+
flex: 1,
|
|
1046
|
+
justifyContent: "center",
|
|
1047
|
+
paddingHorizontal: 10
|
|
1048
|
+
},
|
|
1049
|
+
input: {
|
|
1050
|
+
color: "#fff",
|
|
1051
|
+
height: "100%"
|
|
1052
|
+
},
|
|
1053
|
+
placeholder: {
|
|
1054
|
+
position: "absolute",
|
|
1055
|
+
color: "#888",
|
|
1056
|
+
fontSize: 14
|
|
1057
|
+
},
|
|
1058
|
+
right: {
|
|
1059
|
+
flexDirection: "row",
|
|
1060
|
+
gap: 10
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
|
|
943
1064
|
// src/utils/groupOptions.ts
|
|
944
1065
|
var groupOptions = (options, config) => {
|
|
945
1066
|
return Object.entries(config).map(([label, values]) => ({
|
|
@@ -948,6 +1069,7 @@ var groupOptions = (options, config) => {
|
|
|
948
1069
|
})).filter((g) => g.data.length > 0);
|
|
949
1070
|
};
|
|
950
1071
|
export {
|
|
1072
|
+
AnimatedSearchBar,
|
|
951
1073
|
FloatingButton_default as FloatingButton,
|
|
952
1074
|
MultiPickerGroup,
|
|
953
1075
|
MultiPickerItem,
|
package/package.json
CHANGED