fix sidebar
This commit is contained in:
parent
685774b577
commit
048ff94051
45
dist/layout.js
vendored
45
dist/layout.js
vendored
@ -150,12 +150,12 @@ const SA = Object.assign(CA, {
|
|||||||
Title: uA,
|
Title: uA,
|
||||||
Description: xA,
|
Description: xA,
|
||||||
Bi: mA
|
Bi: mA
|
||||||
}), E = (o = "") => {
|
}), N = (o = "") => {
|
||||||
const A = String(o).split(/[?#]/)[0] || "";
|
const A = String(o).split(/[?#]/)[0] || "";
|
||||||
return !A || A === "/" ? A || "/" : A.replace(/\/+$/, "");
|
return !A || A === "/" ? A || "/" : A.replace(/\/+$/, "");
|
||||||
}, P = (o, A) => {
|
}, P = (o, A) => {
|
||||||
const t = E(o);
|
const t = N(o);
|
||||||
return [A == null ? void 0 : A.path, ...(A == null ? void 0 : A.aliases) || []].filter(Boolean).map(E).some(
|
return [A == null ? void 0 : A.path, ...(A == null ? void 0 : A.aliases) || []].filter(Boolean).map(N).some(
|
||||||
(l) => t === l || t.startsWith(`${l}/`)
|
(l) => t === l || t.startsWith(`${l}/`)
|
||||||
);
|
);
|
||||||
}, MA = (o = [], A) => o.find((t) => P(A, t)), G = aA(
|
}, MA = (o = [], A) => o.find((t) => P(A, t)), G = aA(
|
||||||
@ -171,8 +171,25 @@ const RA = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const a = {
|
const a = {
|
||||||
variant: "ghost",
|
variant: "ghost",
|
||||||
bg: A ? "gray.200" : "transparent",
|
position: "relative",
|
||||||
mx: A ? 2 : 0,
|
bg: "transparent",
|
||||||
|
_before: A ? {
|
||||||
|
content: '""',
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
insetInlineStart: "8px",
|
||||||
|
insetInlineEnd: "8px",
|
||||||
|
bg: "gray.200",
|
||||||
|
borderRadius: "md",
|
||||||
|
zIndex: 0
|
||||||
|
} : void 0,
|
||||||
|
sx: {
|
||||||
|
"> svg": {
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
icon: /* @__PURE__ */ e(d, { as: o.icon }),
|
icon: /* @__PURE__ */ e(d, { as: o.icon }),
|
||||||
fontSize: "xl",
|
fontSize: "xl",
|
||||||
size: { base: "sm", lg: "lg" },
|
size: { base: "sm", lg: "lg" },
|
||||||
@ -285,9 +302,9 @@ const RA = ({
|
|||||||
mobileProps: O
|
mobileProps: O
|
||||||
}) => {
|
}) => {
|
||||||
var k, Y;
|
var k, Y;
|
||||||
const { isOpen: L, onOpen: V, onClose: m } = J(), W = rA(), { cannot: U } = cA(), I = gA.toArray(l).find(
|
const { isOpen: L, onOpen: V, onClose: m } = J(), v = rA(), { cannot: U } = cA(), I = gA.toArray(l).find(
|
||||||
(n) => lA(n) && n.type === B
|
(n) => lA(n) && n.type === B
|
||||||
), R = !!I, f = ((k = I == null ? void 0 : I.props) == null ? void 0 : k.title) || "خروج", v = ((Y = I == null ? void 0 : I.props) == null ? void 0 : Y.icon) || IA, H = A ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : ""), X = o.slice(0, a), w = o.slice(a), y = (n) => (Array.isArray(n == null ? void 0 : n.perm) ? n.perm : [n == null ? void 0 : n.perm]).filter(Boolean).some((i) => U(i)), p = (n) => P(H, n), D = w.some(p), S = w.length > 0 || R, M = (n) => {
|
), R = !!I, f = ((k = I == null ? void 0 : I.props) == null ? void 0 : k.title) || "خروج", W = ((Y = I == null ? void 0 : I.props) == null ? void 0 : Y.icon) || IA, H = A ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : ""), X = o.slice(0, a), w = o.slice(a), y = (n) => (Array.isArray(n == null ? void 0 : n.perm) ? n.perm : [n == null ? void 0 : n.perm]).filter(Boolean).some((i) => U(i)), p = (n) => P(H, n), D = w.some(p), S = w.length > 0 || R, M = (n) => {
|
||||||
r == null || r(n), m();
|
r == null || r(n), m();
|
||||||
}, z = () => {
|
}, z = () => {
|
||||||
m(), sA();
|
m(), sA();
|
||||||
@ -338,7 +355,7 @@ const RA = ({
|
|||||||
Z,
|
Z,
|
||||||
{
|
{
|
||||||
variant: "ghost",
|
variant: "ghost",
|
||||||
icon: /* @__PURE__ */ e(d, { as: v }),
|
icon: /* @__PURE__ */ e(d, { as: W }),
|
||||||
fontSize: "xl",
|
fontSize: "xl",
|
||||||
size: { base: "sm", lg: "lg" },
|
size: { base: "sm", lg: "lg" },
|
||||||
"aria-label": f,
|
"aria-label": f,
|
||||||
@ -382,7 +399,7 @@ const RA = ({
|
|||||||
c,
|
c,
|
||||||
{
|
{
|
||||||
as: "button",
|
as: "button",
|
||||||
ref: W,
|
ref: v,
|
||||||
type: "button",
|
type: "button",
|
||||||
flex: "1",
|
flex: "1",
|
||||||
minW: 0,
|
minW: 0,
|
||||||
@ -432,7 +449,7 @@ const RA = ({
|
|||||||
isOpen: L,
|
isOpen: L,
|
||||||
placement: "bottom",
|
placement: "bottom",
|
||||||
onClose: m,
|
onClose: m,
|
||||||
finalFocusRef: W,
|
finalFocusRef: v,
|
||||||
children: [
|
children: [
|
||||||
/* @__PURE__ */ e($, {}),
|
/* @__PURE__ */ e($, {}),
|
||||||
/* @__PURE__ */ g(
|
/* @__PURE__ */ g(
|
||||||
@ -446,7 +463,7 @@ const RA = ({
|
|||||||
/* @__PURE__ */ e(eA, { borderBottomWidth: "1px", fontSize: "md", children: x }),
|
/* @__PURE__ */ e(eA, { borderBottomWidth: "1px", fontSize: "md", children: x }),
|
||||||
/* @__PURE__ */ g(oA, { py: 4, overflowY: "auto", children: [
|
/* @__PURE__ */ g(oA, { py: 4, overflowY: "auto", children: [
|
||||||
/* @__PURE__ */ e(nA, { columns: 4, spacing: 2, children: w.map((n) => {
|
/* @__PURE__ */ e(nA, { columns: 4, spacing: 2, children: w.map((n) => {
|
||||||
const h = y(n), i = p(n), N = /* @__PURE__ */ g(
|
const h = y(n), i = p(n), E = /* @__PURE__ */ g(
|
||||||
C,
|
C,
|
||||||
{
|
{
|
||||||
h: "70px",
|
h: "70px",
|
||||||
@ -482,7 +499,7 @@ const RA = ({
|
|||||||
{
|
{
|
||||||
"aria-disabled": h ? "true" : void 0,
|
"aria-disabled": h ? "true" : void 0,
|
||||||
"aria-current": i ? "page" : void 0,
|
"aria-current": i ? "page" : void 0,
|
||||||
children: N
|
children: E
|
||||||
},
|
},
|
||||||
n.path
|
n.path
|
||||||
) : /* @__PURE__ */ e(
|
) : /* @__PURE__ */ e(
|
||||||
@ -493,7 +510,7 @@ const RA = ({
|
|||||||
_hover: { textDecoration: "none" },
|
_hover: { textDecoration: "none" },
|
||||||
onClick: () => M(n),
|
onClick: () => M(n),
|
||||||
"aria-current": i ? "page" : void 0,
|
"aria-current": i ? "page" : void 0,
|
||||||
children: N
|
children: E
|
||||||
},
|
},
|
||||||
n.path
|
n.path
|
||||||
);
|
);
|
||||||
@ -513,7 +530,7 @@ const RA = ({
|
|||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
onClick: z,
|
onClick: z,
|
||||||
children: [
|
children: [
|
||||||
/* @__PURE__ */ e(d, { as: v, boxSize: 5 }),
|
/* @__PURE__ */ e(d, { as: W, boxSize: 5 }),
|
||||||
/* @__PURE__ */ e(s, { fontWeight: "bold", children: f })
|
/* @__PURE__ */ e(s, { fontWeight: "bold", children: f })
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,8 +70,30 @@ const DesktopNavItem = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const commonProps = {
|
const commonProps = {
|
||||||
variant: "ghost",
|
variant: "ghost",
|
||||||
bg: isActive ? "gray.200" : "transparent",
|
position: "relative",
|
||||||
mx: isActive ? 2 : 0,
|
bg: "transparent",
|
||||||
|
|
||||||
|
_before: isActive
|
||||||
|
? {
|
||||||
|
content: '""',
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
insetInlineStart: "8px",
|
||||||
|
insetInlineEnd: "8px",
|
||||||
|
bg: "gray.200",
|
||||||
|
borderRadius: "md",
|
||||||
|
zIndex: 0,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
|
||||||
|
sx: {
|
||||||
|
"> svg": {
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
icon: <Icon as={item.icon} />,
|
icon: <Icon as={item.icon} />,
|
||||||
fontSize: "xl",
|
fontSize: "xl",
|
||||||
size: { base: "sm", lg: "lg" },
|
size: { base: "sm", lg: "lg" },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user