@ctlyst.id/internal-ui 3.1.20 → 3.1.21
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +125 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4400,8 +4400,8 @@ var Sidebar = ({ isCollapse, children, ...props }) => {
|
|
4400
4400
|
flexDirection: "column",
|
4401
4401
|
overflow: "hidden",
|
4402
4402
|
shadow: "raised",
|
4403
|
+
initial: { width: isCollapse ? "62px" : width },
|
4403
4404
|
animate: { width: isCollapse ? "62px" : width },
|
4404
|
-
transition: "10ms linear",
|
4405
4405
|
...props,
|
4406
4406
|
children
|
4407
4407
|
}
|
@@ -4440,9 +4440,9 @@ var SidebarHeader = ({ isCollapse, setCollapse, title }) => {
|
|
4440
4440
|
{
|
4441
4441
|
as: import_framer_motion2.motion.div,
|
4442
4442
|
boxSize: "4",
|
4443
|
+
initial: { rotate: 0, x: 8 },
|
4443
4444
|
animate: { rotate: isCollapse ? 0 : -180, x: isCollapse ? 8 : 0 },
|
4444
|
-
|
4445
|
-
transitionDuration: "1ms",
|
4445
|
+
transitionTimingFunction: "linear",
|
4446
4446
|
"aria-label": "toggle sidebar",
|
4447
4447
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_internal_icon8.ArrowRight, { size: 4, color: "inherit" })
|
4448
4448
|
}
|
@@ -4479,130 +4479,142 @@ var Icon8 = __toESM(require("@ctlyst.id/internal-icon"));
|
|
4479
4479
|
var import_framer_motion3 = require("framer-motion");
|
4480
4480
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
4481
4481
|
var SidebarMenu = ({ menu, isCollapse, mappingIcon: mappingIcon2, itemStyles, setActive, active }) => {
|
4482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
const
|
4482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4483
|
+
import_react76.Box,
|
4484
|
+
{
|
4485
|
+
as: import_framer_motion3.motion.div,
|
4486
|
+
transitionTimingFunction: "linear",
|
4487
|
+
initial: { padding: "8px" },
|
4488
|
+
animate: { padding: isCollapse ? "8px 16px" : "8px" },
|
4489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Accordion, { index: menu.findIndex((item) => item.children.some((child) => child.navLink === active)), children: menu.map((item) => {
|
4490
|
+
const isActive = active == null ? void 0 : active.includes(item.navLink);
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.AccordionItem, { mt: "4", children: ({ isExpanded }) => {
|
4492
|
+
const isOpenOptions = isCollapse || !isCollapse && !isExpanded;
|
4493
|
+
const noChild = !item.children.length;
|
4494
|
+
const offsetStyle = isCollapse ? noChild ? [-5, 16] : [-1, 16] : [-1, 8];
|
4493
4495
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
4494
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4496
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Popover, { trigger: "hover", placement: "right-start", offset: offsetStyle, children: ({ isOpen, onClose }) => {
|
4497
|
+
const activeOption = isOpen ? "primary.50" : "white";
|
4498
|
+
const backgroundColor = isOpen && !isActive ? "primary.50" : "primary.100";
|
4499
|
+
const activeParent = isActive ? backgroundColor : activeOption;
|
4500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4502
|
+
import_react76.AccordionButton,
|
4503
|
+
{
|
4504
|
+
"data-test-id": `CTA_button-accordion-${item.title}`,
|
4505
|
+
p: "0",
|
4506
|
+
h: "fit-content",
|
4507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
4508
|
+
NavItem,
|
4509
|
+
{
|
4510
|
+
as: import_framer_motion3.motion.div,
|
4511
|
+
transitionTimingFunction: "linear",
|
4512
|
+
justifyContent: isCollapse ? "center" : "space-between",
|
4513
|
+
isActive,
|
4514
|
+
bg: activeParent,
|
4515
|
+
"data-test-id": `CTA_nav-item-${item.title}`,
|
4516
|
+
onClick: () => setActive(item.children.length > 0 ? item.children[0].navLink : item.navLink),
|
4517
|
+
position: "relative",
|
4518
|
+
...itemStyles,
|
4519
|
+
children: [
|
4520
|
+
mappingIcon2 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
|
4521
|
+
!isCollapse && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
4522
|
+
import_react76.Box,
|
4523
|
+
{
|
4524
|
+
display: "flex",
|
4525
|
+
w: "full",
|
4526
|
+
alignItems: "center",
|
4527
|
+
justifyContent: "space-between",
|
4528
|
+
ml: "2",
|
4529
|
+
as: import_framer_motion3.motion.div,
|
4530
|
+
transition: "20ms linear",
|
4531
|
+
transitionTimingFunction: "linear",
|
4532
|
+
initial: { opacity: 0, x: 24 },
|
4533
|
+
animate: { opacity: 1, x: 0 },
|
4534
|
+
exit: { opacity: 0, x: 16 },
|
4535
|
+
children: [
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { h: "3.5", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Text, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) }),
|
4537
|
+
!!item.children.length && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4538
|
+
import_react76.Box,
|
4539
|
+
{
|
4540
|
+
display: "flex",
|
4541
|
+
boxSize: "3",
|
4542
|
+
as: import_framer_motion3.motion.div,
|
4543
|
+
transitionTimingFunction: "linear",
|
4544
|
+
animate: { transform: isExpanded ? "rotate(-180deg)" : "rotate(0)" },
|
4545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon8.ChevronDown, { size: 3 })
|
4546
|
+
}
|
4547
|
+
)
|
4548
|
+
]
|
4549
|
+
}
|
4550
|
+
)
|
4551
|
+
]
|
4552
|
+
},
|
4553
|
+
item.id
|
4554
|
+
)
|
4555
|
+
},
|
4556
|
+
item.id
|
4557
|
+
) }, item.id),
|
4558
|
+
isOpenOptions && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Portal, { children: item.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react76.PopoverContent, { w: "176px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: [
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverHeader, { borderColor: "neutral.300", textStyle: "text.xs", p: "2", children: mappingIcon2 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react76.Box, { display: "flex", alignItems: "center", children: [
|
4560
|
+
mappingIcon2.get(item.icon || ""),
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { as: "span", ml: "2", children: item.title })
|
4562
|
+
] }) }),
|
4563
|
+
!!item.children.length && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverBody, { pb: "1", px: "0", pt: "0", children: item.children.map((submenu) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4564
|
+
NavItem,
|
4565
|
+
{
|
4566
|
+
"data-test-id": `CTA_Sidebar-popover-item-${submenu.id}`,
|
4567
|
+
isChild: true,
|
4568
|
+
isActive: active === submenu.navLink,
|
4569
|
+
onClick: () => {
|
4570
|
+
setActive(submenu.navLink);
|
4571
|
+
onClose();
|
4572
|
+
},
|
4573
|
+
rounded: "none",
|
4574
|
+
...itemStyles,
|
4575
|
+
children: submenu.title
|
4576
|
+
},
|
4577
|
+
submenu.id
|
4578
|
+
)) })
|
4579
|
+
] }) : isCollapse && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverContent, { w: "174px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverBody, { py: "1", px: "0", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
4501
4580
|
NavItem,
|
4502
4581
|
{
|
4503
|
-
|
4504
|
-
justifyContent:
|
4505
|
-
isActive,
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4582
|
+
"data-test-id": `CTA_Sidebar-popover-item-${item.id}`,
|
4583
|
+
justifyContent: "flex-start",
|
4584
|
+
isActive: active === item.navLink,
|
4585
|
+
onClick: () => {
|
4586
|
+
setActive(item.navLink);
|
4587
|
+
onClose();
|
4588
|
+
},
|
4589
|
+
rounded: "none",
|
4510
4590
|
...itemStyles,
|
4511
4591
|
children: [
|
4512
4592
|
mappingIcon2 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
|
4513
|
-
|
4514
|
-
import_react76.Box,
|
4515
|
-
{
|
4516
|
-
display: "flex",
|
4517
|
-
w: "full",
|
4518
|
-
alignItems: "center",
|
4519
|
-
justifyContent: "space-between",
|
4520
|
-
ml: "2",
|
4521
|
-
as: import_framer_motion3.motion.div,
|
4522
|
-
transition: "20ms ease-in",
|
4523
|
-
initial: { opacity: 0, x: 24 },
|
4524
|
-
animate: { opacity: 1, x: 0 },
|
4525
|
-
exit: { opacity: 0, x: 16 },
|
4526
|
-
children: [
|
4527
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { h: "3.5", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Text, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) }),
|
4528
|
-
!!item.children.length && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4529
|
-
import_react76.Box,
|
4530
|
-
{
|
4531
|
-
display: "flex",
|
4532
|
-
boxSize: "3",
|
4533
|
-
as: import_framer_motion3.motion.div,
|
4534
|
-
animate: { transform: isExpanded ? "rotate(-180deg)" : "rotate(0)" },
|
4535
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon8.ChevronDown, { size: 3 })
|
4536
|
-
}
|
4537
|
-
)
|
4538
|
-
]
|
4539
|
-
}
|
4540
|
-
)
|
4593
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { h: "3.5", position: "relative", ml: "2", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Text, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) })
|
4541
4594
|
]
|
4542
4595
|
},
|
4543
4596
|
item.id
|
4544
|
-
)
|
4545
|
-
}
|
4546
|
-
|
4547
|
-
)
|
4548
|
-
isOpenOptions && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Portal, { children: item.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react76.PopoverContent, { w: "176px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: [
|
4549
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverHeader, { borderColor: "neutral.300", textStyle: "text.xs", p: "2", children: mappingIcon2 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react76.Box, { display: "flex", alignItems: "center", children: [
|
4550
|
-
mappingIcon2.get(item.icon || ""),
|
4551
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { as: "span", ml: "2", children: item.title })
|
4552
|
-
] }) }),
|
4553
|
-
!!item.children.length && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverBody, { pb: "1", px: "0", pt: "0", children: item.children.map((submenu) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4554
|
-
NavItem,
|
4555
|
-
{
|
4556
|
-
"data-test-id": `CTA_Sidebar-popover-item-${submenu.id}`,
|
4557
|
-
isChild: true,
|
4558
|
-
isActive: active === submenu.navLink,
|
4559
|
-
onClick: () => {
|
4560
|
-
setActive(submenu.navLink);
|
4561
|
-
onClose();
|
4562
|
-
},
|
4563
|
-
rounded: "none",
|
4564
|
-
...itemStyles,
|
4565
|
-
children: submenu.title
|
4566
|
-
},
|
4567
|
-
submenu.id
|
4568
|
-
)) })
|
4569
|
-
] }) : isCollapse && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverContent, { w: "174px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.PopoverBody, { py: "1", px: "0", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
4597
|
+
) }) }) })
|
4598
|
+
] });
|
4599
|
+
} }, item.id),
|
4600
|
+
!isCollapse && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.AccordionPanel, { mt: "1", p: "0", children: item.children.map((submenu) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
4570
4601
|
NavItem,
|
4571
4602
|
{
|
4572
|
-
"
|
4573
|
-
|
4574
|
-
isActive: active ===
|
4575
|
-
|
4576
|
-
setActive(item.navLink);
|
4577
|
-
onClose();
|
4578
|
-
},
|
4579
|
-
rounded: "none",
|
4603
|
+
mt: "1",
|
4604
|
+
"data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
|
4605
|
+
isActive: active === submenu.navLink,
|
4606
|
+
isChild: true,
|
4580
4607
|
...itemStyles,
|
4581
|
-
|
4582
|
-
|
4583
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Box, { h: "3.5", position: "relative", ml: "2", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react76.Text, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) })
|
4584
|
-
]
|
4608
|
+
onClick: () => setActive(submenu.navLink),
|
4609
|
+
children: submenu.title
|
4585
4610
|
},
|
4586
|
-
|
4587
|
-
)
|
4611
|
+
submenu.id
|
4612
|
+
)) })
|
4588
4613
|
] });
|
4589
|
-
} }, item.id)
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
mt: "1",
|
4594
|
-
"data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
|
4595
|
-
isActive: active === submenu.navLink,
|
4596
|
-
isChild: true,
|
4597
|
-
...itemStyles,
|
4598
|
-
onClick: () => setActive(submenu.navLink),
|
4599
|
-
children: submenu.title
|
4600
|
-
},
|
4601
|
-
submenu.id
|
4602
|
-
)) })
|
4603
|
-
] });
|
4604
|
-
} }, item.id);
|
4605
|
-
}) }) });
|
4614
|
+
} }, item.id);
|
4615
|
+
}) })
|
4616
|
+
}
|
4617
|
+
);
|
4606
4618
|
};
|
4607
4619
|
SidebarMenu.displayName = "SidebarMenu";
|
4608
4620
|
SidebarMenu.defaultProps = {
|