@ctlyst.id/internal-ui 3.1.8 → 3.1.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +580 -558
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -930,7 +930,6 @@ import { Box as Box11, Checkbox as Checkbox2, Flex as Flex2, Skeleton as Skeleto
|
|
930
930
|
import { css } from "@emotion/react";
|
931
931
|
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
932
932
|
import * as React5 from "react";
|
933
|
-
import { useRef } from "react";
|
934
933
|
import { jsx as jsx24, jsxs as jsxs8 } from "react/jsx-runtime";
|
935
934
|
var isCellDisabled = (row, cellId) => {
|
936
935
|
if (row.disabled) {
|
@@ -1146,13 +1145,11 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1146
1145
|
}
|
1147
1146
|
),
|
1148
1147
|
/* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
|
1149
|
-
const trRef = useRef();
|
1150
1148
|
return /* @__PURE__ */ jsx24(
|
1151
1149
|
Tr,
|
1152
1150
|
{
|
1153
1151
|
"data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
|
1154
1152
|
tabindex: "0",
|
1155
|
-
ref: trRef,
|
1156
1153
|
...styles == null ? void 0 : styles.tableRow,
|
1157
1154
|
css: css`
|
1158
1155
|
&:last-child {
|
@@ -1161,13 +1158,13 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1161
1158
|
}
|
1162
1159
|
}
|
1163
1160
|
`,
|
1164
|
-
onMouseDown: () => {
|
1161
|
+
onMouseDown: (e) => {
|
1165
1162
|
var _a;
|
1166
|
-
(_a =
|
1163
|
+
(_a = e.currentTarget) == null ? void 0 : _a.setAttribute("data-active", "true");
|
1167
1164
|
},
|
1168
|
-
onMouseUp: () => {
|
1165
|
+
onMouseUp: (e) => {
|
1169
1166
|
var _a;
|
1170
|
-
(_a =
|
1167
|
+
(_a = e.currentTarget) == null ? void 0 : _a.removeAttribute("data-active");
|
1171
1168
|
},
|
1172
1169
|
onClick: () => {
|
1173
1170
|
if (onRowClick) {
|
@@ -1175,6 +1172,7 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1175
1172
|
}
|
1176
1173
|
},
|
1177
1174
|
children: row.getVisibleCells().map((cell) => {
|
1175
|
+
const meta = cell.column.columnDef.meta;
|
1178
1176
|
const isDisabled = isCellDisabled(row.original, cell.column.id);
|
1179
1177
|
return /* @__PURE__ */ jsx24(
|
1180
1178
|
Td,
|
@@ -1183,21 +1181,31 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1183
1181
|
fontSize: "text.sm",
|
1184
1182
|
sx: getCommonPinningStyles(cell.column),
|
1185
1183
|
...styles == null ? void 0 : styles.tableCell,
|
1186
|
-
children: /* @__PURE__ */ jsx24(
|
1184
|
+
children: /* @__PURE__ */ jsx24(
|
1187
1185
|
Flex2,
|
1188
1186
|
{
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1187
|
+
height: "100%",
|
1188
|
+
width: "100%",
|
1189
|
+
align: "center",
|
1190
|
+
opacity: isDisabled ? 0.5 : 1,
|
1191
|
+
sx: { ...meta && meta.columnStyles ? meta.columnStyles : {} },
|
1192
|
+
children: /* @__PURE__ */ jsx24(
|
1193
|
+
Flex2,
|
1194
|
+
{
|
1195
|
+
tabIndex: 0,
|
1196
|
+
display: "inline-flex",
|
1197
|
+
cursor: "auto",
|
1198
|
+
"data-test-id": `CT_Component_TableCell_Content-${cell.id}`,
|
1199
|
+
onMouseUp: (e) => e.stopPropagation(),
|
1200
|
+
onMouseDown: (e) => e.stopPropagation(),
|
1201
|
+
onClick: (e) => {
|
1202
|
+
e.stopPropagation();
|
1203
|
+
},
|
1204
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
1205
|
+
}
|
1206
|
+
)
|
1199
1207
|
}
|
1200
|
-
)
|
1208
|
+
)
|
1201
1209
|
},
|
1202
1210
|
cell.id
|
1203
1211
|
);
|
@@ -3855,6 +3863,9 @@ function selectStyles(colorMode, _isError) {
|
|
3855
3863
|
placeholder: (base) => {
|
3856
3864
|
return { ...base, ...selectStyle, color: "var(--chakra-colors-black-low)" };
|
3857
3865
|
},
|
3866
|
+
clearIndicator: (base) => {
|
3867
|
+
return { ...base, cursor: "pointer" };
|
3868
|
+
},
|
3858
3869
|
multiValue: (base) => {
|
3859
3870
|
return {
|
3860
3871
|
...base,
|
@@ -3912,10 +3923,11 @@ function Select2({
|
|
3912
3923
|
...rest
|
3913
3924
|
}) {
|
3914
3925
|
const { colorMode } = useColorMode3();
|
3915
|
-
const { components } = rest;
|
3926
|
+
const { components, value, onChange } = rest;
|
3916
3927
|
return /* @__PURE__ */ jsx53(
|
3917
3928
|
ReactSelect,
|
3918
3929
|
{
|
3930
|
+
"data-test-id": "",
|
3919
3931
|
classNamePrefix: "react-select",
|
3920
3932
|
components: {
|
3921
3933
|
DropdownIndicator,
|
@@ -3924,6 +3936,8 @@ function Select2({
|
|
3924
3936
|
MultiValueRemove,
|
3925
3937
|
...components
|
3926
3938
|
},
|
3939
|
+
value,
|
3940
|
+
onChange,
|
3927
3941
|
styles: { ...selectStyles(colorMode, isError) },
|
3928
3942
|
theme: themeSelect,
|
3929
3943
|
...rest
|
@@ -4095,21 +4109,24 @@ var SelectWithCheckboxBase = ({
|
|
4095
4109
|
isError = false,
|
4096
4110
|
components,
|
4097
4111
|
options,
|
4112
|
+
onChange,
|
4113
|
+
value,
|
4098
4114
|
...rest
|
4099
4115
|
}) => {
|
4100
4116
|
const { colorMode } = useColorMode7();
|
4101
4117
|
return /* @__PURE__ */ jsx57(
|
4102
4118
|
ReactSelect2,
|
4103
4119
|
{
|
4120
|
+
"data-test-id": "",
|
4104
4121
|
classNamePrefix: "react-select",
|
4105
4122
|
options,
|
4123
|
+
value,
|
4124
|
+
onChange,
|
4106
4125
|
styles: { ...selectStyles(colorMode, !!isError) },
|
4107
4126
|
theme: themeSelect,
|
4108
4127
|
closeMenuOnSelect: false,
|
4109
4128
|
hideSelectedOptions: false,
|
4110
|
-
components
|
4111
|
-
...components
|
4112
|
-
},
|
4129
|
+
components,
|
4113
4130
|
...rest
|
4114
4131
|
}
|
4115
4132
|
);
|
@@ -4117,24 +4134,29 @@ var SelectWithCheckboxBase = ({
|
|
4117
4134
|
var SelectCheckbox = (props) => {
|
4118
4135
|
const { isMulti, options, value, components, ...rest } = props;
|
4119
4136
|
const selectValue = value || [];
|
4137
|
+
const defaultComponents = {
|
4138
|
+
DropdownIndicator,
|
4139
|
+
ClearIndicator,
|
4140
|
+
MultiValue,
|
4141
|
+
MultiValueRemove,
|
4142
|
+
Option: (optionProps) => {
|
4143
|
+
const { isSelected, data } = optionProps;
|
4144
|
+
const optionLength = (options == null ? void 0 : options.length) ? options.length - 1 : 0;
|
4145
|
+
const selectedValue = isSelected ? CHECKBOX_STATE.CHECKED : CHECKBOX_STATE.UNCHECKED;
|
4146
|
+
const checkedState = data.selectAllCheckbox ? getSelectAllCheckboxState(selectValue == null ? void 0 : selectValue.length, optionLength) : selectedValue;
|
4147
|
+
return /* @__PURE__ */ jsx57(InputOption, { ...optionProps, checkedState });
|
4148
|
+
}
|
4149
|
+
};
|
4120
4150
|
return /* @__PURE__ */ jsx57(
|
4121
4151
|
SelectWithCheckboxBase,
|
4122
4152
|
{
|
4153
|
+
"data-test-id": "",
|
4123
4154
|
isMulti,
|
4124
4155
|
options,
|
4156
|
+
value,
|
4125
4157
|
components: {
|
4126
|
-
|
4127
|
-
|
4128
|
-
MultiValue,
|
4129
|
-
MultiValueRemove,
|
4130
|
-
...components,
|
4131
|
-
Option: (optionProps) => {
|
4132
|
-
const { isSelected, data } = optionProps;
|
4133
|
-
const optionLength = (options == null ? void 0 : options.length) ? options.length - 1 : 0;
|
4134
|
-
const selectedValue = isSelected ? CHECKBOX_STATE.CHECKED : CHECKBOX_STATE.UNCHECKED;
|
4135
|
-
const checkedState = data.selectAllCheckbox ? getSelectAllCheckboxState(selectValue == null ? void 0 : selectValue.length, optionLength) : selectedValue;
|
4136
|
-
return /* @__PURE__ */ jsx57(InputOption, { ...optionProps, checkedState });
|
4137
|
-
}
|
4158
|
+
...defaultComponents,
|
4159
|
+
...components
|
4138
4160
|
},
|
4139
4161
|
...rest
|
4140
4162
|
}
|
@@ -4744,7 +4766,7 @@ import {
|
|
4744
4766
|
UnorderedList as UnorderedList2
|
4745
4767
|
} from "@chakra-ui/react";
|
4746
4768
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
4747
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useRef
|
4769
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState4 } from "react";
|
4748
4770
|
import { useDropzone } from "react-dropzone";
|
4749
4771
|
|
4750
4772
|
// src/components/uploader/constants.ts
|
@@ -4804,7 +4826,7 @@ var Uploader = ({
|
|
4804
4826
|
size: size2 = "lg",
|
4805
4827
|
...props
|
4806
4828
|
}) => {
|
4807
|
-
const inputRef =
|
4829
|
+
const inputRef = useRef(null);
|
4808
4830
|
const [filePreview, setFilePreview] = useState4();
|
4809
4831
|
const toast2 = useToast();
|
4810
4832
|
const handleRejection = useCallback2(
|
@@ -6692,7 +6714,7 @@ import { useMemo as useMemo5 } from "react";
|
|
6692
6714
|
|
6693
6715
|
// src/provider/components/provider.tsx
|
6694
6716
|
import axios from "axios";
|
6695
|
-
import { createContext as createContext2, useContext, useEffect as useEffect3, useMemo as useMemo4, useRef as
|
6717
|
+
import { createContext as createContext2, useContext, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2 } from "react";
|
6696
6718
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
6697
6719
|
import { jsx as jsx66, jsxs as jsxs31 } from "react/jsx-runtime";
|
6698
6720
|
var ProviderContext = createContext2({
|
@@ -6703,7 +6725,7 @@ var useInternalUI = () => {
|
|
6703
6725
|
return { instance };
|
6704
6726
|
};
|
6705
6727
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
6706
|
-
const instanceRef =
|
6728
|
+
const instanceRef = useRef2(axios.create(config2));
|
6707
6729
|
useEffect3(() => {
|
6708
6730
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
6709
6731
|
instanceRef.current.interceptors.request.use(interceptor);
|