@ctlyst.id/internal-ui 5.4.5 → 5.4.6
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 +8 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -459,7 +459,7 @@ 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
|
462
|
+
import { useCallback } from "react";
|
463
463
|
|
464
464
|
// src/utils/throttleFn.ts
|
465
465
|
var throttle = (fn, delay) => {
|
@@ -480,19 +480,18 @@ import { jsx as jsx16, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
480
480
|
var CheckboxComponent = forwardRef7(
|
481
481
|
({ isError = false, animated = false, helpText, errorText, boxProps, children, isDisabled, throttleTime, ...rest }, ref) => {
|
482
482
|
const { state } = useCheckbox(rest);
|
483
|
-
const [isChecked, setIsChecked] = useState(!!rest.isChecked);
|
484
|
-
useEffect(() => {
|
485
|
-
setIsChecked(!!rest.isChecked);
|
486
|
-
}, [rest.isChecked]);
|
487
483
|
const throttleFn = useCallback(
|
488
|
-
throttle((
|
484
|
+
throttle((event) => {
|
485
|
+
var _a;
|
486
|
+
return (_a = rest.onChange) == null ? void 0 : _a.call(rest, event);
|
487
|
+
}, throttleTime),
|
489
488
|
[]
|
490
489
|
);
|
491
490
|
const handleOnChange = useCallback(
|
492
491
|
(event) => {
|
493
|
-
|
494
|
-
|
495
|
-
|
492
|
+
var _a;
|
493
|
+
if (throttleTime) throttleFn(event);
|
494
|
+
else (_a = rest.onChange) == null ? void 0 : _a.call(rest, event);
|
496
495
|
},
|
497
496
|
[rest.onChange]
|
498
497
|
);
|
@@ -510,7 +509,7 @@ var CheckboxComponent = forwardRef7(
|
|
510
509
|
variant,
|
511
510
|
ref,
|
512
511
|
...rest,
|
513
|
-
isChecked,
|
512
|
+
isChecked: rest.isChecked,
|
514
513
|
onChange: handleOnChange,
|
515
514
|
isDisabled,
|
516
515
|
color: "white",
|
@@ -683,7 +682,7 @@ import { InputRightElement } from "@chakra-ui/react";
|
|
683
682
|
// src/components/form/components/input-field.tsx
|
684
683
|
import { Box as Box8, Input as ChakraInput, InputGroup } from "@chakra-ui/react";
|
685
684
|
import { Close as Close2, Eye as Eye2, EyeOff } from "@ctlyst.id/internal-icon";
|
686
|
-
import React2, { useMemo, useState
|
685
|
+
import React2, { useMemo, useState } from "react";
|
687
686
|
import { jsx as jsx21, jsxs as jsxs5 } from "react/jsx-runtime";
|
688
687
|
var InputField = React2.forwardRef((props, ref) => {
|
689
688
|
const {
|
@@ -718,7 +717,7 @@ var InputField = React2.forwardRef((props, ref) => {
|
|
718
717
|
focusColor: focusColor2
|
719
718
|
};
|
720
719
|
};
|
721
|
-
const [isShowPassword, setIsShowPassword] =
|
720
|
+
const [isShowPassword, setIsShowPassword] = useState(false);
|
722
721
|
const inputType = useMemo(() => {
|
723
722
|
return type === "password" && isShowPassword ? "text" : type;
|
724
723
|
}, [isShowPassword, type]);
|
@@ -5489,36 +5488,36 @@ import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text
|
|
5489
5488
|
// src/components/time-input/components/index.tsx
|
5490
5489
|
import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup4 } from "@chakra-ui/react";
|
5491
5490
|
import { Clock } from "@ctlyst.id/internal-icon";
|
5492
|
-
import { useEffect as
|
5491
|
+
import { useEffect as useEffect3, useImperativeHandle as useImperativeHandle2 } from "react";
|
5493
5492
|
|
5494
5493
|
// src/components/time-input/components/integration.tsx
|
5495
5494
|
import { $NOW, TimescapeManager } from "@zamiru/timescape";
|
5496
5495
|
import { marry } from "@zamiru/timescape";
|
5497
5496
|
import {
|
5498
|
-
useEffect as
|
5497
|
+
useEffect as useEffect2,
|
5499
5498
|
useLayoutEffect,
|
5500
5499
|
useRef as useRef3,
|
5501
|
-
useState as
|
5500
|
+
useState as useState4
|
5502
5501
|
} from "react";
|
5503
5502
|
var useTimescape = (options = {}) => {
|
5504
5503
|
var _a;
|
5505
5504
|
const { date, onChangeDate, ...rest } = options;
|
5506
|
-
const [manager] =
|
5505
|
+
const [manager] = useState4(() => new TimescapeManager(date, rest));
|
5507
5506
|
const onChangeDateRef = useRef3(onChangeDate);
|
5508
5507
|
useLayoutEffect(() => {
|
5509
5508
|
onChangeDateRef.current = onChangeDate;
|
5510
5509
|
}, [onChangeDate]);
|
5511
|
-
const [optionsState, update] =
|
5510
|
+
const [optionsState, update] = useState4(() => ({
|
5512
5511
|
date,
|
5513
5512
|
...rest
|
5514
5513
|
}));
|
5515
|
-
|
5514
|
+
useEffect2(() => {
|
5516
5515
|
manager.resync();
|
5517
5516
|
return () => {
|
5518
5517
|
manager.remove();
|
5519
5518
|
};
|
5520
5519
|
}, [manager]);
|
5521
|
-
|
5520
|
+
useEffect2(() => {
|
5522
5521
|
return manager.on("changeDate", (nextDate) => {
|
5523
5522
|
var _a2;
|
5524
5523
|
(_a2 = onChangeDateRef.current) == null ? void 0 : _a2.call(onChangeDateRef, nextDate);
|
@@ -5526,7 +5525,7 @@ var useTimescape = (options = {}) => {
|
|
5526
5525
|
});
|
5527
5526
|
}, [manager]);
|
5528
5527
|
const timestamp = (_a = optionsState.date) == null ? void 0 : _a.getTime();
|
5529
|
-
|
5528
|
+
useEffect2(() => {
|
5530
5529
|
manager.date = timestamp;
|
5531
5530
|
manager.minDate = optionsState.minDate;
|
5532
5531
|
manager.maxDate = optionsState.maxDate;
|
@@ -5639,7 +5638,7 @@ var TimeInput2 = forwardRef12(
|
|
5639
5638
|
date,
|
5640
5639
|
...config2
|
5641
5640
|
});
|
5642
|
-
|
5641
|
+
useEffect3(() => {
|
5643
5642
|
var _a, _b, _c, _d, _e, _f;
|
5644
5643
|
timeValue.hours = (_b = (_a = options == null ? void 0 : options.date) == null ? void 0 : _a.getHours()) != null ? _b : 0;
|
5645
5644
|
timeValue.minutes = (_d = (_c = options == null ? void 0 : options.date) == null ? void 0 : _c.getMinutes()) != null ? _d : 0;
|
@@ -5899,7 +5898,7 @@ import {
|
|
5899
5898
|
UnorderedList as UnorderedList2
|
5900
5899
|
} from "@chakra-ui/react";
|
5901
5900
|
import { Close as X, Plus } from "@ctlyst.id/internal-icon";
|
5902
|
-
import { useCallback as useCallback4, useEffect as
|
5901
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useState as useState5 } from "react";
|
5903
5902
|
import { useDropzone } from "react-dropzone";
|
5904
5903
|
|
5905
5904
|
// src/components/uploader/constants.ts
|
@@ -5998,7 +5997,7 @@ var Uploader = ({
|
|
5998
5997
|
validatorExt,
|
5999
5998
|
...props
|
6000
5999
|
}) => {
|
6001
|
-
const [filePreview, setFilePreview] =
|
6000
|
+
const [filePreview, setFilePreview] = useState5();
|
6002
6001
|
const toast2 = useToast();
|
6003
6002
|
const handleRejection = useCallback4(
|
6004
6003
|
(message, file, image) => {
|
@@ -6090,7 +6089,7 @@ var Uploader = ({
|
|
6090
6089
|
onHandleUploadFile == null ? void 0 : onHandleUploadFile(null, null);
|
6091
6090
|
acceptedFiles.pop();
|
6092
6091
|
};
|
6093
|
-
|
6092
|
+
useEffect4(() => {
|
6094
6093
|
if (value) {
|
6095
6094
|
if (typeof value === "string") {
|
6096
6095
|
setFilePreview(value);
|
@@ -7939,7 +7938,7 @@ import { useMemo as useMemo5 } from "react";
|
|
7939
7938
|
|
7940
7939
|
// src/provider/components/provider.tsx
|
7941
7940
|
import axios from "axios";
|
7942
|
-
import { createContext as createContext2, useContext, useEffect as
|
7941
|
+
import { createContext as createContext2, useContext, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef4 } from "react";
|
7943
7942
|
import { ToastContainer as ToastContainer2 } from "react-toastify";
|
7944
7943
|
import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
|
7945
7944
|
var ProviderContext = createContext2({
|
@@ -7951,7 +7950,7 @@ var useInternalUI = () => {
|
|
7951
7950
|
};
|
7952
7951
|
var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
|
7953
7952
|
const instanceRef = useRef4(axios.create(config2));
|
7954
|
-
|
7953
|
+
useEffect5(() => {
|
7955
7954
|
requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
|
7956
7955
|
instanceRef.current.interceptors.request.use(interceptor);
|
7957
7956
|
});
|