@ctlyst.id/internal-ui 3.3.2 → 3.3.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -38,23 +38,14 @@ var AccordionIndicator = () => {
38
38
  import {
39
39
  Accordion,
40
40
  AccordionButton,
41
- AccordionButtonProps,
42
41
  AccordionIcon,
43
- AccordionIconProps,
44
42
  AccordionItem,
45
- AccordionItemProps,
46
43
  AccordionPanel,
47
- AccordionPanelProps,
48
- AccordionProps,
49
44
  AccordionProvider,
50
45
  useAccordion,
51
46
  useAccordionContext,
52
47
  useAccordionItem,
53
- UseAccordionItemProps,
54
- UseAccordionItemReturn,
55
48
  useAccordionItemState as useAccordionItemState2,
56
- UseAccordionProps,
57
- UseAccordionReturn,
58
49
  useAccordionStyles
59
50
  } from "@chakra-ui/react";
60
51
 
@@ -4654,8 +4645,85 @@ import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text
4654
4645
  // src/components/time-input/components/index.tsx
4655
4646
  import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup5 } from "@chakra-ui/react";
4656
4647
  import { Clock } from "@ctlyst.id/internal-icon";
4657
- import { useEffect as useEffect2, useImperativeHandle as useImperativeHandle2 } from "react";
4658
- import { useTimescape } from "timescape/react";
4648
+ import { useEffect as useEffect3, useImperativeHandle as useImperativeHandle2 } from "react";
4649
+
4650
+ // src/components/time-input/components/integration.tsx
4651
+ import { $NOW, TimescapeManager } from "@zamiru/timescape";
4652
+ import { marry } from "@zamiru/timescape";
4653
+ import {
4654
+ useEffect as useEffect2,
4655
+ useLayoutEffect,
4656
+ useRef,
4657
+ useState as useState4
4658
+ } from "react";
4659
+ var useTimescape = (options = {}) => {
4660
+ var _a;
4661
+ const { date, onChangeDate, ...rest } = options;
4662
+ const [manager] = useState4(() => new TimescapeManager(date, rest));
4663
+ const onChangeDateRef = useRef(onChangeDate);
4664
+ useLayoutEffect(() => {
4665
+ onChangeDateRef.current = onChangeDate;
4666
+ }, [onChangeDate]);
4667
+ const [optionsState, update] = useState4(() => ({
4668
+ date,
4669
+ ...rest
4670
+ }));
4671
+ useEffect2(() => {
4672
+ manager.resync();
4673
+ return () => {
4674
+ manager.remove();
4675
+ };
4676
+ }, [manager]);
4677
+ useEffect2(() => {
4678
+ return manager.on("changeDate", (nextDate) => {
4679
+ var _a2;
4680
+ (_a2 = onChangeDateRef.current) == null ? void 0 : _a2.call(onChangeDateRef, nextDate);
4681
+ update((value) => ({ ...value, date: nextDate }));
4682
+ });
4683
+ }, [manager]);
4684
+ const timestamp = (_a = optionsState.date) == null ? void 0 : _a.getTime();
4685
+ useEffect2(() => {
4686
+ manager.date = timestamp;
4687
+ manager.minDate = optionsState.minDate;
4688
+ manager.maxDate = optionsState.maxDate;
4689
+ manager.hour12 = optionsState.hour12;
4690
+ manager.wrapAround = optionsState.wrapAround;
4691
+ manager.digits = optionsState.digits;
4692
+ manager.snapToStep = optionsState.snapToStep;
4693
+ }, [
4694
+ manager,
4695
+ timestamp,
4696
+ optionsState.minDate,
4697
+ optionsState.maxDate,
4698
+ optionsState.hour12,
4699
+ optionsState.wrapAround,
4700
+ optionsState.digits,
4701
+ optionsState.snapToStep
4702
+ ]);
4703
+ return {
4704
+ _manager: manager,
4705
+ getInputProps: (type, opts) => ({
4706
+ _ref: (element) => {
4707
+ if (!element) return;
4708
+ manager.registerElement(element, type, opts == null ? void 0 : opts.autofocus);
4709
+ if (opts == null ? void 0 : opts.ref) opts.ref.current = element;
4710
+ },
4711
+ get ref() {
4712
+ return this._ref;
4713
+ },
4714
+ set ref(value) {
4715
+ this._ref = value;
4716
+ }
4717
+ }),
4718
+ getRootProps: () => ({
4719
+ ref: (element) => element && manager.registerRoot(element)
4720
+ }),
4721
+ options: optionsState,
4722
+ update
4723
+ };
4724
+ };
4725
+
4726
+ // src/components/time-input/components/index.tsx
4659
4727
  import { Fragment as Fragment10, jsx as jsx63, jsxs as jsxs29 } from "react/jsx-runtime";
4660
4728
  var Time = class {
4661
4729
  constructor(hours, minutes, seconds) {
@@ -4712,7 +4780,7 @@ var TimeInput2 = forwardRef12(
4712
4780
  date,
4713
4781
  ...config2
4714
4782
  });
4715
- useEffect2(() => {
4783
+ useEffect3(() => {
4716
4784
  var _a, _b, _c, _d, _e, _f;
4717
4785
  timeValue.hours = (_b = (_a = options == null ? void 0 : options.date) == null ? void 0 : _a.getHours()) != null ? _b : 0;
4718
4786
  timeValue.minutes = (_d = (_c = options == null ? void 0 : options.date) == null ? void 0 : _c.getMinutes()) != null ? _d : 0;
@@ -4938,7 +5006,7 @@ import {
4938
5006
  UnorderedList as UnorderedList2
4939
5007
  } from "@chakra-ui/react";
4940
5008
  import { Close as X, Plus } from "@ctlyst.id/internal-icon";
4941
- import { useCallback as useCallback2, useEffect as useEffect3, useRef, useState as useState4 } from "react";
5009
+ import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState5 } from "react";
4942
5010
  import { useDropzone } from "react-dropzone";
4943
5011
 
4944
5012
  // src/components/uploader/constants.ts
@@ -4998,8 +5066,8 @@ var Uploader = ({
4998
5066
  size: size2 = "lg",
4999
5067
  ...props
5000
5068
  }) => {
5001
- const inputRef = useRef(null);
5002
- const [filePreview, setFilePreview] = useState4();
5069
+ const inputRef = useRef2(null);
5070
+ const [filePreview, setFilePreview] = useState5();
5003
5071
  const toast2 = useToast();
5004
5072
  const handleRejection = useCallback2(
5005
5073
  (message, file, image) => {
@@ -5068,7 +5136,7 @@ var Uploader = ({
5068
5136
  onHandleUploadFile == null ? void 0 : onHandleUploadFile(null, null);
5069
5137
  acceptedFiles.pop();
5070
5138
  };
5071
- useEffect3(() => {
5139
+ useEffect4(() => {
5072
5140
  if (value) {
5073
5141
  if (typeof value === "string") {
5074
5142
  setFilePreview(value);
@@ -6902,7 +6970,7 @@ import { useMemo as useMemo5 } from "react";
6902
6970
 
6903
6971
  // src/provider/components/provider.tsx
6904
6972
  import axios from "axios";
6905
- import { createContext as createContext2, useContext, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2 } from "react";
6973
+ import { createContext as createContext2, useContext, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef3 } from "react";
6906
6974
  import { ToastContainer as ToastContainer2 } from "react-toastify";
6907
6975
  import { jsx as jsx67, jsxs as jsxs32 } from "react/jsx-runtime";
6908
6976
  var ProviderContext = createContext2({
@@ -6913,8 +6981,8 @@ var useInternalUI = () => {
6913
6981
  return { instance };
6914
6982
  };
6915
6983
  var Provider = ({ children, config: config2, requestInterceptors, responseInterceptors }) => {
6916
- const instanceRef = useRef2(axios.create(config2));
6917
- useEffect4(() => {
6984
+ const instanceRef = useRef3(axios.create(config2));
6985
+ useEffect5(() => {
6918
6986
  requestInterceptors == null ? void 0 : requestInterceptors.forEach((interceptor) => {
6919
6987
  instanceRef.current.interceptors.request.use(interceptor);
6920
6988
  });
@@ -6985,16 +7053,11 @@ import { extendTheme, forwardRef as forwardRef13 } from "@chakra-ui/react";
6985
7053
  export {
6986
7054
  Accordion,
6987
7055
  AccordionButton,
6988
- AccordionButtonProps,
6989
7056
  AccordionEye,
6990
7057
  AccordionIcon,
6991
- AccordionIconProps,
6992
7058
  AccordionIndicator,
6993
7059
  AccordionItem,
6994
- AccordionItemProps,
6995
7060
  AccordionPanel,
6996
- AccordionPanelProps,
6997
- AccordionProps,
6998
7061
  AccordionProvider,
6999
7062
  Alert,
7000
7063
  AlertAction,
@@ -7255,10 +7318,6 @@ export {
7255
7318
  Tr2 as Tr,
7256
7319
  UnorderedList,
7257
7320
  uploader_default as Uploader,
7258
- UseAccordionItemProps,
7259
- UseAccordionItemReturn,
7260
- UseAccordionProps,
7261
- UseAccordionReturn,
7262
7321
  UseBreakpointOptions,
7263
7322
  UseCheckboxGroupProps,
7264
7323
  UseCheckboxGroupReturn,