@ctlyst.id/internal-ui 5.1.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +768 -692
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -459,10 +459,40 @@ var card_default = CardCustom;
|
|
459
459
|
// src/components/checkbox/components/checkbox.tsx
|
460
460
|
import { Box as Box5, Checkbox, forwardRef as forwardRef7, Text as Text2, useCheckbox } from "@chakra-ui/react";
|
461
461
|
import * as Icon from "@ctlyst.id/internal-icon";
|
462
|
+
import { useCallback, useEffect, useState } from "react";
|
463
|
+
|
464
|
+
// src/utils/throttleFn.ts
|
465
|
+
var throttle = (fn, delay) => {
|
466
|
+
if (!delay) return fn;
|
467
|
+
let timeoutId;
|
468
|
+
return (val) => {
|
469
|
+
if (timeoutId) return;
|
470
|
+
fn(val);
|
471
|
+
timeoutId = setTimeout(() => {
|
472
|
+
clearTimeout(timeoutId);
|
473
|
+
timeoutId = void 0;
|
474
|
+
}, delay);
|
475
|
+
};
|
476
|
+
};
|
477
|
+
|
478
|
+
// src/components/checkbox/components/checkbox.tsx
|
462
479
|
import { jsx as jsx16, jsxs as jsxs2 } from "react/jsx-runtime";
|
463
480
|
var CheckboxComponent = forwardRef7(
|
464
|
-
({ isError = false, animated = false, helpText, errorText, boxProps, children, isDisabled, ...rest }, ref) => {
|
481
|
+
({ isError = false, animated = false, helpText, errorText, boxProps, children, isDisabled, throttleTime, ...rest }, ref) => {
|
465
482
|
const { state } = useCheckbox(rest);
|
483
|
+
const [isChecked, setIsChecked] = useState(!!rest.isChecked);
|
484
|
+
useEffect(() => {
|
485
|
+
setIsChecked(!!rest.isChecked);
|
486
|
+
}, [rest.isChecked]);
|
487
|
+
const throttleFn = useCallback(
|
488
|
+
throttle((val) => setIsChecked(val), throttleTime),
|
489
|
+
[]
|
490
|
+
);
|
491
|
+
const handleOnChange = useCallback((event) => {
|
492
|
+
if (throttleTime) throttleFn(event.target.checked);
|
493
|
+
else setIsChecked(event.target.checked);
|
494
|
+
if (rest.onChange) rest.onChange(event);
|
495
|
+
}, []);
|
466
496
|
const variant = isError ? "errors" : "unstyled";
|
467
497
|
const renderIcon2 = () => {
|
468
498
|
if (state.isChecked) return /* @__PURE__ */ jsx16(Icon.Check, { size: 3, color: "inherit" });
|
@@ -470,7 +500,21 @@ var CheckboxComponent = forwardRef7(
|
|
470
500
|
return void 0;
|
471
501
|
};
|
472
502
|
return /* @__PURE__ */ jsxs2(Box5, { children: [
|
473
|
-
/* @__PURE__ */ jsx16(Box5, { display: "flex", ...boxProps, children: /* @__PURE__ */ jsx16(
|
503
|
+
/* @__PURE__ */ jsx16(Box5, { display: "flex", ...boxProps, children: /* @__PURE__ */ jsx16(
|
504
|
+
Checkbox,
|
505
|
+
{
|
506
|
+
"data-test-id": "Ok3zwJNf_-uY5Pe3mSV4P",
|
507
|
+
variant,
|
508
|
+
ref,
|
509
|
+
...rest,
|
510
|
+
isChecked,
|
511
|
+
onChange: handleOnChange,
|
512
|
+
isDisabled,
|
513
|
+
color: "white",
|
514
|
+
icon: renderIcon2(),
|
515
|
+
children: children && /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.sm", color: isDisabled ? "black.medium" : "black.high", children })
|
516
|
+
}
|
517
|
+
) }),
|
474
518
|
(isError && errorText || helpText) && /* @__PURE__ */ jsx16(Box5, { mt: "1", ml: "6", children: isError ? /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.xs", color: "danger.500", children: errorText }) : /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.xs", color: "black.medium", children: helpText }) })
|
475
519
|
] });
|
476
520
|
}
|
@@ -606,7 +650,7 @@ var chips_default = Chips;
|
|
606
650
|
|
607
651
|
// src/components/counter/components/counter.tsx
|
608
652
|
import { Box as Box10, HStack, IconButton as IconButton3, Text as Text3 } from "@chakra-ui/react";
|
609
|
-
import { useCallback } from "react";
|
653
|
+
import { useCallback as useCallback2 } from "react";
|
610
654
|
import { FiMinus, FiPlus } from "react-icons/fi";
|
611
655
|
|
612
656
|
// src/components/form/components/input-addon.tsx
|
@@ -636,7 +680,7 @@ import { InputRightElement } from "@chakra-ui/react";
|
|
636
680
|
// src/components/form/components/input-field.tsx
|
637
681
|
import { Box as Box8, Input as ChakraInput, InputGroup } from "@chakra-ui/react";
|
638
682
|
import { Close as Close2, Eye as Eye2, EyeOff } from "@ctlyst.id/internal-icon";
|
639
|
-
import React2, { useMemo, useState } from "react";
|
683
|
+
import React2, { useMemo, useState as useState2 } from "react";
|
640
684
|
import { jsx as jsx21, jsxs as jsxs5 } from "react/jsx-runtime";
|
641
685
|
var InputField = React2.forwardRef((props, ref) => {
|
642
686
|
const {
|
@@ -671,7 +715,7 @@ var InputField = React2.forwardRef((props, ref) => {
|
|
671
715
|
focusColor: focusColor2
|
672
716
|
};
|
673
717
|
};
|
674
|
-
const [isShowPassword, setIsShowPassword] =
|
718
|
+
const [isShowPassword, setIsShowPassword] = useState2(false);
|
675
719
|
const inputType = useMemo(() => {
|
676
720
|
return type === "password" && isShowPassword ? "text" : type;
|
677
721
|
}, [isShowPassword, type]);
|
@@ -857,7 +901,7 @@ var Counter = ({
|
|
857
901
|
const increment = () => {
|
858
902
|
onChange(value + 1);
|
859
903
|
};
|
860
|
-
const handleChangeInput =
|
904
|
+
const handleChangeInput = useCallback2(
|
861
905
|
(e) => {
|
862
906
|
const inputValue = e.target.value;
|
863
907
|
const cleanedInputValue = inputValue.replace(/^0+/, "") || "0";
|
@@ -919,10 +963,11 @@ var counter_default = Counter;
|
|
919
963
|
|
920
964
|
// src/components/data-table/components/data-table.tsx
|
921
965
|
import { ChevronDownIcon, ChevronUpIcon, UpDownIcon } from "@chakra-ui/icons";
|
922
|
-
import { Box as Box11,
|
966
|
+
import { Box as Box11, Flex as Flex2, Skeleton as Skeleton2, Table, Tbody, Td, Th, Thead, Tr, useColorModeValue } from "@chakra-ui/react";
|
923
967
|
import { css } from "@emotion/react";
|
924
968
|
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
925
969
|
import * as React5 from "react";
|
970
|
+
import { useCallback as useCallback3 } from "react";
|
926
971
|
|
927
972
|
// src/hooks/use-drag-threshold/use-drag-or-click.ts
|
928
973
|
import { useRef } from "react";
|
@@ -1007,23 +1052,23 @@ var isCellDisabled = (row, cellId) => {
|
|
1007
1052
|
}
|
1008
1053
|
return false;
|
1009
1054
|
};
|
1010
|
-
var getCommonPinningStyles = (column) => {
|
1055
|
+
var getCommonPinningStyles = (column, paddingRowX) => {
|
1011
1056
|
const isPinned = column.getIsPinned();
|
1012
1057
|
const isFirstLeftPinnedColumn = isPinned === "left" && column.getIsFirstColumn("left");
|
1013
1058
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
1014
1059
|
const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
|
1015
1060
|
const isLastRightPinnedColumn = isPinned === "right" && column.getIsLastColumn("right");
|
1016
1061
|
return {
|
1017
|
-
left: isPinned === "left" ? `${column.getStart("left") + (!isFirstLeftPinnedColumn ?
|
1018
|
-
right: isPinned === "right" ? `${column.getAfter("right") + (!isLastRightPinnedColumn ?
|
1062
|
+
left: isPinned === "left" ? `${column.getStart("left") + (!isFirstLeftPinnedColumn ? paddingRowX : 0)}px` : void 0,
|
1063
|
+
right: isPinned === "right" ? `${column.getAfter("right") + (!isLastRightPinnedColumn ? paddingRowX : 0)}px` : void 0,
|
1019
1064
|
position: isPinned ? "sticky" : "relative",
|
1020
1065
|
zIndex: isPinned ? 1 : 0,
|
1021
1066
|
...isFirstLeftPinnedColumn ? {
|
1022
|
-
pl:
|
1023
|
-
} : {
|
1067
|
+
pl: `${paddingRowX + 8}px`
|
1068
|
+
} : {},
|
1024
1069
|
...isLastRightPinnedColumn ? {
|
1025
|
-
pr:
|
1026
|
-
} : {
|
1070
|
+
pr: `${paddingRowX + 8}px`
|
1071
|
+
} : {},
|
1027
1072
|
...isLastLeftPinnedColumn ? {
|
1028
1073
|
py: "16px",
|
1029
1074
|
pr: "8px",
|
@@ -1080,13 +1125,19 @@ var useDataTable = ({
|
|
1080
1125
|
const [sorting, setSorting] = React5.useState(sortingState != null ? sortingState : []);
|
1081
1126
|
const dataColumns = React5.useMemo(() => columns, [columns]);
|
1082
1127
|
const action = React5.useRef("");
|
1128
|
+
const throttleRowClick = useCallback3(
|
1129
|
+
throttle((row) => {
|
1130
|
+
row.toggleSelected();
|
1131
|
+
}, 250),
|
1132
|
+
[]
|
1133
|
+
);
|
1083
1134
|
const checkboxColumn = React5.useMemo(
|
1084
1135
|
() => [
|
1085
1136
|
{
|
1086
1137
|
id: "select",
|
1087
1138
|
size: 32,
|
1088
1139
|
header: ({ table: table2 }) => /* @__PURE__ */ jsx24(Flex2, { justifyContent: "center", children: /* @__PURE__ */ jsx24(
|
1089
|
-
|
1140
|
+
checkbox_default,
|
1090
1141
|
{
|
1091
1142
|
"data-test-id": "select-header-data-table",
|
1092
1143
|
...{
|
@@ -1112,19 +1163,20 @@ var useDataTable = ({
|
|
1112
1163
|
}
|
1113
1164
|
}
|
1114
1165
|
) }),
|
1115
|
-
cell: ({ row }) =>
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1166
|
+
cell: ({ row }) => {
|
1167
|
+
return /* @__PURE__ */ jsx24(Flex2, { justifyContent: "center", children: /* @__PURE__ */ jsx24(
|
1168
|
+
checkbox_default,
|
1169
|
+
{
|
1170
|
+
"data-test-id": `select-data-table-${row.index}`,
|
1120
1171
|
isChecked: row.getIsSelected(),
|
1121
|
-
isIndeterminate: row.getIsSomeSelected()
|
1172
|
+
isIndeterminate: row.getIsSomeSelected(),
|
1173
|
+
onChange: () => throttleRowClick(row)
|
1122
1174
|
}
|
1123
|
-
}
|
1124
|
-
|
1175
|
+
) });
|
1176
|
+
}
|
1125
1177
|
}
|
1126
1178
|
],
|
1127
|
-
[
|
1179
|
+
[]
|
1128
1180
|
);
|
1129
1181
|
const generateColumn = () => {
|
1130
1182
|
if (withSelectedRow) {
|
@@ -1176,11 +1228,12 @@ var useDataTable = ({
|
|
1176
1228
|
table,
|
1177
1229
|
action,
|
1178
1230
|
toggleAllRowsSelected,
|
1179
|
-
generateColumn
|
1231
|
+
generateColumn,
|
1232
|
+
throttleRowClick
|
1180
1233
|
};
|
1181
1234
|
};
|
1182
1235
|
var DataTable = React5.forwardRef((props, ref) => {
|
1183
|
-
var _a, _b, _c, _d, _e
|
1236
|
+
var _a, _b, _c, _d, _e;
|
1184
1237
|
const {
|
1185
1238
|
isLoading,
|
1186
1239
|
styles,
|
@@ -1192,10 +1245,11 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1192
1245
|
highlightedRow,
|
1193
1246
|
withSelectedRow,
|
1194
1247
|
highlightRowColor,
|
1195
|
-
cellLineClamp = 2
|
1248
|
+
cellLineClamp = 2,
|
1249
|
+
paddingRowX = 8
|
1196
1250
|
} = props;
|
1197
1251
|
const { clickOrDragged, getDragOrClickProps } = useDragOrClick();
|
1198
|
-
const { table, action, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1252
|
+
const { table, action, throttleRowClick, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1199
1253
|
const refTable = React5.useRef(null);
|
1200
1254
|
React5.useImperativeHandle(ref, () => ({
|
1201
1255
|
toggleAllRowsSelected
|
@@ -1239,18 +1293,28 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1239
1293
|
};
|
1240
1294
|
}, []);
|
1241
1295
|
const hasScroll = ((_a = refTable == null ? void 0 : refTable.current) == null ? void 0 : _a.offsetWidth) && ((_b = refTable == null ? void 0 : refTable.current) == null ? void 0 : _b.scrollWidth) && ((_c = refTable == null ? void 0 : refTable.current) == null ? void 0 : _c.offsetWidth) < ((_d = refTable == null ? void 0 : refTable.current) == null ? void 0 : _d.scrollWidth);
|
1296
|
+
const getTableHeaderSize = (header, index, totalColumn) => {
|
1297
|
+
if (header.column.getIsFirstColumn("left") || header.column.getIsLastColumn("right")) {
|
1298
|
+
return { width: `${header.getSize() + paddingRowX}px` };
|
1299
|
+
}
|
1300
|
+
if (index === 0) {
|
1301
|
+
return { width: `${header.getSize() + paddingRowX}px`, paddingLeft: `${8 + paddingRowX}` };
|
1302
|
+
}
|
1303
|
+
if (index === totalColumn - 1) {
|
1304
|
+
return { width: `${header.getSize() + paddingRowX}px`, paddingRight: `${8 + paddingRowX}` };
|
1305
|
+
}
|
1306
|
+
return { width: `${header.getSize()}px` };
|
1307
|
+
};
|
1242
1308
|
return /* @__PURE__ */ jsx24(
|
1243
1309
|
Box11,
|
1244
1310
|
{
|
1245
1311
|
overflowX: "auto",
|
1246
1312
|
overflowY: "hidden",
|
1247
1313
|
position: "relative",
|
1248
|
-
pl: ((_e = columnPinning == null ? void 0 : columnPinning.left) == null ? void 0 : _e.length) ? 0 : 2,
|
1249
|
-
pr: ((_f = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _f.length) ? 0 : 2,
|
1250
1314
|
maxW: "100%",
|
1251
1315
|
w: "full",
|
1252
1316
|
ref: refTable,
|
1253
|
-
...((
|
1317
|
+
...((_e = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _e.length) && hasScroll ? { "data-pin-right": true } : {},
|
1254
1318
|
...container,
|
1255
1319
|
children: isLoading ? /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, "data-loading": "true", children: [
|
1256
1320
|
/* @__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(
|
@@ -1288,8 +1352,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1288
1352
|
Th,
|
1289
1353
|
{
|
1290
1354
|
colSpan: header.colSpan,
|
1291
|
-
|
1292
|
-
|
1355
|
+
_first: { paddingLeft: `${paddingRowX + 8}px` },
|
1356
|
+
_last: { paddingRight: `${paddingRowX + 8}px` },
|
1357
|
+
sx: getCommonPinningStyles(header.column, paddingRowX),
|
1358
|
+
...getTableHeaderSize(header, index, headerGroup.headers.length),
|
1293
1359
|
...styles == null ? void 0 : styles.tableColumnHeader,
|
1294
1360
|
children: /* @__PURE__ */ jsxs8(
|
1295
1361
|
Flex2,
|
@@ -1325,7 +1391,7 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1325
1391
|
}) }, headerGroup.id))
|
1326
1392
|
}
|
1327
1393
|
),
|
1328
|
-
/* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
|
1394
|
+
/* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row, index) => {
|
1329
1395
|
const isDisabledRow = disabledRow && disabledRow(row.original);
|
1330
1396
|
const isHighlightedRow = highlightedRow && highlightedRow(row.original);
|
1331
1397
|
return /* @__PURE__ */ jsx24(
|
@@ -1357,7 +1423,7 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1357
1423
|
},
|
1358
1424
|
onClick: () => {
|
1359
1425
|
action.current = "selectRow";
|
1360
|
-
if (withSelectedRow) row
|
1426
|
+
if (withSelectedRow) throttleRowClick(row);
|
1361
1427
|
if (onRowClick) {
|
1362
1428
|
if (isDisabledRow) return;
|
1363
1429
|
onRowClick(row.original);
|
@@ -1374,8 +1440,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1374
1440
|
{
|
1375
1441
|
"data-test-id": `CT_Component_TableCell_${cell.id}`,
|
1376
1442
|
fontSize: "text.sm",
|
1443
|
+
_first: { paddingLeft: `${paddingRowX + 8}px` },
|
1444
|
+
_last: { paddingRight: `${paddingRowX + 8}px` },
|
1377
1445
|
sx: {
|
1378
|
-
...getCommonPinningStyles(cell.column)
|
1446
|
+
...getCommonPinningStyles(cell.column, paddingRowX)
|
1379
1447
|
},
|
1380
1448
|
...styles == null ? void 0 : styles.tableCell,
|
1381
1449
|
children: /* @__PURE__ */ jsx24(
|
@@ -1387,14 +1455,22 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1387
1455
|
align: "center",
|
1388
1456
|
"data-test-id": `CT_Component_TableCell_Content-${cell.id}`,
|
1389
1457
|
opacity: isDisabled ? 0.5 : 1,
|
1390
|
-
...cellLineClamp > 0 ? {
|
1391
|
-
noOfLines: cellLineClamp,
|
1392
|
-
sx: {
|
1393
|
-
display: "-webkit-inline-box"
|
1394
|
-
}
|
1395
|
-
} : {},
|
1396
1458
|
sx: { ...meta && meta.columnStyles ? meta.columnStyles : {} },
|
1397
|
-
children:
|
1459
|
+
children: /* @__PURE__ */ jsx24(
|
1460
|
+
Box11,
|
1461
|
+
{
|
1462
|
+
onMouseUp: (e) => {
|
1463
|
+
e.stopPropagation();
|
1464
|
+
},
|
1465
|
+
...cellLineClamp > 0 ? {
|
1466
|
+
noOfLines: cellLineClamp,
|
1467
|
+
sx: {
|
1468
|
+
display: "-webkit-inline-box"
|
1469
|
+
}
|
1470
|
+
} : {},
|
1471
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
1472
|
+
}
|
1473
|
+
)
|
1398
1474
|
}
|
1399
1475
|
)
|
1400
1476
|
},
|
@@ -4793,7 +4869,7 @@ function SelectCreatable({ styles, isError = false, ...rest }) {
|
|
4793
4869
|
}
|
4794
4870
|
|
4795
4871
|
// src/components/select/components/select-with-checkbox.tsx
|
4796
|
-
import { Checkbox as
|
4872
|
+
import { Checkbox as Checkbox2, Flex as Flex12, Text as Text14 } from "@chakra-ui/react";
|
4797
4873
|
import { useColorMode as useColorMode7 } from "@chakra-ui/system";
|
4798
4874
|
import ReactSelect2, { components as ComponentRS } from "react-select";
|
4799
4875
|
import { Fragment as Fragment8, jsx as jsx57, jsxs as jsxs24 } from "react/jsx-runtime";
|
@@ -4865,7 +4941,7 @@ var InputOption = ({
|
|
4865
4941
|
cursor: isDisabled ? "not-allowed" : "default",
|
4866
4942
|
children: [
|
4867
4943
|
(data == null ? void 0 : data.selectAllCheckbox) ? /* @__PURE__ */ jsx57(
|
4868
|
-
|
4944
|
+
Checkbox2,
|
4869
4945
|
{
|
4870
4946
|
isChecked: checkedState === CHECKBOX_STATE.CHECKED,
|
4871
4947
|
isIndeterminate: checkedState === CHECKBOX_STATE.INDETERMINATE,
|
@@ -4874,7 +4950,7 @@ var InputOption = ({
|
|
4874
4950
|
"data-test-id": "CT_component_select-checkbox_select-all-option"
|
4875
4951
|
}
|
4876
4952
|
) : /* @__PURE__ */ jsx57(
|
4877
|
-
|
4953
|
+
Checkbox2,
|
4878
4954
|
{
|
4879
4955
|
pointerEvents: "none",
|
4880
4956
|
isChecked: isSelected,
|
@@ -5408,36 +5484,36 @@ import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text
|
|
5408
5484
|
// src/components/time-input/components/index.tsx
|
5409
5485
|
import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup4 } from "@chakra-ui/react";
|
5410
5486
|
import { Clock } from "@ctlyst.id/internal-icon";
|
5411
|
-
import { useEffect as
|
5487
|
+
import { useEffect as useEffect4, useImperativeHandle as useImperativeHandle2 } from "react";
|
5412
5488
|
|
5413
5489
|
// src/components/time-input/components/integration.tsx
|
5414
5490
|
import { $NOW, TimescapeManager } from "@zamiru/timescape";
|
5415
5491
|
import { marry } from "@zamiru/timescape";
|
5416
5492
|
import {
|
5417
|
-
useEffect as
|
5493
|
+
useEffect as useEffect3,
|
5418
5494
|
useLayoutEffect,
|
5419
5495
|
useRef as useRef3,
|
5420
|
-
useState as
|
5496
|
+
useState as useState5
|
5421
5497
|
} from "react";
|
5422
5498
|
var useTimescape = (options = {}) => {
|
5423
5499
|
var _a;
|
5424
5500
|
const { date, onChangeDate, ...rest } = options;
|
5425
|
-
const [manager] =
|
5501
|
+
const [manager] = useState5(() => new TimescapeManager(date, rest));
|
5426
5502
|
const onChangeDateRef = useRef3(onChangeDate);
|
5427
5503
|
useLayoutEffect(() => {
|
5428
5504
|
onChangeDateRef.current = onChangeDate;
|
5429
5505
|
}, [onChangeDate]);
|
5430
|
-
const [optionsState, update] =
|
5506
|
+
const [optionsState, update] = useState5(() => ({
|
5431
5507
|
date,
|
5432
5508
|
...rest
|
5433
5509
|
}));
|
5434
|
-
|
5510
|
+
useEffect3(() => {
|
5435
5511
|
manager.resync();
|
5436
5512
|
return () => {
|
5437
5513
|
manager.remove();
|
5438
5514
|
};
|
5439
5515
|
}, [manager]);
|
5440
|
-
|
5516
|
+
useEffect3(() => {
|
5441
5517
|
return manager.on("changeDate", (nextDate) => {
|
5442
5518
|
var _a2;
|
5443
5519
|
(_a2 = onChangeDateRef.current) == null ? void 0 : _a2.call(onChangeDateRef, nextDate);
|
@@ -5445,7 +5521,7 @@ var useTimescape = (options = {}) => {
|
|
5445
5521
|
});
|
5446
5522
|
}, [manager]);
|
5447
5523
|
const timestamp = (_a = optionsState.date) == null ? void 0 : _a.getTime();
|
5448
|
-
|
5524
|
+
useEffect3(() => {
|
5449
5525
|
manager.date = timestamp;
|
5450
5526
|
manager.minDate = optionsState.minDate;
|
5451
5527
|
manager.maxDate = optionsState.maxDate;
|
@@ -5558,7 +5634,7 @@ var TimeInput2 = forwardRef12(
|
|
5558
5634
|
date,
|
5559
5635
|
...config2
|
5560
5636
|
});
|
5561
|
-
|
5637
|
+
useEffect4(() => {
|
5562
5638
|
var _a, _b, _c, _d, _e, _f;
|
5563
5639
|
timeValue.hours = (_b = (_a = options == null ? void 0 : options.date) == null ? void 0 : _a.getHours()) != null ? _b : 0;
|
5564
5640
|
timeValue.minutes = (_d = (_c = options == null ? void 0 : options.date) == null ? void 0 : _c.getMinutes()) != null ? _d : 0;
|
@@ -5817,7 +5893,7 @@ import {
|
|
5817
5893
|
UnorderedList as UnorderedList2
|
5818
5894
|
} from "@chakra-ui/react";
|
5819
5895
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
5820
|
-
import { useCallback as
|
5896
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useState as useState6 } from "react";
|
5821
5897
|
import { useDropzone } from "react-dropzone";
|
5822
5898
|
|
5823
5899
|
// src/components/uploader/constants.ts
|
@@ -5916,9 +5992,9 @@ var Uploader = ({
|
|
5916
5992
|
validatorExt,
|
5917
5993
|
...props
|
5918
5994
|
}) => {
|
5919
|
-
const [filePreview, setFilePreview] =
|
5995
|
+
const [filePreview, setFilePreview] = useState6();
|
5920
5996
|
const toast2 = useToast();
|
5921
|
-
const handleRejection =
|
5997
|
+
const handleRejection = useCallback4(
|
5922
5998
|
(message, file, image) => {
|
5923
5999
|
if (onHandleRejections) {
|
5924
6000
|
onHandleRejections(file, image);
|
@@ -5928,7 +6004,7 @@ var Uploader = ({
|
|
5928
6004
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5929
6005
|
[onHandleRejections]
|
5930
6006
|
);
|
5931
|
-
const onDropAccepted =
|
6007
|
+
const onDropAccepted = useCallback4(
|
5932
6008
|
(files) => {
|
5933
6009
|
const file = files[0];
|
5934
6010
|
const imageUrl = URL.createObjectURL(file);
|
@@ -5951,10 +6027,10 @@ var Uploader = ({
|
|
5951
6027
|
},
|
5952
6028
|
[acceptFormat, customValidation, dimension, handleRejection, maxFileSize, onHandleUploadFile]
|
5953
6029
|
);
|
5954
|
-
const onDropRejected =
|
6030
|
+
const onDropRejected = useCallback4((fileRejections) => {
|
5955
6031
|
defaultOnHandleRejections(fileRejections, { acceptFormat, maxFileSize }, handleRejection);
|
5956
6032
|
}, []);
|
5957
|
-
const validator =
|
6033
|
+
const validator = useCallback4(
|
5958
6034
|
(file) => {
|
5959
6035
|
const result = [];
|
5960
6036
|
if (validatorExt) {
|
@@ -6003,7 +6079,7 @@ var Uploader = ({
|
|
6003
6079
|
onHandleUploadFile == null ? void 0 : onHandleUploadFile(null, null);
|
6004
6080
|
acceptedFiles.pop();
|
6005
6081
|
};
|
6006
|
-
|
6082
|
+
useEffect5(() => {
|
6007
6083
|
if (value) {
|
6008
6084
|
if (typeof value === "string") {
|
6009
6085
|
setFilePreview(value);
|
@@ -6853,14 +6929,14 @@ var variants2 = {
|
|
6853
6929
|
errors,
|
6854
6930
|
unstyled
|
6855
6931
|
};
|
6856
|
-
var
|
6932
|
+
var Checkbox3 = defineMultiStyleConfig3({
|
6857
6933
|
baseStyle: baseStyle3,
|
6858
6934
|
variants: variants2,
|
6859
6935
|
defaultProps: {
|
6860
6936
|
variant: "unstyled"
|
6861
6937
|
}
|
6862
6938
|
});
|
6863
|
-
var checkbox_default2 =
|
6939
|
+
var checkbox_default2 = Checkbox3;
|
6864
6940
|
|
6865
6941
|
// src/config/theme/components/chips.ts
|
6866
6942
|
import { tagAnatomy } from "@chakra-ui/anatomy";
|
@@ -7848,7 +7924,7 @@ import { useMemo as useMemo5 } from "react";
|
|
7848
7924
|
|
7849
7925
|
// src/provider/components/provider.tsx
|
7850
7926
|
import axios from "axios";
|
7851
|
-
import { createContext as createContext2, useContext, useEffect as
|
7927
|
+
import { createContext as createContext2, useContext, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef4 } from "react";
|
7852
7928
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
7853
7929
|
import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
|
7854
7930
|
var ProviderContext = createContext2({
|
@@ -7860,7 +7936,7 @@ var useInternalUI = () => {
|
|
7860
7936
|
};
|
7861
7937
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
7862
7938
|
const instanceRef = useRef4(axios.create(config2));
|
7863
|
-
|
7939
|
+
useEffect6(() => {
|
7864
7940
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
7865
7941
|
instanceRef.current.interceptors.request.use(interceptor);
|
7866
7942
|
});
|