@ctlyst.id/internal-ui 3.3.15 → 3.3.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +34 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -946,26 +946,32 @@ var getCommonPinningStyles = (column) => {
|
|
946
946
|
...isLastLeftPinnedColumn ? {
|
947
947
|
padding: "16px 8px 16px 8px",
|
948
948
|
"&:after": {
|
949
|
+
transition: "all 0.3s",
|
949
950
|
content: "''",
|
950
951
|
position: "absolute",
|
951
952
|
width: "30px",
|
952
953
|
right: "0px",
|
953
954
|
bottom: "-1px",
|
954
955
|
top: 0,
|
955
|
-
transform: "translateX(100%)"
|
956
|
+
transform: "translateX(100%)"
|
957
|
+
},
|
958
|
+
"[pin-left=true] &:after": {
|
956
959
|
boxShadow: "inset 14px 0px 20px -10px #00000010"
|
957
960
|
}
|
958
961
|
} : {},
|
959
962
|
...isFirstRightPinnedColumn ? {
|
960
963
|
padding: "16px 8px 16px 8px",
|
961
964
|
"&:after": {
|
965
|
+
transition: "all 0.3s",
|
962
966
|
content: "''",
|
963
967
|
position: "absolute",
|
964
968
|
width: "30px",
|
965
969
|
left: "0%",
|
966
970
|
top: 0,
|
967
971
|
bottom: "-1px",
|
968
|
-
transform: "translateX(-100%)"
|
972
|
+
transform: "translateX(-100%)"
|
973
|
+
},
|
974
|
+
"[pin-right=true] &:after": {
|
969
975
|
boxShadow: "inset -14px 0px 20px -10px #00000010"
|
970
976
|
}
|
971
977
|
} : {}
|
@@ -1065,22 +1071,39 @@ var useDataTable = ({
|
|
1065
1071
|
};
|
1066
1072
|
};
|
1067
1073
|
var DataTable = React5.forwardRef((props, ref) => {
|
1068
|
-
var _a, _b;
|
1074
|
+
var _a, _b, _c;
|
1069
1075
|
const { isLoading, styles, headerSticky, onRowClick, container, columnPinning } = props;
|
1070
1076
|
const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1077
|
+
const refTable = React5.useRef(null);
|
1071
1078
|
React5.useImperativeHandle(ref, () => ({
|
1072
1079
|
toggleAllRowsSelected
|
1073
1080
|
}));
|
1081
|
+
let lastPinnedColumn = 0;
|
1082
|
+
(_a = refTable.current) == null ? void 0 : _a.addEventListener("scroll", (s) => {
|
1083
|
+
var _a2, _b2, _c2, _d;
|
1084
|
+
const element = s.currentTarget;
|
1085
|
+
if (element.scrollLeft > 0) {
|
1086
|
+
(_a2 = refTable.current) == null ? void 0 : _a2.setAttribute("pin-left", "true");
|
1087
|
+
} else {
|
1088
|
+
(_b2 = refTable.current) == null ? void 0 : _b2.removeAttribute("pin-left");
|
1089
|
+
}
|
1090
|
+
if (element.scrollLeft < element.scrollWidth - (lastPinnedColumn + element.offsetWidth)) {
|
1091
|
+
(_c2 = refTable.current) == null ? void 0 : _c2.setAttribute("pin-right", "true");
|
1092
|
+
} else {
|
1093
|
+
(_d = refTable.current) == null ? void 0 : _d.removeAttribute("pin-right");
|
1094
|
+
}
|
1095
|
+
});
|
1074
1096
|
return /* @__PURE__ */ jsx24(
|
1075
1097
|
Box11,
|
1076
1098
|
{
|
1077
1099
|
overflowX: "auto",
|
1078
1100
|
overflowY: "hidden",
|
1079
1101
|
position: "relative",
|
1080
|
-
pl: ((
|
1081
|
-
pr: ((
|
1102
|
+
pl: ((_b = columnPinning == null ? void 0 : columnPinning.left) == null ? void 0 : _b.length) ? 0 : 4,
|
1103
|
+
pr: ((_c = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _c.length) ? 0 : 4,
|
1082
1104
|
maxW: "100%",
|
1083
1105
|
w: "full",
|
1106
|
+
ref: refTable,
|
1084
1107
|
...container,
|
1085
1108
|
children: isLoading ? /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, "data-loading": "true", children: [
|
1086
1109
|
/* @__PURE__ */ jsx24(Thead, { ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { mx: "2", ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => /* @__PURE__ */ jsx24(
|
@@ -1110,7 +1133,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1110
1133
|
maxH: "50px",
|
1111
1134
|
...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}),
|
1112
1135
|
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { bg: useColorModeValue("initial", "ebony-clay.700"), ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => {
|
1113
|
-
var _a2;
|
1136
|
+
var _a2, _b2;
|
1137
|
+
if (!!((_a2 = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _a2.length) && header.column.getIsFirstColumn("right")) {
|
1138
|
+
lastPinnedColumn = header.column.getAfter("right");
|
1139
|
+
}
|
1114
1140
|
return /* @__PURE__ */ jsx24(
|
1115
1141
|
Th,
|
1116
1142
|
{
|
@@ -1137,10 +1163,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1137
1163
|
cursor: header.column.getCanSort() ? "pointer" : "default",
|
1138
1164
|
"data-test-id": `CT_Container_SortingIcon_${header.id}`,
|
1139
1165
|
onClick: header.column.getToggleSortingHandler(),
|
1140
|
-
children: (
|
1166
|
+
children: (_b2 = header.column.getCanSort() && {
|
1141
1167
|
asc: /* @__PURE__ */ jsx24(ChevronUpIcon, { h: 4, w: 4, color: "neutral.500" }),
|
1142
1168
|
desc: /* @__PURE__ */ jsx24(ChevronDownIcon, { h: 4, w: 4, color: "neutral.500" })
|
1143
|
-
}[header.column.getIsSorted()]) != null ?
|
1169
|
+
}[header.column.getIsSorted()]) != null ? _b2 : /* @__PURE__ */ jsx24(Box11, { display: "flex", justifyContent: "center", alignItems: "center", boxSize: 4, children: /* @__PURE__ */ jsx24(UpDownIcon, { color: "neutral.500" }) })
|
1144
1170
|
}
|
1145
1171
|
)
|
1146
1172
|
]
|
@@ -4665,14 +4691,14 @@ import { marry } from "@zamiru/timescape";
|
|
4665
4691
|
import {
|
4666
4692
|
useEffect as useEffect2,
|
4667
4693
|
useLayoutEffect,
|
4668
|
-
useRef,
|
4694
|
+
useRef as useRef2,
|
4669
4695
|
useState as useState4
|
4670
4696
|
} from "react";
|
4671
4697
|
var useTimescape = (options = {}) => {
|
4672
4698
|
var _a;
|
4673
4699
|
const { date, onChangeDate, ...rest } = options;
|
4674
4700
|
const [manager] = useState4(() => new TimescapeManager(date, rest));
|
4675
|
-
const onChangeDateRef =
|
4701
|
+
const onChangeDateRef = useRef2(onChangeDate);
|
4676
4702
|
useLayoutEffect(() => {
|
4677
4703
|
onChangeDateRef.current = onChangeDate;
|
4678
4704
|
}, [onChangeDate]);
|
@@ -5049,7 +5075,7 @@ import {
|
|
5049
5075
|
UnorderedList as UnorderedList2
|
5050
5076
|
} from "@chakra-ui/react";
|
5051
5077
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
5052
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useRef as
|
5078
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
|
5053
5079
|
import { useDropzone } from "react-dropzone";
|
5054
5080
|
|
5055
5081
|
// src/components/uploader/constants.ts
|
@@ -5109,7 +5135,7 @@ var Uploader = ({
|
|
5109
5135
|
size: size2 = "lg",
|
5110
5136
|
...props
|
5111
5137
|
}) => {
|
5112
|
-
const inputRef =
|
5138
|
+
const inputRef = useRef3(null);
|
5113
5139
|
const [filePreview, setFilePreview] = useState5();
|
5114
5140
|
const toast2 = useToast();
|
5115
5141
|
const handleRejection = useCallback2(
|
@@ -7022,7 +7048,7 @@ import { useMemo as useMemo5 } from "react";
|
|
7022
7048
|
|
7023
7049
|
// src/provider/components/provider.tsx
|
7024
7050
|
import axios from "axios";
|
7025
|
-
import { createContext as createContext2, useContext, useEffect as useEffect5, useMemo as useMemo4, useRef as
|
7051
|
+
import { createContext as createContext2, useContext, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef4 } from "react";
|
7026
7052
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
7027
7053
|
import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
|
7028
7054
|
var ProviderContext = createContext2({
|
@@ -7033,7 +7059,7 @@ var useInternalUI = () => {
|
|
7033
7059
|
return { instance };
|
7034
7060
|
};
|
7035
7061
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
7036
|
-
const instanceRef =
|
7062
|
+
const instanceRef = useRef4(axios.create(config2));
|
7037
7063
|
useEffect5(() => {
|
7038
7064
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
7039
7065
|
instanceRef.current.interceptors.request.use(interceptor);
|