@kaushverse/pickify 1.0.12 → 1.1.1
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 +18 -10
- package/dist/index.d.ts +18 -10
- package/dist/index.js +49 -30
- package/dist/index.mjs +49 -30
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -82,7 +82,7 @@ type MultiPickerItemProps = {
|
|
|
82
82
|
label: string;
|
|
83
83
|
selected: boolean;
|
|
84
84
|
onPress: () => void;
|
|
85
|
-
|
|
85
|
+
renderItemIcon?: IconRenderer;
|
|
86
86
|
styles?: MultiPickerItemStyles;
|
|
87
87
|
};
|
|
88
88
|
type MultiPickerGroupStyles = {
|
|
@@ -98,6 +98,18 @@ type MultiPickerGroupProps = {
|
|
|
98
98
|
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
100
|
};
|
|
101
|
+
type MultiPickerStyles = {
|
|
102
|
+
overlay?: ViewStyle;
|
|
103
|
+
container?: ViewStyle;
|
|
104
|
+
doneBtn?: ViewStyle;
|
|
105
|
+
doneText?: TextStyle;
|
|
106
|
+
label?: TextStyle;
|
|
107
|
+
selectBox?: ViewStyle;
|
|
108
|
+
selectText?: TextStyle;
|
|
109
|
+
error?: TextStyle;
|
|
110
|
+
item?: MultiPickerItemStyles;
|
|
111
|
+
group?: MultiPickerGroupStyles;
|
|
112
|
+
};
|
|
101
113
|
type MultiPickerProps = {
|
|
102
114
|
visible?: boolean;
|
|
103
115
|
setVisible?: (val: boolean) => void;
|
|
@@ -110,17 +122,13 @@ type MultiPickerProps = {
|
|
|
110
122
|
error?: string;
|
|
111
123
|
renderInputIcon?: IconRenderer;
|
|
112
124
|
renderGroupIcon?: IconRenderer;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
selectBox?: ViewStyle;
|
|
116
|
-
selectText?: TextStyle;
|
|
117
|
-
};
|
|
118
|
-
errorStyle?: TextStyle;
|
|
125
|
+
renderItemIcon?: IconRenderer;
|
|
126
|
+
styles?: MultiPickerStyles;
|
|
119
127
|
};
|
|
120
128
|
|
|
121
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon,
|
|
129
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, renderItemIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
122
130
|
|
|
123
|
-
declare function MultiPickerItem({ label, selected, onPress,
|
|
131
|
+
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
124
132
|
|
|
125
133
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
126
134
|
|
|
@@ -128,4 +136,4 @@ declare const toggleValue: (arr: string[], value: string) => string[];
|
|
|
128
136
|
|
|
129
137
|
declare const groupOptions: (options: Option[], config: Record<string, string[]>) => Group[];
|
|
130
138
|
|
|
131
|
-
export { type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type Option, PickerModal, type PickerStyles, type Props, type Theme, groupOptions, toggleValue };
|
|
139
|
+
export { 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ type MultiPickerItemProps = {
|
|
|
82
82
|
label: string;
|
|
83
83
|
selected: boolean;
|
|
84
84
|
onPress: () => void;
|
|
85
|
-
|
|
85
|
+
renderItemIcon?: IconRenderer;
|
|
86
86
|
styles?: MultiPickerItemStyles;
|
|
87
87
|
};
|
|
88
88
|
type MultiPickerGroupStyles = {
|
|
@@ -98,6 +98,18 @@ type MultiPickerGroupProps = {
|
|
|
98
98
|
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
100
|
};
|
|
101
|
+
type MultiPickerStyles = {
|
|
102
|
+
overlay?: ViewStyle;
|
|
103
|
+
container?: ViewStyle;
|
|
104
|
+
doneBtn?: ViewStyle;
|
|
105
|
+
doneText?: TextStyle;
|
|
106
|
+
label?: TextStyle;
|
|
107
|
+
selectBox?: ViewStyle;
|
|
108
|
+
selectText?: TextStyle;
|
|
109
|
+
error?: TextStyle;
|
|
110
|
+
item?: MultiPickerItemStyles;
|
|
111
|
+
group?: MultiPickerGroupStyles;
|
|
112
|
+
};
|
|
101
113
|
type MultiPickerProps = {
|
|
102
114
|
visible?: boolean;
|
|
103
115
|
setVisible?: (val: boolean) => void;
|
|
@@ -110,17 +122,13 @@ type MultiPickerProps = {
|
|
|
110
122
|
error?: string;
|
|
111
123
|
renderInputIcon?: IconRenderer;
|
|
112
124
|
renderGroupIcon?: IconRenderer;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
selectBox?: ViewStyle;
|
|
116
|
-
selectText?: TextStyle;
|
|
117
|
-
};
|
|
118
|
-
errorStyle?: TextStyle;
|
|
125
|
+
renderItemIcon?: IconRenderer;
|
|
126
|
+
styles?: MultiPickerStyles;
|
|
119
127
|
};
|
|
120
128
|
|
|
121
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon,
|
|
129
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, renderItemIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
122
130
|
|
|
123
|
-
declare function MultiPickerItem({ label, selected, onPress,
|
|
131
|
+
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
124
132
|
|
|
125
133
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
126
134
|
|
|
@@ -128,4 +136,4 @@ declare const toggleValue: (arr: string[], value: string) => string[];
|
|
|
128
136
|
|
|
129
137
|
declare const groupOptions: (options: Option[], config: Record<string, string[]>) => Group[];
|
|
130
138
|
|
|
131
|
-
export { type Group, type MultiGroup, type MultiOption, MultiPickerGroup, type MultiPickerGroupProps, type MultiPickerGroupStyles, MultiPickerItem, type MultiPickerItemProps, type MultiPickerItemStyles, MultiPickerModal, type MultiPickerProps, type Option, PickerModal, type PickerStyles, type Props, type Theme, groupOptions, toggleValue };
|
|
139
|
+
export { 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 };
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ function PickerModal({
|
|
|
39
39
|
selectedValue,
|
|
40
40
|
options,
|
|
41
41
|
groups = [],
|
|
42
|
-
styles:
|
|
42
|
+
styles: styles2,
|
|
43
43
|
theme,
|
|
44
44
|
renderTab,
|
|
45
45
|
renderItem,
|
|
@@ -97,7 +97,7 @@ function PickerModal({
|
|
|
97
97
|
style: [
|
|
98
98
|
defaultStyles.container,
|
|
99
99
|
{ backgroundColor: bg },
|
|
100
|
-
|
|
100
|
+
styles2?.container
|
|
101
101
|
],
|
|
102
102
|
children: [
|
|
103
103
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -106,10 +106,10 @@ function PickerModal({
|
|
|
106
106
|
style: [
|
|
107
107
|
defaultStyles.doneBtn,
|
|
108
108
|
{ backgroundColor: primary },
|
|
109
|
-
|
|
109
|
+
styles2?.doneBtn
|
|
110
110
|
],
|
|
111
111
|
onPress: handleClose,
|
|
112
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.doneText,
|
|
112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.doneText, styles2?.doneText], children: "Done" })
|
|
113
113
|
}
|
|
114
114
|
),
|
|
115
115
|
hasGroups && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: groups.map((tab, index) => {
|
|
@@ -122,7 +122,7 @@ function PickerModal({
|
|
|
122
122
|
{
|
|
123
123
|
style: [
|
|
124
124
|
defaultStyles.tab,
|
|
125
|
-
|
|
125
|
+
styles2?.tab,
|
|
126
126
|
isActive && { backgroundColor: primary }
|
|
127
127
|
],
|
|
128
128
|
onPress: () => setActiveTab(index),
|
|
@@ -132,7 +132,7 @@ function PickerModal({
|
|
|
132
132
|
style: [
|
|
133
133
|
defaultStyles.tabText,
|
|
134
134
|
{ color: isActive ? "#fff" : text },
|
|
135
|
-
|
|
135
|
+
styles2?.tabText
|
|
136
136
|
],
|
|
137
137
|
children: tab.label
|
|
138
138
|
}
|
|
@@ -163,14 +163,14 @@ function PickerModal({
|
|
|
163
163
|
}
|
|
164
164
|
);
|
|
165
165
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
166
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, { style:
|
|
167
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.label,
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, { style: styles2?.inputContainer, children: [
|
|
167
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.label, styles2?.label, labelStyle], children: label }),
|
|
168
168
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
169
169
|
import_react_native.TouchableOpacity,
|
|
170
170
|
{
|
|
171
171
|
style: [
|
|
172
172
|
defaultStyles.selectBox,
|
|
173
|
-
|
|
173
|
+
styles2?.selectBox,
|
|
174
174
|
selectBoxStyle,
|
|
175
175
|
error && { borderColor: "red" }
|
|
176
176
|
],
|
|
@@ -181,7 +181,7 @@ function PickerModal({
|
|
|
181
181
|
{
|
|
182
182
|
style: [
|
|
183
183
|
defaultStyles.selectText,
|
|
184
|
-
|
|
184
|
+
styles2?.selectText,
|
|
185
185
|
selectTextStyle
|
|
186
186
|
],
|
|
187
187
|
children: getLabel() || placeholder
|
|
@@ -195,7 +195,7 @@ function PickerModal({
|
|
|
195
195
|
]
|
|
196
196
|
}
|
|
197
197
|
),
|
|
198
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.error,
|
|
198
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: [defaultStyles.error, styles2?.error, errorStyle], children: error })
|
|
199
199
|
] }),
|
|
200
200
|
/* @__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 }) })
|
|
201
201
|
] });
|
|
@@ -353,7 +353,7 @@ function MultiPickerItem({
|
|
|
353
353
|
label,
|
|
354
354
|
selected,
|
|
355
355
|
onPress,
|
|
356
|
-
|
|
356
|
+
renderItemIcon,
|
|
357
357
|
styles: customStyles
|
|
358
358
|
}) {
|
|
359
359
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -372,7 +372,7 @@ function MultiPickerItem({
|
|
|
372
372
|
customStyles?.circle,
|
|
373
373
|
selected && [defaultStyles2.active, customStyles?.activeCircle]
|
|
374
374
|
],
|
|
375
|
-
children: selected && (
|
|
375
|
+
children: selected && (renderItemIcon ? renderItemIcon({
|
|
376
376
|
name: "check",
|
|
377
377
|
size: 14,
|
|
378
378
|
color: "#fff"
|
|
@@ -428,7 +428,8 @@ function MultiPickerModal({
|
|
|
428
428
|
error,
|
|
429
429
|
renderInputIcon,
|
|
430
430
|
renderGroupIcon,
|
|
431
|
-
|
|
431
|
+
renderItemIcon,
|
|
432
|
+
styles: styles2
|
|
432
433
|
}) {
|
|
433
434
|
const [internalVisible, setInternalVisible] = (0, import_react3.useState)(false);
|
|
434
435
|
const isControlled = visible !== void 0 && setVisible !== void 0;
|
|
@@ -446,7 +447,7 @@ function MultiPickerModal({
|
|
|
446
447
|
onChange(updated);
|
|
447
448
|
};
|
|
448
449
|
const getLabel = () => {
|
|
449
|
-
if (selectedValues
|
|
450
|
+
if (!selectedValues?.length) return placeholder;
|
|
450
451
|
const all = groups.length ? groups.flatMap((g) => g.data) : options;
|
|
451
452
|
return all.filter((o) => selectedValues.includes(o.value)).map((o) => o.label).join(", ");
|
|
452
453
|
};
|
|
@@ -462,7 +463,9 @@ function MultiPickerModal({
|
|
|
462
463
|
{
|
|
463
464
|
label: item.label,
|
|
464
465
|
selected: selectedValues.includes(item.value),
|
|
465
|
-
onPress: () => handleSelect(item.value)
|
|
466
|
+
onPress: () => handleSelect(item.value),
|
|
467
|
+
renderItemIcon,
|
|
468
|
+
styles: styles2?.item
|
|
466
469
|
},
|
|
467
470
|
item.value
|
|
468
471
|
))
|
|
@@ -475,29 +478,45 @@ function MultiPickerModal({
|
|
|
475
478
|
{
|
|
476
479
|
label: item.label,
|
|
477
480
|
selected: selectedValues.includes(item.value),
|
|
478
|
-
onPress: () => handleSelect(item.value)
|
|
481
|
+
onPress: () => handleSelect(item.value),
|
|
482
|
+
renderItemIcon,
|
|
483
|
+
styles: styles2?.item
|
|
479
484
|
},
|
|
480
485
|
item.value
|
|
481
486
|
));
|
|
482
487
|
};
|
|
483
488
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
484
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style:
|
|
485
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
489
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
491
|
+
import_react_native4.TouchableOpacity,
|
|
492
|
+
{
|
|
493
|
+
style: [defaultStyles3.box, styles2?.selectBox],
|
|
494
|
+
onPress: open,
|
|
495
|
+
children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.text, styles2?.selectText], children: getLabel() }),
|
|
497
|
+
renderInputIcon?.({
|
|
498
|
+
name: "chevron-down",
|
|
499
|
+
size: 18,
|
|
500
|
+
color: "#6B7280"
|
|
501
|
+
})
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
),
|
|
505
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Modal, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: [defaultStyles3.overlay, styles2?.overlay], children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.View, { style: [defaultStyles3.container, styles2?.container], children: [
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
508
|
+
import_react_native4.TouchableOpacity,
|
|
509
|
+
{
|
|
510
|
+
onPress: close,
|
|
511
|
+
style: [defaultStyles3.done, styles2?.doneBtn],
|
|
512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.doneText, styles2?.doneText], children: "Done" })
|
|
513
|
+
}
|
|
514
|
+
),
|
|
496
515
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.ScrollView, { children: renderList() })
|
|
497
516
|
] }) }) })
|
|
498
517
|
] });
|
|
499
518
|
}
|
|
500
|
-
var
|
|
519
|
+
var defaultStyles3 = import_react_native4.StyleSheet.create({
|
|
501
520
|
label: {
|
|
502
521
|
marginBottom: 6,
|
|
503
522
|
fontSize: 14
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ function PickerModal({
|
|
|
15
15
|
selectedValue,
|
|
16
16
|
options,
|
|
17
17
|
groups = [],
|
|
18
|
-
styles:
|
|
18
|
+
styles: styles2,
|
|
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
|
+
styles2?.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
|
+
styles2?.doneBtn
|
|
86
86
|
],
|
|
87
87
|
onPress: handleClose,
|
|
88
|
-
children: /* @__PURE__ */ jsx(Text, { style: [defaultStyles.doneText,
|
|
88
|
+
children: /* @__PURE__ */ jsx(Text, { style: [defaultStyles.doneText, styles2?.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
|
+
styles2?.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
|
+
styles2?.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: styles2?.inputContainer, children: [
|
|
143
|
+
label && /* @__PURE__ */ jsx(Text, { style: [defaultStyles.label, styles2?.label, labelStyle], children: label }),
|
|
144
144
|
/* @__PURE__ */ jsxs(
|
|
145
145
|
TouchableOpacity,
|
|
146
146
|
{
|
|
147
147
|
style: [
|
|
148
148
|
defaultStyles.selectBox,
|
|
149
|
-
|
|
149
|
+
styles2?.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
|
+
styles2?.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, styles2?.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
|
] });
|
|
@@ -342,7 +342,7 @@ function MultiPickerItem({
|
|
|
342
342
|
label,
|
|
343
343
|
selected,
|
|
344
344
|
onPress,
|
|
345
|
-
|
|
345
|
+
renderItemIcon,
|
|
346
346
|
styles: customStyles
|
|
347
347
|
}) {
|
|
348
348
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -361,7 +361,7 @@ function MultiPickerItem({
|
|
|
361
361
|
customStyles?.circle,
|
|
362
362
|
selected && [defaultStyles2.active, customStyles?.activeCircle]
|
|
363
363
|
],
|
|
364
|
-
children: selected && (
|
|
364
|
+
children: selected && (renderItemIcon ? renderItemIcon({
|
|
365
365
|
name: "check",
|
|
366
366
|
size: 14,
|
|
367
367
|
color: "#fff"
|
|
@@ -417,7 +417,8 @@ function MultiPickerModal({
|
|
|
417
417
|
error,
|
|
418
418
|
renderInputIcon,
|
|
419
419
|
renderGroupIcon,
|
|
420
|
-
|
|
420
|
+
renderItemIcon,
|
|
421
|
+
styles: styles2
|
|
421
422
|
}) {
|
|
422
423
|
const [internalVisible, setInternalVisible] = useState3(false);
|
|
423
424
|
const isControlled = visible !== void 0 && setVisible !== void 0;
|
|
@@ -435,7 +436,7 @@ function MultiPickerModal({
|
|
|
435
436
|
onChange(updated);
|
|
436
437
|
};
|
|
437
438
|
const getLabel = () => {
|
|
438
|
-
if (selectedValues
|
|
439
|
+
if (!selectedValues?.length) return placeholder;
|
|
439
440
|
const all = groups.length ? groups.flatMap((g) => g.data) : options;
|
|
440
441
|
return all.filter((o) => selectedValues.includes(o.value)).map((o) => o.label).join(", ");
|
|
441
442
|
};
|
|
@@ -451,7 +452,9 @@ function MultiPickerModal({
|
|
|
451
452
|
{
|
|
452
453
|
label: item.label,
|
|
453
454
|
selected: selectedValues.includes(item.value),
|
|
454
|
-
onPress: () => handleSelect(item.value)
|
|
455
|
+
onPress: () => handleSelect(item.value),
|
|
456
|
+
renderItemIcon,
|
|
457
|
+
styles: styles2?.item
|
|
455
458
|
},
|
|
456
459
|
item.value
|
|
457
460
|
))
|
|
@@ -464,29 +467,45 @@ function MultiPickerModal({
|
|
|
464
467
|
{
|
|
465
468
|
label: item.label,
|
|
466
469
|
selected: selectedValues.includes(item.value),
|
|
467
|
-
onPress: () => handleSelect(item.value)
|
|
470
|
+
onPress: () => handleSelect(item.value),
|
|
471
|
+
renderItemIcon,
|
|
472
|
+
styles: styles2?.item
|
|
468
473
|
},
|
|
469
474
|
item.value
|
|
470
475
|
));
|
|
471
476
|
};
|
|
472
477
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
473
|
-
label && /* @__PURE__ */ jsx4(Text4, { style:
|
|
474
|
-
/* @__PURE__ */ jsxs4(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
478
|
+
label && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
479
|
+
/* @__PURE__ */ jsxs4(
|
|
480
|
+
TouchableOpacity4,
|
|
481
|
+
{
|
|
482
|
+
style: [defaultStyles3.box, styles2?.selectBox],
|
|
483
|
+
onPress: open,
|
|
484
|
+
children: [
|
|
485
|
+
/* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.text, styles2?.selectText], children: getLabel() }),
|
|
486
|
+
renderInputIcon?.({
|
|
487
|
+
name: "chevron-down",
|
|
488
|
+
size: 18,
|
|
489
|
+
color: "#6B7280"
|
|
490
|
+
})
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
error && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
495
|
+
/* @__PURE__ */ jsx4(Modal2, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ jsx4(View4, { style: [defaultStyles3.overlay, styles2?.overlay], children: /* @__PURE__ */ jsxs4(View4, { style: [defaultStyles3.container, styles2?.container], children: [
|
|
496
|
+
/* @__PURE__ */ jsx4(
|
|
497
|
+
TouchableOpacity4,
|
|
498
|
+
{
|
|
499
|
+
onPress: close,
|
|
500
|
+
style: [defaultStyles3.done, styles2?.doneBtn],
|
|
501
|
+
children: /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.doneText, styles2?.doneText], children: "Done" })
|
|
502
|
+
}
|
|
503
|
+
),
|
|
485
504
|
/* @__PURE__ */ jsx4(ScrollView2, { children: renderList() })
|
|
486
505
|
] }) }) })
|
|
487
506
|
] });
|
|
488
507
|
}
|
|
489
|
-
var
|
|
508
|
+
var defaultStyles3 = StyleSheet4.create({
|
|
490
509
|
label: {
|
|
491
510
|
marginBottom: 6,
|
|
492
511
|
fontSize: 14
|
package/package.json
CHANGED