@ctlyst.id/internal-ui 3.1.19 → 3.1.21

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/dist/index.mjs CHANGED
@@ -3825,9 +3825,11 @@ var selectStyle = {
3825
3825
  };
3826
3826
  function selectStyles(colorMode, _isError) {
3827
3827
  return {
3828
- control: (base, { isFocused }) => {
3828
+ control: (base, { isFocused, isMulti }) => {
3829
3829
  const style = {
3830
3830
  ...base,
3831
+ minHeight: 40,
3832
+ height: isMulti ? "fit-content" : 40,
3831
3833
  flexWrap: "nowrap",
3832
3834
  borderColor: isFocused ? "var(--chakra-colors-primary-500)" : "var(--chakra-colors-neutral-400)",
3833
3835
  boxShadow: "none",
@@ -3859,23 +3861,32 @@ function selectStyles(colorMode, _isError) {
3859
3861
  };
3860
3862
  },
3861
3863
  singleValue: (base) => {
3862
- return { ...base, ...selectStyle };
3864
+ return {
3865
+ ...base,
3866
+ ...selectStyle,
3867
+ marginLeft: 0
3868
+ };
3869
+ },
3870
+ input: (base) => {
3871
+ return {
3872
+ ...base,
3873
+ ...selectStyle,
3874
+ padding: 0,
3875
+ margin: 0
3876
+ };
3863
3877
  },
3864
- input: (base) => ({
3865
- ...base,
3866
- ...selectStyle,
3867
- paddingTop: 8,
3868
- paddingBottom: 8,
3869
- margin: 0
3870
- }),
3871
3878
  dropdownIndicator: (base) => {
3872
3879
  return { ...base, ...selectStyle, color: "var(--chakra-colors-neutral-400)" };
3873
3880
  },
3874
3881
  indicatorSeparator: (base) => {
3875
3882
  return { ...base, background: "var(--chakra-colors-neutral-400)", borderRadius: 10 };
3876
3883
  },
3877
- valueContainer: (base) => {
3878
- return { ...base, ...selectStyle, marginLeft: 0 };
3884
+ valueContainer: (base, { isMulti }) => {
3885
+ return {
3886
+ ...base,
3887
+ ...selectStyle,
3888
+ marginLeft: 0
3889
+ };
3879
3890
  },
3880
3891
  placeholder: (base) => {
3881
3892
  return { ...base, ...selectStyle, color: "var(--chakra-colors-black-low)", marginLeft: 0 };
@@ -4154,7 +4165,7 @@ var SelectWithCheckboxBase = ({
4154
4165
  );
4155
4166
  };
4156
4167
  var SelectCheckbox = (props) => {
4157
- const { isMulti, options, value, components, styles, ...rest } = props;
4168
+ const { isMulti, options, value, components, ...rest } = props;
4158
4169
  const selectValue = value || [];
4159
4170
  const defaultComponents = {
4160
4171
  DropdownIndicator,
@@ -4203,8 +4214,8 @@ var Sidebar = ({ isCollapse, children, ...props }) => {
4203
4214
  flexDirection: "column",
4204
4215
  overflow: "hidden",
4205
4216
  shadow: "raised",
4217
+ initial: { width: isCollapse ? "62px" : width },
4206
4218
  animate: { width: isCollapse ? "62px" : width },
4207
- transition: "10ms linear",
4208
4219
  ...props,
4209
4220
  children
4210
4221
  }
@@ -4243,9 +4254,9 @@ var SidebarHeader = ({ isCollapse, setCollapse, title }) => {
4243
4254
  {
4244
4255
  as: motion2.div,
4245
4256
  boxSize: "4",
4257
+ initial: { rotate: 0, x: 8 },
4246
4258
  animate: { rotate: isCollapse ? 0 : -180, x: isCollapse ? 8 : 0 },
4247
- transition: "ease-in-out",
4248
- transitionDuration: "1ms",
4259
+ transitionTimingFunction: "linear",
4249
4260
  "aria-label": "toggle sidebar",
4250
4261
  children: /* @__PURE__ */ jsx59(ArrowRight, { size: 4, color: "inherit" })
4251
4262
  }
@@ -4295,130 +4306,142 @@ import * as Icon8 from "@ctlyst.id/internal-icon";
4295
4306
  import { motion as motion3 } from "framer-motion";
4296
4307
  import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs26 } from "react/jsx-runtime";
4297
4308
  var SidebarMenu = ({ menu, isCollapse, mappingIcon: mappingIcon2, itemStyles, setActive, active }) => {
4298
- 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) => {
4299
- const isActive = active == null ? void 0 : active.includes(item.navLink);
4300
- return /* @__PURE__ */ jsx60(AccordionItem2, { mt: "4", children: ({ isExpanded }) => {
4301
- const isOpenOptions = isCollapse || !isCollapse && !isExpanded;
4302
- const noChild = !item.children.length;
4303
- const offsetStyle = isCollapse ? noChild ? [-5, 16] : [-1, 16] : [-1, 8];
4304
- return /* @__PURE__ */ jsxs26(Fragment9, { children: [
4305
- /* @__PURE__ */ jsx60(Popover6, { trigger: "hover", placement: "right-start", offset: offsetStyle, children: ({ isOpen, onClose }) => {
4306
- const activeOption = isOpen ? "primary.50" : "white";
4307
- const backgroundColor = isOpen && !isActive ? "primary.50" : "primary.100";
4308
- 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];
4309
4322
  return /* @__PURE__ */ jsxs26(Fragment9, { children: [
4310
- /* @__PURE__ */ jsx60(PopoverTrigger6, { children: /* @__PURE__ */ jsx60(
4311
- AccordionButton2,
4312
- {
4313
- "data-test-id": `CTA_button-accordion-${item.title}`,
4314
- p: "0",
4315
- h: "fit-content",
4316
- 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(
4317
4407
  NavItem,
4318
4408
  {
4319
- as: motion3.div,
4320
- justifyContent: isCollapse ? "center" : "space-between",
4321
- isActive,
4322
- bg: activeParent,
4323
- "data-test-id": `CTA_nav-item-${item.title}`,
4324
- onClick: () => setActive(item.children.length > 0 ? item.children[0].navLink : item.navLink),
4325
- 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",
4326
4417
  ...itemStyles,
4327
4418
  children: [
4328
4419
  mappingIcon2 && /* @__PURE__ */ jsx60(Box28, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
4329
- !isCollapse && /* @__PURE__ */ jsxs26(
4330
- Box28,
4331
- {
4332
- display: "flex",
4333
- w: "full",
4334
- alignItems: "center",
4335
- justifyContent: "space-between",
4336
- ml: "2",
4337
- as: motion3.div,
4338
- transition: "20ms ease-in",
4339
- initial: { opacity: 0, x: 24 },
4340
- animate: { opacity: 1, x: 0 },
4341
- exit: { opacity: 0, x: 16 },
4342
- children: [
4343
- /* @__PURE__ */ jsx60(Box28, { h: "3.5", position: "relative", children: /* @__PURE__ */ jsx60(Text16, { textStyle: "text.xs", w: "max-content", position: "absolute", children: item.title }) }),
4344
- !!item.children.length && /* @__PURE__ */ jsx60(
4345
- Box28,
4346
- {
4347
- display: "flex",
4348
- boxSize: "3",
4349
- as: motion3.div,
4350
- animate: { transform: isExpanded ? "rotate(-180deg)" : "rotate(0)" },
4351
- children: /* @__PURE__ */ jsx60(Icon8.ChevronDown, { size: 3 })
4352
- }
4353
- )
4354
- ]
4355
- }
4356
- )
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 }) })
4357
4421
  ]
4358
4422
  },
4359
4423
  item.id
4360
- )
4361
- },
4362
- item.id
4363
- ) }, item.id),
4364
- isOpenOptions && /* @__PURE__ */ jsx60(Portal4, { children: item.children.length > 0 ? /* @__PURE__ */ jsxs26(PopoverContent6, { w: "176px", borderColor: "neutral.200", bg: "white", rounded: "sm", children: [
4365
- /* @__PURE__ */ jsx60(PopoverHeader2, { borderColor: "neutral.300", textStyle: "text.xs", p: "2", children: mappingIcon2 && /* @__PURE__ */ jsxs26(Box28, { display: "flex", alignItems: "center", children: [
4366
- mappingIcon2.get(item.icon || ""),
4367
- /* @__PURE__ */ jsx60(Box28, { as: "span", ml: "2", children: item.title })
4368
- ] }) }),
4369
- !!item.children.length && /* @__PURE__ */ jsx60(PopoverBody4, { pb: "1", px: "0", pt: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4370
- NavItem,
4371
- {
4372
- "data-test-id": `CTA_Sidebar-popover-item-${submenu.id}`,
4373
- isChild: true,
4374
- isActive: active === submenu.navLink,
4375
- onClick: () => {
4376
- setActive(submenu.navLink);
4377
- onClose();
4378
- },
4379
- rounded: "none",
4380
- ...itemStyles,
4381
- children: submenu.title
4382
- },
4383
- submenu.id
4384
- )) })
4385
- ] }) : 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(
4386
4428
  NavItem,
4387
4429
  {
4388
- "data-test-id": `CTA_Sidebar-popover-item-${item.id}`,
4389
- justifyContent: "flex-start",
4390
- isActive: active === item.navLink,
4391
- onClick: () => {
4392
- setActive(item.navLink);
4393
- onClose();
4394
- },
4395
- rounded: "none",
4430
+ mt: "1",
4431
+ "data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
4432
+ isActive: active === submenu.navLink,
4433
+ isChild: true,
4396
4434
  ...itemStyles,
4397
- children: [
4398
- mappingIcon2 && /* @__PURE__ */ jsx60(Box28, { display: "flex", boxSize: "3", transition: "50ms linear", children: mappingIcon2.get(item.icon || "") }),
4399
- /* @__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 }) })
4400
- ]
4435
+ onClick: () => setActive(submenu.navLink),
4436
+ children: submenu.title
4401
4437
  },
4402
- item.id
4403
- ) }) }) })
4438
+ submenu.id
4439
+ )) })
4404
4440
  ] });
4405
- } }, item.id),
4406
- !isCollapse && /* @__PURE__ */ jsx60(AccordionPanel2, { mt: "1", p: "0", children: item.children.map((submenu) => /* @__PURE__ */ jsx60(
4407
- NavItem,
4408
- {
4409
- mt: "1",
4410
- "data-test-id": `CTA_Sidebar-accordion-item-${submenu.id}`,
4411
- isActive: active === submenu.navLink,
4412
- isChild: true,
4413
- ...itemStyles,
4414
- onClick: () => setActive(submenu.navLink),
4415
- children: submenu.title
4416
- },
4417
- submenu.id
4418
- )) })
4419
- ] });
4420
- } }, item.id);
4421
- }) }) });
4441
+ } }, item.id);
4442
+ }) })
4443
+ }
4444
+ );
4422
4445
  };
4423
4446
  SidebarMenu.displayName = "SidebarMenu";
4424
4447
  SidebarMenu.defaultProps = {