@hai-dev/ui-kit 1.2.0 → 1.2.2
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/assets/button.css +1 -1
- package/dist/assets/circular-progress-loader.css +1 -1
- package/dist/assets/code-input.css +1 -1
- package/dist/assets/error-upload-dialog.css +1 -1
- package/dist/assets/upload-dialog-errors.css +1 -1
- package/dist/button.module-BnTmlu-U.js +40 -0
- package/dist/components/button/button-content.js +8 -8
- package/dist/components/button/button.js +21 -22
- package/dist/components/button/utils/get-button-classnames.js +10 -10
- package/dist/components/circular-progress-loader/circular-progress-loader.js +25 -28
- package/dist/components/code-input/code-input.js +114 -915
- package/dist/components/code-input/types.d.ts +1 -0
- package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +26 -94
- package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +38 -120
- package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +16 -16
- package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -5
- package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +111 -403
- package/dist/components/photo-crop-uploader/photo-crop-uploader.js +12 -12
- package/dist/components/photo-crop-uploader/utils/draw-cropped-image.js +8 -8
- package/dist/components/photo-crop-uploader/utils/get-cropped-source.js +10 -10
- package/dist/components/photo-crop-uploader/utils/get-default-cropped-photo.js +10 -10
- package/dist/components/photo-crop-uploader/utils/get-photo-crop.js +18 -18
- package/dist/upload-dialog-errors-B7V0G-Ey.js +71 -0
- package/package.json +1 -1
- package/dist/Box-BgNAyP2L.js +0 -56
- package/dist/Button-DTV8ztWw.js +0 -660
- package/dist/ButtonBase-C4krg_zd.js +0 -913
- package/dist/CircularProgress-BoaEg4rF.js +0 -274
- package/dist/Dialog-BK9lMUKV.js +0 -2632
- package/dist/DialogTitle-ByUfLB5M.js +0 -254
- package/dist/Typography-BMyz0ZCh.js +0 -255
- package/dist/assets/inter.css +0 -1
- package/dist/button.module-C0UNQnBk.js +0 -40
- package/dist/chainPropTypes-DgqFdXGi.js +0 -532
- package/dist/createSimplePaletteValueFilter-B7--0ryQ.js +0 -17
- package/dist/createTheme-BoOmbNvy.js +0 -4119
- package/dist/extendSxProp-BaUCVMKV.js +0 -50
- package/dist/index-CcueJ2sD.js +0 -432
- package/dist/index-YnD2EP-S.js +0 -43
- package/dist/index-h5oTv8GF.js +0 -91
- package/dist/isHostComponent-Dm_U9uOy.js +0 -14
- package/dist/memoTheme-BYBJ2Fe6.js +0 -15
- package/dist/refType-CsohaiiT.js +0 -60
- package/dist/upload-dialog-errors-CCRxzIZp.js +0 -367
- package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
- package/dist/useId-CK6Kn3Tn.js +0 -21
|
@@ -1,460 +1,168 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { s as
|
|
8
|
-
import { PhotoList as
|
|
9
|
-
import { localizedText as
|
|
10
|
-
import { EN_LOCALE as
|
|
11
|
-
import { DEFAULT_MIN_DIMENSION as
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
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 d, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useCallback as H } from "react";
|
|
3
|
+
import { useScaledMinDimension as O } from "./use-scaled-min-dimension.js";
|
|
4
|
+
import { Dialog as u, DialogContent as L, DialogActions as C, IconButton as j, DialogTitle as K } from "@mui/material";
|
|
5
|
+
import Z from "react-image-crop";
|
|
6
|
+
import e from "classnames";
|
|
7
|
+
import { s as o, U as q } from "../../../../upload-dialog-errors-B7V0G-Ey.js";
|
|
8
|
+
import { PhotoList as G } from "../photo-list/photo-list.js";
|
|
9
|
+
import { localizedText as n } from "../../locale.js";
|
|
10
|
+
import { EN_LOCALE as J, DARK_THEME as Q } from "../../../../constants.js";
|
|
11
|
+
import { DEFAULT_MIN_DIMENSION as X, DEFAULT_ASPECT_RATIO as Y } from "../../constants.js";
|
|
12
|
+
import { CircularProgressLoader as $ } from "../../../circular-progress-loader/circular-progress-loader.js";
|
|
13
|
+
import { Button as b } from "../../../button/button.js";
|
|
14
|
+
import '../../../../assets/upload-dialog.css';const oo = "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", uo = (D) => {
|
|
28
15
|
const {
|
|
29
|
-
|
|
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,
|
|
16
|
+
onCloseDialogHandler: r,
|
|
309
17
|
photoSources: a = [],
|
|
310
|
-
photoCrops:
|
|
311
|
-
onCropChange:
|
|
18
|
+
photoCrops: E = [],
|
|
19
|
+
onCropChange: k = () => {
|
|
312
20
|
},
|
|
313
|
-
onPhotoLoad:
|
|
314
|
-
imageRef:
|
|
315
|
-
photoError:
|
|
316
|
-
onPhotoCrop:
|
|
317
|
-
onNextPhoto:
|
|
318
|
-
onSkipCrop:
|
|
319
|
-
onClearErrors:
|
|
320
|
-
minDimension:
|
|
321
|
-
aspectRatio:
|
|
322
|
-
locale:
|
|
323
|
-
circular:
|
|
324
|
-
keepSelection:
|
|
325
|
-
photoSourceLoading:
|
|
326
|
-
className:
|
|
327
|
-
photoIndex:
|
|
328
|
-
loadingValue:
|
|
329
|
-
errors:
|
|
330
|
-
theme:
|
|
331
|
-
...
|
|
332
|
-
} =
|
|
333
|
-
(
|
|
334
|
-
|
|
21
|
+
onPhotoLoad: x,
|
|
22
|
+
imageRef: s,
|
|
23
|
+
photoError: f,
|
|
24
|
+
onPhotoCrop: A,
|
|
25
|
+
onNextPhoto: S,
|
|
26
|
+
onSkipCrop: I,
|
|
27
|
+
onClearErrors: T,
|
|
28
|
+
minDimension: P = X,
|
|
29
|
+
aspectRatio: v = Y,
|
|
30
|
+
locale: l = J,
|
|
31
|
+
circular: w,
|
|
32
|
+
keepSelection: R = !0,
|
|
33
|
+
photoSourceLoading: _,
|
|
34
|
+
className: c,
|
|
35
|
+
photoIndex: i,
|
|
36
|
+
loadingValue: F,
|
|
37
|
+
errors: m,
|
|
38
|
+
theme: h = Q,
|
|
39
|
+
...g
|
|
40
|
+
} = D, p = a.slice(i).length > 1, [M, U] = y(null), W = H(
|
|
41
|
+
(N) => {
|
|
42
|
+
s && (s.current = N), U(N);
|
|
335
43
|
},
|
|
336
|
-
[
|
|
337
|
-
), { minWidth:
|
|
338
|
-
return
|
|
339
|
-
|
|
44
|
+
[s]
|
|
45
|
+
), { minWidth: z, minHeight: B } = O(M, P);
|
|
46
|
+
return _ || !a.length && !m?.length ? /* @__PURE__ */ t(
|
|
47
|
+
u,
|
|
340
48
|
{
|
|
341
|
-
className:
|
|
342
|
-
onClose:
|
|
343
|
-
...
|
|
344
|
-
children: /* @__PURE__ */
|
|
49
|
+
className: e(o.dialog, c, o[h]),
|
|
50
|
+
onClose: r,
|
|
51
|
+
...g,
|
|
52
|
+
children: /* @__PURE__ */ t(L, { className: e(o.content), children: /* @__PURE__ */ t($, { value: F }) })
|
|
345
53
|
}
|
|
346
|
-
) :
|
|
347
|
-
|
|
54
|
+
) : m?.length ? /* @__PURE__ */ t(
|
|
55
|
+
u,
|
|
348
56
|
{
|
|
349
|
-
className:
|
|
350
|
-
onClose:
|
|
351
|
-
...
|
|
352
|
-
children: /* @__PURE__ */
|
|
353
|
-
|
|
57
|
+
className: e(o.dialog, c, o[h]),
|
|
58
|
+
onClose: r,
|
|
59
|
+
...g,
|
|
60
|
+
children: /* @__PURE__ */ t(
|
|
61
|
+
q,
|
|
354
62
|
{
|
|
355
|
-
locale:
|
|
63
|
+
locale: l,
|
|
356
64
|
photoSources: a,
|
|
357
|
-
errors:
|
|
358
|
-
onCloseDialogHandler:
|
|
359
|
-
onClearErrors:
|
|
65
|
+
errors: m,
|
|
66
|
+
onCloseDialogHandler: r,
|
|
67
|
+
onClearErrors: T
|
|
360
68
|
}
|
|
361
69
|
)
|
|
362
70
|
}
|
|
363
|
-
) : /* @__PURE__ */
|
|
364
|
-
|
|
71
|
+
) : /* @__PURE__ */ d(
|
|
72
|
+
u,
|
|
365
73
|
{
|
|
366
|
-
className:
|
|
367
|
-
onClose:
|
|
368
|
-
...
|
|
74
|
+
className: e(o.dialog, c, o[h]),
|
|
75
|
+
onClose: r,
|
|
76
|
+
...g,
|
|
369
77
|
children: [
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
-
|
|
78
|
+
/* @__PURE__ */ t(C, { className: e(o.topActions), children: /* @__PURE__ */ t(
|
|
79
|
+
j,
|
|
372
80
|
{
|
|
373
|
-
onClick:
|
|
374
|
-
className:
|
|
375
|
-
"aria-label":
|
|
376
|
-
children: /* @__PURE__ */
|
|
81
|
+
onClick: r,
|
|
82
|
+
className: e(o.close),
|
|
83
|
+
"aria-label": n[l].back,
|
|
84
|
+
children: /* @__PURE__ */ t(
|
|
377
85
|
"img",
|
|
378
86
|
{
|
|
379
87
|
draggable: !1,
|
|
380
|
-
src:
|
|
381
|
-
alt:
|
|
88
|
+
src: oo,
|
|
89
|
+
alt: n[l].back
|
|
382
90
|
}
|
|
383
91
|
)
|
|
384
92
|
}
|
|
385
93
|
) }),
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
!!a.length && /* @__PURE__ */
|
|
389
|
-
|
|
94
|
+
/* @__PURE__ */ t(K, { className: e(o.title), children: n[l]["photo-crop"] }),
|
|
95
|
+
/* @__PURE__ */ d(L, { className: e(o.content, p && o.many), children: [
|
|
96
|
+
!!a.length && /* @__PURE__ */ t(
|
|
97
|
+
Z,
|
|
390
98
|
{
|
|
391
|
-
className:
|
|
392
|
-
crop:
|
|
393
|
-
circularCrop:
|
|
394
|
-
keepSelection:
|
|
395
|
-
aspect:
|
|
396
|
-
minWidth:
|
|
397
|
-
minHeight:
|
|
398
|
-
onChange:
|
|
399
|
-
children: /* @__PURE__ */
|
|
99
|
+
className: e(o.crop),
|
|
100
|
+
crop: E[i],
|
|
101
|
+
circularCrop: w,
|
|
102
|
+
keepSelection: R,
|
|
103
|
+
aspect: v,
|
|
104
|
+
minWidth: z,
|
|
105
|
+
minHeight: B,
|
|
106
|
+
onChange: k,
|
|
107
|
+
children: /* @__PURE__ */ t(
|
|
400
108
|
"img",
|
|
401
109
|
{
|
|
402
|
-
onLoad:
|
|
403
|
-
src: a[
|
|
404
|
-
ref:
|
|
405
|
-
alt:
|
|
110
|
+
onLoad: x,
|
|
111
|
+
src: a[i],
|
|
112
|
+
ref: W,
|
|
113
|
+
alt: n[l]["photo-crop"],
|
|
406
114
|
draggable: !1
|
|
407
115
|
},
|
|
408
|
-
|
|
116
|
+
i
|
|
409
117
|
)
|
|
410
118
|
}
|
|
411
119
|
),
|
|
412
|
-
|
|
413
|
-
|
|
120
|
+
p && /* @__PURE__ */ t(
|
|
121
|
+
G,
|
|
414
122
|
{
|
|
415
|
-
locale:
|
|
123
|
+
locale: l,
|
|
416
124
|
photoSources: a,
|
|
417
|
-
photoIndex:
|
|
125
|
+
photoIndex: i
|
|
418
126
|
}
|
|
419
127
|
)
|
|
420
128
|
] }),
|
|
421
|
-
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
|
|
129
|
+
f && /* @__PURE__ */ t(C, { className: e(o.dialogText), children: f }),
|
|
130
|
+
/* @__PURE__ */ t(C, { className: e(o.botActions), children: p ? /* @__PURE__ */ d(V, { children: [
|
|
131
|
+
/* @__PURE__ */ t(
|
|
132
|
+
b,
|
|
425
133
|
{
|
|
426
134
|
buttonSize: "small",
|
|
427
135
|
buttonColor: "red",
|
|
428
136
|
buttonVariant: "outlined",
|
|
429
137
|
buttonWeight: 500,
|
|
430
|
-
className:
|
|
431
|
-
onClick:
|
|
432
|
-
children:
|
|
138
|
+
className: e(o.button),
|
|
139
|
+
onClick: I,
|
|
140
|
+
children: n[l].skip
|
|
433
141
|
}
|
|
434
142
|
),
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
|
|
143
|
+
/* @__PURE__ */ t(
|
|
144
|
+
b,
|
|
437
145
|
{
|
|
438
146
|
buttonSize: "small",
|
|
439
147
|
buttonColor: "blue",
|
|
440
148
|
buttonVariant: "outlined",
|
|
441
149
|
buttonWeight: 500,
|
|
442
|
-
className:
|
|
443
|
-
onClick:
|
|
444
|
-
children:
|
|
150
|
+
className: e(o.button),
|
|
151
|
+
onClick: S,
|
|
152
|
+
children: n[l].continue
|
|
445
153
|
}
|
|
446
154
|
)
|
|
447
|
-
] }) : /* @__PURE__ */
|
|
448
|
-
|
|
155
|
+
] }) : /* @__PURE__ */ t(
|
|
156
|
+
b,
|
|
449
157
|
{
|
|
450
158
|
minWidth: "100%",
|
|
451
159
|
buttonSize: "small",
|
|
452
160
|
buttonColor: "blue",
|
|
453
161
|
buttonVariant: "outlined",
|
|
454
162
|
buttonWeight: 500,
|
|
455
|
-
className:
|
|
456
|
-
onClick:
|
|
457
|
-
children:
|
|
163
|
+
className: e(o.button),
|
|
164
|
+
onClick: A,
|
|
165
|
+
children: n[l].crop
|
|
458
166
|
}
|
|
459
167
|
) })
|
|
460
168
|
]
|
|
@@ -462,5 +170,5 @@ const Io = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%20
|
|
|
462
170
|
);
|
|
463
171
|
};
|
|
464
172
|
export {
|
|
465
|
-
|
|
173
|
+
uo as UploadDialog
|
|
466
174
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as Ho, Fragment as Vo, jsx as A } from "react/jsx-runtime";
|
|
2
2
|
import { useState as i, useRef as U } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { convertToPercentCrop as bo, convertToPixelCrop as ko } from "react-image-crop";
|
|
4
|
+
import zo from "classnames";
|
|
5
5
|
import { localizedText as jo } from "./locale.js";
|
|
6
6
|
import { EN_LOCALE as Wo, DARK_THEME as Bo } from "../../constants.js";
|
|
7
7
|
import { DEFAULT_MIN_DIMENSION as Go, DEFAULT_ASPECT_RATIO as Xo, DEFAULT_TIMEOUT as Yo, DEFAULT_FILE_MAX_SIZE as Zo, DEFAULT_VIDEO_FILE_MAX_SIZE as Ko, DEFAULT_BASE_DIMENSION as qo, FULL_PROGRESS_VALUE as oo, PHOTO_LOADING_DELAY as Jo, RESET_DATA_DELAY as d } from "./constants.js";
|
|
@@ -61,7 +61,7 @@ function Te(a) {
|
|
|
61
61
|
onEndCrop: se,
|
|
62
62
|
onClose: ae,
|
|
63
63
|
..._o
|
|
64
|
-
} = Lo, [To, g] = i(!1), [P, D] = i([]), [
|
|
64
|
+
} = Lo, [To, g] = i(!1), [P, D] = i([]), [x, I] = i([]), f = U([]), h = U([]), [p, W] = i(0), B = U(null), G = U(null), [c, O] = i(!1), [Ao, X] = i(0), [Y, Z] = i(""), [Uo, S] = i([]), [wo, K] = i(!1), vo = To || c && E, xo = () => {
|
|
65
65
|
S([]);
|
|
66
66
|
}, F = (e = []) => {
|
|
67
67
|
c || (a.returnCropParams === !0 && a.onClose?.(
|
|
@@ -81,10 +81,10 @@ function Te(a) {
|
|
|
81
81
|
}, d));
|
|
82
82
|
}, q = () => {
|
|
83
83
|
c || (a.returnCropParams === !0 ? F([]) : R([]));
|
|
84
|
-
},
|
|
84
|
+
}, Io = () => {
|
|
85
85
|
K(!1);
|
|
86
86
|
}, L = (e, t = e, o = [], r = !1) => {
|
|
87
|
-
lo(e), Z(""), D(e),
|
|
87
|
+
lo(e), Z(""), D(e), I(Array(e.length)), W(0), g(!0), f.current = t, h.current = o, !e.length && !r && q();
|
|
88
88
|
}, M = (e) => {
|
|
89
89
|
e instanceof Error && (console.warn(e.message), co(e), Z(e.message), K(!0), D([]), g(!1), f.current = [], h.current = []);
|
|
90
90
|
}, Oo = async (e) => {
|
|
@@ -164,20 +164,20 @@ function Te(a) {
|
|
|
164
164
|
!1,
|
|
165
165
|
So
|
|
166
166
|
);
|
|
167
|
-
|
|
167
|
+
I((_) => {
|
|
168
168
|
const u = [..._];
|
|
169
169
|
return u[p] = r, u;
|
|
170
170
|
});
|
|
171
171
|
}, Ro = (e, t) => {
|
|
172
|
-
|
|
172
|
+
I((o) => {
|
|
173
173
|
const r = [...o];
|
|
174
174
|
return r[p] = t, r;
|
|
175
175
|
});
|
|
176
176
|
}, J = () => {
|
|
177
177
|
const e = G.current, t = B.current;
|
|
178
|
-
if (e && t &&
|
|
178
|
+
if (e && t && x)
|
|
179
179
|
try {
|
|
180
|
-
const o =
|
|
180
|
+
const o = x[p];
|
|
181
181
|
if (!o) return !1;
|
|
182
182
|
if (po(), a.returnCropParams === !0) {
|
|
183
183
|
if (b) {
|
|
@@ -279,11 +279,11 @@ function Te(a) {
|
|
|
279
279
|
photoSourceLoading: c,
|
|
280
280
|
loadingValue: Ao,
|
|
281
281
|
errors: Uo,
|
|
282
|
-
photoCrops:
|
|
282
|
+
photoCrops: x,
|
|
283
283
|
photoSources: P,
|
|
284
284
|
onNextPhoto: Mo,
|
|
285
285
|
onSkipCrop: yo,
|
|
286
|
-
onClearErrors:
|
|
286
|
+
onClearErrors: xo,
|
|
287
287
|
photoError: Y,
|
|
288
288
|
onCloseDialogHandler: q,
|
|
289
289
|
onCropChange: Ro,
|
|
@@ -305,7 +305,7 @@ function Te(a) {
|
|
|
305
305
|
className: z,
|
|
306
306
|
open: mo && wo,
|
|
307
307
|
photoError: Y,
|
|
308
|
-
onCloseErrorDialog:
|
|
308
|
+
onCloseErrorDialog: Io,
|
|
309
309
|
locale: n,
|
|
310
310
|
theme: j
|
|
311
311
|
}
|