@kaushverse/pickify 1.1.0 → 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 +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +20 -8
- package/dist/index.mjs +20 -8
- 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 = {
|
|
@@ -122,12 +122,13 @@ type MultiPickerProps = {
|
|
|
122
122
|
error?: string;
|
|
123
123
|
renderInputIcon?: IconRenderer;
|
|
124
124
|
renderGroupIcon?: IconRenderer;
|
|
125
|
+
renderItemIcon?: IconRenderer;
|
|
125
126
|
styles?: MultiPickerStyles;
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
129
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, renderItemIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
129
130
|
|
|
130
|
-
declare function MultiPickerItem({ label, selected, onPress,
|
|
131
|
+
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
131
132
|
|
|
132
133
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
133
134
|
|
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 = {
|
|
@@ -122,12 +122,13 @@ type MultiPickerProps = {
|
|
|
122
122
|
error?: string;
|
|
123
123
|
renderInputIcon?: IconRenderer;
|
|
124
124
|
renderGroupIcon?: IconRenderer;
|
|
125
|
+
renderItemIcon?: IconRenderer;
|
|
125
126
|
styles?: MultiPickerStyles;
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
129
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, renderItemIcon, styles, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
129
130
|
|
|
130
|
-
declare function MultiPickerItem({ label, selected, onPress,
|
|
131
|
+
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
131
132
|
|
|
132
133
|
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
133
134
|
|
package/dist/index.js
CHANGED
|
@@ -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,6 +428,7 @@ function MultiPickerModal({
|
|
|
428
428
|
error,
|
|
429
429
|
renderInputIcon,
|
|
430
430
|
renderGroupIcon,
|
|
431
|
+
renderItemIcon,
|
|
431
432
|
styles: styles2
|
|
432
433
|
}) {
|
|
433
434
|
const [internalVisible, setInternalVisible] = (0, import_react3.useState)(false);
|
|
@@ -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,13 +478,15 @@ 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
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
489
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
485
490
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
486
491
|
import_react_native4.TouchableOpacity,
|
|
487
492
|
{
|
|
@@ -497,9 +502,16 @@ function MultiPickerModal({
|
|
|
497
502
|
]
|
|
498
503
|
}
|
|
499
504
|
),
|
|
500
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
505
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
501
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: [
|
|
502
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
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
|
+
),
|
|
503
515
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.ScrollView, { children: renderList() })
|
|
504
516
|
] }) }) })
|
|
505
517
|
] });
|
package/dist/index.mjs
CHANGED
|
@@ -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,6 +417,7 @@ function MultiPickerModal({
|
|
|
417
417
|
error,
|
|
418
418
|
renderInputIcon,
|
|
419
419
|
renderGroupIcon,
|
|
420
|
+
renderItemIcon,
|
|
420
421
|
styles: styles2
|
|
421
422
|
}) {
|
|
422
423
|
const [internalVisible, setInternalVisible] = useState3(false);
|
|
@@ -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,13 +467,15 @@ 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
|
-
/* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
478
|
+
label && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.label, styles2?.label], children: label }),
|
|
474
479
|
/* @__PURE__ */ jsxs4(
|
|
475
480
|
TouchableOpacity4,
|
|
476
481
|
{
|
|
@@ -486,9 +491,16 @@ function MultiPickerModal({
|
|
|
486
491
|
]
|
|
487
492
|
}
|
|
488
493
|
),
|
|
489
|
-
/* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
494
|
+
error && /* @__PURE__ */ jsx4(Text4, { style: [defaultStyles3.error, styles2?.error], children: error }),
|
|
490
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: [
|
|
491
|
-
/* @__PURE__ */ jsx4(
|
|
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
|
+
),
|
|
492
504
|
/* @__PURE__ */ jsx4(ScrollView2, { children: renderList() })
|
|
493
505
|
] }) }) })
|
|
494
506
|
] });
|
package/package.json
CHANGED