@bbki.ng/components 2.1.26 → 2.1.29

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.d.ts CHANGED
@@ -173,7 +173,7 @@ interface ImagePreviewerProps {
173
173
  }
174
174
  interface ImageDropProps<T> {
175
175
  uploader: (file: File, img?: HTMLImageElement) => Promise<T>;
176
- onDrop?: (events: Event, file: File) => void;
176
+ onDrop?: (events: React__default.DragEvent<Element>, file: File) => void;
177
177
  onUploadFinish?: (result: T) => void;
178
178
  waitTimeAfterFinish?: number;
179
179
  defaultBgColor?: string;
package/dist/index.js CHANGED
@@ -506,16 +506,18 @@ import { useState as useState4 } from "react";
506
506
 
507
507
  // lib/drop-image/utils.ts
508
508
  var wait = (d) => new Promise((r) => setTimeout(r, d));
509
- var noop = () => {
510
- };
511
509
 
512
510
  // lib/drop-image/useDropImage.ts
513
- import { useState as useState3, useCallback, useRef } from "react";
511
+ import {
512
+ useState as useState3,
513
+ useCallback,
514
+ useRef
515
+ } from "react";
514
516
  var useDropImage = (params) => {
515
517
  const [isDragOver, setIsDragOver] = useState3(false);
516
518
  const [imageSrc, setImageSrc] = useState3("");
517
519
  const [imageSize, setImageSize] = useState3({ width: 0, height: 0 });
518
- const imageFile = useRef(null);
520
+ const imageFile = useRef();
519
521
  const {
520
522
  portraitImageWidth = 384,
521
523
  landscapeImageWidth = 500,
@@ -550,6 +552,9 @@ var useDropImage = (params) => {
550
552
  const handleDragOver = useCallback((ev) => {
551
553
  ev.preventDefault();
552
554
  setIsDragOver(true);
555
+ if (!ev.dataTransfer) {
556
+ return;
557
+ }
553
558
  ev.dataTransfer.dropEffect = "move";
554
559
  }, []);
555
560
  const handleDragLeave = useCallback(() => {
@@ -558,8 +563,8 @@ var useDropImage = (params) => {
558
563
  const handleDrop = useCallback((ev) => {
559
564
  ev.preventDefault();
560
565
  setIsDragOver(false);
561
- const file = ev.dataTransfer.files[0];
562
- if (!file || !file.type.startsWith("image")) {
566
+ const file = ev.dataTransfer ? ev.dataTransfer.files[0] : void 0;
567
+ if (!file || !file.type.startsWith("image") || !imageFile.current) {
563
568
  return;
564
569
  }
565
570
  imageFile.current = file;
@@ -639,8 +644,10 @@ var ImagePreviewer = (props) => {
639
644
  };
640
645
  var GhostDropImage = (props) => {
641
646
  const {
642
- onDrop = noop,
643
- onUploadFinish = noop,
647
+ onDrop = () => {
648
+ },
649
+ onUploadFinish = () => {
650
+ },
644
651
  uploader,
645
652
  waitTimeAfterFinish = 2e3,
646
653
  className = "",
@@ -716,7 +723,8 @@ var DropImage = (props) => {
716
723
  waitTimeAfterFinish = 2e3,
717
724
  placeholder = "",
718
725
  className = "",
719
- onUploadFinish = noop,
726
+ onUploadFinish = () => {
727
+ },
720
728
  ghost,
721
729
  children,
722
730
  dropAreaStyle = {
@@ -1097,10 +1105,10 @@ var VERTEX_SHADER = `
1097
1105
 
1098
1106
  varying vec3 vColor;
1099
1107
 
1100
- vec3 curve(float _percent, float _length) {
1108
+ vec3 curve(float _percent) {
1101
1109
  const float PI2 = 3.141592653589793 * 2.0;
1102
- float radius = 0.028 / 0.15 * _length;
1103
-
1110
+ const float _length = 0.3;
1111
+ const float radius = 0.056;
1104
1112
  float t = mod(_percent, 0.25) / 0.25;
1105
1113
  t = mod(_percent, 0.25) - (2.0 * (1.0 - t) * t * -0.0185 + t * t * 0.25);
1106
1114
  float x = _length * sin(PI2 * _percent);
@@ -1130,7 +1138,7 @@ var VERTEX_SHADER = `
1130
1138
  * uModelMatrix
1131
1139
  * uViewMatrix
1132
1140
  * rotateX(uProgress)
1133
- * vec4(curve(${"aPercent" /* PERCENT */}, 0.8), 1.0);
1141
+ * vec4(curve(${"aPercent" /* PERCENT */}), 1.0);
1134
1142
 
1135
1143
  gl_PointSize = ${"aPointSize" /* POINT_SIZE */};
1136
1144
  }
@@ -1183,7 +1191,8 @@ var LoadingSpiral = (props) => {
1183
1191
  const phenomenon = new Phenomenon({
1184
1192
  settings: createSettings({ canvas: canvasRef.current, step }),
1185
1193
  context: {
1186
- antialias: true
1194
+ antialias: true,
1195
+ alpha: true
1187
1196
  }
1188
1197
  });
1189
1198
  phenomenon.add(
@@ -1192,11 +1201,9 @@ var LoadingSpiral = (props) => {
1192
1201
  );
1193
1202
  }, []);
1194
1203
  return /* @__PURE__ */ React21.createElement("canvas", {
1195
- width: 200,
1196
- height: 200,
1197
1204
  style: {
1198
- width: 200,
1199
- height: 200,
1205
+ maxWidth: 500,
1206
+ maxHeight: 500,
1200
1207
  imageRendering: "pixelated"
1201
1208
  },
1202
1209
  ref: canvasRef,