@ctlyst.id/internal-ui 3.3.14 → 3.3.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -18
- 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]);
|
@@ -4785,10 +4811,12 @@ var TimeInput2 = forwardRef12(
|
|
4785
4811
|
isSuccess,
|
4786
4812
|
onChangeTime
|
4787
4813
|
}, ref) => {
|
4788
|
-
const
|
4814
|
+
const timeVal = value != null ? value : new Time(0, 0, 0);
|
4815
|
+
const dateVal = /* @__PURE__ */ new Date();
|
4816
|
+
dateVal.setHours(timeVal.hours, timeVal.minutes, timeVal.seconds, 0);
|
4789
4817
|
const defaultDate = /* @__PURE__ */ new Date();
|
4790
4818
|
defaultDate.setHours(0, 0, 0, 0);
|
4791
|
-
const date = dateVal
|
4819
|
+
const date = dateVal || defaultDate;
|
4792
4820
|
const timeValue = new Time();
|
4793
4821
|
const { getRootProps, getInputProps, options, update, _manager } = useTimescape({
|
4794
4822
|
date,
|
@@ -5047,7 +5075,7 @@ import {
|
|
5047
5075
|
UnorderedList as UnorderedList2
|
5048
5076
|
} from "@chakra-ui/react";
|
5049
5077
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
5050
|
-
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";
|
5051
5079
|
import { useDropzone } from "react-dropzone";
|
5052
5080
|
|
5053
5081
|
// src/components/uploader/constants.ts
|
@@ -5107,7 +5135,7 @@ var Uploader = ({
|
|
5107
5135
|
size: size2 = "lg",
|
5108
5136
|
...props
|
5109
5137
|
}) => {
|
5110
|
-
const inputRef =
|
5138
|
+
const inputRef = useRef3(null);
|
5111
5139
|
const [filePreview, setFilePreview] = useState5();
|
5112
5140
|
const toast2 = useToast();
|
5113
5141
|
const handleRejection = useCallback2(
|
@@ -5166,7 +5194,16 @@ var Uploader = ({
|
|
5166
5194
|
});
|
5167
5195
|
const renderHelperText = () => {
|
5168
5196
|
if (Array.isArray(helperText)) {
|
5169
|
-
return /* @__PURE__ */ jsx66(
|
5197
|
+
return /* @__PURE__ */ jsx66(
|
5198
|
+
UnorderedList2,
|
5199
|
+
{
|
5200
|
+
pl: 2,
|
5201
|
+
fontSize: 12,
|
5202
|
+
color: "black.medium",
|
5203
|
+
"data-test-id": "CT_component_base-image-uploader_helperText",
|
5204
|
+
children: helperText.map((text2) => /* @__PURE__ */ jsx66(ListItem2, { children: text2 }, text2))
|
5205
|
+
}
|
5206
|
+
);
|
5170
5207
|
}
|
5171
5208
|
return helperText;
|
5172
5209
|
};
|
@@ -5193,7 +5230,6 @@ var Uploader = ({
|
|
5193
5230
|
const color = isDisabled ? "neutral.500" : "primary.500";
|
5194
5231
|
const containerHeight = !isSmall ? "160px" : "120px";
|
5195
5232
|
const cursorType = filePreview ? "initial" : "pointer";
|
5196
|
-
console.log(isDragActive);
|
5197
5233
|
return /* @__PURE__ */ jsxs31(FormControl4, { isRequired, children: [
|
5198
5234
|
label && typeof label === "string" ? (
|
5199
5235
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
@@ -7012,7 +7048,7 @@ import { useMemo as useMemo5 } from "react";
|
|
7012
7048
|
|
7013
7049
|
// src/provider/components/provider.tsx
|
7014
7050
|
import axios from "axios";
|
7015
|
-
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";
|
7016
7052
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
7017
7053
|
import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
|
7018
7054
|
var ProviderContext = createContext2({
|
@@ -7023,7 +7059,7 @@ var useInternalUI = () => {
|
|
7023
7059
|
return { instance };
|
7024
7060
|
};
|
7025
7061
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
7026
|
-
const instanceRef =
|
7062
|
+
const instanceRef = useRef4(axios.create(config2));
|
7027
7063
|
useEffect5(() => {
|
7028
7064
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
7029
7065
|
instanceRef.current.interceptors.request.use(interceptor);
|