@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.d.cts
CHANGED
|
@@ -277,6 +277,10 @@ interface InputFileProps extends PlayerProps {
|
|
|
277
277
|
customNamePlaceholder?: string;
|
|
278
278
|
maxFilesErrorMessage?: string;
|
|
279
279
|
useCustomName?: boolean;
|
|
280
|
+
onDownload?: (data: {
|
|
281
|
+
src?: string;
|
|
282
|
+
name?: string;
|
|
283
|
+
}) => void;
|
|
280
284
|
}
|
|
281
285
|
interface PreviewItemProps extends PlayerProps {
|
|
282
286
|
data: FileItem;
|
|
@@ -287,6 +291,10 @@ interface PreviewItemProps extends PlayerProps {
|
|
|
287
291
|
labelCustomName?: string;
|
|
288
292
|
customNamePlaceholder?: string;
|
|
289
293
|
customName?: string;
|
|
294
|
+
onDownload?: (data?: {
|
|
295
|
+
src?: string;
|
|
296
|
+
name?: string;
|
|
297
|
+
}) => void;
|
|
290
298
|
}
|
|
291
299
|
interface PlayerProps {
|
|
292
300
|
pdfViewerProps?: React.IframeHTMLAttributes<HTMLIFrameElement>;
|
|
@@ -301,7 +309,7 @@ interface InputFileRef {
|
|
|
301
309
|
|
|
302
310
|
declare const InputFile: react.ForwardRefExoticComponent<InputFileProps & react.RefAttributes<InputFileRef>>;
|
|
303
311
|
|
|
304
|
-
declare const PreviewItem: ({ data, onRemove, onReplace, disabled, labelCustomName, onCustomNameChange, customNamePlaceholder, customName, audioPlayerProps, pdfViewerProps, videoPlayerProps, }: PreviewItemProps) => react_jsx_runtime.JSX.Element;
|
|
312
|
+
declare const PreviewItem: ({ data, onRemove, onReplace, disabled, labelCustomName, onCustomNameChange, customNamePlaceholder, customName, audioPlayerProps, pdfViewerProps, videoPlayerProps, onDownload, }: PreviewItemProps) => react_jsx_runtime.JSX.Element;
|
|
305
313
|
|
|
306
314
|
interface ModalPreviewProps {
|
|
307
315
|
onClose: () => void;
|
|
@@ -311,12 +319,16 @@ interface ModalPreviewProps {
|
|
|
311
319
|
iframeProps?: React.IframeHTMLAttributes<HTMLIFrameElement>;
|
|
312
320
|
audioProps?: React.AudioHTMLAttributes<HTMLAudioElement>;
|
|
313
321
|
videoProps?: React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
322
|
+
onDownload?: (data: {
|
|
323
|
+
src?: string;
|
|
324
|
+
name?: string;
|
|
325
|
+
}) => void;
|
|
314
326
|
open: {
|
|
315
327
|
isOpen: boolean;
|
|
316
328
|
isVisible: boolean;
|
|
317
329
|
};
|
|
318
330
|
}
|
|
319
|
-
declare const ModalPreviewAttachment: ({ onClose, open, src, name, type, iframeProps, audioProps, videoProps, }: ModalPreviewProps) => react_jsx_runtime.JSX.Element | null;
|
|
331
|
+
declare const ModalPreviewAttachment: ({ onClose, open, src, name, type, iframeProps, audioProps, videoProps, onDownload, }: ModalPreviewProps) => react_jsx_runtime.JSX.Element | null;
|
|
320
332
|
|
|
321
333
|
interface CounterProps {
|
|
322
334
|
iconLeft?: React.ReactNode;
|
|
@@ -721,7 +733,7 @@ interface TextareaProps extends react.ComponentProps<'textarea'> {
|
|
|
721
733
|
description?: string;
|
|
722
734
|
errorMessages?: string | string[];
|
|
723
735
|
}
|
|
724
|
-
declare function Textarea({ label, hint, description, errorMessages, className, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
736
|
+
declare function Textarea({ label, hint, description, errorMessages, className, required, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
725
737
|
|
|
726
738
|
type SizeType = 'sm' | 'md' | 'lg';
|
|
727
739
|
type ColorType = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'orange' | 'purple' | 'gray';
|
package/dist/clients.d.ts
CHANGED
|
@@ -277,6 +277,10 @@ interface InputFileProps extends PlayerProps {
|
|
|
277
277
|
customNamePlaceholder?: string;
|
|
278
278
|
maxFilesErrorMessage?: string;
|
|
279
279
|
useCustomName?: boolean;
|
|
280
|
+
onDownload?: (data: {
|
|
281
|
+
src?: string;
|
|
282
|
+
name?: string;
|
|
283
|
+
}) => void;
|
|
280
284
|
}
|
|
281
285
|
interface PreviewItemProps extends PlayerProps {
|
|
282
286
|
data: FileItem;
|
|
@@ -287,6 +291,10 @@ interface PreviewItemProps extends PlayerProps {
|
|
|
287
291
|
labelCustomName?: string;
|
|
288
292
|
customNamePlaceholder?: string;
|
|
289
293
|
customName?: string;
|
|
294
|
+
onDownload?: (data?: {
|
|
295
|
+
src?: string;
|
|
296
|
+
name?: string;
|
|
297
|
+
}) => void;
|
|
290
298
|
}
|
|
291
299
|
interface PlayerProps {
|
|
292
300
|
pdfViewerProps?: React.IframeHTMLAttributes<HTMLIFrameElement>;
|
|
@@ -301,7 +309,7 @@ interface InputFileRef {
|
|
|
301
309
|
|
|
302
310
|
declare const InputFile: react.ForwardRefExoticComponent<InputFileProps & react.RefAttributes<InputFileRef>>;
|
|
303
311
|
|
|
304
|
-
declare const PreviewItem: ({ data, onRemove, onReplace, disabled, labelCustomName, onCustomNameChange, customNamePlaceholder, customName, audioPlayerProps, pdfViewerProps, videoPlayerProps, }: PreviewItemProps) => react_jsx_runtime.JSX.Element;
|
|
312
|
+
declare const PreviewItem: ({ data, onRemove, onReplace, disabled, labelCustomName, onCustomNameChange, customNamePlaceholder, customName, audioPlayerProps, pdfViewerProps, videoPlayerProps, onDownload, }: PreviewItemProps) => react_jsx_runtime.JSX.Element;
|
|
305
313
|
|
|
306
314
|
interface ModalPreviewProps {
|
|
307
315
|
onClose: () => void;
|
|
@@ -311,12 +319,16 @@ interface ModalPreviewProps {
|
|
|
311
319
|
iframeProps?: React.IframeHTMLAttributes<HTMLIFrameElement>;
|
|
312
320
|
audioProps?: React.AudioHTMLAttributes<HTMLAudioElement>;
|
|
313
321
|
videoProps?: React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
322
|
+
onDownload?: (data: {
|
|
323
|
+
src?: string;
|
|
324
|
+
name?: string;
|
|
325
|
+
}) => void;
|
|
314
326
|
open: {
|
|
315
327
|
isOpen: boolean;
|
|
316
328
|
isVisible: boolean;
|
|
317
329
|
};
|
|
318
330
|
}
|
|
319
|
-
declare const ModalPreviewAttachment: ({ onClose, open, src, name, type, iframeProps, audioProps, videoProps, }: ModalPreviewProps) => react_jsx_runtime.JSX.Element | null;
|
|
331
|
+
declare const ModalPreviewAttachment: ({ onClose, open, src, name, type, iframeProps, audioProps, videoProps, onDownload, }: ModalPreviewProps) => react_jsx_runtime.JSX.Element | null;
|
|
320
332
|
|
|
321
333
|
interface CounterProps {
|
|
322
334
|
iconLeft?: React.ReactNode;
|
|
@@ -721,7 +733,7 @@ interface TextareaProps extends react.ComponentProps<'textarea'> {
|
|
|
721
733
|
description?: string;
|
|
722
734
|
errorMessages?: string | string[];
|
|
723
735
|
}
|
|
724
|
-
declare function Textarea({ label, hint, description, errorMessages, className, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
736
|
+
declare function Textarea({ label, hint, description, errorMessages, className, required, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
725
737
|
|
|
726
738
|
type SizeType = 'sm' | 'md' | 'lg';
|
|
727
739
|
type ColorType = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'orange' | 'purple' | 'gray';
|
package/dist/clients.js
CHANGED
|
@@ -8447,7 +8447,8 @@ var ModalPreviewAttachment = ({
|
|
|
8447
8447
|
type,
|
|
8448
8448
|
iframeProps,
|
|
8449
8449
|
audioProps,
|
|
8450
|
-
videoProps
|
|
8450
|
+
videoProps,
|
|
8451
|
+
onDownload
|
|
8451
8452
|
}) => {
|
|
8452
8453
|
const [zoom, setZoom] = useState3(1);
|
|
8453
8454
|
const [isDragging, setIsDragging] = useState3(false);
|
|
@@ -8493,13 +8494,22 @@ var ModalPreviewAttachment = ({
|
|
|
8493
8494
|
const handleMouseUp = () => {
|
|
8494
8495
|
setIsDragging(false);
|
|
8495
8496
|
};
|
|
8496
|
-
const handleDownload = () => {
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8497
|
+
const handleDownload = async () => {
|
|
8498
|
+
try {
|
|
8499
|
+
const response = await fetch(src);
|
|
8500
|
+
const blob = await response.blob();
|
|
8501
|
+
const blobUrl = window.URL.createObjectURL(blob);
|
|
8502
|
+
const link = document.createElement("a");
|
|
8503
|
+
link.href = blobUrl;
|
|
8504
|
+
link.download = name || "download";
|
|
8505
|
+
document.body.appendChild(link);
|
|
8506
|
+
link.click();
|
|
8507
|
+
document.body.removeChild(link);
|
|
8508
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
8509
|
+
} catch (error) {
|
|
8510
|
+
console.error("Failed to download file:", error);
|
|
8511
|
+
window.open(src, "_blank");
|
|
8512
|
+
}
|
|
8503
8513
|
};
|
|
8504
8514
|
useEffect5(() => {
|
|
8505
8515
|
if (!open.isOpen) {
|
|
@@ -8550,7 +8560,7 @@ var ModalPreviewAttachment = ({
|
|
|
8550
8560
|
isImage && /* @__PURE__ */ jsx301(
|
|
8551
8561
|
ZoomController,
|
|
8552
8562
|
{
|
|
8553
|
-
onDownload: handleDownload,
|
|
8563
|
+
onDownload: onDownload ? () => onDownload?.({ src, name }) : () => handleDownload(),
|
|
8554
8564
|
onZoomIn: handleZoomIn,
|
|
8555
8565
|
onZoomOut: handleZoomOut,
|
|
8556
8566
|
maxZoom: MAX_ZOOM,
|
|
@@ -8687,7 +8697,8 @@ var PreviewItem = ({
|
|
|
8687
8697
|
customName,
|
|
8688
8698
|
audioPlayerProps,
|
|
8689
8699
|
pdfViewerProps,
|
|
8690
|
-
videoPlayerProps
|
|
8700
|
+
videoPlayerProps,
|
|
8701
|
+
onDownload
|
|
8691
8702
|
}) => {
|
|
8692
8703
|
const [previewShow, setPreviewShow] = useState4({
|
|
8693
8704
|
isOpen: false,
|
|
@@ -8830,6 +8841,10 @@ var PreviewItem = ({
|
|
|
8830
8841
|
name: data?.customName ?? data?.file?.name,
|
|
8831
8842
|
src: data?.preview,
|
|
8832
8843
|
open: previewShow,
|
|
8844
|
+
onDownload: () => onDownload?.({
|
|
8845
|
+
src: data?.preview,
|
|
8846
|
+
name: data?.file?.name
|
|
8847
|
+
}),
|
|
8833
8848
|
onClose: () => handleClosePreview(),
|
|
8834
8849
|
audioProps: audioPlayerProps,
|
|
8835
8850
|
videoProps: videoPlayerProps,
|
|
@@ -8861,7 +8876,8 @@ var InputFile = forwardRef2(
|
|
|
8861
8876
|
useCustomName,
|
|
8862
8877
|
pdfViewerProps,
|
|
8863
8878
|
audioPlayerProps,
|
|
8864
|
-
videoPlayerProps
|
|
8879
|
+
videoPlayerProps,
|
|
8880
|
+
onDownload
|
|
8865
8881
|
}, ref) => {
|
|
8866
8882
|
const inputRef = useRef3(null);
|
|
8867
8883
|
const replaceInputRef = useRef3(null);
|
|
@@ -9157,6 +9173,7 @@ var InputFile = forwardRef2(
|
|
|
9157
9173
|
PreviewItem,
|
|
9158
9174
|
{
|
|
9159
9175
|
data: item,
|
|
9176
|
+
onDownload: (data) => onDownload?.({ src: data?.src, name: data?.name }),
|
|
9160
9177
|
audioPlayerProps,
|
|
9161
9178
|
pdfViewerProps,
|
|
9162
9179
|
videoPlayerProps,
|
|
@@ -11786,6 +11803,7 @@ function Textarea({
|
|
|
11786
11803
|
description,
|
|
11787
11804
|
errorMessages,
|
|
11788
11805
|
className,
|
|
11806
|
+
required = false,
|
|
11789
11807
|
...props
|
|
11790
11808
|
}) {
|
|
11791
11809
|
const hasError = fieldHasError(errorMessages);
|
|
@@ -11799,10 +11817,11 @@ function Textarea({
|
|
|
11799
11817
|
description,
|
|
11800
11818
|
errorMessages,
|
|
11801
11819
|
className,
|
|
11802
|
-
required
|
|
11820
|
+
required,
|
|
11803
11821
|
children: /* @__PURE__ */ jsx318(
|
|
11804
11822
|
"textarea",
|
|
11805
11823
|
{
|
|
11824
|
+
required: false,
|
|
11806
11825
|
id: props?.id ?? generatedId,
|
|
11807
11826
|
className: cn(
|
|
11808
11827
|
"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",
|