@bbki.ng/components 1.5.0 → 1.5.3
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 +28 -2
- package/dist/index.js +194 -2
- package/dist/index.mjs +191 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { EventHandler, ReactElement } from 'react';
|
|
1
|
+
import React, { EventHandler, ReactElement, CSSProperties, FunctionComponent } from 'react';
|
|
2
2
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
declare type ArticleProps = {
|
|
@@ -103,10 +103,36 @@ declare const Table: {
|
|
|
103
103
|
(props: TableProps): JSX.Element;
|
|
104
104
|
HCell(props: {
|
|
105
105
|
children: any;
|
|
106
|
+
style?: CSSProperties;
|
|
106
107
|
}): JSX.Element;
|
|
107
108
|
Cell(props: {
|
|
108
109
|
children: any;
|
|
110
|
+
style?: CSSProperties;
|
|
109
111
|
}): JSX.Element;
|
|
110
112
|
};
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
declare enum SkeletonColor {
|
|
115
|
+
BLUE = "blue",
|
|
116
|
+
RED = "red",
|
|
117
|
+
GRAY = "gray"
|
|
118
|
+
}
|
|
119
|
+
declare type SkeletonProps = {
|
|
120
|
+
width?: number;
|
|
121
|
+
height?: number;
|
|
122
|
+
bgColor?: SkeletonColor;
|
|
123
|
+
};
|
|
124
|
+
declare const Skeleton: (props: SkeletonProps) => JSX.Element;
|
|
125
|
+
|
|
126
|
+
interface ImageDropProps<T> {
|
|
127
|
+
uploader: (file: File, img: HTMLImageElement) => Promise<T>;
|
|
128
|
+
onDrop?: (events: Event, file: File) => void;
|
|
129
|
+
onUploadFinish?: (result: T) => void;
|
|
130
|
+
waitTimeAfterFinish?: number;
|
|
131
|
+
defaultBgColor?: string;
|
|
132
|
+
dragOverBgColor?: string;
|
|
133
|
+
dropAreaStyle?: CSSStyleDeclaration;
|
|
134
|
+
placeholder?: any;
|
|
135
|
+
}
|
|
136
|
+
declare const DropImage: FunctionComponent<ImageDropProps<any>>;
|
|
137
|
+
|
|
138
|
+
export { Article, ArticleProps, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, DropImage, ImageDropProps, Link, LinkColor, LinkProps, Logo, LogoProps, Nav, NavProps, Page, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Skeleton, SkeletonColor, SkeletonProps, Table, TableProps, Tag, TagProps, Tags };
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ __export(src_exports, {
|
|
|
62
62
|
Breadcrumb: () => Breadcrumb,
|
|
63
63
|
Button: () => Button,
|
|
64
64
|
ButtonType: () => ButtonType,
|
|
65
|
+
DropImage: () => DropImage,
|
|
65
66
|
Link: () => Link,
|
|
66
67
|
LinkColor: () => LinkColor,
|
|
67
68
|
Logo: () => Logo,
|
|
@@ -69,6 +70,8 @@ __export(src_exports, {
|
|
|
69
70
|
Page: () => Page,
|
|
70
71
|
Panel: () => Panel,
|
|
71
72
|
PopConfirm: () => PopConfirm,
|
|
73
|
+
Skeleton: () => Skeleton,
|
|
74
|
+
SkeletonColor: () => SkeletonColor,
|
|
72
75
|
Table: () => Table,
|
|
73
76
|
Tag: () => Tag,
|
|
74
77
|
Tags: () => Tags
|
|
@@ -322,8 +325,194 @@ var Table = (props) => {
|
|
|
322
325
|
className
|
|
323
326
|
}, headerRenderer && /* @__PURE__ */ import_react10.default.createElement("thead", null, /* @__PURE__ */ import_react10.default.createElement("tr", null, headerRenderer())), /* @__PURE__ */ import_react10.default.createElement("tbody", null, rows));
|
|
324
327
|
};
|
|
325
|
-
Table.HCell = (props) => /* @__PURE__ */ import_react10.default.createElement("th",
|
|
326
|
-
Table.Cell = (props) => /* @__PURE__ */ import_react10.default.createElement("td",
|
|
328
|
+
Table.HCell = (props) => /* @__PURE__ */ import_react10.default.createElement("th", __spreadValues({}, props), props.children);
|
|
329
|
+
Table.Cell = (props) => /* @__PURE__ */ import_react10.default.createElement("td", __spreadValues({}, props), props.children);
|
|
330
|
+
|
|
331
|
+
// src/skeleton/Seleton.tsx
|
|
332
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
333
|
+
var import_react11 = __toESM(require("react"));
|
|
334
|
+
var SkeletonColor = /* @__PURE__ */ ((SkeletonColor2) => {
|
|
335
|
+
SkeletonColor2["BLUE"] = "blue";
|
|
336
|
+
SkeletonColor2["RED"] = "red";
|
|
337
|
+
SkeletonColor2["GRAY"] = "gray";
|
|
338
|
+
return SkeletonColor2;
|
|
339
|
+
})(SkeletonColor || {});
|
|
340
|
+
var COLOR_MAPPING2 = {
|
|
341
|
+
["blue" /* BLUE */]: "bg-blue-100",
|
|
342
|
+
["red" /* RED */]: "bg-red-100",
|
|
343
|
+
["gray" /* GRAY */]: "bg-gray-100"
|
|
344
|
+
};
|
|
345
|
+
var Skeleton = (props) => {
|
|
346
|
+
const { bgColor = "gray" /* GRAY */, width = 26, height = 24 } = props;
|
|
347
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
348
|
+
className: (0, import_classnames5.default)(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded"),
|
|
349
|
+
style: { width, height }
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/drop-image/DropImage.tsx
|
|
354
|
+
var import_classnames6 = __toESM(require("classnames"));
|
|
355
|
+
var import_react13 = __toESM(require("react"));
|
|
356
|
+
var import_react14 = require("react");
|
|
357
|
+
|
|
358
|
+
// src/drop-image/utils.ts
|
|
359
|
+
var wait = (d) => new Promise((r) => setTimeout(r, d));
|
|
360
|
+
var noop = () => {
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// src/drop-image/useDropImage.ts
|
|
364
|
+
var import_react12 = require("react");
|
|
365
|
+
var useDropImage = (params) => {
|
|
366
|
+
const [isDragOver, setIsDragOver] = (0, import_react12.useState)(false);
|
|
367
|
+
const [imageSrc, setImageSrc] = (0, import_react12.useState)("");
|
|
368
|
+
const [imageSize, setImageSize] = (0, import_react12.useState)({ width: 0, height: 0 });
|
|
369
|
+
const imageFile = (0, import_react12.useRef)(null);
|
|
370
|
+
const {
|
|
371
|
+
portraitImageWidth = 384,
|
|
372
|
+
landscapeImageWidth = 500,
|
|
373
|
+
onDrop = () => {
|
|
374
|
+
},
|
|
375
|
+
onImageLoad = () => {
|
|
376
|
+
}
|
|
377
|
+
} = params || {};
|
|
378
|
+
const reset = () => {
|
|
379
|
+
setImageSrc("");
|
|
380
|
+
setImageSize({ width: 0, height: 0 });
|
|
381
|
+
setIsDragOver(false);
|
|
382
|
+
imageFile.current = null;
|
|
383
|
+
};
|
|
384
|
+
const calcDefaultImgSize = (img, defaultWidth) => {
|
|
385
|
+
const { width, height } = img;
|
|
386
|
+
const whRatio = width / height;
|
|
387
|
+
const isHorizontal = width > height;
|
|
388
|
+
const finalWidth = defaultWidth || (isHorizontal ? landscapeImageWidth : portraitImageWidth);
|
|
389
|
+
return {
|
|
390
|
+
width: finalWidth,
|
|
391
|
+
height: finalWidth / whRatio
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
const setPreviewImageSrcByFile = (file) => {
|
|
395
|
+
setImageSrc(URL.createObjectURL(file));
|
|
396
|
+
};
|
|
397
|
+
const handleDragOver = (0, import_react12.useCallback)((ev) => {
|
|
398
|
+
ev.preventDefault();
|
|
399
|
+
setIsDragOver(true);
|
|
400
|
+
ev.dataTransfer.dropEffect = "move";
|
|
401
|
+
}, []);
|
|
402
|
+
const handleDragLeave = (0, import_react12.useCallback)(() => {
|
|
403
|
+
setIsDragOver(false);
|
|
404
|
+
}, []);
|
|
405
|
+
const handleDrop = (0, import_react12.useCallback)((ev) => {
|
|
406
|
+
ev.preventDefault();
|
|
407
|
+
setIsDragOver(false);
|
|
408
|
+
const file = ev.dataTransfer.files[0];
|
|
409
|
+
imageFile.current = file;
|
|
410
|
+
setPreviewImageSrcByFile(file);
|
|
411
|
+
onDrop(ev, file);
|
|
412
|
+
}, []);
|
|
413
|
+
const handleImgLoad = (img) => {
|
|
414
|
+
const updateFunc = async () => {
|
|
415
|
+
const p = "decode" in img ? img.decode : Promise.resolve;
|
|
416
|
+
try {
|
|
417
|
+
await p();
|
|
418
|
+
} catch (e) {
|
|
419
|
+
}
|
|
420
|
+
setImageSize(calcDefaultImgSize({
|
|
421
|
+
width: img.naturalWidth,
|
|
422
|
+
height: img.naturalHeight
|
|
423
|
+
}));
|
|
424
|
+
if (!imageFile.current) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
onImageLoad(img, imageFile.current);
|
|
428
|
+
};
|
|
429
|
+
if (img.complete) {
|
|
430
|
+
updateFunc().then();
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
img.onload = updateFunc;
|
|
434
|
+
};
|
|
435
|
+
const imageRef = (0, import_react12.useCallback)((input) => {
|
|
436
|
+
if (!input) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
handleImgLoad(input);
|
|
440
|
+
}, []);
|
|
441
|
+
return {
|
|
442
|
+
isDragOver,
|
|
443
|
+
imageSrc,
|
|
444
|
+
imageRef,
|
|
445
|
+
imageSize,
|
|
446
|
+
handleDragOver,
|
|
447
|
+
handleDragLeave,
|
|
448
|
+
handleDrop,
|
|
449
|
+
reset
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// src/drop-image/DropImage.tsx
|
|
454
|
+
var DropImage = (props) => {
|
|
455
|
+
const {
|
|
456
|
+
uploader,
|
|
457
|
+
defaultBgColor = "#F3F4F6",
|
|
458
|
+
onDrop,
|
|
459
|
+
dragOverBgColor = "#EFF6FF",
|
|
460
|
+
waitTimeAfterFinish = 2e3,
|
|
461
|
+
placeholder = "",
|
|
462
|
+
onUploadFinish = noop,
|
|
463
|
+
dropAreaStyle = {
|
|
464
|
+
width: 300,
|
|
465
|
+
height: 300
|
|
466
|
+
}
|
|
467
|
+
} = props;
|
|
468
|
+
const [showImagePreviewer, setShowImagePreviewer] = (0, import_react14.useState)(false);
|
|
469
|
+
const {
|
|
470
|
+
handleDragLeave,
|
|
471
|
+
handleDragOver,
|
|
472
|
+
handleDrop,
|
|
473
|
+
imageRef,
|
|
474
|
+
imageSize,
|
|
475
|
+
imageSrc,
|
|
476
|
+
isDragOver,
|
|
477
|
+
reset
|
|
478
|
+
} = useDropImage({
|
|
479
|
+
onDrop,
|
|
480
|
+
onImageLoad: async (image, file) => {
|
|
481
|
+
await wait(500);
|
|
482
|
+
setShowImagePreviewer(true);
|
|
483
|
+
await onUploadFinish(await uploader(file, image));
|
|
484
|
+
await wait(waitTimeAfterFinish);
|
|
485
|
+
setShowImagePreviewer(false);
|
|
486
|
+
await wait(500);
|
|
487
|
+
reset();
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
const getDropAreaStyle = () => {
|
|
491
|
+
return Object.assign({}, dropAreaStyle, {
|
|
492
|
+
background: isDragOver ? dragOverBgColor : defaultBgColor,
|
|
493
|
+
width: imageSize.width || dropAreaStyle.width,
|
|
494
|
+
height: imageSize.height || dropAreaStyle.height
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
498
|
+
className: (0, import_classnames6.default)("transition-all items-center justify-center flex duration-200 ease-in-out", {
|
|
499
|
+
"shadow-input": !imageSrc,
|
|
500
|
+
"shadow-empty": imageSrc
|
|
501
|
+
}),
|
|
502
|
+
onDragLeave: handleDragLeave,
|
|
503
|
+
onDragOver: handleDragOver,
|
|
504
|
+
onDrop: handleDrop,
|
|
505
|
+
style: getDropAreaStyle()
|
|
506
|
+
}, /* @__PURE__ */ import_react13.default.createElement("img", {
|
|
507
|
+
className: (0, import_classnames6.default)("max-w-[100%]", "h-[auto]", "duration-300", "transition-opacity", "opacity-0", {
|
|
508
|
+
"opacity-100": showImagePreviewer
|
|
509
|
+
}),
|
|
510
|
+
ref: imageRef,
|
|
511
|
+
src: imageSrc,
|
|
512
|
+
width: imageSize.width,
|
|
513
|
+
height: imageSize.height
|
|
514
|
+
}), !imageSrc && placeholder);
|
|
515
|
+
};
|
|
327
516
|
module.exports = __toCommonJS(src_exports);
|
|
328
517
|
// Annotate the CommonJS export names for ESM import in node:
|
|
329
518
|
0 && (module.exports = {
|
|
@@ -331,6 +520,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
331
520
|
Breadcrumb,
|
|
332
521
|
Button,
|
|
333
522
|
ButtonType,
|
|
523
|
+
DropImage,
|
|
334
524
|
Link,
|
|
335
525
|
LinkColor,
|
|
336
526
|
Logo,
|
|
@@ -338,6 +528,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
338
528
|
Page,
|
|
339
529
|
Panel,
|
|
340
530
|
PopConfirm,
|
|
531
|
+
Skeleton,
|
|
532
|
+
SkeletonColor,
|
|
341
533
|
Table,
|
|
342
534
|
Tag,
|
|
343
535
|
Tags
|
package/dist/index.mjs
CHANGED
|
@@ -278,13 +278,200 @@ var Table = (props) => {
|
|
|
278
278
|
className
|
|
279
279
|
}, headerRenderer && /* @__PURE__ */ React11.createElement("thead", null, /* @__PURE__ */ React11.createElement("tr", null, headerRenderer())), /* @__PURE__ */ React11.createElement("tbody", null, rows));
|
|
280
280
|
};
|
|
281
|
-
Table.HCell = (props) => /* @__PURE__ */ React11.createElement("th",
|
|
282
|
-
Table.Cell = (props) => /* @__PURE__ */ React11.createElement("td",
|
|
281
|
+
Table.HCell = (props) => /* @__PURE__ */ React11.createElement("th", __spreadValues({}, props), props.children);
|
|
282
|
+
Table.Cell = (props) => /* @__PURE__ */ React11.createElement("td", __spreadValues({}, props), props.children);
|
|
283
|
+
|
|
284
|
+
// src/skeleton/Seleton.tsx
|
|
285
|
+
import classNames5 from "classnames";
|
|
286
|
+
import React12 from "react";
|
|
287
|
+
var SkeletonColor = /* @__PURE__ */ ((SkeletonColor2) => {
|
|
288
|
+
SkeletonColor2["BLUE"] = "blue";
|
|
289
|
+
SkeletonColor2["RED"] = "red";
|
|
290
|
+
SkeletonColor2["GRAY"] = "gray";
|
|
291
|
+
return SkeletonColor2;
|
|
292
|
+
})(SkeletonColor || {});
|
|
293
|
+
var COLOR_MAPPING2 = {
|
|
294
|
+
["blue" /* BLUE */]: "bg-blue-100",
|
|
295
|
+
["red" /* RED */]: "bg-red-100",
|
|
296
|
+
["gray" /* GRAY */]: "bg-gray-100"
|
|
297
|
+
};
|
|
298
|
+
var Skeleton = (props) => {
|
|
299
|
+
const { bgColor = "gray" /* GRAY */, width = 26, height = 24 } = props;
|
|
300
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
301
|
+
className: classNames5(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded"),
|
|
302
|
+
style: { width, height }
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/drop-image/DropImage.tsx
|
|
307
|
+
import cls from "classnames";
|
|
308
|
+
import React13 from "react";
|
|
309
|
+
import { useState as useState3 } from "react";
|
|
310
|
+
|
|
311
|
+
// src/drop-image/utils.ts
|
|
312
|
+
var wait = (d) => new Promise((r) => setTimeout(r, d));
|
|
313
|
+
var noop = () => {
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// src/drop-image/useDropImage.ts
|
|
317
|
+
import { useState as useState2, useCallback, useRef } from "react";
|
|
318
|
+
var useDropImage = (params) => {
|
|
319
|
+
const [isDragOver, setIsDragOver] = useState2(false);
|
|
320
|
+
const [imageSrc, setImageSrc] = useState2("");
|
|
321
|
+
const [imageSize, setImageSize] = useState2({ width: 0, height: 0 });
|
|
322
|
+
const imageFile = useRef(null);
|
|
323
|
+
const {
|
|
324
|
+
portraitImageWidth = 384,
|
|
325
|
+
landscapeImageWidth = 500,
|
|
326
|
+
onDrop = () => {
|
|
327
|
+
},
|
|
328
|
+
onImageLoad = () => {
|
|
329
|
+
}
|
|
330
|
+
} = params || {};
|
|
331
|
+
const reset = () => {
|
|
332
|
+
setImageSrc("");
|
|
333
|
+
setImageSize({ width: 0, height: 0 });
|
|
334
|
+
setIsDragOver(false);
|
|
335
|
+
imageFile.current = null;
|
|
336
|
+
};
|
|
337
|
+
const calcDefaultImgSize = (img, defaultWidth) => {
|
|
338
|
+
const { width, height } = img;
|
|
339
|
+
const whRatio = width / height;
|
|
340
|
+
const isHorizontal = width > height;
|
|
341
|
+
const finalWidth = defaultWidth || (isHorizontal ? landscapeImageWidth : portraitImageWidth);
|
|
342
|
+
return {
|
|
343
|
+
width: finalWidth,
|
|
344
|
+
height: finalWidth / whRatio
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
const setPreviewImageSrcByFile = (file) => {
|
|
348
|
+
setImageSrc(URL.createObjectURL(file));
|
|
349
|
+
};
|
|
350
|
+
const handleDragOver = useCallback((ev) => {
|
|
351
|
+
ev.preventDefault();
|
|
352
|
+
setIsDragOver(true);
|
|
353
|
+
ev.dataTransfer.dropEffect = "move";
|
|
354
|
+
}, []);
|
|
355
|
+
const handleDragLeave = useCallback(() => {
|
|
356
|
+
setIsDragOver(false);
|
|
357
|
+
}, []);
|
|
358
|
+
const handleDrop = useCallback((ev) => {
|
|
359
|
+
ev.preventDefault();
|
|
360
|
+
setIsDragOver(false);
|
|
361
|
+
const file = ev.dataTransfer.files[0];
|
|
362
|
+
imageFile.current = file;
|
|
363
|
+
setPreviewImageSrcByFile(file);
|
|
364
|
+
onDrop(ev, file);
|
|
365
|
+
}, []);
|
|
366
|
+
const handleImgLoad = (img) => {
|
|
367
|
+
const updateFunc = async () => {
|
|
368
|
+
const p = "decode" in img ? img.decode : Promise.resolve;
|
|
369
|
+
try {
|
|
370
|
+
await p();
|
|
371
|
+
} catch (e) {
|
|
372
|
+
}
|
|
373
|
+
setImageSize(calcDefaultImgSize({
|
|
374
|
+
width: img.naturalWidth,
|
|
375
|
+
height: img.naturalHeight
|
|
376
|
+
}));
|
|
377
|
+
if (!imageFile.current) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
onImageLoad(img, imageFile.current);
|
|
381
|
+
};
|
|
382
|
+
if (img.complete) {
|
|
383
|
+
updateFunc().then();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
img.onload = updateFunc;
|
|
387
|
+
};
|
|
388
|
+
const imageRef = useCallback((input) => {
|
|
389
|
+
if (!input) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
handleImgLoad(input);
|
|
393
|
+
}, []);
|
|
394
|
+
return {
|
|
395
|
+
isDragOver,
|
|
396
|
+
imageSrc,
|
|
397
|
+
imageRef,
|
|
398
|
+
imageSize,
|
|
399
|
+
handleDragOver,
|
|
400
|
+
handleDragLeave,
|
|
401
|
+
handleDrop,
|
|
402
|
+
reset
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// src/drop-image/DropImage.tsx
|
|
407
|
+
var DropImage = (props) => {
|
|
408
|
+
const {
|
|
409
|
+
uploader,
|
|
410
|
+
defaultBgColor = "#F3F4F6",
|
|
411
|
+
onDrop,
|
|
412
|
+
dragOverBgColor = "#EFF6FF",
|
|
413
|
+
waitTimeAfterFinish = 2e3,
|
|
414
|
+
placeholder = "",
|
|
415
|
+
onUploadFinish = noop,
|
|
416
|
+
dropAreaStyle = {
|
|
417
|
+
width: 300,
|
|
418
|
+
height: 300
|
|
419
|
+
}
|
|
420
|
+
} = props;
|
|
421
|
+
const [showImagePreviewer, setShowImagePreviewer] = useState3(false);
|
|
422
|
+
const {
|
|
423
|
+
handleDragLeave,
|
|
424
|
+
handleDragOver,
|
|
425
|
+
handleDrop,
|
|
426
|
+
imageRef,
|
|
427
|
+
imageSize,
|
|
428
|
+
imageSrc,
|
|
429
|
+
isDragOver,
|
|
430
|
+
reset
|
|
431
|
+
} = useDropImage({
|
|
432
|
+
onDrop,
|
|
433
|
+
onImageLoad: async (image, file) => {
|
|
434
|
+
await wait(500);
|
|
435
|
+
setShowImagePreviewer(true);
|
|
436
|
+
await onUploadFinish(await uploader(file, image));
|
|
437
|
+
await wait(waitTimeAfterFinish);
|
|
438
|
+
setShowImagePreviewer(false);
|
|
439
|
+
await wait(500);
|
|
440
|
+
reset();
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
const getDropAreaStyle = () => {
|
|
444
|
+
return Object.assign({}, dropAreaStyle, {
|
|
445
|
+
background: isDragOver ? dragOverBgColor : defaultBgColor,
|
|
446
|
+
width: imageSize.width || dropAreaStyle.width,
|
|
447
|
+
height: imageSize.height || dropAreaStyle.height
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
451
|
+
className: cls("transition-all items-center justify-center flex duration-200 ease-in-out", {
|
|
452
|
+
"shadow-input": !imageSrc,
|
|
453
|
+
"shadow-empty": imageSrc
|
|
454
|
+
}),
|
|
455
|
+
onDragLeave: handleDragLeave,
|
|
456
|
+
onDragOver: handleDragOver,
|
|
457
|
+
onDrop: handleDrop,
|
|
458
|
+
style: getDropAreaStyle()
|
|
459
|
+
}, /* @__PURE__ */ React13.createElement("img", {
|
|
460
|
+
className: cls("max-w-[100%]", "h-[auto]", "duration-300", "transition-opacity", "opacity-0", {
|
|
461
|
+
"opacity-100": showImagePreviewer
|
|
462
|
+
}),
|
|
463
|
+
ref: imageRef,
|
|
464
|
+
src: imageSrc,
|
|
465
|
+
width: imageSize.width,
|
|
466
|
+
height: imageSize.height
|
|
467
|
+
}), !imageSrc && placeholder);
|
|
468
|
+
};
|
|
283
469
|
export {
|
|
284
470
|
Article,
|
|
285
471
|
Breadcrumb,
|
|
286
472
|
Button,
|
|
287
473
|
ButtonType,
|
|
474
|
+
DropImage,
|
|
288
475
|
Link,
|
|
289
476
|
LinkColor,
|
|
290
477
|
Logo,
|
|
@@ -292,6 +479,8 @@ export {
|
|
|
292
479
|
Page,
|
|
293
480
|
Panel,
|
|
294
481
|
PopConfirm,
|
|
482
|
+
Skeleton,
|
|
483
|
+
SkeletonColor,
|
|
295
484
|
Table,
|
|
296
485
|
Tag,
|
|
297
486
|
Tags
|