@payfit/unity-components
Version:
25 lines (24 loc) • 821 B
JavaScript
import { ActionBarButton as e } from "../parts/ActionBarButton.js";
import { ActionBarIconButton as t } from "../parts/ActionBarIconButton.js";
import n, { isValidElement as r } from "react";
//#region src/components/action-bar/utils/action-bar-helpers.ts
var i = (e) => e.filter((e) => e.variant !== "primary"), a = (i) => {
let a = [];
return n.Children.forEach(i, (n) => {
if (!r(n) || n.type !== e && n.type !== t) return;
let i = n.props;
if (i.variant === "primary") return;
let o = n.type === t ? i.label : i.children, s = n.type === t ? i.icon : i.prefixIcon;
a.push({
id: n.key ?? i.id,
label: o,
variant: i.variant,
meta: {
onPress: i.onPress,
prefixIcon: s
}
});
}), a;
};
//#endregion
export { i as extractMobileActionsFromArray, a as extractMobileActionsFromChildren };