@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.mjs CHANGED
@@ -4214,8 +4214,8 @@ var Sidebar = ({ isCollapse, children, ...props }) => {
4214
4214
  flexDirection: "column",
4215
4215
  overflow: "hidden",
4216
4216
  shadow: "raised",
4217
+ initial: { width: isCollapse ? "62px" : width },
4217
4218
  animate: { width: isCollapse ? "62px" : width },
4218
- transition: "10ms linear",
4219
4219
  ...props,
4220
4220
  children
4221
4221
  }
@@ -4254,9 +4254,9 @@ var SidebarHeader = ({ isCollapse, setCollapse, title }) => {
4254
4254
  {
4255
4255
  as: motion2.div,
4256
4256
  boxSize: "4",
4257
+ initial: { rotate: 0, x: 8 },
4257
4258
  animate: { rotate: isCollapse ? 0 : -180, x: isCollapse ? 8 : 0 },
4258
- transition: "ease-in-out",
4259
- transitionDuration: "1ms",
4259
+ transitionTimingFunction: "linear",
4260
4260
  "aria-label": "toggle sidebar",
4261
4261
  children: /* @__PURE__ */ jsx59(ArrowRight, { size: 4, color: "inherit" })
4262
4262
  }
@@ -4306,130 +4306,142 @@ import * as Icon8 from "@ctlyst.id/internal-icon";
4306
4306
  import { motion as motion3 } from "framer-motion";
4307
4307
  import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs26 } from "react/jsx-runtime";
4308
4308
  var SidebarMenu = ({ menu, isCollapse, mappingIcon: mappingIcon2, itemStyles, setActive, active }) => {
4309
- return /* @__PURE__ */ jsx60(Box28, { as: motion3.div, animate: { padding: isCollapse ? "8px 16px" : "8px" }, children: /* @__PURE__ */ jsx60(Accordion2, { index: menu.findIndex((item) => item.children.some((child) => child.navLink === active)), children: menu.map((item) => {
4310
- const isActive = active == null ? void 0 : active.includes(item.navLink);
4311
- return /* @__PURE__ */ jsx60(AccordionItem2, { mt: "4", children: ({ isExpanded }) => {
4312
- const isOpenOptions = isCollapse || !isCollapse && !isExpanded;
4313
- const noChild = !item.children.length;
4314
- const offsetStyle = isCollapse ? noChild ? [-5, 16] : [-1, 16] : [-1, 8];
4315
- return /* @__PURE__ */ jsxs26(Fragment9, { children: [
4316
- /* @__PURE__ */ jsx60(Popover6, { trigger: "hover", placement: "right-start", offset: offsetStyle, children: ({ isOpen, onClose }) => {
4317
- const activeOption = isOpen ? "primary.50" : "white";
4318
- const backgroundColor = isOpen && !isActive ? "primary.50" : "primary.100";
4319
- const activeParent = isActive ? backgroundColor : activeOption;
4309
+ return /* @__PURE__ */ jsx60(
4310
+ Box28,
4311
+ {
4312
+ as: motion3.div,
4313
+ transitionTimingFunction: "linear",
4314
+ initial: { padding: "8px" },
4315
+ animate: { padding: isCollapse ? "8px 16px" : "8px" },
4316
+ children: /* @__PURE__ */ jsx60(Accordion2, { index: menu.findIndex((item) => item.children.some((child) => child.navLink === active)), children: menu.map((item) => {
4317
+ const isActive = active == null ? void 0 : active.includes(item.navLink);
4318
+ return /* @__PURE__ */ jsx60(AccordionItem2, { mt: "4", children: ({ isExpanded }) => {
4319
+ const isOpenOptions = isCollapse || !isCollapse && !isExpanded;
4320
+ const noChild = !item.children.length;
4321
+ const offsetStyle = isCollapse ? noChild ? [-5, 16] : [-1, 16] : [-1, 8];
4320
4322
  return /* @__PURE__ */ jsxs26(Fragment9, { children: [
4321
- /* @__PURE__ */ jsx60(PopoverTrigger6, { children: /* @__PURE__ */ jsx60(
4322
- AccordionButton2,
4323
- {
4324
- "data-test-id": `CTA_button-accordion-${item.title}`,
4325
- p: "0",
4326
- h: "fit-content",
4327
- children: /* @__PURE__ */ jsxs26(
4323
+ /* @__PURE__ */ jsx60(Popover6, { trigger: "hover", placement: "right-start", offset: offsetStyle, children: ({ isOpen, onClose }) => {
4324
+ const activeOption = isOpen ? "primary.50" : "white";
4325
+ const backgroundColor = isOpen && !isActive ? "primary.50" : "primary.100";
4326
+ const activeParent = isActive ? backgroundColor : activeOption;
4327
+ return /* @__PURE__ */ jsxs26(Fragment9, { children: [
4328
+ /* @__PURE__ */ jsx60(PopoverTrigger6, { children: /* @__PURE__ */ jsx60(
4329
+ AccordionButton2,
4330
+ {
4331
+ "data-test-id": `CTA_button-accordion-${item.title}`,
4332
+ p: "0",
4333
+ h: "fit-content",
4334
+ children: /* @__PURE__ */ jsxs26(
4335
+ NavItem,
4336
+ {
4337
+ as: motion3.div,
4338
+ transitionTimingFunction: "linear",
4339
+ justifyContent: isCollapse ? "center" : "space-between",
4340
+ isActive,
4341
+ bg: activeParent,
4342
+ "data-test-id": `CTA_nav-item-${item.title}`,
4343
+ onClick: () => setActive(item.children.length > 0 ? item.children[0].navLink : item.navLink),
4344
+ position: "relative",
4345
+ ...itemStyles,
4346
+ children: [
4347
+ mappingIcon2 && /* @__PURE__ */ jsx60(Box28, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
4348
+ !isCollapse && /* @__PURE__ */ jsxs26(
4349
+ Box28,
4350
+ {
4351
+ display: "flex",
4352
+ w: "full",
4353
+ alignItems: "center",
4354
+ justifyContent: "space-between",
4355
+ ml: "2",
4356
+ as: motion3.div,
4357
+ transition: "20ms linear",
4358
+ transitionTimingFunction: "linear",
4359
+ initial: { opacity: 0, x: 24 },
4360
+ animate: { opacity: 1, x: 0 },
4361
+ exit: { opacity: 0, x: 16 },
4362
+ children: [
4363
+ /* @__PURE__ */ jsx60(Box28, { h: "3.5", position: "relative", children: /* @__PURE__ */ jsx60(Text16, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) }),
4364
+ !!item.children.length && /* @__PURE__ */ jsx60(
4365
+ Box28,
4366
+ {
4367
+ display: "flex",
4368
+ boxSize: "3",
4369
+ as: motion3.div,
4370
+ transitionTimingFunction: "linear",
4371
+ animate: { transform: isExpanded ? "rotate(-180deg)" : "rotate(0)" },
4372
+ children: /* @__PURE__ */ jsx60(Icon8.ChevronDown, { size: 3 })
4373
+ }
4374
+ )
4375
+ ]
4376
+ }
4377
+ )
4378
+ ]
4379
+ },
4380
+ item.id
4381
+ )
4382
+ },
4383
+ item.id
4384
+ ) }, item.id),
4385
+ isOpenOptions && /* @__PURE__ */ jsx60(Portal4, { children: item.children.length > 0 ? /* @__PURE__ */ jsxs26(PopoverContent6, { w: "176px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: [
4386
+ /* @__PURE__ */ jsx60(PopoverHeader2, { borderColor: "neutral.300", textStyle: "text.xs", p: "2", children: mappingIcon2 && /* @__PURE__ */ jsxs26(Box28, { display: "flex", alignItems: "center", children: [
4387
+ mappingIcon2.get(item.icon || ""),
4388
+ /* @__PURE__ */ jsx60(Box28, { as: "span", ml: "2", children: item.title })
4389
+ ] }) }),
4390
+ !!item.children.length && /* @__PURE__ */ jsx60(PopoverBody4, { pb: "1", px: "0", pt: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4391
+ NavItem,
4392
+ {
4393
+ "data-test-id": `CTA_Sidebar-popover-item-${submenu.id}`,
4394
+ isChild: true,
4395
+ isActive: active === submenu.navLink,
4396
+ onClick: () => {
4397
+ setActive(submenu.navLink);
4398
+ onClose();
4399
+ },
4400
+ rounded: "none",
4401
+ ...itemStyles,
4402
+ children: submenu.title
4403
+ },
4404
+ submenu.id
4405
+ )) })
4406
+ ] }) : isCollapse && /* @__PURE__ */ jsx60(PopoverContent6, { w: "174px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: /* @__PURE__ */ jsx60(PopoverBody4, { py: "1", px: "0", children: /* @__PURE__ */ jsxs26(
4328
4407
  NavItem,
4329
4408
  {
4330
- as: motion3.div,
4331
- justifyContent: isCollapse ? "center" : "space-between",
4332
- isActive,
4333
- bg: activeParent,
4334
- "data-test-id": `CTA_nav-item-${item.title}`,
4335
- onClick: () => setActive(item.children.length > 0 ? item.children[0].navLink : item.navLink),
4336
- position: "relative",
4409
+ "data-test-id": `CTA_Sidebar-popover-item-${item.id}`,
4410
+ justifyContent: "flex-start",
4411
+ isActive: active === item.navLink,
4412
+ onClick: () => {
4413
+ setActive(item.navLink);
4414
+ onClose();
4415
+ },
4416
+ rounded: "none",
4337
4417
  ...itemStyles,
4338
4418
  children: [
4339
4419
  mappingIcon2 && /* @__PURE__ */ jsx60(Box28, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
4340
- !isCollapse && /* @__PURE__ */ jsxs26(
4341
- Box28,
4342
- {
4343
- display: "flex",
4344
- w: "full",
4345
- alignItems: "center",
4346
- justifyContent: "space-between",
4347
- ml: "2",
4348
- as: motion3.div,
4349
- transition: "20ms ease-in",
4350
- initial: { opacity: 0, x: 24 },
4351
- animate: { opacity: 1, x: 0 },
4352
- exit: { opacity: 0, x: 16 },
4353
- children: [
4354
- /* @__PURE__ */ jsx60(Box28, { h: "3.5", position: "relative", children: /* @__PURE__ */ jsx60(Text16, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) }),
4355
- !!item.children.length && /* @__PURE__ */ jsx60(
4356
- Box28,
4357
- {
4358
- display: "flex",
4359
- boxSize: "3",
4360
- as: motion3.div,
4361
- animate: { transform: isExpanded ? "rotate(-180deg)" : "rotate(0)" },
4362
- children: /* @__PURE__ */ jsx60(Icon8.ChevronDown, { size: 3 })
4363
- }
4364
- )
4365
- ]
4366
- }
4367
- )
4420
+ /* @__PURE__ */ jsx60(Box28, { h: "3.5", position: "relative", ml: "2", children: /* @__PURE__ */ jsx60(Text16, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) })
4368
4421
  ]
4369
4422
  },
4370
4423
  item.id
4371
- )
4372
- },
4373
- item.id
4374
- ) }, item.id),
4375
- isOpenOptions && /* @__PURE__ */ jsx60(Portal4, { children: item.children.length > 0 ? /* @__PURE__ */ jsxs26(PopoverContent6, { w: "176px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: [
4376
- /* @__PURE__ */ jsx60(PopoverHeader2, { borderColor: "neutral.300", textStyle: "text.xs", p: "2", children: mappingIcon2 && /* @__PURE__ */ jsxs26(Box28, { display: "flex", alignItems: "center", children: [
4377
- mappingIcon2.get(item.icon || ""),
4378
- /* @__PURE__ */ jsx60(Box28, { as: "span", ml: "2", children: item.title })
4379
- ] }) }),
4380
- !!item.children.length && /* @__PURE__ */ jsx60(PopoverBody4, { pb: "1", px: "0", pt: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4381
- NavItem,
4382
- {
4383
- "data-test-id": `CTA_Sidebar-popover-item-${submenu.id}`,
4384
- isChild: true,
4385
- isActive: active === submenu.navLink,
4386
- onClick: () => {
4387
- setActive(submenu.navLink);
4388
- onClose();
4389
- },
4390
- rounded: "none",
4391
- ...itemStyles,
4392
- children: submenu.title
4393
- },
4394
- submenu.id
4395
- )) })
4396
- ] }) : isCollapse && /* @__PURE__ */ jsx60(PopoverContent6, { w: "174px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: /* @__PURE__ */ jsx60(PopoverBody4, { py: "1", px: "0", children: /* @__PURE__ */ jsxs26(
4424
+ ) }) }) })
4425
+ ] });
4426
+ } }, item.id),
4427
+ !isCollapse && /* @__PURE__ */ jsx60(AccordionPanel2, { mt: "1", p: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4397
4428
  NavItem,
4398
4429
  {
4399
- "data-test-id": `CTA_Sidebar-popover-item-${item.id}`,
4400
- justifyContent: "flex-start",
4401
- isActive: active === item.navLink,
4402
- onClick: () => {
4403
- setActive(item.navLink);
4404
- onClose();
4405
- },
4406
- rounded: "none",
4430
+ mt: "1",
4431
+ "data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
4432
+ isActive: active === submenu.navLink,
4433
+ isChild: true,
4407
4434
  ...itemStyles,
4408
- children: [
4409
- mappingIcon2 && /* @__PURE__ */ jsx60(Box28, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
4410
- /* @__PURE__ */ jsx60(Box28, { h: "3.5", position: "relative", ml: "2", children: /* @__PURE__ */ jsx60(Text16, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) })
4411
- ]
4435
+ onClick: () => setActive(submenu.navLink),
4436
+ children: submenu.title
4412
4437
  },
4413
- item.id
4414
- ) }) }) })
4438
+ submenu.id
4439
+ )) })
4415
4440
  ] });
4416
- } }, item.id),
4417
- !isCollapse && /* @__PURE__ */ jsx60(AccordionPanel2, { mt: "1", p: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4418
- NavItem,
4419
- {
4420
- mt: "1",
4421
- "data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
4422
- isActive: active === submenu.navLink,
4423
- isChild: true,
4424
- ...itemStyles,
4425
- onClick: () => setActive(submenu.navLink),
4426
- children: submenu.title
4427
- },
4428
- submenu.id
4429
- )) })
4430
- ] });
4431
- } }, item.id);
4432
- }) }) });
4441
+ } }, item.id);
4442
+ }) })
4443
+ }
4444
+ );
4433
4445
  };
4434
4446
  SidebarMenu.displayName = "SidebarMenu";
4435
4447
  SidebarMenu.defaultProps = {