@hai-dev/ui-kit 1.0.0

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 (66) hide show
  1. package/README.md +73 -0
  2. package/dist/Button-BjNjCLw8.js +6428 -0
  3. package/dist/DialogTitle-1A3dJ174.js +3258 -0
  4. package/dist/assets/error-upload-dialog.css +1 -0
  5. package/dist/assets/photo-crop-uploader.css +1 -0
  6. package/dist/assets/upload-button.css +1 -0
  7. package/dist/assets/upload-dialog.css +1 -0
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/components/index.js +4 -0
  10. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.d.ts +3 -0
  11. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +33 -0
  12. package/dist/components/photo-crop-uploader/components/error-upload-dialog/index.d.ts +1 -0
  13. package/dist/components/photo-crop-uploader/components/error-upload-dialog/index.js +4 -0
  14. package/dist/components/photo-crop-uploader/components/error-upload-dialog/types.d.ts +9 -0
  15. package/dist/components/photo-crop-uploader/components/error-upload-dialog/types.js +1 -0
  16. package/dist/components/photo-crop-uploader/components/index.d.ts +3 -0
  17. package/dist/components/photo-crop-uploader/components/index.js +8 -0
  18. package/dist/components/photo-crop-uploader/components/upload-button/constants.d.ts +3 -0
  19. package/dist/components/photo-crop-uploader/components/upload-button/constants.js +6 -0
  20. package/dist/components/photo-crop-uploader/components/upload-button/index.d.ts +1 -0
  21. package/dist/components/photo-crop-uploader/components/upload-button/index.js +4 -0
  22. package/dist/components/photo-crop-uploader/components/upload-button/types.d.ts +12 -0
  23. package/dist/components/photo-crop-uploader/components/upload-button/types.js +1 -0
  24. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.d.ts +3 -0
  25. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +90 -0
  26. package/dist/components/photo-crop-uploader/components/upload-dialog/index.d.ts +1 -0
  27. package/dist/components/photo-crop-uploader/components/upload-dialog/index.js +4 -0
  28. package/dist/components/photo-crop-uploader/components/upload-dialog/types.d.ts +27 -0
  29. package/dist/components/photo-crop-uploader/components/upload-dialog/types.js +1 -0
  30. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.d.ts +3 -0
  31. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +123 -0
  32. package/dist/components/photo-crop-uploader/constants.d.ts +41 -0
  33. package/dist/components/photo-crop-uploader/constants.js +64 -0
  34. package/dist/components/photo-crop-uploader/errors/index.d.ts +2 -0
  35. package/dist/components/photo-crop-uploader/errors/index.js +6 -0
  36. package/dist/components/photo-crop-uploader/errors/photo-file.error.d.ts +7 -0
  37. package/dist/components/photo-crop-uploader/errors/photo-file.error.js +15 -0
  38. package/dist/components/photo-crop-uploader/errors/photo-size.error.d.ts +10 -0
  39. package/dist/components/photo-crop-uploader/errors/photo-size.error.js +19 -0
  40. package/dist/components/photo-crop-uploader/index.d.ts +1 -0
  41. package/dist/components/photo-crop-uploader/index.js +4 -0
  42. package/dist/components/photo-crop-uploader/locale.d.ts +2 -0
  43. package/dist/components/photo-crop-uploader/locale.js +47 -0
  44. package/dist/components/photo-crop-uploader/photo-crop-uploader.d.ts +3 -0
  45. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +143 -0
  46. package/dist/components/photo-crop-uploader/photo-crop-uploder.stories.d.ts +7 -0
  47. package/dist/components/photo-crop-uploader/types.d.ts +33 -0
  48. package/dist/components/photo-crop-uploader/types.js +1 -0
  49. package/dist/components/photo-crop-uploader/utils/get-croped-photo.d.ts +4 -0
  50. package/dist/components/photo-crop-uploader/utils/get-croped-photo.js +26 -0
  51. package/dist/components/photo-crop-uploader/utils/get-photo-crop.d.ts +2 -0
  52. package/dist/components/photo-crop-uploader/utils/get-photo-crop.js +18 -0
  53. package/dist/components/photo-crop-uploader/utils/index.d.ts +4 -0
  54. package/dist/components/photo-crop-uploader/utils/index.js +10 -0
  55. package/dist/components/photo-crop-uploader/utils/read-photo.d.ts +3 -0
  56. package/dist/components/photo-crop-uploader/utils/read-photo.js +51 -0
  57. package/dist/components/photo-crop-uploader/utils/validate-photo-file.d.ts +3 -0
  58. package/dist/components/photo-crop-uploader/utils/validate-photo-file.js +24 -0
  59. package/dist/constants.d.ts +3 -0
  60. package/dist/constants.js +6 -0
  61. package/dist/index-BiffjjQq.js +431 -0
  62. package/dist/index.d.ts +5 -0
  63. package/dist/index.js +26 -0
  64. package/dist/types.d.ts +2 -0
  65. package/dist/types.js +1 -0
  66. package/package.json +73 -0
@@ -0,0 +1 @@
1
+ ._dialog_lyvu5_1 ._dialogErrorText_lyvu5_1{color:#e2402fe0}
@@ -0,0 +1 @@
1
+ ._photoCropCanvas_1i4lr_1{display:none}
@@ -0,0 +1 @@
1
+ ._dragDropWrapper_z6dm0_1 ._uploadButton_z6dm0_1 ._input_z6dm0_1{clip:rect(0 0 0 0);clip-path:inset(50%);height:1;overflow:hidden;position:absolute;bottom:0;left:0;white-space:nowrap;width:1}
@@ -0,0 +1 @@
1
+ ._dialog_jouds_1 ._dialogText_jouds_1{color:#e2402fe0}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}:root{--rc-drag-handle-size: 12px;--rc-drag-handle-mobile-size: 24px;--rc-drag-handle-bg-colour: rgba(0, 0, 0, .2);--rc-drag-bar-size: 6px;--rc-border-color: rgba(255, 255, 255, .7);--rc-focus-color: #0088ff}.ReactCrop{position:relative;display:inline-block;cursor:crosshair;max-width:100%}.ReactCrop *,.ReactCrop *:before,.ReactCrop *:after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{overflow:hidden;max-height:inherit}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{display:block;max-width:100%;max-height:inherit}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>video{touch-action:none}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-mask{position:absolute;inset:0;pointer-events:none;width:calc(100% + .5px);height:calc(100% + .5px)}.ReactCrop__crop-selection{position:absolute;top:0;left:0;transform:translateZ(0);cursor:move}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--circular-crop .ReactCrop__crop-selection:after{pointer-events:none;content:"";position:absolute;inset:-1px;border:1px solid var(--rc-border-color);opacity:.3}.ReactCrop--no-animate .ReactCrop__crop-selection{outline:1px dashed white}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection){animation:marching-ants 1s;background-image:linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%);background-size:10px 1px,10px 1px,1px 10px,1px 10px;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;color:#fff;animation-play-state:running;animation-timing-function:linear;animation-iteration-count:infinite}.ReactCrop__crop-selection:focus{outline:2px solid var(--rc-focus-color);outline-offset:-1px}.ReactCrop--invisible-crop .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";display:block;position:absolute;background-color:#fff6}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333333333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6666666667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333333333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6666666667%}.ReactCrop__drag-handle{position:absolute;width:var(--rc-drag-handle-size);height:var(--rc-drag-handle-size);background-color:var(--rc-drag-handle-bg-colour);border:1px solid var(--rc-border-color)}.ReactCrop__drag-handle:focus{background:var(--rc-focus-color)}.ReactCrop .ord-nw{top:0;left:0;transform:translate(-50%,-50%);cursor:nw-resize}.ReactCrop .ord-n{top:0;left:50%;transform:translate(-50%,-50%);cursor:n-resize}.ReactCrop .ord-ne{top:0;right:0;transform:translate(50%,-50%);cursor:ne-resize}.ReactCrop .ord-e{top:50%;right:0;transform:translate(50%,-50%);cursor:e-resize}.ReactCrop .ord-se{bottom:0;right:0;transform:translate(50%,50%);cursor:se-resize}.ReactCrop .ord-s{bottom:0;left:50%;transform:translate(-50%,50%);cursor:s-resize}.ReactCrop .ord-sw{bottom:0;left:0;transform:translate(-50%,50%);cursor:sw-resize}.ReactCrop .ord-w{top:50%;left:0;transform:translate(-50%,-50%);cursor:w-resize}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{top:0;left:0;width:100%;height:var(--rc-drag-bar-size);transform:translateY(-50%)}.ReactCrop__drag-bar.ord-e{right:0;top:0;width:var(--rc-drag-bar-size);height:100%;transform:translate(50%)}.ReactCrop__drag-bar.ord-s{bottom:0;left:0;width:100%;height:var(--rc-drag-bar-size);transform:translateY(50%)}.ReactCrop__drag-bar.ord-w{top:0;left:0;width:var(--rc-drag-bar-size);height:100%;transform:translate(-50%)}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer: coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:var(--rc-drag-handle-mobile-size);height:var(--rc-drag-handle-mobile-size)}}
@@ -0,0 +1 @@
1
+ export { PhotoCropUploader } from './photo-crop-uploader';
@@ -0,0 +1,4 @@
1
+ import { PhotoCropUploader as p } from "./photo-crop-uploader/photo-crop-uploader.js";
2
+ export {
3
+ p as PhotoCropUploader
4
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ErrorUploadDialogProps } from './types';
3
+ export declare const ErrorUploadDialog: FC<ErrorUploadDialogProps>;
@@ -0,0 +1,33 @@
1
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
+ import { c as a, B as g } from "../../../../Button-BjNjCLw8.js";
3
+ import { localizedText as i } from "../../locale.js";
4
+ import { EN_LOCALE as m } from "../../../../constants.js";
5
+ import { D as x, a as p, b as E, c as D, d as h } from "../../../../DialogTitle-1A3dJ174.js";
6
+ import '../../../../assets/error-upload-dialog.css';const T = "_dialog_lyvu5_1", _ = "_dialogErrorText_lyvu5_1", t = {
7
+ dialog: T,
8
+ dialogErrorText: _
9
+ }, b = (s) => {
10
+ const {
11
+ photoError: e,
12
+ onCloseErrorDialog: r,
13
+ locale: l = m,
14
+ className: c,
15
+ ...n
16
+ } = s;
17
+ return /* @__PURE__ */ d(
18
+ x,
19
+ {
20
+ className: a(t.dialog, c),
21
+ onClose: r,
22
+ ...n,
23
+ children: [
24
+ /* @__PURE__ */ o(p, { children: i[l].error }),
25
+ /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(D, { className: a(t.dialogErrorText), children: e }) }),
26
+ /* @__PURE__ */ o(h, { children: /* @__PURE__ */ o(g, { onClick: r, children: i[l].back }) })
27
+ ]
28
+ }
29
+ );
30
+ };
31
+ export {
32
+ b as ErrorUploadDialog
33
+ };
@@ -0,0 +1 @@
1
+ export { ErrorUploadDialog } from './error-upload-dialog';
@@ -0,0 +1,4 @@
1
+ import { ErrorUploadDialog as a } from "./error-upload-dialog.js";
2
+ export {
3
+ a as ErrorUploadDialog
4
+ };
@@ -0,0 +1,9 @@
1
+ import { DialogProps } from '@mui/material';
2
+ import { Locale } from '../../../../types';
3
+ type ErrorUploadDialogCustomProps = {
4
+ onCloseErrorDialog?: () => void;
5
+ photoError?: string;
6
+ locale?: Locale;
7
+ };
8
+ export type ErrorUploadDialogProps = ErrorUploadDialogCustomProps & DialogProps;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ export { UploadButton } from './upload-button';
2
+ export { ErrorUploadDialog } from './error-upload-dialog';
3
+ export { UploadDialog } from './upload-dialog';
@@ -0,0 +1,8 @@
1
+ import { UploadButton as p } from "./upload-button/upload-button.js";
2
+ import { ErrorUploadDialog as l } from "./error-upload-dialog/error-upload-dialog.js";
3
+ import { UploadDialog as d } from "./upload-dialog/upload-dialog.js";
4
+ export {
5
+ l as ErrorUploadDialog,
6
+ p as UploadButton,
7
+ d as UploadDialog
8
+ };
@@ -0,0 +1,3 @@
1
+ export declare const UPLOAD_BUTTON_IMAGE_SIZE = 20;
2
+ export declare const UPLOAD_BUTTON_TAB_INDEX = -1;
3
+ export declare const UPLOAD_BUTTON_WIDTH_DEFAULT = 260;
@@ -0,0 +1,6 @@
1
+ const T = 20, _ = -1, U = 260;
2
+ export {
3
+ T as UPLOAD_BUTTON_IMAGE_SIZE,
4
+ _ as UPLOAD_BUTTON_TAB_INDEX,
5
+ U as UPLOAD_BUTTON_WIDTH_DEFAULT
6
+ };
@@ -0,0 +1 @@
1
+ export { UploadButton } from './upload-button';
@@ -0,0 +1,4 @@
1
+ import { UploadButton as p } from "./upload-button.js";
2
+ export {
3
+ p as UploadButton
4
+ };
@@ -0,0 +1,12 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ import { Locale } from '../../../../types';
3
+ import { PhotoExtension } from '../../types';
4
+ type UploadButtonCustonProps = {
5
+ buttonClassname?: string;
6
+ buttonDisabled?: boolean;
7
+ locale?: Locale;
8
+ width?: number | string;
9
+ allowedExtensions?: PhotoExtension[];
10
+ };
11
+ export type UploadButtonProps = InputHTMLAttributes<HTMLInputElement> & UploadButtonCustonProps;
12
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { UploadButtonProps } from './types';
3
+ export declare const UploadButton: FC<UploadButtonProps>;
@@ -0,0 +1,90 @@
1
+ import { jsx as a, jsxs as B } from "react/jsx-runtime";
2
+ import { useState as I, useRef as N } from "react";
3
+ import { c as n, B as S } from "../../../../Button-BjNjCLw8.js";
4
+ import { localizedText as c } from "../../locale.js";
5
+ import { EN_LOCALE as C } from "../../../../constants.js";
6
+ import { SUPPORTED_IMAGE_EXTENSIONS as P } from "../../constants.js";
7
+ import { UPLOAD_BUTTON_WIDTH_DEFAULT as U, UPLOAD_BUTTON_TAB_INDEX as A, UPLOAD_BUTTON_IMAGE_SIZE as d } from "./constants.js";
8
+ import '../../../../assets/upload-button.css';const G = "data:image/svg+xml,%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Transformed%20by:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23000000'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'/%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3cpath%20fill='%23ffffff'%20d='M544%20864V672h128L512%20480%20352%20672h128v192H320v-1.6c-5.376.32-10.496%201.6-16%201.6A240%20240%200%200%201%2064%20624c0-123.136%2093.12-223.488%20212.608-237.248A239.808%20239.808%200%200%201%20512%20192a239.872%20239.872%200%200%201%20235.456%20194.752c119.488%2013.76%20212.48%20114.112%20212.48%20237.248a240%20240%200%200%201-240%20240c-5.376%200-10.56-1.28-16-1.6v1.6H544z'/%3e%3c/g%3e%3c/svg%3e", L = "_dragDropWrapper_z6dm0_1", b = "_uploadButton_z6dm0_1", R = "_input_z6dm0_1", s = {
9
+ dragDropWrapper: L,
10
+ uploadButton: b,
11
+ input: R
12
+ }, H = (g) => {
13
+ const {
14
+ buttonClassname: u,
15
+ buttonDisabled: o = !1,
16
+ children: f,
17
+ className: m,
18
+ onChange: e,
19
+ locale: p = C,
20
+ width: h = U,
21
+ allowedExtensions: D = P,
22
+ ...v
23
+ } = g, [_, r] = I(!1), T = N(null), i = (t) => {
24
+ t && t.length > 0 && e && e({
25
+ target: {
26
+ files: t,
27
+ value: ""
28
+ }
29
+ });
30
+ }, w = (t) => {
31
+ t.preventDefault(), t.stopPropagation(), o || r(!0);
32
+ }, E = (t) => {
33
+ t.preventDefault(), t.stopPropagation(), r(!1);
34
+ }, x = (t) => {
35
+ if (t.preventDefault(), t.stopPropagation(), r(!1), o) return;
36
+ const l = t.dataTransfer?.files;
37
+ i(l);
38
+ }, O = (t) => {
39
+ i(t.target.files), e && e(t);
40
+ };
41
+ return /* @__PURE__ */ a(
42
+ "div",
43
+ {
44
+ className: n(s.dragDropWrapper),
45
+ onDragOver: w,
46
+ onDragLeave: E,
47
+ onDrop: x,
48
+ children: /* @__PURE__ */ B(
49
+ S,
50
+ {
51
+ component: "label",
52
+ sx: {
53
+ width: h
54
+ },
55
+ role: "none",
56
+ variant: "contained",
57
+ disabled: o,
58
+ tabIndex: A,
59
+ className: n(s.uploadButton, u),
60
+ startIcon: /* @__PURE__ */ a(
61
+ "img",
62
+ {
63
+ width: d,
64
+ height: d,
65
+ src: G,
66
+ alt: c[p].upload
67
+ }
68
+ ),
69
+ children: [
70
+ _ ? c[p].drop : f,
71
+ /* @__PURE__ */ a(
72
+ "input",
73
+ {
74
+ ref: T,
75
+ className: n(s.input, m),
76
+ type: "file",
77
+ accept: D.join(", "),
78
+ onChange: O,
79
+ ...v
80
+ }
81
+ )
82
+ ]
83
+ }
84
+ )
85
+ }
86
+ );
87
+ };
88
+ export {
89
+ H as UploadButton
90
+ };
@@ -0,0 +1 @@
1
+ export { UploadDialog } from './upload-dialog';
@@ -0,0 +1,4 @@
1
+ import { UploadDialog as l } from "./upload-dialog.js";
2
+ export {
3
+ l as UploadDialog
4
+ };
@@ -0,0 +1,27 @@
1
+ import { SyntheticEvent } from 'react';
2
+ import { DialogProps } from '@mui/material';
3
+ import { Crop, PercentCrop, PixelCrop } from 'react-image-crop';
4
+ import { Locale } from '../../../../types';
5
+ import { PhotoDataUrl } from '../../types';
6
+ type OnPhotoLoad = (event: SyntheticEvent<HTMLImageElement, Event>) => void;
7
+ type OnCropChange = (pixelCrop: PixelCrop, percentCrop: PercentCrop) => void;
8
+ type ImageRef = {
9
+ current: HTMLImageElement | null;
10
+ };
11
+ type UploadDialogCustomProps = {
12
+ photoSource?: PhotoDataUrl;
13
+ photoError?: string;
14
+ imageRef?: ImageRef;
15
+ onCloseDialogHandler?: () => void;
16
+ onPhotoLoad?: OnPhotoLoad;
17
+ onCropChange?: OnCropChange;
18
+ onPhotoCrop?: () => void;
19
+ photoCrop?: Crop;
20
+ minDimension?: number;
21
+ aspectRatio?: number;
22
+ locale?: Locale;
23
+ circular?: boolean;
24
+ keepSelection?: boolean;
25
+ };
26
+ export type UploadDialogProps = UploadDialogCustomProps & DialogProps;
27
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { UploadDialogProps } from './types';
3
+ export declare const UploadDialog: FC<UploadDialogProps>;
@@ -0,0 +1,123 @@
1
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
+ import { S as y } from "../../../../index-BiffjjQq.js";
3
+ import { s as B, a as b, b as P, g as I, C as O, T as S, d as j, P as o, c as C, B as T } from "../../../../Button-BjNjCLw8.js";
4
+ import { localizedText as d } from "../../locale.js";
5
+ import { EN_LOCALE as A } from "../../../../constants.js";
6
+ import { DEFAULT_MIN_DIMENSION as L, DEFAULT_ASPECT_RATIO as R } from "../../constants.js";
7
+ import { u as M, e as k, D as v, a as F, b as U, c as H, d as w } from "../../../../DialogTitle-1A3dJ174.js";
8
+ import * as z from "react";
9
+ import '../../../../assets/upload-dialog.css';function G(m = {}) {
10
+ const {
11
+ themeId: s,
12
+ defaultTheme: n,
13
+ defaultClassName: l = "MuiBox-root",
14
+ generateClassName: c
15
+ } = m, p = B("div", {
16
+ shouldForwardProp: (a) => a !== "theme" && a !== "sx" && a !== "as"
17
+ })(b);
18
+ return /* @__PURE__ */ z.forwardRef(function(h, i) {
19
+ const r = M(n), {
20
+ className: t,
21
+ component: g = "div",
22
+ ...f
23
+ } = k(h);
24
+ return /* @__PURE__ */ e(p, {
25
+ as: g,
26
+ ref: i,
27
+ className: P(t, c ? c(l) : l),
28
+ theme: s && r[s] || r,
29
+ ...f
30
+ });
31
+ });
32
+ }
33
+ const V = I("MuiBox", ["root"]), W = j(), D = G({
34
+ themeId: S,
35
+ defaultTheme: W,
36
+ defaultClassName: V.root,
37
+ generateClassName: O.generate
38
+ });
39
+ process.env.NODE_ENV !== "production" && (D.propTypes = {
40
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
41
+ // │ These PropTypes are generated from the TypeScript type definitions. │
42
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
43
+ // └─────────────────────────────────────────────────────────────────────┘
44
+ /**
45
+ * @ignore
46
+ */
47
+ children: o.node,
48
+ /**
49
+ * The component used for the root node.
50
+ * Either a string to use a HTML element or a component.
51
+ */
52
+ component: o.elementType,
53
+ /**
54
+ * The system prop that allows defining system overrides as well as additional CSS styles.
55
+ */
56
+ sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
57
+ });
58
+ const q = "_dialog_jouds_1", J = "_dialogText_jouds_1", N = {
59
+ dialog: q,
60
+ dialogText: J
61
+ }, eo = (m) => {
62
+ const {
63
+ onCloseDialogHandler: s,
64
+ photoSource: n,
65
+ photoCrop: l,
66
+ onCropChange: c = () => {
67
+ },
68
+ onPhotoLoad: p,
69
+ imageRef: x,
70
+ photoError: a,
71
+ onPhotoCrop: h,
72
+ minDimension: i = L,
73
+ aspectRatio: r = R,
74
+ locale: t = A,
75
+ circular: g,
76
+ keepSelection: f = !0,
77
+ className: _,
78
+ ...E
79
+ } = m;
80
+ return /* @__PURE__ */ u(
81
+ v,
82
+ {
83
+ className: C(N.dialog, _),
84
+ onClose: s,
85
+ ...E,
86
+ children: [
87
+ /* @__PURE__ */ e(F, { children: d[t]["photo-crop"] }),
88
+ /* @__PURE__ */ u(U, { children: [
89
+ n && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
90
+ y,
91
+ {
92
+ crop: l,
93
+ circularCrop: g,
94
+ keepSelection: f,
95
+ aspect: r,
96
+ minWidth: i,
97
+ minHeight: i,
98
+ onChange: c,
99
+ children: /* @__PURE__ */ e(
100
+ "img",
101
+ {
102
+ onLoad: p,
103
+ src: n,
104
+ ref: x,
105
+ alt: d[t]["photo-crop"],
106
+ draggable: !1
107
+ }
108
+ )
109
+ }
110
+ ) }),
111
+ a && /* @__PURE__ */ e(H, { className: C(N.dialogText), children: a })
112
+ ] }),
113
+ /* @__PURE__ */ u(w, { children: [
114
+ /* @__PURE__ */ e(T, { onClick: s, children: d[t].back }),
115
+ /* @__PURE__ */ e(T, { onClick: h, children: d[t].crop })
116
+ ] })
117
+ ]
118
+ }
119
+ );
120
+ };
121
+ export {
122
+ eo as UploadDialog
123
+ };
@@ -0,0 +1,41 @@
1
+ export declare const DEFAULT_ASPECT_RATIO = 1;
2
+ export declare const DEFAULT_MIN_DIMENSION = 150;
3
+ export declare const JPG_IMAGE_EXT = ".jpg";
4
+ export declare const JPEG_IMAGE_EXT = ".jpeg";
5
+ export declare const PNG_IMAGE_EXT = ".png";
6
+ export declare const SVG_IMAGE_EXT = ".svg";
7
+ export declare const BMP_IMAGE_EXT = ".bmp";
8
+ export declare const GIF_IMAGE_EXT = ".gif";
9
+ export declare const ICO_IMAGE_EXT = ".ico";
10
+ export declare const WEBP_IMAGE_EXT = ".webp";
11
+ export declare const SUPPORTED_IMAGE_EXTENSIONS: string[];
12
+ export declare const JPG_IMAGE_TYPE = "image/jpg";
13
+ export declare const JPEG_IMAGE_TYPE = "image/jpeg";
14
+ export declare const PNG_IMAGE_TYPE = "image/png";
15
+ export declare const SVG_IMAGE_TYPE = "image/svg+xml";
16
+ export declare const BMP_IMAGE_TYPE = "image/bmp";
17
+ export declare const GIF_IMAGE_TYPE = "image/gif";
18
+ export declare const WEBP_IMAGE_TYPE = "image/webp";
19
+ export declare const ICO_IMAGE_TYPE = "image/x-icon";
20
+ export declare const MICROSOFT_ICO_IMAGE_TYPE = "image/vnd.microsoft.icon";
21
+ export declare const SUPPORTED_IMAGE_MIME_TYPES: string[];
22
+ export declare const MIME_TO_EXT: {
23
+ JPEG_IMAGE_TYPE: string[];
24
+ JPG_IMAGE_TYPE: string[];
25
+ PNG_IMAGE_TYPE: string[];
26
+ GIF_IMAGE_TYPE: string[];
27
+ SVG_IMAGE_TYPE: string[];
28
+ BMP_IMAGE_TYPE: string[];
29
+ WEBP_IMAGE_TYPE: string[];
30
+ ICO_IMAGE_TYPE: string[];
31
+ MICROSOFT_ICO_IMAGE_TYPE: string[];
32
+ };
33
+ export declare const DEFAULT_TIMEOUT = 500;
34
+ export declare const DEFAULT_FILE_MAX_SIZE: number;
35
+ export declare const PHOTO_CANVAS_CONTEXT = "2d";
36
+ export declare const PHOTO_SMOOTHING_QUALITY = "high";
37
+ export declare const PRECENT_UNIT = "%";
38
+ export declare const PIXEL_UNIT = "px";
39
+ export declare const MS_UNIT = "ms";
40
+ export declare const MB_UNIT = "mb";
41
+ export declare const MB_FRACTION_DIGITS = 1;
@@ -0,0 +1,64 @@
1
+ import { BYTE_TO_KILOBYTE as T } from "../../constants.js";
2
+ const S = 1, e = 150, E = ".jpg", _ = ".jpeg", G = ".png", M = ".svg", P = ".bmp", o = ".gif", I = ".ico", A = ".webp", p = [
3
+ E,
4
+ _,
5
+ G,
6
+ M,
7
+ P,
8
+ o,
9
+ A,
10
+ I
11
+ ], n = "image/jpg", c = "image/jpeg", s = "image/png", t = "image/svg+xml", O = "image/bmp", Y = "image/gif", g = "image/webp", i = "image/x-icon", m = "image/vnd.microsoft.icon", X = [
12
+ n,
13
+ c,
14
+ s,
15
+ t,
16
+ O,
17
+ Y,
18
+ g,
19
+ i,
20
+ m
21
+ ], C = {
22
+ JPEG_IMAGE_TYPE: [E, _],
23
+ JPG_IMAGE_TYPE: [E, _],
24
+ PNG_IMAGE_TYPE: [G],
25
+ GIF_IMAGE_TYPE: [o],
26
+ SVG_IMAGE_TYPE: [M],
27
+ BMP_IMAGE_TYPE: [P],
28
+ WEBP_IMAGE_TYPE: [A],
29
+ ICO_IMAGE_TYPE: [I],
30
+ MICROSOFT_ICO_IMAGE_TYPE: [I]
31
+ }, U = 500, F = 5 * T * T, B = "2d", a = "high", D = "%", L = "px", R = "ms", J = "mb", b = 1;
32
+ export {
33
+ P as BMP_IMAGE_EXT,
34
+ O as BMP_IMAGE_TYPE,
35
+ S as DEFAULT_ASPECT_RATIO,
36
+ F as DEFAULT_FILE_MAX_SIZE,
37
+ e as DEFAULT_MIN_DIMENSION,
38
+ U as DEFAULT_TIMEOUT,
39
+ o as GIF_IMAGE_EXT,
40
+ Y as GIF_IMAGE_TYPE,
41
+ I as ICO_IMAGE_EXT,
42
+ i as ICO_IMAGE_TYPE,
43
+ _ as JPEG_IMAGE_EXT,
44
+ c as JPEG_IMAGE_TYPE,
45
+ E as JPG_IMAGE_EXT,
46
+ n as JPG_IMAGE_TYPE,
47
+ b as MB_FRACTION_DIGITS,
48
+ J as MB_UNIT,
49
+ m as MICROSOFT_ICO_IMAGE_TYPE,
50
+ C as MIME_TO_EXT,
51
+ R as MS_UNIT,
52
+ B as PHOTO_CANVAS_CONTEXT,
53
+ a as PHOTO_SMOOTHING_QUALITY,
54
+ L as PIXEL_UNIT,
55
+ G as PNG_IMAGE_EXT,
56
+ s as PNG_IMAGE_TYPE,
57
+ D as PRECENT_UNIT,
58
+ p as SUPPORTED_IMAGE_EXTENSIONS,
59
+ X as SUPPORTED_IMAGE_MIME_TYPES,
60
+ M as SVG_IMAGE_EXT,
61
+ t as SVG_IMAGE_TYPE,
62
+ A as WEBP_IMAGE_EXT,
63
+ g as WEBP_IMAGE_TYPE
64
+ };
@@ -0,0 +1,2 @@
1
+ export { PhotoSizeError } from './photo-size.error';
2
+ export { PhotoFileError } from './photo-file.error';
@@ -0,0 +1,6 @@
1
+ import { PhotoSizeError as e } from "./photo-size.error.js";
2
+ import { PhotoFileError as f } from "./photo-file.error.js";
3
+ export {
4
+ f as PhotoFileError,
5
+ e as PhotoSizeError
6
+ };
@@ -0,0 +1,7 @@
1
+ import { PhotoFileOptions } from '../types';
2
+ export declare class PhotoFileError extends Error {
3
+ errors: string[];
4
+ options?: PhotoFileOptions;
5
+ constructor(message: string, errors?: string[], options?: PhotoFileOptions);
6
+ static get(errors?: string[], options?: PhotoFileOptions): PhotoFileError;
7
+ }
@@ -0,0 +1,15 @@
1
+ const o = "PhotoFileError";
2
+ class e extends Error {
3
+ errors = [];
4
+ options;
5
+ constructor(s, t = [], r) {
6
+ super(s), this.name = o, this.errors = t, this.options = r;
7
+ }
8
+ static get(s = [], t) {
9
+ const r = s[0] || o;
10
+ return new e(r, s, t);
11
+ }
12
+ }
13
+ export {
14
+ e as PhotoFileError
15
+ };
@@ -0,0 +1,10 @@
1
+ import { Locale } from '../../../types';
2
+ declare const UNKNOWN_MIN_DIMENSION = "unknown";
3
+ type MinDimension = number | typeof UNKNOWN_MIN_DIMENSION;
4
+ export declare class PhotoSizeError extends Error {
5
+ minDimension: MinDimension;
6
+ constructor(message: string, minDimension: MinDimension);
7
+ static get(minDimension?: MinDimension, locale?: Locale): PhotoSizeError;
8
+ private static getMessage;
9
+ }
10
+ export {};
@@ -0,0 +1,19 @@
1
+ import { localizedText as s } from "../locale.js";
2
+ import { EN_LOCALE as r } from "../../../constants.js";
3
+ const c = "PhotoSizeError", E = "X", o = "unknown";
4
+ class n extends Error {
5
+ minDimension;
6
+ constructor(t, e) {
7
+ super(t), this.name = c, this.minDimension = e;
8
+ }
9
+ static get(t = o, e = r) {
10
+ const i = this.getMessage(t, e);
11
+ return new n(i, t);
12
+ }
13
+ static getMessage(t = o, e = r) {
14
+ return `${s[e]["photo-size-error"]} ${t} ${E} ${t} ${s[e].pixels}`;
15
+ }
16
+ }
17
+ export {
18
+ n as PhotoSizeError
19
+ };
@@ -0,0 +1 @@
1
+ export { PhotoCropUploader } from './photo-crop-uploader';
@@ -0,0 +1,4 @@
1
+ import { PhotoCropUploader as p } from "./photo-crop-uploader.js";
2
+ export {
3
+ p as PhotoCropUploader
4
+ };
@@ -0,0 +1,2 @@
1
+ import { PhotoCropUploaderLocaleText } from './types';
2
+ export declare const localizedText: PhotoCropUploaderLocaleText;
@@ -0,0 +1,47 @@
1
+ const e = {
2
+ en: {
3
+ upload: "Upload a photo",
4
+ drop: "Drop the file here",
5
+ "photo-crop": "Cropping a photo",
6
+ crop: "Crop",
7
+ back: "Back",
8
+ "photo-size-error": "The photo size must be at least",
9
+ pixels: "pixels",
10
+ "canvas-error": "Canvas context not found",
11
+ error: "Error",
12
+ "large-file": "The file is too large",
13
+ "maximum-size": "Maximum size",
14
+ "file-ext-error": "Unsupported file extension",
15
+ "file-type-error": "Unsupported file type",
16
+ "mime-type": "MIME Type",
17
+ "not-correspond-ext": "does not correspond to the expansion",
18
+ "timeout-error": "Photo loading timed out",
19
+ "paint-error": "Failed to render photo",
20
+ "read-abort": "Reading of photo was interrupted",
21
+ "paint-abort": "Rendering of photo was interrupted"
22
+ },
23
+ ru: {
24
+ upload: "Загрузить фото",
25
+ drop: "Отпустите файл здесь",
26
+ "photo-crop": "Обрезка фотографии",
27
+ crop: "Обрезать",
28
+ back: "Назад",
29
+ "photo-size-error": "Размер фотографии должен быть не меньше",
30
+ pixels: "пикселей",
31
+ "canvas-error": "Контекст канваса не найден",
32
+ error: "Ошибка",
33
+ "large-file": "Файл слишком большой",
34
+ "maximum-size": "Максимальный размер",
35
+ "file-ext-error": "Неподдерживаемое расширение файла",
36
+ "file-type-error": "Неподдерживаемый тип файла",
37
+ "mime-type": "MIME тип",
38
+ "not-correspond-ext": "не соответствует расширению",
39
+ "timeout-error": "Превышено время загрузки фотографии",
40
+ "paint-error": "Не удалось отрисовать фотографию",
41
+ "read-abort": "Чтение фотографии было прервано",
42
+ "paint-abort": "Отрисовка фотографии была прервана"
43
+ }
44
+ };
45
+ export {
46
+ e as localizedText
47
+ };