@hai-dev/ui-kit 1.2.1 → 1.2.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.
Files changed (56) hide show
  1. package/dist/assets/button.css +1 -1
  2. package/dist/assets/circular-progress-loader.css +1 -1
  3. package/dist/assets/code-input.css +1 -1
  4. package/dist/assets/error-upload-dialog.css +1 -1
  5. package/dist/assets/upload-dialog-errors.css +1 -1
  6. package/dist/button.module-BnTmlu-U.js +40 -0
  7. package/dist/components/button/button-content.js +8 -8
  8. package/dist/components/button/button.js +21 -22
  9. package/dist/components/button/utils/get-button-classnames.js +10 -10
  10. package/dist/components/circular-progress-loader/circular-progress-loader.js +25 -28
  11. package/dist/components/code-input/code-input.js +129 -912
  12. package/dist/components/code-input/constants.d.ts +1 -0
  13. package/dist/components/code-input/constants.js +9 -8
  14. package/dist/components/code-input/types.d.ts +1 -0
  15. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +46 -94
  16. package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +38 -120
  17. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +16 -16
  18. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -4
  19. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +113 -404
  20. package/dist/components/photo-crop-uploader/constants.d.ts +2 -2
  21. package/dist/components/photo-crop-uploader/constants.js +1 -1
  22. package/dist/components/photo-crop-uploader/errors/photo-size.error.d.ts +1 -1
  23. package/dist/components/photo-crop-uploader/errors/photo-size.error.js +17 -12
  24. package/dist/components/photo-crop-uploader/locale.js +2 -2
  25. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +45 -38
  26. package/dist/components/photo-crop-uploader/utils/draw-cropped-image.js +8 -8
  27. package/dist/components/photo-crop-uploader/utils/get-cropped-source.js +10 -10
  28. package/dist/components/photo-crop-uploader/utils/get-default-cropped-photo.js +10 -10
  29. package/dist/components/photo-crop-uploader/utils/get-photo-crop.js +18 -18
  30. package/dist/components/photo-crop-uploader/utils/read-photo.d.ts +1 -1
  31. package/dist/components/photo-crop-uploader/utils/read-photo.js +39 -39
  32. package/dist/raw-cross-BhC4FBfp.js +4 -0
  33. package/dist/upload-dialog-errors-BIwMA_MN.js +89 -0
  34. package/package.json +1 -1
  35. package/dist/Box-BgNAyP2L.js +0 -56
  36. package/dist/Button-DTV8ztWw.js +0 -660
  37. package/dist/ButtonBase-C4krg_zd.js +0 -913
  38. package/dist/CircularProgress-BoaEg4rF.js +0 -274
  39. package/dist/Dialog-BK9lMUKV.js +0 -2632
  40. package/dist/DialogTitle-ByUfLB5M.js +0 -254
  41. package/dist/Typography-BMyz0ZCh.js +0 -255
  42. package/dist/assets/inter.css +0 -1
  43. package/dist/button.module-C0UNQnBk.js +0 -40
  44. package/dist/chainPropTypes-DgqFdXGi.js +0 -532
  45. package/dist/createSimplePaletteValueFilter-B7--0ryQ.js +0 -17
  46. package/dist/createTheme-BoOmbNvy.js +0 -4119
  47. package/dist/extendSxProp-BaUCVMKV.js +0 -50
  48. package/dist/index-CcueJ2sD.js +0 -432
  49. package/dist/index-YnD2EP-S.js +0 -43
  50. package/dist/index-h5oTv8GF.js +0 -91
  51. package/dist/isHostComponent-Dm_U9uOy.js +0 -14
  52. package/dist/memoTheme-BYBJ2Fe6.js +0 -15
  53. package/dist/refType-CsohaiiT.js +0 -60
  54. package/dist/upload-dialog-errors-BwQsTOc3.js +0 -367
  55. package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
  56. package/dist/useId-CK6Kn3Tn.js +0 -21
@@ -1,460 +1,169 @@
1
- import { jsxs as S, jsx as r, Fragment as Z } from "react/jsx-runtime";
2
- import * as O from "react";
3
- import { useState as q, useCallback as G } from "react";
4
- import { useScaledMinDimension as J } from "./use-scaled-min-dimension.js";
5
- import { S as Q } from "../../../../index-CcueJ2sD.js";
6
- import { c as i } from "../../../../index-YnD2EP-S.js";
7
- import { s as n, U as X } from "../../../../upload-dialog-errors-BwQsTOc3.js";
8
- import { PhotoList as oo } from "../photo-list/photo-list.js";
9
- import { localizedText as g } from "../../locale.js";
10
- import { EN_LOCALE as eo, DARK_THEME as to } from "../../../../constants.js";
11
- import { DEFAULT_MIN_DIMENSION as ao, DEFAULT_ASPECT_RATIO as ro } from "../../constants.js";
12
- import '../../../../assets/inter.css';import '../../../../assets/upload-dialog.css';/* empty css */
13
- import { D as k } from "../../../../Dialog-BK9lMUKV.js";
14
- import { a as A, b as D, D as no } from "../../../../DialogTitle-ByUfLB5M.js";
15
- import { CircularProgressLoader as io } from "../../../circular-progress-loader/circular-progress-loader.js";
16
- import { g as so, a as lo, c as co, b as f, P as t } from "../../../../createTheme-BoOmbNvy.js";
17
- import { m as M } from "../../../../memoTheme-BYBJ2Fe6.js";
18
- import { c as U } from "../../../../createSimplePaletteValueFilter-B7--0ryQ.js";
19
- import { u as po, c as go, s as j, b as uo } from "../../../../chainPropTypes-DgqFdXGi.js";
20
- import { u as mo } from "../../../../useId-CK6Kn3Tn.js";
21
- import { B as fo } from "../../../../ButtonBase-C4krg_zd.js";
22
- import { C as bo } from "../../../../CircularProgress-BoaEg4rF.js";
23
- import { Button as P } from "../../../button/button.js";
24
- function ho(o) {
25
- return so("MuiIconButton", o);
26
- }
27
- const W = lo("MuiIconButton", ["root", "disabled", "colorInherit", "colorPrimary", "colorSecondary", "colorError", "colorInfo", "colorSuccess", "colorWarning", "edgeStart", "edgeEnd", "sizeSmall", "sizeMedium", "sizeLarge", "loading", "loadingIndicator", "loadingWrapper"]), Co = (o) => {
1
+ import { jsx as t, jsxs as u, Fragment as H } from "react/jsx-runtime";
2
+ import { useState as O, useCallback as j } from "react";
3
+ import { useScaledMinDimension as v } from "./use-scaled-min-dimension.js";
4
+ import { Dialog as g, DialogContent as D, DialogActions as C, IconButton as K, DialogTitle as q } from "@mui/material";
5
+ import w from "react-image-crop";
6
+ import e from "classnames";
7
+ import { s as o, U as G } from "../../../../upload-dialog-errors-BIwMA_MN.js";
8
+ import { PhotoList as J } from "../photo-list/photo-list.js";
9
+ import { localizedText as l } from "../../locale.js";
10
+ import { EN_LOCALE as Q, DARK_THEME as X } from "../../../../constants.js";
11
+ import { DEFAULT_MIN_DIMENSION as Y, DEFAULT_ASPECT_RATIO as Z } from "../../constants.js";
12
+ import { c as $ } from "../../../../raw-cross-BhC4FBfp.js";
13
+ import { CircularProgressLoader as oo } from "../../../circular-progress-loader/circular-progress-loader.js";
14
+ import { Button as b } from "../../../button/button.js";
15
+ import '../../../../assets/upload-dialog.css';const Co = (E) => {
28
16
  const {
29
- classes: e,
30
- disabled: a,
31
- color: l,
32
- edge: u,
33
- size: b,
34
- loading: c
35
- } = o, m = {
36
- root: ["root", c && "loading", a && "disabled", l !== "default" && `color${f(l)}`, u && `edge${f(u)}`, `size${f(b)}`],
37
- loadingIndicator: ["loadingIndicator"],
38
- loadingWrapper: ["loadingWrapper"]
39
- };
40
- return go(m, ho, e);
41
- }, yo = j(fo, {
42
- name: "MuiIconButton",
43
- slot: "Root",
44
- overridesResolver: (o, e) => {
45
- const {
46
- ownerState: a
47
- } = o;
48
- return [e.root, a.loading && e.loading, a.color !== "default" && e[`color${f(a.color)}`], a.edge && e[`edge${f(a.edge)}`], e[`size${f(a.size)}`]];
49
- }
50
- })(M(({
51
- theme: o
52
- }) => ({
53
- textAlign: "center",
54
- flex: "0 0 auto",
55
- fontSize: o.typography.pxToRem(24),
56
- padding: 8,
57
- borderRadius: "50%",
58
- color: (o.vars || o).palette.action.active,
59
- transition: o.transitions.create("background-color", {
60
- duration: o.transitions.duration.shortest
61
- }),
62
- variants: [{
63
- props: (e) => !e.disableRipple,
64
- style: {
65
- "--IconButton-hoverBg": o.alpha((o.vars || o).palette.action.active, (o.vars || o).palette.action.hoverOpacity),
66
- "&:hover": {
67
- backgroundColor: "var(--IconButton-hoverBg)",
68
- // Reset on touch devices, it doesn't add specificity
69
- "@media (hover: none)": {
70
- backgroundColor: "transparent"
71
- }
72
- }
73
- }
74
- }, {
75
- props: {
76
- edge: "start"
77
- },
78
- style: {
79
- marginLeft: -12
80
- }
81
- }, {
82
- props: {
83
- edge: "start",
84
- size: "small"
85
- },
86
- style: {
87
- marginLeft: -3
88
- }
89
- }, {
90
- props: {
91
- edge: "end"
92
- },
93
- style: {
94
- marginRight: -12
95
- }
96
- }, {
97
- props: {
98
- edge: "end",
99
- size: "small"
100
- },
101
- style: {
102
- marginRight: -3
103
- }
104
- }]
105
- })), M(({
106
- theme: o
107
- }) => ({
108
- variants: [{
109
- props: {
110
- color: "inherit"
111
- },
112
- style: {
113
- color: "inherit"
114
- }
115
- }, ...Object.entries(o.palette).filter(U()).map(([e]) => ({
116
- props: {
117
- color: e
118
- },
119
- style: {
120
- color: (o.vars || o).palette[e].main
121
- }
122
- })), ...Object.entries(o.palette).filter(U()).map(([e]) => ({
123
- props: {
124
- color: e
125
- },
126
- style: {
127
- "--IconButton-hoverBg": o.alpha((o.vars || o).palette[e].main, (o.vars || o).palette.action.hoverOpacity)
128
- }
129
- })), {
130
- props: {
131
- size: "small"
132
- },
133
- style: {
134
- padding: 5,
135
- fontSize: o.typography.pxToRem(18)
136
- }
137
- }, {
138
- props: {
139
- size: "large"
140
- },
141
- style: {
142
- padding: 12,
143
- fontSize: o.typography.pxToRem(28)
144
- }
145
- }],
146
- [`&.${W.disabled}`]: {
147
- backgroundColor: "transparent",
148
- color: (o.vars || o).palette.action.disabled
149
- },
150
- [`&.${W.loading}`]: {
151
- color: "transparent"
152
- }
153
- }))), vo = j("span", {
154
- name: "MuiIconButton",
155
- slot: "LoadingIndicator"
156
- })(({
157
- theme: o
158
- }) => ({
159
- display: "none",
160
- position: "absolute",
161
- visibility: "visible",
162
- top: "50%",
163
- left: "50%",
164
- transform: "translate(-50%, -50%)",
165
- color: (o.vars || o).palette.action.disabled,
166
- variants: [{
167
- props: {
168
- loading: !0
169
- },
170
- style: {
171
- display: "flex"
172
- }
173
- }]
174
- })), F = /* @__PURE__ */ O.forwardRef(function(e, a) {
175
- const l = po({
176
- props: e,
177
- name: "MuiIconButton"
178
- }), {
179
- edge: u = !1,
180
- children: b,
181
- className: c,
182
- color: m = "default",
183
- disabled: y = !1,
184
- disableFocusRipple: v = !1,
185
- size: z = "medium",
186
- id: I,
187
- loading: d = null,
188
- loadingIndicator: L,
189
- ...s
190
- } = l, N = mo(I), B = L ?? /* @__PURE__ */ r(bo, {
191
- "aria-labelledby": N,
192
- color: "inherit",
193
- size: 16
194
- }), h = {
195
- ...l,
196
- edge: u,
197
- color: m,
198
- disabled: y,
199
- disableFocusRipple: v,
200
- loading: d,
201
- loadingIndicator: B,
202
- size: z
203
- }, p = Co(h);
204
- return /* @__PURE__ */ S(yo, {
205
- id: d ? N : I,
206
- className: co(p.root, c),
207
- centerRipple: !0,
208
- focusRipple: !v,
209
- disabled: y || d,
210
- ref: a,
211
- ...s,
212
- ownerState: h,
213
- children: [typeof d == "boolean" && // use plain HTML span to minimize the runtime overhead
214
- /* @__PURE__ */ r("span", {
215
- className: p.loadingWrapper,
216
- style: {
217
- display: "contents"
218
- },
219
- children: /* @__PURE__ */ r(vo, {
220
- className: p.loadingIndicator,
221
- ownerState: h,
222
- children: d && B
223
- })
224
- }), b]
225
- });
226
- });
227
- process.env.NODE_ENV !== "production" && (F.propTypes = {
228
- // ┌────────────────────────────── Warning ──────────────────────────────┐
229
- // │ These PropTypes are generated from the TypeScript type definitions. │
230
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
231
- // └─────────────────────────────────────────────────────────────────────┘
232
- /**
233
- * The icon to display.
234
- */
235
- children: uo(t.node, (o) => O.Children.toArray(o.children).some((a) => /* @__PURE__ */ O.isValidElement(a) && a.props.onClick) ? new Error(["MUI: You are providing an onClick event listener to a child of a button element.", "Prefer applying it to the IconButton directly.", "This guarantees that the whole <button> will be responsive to click events."].join(`
236
- `)) : null),
237
- /**
238
- * Override or extend the styles applied to the component.
239
- */
240
- classes: t.object,
241
- /**
242
- * @ignore
243
- */
244
- className: t.string,
245
- /**
246
- * The color of the component.
247
- * It supports both default and custom theme colors, which can be added as shown in the
248
- * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
249
- * @default 'default'
250
- */
251
- color: t.oneOfType([t.oneOf(["inherit", "default", "primary", "secondary", "error", "info", "success", "warning"]), t.string]),
252
- /**
253
- * If `true`, the component is disabled.
254
- * @default false
255
- */
256
- disabled: t.bool,
257
- /**
258
- * If `true`, the keyboard focus ripple is disabled.
259
- * @default false
260
- */
261
- disableFocusRipple: t.bool,
262
- /**
263
- * If `true`, the ripple effect is disabled.
264
- *
265
- * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
266
- * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
267
- * @default false
268
- */
269
- disableRipple: t.bool,
270
- /**
271
- * If given, uses a negative margin to counteract the padding on one
272
- * side (this is often helpful for aligning the left or right
273
- * side of the icon with content above or below, without ruining the border
274
- * size and shape).
275
- * @default false
276
- */
277
- edge: t.oneOf(["end", "start", !1]),
278
- /**
279
- * @ignore
280
- */
281
- id: t.string,
282
- /**
283
- * If `true`, the loading indicator is visible and the button is disabled.
284
- * If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
285
- * @default null
286
- */
287
- loading: t.bool,
288
- /**
289
- * Element placed before the children if the button is in loading state.
290
- * The node should contain an element with `role="progressbar"` with an accessible name.
291
- * By default, it renders a `CircularProgress` that is labeled by the button itself.
292
- * @default <CircularProgress color="inherit" size={16} />
293
- */
294
- loadingIndicator: t.node,
295
- /**
296
- * The size of the component.
297
- * `small` is equivalent to the dense button styling.
298
- * @default 'medium'
299
- */
300
- size: t.oneOfType([t.oneOf(["small", "medium", "large"]), t.string]),
301
- /**
302
- * The system prop that allows defining system overrides as well as additional CSS styles.
303
- */
304
- sx: t.oneOfType([t.arrayOf(t.oneOfType([t.func, t.object, t.bool])), t.func, t.object])
305
- });
306
- const Io = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.27623%200.391122C1.75553%20-0.129577%200.911316%20-0.129578%200.390616%200.391122C-0.130083%200.911821%20-0.130083%201.75604%200.390616%202.27674L6.04747%207.93359L0.390616%2013.5904C-0.130083%2014.1111%20-0.130083%2014.9554%200.390616%2015.4761C0.911316%2015.9968%201.75553%2015.9968%202.27623%2015.4761L7.93309%209.81921L13.5899%2015.4761C14.1106%2015.9968%2014.9549%2015.9968%2015.4756%2015.4761C15.9963%2014.9554%2015.9963%2014.1111%2015.4756%2013.5904L9.81871%207.93359L15.4756%202.27674C15.9963%201.75604%2015.9963%200.911822%2015.4756%200.391122C14.9549%20-0.129577%2014.1106%20-0.129578%2013.5899%200.391123L7.93309%206.04798L2.27623%200.391122Z'%20fill='%233AA8FF'/%3e%3c/svg%3e", _o = (o) => {
307
- const {
308
- onCloseDialogHandler: e,
17
+ onCloseDialogHandler: n,
309
18
  photoSources: a = [],
310
- photoCrops: l = [],
311
- onCropChange: u = () => {
19
+ photoCrops: k = [],
20
+ onCropChange: S = () => {
312
21
  },
313
- onPhotoLoad: b,
314
- imageRef: c,
315
- photoError: m,
316
- onPhotoCrop: y,
317
- onNextPhoto: v,
318
- onSkipCrop: z,
319
- onClearErrors: I,
320
- minDimension: d = ao,
321
- aspectRatio: L = ro,
322
- locale: s = eo,
323
- circular: N,
324
- keepSelection: B = !0,
325
- photoSourceLoading: h,
326
- className: p,
327
- photoIndex: C,
328
- loadingValue: $,
329
- errors: R,
330
- theme: T = to,
331
- ...x
332
- } = o, E = a.slice(C).length > 1, [V, _] = q(null), H = G(
333
- (w) => {
334
- c && (c.current = w), _(w);
22
+ onPhotoLoad: A,
23
+ imageRef: s,
24
+ photoError: f,
25
+ onPhotoCrop: I,
26
+ onNextPhoto: L,
27
+ onSkipCrop: x,
28
+ onClearErrors: T,
29
+ minDimension: P = Y,
30
+ aspectRatio: R = Z,
31
+ locale: r = Q,
32
+ circular: W,
33
+ keepSelection: _ = !0,
34
+ photoSourceLoading: U,
35
+ className: c,
36
+ photoIndex: i,
37
+ loadingValue: z,
38
+ errors: m,
39
+ theme: p = X,
40
+ ...h
41
+ } = E, d = a.slice(i).length > 1, [M, V] = O(null), y = j(
42
+ (N) => {
43
+ s && (s.current = N), V(N);
335
44
  },
336
- [c]
337
- ), { minWidth: K, minHeight: Y } = J(V, d);
338
- return h || !a.length && !R?.length ? /* @__PURE__ */ r(
339
- k,
45
+ [s]
46
+ ), { minWidth: B, minHeight: F } = v(M, P);
47
+ return U || !a.length && !m?.length ? /* @__PURE__ */ t(
48
+ g,
340
49
  {
341
- className: i(n.dialog, p, n[T]),
342
- onClose: e,
343
- ...x,
344
- children: /* @__PURE__ */ r(A, { className: i(n.content), children: /* @__PURE__ */ r(io, { value: $ }) })
50
+ className: e(o.dialog, c, o[p]),
51
+ onClose: n,
52
+ ...h,
53
+ children: /* @__PURE__ */ t(D, { className: e(o.content), children: /* @__PURE__ */ t(oo, { value: z }) })
345
54
  }
346
- ) : R?.length ? /* @__PURE__ */ r(
347
- k,
55
+ ) : m?.length ? /* @__PURE__ */ t(
56
+ g,
348
57
  {
349
- className: i(n.dialog, p, n[T]),
350
- onClose: e,
351
- ...x,
352
- children: /* @__PURE__ */ r(
353
- X,
58
+ className: e(o.dialog, c, o[p]),
59
+ onClose: n,
60
+ ...h,
61
+ children: /* @__PURE__ */ t(
62
+ G,
354
63
  {
355
- locale: s,
64
+ locale: r,
356
65
  photoSources: a,
357
- errors: R,
358
- onCloseDialogHandler: e,
359
- onClearErrors: I
66
+ errors: m,
67
+ onCloseDialogHandler: n,
68
+ onClearErrors: T
360
69
  }
361
70
  )
362
71
  }
363
- ) : /* @__PURE__ */ S(
364
- k,
72
+ ) : /* @__PURE__ */ u(
73
+ g,
365
74
  {
366
- className: i(n.dialog, p, n[T]),
367
- onClose: e,
368
- ...x,
75
+ className: e(o.dialog, c, o[p]),
76
+ onClose: n,
77
+ ...h,
369
78
  children: [
370
- /* @__PURE__ */ r(D, { className: i(n.topActions), children: /* @__PURE__ */ r(
371
- F,
79
+ /* @__PURE__ */ t(C, { className: e(o.topActions), children: /* @__PURE__ */ t(
80
+ K,
372
81
  {
373
- onClick: e,
374
- className: i(n.close),
375
- "aria-label": g[s].back,
376
- children: /* @__PURE__ */ r(
82
+ onClick: n,
83
+ className: e(o.close),
84
+ "aria-label": l[r].back,
85
+ children: /* @__PURE__ */ t(
377
86
  "img",
378
87
  {
379
88
  draggable: !1,
380
- src: Io,
381
- alt: g[s].back
89
+ src: $,
90
+ alt: l[r].back
382
91
  }
383
92
  )
384
93
  }
385
94
  ) }),
386
- /* @__PURE__ */ r(no, { className: i(n.title), children: g[s]["photo-crop"] }),
387
- /* @__PURE__ */ S(A, { className: i(n.content, E && n.many), children: [
388
- !!a.length && /* @__PURE__ */ r(
389
- Q,
95
+ /* @__PURE__ */ t(q, { className: e(o.title), children: l[r]["photo-crop"] }),
96
+ /* @__PURE__ */ u(D, { className: e(o.content, d && o.many), children: [
97
+ !!a.length && /* @__PURE__ */ t("div", { className: e(o.cropWrapper), children: /* @__PURE__ */ t(
98
+ w,
390
99
  {
391
- className: i(n.crop),
392
- crop: l[C],
393
- circularCrop: N,
394
- keepSelection: B,
395
- aspect: L,
396
- minWidth: K,
397
- minHeight: Y,
398
- onChange: u,
399
- children: /* @__PURE__ */ r(
100
+ className: e(o.crop),
101
+ crop: k[i],
102
+ circularCrop: W,
103
+ keepSelection: _,
104
+ aspect: R,
105
+ minWidth: B,
106
+ minHeight: F,
107
+ onChange: S,
108
+ children: /* @__PURE__ */ t(
400
109
  "img",
401
110
  {
402
- onLoad: b,
403
- src: a[C],
404
- ref: H,
405
- alt: g[s]["photo-crop"],
111
+ onLoad: A,
112
+ src: a[i],
113
+ ref: y,
114
+ alt: l[r]["photo-crop"],
406
115
  draggable: !1
407
116
  },
408
- C
117
+ i
409
118
  )
410
119
  }
411
- ),
412
- E && /* @__PURE__ */ r(
413
- oo,
120
+ ) }),
121
+ d && /* @__PURE__ */ t(
122
+ J,
414
123
  {
415
- locale: s,
124
+ locale: r,
416
125
  photoSources: a,
417
- photoIndex: C
126
+ photoIndex: i
418
127
  }
419
128
  )
420
129
  ] }),
421
- m && /* @__PURE__ */ r(D, { className: i(n.dialogText), children: m }),
422
- /* @__PURE__ */ r(D, { className: i(n.botActions), children: E ? /* @__PURE__ */ S(Z, { children: [
423
- /* @__PURE__ */ r(
424
- P,
130
+ f && /* @__PURE__ */ t(C, { className: e(o.dialogText), children: f }),
131
+ /* @__PURE__ */ t(C, { className: e(o.botActions), children: d ? /* @__PURE__ */ u(H, { children: [
132
+ /* @__PURE__ */ t(
133
+ b,
425
134
  {
426
135
  buttonSize: "small",
427
136
  buttonColor: "red",
428
137
  buttonVariant: "outlined",
429
138
  buttonWeight: 500,
430
- className: i(n.button),
431
- onClick: z,
432
- children: g[s].skip
139
+ className: e(o.button),
140
+ onClick: x,
141
+ children: l[r].skip
433
142
  }
434
143
  ),
435
- /* @__PURE__ */ r(
436
- P,
144
+ /* @__PURE__ */ t(
145
+ b,
437
146
  {
438
147
  buttonSize: "small",
439
148
  buttonColor: "blue",
440
149
  buttonVariant: "outlined",
441
150
  buttonWeight: 500,
442
- className: i(n.button),
443
- onClick: v,
444
- children: g[s].continue
151
+ className: e(o.button),
152
+ onClick: L,
153
+ children: l[r].continue
445
154
  }
446
155
  )
447
- ] }) : /* @__PURE__ */ r(
448
- P,
156
+ ] }) : /* @__PURE__ */ t(
157
+ b,
449
158
  {
450
159
  minWidth: "100%",
451
160
  buttonSize: "small",
452
161
  buttonColor: "blue",
453
162
  buttonVariant: "outlined",
454
163
  buttonWeight: 500,
455
- className: i(n.button),
456
- onClick: y,
457
- children: g[s].crop
164
+ className: e(o.button),
165
+ onClick: I,
166
+ children: l[r].crop
458
167
  }
459
168
  ) })
460
169
  ]
@@ -462,5 +171,5 @@ const Io = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%20
462
171
  );
463
172
  };
464
173
  export {
465
- _o as UploadDialog
174
+ Co as UploadDialog
466
175
  };
@@ -46,8 +46,8 @@ export declare const MS_UNIT = "ms";
46
46
  export declare const MB_UNIT = "mb";
47
47
  export declare const MB_FRACTION_DIGITS = 1;
48
48
  export declare const FULL_CROP_SIZE = 100;
49
- export declare const MAX_ASPECT_RATIO = 2;
50
- export declare const MIN_ASPECT_RATIO = 0.5;
49
+ export declare const MAX_ASPECT_RATIO = 5;
50
+ export declare const MIN_ASPECT_RATIO: number;
51
51
  export declare const FULL_PROGRESS_VALUE = 100;
52
52
  export declare const PHOTO_LOADING_DELAY = 100;
53
53
  export declare const RESET_DATA_DELAY = 500;
@@ -28,7 +28,7 @@ const D = 1, i = 670, L = 90, _ = ".jpg", I = ".jpeg", A = ".png", o = ".svg", M
28
28
  WEBP_IMAGE_TYPE: [n],
29
29
  ICO_IMAGE_TYPE: [T],
30
30
  MICROSOFT_ICO_IMAGE_TYPE: [T]
31
- }, R = 500, V = 10 * E * E, a = 50 * E * E, b = "2d", J = "high", v = "%", W = "px", d = "ms", f = "mb", j = 1, r = 100, w = 2, x = 0.5, H = 100, Z = 100, h = 500;
31
+ }, R = 500, V = 10 * E * E, a = 50 * E * E, b = "2d", J = "high", v = "%", W = "px", d = "ms", f = "mb", j = 1, r = 100, w = 5, x = 1 / 5, H = 100, Z = 100, h = 500;
32
32
  export {
33
33
  M as BMP_IMAGE_EXT,
34
34
  O as BMP_IMAGE_TYPE,
@@ -4,7 +4,7 @@ type MinDimension = number | typeof UNKNOWN_MIN_DIMENSION;
4
4
  export declare class PhotoSizeError extends Error {
5
5
  minDimension: MinDimension;
6
6
  constructor(message: string, minDimension: MinDimension);
7
- static get(minDimension?: MinDimension, locale?: Locale): PhotoSizeError;
7
+ static get(minDimension?: MinDimension, locale?: Locale, aspectRatio?: number): PhotoSizeError;
8
8
  private static getMessage;
9
9
  }
10
10
  export {};
@@ -1,19 +1,24 @@
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 {
1
+ import { localizedText as c } from "../locale.js";
2
+ import { EN_LOCALE as E } from "../../../constants.js";
3
+ import { DEFAULT_ASPECT_RATIO as $ } from "../constants.js";
4
+ const g = "PhotoSizeError", h = "X", f = "unknown";
5
+ class u extends Error {
5
6
  minDimension;
6
- constructor(t, e) {
7
- super(t), this.name = c, this.minDimension = e;
7
+ constructor(t, r) {
8
+ super(t), this.name = g, this.minDimension = r;
8
9
  }
9
- static get(t = o, e = r) {
10
- const i = this.getMessage(t, e);
11
- return new n(i, t);
10
+ static get(t = f, r = E, e = $) {
11
+ const s = this.getMessage(t, r, e);
12
+ return new u(s, t);
12
13
  }
13
- static getMessage(t = o, e = r) {
14
- return `${s[e]["photo-size-error"]} ${t} ${E} ${t} ${s[e].pixels}`;
14
+ static getMessage(t = f, r = E, e = $) {
15
+ const s = c[r]["photo-size-error"], o = c[r].pixels;
16
+ if (typeof t != "number")
17
+ return `${s} ${t} ${h} ${t} ${o}`;
18
+ const N = e >= 1 ? Math.ceil(t * e) : t, _ = e >= 1 ? t : Math.ceil(t / e);
19
+ return `${s} ${N} ${h} ${_} ${o}`;
15
20
  }
16
21
  }
17
22
  export {
18
- n as PhotoSizeError
23
+ u as PhotoSizeError
19
24
  };
@@ -22,7 +22,7 @@ const e = {
22
22
  "paint-abort": "Rendering of photo was interrupted",
23
23
  continue: "Continue",
24
24
  skip: "Skip area selection",
25
- aspect: "The aspect ratio of the cropped image must not be greater than 2",
25
+ aspect: "The aspect ratio of the cropped image must not be greater than 5",
26
26
  close: "Close",
27
27
  "not-uploaded": "Files were not uploaded",
28
28
  "some-not-uploaded": "Some files were not uploaded",
@@ -52,7 +52,7 @@ const e = {
52
52
  "paint-abort": "Отрисовка фотографии была прервана",
53
53
  continue: "Продолжить",
54
54
  skip: "Пропустить выбор области",
55
- aspect: "Соотношение сторон обрезаемого изображения не должно быть больше 2",
55
+ aspect: "Соотношение сторон обрезаемого изображения не должно быть больше 5",
56
56
  close: "Закрыть",
57
57
  "not-uploaded": "Файлы не были загружены",
58
58
  "some-not-uploaded": "Некоторые файлы не были загружены",