@kaushverse/pickify 1.1.3 → 1.1.5
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 +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +38 -32
- package/dist/index.mjs +38 -32
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -97,6 +97,7 @@ type MultiPickerGroupProps = {
|
|
|
97
97
|
children: React.ReactNode;
|
|
98
98
|
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
|
+
defaultOpen: boolean;
|
|
100
101
|
};
|
|
101
102
|
type MultiPickerStyles = {
|
|
102
103
|
overlay?: ViewStyle;
|
|
@@ -130,22 +131,25 @@ declare function MultiPickerModal({ visible, setVisible, selectedValues, options
|
|
|
130
131
|
|
|
131
132
|
type Action = {
|
|
132
133
|
icon: string;
|
|
133
|
-
onPress
|
|
134
|
+
onPress?: () => void;
|
|
135
|
+
navigateTo?: () => void;
|
|
136
|
+
color?: string;
|
|
137
|
+
iconColor?: string;
|
|
134
138
|
};
|
|
135
139
|
type FloatingButtonStyles = {
|
|
136
140
|
container?: ViewStyle;
|
|
137
141
|
mainButton?: ViewStyle;
|
|
138
142
|
secondaryButton?: ViewStyle;
|
|
139
|
-
mainIcon?: TextStyle;
|
|
140
|
-
secondaryIcon?: TextStyle;
|
|
141
143
|
};
|
|
142
144
|
type Props = {
|
|
143
145
|
actions: Action[];
|
|
144
146
|
mode?: "vertical" | "horizontal" | "circle";
|
|
145
147
|
radius?: number;
|
|
146
|
-
|
|
148
|
+
renderMainIcon?: IconRenderer;
|
|
149
|
+
renderItemIcon?: IconRenderer;
|
|
147
150
|
styles?: FloatingButtonStyles;
|
|
148
151
|
style?: ViewStyle;
|
|
152
|
+
mainIconName?: string;
|
|
149
153
|
};
|
|
150
154
|
declare class FloatingButton extends React$1.Component<Props> {
|
|
151
155
|
animation: Animated.Value;
|
|
@@ -157,7 +161,7 @@ declare class FloatingButton extends React$1.Component<Props> {
|
|
|
157
161
|
|
|
158
162
|
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
159
163
|
|
|
160
|
-
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
declare function MultiPickerGroup({ label, children, renderGroupIcon, defaultOpen, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
161
165
|
|
|
162
166
|
declare const toggleValue: (arr: string[], value: string) => string[];
|
|
163
167
|
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ type MultiPickerGroupProps = {
|
|
|
97
97
|
children: React.ReactNode;
|
|
98
98
|
renderGroupIcon?: IconRenderer;
|
|
99
99
|
styles?: MultiPickerGroupStyles;
|
|
100
|
+
defaultOpen: boolean;
|
|
100
101
|
};
|
|
101
102
|
type MultiPickerStyles = {
|
|
102
103
|
overlay?: ViewStyle;
|
|
@@ -130,22 +131,25 @@ declare function MultiPickerModal({ visible, setVisible, selectedValues, options
|
|
|
130
131
|
|
|
131
132
|
type Action = {
|
|
132
133
|
icon: string;
|
|
133
|
-
onPress
|
|
134
|
+
onPress?: () => void;
|
|
135
|
+
navigateTo?: () => void;
|
|
136
|
+
color?: string;
|
|
137
|
+
iconColor?: string;
|
|
134
138
|
};
|
|
135
139
|
type FloatingButtonStyles = {
|
|
136
140
|
container?: ViewStyle;
|
|
137
141
|
mainButton?: ViewStyle;
|
|
138
142
|
secondaryButton?: ViewStyle;
|
|
139
|
-
mainIcon?: TextStyle;
|
|
140
|
-
secondaryIcon?: TextStyle;
|
|
141
143
|
};
|
|
142
144
|
type Props = {
|
|
143
145
|
actions: Action[];
|
|
144
146
|
mode?: "vertical" | "horizontal" | "circle";
|
|
145
147
|
radius?: number;
|
|
146
|
-
|
|
148
|
+
renderMainIcon?: IconRenderer;
|
|
149
|
+
renderItemIcon?: IconRenderer;
|
|
147
150
|
styles?: FloatingButtonStyles;
|
|
148
151
|
style?: ViewStyle;
|
|
152
|
+
mainIconName?: string;
|
|
149
153
|
};
|
|
150
154
|
declare class FloatingButton extends React$1.Component<Props> {
|
|
151
155
|
animation: Animated.Value;
|
|
@@ -157,7 +161,7 @@ declare class FloatingButton extends React$1.Component<Props> {
|
|
|
157
161
|
|
|
158
162
|
declare function MultiPickerItem({ label, selected, onPress, renderItemIcon, styles: customStyles, }: MultiPickerItemProps): react_jsx_runtime.JSX.Element;
|
|
159
163
|
|
|
160
|
-
declare function MultiPickerGroup({ label, children, renderGroupIcon, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
declare function MultiPickerGroup({ label, children, renderGroupIcon, defaultOpen, }: MultiPickerGroupProps): react_jsx_runtime.JSX.Element;
|
|
161
165
|
|
|
162
166
|
declare const toggleValue: (arr: string[], value: string) => string[];
|
|
163
167
|
|
package/dist/index.js
CHANGED
|
@@ -288,9 +288,10 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
288
288
|
function MultiPickerGroup({
|
|
289
289
|
label,
|
|
290
290
|
children,
|
|
291
|
-
renderGroupIcon
|
|
291
|
+
renderGroupIcon,
|
|
292
|
+
defaultOpen = false
|
|
292
293
|
}) {
|
|
293
|
-
const [open, setOpen] = (0, import_react2.useState)(
|
|
294
|
+
const [open, setOpen] = (0, import_react2.useState)(defaultOpen);
|
|
294
295
|
const [contentHeight, setContentHeight] = (0, import_react2.useState)(0);
|
|
295
296
|
const animatedHeight = (0, import_react2.useRef)(new import_react_native2.Animated.Value(0)).current;
|
|
296
297
|
const toggle = () => {
|
|
@@ -464,11 +465,12 @@ function MultiPickerModal({
|
|
|
464
465
|
};
|
|
465
466
|
const renderList = () => {
|
|
466
467
|
if (groups.length > 0) {
|
|
467
|
-
return groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
468
|
+
return groups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
468
469
|
MultiPickerGroup,
|
|
469
470
|
{
|
|
470
471
|
label: group.label,
|
|
471
472
|
renderGroupIcon,
|
|
473
|
+
defaultOpen: index === 0,
|
|
472
474
|
children: group.data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
473
475
|
MultiPickerItem,
|
|
474
476
|
{
|
|
@@ -597,7 +599,7 @@ var FloatingButton = class extends import_react4.default.Component {
|
|
|
597
599
|
mode = "vertical",
|
|
598
600
|
radius = 100,
|
|
599
601
|
actions,
|
|
600
|
-
|
|
602
|
+
renderItemIcon,
|
|
601
603
|
styles: styles2
|
|
602
604
|
} = this.props;
|
|
603
605
|
let translateX = 0;
|
|
@@ -609,9 +611,12 @@ var FloatingButton = class extends import_react4.default.Component {
|
|
|
609
611
|
translateX = -60 * (index + 1);
|
|
610
612
|
}
|
|
611
613
|
if (mode === "circle") {
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
614
|
+
const angleStep = Math.PI / 2;
|
|
615
|
+
const angle = index / (actions.length - 1 || 1) * angleStep;
|
|
616
|
+
const adjustedRadiusX = radius * 0.7;
|
|
617
|
+
const adjustedRadiusY = radius;
|
|
618
|
+
translateX = -adjustedRadiusX * Math.cos(angle);
|
|
619
|
+
translateY = -adjustedRadiusY * Math.sin(angle);
|
|
615
620
|
}
|
|
616
621
|
const animStyle = {
|
|
617
622
|
transform: [
|
|
@@ -641,16 +646,22 @@ var FloatingButton = class extends import_react4.default.Component {
|
|
|
641
646
|
{
|
|
642
647
|
onPress: () => {
|
|
643
648
|
this.toggleMenu();
|
|
644
|
-
action.onPress();
|
|
649
|
+
action.onPress?.();
|
|
650
|
+
action.navigateTo?.();
|
|
645
651
|
},
|
|
646
652
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
647
653
|
import_react_native5.Animated.View,
|
|
648
654
|
{
|
|
649
|
-
style: [
|
|
650
|
-
|
|
655
|
+
style: [
|
|
656
|
+
defaultStyles4.secondary,
|
|
657
|
+
styles2?.secondaryButton,
|
|
658
|
+
{ backgroundColor: action.color || "#F02A4B" },
|
|
659
|
+
animStyle
|
|
660
|
+
],
|
|
661
|
+
children: renderItemIcon?.({
|
|
651
662
|
name: action.icon,
|
|
652
663
|
size: 20,
|
|
653
|
-
color: "#FFF"
|
|
664
|
+
color: action.iconColor || "#FFF"
|
|
654
665
|
})
|
|
655
666
|
}
|
|
656
667
|
)
|
|
@@ -659,7 +670,7 @@ var FloatingButton = class extends import_react4.default.Component {
|
|
|
659
670
|
);
|
|
660
671
|
};
|
|
661
672
|
render() {
|
|
662
|
-
const { actions,
|
|
673
|
+
const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
|
|
663
674
|
const rotation = {
|
|
664
675
|
transform: [
|
|
665
676
|
{
|
|
@@ -670,26 +681,21 @@ var FloatingButton = class extends import_react4.default.Component {
|
|
|
670
681
|
}
|
|
671
682
|
]
|
|
672
683
|
};
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
) })
|
|
690
|
-
]
|
|
691
|
-
}
|
|
692
|
-
);
|
|
684
|
+
const mainIcon = mainIconName || "add";
|
|
685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { style: [defaultStyles4.container, styles2?.container, style], children: [
|
|
686
|
+
actions.map(this.renderAction),
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
688
|
+
import_react_native5.Animated.View,
|
|
689
|
+
{
|
|
690
|
+
style: [defaultStyles4.button, styles2?.mainButton, rotation],
|
|
691
|
+
children: renderMainIcon?.({
|
|
692
|
+
name: mainIcon,
|
|
693
|
+
size: 26,
|
|
694
|
+
color: "#FFF"
|
|
695
|
+
})
|
|
696
|
+
}
|
|
697
|
+
) })
|
|
698
|
+
] });
|
|
693
699
|
}
|
|
694
700
|
};
|
|
695
701
|
var defaultStyles4 = import_react_native5.StyleSheet.create({
|
package/dist/index.mjs
CHANGED
|
@@ -266,9 +266,10 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
266
266
|
function MultiPickerGroup({
|
|
267
267
|
label,
|
|
268
268
|
children,
|
|
269
|
-
renderGroupIcon
|
|
269
|
+
renderGroupIcon,
|
|
270
|
+
defaultOpen = false
|
|
270
271
|
}) {
|
|
271
|
-
const [open, setOpen] = useState2(
|
|
272
|
+
const [open, setOpen] = useState2(defaultOpen);
|
|
272
273
|
const [contentHeight, setContentHeight] = useState2(0);
|
|
273
274
|
const animatedHeight = useRef(new Animated.Value(0)).current;
|
|
274
275
|
const toggle = () => {
|
|
@@ -442,11 +443,12 @@ function MultiPickerModal({
|
|
|
442
443
|
};
|
|
443
444
|
const renderList = () => {
|
|
444
445
|
if (groups.length > 0) {
|
|
445
|
-
return groups.map((group) => /* @__PURE__ */ jsx4(
|
|
446
|
+
return groups.map((group, index) => /* @__PURE__ */ jsx4(
|
|
446
447
|
MultiPickerGroup,
|
|
447
448
|
{
|
|
448
449
|
label: group.label,
|
|
449
450
|
renderGroupIcon,
|
|
451
|
+
defaultOpen: index === 0,
|
|
450
452
|
children: group.data.map((item) => /* @__PURE__ */ jsx4(
|
|
451
453
|
MultiPickerItem,
|
|
452
454
|
{
|
|
@@ -580,7 +582,7 @@ var FloatingButton = class extends React4.Component {
|
|
|
580
582
|
mode = "vertical",
|
|
581
583
|
radius = 100,
|
|
582
584
|
actions,
|
|
583
|
-
|
|
585
|
+
renderItemIcon,
|
|
584
586
|
styles: styles2
|
|
585
587
|
} = this.props;
|
|
586
588
|
let translateX = 0;
|
|
@@ -592,9 +594,12 @@ var FloatingButton = class extends React4.Component {
|
|
|
592
594
|
translateX = -60 * (index + 1);
|
|
593
595
|
}
|
|
594
596
|
if (mode === "circle") {
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
597
|
+
const angleStep = Math.PI / 2;
|
|
598
|
+
const angle = index / (actions.length - 1 || 1) * angleStep;
|
|
599
|
+
const adjustedRadiusX = radius * 0.7;
|
|
600
|
+
const adjustedRadiusY = radius;
|
|
601
|
+
translateX = -adjustedRadiusX * Math.cos(angle);
|
|
602
|
+
translateY = -adjustedRadiusY * Math.sin(angle);
|
|
598
603
|
}
|
|
599
604
|
const animStyle = {
|
|
600
605
|
transform: [
|
|
@@ -624,16 +629,22 @@ var FloatingButton = class extends React4.Component {
|
|
|
624
629
|
{
|
|
625
630
|
onPress: () => {
|
|
626
631
|
this.toggleMenu();
|
|
627
|
-
action.onPress();
|
|
632
|
+
action.onPress?.();
|
|
633
|
+
action.navigateTo?.();
|
|
628
634
|
},
|
|
629
635
|
children: /* @__PURE__ */ jsx5(
|
|
630
636
|
Animated2.View,
|
|
631
637
|
{
|
|
632
|
-
style: [
|
|
633
|
-
|
|
638
|
+
style: [
|
|
639
|
+
defaultStyles4.secondary,
|
|
640
|
+
styles2?.secondaryButton,
|
|
641
|
+
{ backgroundColor: action.color || "#F02A4B" },
|
|
642
|
+
animStyle
|
|
643
|
+
],
|
|
644
|
+
children: renderItemIcon?.({
|
|
634
645
|
name: action.icon,
|
|
635
646
|
size: 20,
|
|
636
|
-
color: "#FFF"
|
|
647
|
+
color: action.iconColor || "#FFF"
|
|
637
648
|
})
|
|
638
649
|
}
|
|
639
650
|
)
|
|
@@ -642,7 +653,7 @@ var FloatingButton = class extends React4.Component {
|
|
|
642
653
|
);
|
|
643
654
|
};
|
|
644
655
|
render() {
|
|
645
|
-
const { actions,
|
|
656
|
+
const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
|
|
646
657
|
const rotation = {
|
|
647
658
|
transform: [
|
|
648
659
|
{
|
|
@@ -653,26 +664,21 @@ var FloatingButton = class extends React4.Component {
|
|
|
653
664
|
}
|
|
654
665
|
]
|
|
655
666
|
};
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
) })
|
|
673
|
-
]
|
|
674
|
-
}
|
|
675
|
-
);
|
|
667
|
+
const mainIcon = mainIconName || "add";
|
|
668
|
+
return /* @__PURE__ */ jsxs5(View5, { style: [defaultStyles4.container, styles2?.container, style], children: [
|
|
669
|
+
actions.map(this.renderAction),
|
|
670
|
+
/* @__PURE__ */ jsx5(TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ jsx5(
|
|
671
|
+
Animated2.View,
|
|
672
|
+
{
|
|
673
|
+
style: [defaultStyles4.button, styles2?.mainButton, rotation],
|
|
674
|
+
children: renderMainIcon?.({
|
|
675
|
+
name: mainIcon,
|
|
676
|
+
size: 26,
|
|
677
|
+
color: "#FFF"
|
|
678
|
+
})
|
|
679
|
+
}
|
|
680
|
+
) })
|
|
681
|
+
] });
|
|
676
682
|
}
|
|
677
683
|
};
|
|
678
684
|
var defaultStyles4 = StyleSheet5.create({
|
package/package.json
CHANGED