@propeller-commerce/propeller-v2-react-ui 0.10.1 → 0.11.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/CHANGELOG.md +87 -0
- package/dist/index.cjs +178 -251
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -6
- package/dist/index.d.ts +69 -6
- package/dist/index.js +178 -251
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12825,12 +12825,10 @@ function ItemsOverview(props) {
|
|
|
12825
12825
|
] });
|
|
12826
12826
|
}
|
|
12827
12827
|
var ItemsOverview_default = ItemsOverview;
|
|
12828
|
+
var RENDERED_STYLES = ["dropdown-vertical", "jumbotron", "accordion"];
|
|
12828
12829
|
function Menu(rawProps) {
|
|
12829
12830
|
const props = useInfraProps(rawProps);
|
|
12830
|
-
const [
|
|
12831
|
-
const [hoveredL2Id, setHoveredL2Id] = useState(null);
|
|
12832
|
-
const [expandedL1, setExpandedL1] = useState(null);
|
|
12833
|
-
const [expandedL2, setExpandedL2] = useState(null);
|
|
12831
|
+
const [openPath, setOpenPath] = useState([]);
|
|
12834
12832
|
const userKey = props.user ? "contactId" in props.user ? `c${props.user.contactId}` : `u${props.user.customerId}` : "";
|
|
12835
12833
|
const hasPrefetchedTree = Array.isArray(props.tree);
|
|
12836
12834
|
const { categories: fetchedCategories, loading: fetchedLoading, error: menuError, fetchMenu } = useMenu({
|
|
@@ -12867,21 +12865,178 @@ function Menu(rawProps) {
|
|
|
12867
12865
|
});
|
|
12868
12866
|
}
|
|
12869
12867
|
}
|
|
12870
|
-
function
|
|
12871
|
-
|
|
12872
|
-
|
|
12868
|
+
function openAt(level, categoryId) {
|
|
12869
|
+
setOpenPath((prev) => {
|
|
12870
|
+
const next = prev.slice(0, level);
|
|
12871
|
+
if (categoryId !== null) next.push(categoryId);
|
|
12872
|
+
return next;
|
|
12873
|
+
});
|
|
12873
12874
|
}
|
|
12874
|
-
function
|
|
12875
|
-
|
|
12875
|
+
function toggleAt(level, categoryId) {
|
|
12876
|
+
setOpenPath(
|
|
12877
|
+
(prev) => prev[level] === categoryId ? prev.slice(0, level) : [...prev.slice(0, level), categoryId]
|
|
12878
|
+
);
|
|
12879
|
+
}
|
|
12880
|
+
function isOpenAt(level, categoryId) {
|
|
12881
|
+
return openPath[level] === categoryId;
|
|
12876
12882
|
}
|
|
12877
12883
|
function getMenuStyle() {
|
|
12878
|
-
|
|
12884
|
+
const requested = props.menuStyle || "dropdown-vertical";
|
|
12885
|
+
if (!RENDERED_STYLES.includes(requested)) {
|
|
12886
|
+
if (process.env.NODE_ENV !== "production") {
|
|
12887
|
+
console.warn(
|
|
12888
|
+
`[Menu] menuStyle="${requested}" has no built-in renderer (available: ${RENDERED_STYLES.join(", ")}); falling back to "accordion". Pass \`renderMenu\` to draw a custom style.`
|
|
12889
|
+
);
|
|
12890
|
+
}
|
|
12891
|
+
return "accordion";
|
|
12892
|
+
}
|
|
12893
|
+
return requested;
|
|
12894
|
+
}
|
|
12895
|
+
function getRenderableDepth() {
|
|
12896
|
+
const requested = Math.max(1, props.depth ?? 3);
|
|
12897
|
+
const cap = getMenuStyle() === "accordion" ? Number.POSITIVE_INFINITY : 5;
|
|
12898
|
+
if (process.env.NODE_ENV !== "production" && requested > cap) {
|
|
12899
|
+
console.warn(
|
|
12900
|
+
`[Menu] depth={${requested}} exceeds what menuStyle="${getMenuStyle()}" can lay out (${cap}); rendering ${cap} levels. Use menuStyle="accordion" for deeper trees.`
|
|
12901
|
+
);
|
|
12902
|
+
}
|
|
12903
|
+
return Math.min(requested, cap);
|
|
12904
|
+
}
|
|
12905
|
+
const maxDepth = getRenderableDepth();
|
|
12906
|
+
function renderChevron(cat, level, rotated = false) {
|
|
12907
|
+
if (getSubCategories(cat).length === 0 || level + 1 >= maxDepth) return null;
|
|
12908
|
+
return /* @__PURE__ */ jsx(
|
|
12909
|
+
"svg",
|
|
12910
|
+
{
|
|
12911
|
+
className: `propeller-menu__chevron w-3.5 h-3.5 flex-shrink-0 transition-transform ${rotated ? "rotate-180" : ""}`,
|
|
12912
|
+
viewBox: "0 0 24 24",
|
|
12913
|
+
fill: "none",
|
|
12914
|
+
stroke: "currentColor",
|
|
12915
|
+
strokeWidth: "2",
|
|
12916
|
+
strokeLinecap: "round",
|
|
12917
|
+
strokeLinejoin: "round",
|
|
12918
|
+
"aria-hidden": "true",
|
|
12919
|
+
children: rotated ? /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" }) : /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
|
|
12920
|
+
}
|
|
12921
|
+
);
|
|
12922
|
+
}
|
|
12923
|
+
function renderColumns(items, level) {
|
|
12924
|
+
if (!items.length || level >= maxDepth) return [];
|
|
12925
|
+
const openId = openPath[level];
|
|
12926
|
+
const openCat = items.find((c) => c.categoryId === openId);
|
|
12927
|
+
const column = /* @__PURE__ */ jsx(
|
|
12928
|
+
"ul",
|
|
12929
|
+
{
|
|
12930
|
+
className: `propeller-menu__list w-64 py-1 flex-shrink-0 ${level + 1 < maxDepth ? "border-r border-border" : ""}`,
|
|
12931
|
+
"data-level": level + 1,
|
|
12932
|
+
children: items.map((cat, idx) => /* @__PURE__ */ jsx(
|
|
12933
|
+
"li",
|
|
12934
|
+
{
|
|
12935
|
+
className: "propeller-menu__item",
|
|
12936
|
+
"data-level": level + 1,
|
|
12937
|
+
"data-active": isOpenAt(level, cat.categoryId) ? "true" : "false",
|
|
12938
|
+
onMouseEnter: () => openAt(level, cat.categoryId),
|
|
12939
|
+
children: /* @__PURE__ */ jsxs(
|
|
12940
|
+
"a",
|
|
12941
|
+
{
|
|
12942
|
+
href: getCategoryUrl(cat),
|
|
12943
|
+
onClick: (e) => handleItemClick(cat, e),
|
|
12944
|
+
className: `propeller-menu__link flex items-center justify-between px-4 py-2.5 text-sm transition-colors ${isOpenAt(level, cat.categoryId) ? "bg-accent text-accent-foreground" : "text-foreground hover:bg-accent/50"}`,
|
|
12945
|
+
children: [
|
|
12946
|
+
/* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(cat) }),
|
|
12947
|
+
renderChevron(cat, level)
|
|
12948
|
+
]
|
|
12949
|
+
}
|
|
12950
|
+
)
|
|
12951
|
+
},
|
|
12952
|
+
`l${level}-${cat.categoryId}-${idx}`
|
|
12953
|
+
))
|
|
12954
|
+
},
|
|
12955
|
+
`col-${level}`
|
|
12956
|
+
);
|
|
12957
|
+
const deeper = openCat ? renderColumns(getSubCategories(openCat), level + 1) : [];
|
|
12958
|
+
return [column, ...deeper];
|
|
12959
|
+
}
|
|
12960
|
+
function renderAccordion(items, level) {
|
|
12961
|
+
if (!items.length || level >= maxDepth) return null;
|
|
12962
|
+
return /* @__PURE__ */ jsx(
|
|
12963
|
+
"ul",
|
|
12964
|
+
{
|
|
12965
|
+
className: `propeller-menu__list ${level === 0 ? "divide-y divide-border" : level === 1 ? "bg-accent/30" : "bg-accent/20"}`,
|
|
12966
|
+
"data-level": level + 1,
|
|
12967
|
+
children: items.map((cat, idx) => {
|
|
12968
|
+
const children = getSubCategories(cat);
|
|
12969
|
+
const expanded = isOpenAt(level, cat.categoryId);
|
|
12970
|
+
const canExpand = children.length > 0 && level + 1 < maxDepth;
|
|
12971
|
+
return /* @__PURE__ */ jsxs(
|
|
12972
|
+
"li",
|
|
12973
|
+
{
|
|
12974
|
+
className: "propeller-menu__item",
|
|
12975
|
+
"data-level": level + 1,
|
|
12976
|
+
"data-expanded": expanded ? "true" : "false",
|
|
12977
|
+
children: [
|
|
12978
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12979
|
+
/* @__PURE__ */ jsx(
|
|
12980
|
+
"a",
|
|
12981
|
+
{
|
|
12982
|
+
href: getCategoryUrl(cat),
|
|
12983
|
+
onClick: (e) => handleItemClick(cat, e),
|
|
12984
|
+
className: "propeller-menu__link flex-1 px-4 py-3 text-sm text-foreground",
|
|
12985
|
+
style: { paddingLeft: `${1 + level}rem` },
|
|
12986
|
+
children: getCategoryName(cat)
|
|
12987
|
+
}
|
|
12988
|
+
),
|
|
12989
|
+
canExpand ? /* @__PURE__ */ jsx(
|
|
12990
|
+
"button",
|
|
12991
|
+
{
|
|
12992
|
+
type: "button",
|
|
12993
|
+
className: "propeller-menu__toggle cursor-pointer px-4 py-3 text-muted-foreground transition-colors hover:text-foreground",
|
|
12994
|
+
"aria-expanded": expanded,
|
|
12995
|
+
"aria-label": getCategoryName(cat),
|
|
12996
|
+
onClick: () => toggleAt(level, cat.categoryId),
|
|
12997
|
+
children: renderChevron(cat, level, expanded)
|
|
12998
|
+
}
|
|
12999
|
+
) : null
|
|
13000
|
+
] }),
|
|
13001
|
+
expanded && canExpand ? renderAccordion(children, level + 1) : null
|
|
13002
|
+
]
|
|
13003
|
+
},
|
|
13004
|
+
`l${level}-${cat.categoryId}-${idx}`
|
|
13005
|
+
);
|
|
13006
|
+
})
|
|
13007
|
+
}
|
|
13008
|
+
);
|
|
12879
13009
|
}
|
|
12880
13010
|
useEffect(() => {
|
|
12881
13011
|
if (hasPrefetchedTree) return;
|
|
12882
13012
|
if (!props.graphqlClient) return;
|
|
12883
13013
|
fetchMenu(props.categoryId, userKey);
|
|
12884
13014
|
}, [hasPrefetchedTree, props.graphqlClient, props.categoryId, props.language, userKey, fetchMenu]);
|
|
13015
|
+
const customMenu = props.renderMenu ? props.renderMenu({
|
|
13016
|
+
categories: menuCategories,
|
|
13017
|
+
isLoading,
|
|
13018
|
+
hasError,
|
|
13019
|
+
maxDepth,
|
|
13020
|
+
getSubCategories,
|
|
13021
|
+
getCategoryName,
|
|
13022
|
+
getCategoryUrl,
|
|
13023
|
+
handleItemClick,
|
|
13024
|
+
openPath,
|
|
13025
|
+
isOpenAt,
|
|
13026
|
+
openAt,
|
|
13027
|
+
toggleAt
|
|
13028
|
+
}) : null;
|
|
13029
|
+
if (customMenu !== null && customMenu !== void 0) {
|
|
13030
|
+
return /* @__PURE__ */ jsx(
|
|
13031
|
+
"div",
|
|
13032
|
+
{
|
|
13033
|
+
className: `propeller-menu ${props.className || ""}`,
|
|
13034
|
+
"data-variant": props.menuStyle || "custom",
|
|
13035
|
+
"data-loading": isLoading ? "true" : "false",
|
|
13036
|
+
children: customMenu
|
|
13037
|
+
}
|
|
13038
|
+
);
|
|
13039
|
+
}
|
|
12885
13040
|
return /* @__PURE__ */ jsxs(
|
|
12886
13041
|
"div",
|
|
12887
13042
|
{
|
|
@@ -12899,125 +13054,7 @@ function Menu(rawProps) {
|
|
|
12899
13054
|
"nav",
|
|
12900
13055
|
{
|
|
12901
13056
|
className: `propeller-menu__nav hidden md:block ${props.menuClass || ""}`,
|
|
12902
|
-
children: /* @__PURE__ */
|
|
12903
|
-
/* @__PURE__ */ jsx("ul", { className: "propeller-menu__list w-64 py-1 border-r border-border flex-shrink-0", "data-level": "1", children: menuCategories?.map((l1, idx) => /* @__PURE__ */ jsx(
|
|
12904
|
-
"li",
|
|
12905
|
-
{
|
|
12906
|
-
className: "propeller-menu__item",
|
|
12907
|
-
"data-level": "1",
|
|
12908
|
-
"data-active": hoveredL1Id === l1.categoryId ? "true" : "false",
|
|
12909
|
-
onMouseEnter: (event) => setHoveredL1(l1.categoryId),
|
|
12910
|
-
children: /* @__PURE__ */ jsxs(
|
|
12911
|
-
"a",
|
|
12912
|
-
{
|
|
12913
|
-
href: getCategoryUrl(l1),
|
|
12914
|
-
onClick: (e) => handleItemClick(l1, e),
|
|
12915
|
-
className: `propeller-menu__link flex items-center justify-between px-4 py-2.5 text-sm transition-colors ${hoveredL1Id === l1.categoryId ? "bg-accent text-accent-foreground" : "text-foreground hover:bg-accent/50"}`,
|
|
12916
|
-
children: [
|
|
12917
|
-
/* @__PURE__ */ jsx("span", { className: "propeller-menu__label font-medium truncate", children: getCategoryName(l1) }),
|
|
12918
|
-
getSubCategories(l1).length > 0 ? /* @__PURE__ */ jsx(
|
|
12919
|
-
"svg",
|
|
12920
|
-
{
|
|
12921
|
-
fill: "none",
|
|
12922
|
-
stroke: "currentColor",
|
|
12923
|
-
viewBox: "0 0 24 24",
|
|
12924
|
-
className: "propeller-menu__chevron w-4 h-4 text-muted-foreground",
|
|
12925
|
-
children: /* @__PURE__ */ jsx(
|
|
12926
|
-
"path",
|
|
12927
|
-
{
|
|
12928
|
-
strokeLinecap: "round",
|
|
12929
|
-
strokeLinejoin: "round",
|
|
12930
|
-
d: "M9 5l7 7-7 7",
|
|
12931
|
-
strokeWidth: 2
|
|
12932
|
-
}
|
|
12933
|
-
)
|
|
12934
|
-
}
|
|
12935
|
-
) : null
|
|
12936
|
-
]
|
|
12937
|
-
}
|
|
12938
|
-
)
|
|
12939
|
-
},
|
|
12940
|
-
`l1-${l1.categoryId}-${idx}`
|
|
12941
|
-
)) }),
|
|
12942
|
-
menuCategories?.map(
|
|
12943
|
-
(l1, idx) => hoveredL1Id === l1.categoryId && getSubCategories(l1).length > 0 ? /* @__PURE__ */ jsx(
|
|
12944
|
-
"ul",
|
|
12945
|
-
{
|
|
12946
|
-
className: "propeller-menu__list w-64 py-1 border-r border-border flex-shrink-0",
|
|
12947
|
-
"data-level": "2",
|
|
12948
|
-
children: getSubCategories(l1)?.map((l2, idx2) => /* @__PURE__ */ jsx(
|
|
12949
|
-
"li",
|
|
12950
|
-
{
|
|
12951
|
-
className: "propeller-menu__item",
|
|
12952
|
-
"data-level": "2",
|
|
12953
|
-
"data-active": hoveredL2Id === l2.categoryId ? "true" : "false",
|
|
12954
|
-
onMouseEnter: (event) => setHoveredL2(l2.categoryId),
|
|
12955
|
-
children: /* @__PURE__ */ jsxs(
|
|
12956
|
-
"a",
|
|
12957
|
-
{
|
|
12958
|
-
href: getCategoryUrl(l2),
|
|
12959
|
-
onClick: (e) => handleItemClick(l2, e),
|
|
12960
|
-
className: `propeller-menu__link flex items-center justify-between px-4 py-2.5 text-sm transition-colors ${hoveredL2Id === l2.categoryId ? "bg-accent text-accent-foreground" : "text-foreground hover:bg-accent/50"}`,
|
|
12961
|
-
children: [
|
|
12962
|
-
/* @__PURE__ */ jsx("span", { className: "propeller-menu__label truncate", children: getCategoryName(l2) }),
|
|
12963
|
-
getSubCategories(l2).length > 0 ? /* @__PURE__ */ jsx(
|
|
12964
|
-
"svg",
|
|
12965
|
-
{
|
|
12966
|
-
fill: "none",
|
|
12967
|
-
stroke: "currentColor",
|
|
12968
|
-
viewBox: "0 0 24 24",
|
|
12969
|
-
className: "propeller-menu__chevron w-4 h-4 text-muted-foreground",
|
|
12970
|
-
children: /* @__PURE__ */ jsx(
|
|
12971
|
-
"path",
|
|
12972
|
-
{
|
|
12973
|
-
strokeLinecap: "round",
|
|
12974
|
-
strokeLinejoin: "round",
|
|
12975
|
-
d: "M9 5l7 7-7 7",
|
|
12976
|
-
strokeWidth: 2
|
|
12977
|
-
}
|
|
12978
|
-
)
|
|
12979
|
-
}
|
|
12980
|
-
) : null
|
|
12981
|
-
]
|
|
12982
|
-
}
|
|
12983
|
-
)
|
|
12984
|
-
},
|
|
12985
|
-
`l2-${l2.categoryId}-${idx2}`
|
|
12986
|
-
))
|
|
12987
|
-
},
|
|
12988
|
-
`l1-sub-${l1.categoryId}-${idx}`
|
|
12989
|
-
) : null
|
|
12990
|
-
),
|
|
12991
|
-
menuCategories?.map(
|
|
12992
|
-
(l1, idx) => hoveredL1Id === l1.categoryId ? /* @__PURE__ */ jsx(React6.Fragment, { children: getSubCategories(l1)?.map(
|
|
12993
|
-
(l2, idx2) => hoveredL2Id === l2.categoryId && getSubCategories(l2).length > 0 ? /* @__PURE__ */ jsx(
|
|
12994
|
-
"ul",
|
|
12995
|
-
{
|
|
12996
|
-
className: "propeller-menu__list w-64 py-1 flex-shrink-0",
|
|
12997
|
-
"data-level": "3",
|
|
12998
|
-
children: getSubCategories(l2)?.map((l3, idx3) => /* @__PURE__ */ jsx(
|
|
12999
|
-
"li",
|
|
13000
|
-
{
|
|
13001
|
-
className: "propeller-menu__item",
|
|
13002
|
-
"data-level": "3",
|
|
13003
|
-
children: /* @__PURE__ */ jsx(
|
|
13004
|
-
"a",
|
|
13005
|
-
{
|
|
13006
|
-
className: "propeller-menu__link block px-4 py-2.5 text-sm text-foreground hover:bg-accent/50 transition-colors",
|
|
13007
|
-
href: getCategoryUrl(l3),
|
|
13008
|
-
onClick: (e) => handleItemClick(l3, e),
|
|
13009
|
-
children: /* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(l3) })
|
|
13010
|
-
}
|
|
13011
|
-
)
|
|
13012
|
-
},
|
|
13013
|
-
`l3-${l3.categoryId}-${idx3}`
|
|
13014
|
-
))
|
|
13015
|
-
},
|
|
13016
|
-
`l3-col-${l2.categoryId}-${idx2}`
|
|
13017
|
-
) : null
|
|
13018
|
-
) }, `l1-l3col-${l1.categoryId}-${idx}`) : null
|
|
13019
|
-
)
|
|
13020
|
-
] })
|
|
13057
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex max-w-[100vw] overflow-x-auto bg-popover border border-border shadow-lg", children: renderColumns(menuCategories, 0) })
|
|
13021
13058
|
}
|
|
13022
13059
|
) : null,
|
|
13023
13060
|
!isLoading && !hasError && menuCategories.length > 0 && getMenuStyle() === "jumbotron" ? /* @__PURE__ */ jsxs(
|
|
@@ -13028,22 +13065,22 @@ function Menu(rawProps) {
|
|
|
13028
13065
|
/* @__PURE__ */ jsx("div", { className: "propeller-menu__tabs flex items-center border-b border-border", children: menuCategories?.map((l1, idx) => /* @__PURE__ */ jsx(
|
|
13029
13066
|
"button",
|
|
13030
13067
|
{
|
|
13031
|
-
className: `propeller-menu__tab px-5 py-3 text-sm font-medium transition-colors border-b-2 ${
|
|
13068
|
+
className: `propeller-menu__tab cursor-pointer px-5 py-3 text-sm font-medium transition-colors border-b-2 ${isOpenAt(0, l1.categoryId) ? "border-primary text-primary" : "border-transparent text-foreground hover:text-primary hover:border-primary/50"}`,
|
|
13032
13069
|
"data-level": "1",
|
|
13033
|
-
"data-active":
|
|
13034
|
-
onMouseEnter: (event) =>
|
|
13070
|
+
"data-active": isOpenAt(0, l1.categoryId) ? "true" : "false",
|
|
13071
|
+
onMouseEnter: (event) => openAt(0, l1.categoryId),
|
|
13035
13072
|
onClick: (e) => handleItemClick(l1, e),
|
|
13036
13073
|
children: /* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(l1) })
|
|
13037
13074
|
},
|
|
13038
13075
|
`l1-${l1.categoryId}-${idx}`
|
|
13039
13076
|
)) }),
|
|
13040
13077
|
menuCategories?.map(
|
|
13041
|
-
(l1, idx) =>
|
|
13078
|
+
(l1, idx) => isOpenAt(0, l1.categoryId) && getSubCategories(l1).length > 0 ? /* @__PURE__ */ jsx(
|
|
13042
13079
|
"div",
|
|
13043
13080
|
{
|
|
13044
13081
|
className: "propeller-menu__panel bg-popover border border-border border-t-0 shadow-lg p-6",
|
|
13045
|
-
onMouseEnter: (event) =>
|
|
13046
|
-
onMouseLeave: (event) =>
|
|
13082
|
+
onMouseEnter: (event) => openAt(0, l1.categoryId),
|
|
13083
|
+
onMouseLeave: (event) => openAt(0, null),
|
|
13047
13084
|
children: /* @__PURE__ */ jsx("div", { className: "propeller-menu__panel-grid grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6", children: getSubCategories(l1)?.map((l2, idx2) => /* @__PURE__ */ jsxs("div", { className: "propeller-menu__group", "data-level": "2", children: [
|
|
13048
13085
|
/* @__PURE__ */ jsx(
|
|
13049
13086
|
"a",
|
|
@@ -13070,123 +13107,13 @@ function Menu(rawProps) {
|
|
|
13070
13107
|
]
|
|
13071
13108
|
}
|
|
13072
13109
|
) : null,
|
|
13073
|
-
!isLoading && !hasError && menuCategories.length > 0 ? /* @__PURE__ */ jsx(
|
|
13074
|
-
"
|
|
13110
|
+
!isLoading && !hasError && menuCategories.length > 0 ? /* @__PURE__ */ jsx(
|
|
13111
|
+
"nav",
|
|
13075
13112
|
{
|
|
13076
|
-
className:
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
13081
|
-
/* @__PURE__ */ jsx(
|
|
13082
|
-
"a",
|
|
13083
|
-
{
|
|
13084
|
-
className: "propeller-menu__link flex-1 px-4 py-3 text-sm font-medium text-foreground",
|
|
13085
|
-
href: getCategoryUrl(l1),
|
|
13086
|
-
onClick: (e) => handleItemClick(l1, e),
|
|
13087
|
-
children: /* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(l1) })
|
|
13088
|
-
}
|
|
13089
|
-
),
|
|
13090
|
-
getSubCategories(l1).length > 0 ? /* @__PURE__ */ jsx(
|
|
13091
|
-
"button",
|
|
13092
|
-
{
|
|
13093
|
-
type: "button",
|
|
13094
|
-
className: "propeller-menu__toggle px-4 py-3 text-muted-foreground",
|
|
13095
|
-
onClick: (event) => {
|
|
13096
|
-
setExpandedL1(expandedL1 === l1.categoryId ? null : l1.categoryId);
|
|
13097
|
-
},
|
|
13098
|
-
children: /* @__PURE__ */ jsx(
|
|
13099
|
-
"svg",
|
|
13100
|
-
{
|
|
13101
|
-
fill: "none",
|
|
13102
|
-
stroke: "currentColor",
|
|
13103
|
-
viewBox: "0 0 24 24",
|
|
13104
|
-
className: `propeller-menu__chevron w-4 h-4 transition-transform ${expandedL1 === l1.categoryId ? "rotate-180" : ""}`,
|
|
13105
|
-
children: /* @__PURE__ */ jsx(
|
|
13106
|
-
"path",
|
|
13107
|
-
{
|
|
13108
|
-
strokeLinecap: "round",
|
|
13109
|
-
strokeLinejoin: "round",
|
|
13110
|
-
d: "m6 9 6 6 6-6",
|
|
13111
|
-
strokeWidth: 2
|
|
13112
|
-
}
|
|
13113
|
-
)
|
|
13114
|
-
}
|
|
13115
|
-
)
|
|
13116
|
-
}
|
|
13117
|
-
) : null
|
|
13118
|
-
] }),
|
|
13119
|
-
expandedL1 === l1.categoryId && getSubCategories(l1).length > 0 ? /* @__PURE__ */ jsx("ul", { className: "propeller-menu__list bg-accent/30", "data-level": "2", children: getSubCategories(l1)?.map((l2, idx2) => /* @__PURE__ */ jsxs(
|
|
13120
|
-
"li",
|
|
13121
|
-
{
|
|
13122
|
-
className: "propeller-menu__item",
|
|
13123
|
-
"data-level": "2",
|
|
13124
|
-
"data-expanded": expandedL2 === l2.categoryId ? "true" : "false",
|
|
13125
|
-
children: [
|
|
13126
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
13127
|
-
/* @__PURE__ */ jsx(
|
|
13128
|
-
"a",
|
|
13129
|
-
{
|
|
13130
|
-
className: "propeller-menu__link flex-1 pl-8 pr-4 py-2.5 text-sm text-foreground",
|
|
13131
|
-
href: getCategoryUrl(l2),
|
|
13132
|
-
onClick: (e) => handleItemClick(l2, e),
|
|
13133
|
-
children: /* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(l2) })
|
|
13134
|
-
}
|
|
13135
|
-
),
|
|
13136
|
-
getSubCategories(l2).length > 0 ? /* @__PURE__ */ jsx(
|
|
13137
|
-
"button",
|
|
13138
|
-
{
|
|
13139
|
-
type: "button",
|
|
13140
|
-
className: "propeller-menu__toggle px-4 py-2.5 text-muted-foreground",
|
|
13141
|
-
onClick: (event) => {
|
|
13142
|
-
setExpandedL2(expandedL2 === l2.categoryId ? null : l2.categoryId);
|
|
13143
|
-
},
|
|
13144
|
-
children: /* @__PURE__ */ jsx(
|
|
13145
|
-
"svg",
|
|
13146
|
-
{
|
|
13147
|
-
fill: "none",
|
|
13148
|
-
stroke: "currentColor",
|
|
13149
|
-
viewBox: "0 0 24 24",
|
|
13150
|
-
className: `propeller-menu__chevron w-3.5 h-3.5 transition-transform ${expandedL2 === l2.categoryId ? "rotate-180" : ""}`,
|
|
13151
|
-
children: /* @__PURE__ */ jsx(
|
|
13152
|
-
"path",
|
|
13153
|
-
{
|
|
13154
|
-
strokeLinecap: "round",
|
|
13155
|
-
strokeLinejoin: "round",
|
|
13156
|
-
d: "m6 9 6 6 6-6",
|
|
13157
|
-
strokeWidth: 2
|
|
13158
|
-
}
|
|
13159
|
-
)
|
|
13160
|
-
}
|
|
13161
|
-
)
|
|
13162
|
-
}
|
|
13163
|
-
) : null
|
|
13164
|
-
] }),
|
|
13165
|
-
expandedL2 === l2.categoryId && getSubCategories(l2).length > 0 ? /* @__PURE__ */ jsx("ul", { className: "propeller-menu__list bg-accent/20", "data-level": "3", children: getSubCategories(l2)?.map((l3, idx3) => /* @__PURE__ */ jsx(
|
|
13166
|
-
"li",
|
|
13167
|
-
{
|
|
13168
|
-
className: "propeller-menu__item",
|
|
13169
|
-
"data-level": "3",
|
|
13170
|
-
children: /* @__PURE__ */ jsx(
|
|
13171
|
-
"a",
|
|
13172
|
-
{
|
|
13173
|
-
className: "propeller-menu__link block pl-12 pr-4 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
13174
|
-
href: getCategoryUrl(l3),
|
|
13175
|
-
onClick: (e) => handleItemClick(l3, e),
|
|
13176
|
-
children: /* @__PURE__ */ jsx("span", { className: "propeller-menu__label", children: getCategoryName(l3) })
|
|
13177
|
-
}
|
|
13178
|
-
)
|
|
13179
|
-
},
|
|
13180
|
-
`l3-mobile-${l3.categoryId}-${idx3}`
|
|
13181
|
-
)) }) : null
|
|
13182
|
-
]
|
|
13183
|
-
},
|
|
13184
|
-
`l2-mobile-${l2.categoryId}-${idx2}`
|
|
13185
|
-
)) }) : null
|
|
13186
|
-
]
|
|
13187
|
-
},
|
|
13188
|
-
`l1-mobile-${l1.categoryId}-${idx}`
|
|
13189
|
-
)) }) }) : null
|
|
13113
|
+
className: `propeller-menu__nav ${getMenuStyle() === "accordion" ? "block" : "md:hidden"} ${props.menuClass || ""}`,
|
|
13114
|
+
children: renderAccordion(menuCategories, 0)
|
|
13115
|
+
}
|
|
13116
|
+
) : null
|
|
13190
13117
|
]
|
|
13191
13118
|
}
|
|
13192
13119
|
);
|