@ctlyst.id/internal-ui 2.1.13 → 2.1.14

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -913,14 +913,40 @@ var getCommonPinningStyles = (column) => {
913
913
  const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
914
914
  const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
915
915
  return {
916
- // eslint-disable-next-line no-nested-ternary
917
- boxShadow: isLastLeftPinnedColumn ? "-4px 0 4px -4px gray inset" : isFirstRightPinnedColumn ? "4px 0 4px -4px gray inset" : void 0,
918
916
  left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
919
917
  right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
920
- opacity: isPinned ? 0.95 : 1,
921
918
  position: isPinned ? "sticky" : "relative",
922
919
  width: column.getSize(),
923
- zIndex: isPinned ? 1 : 0
920
+ zIndex: isPinned ? 1 : 0,
921
+ backgroundColor: "white",
922
+ ...isLastLeftPinnedColumn ? {
923
+ padding: 0,
924
+ "&:after": {
925
+ content: "''",
926
+ position: "absolute",
927
+ width: "20%",
928
+ height: "100%",
929
+ right: "0px",
930
+ top: 0,
931
+ zIndex: -1,
932
+ boxShadow: "-10px 0px 20px 10px #00000010",
933
+ clipPath: "inset(0px -38px 0px 0px)"
934
+ }
935
+ } : {},
936
+ ...isFirstRightPinnedColumn ? {
937
+ padding: "0px 0px 0px 8px",
938
+ "&:after": {
939
+ content: "''",
940
+ position: "absolute",
941
+ width: "20%",
942
+ height: "100%",
943
+ left: "0%",
944
+ top: 0,
945
+ zIndex: -1,
946
+ boxShadow: "10px 0px 20px 10px #00000010",
947
+ clipPath: "inset(0px 0px 0px -38px )"
948
+ }
949
+ } : {}
924
950
  };
925
951
  };
926
952
  var useDataTable = ({
@@ -1017,12 +1043,12 @@ var useDataTable = ({
1017
1043
  };
1018
1044
  };
1019
1045
  var DataTable = React5.forwardRef((props, ref) => {
1020
- const { isLoading, styles, headerSticky, onRowClick } = props;
1046
+ const { isLoading, styles, headerSticky, onRowClick, container } = props;
1021
1047
  const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
1022
1048
  React5.useImperativeHandle(ref, () => ({
1023
1049
  toggleAllRowsSelected
1024
1050
  }));
1025
- return /* @__PURE__ */ jsxs9(Box12, { ...props, children: [
1051
+ return /* @__PURE__ */ jsxs9(Box12, { overflowX: "auto", position: "relative", maxW: "100%", minH: 400, w: "full", ...container, children: [
1026
1052
  isLoading && /* @__PURE__ */ jsxs9(Table, { ...styles == null ? void 0 : styles.table, children: [
1027
1053
  /* @__PURE__ */ jsx23(Thead, { ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx23(Tr, { mx: "2", ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => /* @__PURE__ */ jsx23(
1028
1054
  Th,
@@ -1053,11 +1079,13 @@ var DataTable = React5.forwardRef((props, ref) => {
1053
1079
  {
1054
1080
  colSpan: header.colSpan,
1055
1081
  width: `${header.getSize() + (index === 0 || index === headerGroup.headers.length - 1 ? 16 : 0)}px`,
1056
- style: { ...getCommonPinningStyles(header.column) },
1082
+ sx: getCommonPinningStyles(header.column),
1057
1083
  ...styles == null ? void 0 : styles.tableColumnHeader,
1058
1084
  children: /* @__PURE__ */ jsxs9(
1059
1085
  Flex,
1060
1086
  {
1087
+ backgroundColor: "white",
1088
+ height: "100%",
1061
1089
  "data-test-id": `CT_Container_TableHeader_${header.id}`,
1062
1090
  textTransform: "capitalize",
1063
1091
  userSelect: "none",
@@ -1120,9 +1148,9 @@ var DataTable = React5.forwardRef((props, ref) => {
1120
1148
  "data-test-id": `CT_Component_TableCell_${cell.id}`,
1121
1149
  fontSize: "text.sm",
1122
1150
  color: useColorModeValue("dark.800", "dark.300"),
1123
- style: { ...getCommonPinningStyles(cell.column) },
1151
+ sx: getCommonPinningStyles(cell.column),
1124
1152
  ...styles == null ? void 0 : styles.tableCell,
1125
- children: /* @__PURE__ */ jsx23(
1153
+ children: /* @__PURE__ */ jsx23(Flex, { height: "100%", backgroundColor: "white", align: "center", children: /* @__PURE__ */ jsx23(
1126
1154
  Box12,
1127
1155
  {
1128
1156
  tabIndex: 0,
@@ -1136,7 +1164,7 @@ var DataTable = React5.forwardRef((props, ref) => {
1136
1164
  },
1137
1165
  children: flexRender(cell.column.columnDef.cell, cell.getContext())
1138
1166
  }
1139
- )
1167
+ ) })
1140
1168
  },
1141
1169
  cell.id
1142
1170
  ))
@@ -1148,12 +1176,8 @@ var DataTable = React5.forwardRef((props, ref) => {
1148
1176
  ] });
1149
1177
  });
1150
1178
  DataTable.defaultProps = {
1179
+ container: void 0,
1151
1180
  withSelectedRow: false,
1152
- overflowX: "scroll",
1153
- pos: "relative",
1154
- maxW: "100%",
1155
- minH: 400,
1156
- w: "full",
1157
1181
  styles: void 0,
1158
1182
  isLoading: void 0,
1159
1183
  onSelectedRow: void 0,
@@ -2232,7 +2256,7 @@ var Dialog = ({
2232
2256
  }) => {
2233
2257
  return /* @__PURE__ */ jsxs13(Modal, { ...props, children: [
2234
2258
  isModalOverlay && /* @__PURE__ */ jsx29(ModalOverlay, { pointerEvents: isOverlayClickable ? "auto" : "none" }),
2235
- /* @__PURE__ */ jsxs13(ModalContent, { bgColor: "neutral.50", fontFamily: "Poppins", width, children: [
2259
+ /* @__PURE__ */ jsxs13(ModalContent, { bgColor: "neutral.50", fontFamily: "Poppins", width, minW: "400px", children: [
2236
2260
  /* @__PURE__ */ jsx29(ModalHeader, { bgColor: "neutral.200", py: 2, px: 4, borderTopRadius: "sm", children: /* @__PURE__ */ jsx29(Text6, { textStyle: "text.lg", fontWeight: "normal", children: title }) }),
2237
2261
  /* @__PURE__ */ jsx29(ModalBody, { p: 4, textStyle: "text.md", children: content }),
2238
2262
  /* @__PURE__ */ jsx29(ModalFooter, { bgColor: "neutral.200", p: 4, borderBottomRadius: "sm", children: footer })
@@ -3254,17 +3278,6 @@ var rating_default = Rating;
3254
3278
  import { useColorMode as useColorMode3 } from "@chakra-ui/system";
3255
3279
  import ReactSelect from "react-select";
3256
3280
 
3257
- // src/components/select/components/select-wrapper.tsx
3258
- import { Box as Box26 } from "@chakra-ui/react";
3259
- import { jsx as jsx51 } from "react/jsx-runtime";
3260
- var SelectWrapper = ({ children }) => {
3261
- return /* @__PURE__ */ jsx51(Box26, { children });
3262
- };
3263
- SelectWrapper.defaultProps = {
3264
- isError: false
3265
- };
3266
- var select_wrapper_default = SelectWrapper;
3267
-
3268
3281
  // src/config/theme/foundations/shadows.ts
3269
3282
  import { theme as theme2 } from "@chakra-ui/react";
3270
3283
  var shadows = {
@@ -3530,37 +3543,32 @@ var selectStyle = {
3530
3543
  lineHeight: styleMd.lineHeight,
3531
3544
  letterSpacing: 0
3532
3545
  };
3533
- var boxShadow = (color) => `0 0 0 1px ${color}`;
3534
3546
  function selectStyles(colorMode, _isError) {
3535
- const boxShadowLight = (isFocused = false, isError = false) => {
3536
- if (isError && isFocused || isError) {
3537
- return boxShadow("danger.500");
3538
- }
3539
- if (isFocused) {
3540
- return boxShadow("primary.500");
3541
- }
3542
- return boxShadow("neutral.400");
3543
- };
3544
3547
  return {
3545
- control: (base, state) => colorMode === "dark" ? {
3546
- ...base,
3547
- ...selectStyle,
3548
- background: "transparent",
3549
- color: "primary.300",
3550
- borderColor: "secondary.500",
3551
- boxShadow: state.isFocused ? "none" : `inherit`
3552
- } : {
3553
- ...base,
3554
- ...selectStyle,
3555
- borderWidth: 0,
3556
- boxShadow: boxShadowLight(state.isFocused, _isError)
3548
+ control: (base, { isDisabled, isFocused }) => {
3549
+ const style = {
3550
+ ...base,
3551
+ flexWrap: "nowrap",
3552
+ borderColor: isFocused ? "var(--chakra-colors-primary-500)" : "var(--chakra-colors-neutral-400)",
3553
+ boxShadow: "none",
3554
+ color: isDisabled ? "var(--chakra-colors-black-low)" : "var(--chakra-colors-black-high)",
3555
+ "&:hover": {
3556
+ borderColor: _isError ? "" : isFocused ? "var(--chakra-colors-primary-500)" : "var(--chakra-colors-neutral-500)"
3557
+ }
3558
+ };
3559
+ if (_isError) {
3560
+ return {
3561
+ ...style,
3562
+ borderColor: "var(--chakra-colors-danger-500)"
3563
+ };
3564
+ }
3565
+ return style;
3557
3566
  },
3558
- option: (base, { isSelected }) => colorMode === "dark" ? {
3567
+ option: (base) => ({
3559
3568
  ...base,
3560
3569
  ...selectStyle,
3561
- background: isSelected ? "primary.700" : "dark.800",
3562
- color: "white"
3563
- } : { ...base, ...selectStyle },
3570
+ color: "var(--chakra-colors-neutral-900)"
3571
+ }),
3564
3572
  menu: (base) => colorMode === "dark" ? {
3565
3573
  ...base,
3566
3574
  ...selectStyle,
@@ -3585,23 +3593,23 @@ var themeSelect = (theme6) => {
3585
3593
  ...theme6,
3586
3594
  colors: {
3587
3595
  ...theme6.colors,
3588
- primary: "primary.500",
3589
- primary25: "primary.50",
3590
- primary50: "primary.100",
3591
- primary75: "primary.200"
3596
+ primary: "var(--chakra-colors-primary-100)",
3597
+ primary25: "var(--chakra-colors-primary-50)",
3598
+ primary50: "var(--chakra-colors-primary-100)",
3599
+ primary75: "var(--chakra-colors-primary-200)"
3592
3600
  }
3593
3601
  };
3594
3602
  };
3595
3603
 
3596
3604
  // src/components/select/components/select.tsx
3597
- import { jsx as jsx52 } from "react/jsx-runtime";
3605
+ import { jsx as jsx51 } from "react/jsx-runtime";
3598
3606
  function Select2({
3599
3607
  styles,
3600
3608
  isError = false,
3601
3609
  ...rest
3602
3610
  }) {
3603
3611
  const { colorMode } = useColorMode3();
3604
- return /* @__PURE__ */ jsx52(select_wrapper_default, { isError, children: /* @__PURE__ */ jsx52(
3612
+ return /* @__PURE__ */ jsx51(
3605
3613
  ReactSelect,
3606
3614
  {
3607
3615
  classNamePrefix: "react-select",
@@ -3609,21 +3617,21 @@ function Select2({
3609
3617
  styles: { ...selectStyles(colorMode, isError) },
3610
3618
  theme: themeSelect
3611
3619
  }
3612
- ) });
3620
+ );
3613
3621
  }
3614
3622
  var select_default = Select2;
3615
3623
 
3616
3624
  // src/components/select/components/select-async.tsx
3617
3625
  import { useColorMode as useColorMode4 } from "@chakra-ui/system";
3618
3626
  import { AsyncPaginate } from "react-select-async-paginate";
3619
- import { jsx as jsx53 } from "react/jsx-runtime";
3627
+ import { jsx as jsx52 } from "react/jsx-runtime";
3620
3628
  function SelectAsync({
3621
3629
  styles,
3622
3630
  isError = false,
3623
3631
  ...rest
3624
3632
  }) {
3625
3633
  const { colorMode } = useColorMode4();
3626
- return /* @__PURE__ */ jsx53(select_wrapper_default, { isError, children: /* @__PURE__ */ jsx53(
3634
+ return /* @__PURE__ */ jsx52(
3627
3635
  AsyncPaginate,
3628
3636
  {
3629
3637
  classNamePrefix: "react-select",
@@ -3631,17 +3639,17 @@ function SelectAsync({
3631
3639
  styles: { ...selectStyles(colorMode, isError), ...styles },
3632
3640
  theme: themeSelect
3633
3641
  }
3634
- ) });
3642
+ );
3635
3643
  }
3636
3644
  var select_async_default = SelectAsync;
3637
3645
 
3638
3646
  // src/components/select/components/select-async-creatable.tsx
3639
3647
  import { useColorMode as useColorMode5 } from "@chakra-ui/system";
3640
3648
  import ReactSelectAsyncCreatable from "react-select/async-creatable";
3641
- import { jsx as jsx54 } from "react/jsx-runtime";
3649
+ import { jsx as jsx53 } from "react/jsx-runtime";
3642
3650
  function SelectAsyncCreatable({ styles, isError = false, ...rest }) {
3643
3651
  const { colorMode } = useColorMode5();
3644
- return /* @__PURE__ */ jsx54(select_wrapper_default, { isError, children: /* @__PURE__ */ jsx54(
3652
+ return /* @__PURE__ */ jsx53(
3645
3653
  ReactSelectAsyncCreatable,
3646
3654
  {
3647
3655
  classNamePrefix: "react-select",
@@ -3649,16 +3657,16 @@ function SelectAsyncCreatable({ styles, isError = false, ...rest }) {
3649
3657
  styles: { ...selectStyles(colorMode, isError), ...styles },
3650
3658
  theme: themeSelect
3651
3659
  }
3652
- ) });
3660
+ );
3653
3661
  }
3654
3662
 
3655
3663
  // src/components/select/components/select-creatable.tsx
3656
3664
  import { useColorMode as useColorMode6 } from "@chakra-ui/system";
3657
3665
  import ReactSelectCreatable from "react-select/creatable";
3658
- import { jsx as jsx55 } from "react/jsx-runtime";
3666
+ import { jsx as jsx54 } from "react/jsx-runtime";
3659
3667
  function SelectCreatable({ styles, isError = false, ...rest }) {
3660
3668
  const { colorMode } = useColorMode6();
3661
- return /* @__PURE__ */ jsx55(select_wrapper_default, { isError, children: /* @__PURE__ */ jsx55(
3669
+ return /* @__PURE__ */ jsx54(
3662
3670
  ReactSelectCreatable,
3663
3671
  {
3664
3672
  classNamePrefix: "react-select",
@@ -3666,7 +3674,7 @@ function SelectCreatable({ styles, isError = false, ...rest }) {
3666
3674
  styles: { ...selectStyles(colorMode, isError), ...styles },
3667
3675
  theme: themeSelect
3668
3676
  }
3669
- ) });
3677
+ );
3670
3678
  }
3671
3679
 
3672
3680
  // src/components/switch/components/switch.tsx
@@ -3674,7 +3682,7 @@ import { chakra as chakra6, Flex as Flex8, forwardRef as forwardRef13, omitThemi
3674
3682
  import { cx as cx9, dataAttr } from "@chakra-ui/shared-utils";
3675
3683
  import { Check, Close as Close4 } from "@ctlyst.id/internal-icon";
3676
3684
  import { useMemo as useMemo4 } from "react";
3677
- import { jsx as jsx56, jsxs as jsxs23 } from "react/jsx-runtime";
3685
+ import { jsx as jsx55, jsxs as jsxs23 } from "react/jsx-runtime";
3678
3686
  var Switch = forwardRef13(function Switch2(props, ref) {
3679
3687
  const styles = useMultiStyleConfig2("Switch", props);
3680
3688
  const { spacing: spacing2 = "0.5rem", children, ...ownProps } = omitThemingProps2(props);
@@ -3726,13 +3734,13 @@ var Switch = forwardRef13(function Switch2(props, ref) {
3726
3734
  className: cx9("chakra-switch", props.className),
3727
3735
  __css: containerStyles,
3728
3736
  children: [
3729
- /* @__PURE__ */ jsx56("input", { "data-test-id": "", className: "chakra-switch__input", ...getInputProps({}, ref) }),
3737
+ /* @__PURE__ */ jsx55("input", { "data-test-id": "", className: "chakra-switch__input", ...getInputProps({}, ref) }),
3730
3738
  /* @__PURE__ */ jsxs23(chakra6.span, { ...getCheckboxProps(), className: "chakra-switch__track", pos: "relative", __css: trackStyles, children: [
3731
3739
  /* @__PURE__ */ jsxs23(Flex8, { gap: 2, pos: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)", children: [
3732
- /* @__PURE__ */ jsx56(Check, { color: "white", size: getIconSize(props.size) }),
3733
- /* @__PURE__ */ jsx56(Close4, { color: state.isDisabled ? "neutral.600" : "neutral.900", size: getIconSize(props.size) })
3740
+ /* @__PURE__ */ jsx55(Check, { color: "white", size: getIconSize(props.size) }),
3741
+ /* @__PURE__ */ jsx55(Close4, { color: state.isDisabled ? "neutral.600" : "neutral.900", size: getIconSize(props.size) })
3734
3742
  ] }),
3735
- /* @__PURE__ */ jsx56(
3743
+ /* @__PURE__ */ jsx55(
3736
3744
  chakra6.span,
3737
3745
  {
3738
3746
  __css: styles.thumb,
@@ -3742,7 +3750,7 @@ var Switch = forwardRef13(function Switch2(props, ref) {
3742
3750
  }
3743
3751
  )
3744
3752
  ] }),
3745
- children && /* @__PURE__ */ jsx56(
3753
+ children && /* @__PURE__ */ jsx55(
3746
3754
  chakra6.span,
3747
3755
  {
3748
3756
  className: "chakra-switch__label",
@@ -3779,13 +3787,13 @@ import {
3779
3787
 
3780
3788
  // src/components/tabs/components/tab.tsx
3781
3789
  import { Button as Button4, Flex as Flex9, forwardRef as forwardRef14, useMultiStyleConfig as useMultiStyleConfig3, useTab } from "@chakra-ui/react";
3782
- import { jsx as jsx57, jsxs as jsxs24 } from "react/jsx-runtime";
3790
+ import { jsx as jsx56, jsxs as jsxs24 } from "react/jsx-runtime";
3783
3791
  var Tab = forwardRef14((props, ref) => {
3784
3792
  var _a, _b;
3785
3793
  const tabProps = useTab({ ...props, ref });
3786
3794
  const isSelected = !!tabProps["aria-selected"];
3787
3795
  const styles = useMultiStyleConfig3("Tabs", tabProps);
3788
- return /* @__PURE__ */ jsx57(
3796
+ return /* @__PURE__ */ jsx56(
3789
3797
  Button4,
3790
3798
  {
3791
3799
  "data-test-id": props["data-test-id"],
@@ -3877,7 +3885,7 @@ var messages = {
3877
3885
  };
3878
3886
 
3879
3887
  // src/components/uploader/components/uploader.tsx
3880
- import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
3888
+ import { jsx as jsx57, jsxs as jsxs25 } from "react/jsx-runtime";
3881
3889
  var Uploader = ({
3882
3890
  onHandleUploadFile,
3883
3891
  onHandleRejections,
@@ -3938,11 +3946,11 @@ var Uploader = ({
3938
3946
  ...props,
3939
3947
  ...getRootProps(),
3940
3948
  children: [
3941
- /* @__PURE__ */ jsx58("input", { ...getInputProps() }),
3942
- isDragActive ? /* @__PURE__ */ jsx58(Text15, { children: messages.dragActive }) : /* @__PURE__ */ jsxs25(Flex10, { flexDirection: "column", alignItems: "center", color: isError ? "danger.500" : "primary.500", children: [
3943
- !multiple && isSelected && /* @__PURE__ */ jsx58(Heading2, { fontWeight: 400, fontSize: "18px", lineHeight: 28, color: "black.high", mb: 2, children: selectedFirstFile == null ? void 0 : selectedFirstFile.name }),
3944
- !isSelected && /* @__PURE__ */ jsx58(Heading2, { fontWeight: 400, fontSize: "18px", lineHeight: 28, mb: 2, children: messages.uploadFile }),
3945
- isSelected ? /* @__PURE__ */ jsx58(Text15, { children: messages.dragReplace }) : /* @__PURE__ */ jsx58(Text15, { children: messages.dragInActive })
3949
+ /* @__PURE__ */ jsx57("input", { ...getInputProps() }),
3950
+ isDragActive ? /* @__PURE__ */ jsx57(Text15, { children: messages.dragActive }) : /* @__PURE__ */ jsxs25(Flex10, { flexDirection: "column", alignItems: "center", color: isError ? "danger.500" : "primary.500", children: [
3951
+ !multiple && isSelected && /* @__PURE__ */ jsx57(Heading2, { fontWeight: 400, fontSize: "18px", lineHeight: 28, color: "black.high", mb: 2, children: selectedFirstFile == null ? void 0 : selectedFirstFile.name }),
3952
+ !isSelected && /* @__PURE__ */ jsx57(Heading2, { fontWeight: 400, fontSize: "18px", lineHeight: 28, mb: 2, children: messages.uploadFile }),
3953
+ isSelected ? /* @__PURE__ */ jsx57(Text15, { children: messages.dragReplace }) : /* @__PURE__ */ jsx57(Text15, { children: messages.dragInActive })
3946
3954
  ] })
3947
3955
  ]
3948
3956
  }
@@ -5495,7 +5503,7 @@ import { useMemo as useMemo7 } from "react";
5495
5503
  import axios from "axios";
5496
5504
  import { createContext as createContext2, useContext, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef2 } from "react";
5497
5505
  import { ToastContainer } from "react-toastify";
5498
- import { jsx as jsx59, jsxs as jsxs26 } from "react/jsx-runtime";
5506
+ import { jsx as jsx58, jsxs as jsxs26 } from "react/jsx-runtime";
5499
5507
  var ProviderContext = createContext2({
5500
5508
  instance: void 0
5501
5509
  });
@@ -5515,7 +5523,7 @@ var Provider = ({ children, config: config2, requestInterceptors, responseInterc
5515
5523
  }, [requestInterceptors, responseInterceptors]);
5516
5524
  const provider = useMemo6(() => ({ instance: instanceRef.current }), []);
5517
5525
  return /* @__PURE__ */ jsxs26(ProviderContext.Provider, { value: provider, children: [
5518
- /* @__PURE__ */ jsx59(ToastContainer, {}),
5526
+ /* @__PURE__ */ jsx58(ToastContainer, {}),
5519
5527
  children
5520
5528
  ] });
5521
5529
  };