@ctlyst.id/internal-ui 3.0.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -11419,36 +11419,46 @@ import {
11419
11419
  import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text as Text18, TextProps } from "@chakra-ui/react";
11420
11420
 
11421
11421
  // src/components/toast/components/toast.tsx
11422
- import "react-toastify/dist/ReactToastify.css";
11423
11422
  import { chakra as chakra7, Flex as Flex16, Link as Link6, useToken } from "@chakra-ui/react";
11424
11423
  import { Bounce, toast } from "react-toastify";
11425
- import { jsx as jsx66, jsxs as jsxs28 } from "react/jsx-runtime";
11426
- var toastStyles = `
11427
- .Toastify__toast-container {
11428
- width: 380px;
11429
- }
11430
11424
 
11431
- .container-toast {
11432
- height: 64px;
11433
- width: 380px;
11434
- border-radius: 4px;
11435
- font-family: Poppins;
11436
- }
11425
+ // src/components/toast/components/styles.tsx
11426
+ import { Global as Global2 } from "@emotion/react";
11427
+ import { jsx as jsx66 } from "react/jsx-runtime";
11428
+ var Styles2 = () => {
11429
+ return /* @__PURE__ */ jsx66(
11430
+ Global2,
11431
+ {
11432
+ styles: `
11433
+ .Toastify__toast-container {
11434
+ width: 380px;
11435
+ }
11437
11436
 
11438
- @media (max-width: 480px) {
11439
- .container-toast {
11440
- margin: 16px !important;
11441
- width: calc(100% - 32px); /* Adjust width to fit within the margin */
11442
- }
11437
+ .container-toast {
11438
+ height: 64px;
11439
+ width: 380px;
11440
+ border-radius: 4px;
11441
+ font-family: Poppins;
11442
+ }
11443
11443
 
11444
- .Toastify__toast-container {
11445
- width: 100%;
11444
+ @media (max-width: 480px) {
11445
+ .container-toast {
11446
+ margin: 16px !important;
11447
+ width: calc(100% - 32px); /* Adjust width to fit within the margin */
11448
+ }
11449
+
11450
+ .Toastify__toast-container {
11451
+ width: 100%;
11452
+ }
11453
+ }
11454
+ `
11446
11455
  }
11447
- }
11448
- `;
11449
- var styleSheet = document.createElement("style");
11450
- styleSheet.innerText = toastStyles;
11451
- document.head.appendChild(styleSheet);
11456
+ );
11457
+ };
11458
+ var styles_default2 = Styles2;
11459
+
11460
+ // src/components/toast/components/toast.tsx
11461
+ import { Fragment as Fragment9, jsx as jsx67, jsxs as jsxs28 } from "react/jsx-runtime";
11452
11462
  var DEFAULT_OPTIONS = {
11453
11463
  position: "top-right",
11454
11464
  autoClose: 5e3,
@@ -11479,23 +11489,26 @@ var useToast = () => {
11479
11489
  "success.500"
11480
11490
  ]);
11481
11491
  const content = (icon, message, link) => {
11482
- return /* @__PURE__ */ jsxs28(Flex16, { justifyContent: "space-between", alignItems: "center", gap: 4, children: [
11483
- /* @__PURE__ */ jsxs28(Flex16, { alignItems: "center", children: [
11484
- icon && /* @__PURE__ */ jsx66(chakra7.span, { mr: 2, w: 4, h: 4, children: renderIcon(icon, "default") }),
11485
- /* @__PURE__ */ jsx66(chakra7.span, { noOfLines: 2, children: message })
11486
- ] }),
11487
- link && /* @__PURE__ */ jsx66(
11488
- Link6,
11489
- {
11490
- href: link.url,
11491
- textDecoration: "underline",
11492
- minW: "max-content",
11493
- textAlign: "right",
11494
- textStyle: "text.sm",
11495
- fontWeight: "semibold",
11496
- children: link.label
11497
- }
11498
- )
11492
+ return /* @__PURE__ */ jsxs28(Fragment9, { children: [
11493
+ /* @__PURE__ */ jsx67(styles_default2, {}),
11494
+ /* @__PURE__ */ jsxs28(Flex16, { justifyContent: "space-between", alignItems: "center", gap: 4, children: [
11495
+ /* @__PURE__ */ jsxs28(Flex16, { alignItems: "center", children: [
11496
+ icon && /* @__PURE__ */ jsx67(chakra7.span, { mr: 2, w: 4, h: 4, children: renderIcon(icon, "default") }),
11497
+ /* @__PURE__ */ jsx67(chakra7.span, { noOfLines: 2, children: message })
11498
+ ] }),
11499
+ link && /* @__PURE__ */ jsx67(
11500
+ Link6,
11501
+ {
11502
+ href: link.url,
11503
+ textDecoration: "underline",
11504
+ minW: "max-content",
11505
+ textAlign: "right",
11506
+ textStyle: "text.sm",
11507
+ fontWeight: "semibold",
11508
+ children: link.label
11509
+ }
11510
+ )
11511
+ ] })
11499
11512
  ] });
11500
11513
  };
11501
11514
  return {
@@ -11571,17 +11584,17 @@ import {
11571
11584
  Portal as Portal4,
11572
11585
  Tooltip as ChakraTooltip
11573
11586
  } from "@chakra-ui/react";
11574
- import { jsx as jsx67, jsxs as jsxs29 } from "react/jsx-runtime";
11587
+ import { jsx as jsx68, jsxs as jsxs29 } from "react/jsx-runtime";
11575
11588
  var Tooltip = (props) => {
11576
11589
  const { children, bg = "neutral.700", textStyle = "text.sm", color: color2 = "white" } = props;
11577
11590
  const content = /* @__PURE__ */ jsxs29(PopoverContent6, { border: "none", bg, textStyle, borderRadius: props.borderRadius, children: [
11578
- props.hasArrow && /* @__PURE__ */ jsx67(PopoverArrow3, { color: color2, bg }),
11579
- /* @__PURE__ */ jsx67(PopoverBody4, { color: color2, ...props, children: props.label })
11591
+ props.hasArrow && /* @__PURE__ */ jsx68(PopoverArrow3, { color: color2, bg }),
11592
+ /* @__PURE__ */ jsx68(PopoverBody4, { color: color2, ...props, children: props.label })
11580
11593
  ] });
11581
11594
  return props.isInteractive === true ? /* @__PURE__ */ jsxs29(Popover6, { trigger: "hover", placement: props.placement, children: [
11582
- /* @__PURE__ */ jsx67(PopoverTrigger6, { children }),
11583
- props.portal ? /* @__PURE__ */ jsx67(Portal4, { children: content }) : content
11584
- ] }) : /* @__PURE__ */ jsx67(ChakraTooltip, { ...props, children });
11595
+ /* @__PURE__ */ jsx68(PopoverTrigger6, { children }),
11596
+ props.portal ? /* @__PURE__ */ jsx68(Portal4, { children: content }) : content
11597
+ ] }) : /* @__PURE__ */ jsx68(ChakraTooltip, { ...props, children });
11585
11598
  };
11586
11599
 
11587
11600
  // src/components/uploader/components/uploader.tsx
@@ -11629,7 +11642,7 @@ var concatList = (list) => {
11629
11642
  var formatValidationMessage = (extension) => `Foto harus dalam format ${concatList(extension.map((ext) => `.${ext}`))}.`;
11630
11643
 
11631
11644
  // src/components/uploader/components/uploader.tsx
11632
- import { Fragment as Fragment9, jsx as jsx68, jsxs as jsxs30 } from "react/jsx-runtime";
11645
+ import { Fragment as Fragment10, jsx as jsx69, jsxs as jsxs30 } from "react/jsx-runtime";
11633
11646
  import { createElement as createElement6 } from "react";
11634
11647
  var Uploader = ({
11635
11648
  onHandleUploadFile,
@@ -11718,11 +11731,11 @@ var Uploader = ({
11718
11731
  });
11719
11732
  const renderHelperText = () => {
11720
11733
  if (Array.isArray(helperText)) {
11721
- return /* @__PURE__ */ jsx68(UnorderedList2, { pl: 2, fontSize: 12, color: "gray.600", "data-test-id": "CT_component_base-image-uploader_helperText", children: helperText.map((text2) => /* @__PURE__ */ jsx68(ListItem2, { children: text2 }, text2)) });
11734
+ return /* @__PURE__ */ jsx69(UnorderedList2, { pl: 2, fontSize: 12, color: "gray.600", "data-test-id": "CT_component_base-image-uploader_helperText", children: helperText.map((text2) => /* @__PURE__ */ jsx69(ListItem2, { children: text2 }, text2)) });
11722
11735
  }
11723
11736
  return helperText;
11724
11737
  };
11725
- const renderErrorText = (text2) => /* @__PURE__ */ jsx68(Box29, { mb: 2, children: /* @__PURE__ */ jsx68(Text19, { textStyle: "text.xs", color: "danger.500", children: text2 }) });
11738
+ const renderErrorText = (text2) => /* @__PURE__ */ jsx69(Box29, { mb: 2, children: /* @__PURE__ */ jsx69(Text19, { textStyle: "text.xs", color: "danger.500", children: text2 }) });
11726
11739
  const handleRemove = (e) => {
11727
11740
  e.stopPropagation();
11728
11741
  setFilePreview(void 0);
@@ -11748,8 +11761,8 @@ var Uploader = ({
11748
11761
  return /* @__PURE__ */ jsxs30(FormControl4, { isRequired, children: [
11749
11762
  label && typeof label === "string" ? (
11750
11763
  // eslint-disable-next-line react/jsx-no-useless-fragment
11751
- /* @__PURE__ */ jsxs30(FormLabel4, { requiredIndicator: /* @__PURE__ */ jsx68(Fragment9, {}), fontSize: "text.sm", children: [
11752
- isRequired && /* @__PURE__ */ jsx68(RequiredIndicator2, { mr: 1, ml: 0 }),
11764
+ /* @__PURE__ */ jsxs30(FormLabel4, { requiredIndicator: /* @__PURE__ */ jsx69(Fragment10, {}), fontSize: "text.sm", children: [
11765
+ isRequired && /* @__PURE__ */ jsx69(RequiredIndicator2, { mr: 1, ml: 0 }),
11753
11766
  label
11754
11767
  ] })
11755
11768
  ) : label,
@@ -11771,7 +11784,7 @@ var Uploader = ({
11771
11784
  ...props,
11772
11785
  ...getRootProps(),
11773
11786
  children: [
11774
- filePreview && isShowCloseButton && /* @__PURE__ */ jsx68(Box29, { position: "absolute", top: 1, right: 1, children: /* @__PURE__ */ jsx68(
11787
+ filePreview && isShowCloseButton && /* @__PURE__ */ jsx69(Box29, { position: "absolute", top: 1, right: 1, children: /* @__PURE__ */ jsx69(
11775
11788
  Button7,
11776
11789
  {
11777
11790
  "data-test-id": `CT_component_base-image-uploader_remove-image${testId ? `_${testId}` : ""}`,
@@ -11786,17 +11799,17 @@ var Uploader = ({
11786
11799
  border: "none",
11787
11800
  zIndex: 1,
11788
11801
  onClick: handleRemove,
11789
- children: /* @__PURE__ */ jsx68(X, { size: 3, color: "white" })
11802
+ children: /* @__PURE__ */ jsx69(X, { size: 3, color: "white" })
11790
11803
  }
11791
11804
  ) }),
11792
- filePreview && /* @__PURE__ */ jsx68(Box29, { w: "full", children: /* @__PURE__ */ jsx68(
11805
+ filePreview && /* @__PURE__ */ jsx69(Box29, { w: "full", children: /* @__PURE__ */ jsx69(
11793
11806
  Flex17,
11794
11807
  {
11795
11808
  position: "relative",
11796
11809
  "data-test-id": `CT_component_base-image-uploader_image-preview${testId ? `_${testId}` : ""}`,
11797
11810
  justify: "center",
11798
11811
  align: "center",
11799
- children: /* @__PURE__ */ jsx68(
11812
+ children: /* @__PURE__ */ jsx69(
11800
11813
  ChakraImage,
11801
11814
  {
11802
11815
  h: size2 === "lg" ? "120" : "100",
@@ -11807,18 +11820,18 @@ var Uploader = ({
11807
11820
  )
11808
11821
  }
11809
11822
  ) }),
11810
- !filePreview && /* @__PURE__ */ jsxs30(Fragment9, { children: [
11811
- /* @__PURE__ */ jsx68(
11823
+ !filePreview && /* @__PURE__ */ jsxs30(Fragment10, { children: [
11824
+ /* @__PURE__ */ jsx69(
11812
11825
  "input",
11813
11826
  {
11814
11827
  "data-test-id": `CT_component_base-image-uploader_input-file${testId ? `_${testId}` : ""}`,
11815
11828
  ...getInputProps()
11816
11829
  }
11817
11830
  ),
11818
- isDragActive2 ? /* @__PURE__ */ jsx68(Text19, { children: dragActiveText != null ? dragActiveText : messages.dragActive }) : /* @__PURE__ */ jsxs30(Flex17, { gap: 2, flexDirection: "column", alignItems: "center", color: isError ? "danger.500" : color2, children: [
11819
- size2 === "sm" && /* @__PURE__ */ jsx68(Plus, { size: 6, color: color2 }),
11831
+ isDragActive2 ? /* @__PURE__ */ jsx69(Text19, { children: dragActiveText != null ? dragActiveText : messages.dragActive }) : /* @__PURE__ */ jsxs30(Flex17, { gap: 2, flexDirection: "column", alignItems: "center", color: isError ? "danger.500" : color2, children: [
11832
+ size2 === "sm" && /* @__PURE__ */ jsx69(Plus, { size: 6, color: color2 }),
11820
11833
  /* @__PURE__ */ jsxs30(Box29, { children: [
11821
- !filePreview && /* @__PURE__ */ jsx68(
11834
+ !filePreview && /* @__PURE__ */ jsx69(
11822
11835
  Heading2,
11823
11836
  {
11824
11837
  fontWeight: "400",
@@ -11828,7 +11841,7 @@ var Uploader = ({
11828
11841
  children: uploadFileText && size2 === "lg" ? messages.uploadFile : "Upload"
11829
11842
  }
11830
11843
  ),
11831
- size2 === "lg" && /* @__PURE__ */ jsx68(Text19, { fontSize: 12, children: filePreview ? dragReplaceText != null ? dragReplaceText : messages.dragReplace : dragInActiveText != null ? dragInActiveText : messages.dragInActive })
11844
+ size2 === "lg" && /* @__PURE__ */ jsx69(Text19, { fontSize: 12, children: filePreview ? dragReplaceText != null ? dragReplaceText : messages.dragReplace : dragInActiveText != null ? dragInActiveText : messages.dragInActive })
11832
11845
  ] })
11833
11846
  ] })
11834
11847
  ] })
@@ -11846,7 +11859,7 @@ var Uploader = ({
11846
11859
  "data-test-id": `CT_component_base-image-uploader_change-img${testId ? `_${testId}` : ""}`
11847
11860
  }
11848
11861
  ),
11849
- isShowReupload && /* @__PURE__ */ jsx68(
11862
+ isShowReupload && /* @__PURE__ */ jsx69(
11850
11863
  Button7,
11851
11864
  {
11852
11865
  "data-test-id": `CT_component_base-image-uploader_change-img-btn${testId ? `_${testId}` : ""}`,
@@ -13492,7 +13505,7 @@ import { useMemo as useMemo9 } from "react";
13492
13505
  import axios from "axios";
13493
13506
  import { createContext as createContext8, useContext as useContext14, useEffect as useEffect13, useMemo as useMemo8, useRef as useRef10 } from "react";
13494
13507
  import { ToastContainer as ToastContainer2 } from "react-toastify";
13495
- import { jsx as jsx69, jsxs as jsxs31 } from "react/jsx-runtime";
13508
+ import { jsx as jsx70, jsxs as jsxs31 } from "react/jsx-runtime";
13496
13509
  var ProviderContext = createContext8({
13497
13510
  instance: void 0
13498
13511
  });
@@ -13512,7 +13525,7 @@ var Provider = ({ children, config: config2, requestInterceptors, responseInterc
13512
13525
  }, [requestInterceptors, responseInterceptors]);
13513
13526
  const provider = useMemo8(() => ({ instance: instanceRef.current }), []);
13514
13527
  return /* @__PURE__ */ jsxs31(ProviderContext.Provider, { value: provider, children: [
13515
- /* @__PURE__ */ jsx69(ToastContainer2, {}),
13528
+ /* @__PURE__ */ jsx70(ToastContainer2, {}),
13516
13529
  children
13517
13530
  ] });
13518
13531
  };