@herca/r-kit 0.0.39 → 0.0.41
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/clients.cjs +31 -12
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +15 -3
- package/dist/clients.d.ts +15 -3
- package/dist/clients.js +31 -12
- package/dist/clients.js.map +1 -1
- package/package.json +1 -1
package/dist/clients.cjs
CHANGED
|
@@ -8583,7 +8583,8 @@ var ModalPreviewAttachment = ({
|
|
|
8583
8583
|
type,
|
|
8584
8584
|
iframeProps,
|
|
8585
8585
|
audioProps,
|
|
8586
|
-
videoProps
|
|
8586
|
+
videoProps,
|
|
8587
|
+
onDownload
|
|
8587
8588
|
}) => {
|
|
8588
8589
|
const [zoom, setZoom] = (0, import_react289.useState)(1);
|
|
8589
8590
|
const [isDragging, setIsDragging] = (0, import_react289.useState)(false);
|
|
@@ -8629,13 +8630,22 @@ var ModalPreviewAttachment = ({
|
|
|
8629
8630
|
const handleMouseUp = () => {
|
|
8630
8631
|
setIsDragging(false);
|
|
8631
8632
|
};
|
|
8632
|
-
const handleDownload = () => {
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8633
|
+
const handleDownload = async () => {
|
|
8634
|
+
try {
|
|
8635
|
+
const response = await fetch(src);
|
|
8636
|
+
const blob = await response.blob();
|
|
8637
|
+
const blobUrl = window.URL.createObjectURL(blob);
|
|
8638
|
+
const link = document.createElement("a");
|
|
8639
|
+
link.href = blobUrl;
|
|
8640
|
+
link.download = name || "download";
|
|
8641
|
+
document.body.appendChild(link);
|
|
8642
|
+
link.click();
|
|
8643
|
+
document.body.removeChild(link);
|
|
8644
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
8645
|
+
} catch (error) {
|
|
8646
|
+
console.error("Failed to download file:", error);
|
|
8647
|
+
window.open(src, "_blank");
|
|
8648
|
+
}
|
|
8639
8649
|
};
|
|
8640
8650
|
(0, import_react289.useEffect)(() => {
|
|
8641
8651
|
if (!open.isOpen) {
|
|
@@ -8686,7 +8696,7 @@ var ModalPreviewAttachment = ({
|
|
|
8686
8696
|
isImage && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
8687
8697
|
ZoomController,
|
|
8688
8698
|
{
|
|
8689
|
-
onDownload: handleDownload,
|
|
8699
|
+
onDownload: onDownload ? () => onDownload?.({ src, name }) : () => handleDownload(),
|
|
8690
8700
|
onZoomIn: handleZoomIn,
|
|
8691
8701
|
onZoomOut: handleZoomOut,
|
|
8692
8702
|
maxZoom: MAX_ZOOM,
|
|
@@ -8823,7 +8833,8 @@ var PreviewItem = ({
|
|
|
8823
8833
|
customName,
|
|
8824
8834
|
audioPlayerProps,
|
|
8825
8835
|
pdfViewerProps,
|
|
8826
|
-
videoPlayerProps
|
|
8836
|
+
videoPlayerProps,
|
|
8837
|
+
onDownload
|
|
8827
8838
|
}) => {
|
|
8828
8839
|
const [previewShow, setPreviewShow] = (0, import_react290.useState)({
|
|
8829
8840
|
isOpen: false,
|
|
@@ -8966,6 +8977,10 @@ var PreviewItem = ({
|
|
|
8966
8977
|
name: data?.customName ?? data?.file?.name,
|
|
8967
8978
|
src: data?.preview,
|
|
8968
8979
|
open: previewShow,
|
|
8980
|
+
onDownload: () => onDownload?.({
|
|
8981
|
+
src: data?.preview,
|
|
8982
|
+
name: data?.file?.name
|
|
8983
|
+
}),
|
|
8969
8984
|
onClose: () => handleClosePreview(),
|
|
8970
8985
|
audioProps: audioPlayerProps,
|
|
8971
8986
|
videoProps: videoPlayerProps,
|
|
@@ -8997,7 +9012,8 @@ var InputFile = (0, import_react291.forwardRef)(
|
|
|
8997
9012
|
useCustomName,
|
|
8998
9013
|
pdfViewerProps,
|
|
8999
9014
|
audioPlayerProps,
|
|
9000
|
-
videoPlayerProps
|
|
9015
|
+
videoPlayerProps,
|
|
9016
|
+
onDownload
|
|
9001
9017
|
}, ref) => {
|
|
9002
9018
|
const inputRef = (0, import_react291.useRef)(null);
|
|
9003
9019
|
const replaceInputRef = (0, import_react291.useRef)(null);
|
|
@@ -9293,6 +9309,7 @@ var InputFile = (0, import_react291.forwardRef)(
|
|
|
9293
9309
|
PreviewItem,
|
|
9294
9310
|
{
|
|
9295
9311
|
data: item,
|
|
9312
|
+
onDownload: (data) => onDownload?.({ src: data?.src, name: data?.name }),
|
|
9296
9313
|
audioPlayerProps,
|
|
9297
9314
|
pdfViewerProps,
|
|
9298
9315
|
videoPlayerProps,
|
|
@@ -11922,6 +11939,7 @@ function Textarea({
|
|
|
11922
11939
|
description,
|
|
11923
11940
|
errorMessages,
|
|
11924
11941
|
className,
|
|
11942
|
+
required = false,
|
|
11925
11943
|
...props
|
|
11926
11944
|
}) {
|
|
11927
11945
|
const hasError = fieldHasError(errorMessages);
|
|
@@ -11935,10 +11953,11 @@ function Textarea({
|
|
|
11935
11953
|
description,
|
|
11936
11954
|
errorMessages,
|
|
11937
11955
|
className,
|
|
11938
|
-
required
|
|
11956
|
+
required,
|
|
11939
11957
|
children: /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
11940
11958
|
"textarea",
|
|
11941
11959
|
{
|
|
11960
|
+
required: false,
|
|
11942
11961
|
id: props?.id ?? generatedId,
|
|
11943
11962
|
className: cn(
|
|
11944
11963
|
"aria-invalid:ring-danger-500 aria-invalid:border-danger-500 focus-visible:ring-primary-300 flex field-sizing-content min-h-30 w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-base font-medium text-gray-800 shadow-xs transition-[color,box-shadow] outline-none placeholder:text-gray-500 focus-visible:border-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:border-gray-400 disabled:bg-gray-300 md:text-sm",
|