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