@ikatec/nebula-react 1.3.1 → 1.3.2-beta.2

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 CHANGED
@@ -2927,7 +2927,7 @@ var Tooltip = React8__namespace.forwardRef(
2927
2927
  }, ref) => {
2928
2928
  const Comp = portal ? TooltipPrimitive__namespace.Portal : React8__namespace.Fragment;
2929
2929
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive__namespace.Root, { children: [
2930
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { children }),
2930
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { type: "button", children }),
2931
2931
  /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2932
2932
  TooltipPrimitive__namespace.Content,
2933
2933
  {
@@ -4757,9 +4757,25 @@ var useFileUpload = (options = {}) => {
4757
4757
  },
4758
4758
  [accept, multiple, handleFileChange]
4759
4759
  );
4760
- return [
4761
- state,
4762
- {
4760
+ return React8.useMemo(
4761
+ () => [
4762
+ state,
4763
+ {
4764
+ addFiles,
4765
+ removeFile,
4766
+ clearFiles,
4767
+ clearErrors,
4768
+ handleDragEnter,
4769
+ handleDragLeave,
4770
+ handleDragOver,
4771
+ handleDrop,
4772
+ handleFileChange,
4773
+ openFileDialog,
4774
+ getInputProps
4775
+ }
4776
+ ],
4777
+ [
4778
+ state,
4763
4779
  addFiles,
4764
4780
  removeFile,
4765
4781
  clearFiles,
@@ -4771,8 +4787,8 @@ var useFileUpload = (options = {}) => {
4771
4787
  handleFileChange,
4772
4788
  openFileDialog,
4773
4789
  getInputProps
4774
- }
4775
- ];
4790
+ ]
4791
+ );
4776
4792
  };
4777
4793
  var formatBytes = (bytes, decimals = 2) => {
4778
4794
  if (bytes === 0) return "0 Bytes";
@@ -4827,7 +4843,7 @@ function FileUpload({
4827
4843
  });
4828
4844
  React8.useEffect(() => {
4829
4845
  onError?.(errors);
4830
- }, [errors, onError]);
4846
+ }, [errors]);
4831
4847
  const disabled = React8.useMemo(() => {
4832
4848
  if (rest.disabled) return true;
4833
4849
  if (rest.multiple) {
@@ -6105,11 +6121,13 @@ var ProfileImage = ({
6105
6121
  handleFileChange(file2?.file);
6106
6122
  }
6107
6123
  });
6108
- const [finalImageUrl, setFinalImageUrl] = React8.useState(null);
6124
+ const [finalImageUrl, setFinalImageUrl] = React8.useState(
6125
+ image || null
6126
+ );
6109
6127
  const [isDialogOpen, setIsDialogOpen] = React8.useState(false);
6110
6128
  React8.useEffect(() => {
6111
6129
  onError?.(errors);
6112
- }, [errors, onError]);
6130
+ }, [errors]);
6113
6131
  const [file] = files;
6114
6132
  const fileId = file?.id;
6115
6133
  const previousFileIdRef = React8.useRef(null);
@@ -6118,12 +6136,14 @@ var ProfileImage = ({
6118
6136
  if (withCropper) return finalImageUrl;
6119
6137
  return previewUrl;
6120
6138
  }, [previewUrl, withCropper, finalImageUrl]);
6139
+ const initialRenderRef = React8.useRef(true);
6121
6140
  React8.useEffect(() => {
6122
6141
  if (!withCropper) return;
6123
- if (fileId && fileId !== previousFileIdRef.current) {
6142
+ if (fileId && fileId !== previousFileIdRef.current && !initialRenderRef.current) {
6124
6143
  setIsDialogOpen(true);
6125
6144
  }
6126
6145
  previousFileIdRef.current = fileId;
6146
+ initialRenderRef.current = false;
6127
6147
  }, [fileId, withCropper]);
6128
6148
  const handleApply = async (croppedUrl, croppedBlob) => {
6129
6149
  try {
package/dist/index.mjs CHANGED
@@ -2885,7 +2885,7 @@ var Tooltip = React8.forwardRef(
2885
2885
  }, ref) => {
2886
2886
  const Comp = portal ? TooltipPrimitive.Portal : React8.Fragment;
2887
2887
  return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { children: [
2888
- /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { children }),
2888
+ /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { type: "button", children }),
2889
2889
  /* @__PURE__ */ jsx(Comp, { children: /* @__PURE__ */ jsxs(
2890
2890
  TooltipPrimitive.Content,
2891
2891
  {
@@ -4715,9 +4715,25 @@ var useFileUpload = (options = {}) => {
4715
4715
  },
4716
4716
  [accept, multiple, handleFileChange]
4717
4717
  );
4718
- return [
4719
- state,
4720
- {
4718
+ return useMemo(
4719
+ () => [
4720
+ state,
4721
+ {
4722
+ addFiles,
4723
+ removeFile,
4724
+ clearFiles,
4725
+ clearErrors,
4726
+ handleDragEnter,
4727
+ handleDragLeave,
4728
+ handleDragOver,
4729
+ handleDrop,
4730
+ handleFileChange,
4731
+ openFileDialog,
4732
+ getInputProps
4733
+ }
4734
+ ],
4735
+ [
4736
+ state,
4721
4737
  addFiles,
4722
4738
  removeFile,
4723
4739
  clearFiles,
@@ -4729,8 +4745,8 @@ var useFileUpload = (options = {}) => {
4729
4745
  handleFileChange,
4730
4746
  openFileDialog,
4731
4747
  getInputProps
4732
- }
4733
- ];
4748
+ ]
4749
+ );
4734
4750
  };
4735
4751
  var formatBytes = (bytes, decimals = 2) => {
4736
4752
  if (bytes === 0) return "0 Bytes";
@@ -4785,7 +4801,7 @@ function FileUpload({
4785
4801
  });
4786
4802
  useEffect(() => {
4787
4803
  onError?.(errors);
4788
- }, [errors, onError]);
4804
+ }, [errors]);
4789
4805
  const disabled = useMemo(() => {
4790
4806
  if (rest.disabled) return true;
4791
4807
  if (rest.multiple) {
@@ -6063,11 +6079,13 @@ var ProfileImage = ({
6063
6079
  handleFileChange(file2?.file);
6064
6080
  }
6065
6081
  });
6066
- const [finalImageUrl, setFinalImageUrl] = useState(null);
6082
+ const [finalImageUrl, setFinalImageUrl] = useState(
6083
+ image || null
6084
+ );
6067
6085
  const [isDialogOpen, setIsDialogOpen] = useState(false);
6068
6086
  useEffect(() => {
6069
6087
  onError?.(errors);
6070
- }, [errors, onError]);
6088
+ }, [errors]);
6071
6089
  const [file] = files;
6072
6090
  const fileId = file?.id;
6073
6091
  const previousFileIdRef = useRef(null);
@@ -6076,12 +6094,14 @@ var ProfileImage = ({
6076
6094
  if (withCropper) return finalImageUrl;
6077
6095
  return previewUrl;
6078
6096
  }, [previewUrl, withCropper, finalImageUrl]);
6097
+ const initialRenderRef = useRef(true);
6079
6098
  useEffect(() => {
6080
6099
  if (!withCropper) return;
6081
- if (fileId && fileId !== previousFileIdRef.current) {
6100
+ if (fileId && fileId !== previousFileIdRef.current && !initialRenderRef.current) {
6082
6101
  setIsDialogOpen(true);
6083
6102
  }
6084
6103
  previousFileIdRef.current = fileId;
6104
+ initialRenderRef.current = false;
6085
6105
  }, [fileId, withCropper]);
6086
6106
  const handleApply = async (croppedUrl, croppedBlob) => {
6087
6107
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikatec/nebula-react",
3
- "version": "1.3.1",
3
+ "version": "1.3.2-beta.2",
4
4
  "description": "React components for Nebula Design System",
5
5
  "publishConfig": {
6
6
  "access": "public"
Binary file