@ctlyst.id/internal-ui 3.1.8 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +557 -546
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -27
- 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) {
|
|
@@ -3855,6 +3852,9 @@ function selectStyles(colorMode, _isError) {
|
|
|
3855
3852
|
placeholder: (base) => {
|
|
3856
3853
|
return { ...base, ...selectStyle, color: "var(--chakra-colors-black-low)" };
|
|
3857
3854
|
},
|
|
3855
|
+
clearIndicator: (base) => {
|
|
3856
|
+
return { ...base, cursor: "pointer" };
|
|
3857
|
+
},
|
|
3858
3858
|
multiValue: (base) => {
|
|
3859
3859
|
return {
|
|
3860
3860
|
...base,
|
|
@@ -3912,10 +3912,11 @@ function Select2({
|
|
|
3912
3912
|
...rest
|
|
3913
3913
|
}) {
|
|
3914
3914
|
const { colorMode } = useColorMode3();
|
|
3915
|
-
const { components } = rest;
|
|
3915
|
+
const { components, value, onChange } = rest;
|
|
3916
3916
|
return /* @__PURE__ */ jsx53(
|
|
3917
3917
|
ReactSelect,
|
|
3918
3918
|
{
|
|
3919
|
+
"data-test-id": "",
|
|
3919
3920
|
classNamePrefix: "react-select",
|
|
3920
3921
|
components: {
|
|
3921
3922
|
DropdownIndicator,
|
|
@@ -3924,6 +3925,8 @@ function Select2({
|
|
|
3924
3925
|
MultiValueRemove,
|
|
3925
3926
|
...components
|
|
3926
3927
|
},
|
|
3928
|
+
value,
|
|
3929
|
+
onChange,
|
|
3927
3930
|
styles: { ...selectStyles(colorMode, isError) },
|
|
3928
3931
|
theme: themeSelect,
|
|
3929
3932
|
...rest
|
|
@@ -4095,21 +4098,24 @@ var SelectWithCheckboxBase = ({
|
|
|
4095
4098
|
isError = false,
|
|
4096
4099
|
components,
|
|
4097
4100
|
options,
|
|
4101
|
+
onChange,
|
|
4102
|
+
value,
|
|
4098
4103
|
...rest
|
|
4099
4104
|
}) => {
|
|
4100
4105
|
const { colorMode } = useColorMode7();
|
|
4101
4106
|
return /* @__PURE__ */ jsx57(
|
|
4102
4107
|
ReactSelect2,
|
|
4103
4108
|
{
|
|
4109
|
+
"data-test-id": "",
|
|
4104
4110
|
classNamePrefix: "react-select",
|
|
4105
4111
|
options,
|
|
4112
|
+
value,
|
|
4113
|
+
onChange,
|
|
4106
4114
|
styles: { ...selectStyles(colorMode, !!isError) },
|
|
4107
4115
|
theme: themeSelect,
|
|
4108
4116
|
closeMenuOnSelect: false,
|
|
4109
4117
|
hideSelectedOptions: false,
|
|
4110
|
-
components
|
|
4111
|
-
...components
|
|
4112
|
-
},
|
|
4118
|
+
components,
|
|
4113
4119
|
...rest
|
|
4114
4120
|
}
|
|
4115
4121
|
);
|
|
@@ -4117,24 +4123,29 @@ var SelectWithCheckboxBase = ({
|
|
|
4117
4123
|
var SelectCheckbox = (props) => {
|
|
4118
4124
|
const { isMulti, options, value, components, ...rest } = props;
|
|
4119
4125
|
const selectValue = value || [];
|
|
4126
|
+
const defaultComponents = {
|
|
4127
|
+
DropdownIndicator,
|
|
4128
|
+
ClearIndicator,
|
|
4129
|
+
MultiValue,
|
|
4130
|
+
MultiValueRemove,
|
|
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
|
+
}
|
|
4138
|
+
};
|
|
4120
4139
|
return /* @__PURE__ */ jsx57(
|
|
4121
4140
|
SelectWithCheckboxBase,
|
|
4122
4141
|
{
|
|
4142
|
+
"data-test-id": "",
|
|
4123
4143
|
isMulti,
|
|
4124
4144
|
options,
|
|
4145
|
+
value,
|
|
4125
4146
|
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
|
-
}
|
|
4147
|
+
...defaultComponents,
|
|
4148
|
+
...components
|
|
4138
4149
|
},
|
|
4139
4150
|
...rest
|
|
4140
4151
|
}
|
|
@@ -4744,7 +4755,7 @@ import {
|
|
|
4744
4755
|
UnorderedList as UnorderedList2
|
|
4745
4756
|
} from "@chakra-ui/react";
|
|
4746
4757
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
|
4747
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useRef
|
|
4758
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState4 } from "react";
|
|
4748
4759
|
import { useDropzone } from "react-dropzone";
|
|
4749
4760
|
|
|
4750
4761
|
// src/components/uploader/constants.ts
|
|
@@ -4804,7 +4815,7 @@ var Uploader = ({
|
|
|
4804
4815
|
size: size2 = "lg",
|
|
4805
4816
|
...props
|
|
4806
4817
|
}) => {
|
|
4807
|
-
const inputRef =
|
|
4818
|
+
const inputRef = useRef(null);
|
|
4808
4819
|
const [filePreview, setFilePreview] = useState4();
|
|
4809
4820
|
const toast2 = useToast();
|
|
4810
4821
|
const handleRejection = useCallback2(
|
|
@@ -6692,7 +6703,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
6692
6703
|
|
|
6693
6704
|
// src/provider/components/provider.tsx
|
|
6694
6705
|
import axios from "axios";
|
|
6695
|
-
import { createContext as createContext2, useContext, useEffect as useEffect3, useMemo as useMemo4, useRef as
|
|
6706
|
+
import { createContext as createContext2, useContext, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2 } from "react";
|
|
6696
6707
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
|
6697
6708
|
import { jsx as jsx66, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6698
6709
|
var ProviderContext = createContext2({
|
|
@@ -6703,7 +6714,7 @@ var useInternalUI = () => {
|
|
|
6703
6714
|
return { instance };
|
|
6704
6715
|
};
|
|
6705
6716
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
|
6706
|
-
const instanceRef =
|
|
6717
|
+
const instanceRef = useRef2(axios.create(config2));
|
|
6707
6718
|
useEffect3(() => {
|
|
6708
6719
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
|
6709
6720
|
instanceRef.current.interceptors.request.use(interceptor);
|