@kaushverse/pickify 1.0.8 → 1.0.10
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 +6 -12
- package/dist/index.d.ts +6 -12
- package/dist/index.js +34 -17
- package/dist/index.mjs +34 -17
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -95,7 +95,7 @@ type MultiPickerGroupStyles = {
|
|
|
95
95
|
type MultiPickerGroupProps = {
|
|
96
96
|
label: string;
|
|
97
97
|
children: React.ReactNode;
|
|
98
|
-
|
|
98
|
+
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
100
|
};
|
|
101
101
|
type MultiPickerProps = {
|
|
@@ -108,27 +108,21 @@ type MultiPickerProps = {
|
|
|
108
108
|
label?: string;
|
|
109
109
|
placeholder?: string;
|
|
110
110
|
error?: string;
|
|
111
|
-
|
|
111
|
+
renderInputIcon?: IconRenderer;
|
|
112
|
+
renderGroupIcon?: IconRenderer;
|
|
112
113
|
styles?: {
|
|
113
114
|
container?: ViewStyle;
|
|
114
115
|
selectBox?: ViewStyle;
|
|
115
116
|
selectText?: TextStyle;
|
|
116
117
|
};
|
|
118
|
+
errorStyle?: TextStyle;
|
|
117
119
|
};
|
|
118
120
|
|
|
119
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error,
|
|
121
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, errorStyle, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
120
122
|
|
|
121
123
|
declare function MultiPickerItem({ label, selected, onPress, renderIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
122
124
|
|
|
123
|
-
declare function MultiPickerGroup({ label, children,
|
|
124
|
-
label: string;
|
|
125
|
-
children: React$1.ReactNode;
|
|
126
|
-
renderIcon?: (props: {
|
|
127
|
-
name: string;
|
|
128
|
-
size: number;
|
|
129
|
-
color: string;
|
|
130
|
-
}) => React$1.ReactNode;
|
|
131
|
-
}): react_jsx_runtime.JSX.Element;
|
|
125
|
+
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
132
126
|
|
|
133
127
|
declare const toggleValue: (arr: string[], value: string) => string[];
|
|
134
128
|
|
package/dist/index.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ type MultiPickerGroupStyles = {
|
|
|
95
95
|
type MultiPickerGroupProps = {
|
|
96
96
|
label: string;
|
|
97
97
|
children: React.ReactNode;
|
|
98
|
-
|
|
98
|
+
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
100
|
};
|
|
101
101
|
type MultiPickerProps = {
|
|
@@ -108,27 +108,21 @@ type MultiPickerProps = {
|
|
|
108
108
|
label?: string;
|
|
109
109
|
placeholder?: string;
|
|
110
110
|
error?: string;
|
|
111
|
-
|
|
111
|
+
renderInputIcon?: IconRenderer;
|
|
112
|
+
renderGroupIcon?: IconRenderer;
|
|
112
113
|
styles?: {
|
|
113
114
|
container?: ViewStyle;
|
|
114
115
|
selectBox?: ViewStyle;
|
|
115
116
|
selectText?: TextStyle;
|
|
116
117
|
};
|
|
118
|
+
errorStyle?: TextStyle;
|
|
117
119
|
};
|
|
118
120
|
|
|
119
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error,
|
|
121
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, errorStyle, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
120
122
|
|
|
121
123
|
declare function MultiPickerItem({ label, selected, onPress, renderIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
122
124
|
|
|
123
|
-
declare function MultiPickerGroup({ label, children,
|
|
124
|
-
label: string;
|
|
125
|
-
children: React$1.ReactNode;
|
|
126
|
-
renderIcon?: (props: {
|
|
127
|
-
name: string;
|
|
128
|
-
size: number;
|
|
129
|
-
color: string;
|
|
130
|
-
}) => React$1.ReactNode;
|
|
131
|
-
}): react_jsx_runtime.JSX.Element;
|
|
125
|
+
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
132
126
|
|
|
133
127
|
declare const toggleValue: (arr: string[], value: string) => string[];
|
|
134
128
|
|
package/dist/index.js
CHANGED
|
@@ -277,17 +277,17 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
277
277
|
function MultiPickerGroup({
|
|
278
278
|
label,
|
|
279
279
|
children,
|
|
280
|
-
|
|
280
|
+
renderGroupIcon
|
|
281
281
|
}) {
|
|
282
282
|
const [open, setOpen] = (0, import_react2.useState)(true);
|
|
283
283
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.View, { style: styles.group, children: [
|
|
284
284
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.TouchableOpacity, { style: styles.header, onPress: () => setOpen(!open), children: [
|
|
285
285
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style: styles.title, children: label }),
|
|
286
|
-
|
|
286
|
+
renderGroupIcon?.({
|
|
287
287
|
name: open ? "chevron-up" : "chevron-down",
|
|
288
288
|
size: 18,
|
|
289
289
|
color: "#6B7280"
|
|
290
|
-
})
|
|
290
|
+
})
|
|
291
291
|
] }),
|
|
292
292
|
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: { marginTop: 6 }, children })
|
|
293
293
|
] });
|
|
@@ -391,7 +391,9 @@ function MultiPickerModal({
|
|
|
391
391
|
label,
|
|
392
392
|
placeholder = "Select",
|
|
393
393
|
error,
|
|
394
|
-
|
|
394
|
+
renderInputIcon,
|
|
395
|
+
renderGroupIcon,
|
|
396
|
+
errorStyle
|
|
395
397
|
}) {
|
|
396
398
|
const [internalVisible, setInternalVisible] = (0, import_react3.useState)(false);
|
|
397
399
|
const isControlled = visible !== void 0 && setVisible !== void 0;
|
|
@@ -415,15 +417,23 @@ function MultiPickerModal({
|
|
|
415
417
|
};
|
|
416
418
|
const renderList = () => {
|
|
417
419
|
if (groups.length > 0) {
|
|
418
|
-
return groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
419
|
-
|
|
420
|
+
return groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
421
|
+
MultiPickerGroup,
|
|
420
422
|
{
|
|
421
|
-
label:
|
|
422
|
-
|
|
423
|
-
|
|
423
|
+
label: group.label,
|
|
424
|
+
renderGroupIcon,
|
|
425
|
+
children: group.data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
426
|
+
MultiPickerItem,
|
|
427
|
+
{
|
|
428
|
+
label: item.label,
|
|
429
|
+
selected: selectedValues.includes(item.value),
|
|
430
|
+
onPress: () => handleSelect(item.value)
|
|
431
|
+
},
|
|
432
|
+
item.value
|
|
433
|
+
))
|
|
424
434
|
},
|
|
425
|
-
|
|
426
|
-
))
|
|
435
|
+
group.label
|
|
436
|
+
));
|
|
427
437
|
}
|
|
428
438
|
return options.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
429
439
|
MultiPickerItem,
|
|
@@ -439,15 +449,15 @@ function MultiPickerModal({
|
|
|
439
449
|
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.label, children: label }),
|
|
440
450
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.TouchableOpacity, { style: styles2.box, onPress: open, children: [
|
|
441
451
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.text, children: getLabel() }),
|
|
442
|
-
|
|
452
|
+
renderInputIcon?.({
|
|
443
453
|
name: "chevron-down",
|
|
444
454
|
size: 18,
|
|
445
455
|
color: "#6B7280"
|
|
446
|
-
})
|
|
456
|
+
})
|
|
447
457
|
] }),
|
|
448
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.error, children: error }),
|
|
458
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [styles2.error, errorStyle], children: error }),
|
|
449
459
|
/* @__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: styles2.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.View, { style: styles2.container, children: [
|
|
450
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.TouchableOpacity, { onPress: close, style: styles2.done, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style:
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.TouchableOpacity, { onPress: close, style: styles2.done, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.doneText, children: "Done" }) }),
|
|
451
461
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.ScrollView, { children: renderList() })
|
|
452
462
|
] }) }) })
|
|
453
463
|
] });
|
|
@@ -463,13 +473,15 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
463
473
|
borderRadius: 12,
|
|
464
474
|
padding: 12,
|
|
465
475
|
flexDirection: "row",
|
|
466
|
-
justifyContent: "space-between"
|
|
476
|
+
justifyContent: "space-between",
|
|
477
|
+
alignItems: "center"
|
|
467
478
|
},
|
|
468
479
|
text: {
|
|
469
480
|
fontSize: 15
|
|
470
481
|
},
|
|
471
482
|
error: {
|
|
472
483
|
color: "red",
|
|
484
|
+
fontSize: 12,
|
|
473
485
|
marginTop: 4
|
|
474
486
|
},
|
|
475
487
|
overlay: {
|
|
@@ -486,10 +498,15 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
486
498
|
},
|
|
487
499
|
done: {
|
|
488
500
|
backgroundColor: "#6366f1",
|
|
489
|
-
|
|
501
|
+
paddingVertical: 10,
|
|
502
|
+
paddingHorizontal: 14,
|
|
490
503
|
borderRadius: 10,
|
|
491
504
|
alignSelf: "flex-end",
|
|
492
505
|
marginBottom: 10
|
|
506
|
+
},
|
|
507
|
+
doneText: {
|
|
508
|
+
color: "#fff",
|
|
509
|
+
fontWeight: "600"
|
|
493
510
|
}
|
|
494
511
|
});
|
|
495
512
|
|
package/dist/index.mjs
CHANGED
|
@@ -260,17 +260,17 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
260
260
|
function MultiPickerGroup({
|
|
261
261
|
label,
|
|
262
262
|
children,
|
|
263
|
-
|
|
263
|
+
renderGroupIcon
|
|
264
264
|
}) {
|
|
265
265
|
const [open, setOpen] = useState2(true);
|
|
266
266
|
return /* @__PURE__ */ jsxs2(View2, { style: styles.group, children: [
|
|
267
267
|
/* @__PURE__ */ jsxs2(TouchableOpacity2, { style: styles.header, onPress: () => setOpen(!open), children: [
|
|
268
268
|
/* @__PURE__ */ jsx2(Text2, { style: styles.title, children: label }),
|
|
269
|
-
|
|
269
|
+
renderGroupIcon?.({
|
|
270
270
|
name: open ? "chevron-up" : "chevron-down",
|
|
271
271
|
size: 18,
|
|
272
272
|
color: "#6B7280"
|
|
273
|
-
})
|
|
273
|
+
})
|
|
274
274
|
] }),
|
|
275
275
|
open && /* @__PURE__ */ jsx2(View2, { style: { marginTop: 6 }, children })
|
|
276
276
|
] });
|
|
@@ -374,7 +374,9 @@ function MultiPickerModal({
|
|
|
374
374
|
label,
|
|
375
375
|
placeholder = "Select",
|
|
376
376
|
error,
|
|
377
|
-
|
|
377
|
+
renderInputIcon,
|
|
378
|
+
renderGroupIcon,
|
|
379
|
+
errorStyle
|
|
378
380
|
}) {
|
|
379
381
|
const [internalVisible, setInternalVisible] = useState3(false);
|
|
380
382
|
const isControlled = visible !== void 0 && setVisible !== void 0;
|
|
@@ -398,15 +400,23 @@ function MultiPickerModal({
|
|
|
398
400
|
};
|
|
399
401
|
const renderList = () => {
|
|
400
402
|
if (groups.length > 0) {
|
|
401
|
-
return groups.map((group) => /* @__PURE__ */ jsx4(
|
|
402
|
-
|
|
403
|
+
return groups.map((group) => /* @__PURE__ */ jsx4(
|
|
404
|
+
MultiPickerGroup,
|
|
403
405
|
{
|
|
404
|
-
label:
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
label: group.label,
|
|
407
|
+
renderGroupIcon,
|
|
408
|
+
children: group.data.map((item) => /* @__PURE__ */ jsx4(
|
|
409
|
+
MultiPickerItem,
|
|
410
|
+
{
|
|
411
|
+
label: item.label,
|
|
412
|
+
selected: selectedValues.includes(item.value),
|
|
413
|
+
onPress: () => handleSelect(item.value)
|
|
414
|
+
},
|
|
415
|
+
item.value
|
|
416
|
+
))
|
|
407
417
|
},
|
|
408
|
-
|
|
409
|
-
))
|
|
418
|
+
group.label
|
|
419
|
+
));
|
|
410
420
|
}
|
|
411
421
|
return options.map((item) => /* @__PURE__ */ jsx4(
|
|
412
422
|
MultiPickerItem,
|
|
@@ -422,15 +432,15 @@ function MultiPickerModal({
|
|
|
422
432
|
label && /* @__PURE__ */ jsx4(Text4, { style: styles2.label, children: label }),
|
|
423
433
|
/* @__PURE__ */ jsxs4(TouchableOpacity4, { style: styles2.box, onPress: open, children: [
|
|
424
434
|
/* @__PURE__ */ jsx4(Text4, { style: styles2.text, children: getLabel() }),
|
|
425
|
-
|
|
435
|
+
renderInputIcon?.({
|
|
426
436
|
name: "chevron-down",
|
|
427
437
|
size: 18,
|
|
428
438
|
color: "#6B7280"
|
|
429
|
-
})
|
|
439
|
+
})
|
|
430
440
|
] }),
|
|
431
|
-
error && /* @__PURE__ */ jsx4(Text4, { style: styles2.error, children: error }),
|
|
441
|
+
error && /* @__PURE__ */ jsx4(Text4, { style: [styles2.error, errorStyle], children: error }),
|
|
432
442
|
/* @__PURE__ */ jsx4(Modal2, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ jsx4(View4, { style: styles2.overlay, children: /* @__PURE__ */ jsxs4(View4, { style: styles2.container, children: [
|
|
433
|
-
/* @__PURE__ */ jsx4(TouchableOpacity4, { onPress: close, style: styles2.done, children: /* @__PURE__ */ jsx4(Text4, { style:
|
|
443
|
+
/* @__PURE__ */ jsx4(TouchableOpacity4, { onPress: close, style: styles2.done, children: /* @__PURE__ */ jsx4(Text4, { style: styles2.doneText, children: "Done" }) }),
|
|
434
444
|
/* @__PURE__ */ jsx4(ScrollView2, { children: renderList() })
|
|
435
445
|
] }) }) })
|
|
436
446
|
] });
|
|
@@ -446,13 +456,15 @@ var styles2 = StyleSheet4.create({
|
|
|
446
456
|
borderRadius: 12,
|
|
447
457
|
padding: 12,
|
|
448
458
|
flexDirection: "row",
|
|
449
|
-
justifyContent: "space-between"
|
|
459
|
+
justifyContent: "space-between",
|
|
460
|
+
alignItems: "center"
|
|
450
461
|
},
|
|
451
462
|
text: {
|
|
452
463
|
fontSize: 15
|
|
453
464
|
},
|
|
454
465
|
error: {
|
|
455
466
|
color: "red",
|
|
467
|
+
fontSize: 12,
|
|
456
468
|
marginTop: 4
|
|
457
469
|
},
|
|
458
470
|
overlay: {
|
|
@@ -469,10 +481,15 @@ var styles2 = StyleSheet4.create({
|
|
|
469
481
|
},
|
|
470
482
|
done: {
|
|
471
483
|
backgroundColor: "#6366f1",
|
|
472
|
-
|
|
484
|
+
paddingVertical: 10,
|
|
485
|
+
paddingHorizontal: 14,
|
|
473
486
|
borderRadius: 10,
|
|
474
487
|
alignSelf: "flex-end",
|
|
475
488
|
marginBottom: 10
|
|
489
|
+
},
|
|
490
|
+
doneText: {
|
|
491
|
+
color: "#fff",
|
|
492
|
+
fontWeight: "600"
|
|
476
493
|
}
|
|
477
494
|
});
|
|
478
495
|
|
package/package.json
CHANGED