demio-ui 2.5.2 → 2.5.4

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.
Files changed (40) hide show
  1. package/dist/cjs/index.css +1 -1
  2. package/dist/cjs/index.js +5 -5
  3. package/dist/cjs/types/src/components/DnDArea/DnDArea.d.ts +1 -1
  4. package/dist/cjs/types/src/components/Dropdown/Dropdown.d.ts +1 -1
  5. package/dist/cjs/types/src/components/Upload/Upload.d.ts +53 -0
  6. package/dist/cjs/types/src/components/Upload/index.d.ts +1 -0
  7. package/dist/cjs/types/src/components/index.d.ts +1 -0
  8. package/dist/cjs/types/src/hooks/useFileValidation/useFileValidation.d.ts +19 -2
  9. package/dist/cjs/types/src/icons/index.d.ts +2 -1
  10. package/dist/cjs/types/src/index.d.ts +1 -0
  11. package/dist/cjs/types/src/utils/file/file-utils.d.ts +8 -0
  12. package/dist/cjs/types/src/utils/file/index.d.ts +1 -0
  13. package/dist/cjs/types/src/utils/file/test.d.ts +1 -0
  14. package/dist/cjs/types/src/utils/image/image-utils.d.ts +11 -0
  15. package/dist/cjs/types/src/utils/image/index.d.ts +1 -0
  16. package/dist/cjs/types/src/utils/image/test.d.ts +1 -0
  17. package/dist/cjs/types/src/utils/index.d.ts +2 -0
  18. package/dist/esm/index.css +1 -1
  19. package/dist/esm/index.js +5 -5
  20. package/dist/esm/types/src/components/DnDArea/DnDArea.d.ts +1 -1
  21. package/dist/esm/types/src/components/Dropdown/Dropdown.d.ts +1 -1
  22. package/dist/esm/types/src/components/Upload/Upload.d.ts +53 -0
  23. package/dist/esm/types/src/components/Upload/index.d.ts +1 -0
  24. package/dist/esm/types/src/components/index.d.ts +1 -0
  25. package/dist/esm/types/src/hooks/useFileValidation/useFileValidation.d.ts +19 -2
  26. package/dist/esm/types/src/icons/index.d.ts +2 -1
  27. package/dist/esm/types/src/index.d.ts +1 -0
  28. package/dist/esm/types/src/utils/file/file-utils.d.ts +8 -0
  29. package/dist/esm/types/src/utils/file/index.d.ts +1 -0
  30. package/dist/esm/types/src/utils/file/test.d.ts +1 -0
  31. package/dist/esm/types/src/utils/image/image-utils.d.ts +11 -0
  32. package/dist/esm/types/src/utils/image/index.d.ts +1 -0
  33. package/dist/esm/types/src/utils/image/test.d.ts +1 -0
  34. package/dist/esm/types/src/utils/index.d.ts +2 -0
  35. package/dist/types.d.ts +348 -260
  36. package/package.json +22 -18
  37. package/dist/cjs/types/src/components/Pagination/Pagination.utils.d.ts +0 -7
  38. package/dist/cjs/types/src/hooks/useCroppedImage.d.ts +0 -4
  39. package/dist/esm/types/src/components/Pagination/Pagination.utils.d.ts +0 -7
  40. package/dist/esm/types/src/hooks/useCroppedImage.d.ts +0 -4
@@ -3,7 +3,7 @@ export interface DnDAreaProps {
3
3
  acceptableFileTypes?: string;
4
4
  className?: string;
5
5
  children?: ReactNode;
6
- dropText?: string;
6
+ dropText?: ReactNode;
7
7
  fileSizeMbLimit?: number;
8
8
  errorDimension?: string;
9
9
  error?: string;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
3
  export declare const DropdownMenuContent: React.ForwardRefExoticComponent<Pick<import("@radix-ui/react-menu").MenuContentProps & React.RefAttributes<HTMLDivElement>, "className" | "children" | "onClick" | "prefix" | "slot" | "style" | "title" | "forceMount" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "asChild" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "onCloseAutoFocus" | "align" | "side" | "sideOffset" | "alignOffset" | "arrowPadding" | "avoidCollisions" | "collisionBoundary" | "collisionPadding" | "sticky" | "hideWhenDetached" | "updatePositionStrategy" | "loop" | "onEntryFocus"> & React.RefAttributes<HTMLDivElement>>;
4
4
  export declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<{
5
- className?: string | undefined;
5
+ className?: string;
6
6
  } & React.RefAttributes<HTMLDivElement>>;
7
7
  export declare const DropdownMenuRoot: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
8
8
  export declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,53 @@
1
+ import React, { DragEvent, FC, ReactNode, SetStateAction } from 'react';
2
+ import { RcFile, UploadProgressEvent } from 'rc-upload/es/interface';
3
+ import { Area, Point } from 'react-easy-crop';
4
+ export interface SelectOptions {
5
+ file?: string;
6
+ setFile?: (file: string) => void;
7
+ }
8
+ export interface UploadMenuItem {
9
+ className?: string;
10
+ icon?: ReactNode;
11
+ onSelect?: (e: Event, options: SelectOptions) => void;
12
+ text: ReactNode;
13
+ isDisabled?: boolean;
14
+ }
15
+ export interface UploadProps {
16
+ acceptableFileTypes?: string;
17
+ children?: ReactNode;
18
+ className?: string;
19
+ customIcon?: ReactNode;
20
+ customHeader?: string;
21
+ customText?: ReactNode;
22
+ cropAspectRatio?: number;
23
+ dropText?: ReactNode;
24
+ error?: string;
25
+ errorDimension?: string;
26
+ errorSize?: string;
27
+ errorType?: string;
28
+ fileSizeMbLimit?: number;
29
+ isCropAllowed?: boolean;
30
+ isDimensionValidationEnabled?: boolean;
31
+ isSizeValidationEnabled?: boolean;
32
+ isTypeValidationEnabled?: boolean;
33
+ isValidationEnabled?: boolean;
34
+ menu?: UploadMenuItem[];
35
+ minHeightLimit?: number;
36
+ minWidthLimit?: number;
37
+ name?: string;
38
+ onBeforeUpload?: (file: RcFile, fileList: RcFile[]) => void;
39
+ onCropCancel?: () => void;
40
+ onCropOk?: (croppedUrl: string) => void;
41
+ onCropChange?: (data: SetStateAction<Point>) => void;
42
+ onCropComplete?: (croppedArea: Area, croppedAreaPixels: Area) => void;
43
+ onDragLeave?: (event: React.DragEvent<HTMLDivElement>) => void;
44
+ onDragOver?: (event: React.DragEvent<HTMLDivElement>) => void;
45
+ onDrop?: (event: DragEvent<HTMLDivElement>, file: File | null) => void;
46
+ onError?: (err: Error, ret: Record<string, unknown>, file: RcFile) => void;
47
+ onProgress?: (event: UploadProgressEvent, file: RcFile) => void;
48
+ onStart?: (file: RcFile) => void;
49
+ onSuccess?: (ret: Record<string, unknown>) => void;
50
+ onZoomChange?: (value: number) => void;
51
+ }
52
+ declare const Upload: FC<UploadProps>;
53
+ export default Upload;
@@ -0,0 +1 @@
1
+ export { default } from './Upload';
@@ -28,3 +28,4 @@ export { Tab, TabsContent, TabsList, TabsRoot } from './Tabs';
28
28
  export { Tag } from './Tag';
29
29
  export { PopoverTooltip, Tooltip } from './Tooltip';
30
30
  export { Typography } from './Typography';
31
+ export { default as Upload } from './Upload';
@@ -1,6 +1,11 @@
1
+ export interface FileValidation {
2
+ isFileDimensionValid: boolean;
3
+ isFileSizeValid: boolean;
4
+ isFileTypeValid: boolean;
5
+ isFileValid: boolean;
6
+ }
1
7
  interface useFileValidationInterface {
2
8
  acceptableFileTypes?: string;
3
- file?: File | null;
4
9
  fileSizeMbLimit?: number;
5
10
  isValidationEnabled?: boolean;
6
11
  isDimensionValidationEnabled?: boolean;
@@ -9,10 +14,22 @@ interface useFileValidationInterface {
9
14
  minHeightLimit?: number;
10
15
  minWidthLimit?: number;
11
16
  }
12
- export declare const useFileValidation: ({ acceptableFileTypes, file, fileSizeMbLimit, isValidationEnabled, isDimensionValidationEnabled, isSizeValidationEnabled, isTypeValidationEnabled, minHeightLimit, minWidthLimit, }: useFileValidationInterface) => {
17
+ export declare const initialFileValidation: {
18
+ isFileDimensionValid: boolean;
19
+ isFileSizeValid: boolean;
20
+ isFileTypeValid: boolean;
13
21
  isFileValid: boolean;
22
+ };
23
+ export declare const useFileValidation: ({ acceptableFileTypes, fileSizeMbLimit, isValidationEnabled, isDimensionValidationEnabled, isSizeValidationEnabled, isTypeValidationEnabled, minHeightLimit, minWidthLimit, }: useFileValidationInterface) => {
24
+ validate: (file?: unknown) => Promise<{
25
+ isFileDimensionValid: boolean;
26
+ isFileSizeValid: boolean;
27
+ isFileTypeValid: boolean;
28
+ isFileValid: boolean;
29
+ }>;
14
30
  isFileDimensionValid: boolean;
15
31
  isFileSizeValid: boolean;
16
32
  isFileTypeValid: boolean;
33
+ isFileValid: boolean;
17
34
  };
18
35
  export {};
@@ -62,6 +62,7 @@ import PeopleIcon from './people.svg';
62
62
  import PeopleCommunityIcon from './people-community.svg';
63
63
  import Person from './person.svg';
64
64
  import PlayIcon from './play.svg';
65
+ import PlusIcon from './plus.svg';
65
66
  import PollIcon from './poll.svg';
66
67
  import ProgressIcon from './progress.svg';
67
68
  import ReplayDisabledIcon from './replay_disabled.svg';
@@ -90,4 +91,4 @@ import VolumeUpSolidIcon from './volume_up.svg';
90
91
  import VolumeUpIcon from './volume_up-1.svg';
91
92
  import WarningSolidIcon from './warning.svg';
92
93
  import WarningIcon from './warning-1.svg';
93
- export { AddIcon, ArrowDownIcon, ArrowFromLeftIcon, ArrowLeftDoubleIcon, ArrowLeftIcon, ArrowLeftSingleIcon, BarChartIcon, BlockIcon, BlurOnIcon, CachedIcon, CalendarIcon, CalendarStarIcon, CameraIcon, ChatIcon, CheckboxIcon, CheckboxUncheckIcon, CheckCircleIcon, CheckCircleSolidIcon, ClockIcon, CloseIcon, CompressIcon, CopyIcon, CustomizeIcon, DeleteIcon, DotsIcon, DownloadIcon, EditIcon, ElectricBoltIcon, EventDetailsIcon, EventRepeatIcon, ExclamationIcon, ExpandIcon, ExternalLinkIcon, FeatureActionIcon, FileIcon, FilterListIcon, FlipCameraIcon, GearIcon, HelpSolidIcon, InfoCircleIcon, InfoCircleSolidIcon, InfoIcon, InfoSolidIcon, ItemsIcon, ListIcon, ListThIcon, LocationIcon, LockIcon, MagicIcon, MailIcon, MaterialsIcon, MicBoldIcon, MicOffIcon, MicOffSolidIcon, MicOnfIcon, MicOnSolidIcon, MobileDeviceIcon, OutStageIcon, PasswordEyeCrossedIcon, PasswordEyeIcon, PeopleCommunityIcon, PeopleIcon, Person, Person as PersonIcon, PlayIcon, PollIcon, ProgressIcon, ReplayDisabledIcon, RestartIcon, RocketIcon, ScreenPersonIcon, ScreenShareIcon, ScreenShareWindowIcon, SearchIcon, SideBarIcon, SmileIcon, SpotlightIcon, StackedEmailIcon, SyncIcon, TimesCircleIcon, TodayIcon, TrendingDownIcon, TrendingUpIcon, VideoCamOffIcon, VideoCamOffSolidIcon, VideoCamOnIcon, VideoCamOnSolidIcon, VolumeOffIcon, VolumeOffSolidIcon, VolumeUpIcon, VolumeUpSolidIcon, WarningIcon, WarningSolidIcon, };
94
+ export { AddIcon, ArrowDownIcon, ArrowFromLeftIcon, ArrowLeftDoubleIcon, ArrowLeftIcon, ArrowLeftSingleIcon, BarChartIcon, BlockIcon, BlurOnIcon, CachedIcon, CalendarIcon, CalendarStarIcon, CameraIcon, ChatIcon, CheckboxIcon, CheckboxUncheckIcon, CheckCircleIcon, CheckCircleSolidIcon, ClockIcon, CloseIcon, CompressIcon, CopyIcon, CustomizeIcon, DeleteIcon, DotsIcon, DownloadIcon, EditIcon, ElectricBoltIcon, EventDetailsIcon, EventRepeatIcon, ExclamationIcon, ExpandIcon, ExternalLinkIcon, FeatureActionIcon, FileIcon, FilterListIcon, FlipCameraIcon, GearIcon, HelpSolidIcon, InfoCircleIcon, InfoCircleSolidIcon, InfoIcon, InfoSolidIcon, ItemsIcon, ListIcon, ListThIcon, LocationIcon, LockIcon, MagicIcon, MailIcon, MaterialsIcon, MicBoldIcon, MicOffIcon, MicOffSolidIcon, MicOnfIcon, MicOnSolidIcon, MobileDeviceIcon, OutStageIcon, PasswordEyeCrossedIcon, PasswordEyeIcon, PeopleCommunityIcon, PeopleIcon, Person, Person as PersonIcon, PlayIcon, PlusIcon, PollIcon, ProgressIcon, ReplayDisabledIcon, RestartIcon, RocketIcon, ScreenPersonIcon, ScreenShareIcon, ScreenShareWindowIcon, SearchIcon, SideBarIcon, SmileIcon, SpotlightIcon, StackedEmailIcon, SyncIcon, TimesCircleIcon, TodayIcon, TrendingDownIcon, TrendingUpIcon, VideoCamOffIcon, VideoCamOffSolidIcon, VideoCamOnIcon, VideoCamOnSolidIcon, VolumeOffIcon, VolumeOffSolidIcon, VolumeUpIcon, VolumeUpSolidIcon, WarningIcon, WarningSolidIcon, };
@@ -2,3 +2,4 @@ import './index.css';
2
2
  export * from './components';
3
3
  export * from './hooks';
4
4
  export * as icons from './icons';
5
+ export * from './utils';
@@ -0,0 +1,8 @@
1
+ export declare const mimeTypeMap: Record<string, string[]>;
2
+ export declare const getFileExtension: (file?: unknown) => string;
3
+ export declare const getFileMimeType: (file?: unknown) => string;
4
+ export declare const isExtensionMatchingMimeType: (extension?: unknown, mimeType?: unknown) => boolean;
5
+ export declare const isValidFileType: (file?: unknown, acceptableTypePattern?: unknown) => boolean;
6
+ export declare const isImage: (file?: unknown) => boolean;
7
+ export declare const isValidFileSize: (file?: unknown, fileSizeMbLimit?: unknown) => boolean;
8
+ export declare const isValidFileDimension: (file?: unknown, minWidth?: number, minHeight?: number) => Promise<boolean>;
@@ -0,0 +1 @@
1
+ export { getFileExtension, getFileMimeType, isExtensionMatchingMimeType, isValidFileDimension, isValidFileSize, isValidFileType, mimeTypeMap, } from './file-utils';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Area } from 'react-easy-crop';
2
+ export declare const createImage: (url: string) => Promise<HTMLImageElement>;
3
+ export declare const getRadianAngle: (degreeValue?: number) => number;
4
+ export declare const rotateSize: (width: number, height: number, rotation: number) => {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export declare const getCroppedImageURL: (imageSrc: string, pixelCrop: Area, rotation?: number, flip?: {
9
+ horizontal: boolean;
10
+ vertical: boolean;
11
+ }) => Promise<string | null>;
@@ -0,0 +1 @@
1
+ export { createImage, getCroppedImageURL, getRadianAngle, rotateSize } from './image-utils';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { getFileExtension, getFileMimeType, isExtensionMatchingMimeType, isValidFileDimension, isValidFileSize, isValidFileType, mimeTypeMap, } from './file';
2
+ export { createImage, getCroppedImageURL, getRadianAngle, rotateSize } from './image';