@ctlyst.id/internal-ui 5.4.4 → 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.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, useEffect, useState } from "react";
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((val) => setIsChecked(val), throttleTime),
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
- if (throttleTime) throttleFn(event.target.checked);
494
- else setIsChecked(event.target.checked);
495
- if (rest.onChange) rest.onChange(event);
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 as useState2 } from "react";
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] = useState2(false);
720
+ const [isShowPassword, setIsShowPassword] = useState(false);
722
721
  const inputType = useMemo(() => {
723
722
  return type === "password" && isShowPassword ? "text" : type;
724
723
  }, [isShowPassword, type]);
@@ -4669,8 +4668,7 @@ function selectStyles(colorMode, _isError) {
4669
4668
  ...base,
4670
4669
  ...selectStyle,
4671
4670
  color: "var(--chakra-colors-neutral-900)",
4672
- padding: 12,
4673
- height: 42
4671
+ padding: 12
4674
4672
  }),
4675
4673
  menu: (base) => {
4676
4674
  return {
@@ -5490,36 +5488,36 @@ import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text
5490
5488
  // src/components/time-input/components/index.tsx
5491
5489
  import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup4 } from "@chakra-ui/react";
5492
5490
  import { Clock } from "@ctlyst.id/internal-icon";
5493
- import { useEffect as useEffect4, useImperativeHandle as useImperativeHandle2 } from "react";
5491
+ import { useEffect as useEffect3, useImperativeHandle as useImperativeHandle2 } from "react";
5494
5492
 
5495
5493
  // src/components/time-input/components/integration.tsx
5496
5494
  import { $NOW, TimescapeManager } from "@zamiru/timescape";
5497
5495
  import { marry } from "@zamiru/timescape";
5498
5496
  import {
5499
- useEffect as useEffect3,
5497
+ useEffect as useEffect2,
5500
5498
  useLayoutEffect,
5501
5499
  useRef as useRef3,
5502
- useState as useState5
5500
+ useState as useState4
5503
5501
  } from "react";
5504
5502
  var useTimescape = (options = {}) => {
5505
5503
  var _a;
5506
5504
  const { date, onChangeDate, ...rest } = options;
5507
- const [manager] = useState5(() => new TimescapeManager(date, rest));
5505
+ const [manager] = useState4(() => new TimescapeManager(date, rest));
5508
5506
  const onChangeDateRef = useRef3(onChangeDate);
5509
5507
  useLayoutEffect(() => {
5510
5508
  onChangeDateRef.current = onChangeDate;
5511
5509
  }, [onChangeDate]);
5512
- const [optionsState, update] = useState5(() => ({
5510
+ const [optionsState, update] = useState4(() => ({
5513
5511
  date,
5514
5512
  ...rest
5515
5513
  }));
5516
- useEffect3(() => {
5514
+ useEffect2(() => {
5517
5515
  manager.resync();
5518
5516
  return () => {
5519
5517
  manager.remove();
5520
5518
  };
5521
5519
  }, [manager]);
5522
- useEffect3(() => {
5520
+ useEffect2(() => {
5523
5521
  return manager.on("changeDate", (nextDate) => {
5524
5522
  var _a2;
5525
5523
  (_a2 = onChangeDateRef.current) == null ? void 0 : _a2.call(onChangeDateRef, nextDate);
@@ -5527,7 +5525,7 @@ var useTimescape = (options = {}) => {
5527
5525
  });
5528
5526
  }, [manager]);
5529
5527
  const timestamp = (_a = optionsState.date) == null ? void 0 : _a.getTime();
5530
- useEffect3(() => {
5528
+ useEffect2(() => {
5531
5529
  manager.date = timestamp;
5532
5530
  manager.minDate = optionsState.minDate;
5533
5531
  manager.maxDate = optionsState.maxDate;
@@ -5640,7 +5638,7 @@ var TimeInput2 = forwardRef12(
5640
5638
  date,
5641
5639
  ...config2
5642
5640
  });
5643
- useEffect4(() => {
5641
+ useEffect3(() => {
5644
5642
  var _a, _b, _c, _d, _e, _f;
5645
5643
  timeValue.hours = (_b = (_a = options == null ? void 0 : options.date) == null ? void 0 : _a.getHours()) != null ? _b : 0;
5646
5644
  timeValue.minutes = (_d = (_c = options == null ? void 0 : options.date) == null ? void 0 : _c.getMinutes()) != null ? _d : 0;
@@ -5900,7 +5898,7 @@ import {
5900
5898
  UnorderedList as UnorderedList2
5901
5899
  } from "@chakra-ui/react";
5902
5900
  import { Close as X, Plus } from "@ctlyst.id/internal-icon";
5903
- import { useCallback as useCallback4, useEffect as useEffect5, useState as useState6 } from "react";
5901
+ import { useCallback as useCallback4, useEffect as useEffect4, useState as useState5 } from "react";
5904
5902
  import { useDropzone } from "react-dropzone";
5905
5903
 
5906
5904
  // src/components/uploader/constants.ts
@@ -5999,7 +5997,7 @@ var Uploader = ({
5999
5997
  validatorExt,
6000
5998
  ...props
6001
5999
  }) => {
6002
- const [filePreview, setFilePreview] = useState6();
6000
+ const [filePreview, setFilePreview] = useState5();
6003
6001
  const toast2 = useToast();
6004
6002
  const handleRejection = useCallback4(
6005
6003
  (message, file, image) => {
@@ -6091,7 +6089,7 @@ var Uploader = ({
6091
6089
  onHandleUploadFile == null ? void 0 : onHandleUploadFile(null, null);
6092
6090
  acceptedFiles.pop();
6093
6091
  };
6094
- useEffect5(() => {
6092
+ useEffect4(() => {
6095
6093
  if (value) {
6096
6094
  if (typeof value === "string") {
6097
6095
  setFilePreview(value);
@@ -7940,7 +7938,7 @@ import { useMemo as useMemo5 } from "react";
7940
7938
 
7941
7939
  // src/provider/components/provider.tsx
7942
7940
  import axios from "axios";
7943
- import { createContext as createContext2, useContext, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef4 } from "react";
7941
+ import { createContext as createContext2, useContext, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef4 } from "react";
7944
7942
  import { ToastContainer as ToastContainer2 } from "react-toastify";
7945
7943
  import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
7946
7944
  var ProviderContext = createContext2({
@@ -7952,7 +7950,7 @@ var useInternalUI = () => {
7952
7950
  };
7953
7951
  var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
7954
7952
  const instanceRef = useRef4(axios.create(config2));
7955
- useEffect6(() => {
7953
+ useEffect5(() => {
7956
7954
  requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
7957
7955
  instanceRef.current.interceptors.request.use(interceptor);
7958
7956
  });