@kaushverse/pickify 1.0.9 → 1.0.11
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 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +47 -20
- package/dist/index.mjs +56 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,9 +3,9 @@ import React$1 from 'react';
|
|
|
3
3
|
import { TextStyle, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
5
|
type IconRenderer = (props: {
|
|
6
|
-
name
|
|
7
|
-
size
|
|
8
|
-
color
|
|
6
|
+
name?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
9
|
}) => React.ReactNode;
|
|
10
10
|
|
|
11
11
|
type Option = {
|
|
@@ -107,8 +107,9 @@ type MultiPickerProps = {
|
|
|
107
107
|
onChange: (val: string[]) => void;
|
|
108
108
|
label?: string;
|
|
109
109
|
placeholder?: string;
|
|
110
|
-
error?:
|
|
110
|
+
error?: string;
|
|
111
111
|
renderInputIcon?: IconRenderer;
|
|
112
|
+
renderGroupIcon?: IconRenderer;
|
|
112
113
|
styles?: {
|
|
113
114
|
container?: ViewStyle;
|
|
114
115
|
selectBox?: ViewStyle;
|
|
@@ -117,9 +118,7 @@ type MultiPickerProps = {
|
|
|
117
118
|
errorStyle?: TextStyle;
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, errorStyle, }: MultiPickerProps
|
|
121
|
-
error: string;
|
|
122
|
-
}): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, errorStyle, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
123
122
|
|
|
124
123
|
declare function MultiPickerItem({ label, selected, onPress, renderIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
125
124
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import React$1 from 'react';
|
|
|
3
3
|
import { TextStyle, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
5
|
type IconRenderer = (props: {
|
|
6
|
-
name
|
|
7
|
-
size
|
|
8
|
-
color
|
|
6
|
+
name?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
9
|
}) => React.ReactNode;
|
|
10
10
|
|
|
11
11
|
type Option = {
|
|
@@ -107,8 +107,9 @@ type MultiPickerProps = {
|
|
|
107
107
|
onChange: (val: string[]) => void;
|
|
108
108
|
label?: string;
|
|
109
109
|
placeholder?: string;
|
|
110
|
-
error?:
|
|
110
|
+
error?: string;
|
|
111
111
|
renderInputIcon?: IconRenderer;
|
|
112
|
+
renderGroupIcon?: IconRenderer;
|
|
112
113
|
styles?: {
|
|
113
114
|
container?: ViewStyle;
|
|
114
115
|
selectBox?: ViewStyle;
|
|
@@ -117,9 +118,7 @@ type MultiPickerProps = {
|
|
|
117
118
|
errorStyle?: TextStyle;
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, errorStyle, }: MultiPickerProps
|
|
121
|
-
error: string;
|
|
122
|
-
}): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function MultiPickerModal({ visible, setVisible, selectedValues, options, groups, onChange, label, placeholder, error, renderInputIcon, renderGroupIcon, errorStyle, }: MultiPickerProps): react_jsx_runtime.JSX.Element;
|
|
123
122
|
|
|
124
123
|
declare function MultiPickerItem({ label, selected, onPress, renderIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
125
124
|
|
package/dist/index.js
CHANGED
|
@@ -274,22 +274,35 @@ var toggleValue = (arr, value) => {
|
|
|
274
274
|
var import_react2 = require("react");
|
|
275
275
|
var import_react_native2 = require("react-native");
|
|
276
276
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
277
|
+
if (import_react_native2.Platform.OS === "android") {
|
|
278
|
+
import_react_native2.UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
279
|
+
}
|
|
277
280
|
function MultiPickerGroup({
|
|
278
281
|
label,
|
|
279
282
|
children,
|
|
280
283
|
renderGroupIcon
|
|
281
284
|
}) {
|
|
282
285
|
const [open, setOpen] = (0, import_react2.useState)(true);
|
|
286
|
+
const toggle = () => {
|
|
287
|
+
import_react_native2.LayoutAnimation.configureNext(
|
|
288
|
+
import_react_native2.LayoutAnimation.create(
|
|
289
|
+
250,
|
|
290
|
+
import_react_native2.LayoutAnimation.Types.easeInEaseOut,
|
|
291
|
+
import_react_native2.LayoutAnimation.Properties.opacity
|
|
292
|
+
)
|
|
293
|
+
);
|
|
294
|
+
setOpen((prev) => !prev);
|
|
295
|
+
};
|
|
283
296
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.View, { style: styles.group, children: [
|
|
284
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.TouchableOpacity, { style: styles.header, onPress:
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.TouchableOpacity, { style: styles.header, onPress: toggle, children: [
|
|
285
298
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style: styles.title, children: label }),
|
|
286
|
-
renderGroupIcon
|
|
299
|
+
renderGroupIcon?.({
|
|
287
300
|
name: open ? "chevron-up" : "chevron-down",
|
|
288
301
|
size: 18,
|
|
289
302
|
color: "#6B7280"
|
|
290
|
-
})
|
|
303
|
+
})
|
|
291
304
|
] }),
|
|
292
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style:
|
|
305
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: styles.content, children })
|
|
293
306
|
] });
|
|
294
307
|
}
|
|
295
308
|
var styles = import_react_native2.StyleSheet.create({
|
|
@@ -305,9 +318,8 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
305
318
|
fontWeight: "600",
|
|
306
319
|
fontSize: 14
|
|
307
320
|
},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
color: "#6B7280"
|
|
321
|
+
content: {
|
|
322
|
+
marginTop: 6
|
|
311
323
|
}
|
|
312
324
|
});
|
|
313
325
|
|
|
@@ -392,6 +404,7 @@ function MultiPickerModal({
|
|
|
392
404
|
placeholder = "Select",
|
|
393
405
|
error,
|
|
394
406
|
renderInputIcon,
|
|
407
|
+
renderGroupIcon,
|
|
395
408
|
errorStyle
|
|
396
409
|
}) {
|
|
397
410
|
const [internalVisible, setInternalVisible] = (0, import_react3.useState)(false);
|
|
@@ -416,15 +429,23 @@ function MultiPickerModal({
|
|
|
416
429
|
};
|
|
417
430
|
const renderList = () => {
|
|
418
431
|
if (groups.length > 0) {
|
|
419
|
-
return groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
420
|
-
|
|
432
|
+
return groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
433
|
+
MultiPickerGroup,
|
|
421
434
|
{
|
|
422
|
-
label:
|
|
423
|
-
|
|
424
|
-
|
|
435
|
+
label: group.label,
|
|
436
|
+
renderGroupIcon,
|
|
437
|
+
children: group.data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
438
|
+
MultiPickerItem,
|
|
439
|
+
{
|
|
440
|
+
label: item.label,
|
|
441
|
+
selected: selectedValues.includes(item.value),
|
|
442
|
+
onPress: () => handleSelect(item.value)
|
|
443
|
+
},
|
|
444
|
+
item.value
|
|
445
|
+
))
|
|
425
446
|
},
|
|
426
|
-
|
|
427
|
-
))
|
|
447
|
+
group.label
|
|
448
|
+
));
|
|
428
449
|
}
|
|
429
450
|
return options.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
430
451
|
MultiPickerItem,
|
|
@@ -440,15 +461,15 @@ function MultiPickerModal({
|
|
|
440
461
|
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.label, children: label }),
|
|
441
462
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.TouchableOpacity, { style: styles2.box, onPress: open, children: [
|
|
442
463
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: styles2.text, children: getLabel() }),
|
|
443
|
-
renderInputIcon
|
|
464
|
+
renderInputIcon?.({
|
|
444
465
|
name: "chevron-down",
|
|
445
466
|
size: 18,
|
|
446
467
|
color: "#6B7280"
|
|
447
|
-
})
|
|
468
|
+
})
|
|
448
469
|
] }),
|
|
449
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [styles2.error,
|
|
470
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Text, { style: [styles2.error, errorStyle], children: error }),
|
|
450
471
|
/* @__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: [
|
|
451
|
-
/* @__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:
|
|
472
|
+
/* @__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" }) }),
|
|
452
473
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.ScrollView, { children: renderList() })
|
|
453
474
|
] }) }) })
|
|
454
475
|
] });
|
|
@@ -464,7 +485,8 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
464
485
|
borderRadius: 12,
|
|
465
486
|
padding: 12,
|
|
466
487
|
flexDirection: "row",
|
|
467
|
-
justifyContent: "space-between"
|
|
488
|
+
justifyContent: "space-between",
|
|
489
|
+
alignItems: "center"
|
|
468
490
|
},
|
|
469
491
|
text: {
|
|
470
492
|
fontSize: 15
|
|
@@ -488,10 +510,15 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
488
510
|
},
|
|
489
511
|
done: {
|
|
490
512
|
backgroundColor: "#6366f1",
|
|
491
|
-
|
|
513
|
+
paddingVertical: 10,
|
|
514
|
+
paddingHorizontal: 14,
|
|
492
515
|
borderRadius: 10,
|
|
493
516
|
alignSelf: "flex-end",
|
|
494
517
|
marginBottom: 10
|
|
518
|
+
},
|
|
519
|
+
doneText: {
|
|
520
|
+
color: "#fff",
|
|
521
|
+
fontWeight: "600"
|
|
495
522
|
}
|
|
496
523
|
});
|
|
497
524
|
|
package/dist/index.mjs
CHANGED
|
@@ -255,24 +255,45 @@ var toggleValue = (arr, value) => {
|
|
|
255
255
|
|
|
256
256
|
// src/components/MultiPickerGroup.tsx
|
|
257
257
|
import { useState as useState2 } from "react";
|
|
258
|
-
import {
|
|
258
|
+
import {
|
|
259
|
+
View as View2,
|
|
260
|
+
Text as Text2,
|
|
261
|
+
TouchableOpacity as TouchableOpacity2,
|
|
262
|
+
StyleSheet as StyleSheet2,
|
|
263
|
+
LayoutAnimation,
|
|
264
|
+
Platform,
|
|
265
|
+
UIManager
|
|
266
|
+
} from "react-native";
|
|
259
267
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
268
|
+
if (Platform.OS === "android") {
|
|
269
|
+
UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
270
|
+
}
|
|
260
271
|
function MultiPickerGroup({
|
|
261
272
|
label,
|
|
262
273
|
children,
|
|
263
274
|
renderGroupIcon
|
|
264
275
|
}) {
|
|
265
276
|
const [open, setOpen] = useState2(true);
|
|
277
|
+
const toggle = () => {
|
|
278
|
+
LayoutAnimation.configureNext(
|
|
279
|
+
LayoutAnimation.create(
|
|
280
|
+
250,
|
|
281
|
+
LayoutAnimation.Types.easeInEaseOut,
|
|
282
|
+
LayoutAnimation.Properties.opacity
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
setOpen((prev) => !prev);
|
|
286
|
+
};
|
|
266
287
|
return /* @__PURE__ */ jsxs2(View2, { style: styles.group, children: [
|
|
267
|
-
/* @__PURE__ */ jsxs2(TouchableOpacity2, { style: styles.header, onPress:
|
|
288
|
+
/* @__PURE__ */ jsxs2(TouchableOpacity2, { style: styles.header, onPress: toggle, children: [
|
|
268
289
|
/* @__PURE__ */ jsx2(Text2, { style: styles.title, children: label }),
|
|
269
|
-
renderGroupIcon
|
|
290
|
+
renderGroupIcon?.({
|
|
270
291
|
name: open ? "chevron-up" : "chevron-down",
|
|
271
292
|
size: 18,
|
|
272
293
|
color: "#6B7280"
|
|
273
|
-
})
|
|
294
|
+
})
|
|
274
295
|
] }),
|
|
275
|
-
open && /* @__PURE__ */ jsx2(View2, { style:
|
|
296
|
+
open && /* @__PURE__ */ jsx2(View2, { style: styles.content, children })
|
|
276
297
|
] });
|
|
277
298
|
}
|
|
278
299
|
var styles = StyleSheet2.create({
|
|
@@ -288,9 +309,8 @@ var styles = StyleSheet2.create({
|
|
|
288
309
|
fontWeight: "600",
|
|
289
310
|
fontSize: 14
|
|
290
311
|
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
color: "#6B7280"
|
|
312
|
+
content: {
|
|
313
|
+
marginTop: 6
|
|
294
314
|
}
|
|
295
315
|
});
|
|
296
316
|
|
|
@@ -375,6 +395,7 @@ function MultiPickerModal({
|
|
|
375
395
|
placeholder = "Select",
|
|
376
396
|
error,
|
|
377
397
|
renderInputIcon,
|
|
398
|
+
renderGroupIcon,
|
|
378
399
|
errorStyle
|
|
379
400
|
}) {
|
|
380
401
|
const [internalVisible, setInternalVisible] = useState3(false);
|
|
@@ -399,15 +420,23 @@ function MultiPickerModal({
|
|
|
399
420
|
};
|
|
400
421
|
const renderList = () => {
|
|
401
422
|
if (groups.length > 0) {
|
|
402
|
-
return groups.map((group) => /* @__PURE__ */ jsx4(
|
|
403
|
-
|
|
423
|
+
return groups.map((group) => /* @__PURE__ */ jsx4(
|
|
424
|
+
MultiPickerGroup,
|
|
404
425
|
{
|
|
405
|
-
label:
|
|
406
|
-
|
|
407
|
-
|
|
426
|
+
label: group.label,
|
|
427
|
+
renderGroupIcon,
|
|
428
|
+
children: group.data.map((item) => /* @__PURE__ */ jsx4(
|
|
429
|
+
MultiPickerItem,
|
|
430
|
+
{
|
|
431
|
+
label: item.label,
|
|
432
|
+
selected: selectedValues.includes(item.value),
|
|
433
|
+
onPress: () => handleSelect(item.value)
|
|
434
|
+
},
|
|
435
|
+
item.value
|
|
436
|
+
))
|
|
408
437
|
},
|
|
409
|
-
|
|
410
|
-
))
|
|
438
|
+
group.label
|
|
439
|
+
));
|
|
411
440
|
}
|
|
412
441
|
return options.map((item) => /* @__PURE__ */ jsx4(
|
|
413
442
|
MultiPickerItem,
|
|
@@ -423,15 +452,15 @@ function MultiPickerModal({
|
|
|
423
452
|
label && /* @__PURE__ */ jsx4(Text4, { style: styles2.label, children: label }),
|
|
424
453
|
/* @__PURE__ */ jsxs4(TouchableOpacity4, { style: styles2.box, onPress: open, children: [
|
|
425
454
|
/* @__PURE__ */ jsx4(Text4, { style: styles2.text, children: getLabel() }),
|
|
426
|
-
renderInputIcon
|
|
455
|
+
renderInputIcon?.({
|
|
427
456
|
name: "chevron-down",
|
|
428
457
|
size: 18,
|
|
429
458
|
color: "#6B7280"
|
|
430
|
-
})
|
|
459
|
+
})
|
|
431
460
|
] }),
|
|
432
|
-
error && /* @__PURE__ */ jsx4(Text4, { style: [styles2.error,
|
|
461
|
+
error && /* @__PURE__ */ jsx4(Text4, { style: [styles2.error, errorStyle], children: error }),
|
|
433
462
|
/* @__PURE__ */ jsx4(Modal2, { visible: isVisible, transparent: true, animationType: "slide", children: /* @__PURE__ */ jsx4(View4, { style: styles2.overlay, children: /* @__PURE__ */ jsxs4(View4, { style: styles2.container, children: [
|
|
434
|
-
/* @__PURE__ */ jsx4(TouchableOpacity4, { onPress: close, style: styles2.done, children: /* @__PURE__ */ jsx4(Text4, { style:
|
|
463
|
+
/* @__PURE__ */ jsx4(TouchableOpacity4, { onPress: close, style: styles2.done, children: /* @__PURE__ */ jsx4(Text4, { style: styles2.doneText, children: "Done" }) }),
|
|
435
464
|
/* @__PURE__ */ jsx4(ScrollView2, { children: renderList() })
|
|
436
465
|
] }) }) })
|
|
437
466
|
] });
|
|
@@ -447,7 +476,8 @@ var styles2 = StyleSheet4.create({
|
|
|
447
476
|
borderRadius: 12,
|
|
448
477
|
padding: 12,
|
|
449
478
|
flexDirection: "row",
|
|
450
|
-
justifyContent: "space-between"
|
|
479
|
+
justifyContent: "space-between",
|
|
480
|
+
alignItems: "center"
|
|
451
481
|
},
|
|
452
482
|
text: {
|
|
453
483
|
fontSize: 15
|
|
@@ -471,10 +501,15 @@ var styles2 = StyleSheet4.create({
|
|
|
471
501
|
},
|
|
472
502
|
done: {
|
|
473
503
|
backgroundColor: "#6366f1",
|
|
474
|
-
|
|
504
|
+
paddingVertical: 10,
|
|
505
|
+
paddingHorizontal: 14,
|
|
475
506
|
borderRadius: 10,
|
|
476
507
|
alignSelf: "flex-end",
|
|
477
508
|
marginBottom: 10
|
|
509
|
+
},
|
|
510
|
+
doneText: {
|
|
511
|
+
color: "#fff",
|
|
512
|
+
fontWeight: "600"
|
|
478
513
|
}
|
|
479
514
|
});
|
|
480
515
|
|
package/package.json
CHANGED