lizaui 10.0.4 → 10.0.5

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.es.js CHANGED
@@ -5,7 +5,7 @@ function useModalHooks(modalIdRef) {
5
5
  const [isOpen, setIsOpen] = useState(false);
6
6
  const [isVisibleModal, setIsVisibleModal] = useState(false);
7
7
  const [paramBody, setParamBody] = useState(null);
8
- const onOpenRef = useRef(_temp$1);
8
+ const onOpenRef = useRef(_temp$2);
9
9
  const onCloseRef = useRef(_temp2);
10
10
  const modalIdGenerated = useId();
11
11
  const modalId = modalIdRef || `modal-${modalIdGenerated}`;
@@ -106,7 +106,7 @@ function useModalHooks(modalIdRef) {
106
106
  }
107
107
  function _temp2() {
108
108
  }
109
- function _temp$1() {
109
+ function _temp$2() {
110
110
  }
111
111
  function useDrawer(t0) {
112
112
  const $ = c(14);
@@ -251,7 +251,7 @@ const useConfirmationAlert = () => {
251
251
  const showAlert = t1;
252
252
  let t2;
253
253
  if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
254
- t2 = () => setAlert(_temp);
254
+ t2 = () => setAlert(_temp$1);
255
255
  $[2] = t2;
256
256
  } else {
257
257
  t2 = $[2];
@@ -331,7 +331,7 @@ const useConfirmationAlert = () => {
331
331
  }
332
332
  return t7;
333
333
  };
334
- function _temp(prev) {
334
+ function _temp$1(prev) {
335
335
  return {
336
336
  ...prev,
337
337
  loading: true
@@ -778,99 +778,225 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
778
778
  };
779
779
  }
780
780
  function useDraggable(props) {
781
+ const $ = c(26);
781
782
  const {
782
783
  targetRef,
783
- isDisabled = false,
784
- canOverflow = false
784
+ isDisabled: t0,
785
+ canOverflow: t1
785
786
  } = props;
786
- const boundary = useRef({
787
- minLeft: 0,
788
- minTop: 0,
789
- maxLeft: 0,
790
- maxTop: 0
791
- });
792
- let transform = {
793
- offsetX: 0,
794
- offsetY: 0
795
- };
796
- const onMoveStart = useCallback(() => {
797
- const {
798
- offsetX,
799
- offsetY
800
- } = transform;
801
- const targetRect = targetRef?.current?.getBoundingClientRect();
802
- const targetLeft = targetRect?.left ?? 0;
803
- const targetTop = targetRect?.top ?? 0;
804
- const targetWidth = targetRect?.width ?? 0;
805
- const targetHeight = targetRect?.height ?? 0;
806
- const clientWidth = document.documentElement.clientWidth;
807
- const clientHeight = document.documentElement.clientHeight;
808
- const minLeft = -targetLeft + offsetX;
809
- const minTop = -targetTop + offsetY;
810
- const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
811
- const maxTop = clientHeight - targetTop - targetHeight + offsetY;
812
- boundary.current = {
813
- minLeft,
814
- minTop,
815
- maxLeft,
816
- maxTop
787
+ const isDisabled = t0 === void 0 ? false : t0;
788
+ const canOverflow = t1 === void 0 ? false : t1;
789
+ let t2;
790
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
791
+ t2 = {
792
+ minLeft: 0,
793
+ minTop: 0,
794
+ maxLeft: 0,
795
+ maxTop: 0
817
796
  };
818
- }, [transform, targetRef?.current]);
819
- const onMove = useCallback((e) => {
820
- if (isDisabled) {
821
- return;
822
- }
823
- const {
824
- offsetX: offsetX_0,
825
- offsetY: offsetY_0
826
- } = transform;
827
- const {
828
- minLeft: minLeft_0,
829
- minTop: minTop_0,
830
- maxLeft: maxLeft_0,
831
- maxTop: maxTop_0
832
- } = boundary.current;
833
- let moveX = offsetX_0 + e.deltaX;
834
- let moveY = offsetY_0 + e.deltaY;
835
- if (!canOverflow) {
836
- moveX = Math.min(Math.max(moveX, minLeft_0), maxLeft_0);
837
- moveY = Math.min(Math.max(moveY, minTop_0), maxTop_0);
838
- }
839
- transform = {
840
- offsetX: moveX,
841
- offsetY: moveY
797
+ $[0] = t2;
798
+ } else {
799
+ t2 = $[0];
800
+ }
801
+ const boundary = useRef(t2);
802
+ let t3;
803
+ if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
804
+ t3 = {
805
+ offsetX: 0,
806
+ offsetY: 0
842
807
  };
843
- if (targetRef?.current) {
844
- targetRef.current.style.transform = `translate(${moveX}px, ${moveY}px)`;
845
- }
846
- }, [isDisabled, transform, boundary.current, canOverflow, targetRef?.current]);
808
+ $[1] = t3;
809
+ } else {
810
+ t3 = $[1];
811
+ }
812
+ const transformRef = useRef(t3);
813
+ let t4;
814
+ if ($[2] !== targetRef) {
815
+ t4 = () => {
816
+ const {
817
+ offsetX,
818
+ offsetY
819
+ } = transformRef.current;
820
+ const targetRect = targetRef?.current?.getBoundingClientRect();
821
+ const targetLeft = targetRect?.left ?? 0;
822
+ const targetTop = targetRect?.top ?? 0;
823
+ const targetWidth = targetRect?.width ?? 0;
824
+ const targetHeight = targetRect?.height ?? 0;
825
+ const clientWidth = document.documentElement.clientWidth;
826
+ const clientHeight = document.documentElement.clientHeight;
827
+ const minLeft = -targetLeft + offsetX;
828
+ const minTop = -targetTop + offsetY;
829
+ const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
830
+ const maxTop = clientHeight - targetTop - targetHeight + offsetY;
831
+ boundary.current = {
832
+ minLeft,
833
+ minTop,
834
+ maxLeft,
835
+ maxTop
836
+ };
837
+ };
838
+ $[2] = targetRef;
839
+ $[3] = t4;
840
+ } else {
841
+ t4 = $[3];
842
+ }
843
+ const onMoveStart = t4;
844
+ let t5;
845
+ if ($[4] !== canOverflow || $[5] !== isDisabled || $[6] !== targetRef) {
846
+ t5 = (e) => {
847
+ if (isDisabled) {
848
+ return;
849
+ }
850
+ const {
851
+ offsetX: offsetX_0,
852
+ offsetY: offsetY_0
853
+ } = transformRef.current;
854
+ const {
855
+ minLeft: minLeft_0,
856
+ minTop: minTop_0,
857
+ maxLeft: maxLeft_0,
858
+ maxTop: maxTop_0
859
+ } = boundary.current;
860
+ let moveX = offsetX_0 + e.deltaX;
861
+ let moveY = offsetY_0 + e.deltaY;
862
+ if (!canOverflow) {
863
+ moveX = Math.min(Math.max(moveX, minLeft_0), maxLeft_0);
864
+ moveY = Math.min(Math.max(moveY, minTop_0), maxTop_0);
865
+ }
866
+ transformRef.current = {
867
+ offsetX: moveX,
868
+ offsetY: moveY
869
+ };
870
+ if (targetRef?.current) {
871
+ targetRef.current.style.transform = `translate(${moveX}px, ${moveY}px)`;
872
+ }
873
+ };
874
+ $[4] = canOverflow;
875
+ $[5] = isDisabled;
876
+ $[6] = targetRef;
877
+ $[7] = t5;
878
+ } else {
879
+ t5 = $[7];
880
+ }
881
+ const onMove = t5;
882
+ let t6;
883
+ if ($[8] !== onMove || $[9] !== onMoveStart) {
884
+ t6 = {
885
+ onMoveStart,
886
+ onMove
887
+ };
888
+ $[8] = onMove;
889
+ $[9] = onMoveStart;
890
+ $[10] = t6;
891
+ } else {
892
+ t6 = $[10];
893
+ }
847
894
  const {
848
895
  moveProps
849
- } = $e8a7022cf87cba2a$export$36da96379f79f245({
850
- onMoveStart,
851
- onMove
852
- });
853
- const preventDefault = useCallback((e_0) => {
854
- e_0.preventDefault();
855
- }, []);
856
- useEffect(() => {
857
- if (!isDisabled) {
858
- document.body.addEventListener("touchmove", preventDefault, {
859
- passive: false
860
- });
861
- }
862
- return () => {
863
- document.body.removeEventListener("touchmove", preventDefault);
896
+ } = $e8a7022cf87cba2a$export$36da96379f79f245(t6);
897
+ const preventDefault = _temp;
898
+ let t7;
899
+ let t8;
900
+ if ($[11] !== isDisabled) {
901
+ t7 = () => {
902
+ if (!isDisabled) {
903
+ document.body.addEventListener("touchmove", preventDefault, {
904
+ passive: false
905
+ });
906
+ }
907
+ return () => {
908
+ document.body.removeEventListener("touchmove", preventDefault);
909
+ };
864
910
  };
865
- }, [isDisabled]);
866
- return {
867
- moveProps: {
868
- ...moveProps,
869
- style: {
870
- cursor: !isDisabled ? "move" : void 0
911
+ t8 = [isDisabled, preventDefault];
912
+ $[11] = isDisabled;
913
+ $[12] = t7;
914
+ $[13] = t8;
915
+ } else {
916
+ t7 = $[12];
917
+ t8 = $[13];
918
+ }
919
+ useEffect(t7, t8);
920
+ let t10;
921
+ let t9;
922
+ if ($[14] !== isDisabled || $[15] !== targetRef) {
923
+ t9 = () => {
924
+ if (isDisabled && targetRef?.current) {
925
+ transformRef.current = {
926
+ offsetX: 0,
927
+ offsetY: 0
928
+ };
929
+ targetRef.current.style.transform = "";
871
930
  }
872
- }
873
- };
931
+ };
932
+ t10 = [isDisabled, targetRef];
933
+ $[14] = isDisabled;
934
+ $[15] = targetRef;
935
+ $[16] = t10;
936
+ $[17] = t9;
937
+ } else {
938
+ t10 = $[16];
939
+ t9 = $[17];
940
+ }
941
+ useEffect(t9, t10);
942
+ let t11;
943
+ if ($[18] !== isDisabled || $[19] !== targetRef) {
944
+ t11 = () => {
945
+ if (!targetRef?.current || isDisabled) {
946
+ return;
947
+ }
948
+ const {
949
+ offsetX: offsetX_1,
950
+ offsetY: offsetY_1
951
+ } = transformRef.current;
952
+ if (offsetX_1 !== 0 || offsetY_1 !== 0) {
953
+ const currentTransform = targetRef.current.style.transform;
954
+ const expectedTransform = `translate(${offsetX_1}px, ${offsetY_1}px)`;
955
+ if (currentTransform !== expectedTransform) {
956
+ requestAnimationFrame(() => {
957
+ if (targetRef?.current) {
958
+ targetRef.current.style.transform = expectedTransform;
959
+ }
960
+ });
961
+ }
962
+ }
963
+ };
964
+ $[18] = isDisabled;
965
+ $[19] = targetRef;
966
+ $[20] = t11;
967
+ } else {
968
+ t11 = $[20];
969
+ }
970
+ useEffect(t11);
971
+ const t12 = !isDisabled ? "move" : void 0;
972
+ let t13;
973
+ if ($[21] !== t12) {
974
+ t13 = {
975
+ cursor: t12
976
+ };
977
+ $[21] = t12;
978
+ $[22] = t13;
979
+ } else {
980
+ t13 = $[22];
981
+ }
982
+ let t14;
983
+ if ($[23] !== moveProps || $[24] !== t13) {
984
+ t14 = {
985
+ moveProps: {
986
+ ...moveProps,
987
+ style: t13
988
+ }
989
+ };
990
+ $[23] = moveProps;
991
+ $[24] = t13;
992
+ $[25] = t14;
993
+ } else {
994
+ t14 = $[25];
995
+ }
996
+ return t14;
997
+ }
998
+ function _temp(e_0) {
999
+ e_0.preventDefault();
874
1000
  }
875
1001
  export {
876
1002
  useConfirmationAlert,