@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.
- 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 +129 -912
- package/dist/components/code-input/constants.d.ts +1 -0
- package/dist/components/code-input/constants.js +9 -8
- package/dist/components/code-input/types.d.ts +1 -0
- package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +46 -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 -4
- package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +113 -404
- package/dist/components/photo-crop-uploader/constants.d.ts +2 -2
- package/dist/components/photo-crop-uploader/constants.js +1 -1
- package/dist/components/photo-crop-uploader/errors/photo-size.error.d.ts +1 -1
- package/dist/components/photo-crop-uploader/errors/photo-size.error.js +17 -12
- package/dist/components/photo-crop-uploader/locale.js +2 -2
- package/dist/components/photo-crop-uploader/photo-crop-uploader.js +45 -38
- 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/components/photo-crop-uploader/utils/read-photo.d.ts +1 -1
- package/dist/components/photo-crop-uploader/utils/read-photo.js +39 -39
- package/dist/raw-cross-BhC4FBfp.js +4 -0
- package/dist/upload-dialog-errors-BIwMA_MN.js +89 -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-BwQsTOc3.js +0 -367
- package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
- package/dist/useId-CK6Kn3Tn.js +0 -21
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as u from "react";
|
|
2
|
-
import { f, h as a, i as m, j as l } from "./createTheme-BoOmbNvy.js";
|
|
3
|
-
function h(t) {
|
|
4
|
-
return Object.keys(t).length === 0;
|
|
5
|
-
}
|
|
6
|
-
function x(t = null) {
|
|
7
|
-
const e = u.useContext(f);
|
|
8
|
-
return !e || h(e) ? t : e;
|
|
9
|
-
}
|
|
10
|
-
const y = a();
|
|
11
|
-
function b(t = y) {
|
|
12
|
-
return x(t);
|
|
13
|
-
}
|
|
14
|
-
const P = (t) => {
|
|
15
|
-
const e = {
|
|
16
|
-
systemProps: {},
|
|
17
|
-
otherProps: {}
|
|
18
|
-
}, r = t?.theme?.unstable_sxConfig ?? l;
|
|
19
|
-
return Object.keys(t).forEach((s) => {
|
|
20
|
-
r[s] ? e.systemProps[s] = t[s] : e.otherProps[s] = t[s];
|
|
21
|
-
}), e;
|
|
22
|
-
};
|
|
23
|
-
function j(t) {
|
|
24
|
-
const {
|
|
25
|
-
sx: e,
|
|
26
|
-
...r
|
|
27
|
-
} = t, {
|
|
28
|
-
systemProps: s,
|
|
29
|
-
otherProps: c
|
|
30
|
-
} = P(r);
|
|
31
|
-
let n;
|
|
32
|
-
return Array.isArray(e) ? n = [s, ...e] : typeof e == "function" ? n = (...i) => {
|
|
33
|
-
const o = e(...i);
|
|
34
|
-
return m(o) ? {
|
|
35
|
-
...s,
|
|
36
|
-
...o
|
|
37
|
-
} : s;
|
|
38
|
-
} : n = {
|
|
39
|
-
...s,
|
|
40
|
-
...e
|
|
41
|
-
}, {
|
|
42
|
-
...c,
|
|
43
|
-
sx: n
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
x as a,
|
|
48
|
-
j as e,
|
|
49
|
-
b as u
|
|
50
|
-
};
|
package/dist/index-CcueJ2sD.js
DELETED
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
import p, { PureComponent as H, createRef as k } from "react";
|
|
2
|
-
var X = Object.defineProperty, $ = (s, t, e) => t in s ? X(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, u = (s, t, e) => $(s, typeof t != "symbol" ? t + "" : t, e);
|
|
3
|
-
const E = {
|
|
4
|
-
x: 0,
|
|
5
|
-
y: 0,
|
|
6
|
-
width: 0,
|
|
7
|
-
height: 0,
|
|
8
|
-
unit: "px"
|
|
9
|
-
}, R = (s, t, e) => Math.min(Math.max(s, t), e), P = (...s) => s.filter((t) => t && typeof t == "string").join(" "), Y = (s, t) => s === t || s.width === t.width && s.height === t.height && s.x === t.x && s.y === t.y && s.unit === t.unit;
|
|
10
|
-
function N(s, t, e, o) {
|
|
11
|
-
const i = C(s, e, o);
|
|
12
|
-
return s.width && (i.height = i.width / t), s.height && (i.width = i.height * t), i.y + i.height > o && (i.height = o - i.y, i.width = i.height * t), i.x + i.width > e && (i.width = e - i.x, i.height = i.width / t), s.unit === "%" ? f(i, e, o) : i;
|
|
13
|
-
}
|
|
14
|
-
function O(s, t, e) {
|
|
15
|
-
const o = C(s, t, e);
|
|
16
|
-
return o.x = (t - o.width) / 2, o.y = (e - o.height) / 2, s.unit === "%" ? f(o, t, e) : o;
|
|
17
|
-
}
|
|
18
|
-
function f(s, t, e) {
|
|
19
|
-
return s.unit === "%" ? { ...E, ...s, unit: "%" } : {
|
|
20
|
-
unit: "%",
|
|
21
|
-
x: s.x ? s.x / t * 100 : 0,
|
|
22
|
-
y: s.y ? s.y / e * 100 : 0,
|
|
23
|
-
width: s.width ? s.width / t * 100 : 0,
|
|
24
|
-
height: s.height ? s.height / e * 100 : 0
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function C(s, t, e) {
|
|
28
|
-
return s.unit ? s.unit === "px" ? { ...E, ...s, unit: "px" } : {
|
|
29
|
-
unit: "px",
|
|
30
|
-
x: s.x ? s.x * t / 100 : 0,
|
|
31
|
-
y: s.y ? s.y * e / 100 : 0,
|
|
32
|
-
width: s.width ? s.width * t / 100 : 0,
|
|
33
|
-
height: s.height ? s.height * e / 100 : 0
|
|
34
|
-
} : { ...E, ...s, unit: "px" };
|
|
35
|
-
}
|
|
36
|
-
function _(s, t, e, o, i, n = 0, a = 0, l = o, h = i) {
|
|
37
|
-
const r = { ...s };
|
|
38
|
-
let c = Math.min(n, o), w = Math.min(a, i), g = Math.min(l, o), d = Math.min(h, i);
|
|
39
|
-
t && (t > 1 ? (c = a ? a * t : c, w = c / t, g = l * t) : (w = n ? n / t : w, c = w * t, d = h / t)), r.y < 0 && (r.height = Math.max(r.height + r.y, w), r.y = 0), r.x < 0 && (r.width = Math.max(r.width + r.x, c), r.x = 0);
|
|
40
|
-
const m = o - (r.x + r.width);
|
|
41
|
-
m < 0 && (r.x = Math.min(r.x, o - c), r.width += m);
|
|
42
|
-
const x = i - (r.y + r.height);
|
|
43
|
-
if (x < 0 && (r.y = Math.min(r.y, i - w), r.height += x), r.width < c && ((e === "sw" || e == "nw") && (r.x -= c - r.width), r.width = c), r.height < w && ((e === "nw" || e == "ne") && (r.y -= w - r.height), r.height = w), r.width > g && ((e === "sw" || e == "nw") && (r.x -= g - r.width), r.width = g), r.height > d && ((e === "nw" || e == "ne") && (r.y -= d - r.height), r.height = d), t) {
|
|
44
|
-
const b = r.width / r.height;
|
|
45
|
-
if (b < t) {
|
|
46
|
-
const D = Math.max(r.width / t, w);
|
|
47
|
-
(e === "nw" || e == "ne") && (r.y -= D - r.height), r.height = D;
|
|
48
|
-
} else if (b > t) {
|
|
49
|
-
const D = Math.max(r.height * t, c);
|
|
50
|
-
(e === "sw" || e == "nw") && (r.x -= D - r.width), r.width = D;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return r;
|
|
54
|
-
}
|
|
55
|
-
function S(s, t, e, o) {
|
|
56
|
-
const i = { ...s };
|
|
57
|
-
return t === "ArrowLeft" ? o === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : o === "w" ? (i.x -= e, i.width += e) : o === "sw" ? (i.x -= e, i.width += e, i.height += e) : o === "ne" ? (i.y += e, i.width -= e, i.height -= e) : o === "e" ? i.width -= e : o === "se" && (i.width -= e, i.height -= e) : t === "ArrowRight" && (o === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : o === "w" ? (i.x += e, i.width -= e) : o === "sw" ? (i.x += e, i.width -= e, i.height -= e) : o === "ne" ? (i.y -= e, i.width += e, i.height += e) : o === "e" ? i.width += e : o === "se" && (i.width += e, i.height += e)), t === "ArrowUp" ? o === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : o === "n" ? (i.y -= e, i.height += e) : o === "ne" ? (i.y -= e, i.width += e, i.height += e) : o === "sw" ? (i.x += e, i.width -= e, i.height -= e) : o === "s" ? i.height -= e : o === "se" && (i.width -= e, i.height -= e) : t === "ArrowDown" && (o === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : o === "n" ? (i.y += e, i.height -= e) : o === "ne" ? (i.y += e, i.width -= e, i.height -= e) : o === "sw" ? (i.x -= e, i.width += e, i.height += e) : o === "s" ? i.height += e : o === "se" && (i.width += e, i.height += e)), i;
|
|
58
|
-
}
|
|
59
|
-
const M = { capture: !0, passive: !1 };
|
|
60
|
-
let K = 0;
|
|
61
|
-
const v = class y extends H {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(...arguments), u(this, "docMoveBound", !1), u(this, "mouseDownOnCrop", !1), u(this, "dragStarted", !1), u(this, "evData", {
|
|
64
|
-
startClientX: 0,
|
|
65
|
-
startClientY: 0,
|
|
66
|
-
startCropX: 0,
|
|
67
|
-
startCropY: 0,
|
|
68
|
-
clientX: 0,
|
|
69
|
-
clientY: 0,
|
|
70
|
-
isResize: !0
|
|
71
|
-
}), u(this, "componentRef", k()), u(this, "mediaRef", k()), u(this, "resizeObserver"), u(this, "initChangeCalled", !1), u(this, "instanceId", `rc-${K++}`), u(this, "state", {
|
|
72
|
-
cropIsActive: !1,
|
|
73
|
-
newCropIsBeingDrawn: !1
|
|
74
|
-
}), u(this, "onCropPointerDown", (t) => {
|
|
75
|
-
const { crop: e, disabled: o } = this.props, i = this.getBox();
|
|
76
|
-
if (!e)
|
|
77
|
-
return;
|
|
78
|
-
const n = C(e, i.width, i.height);
|
|
79
|
-
if (o)
|
|
80
|
-
return;
|
|
81
|
-
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
82
|
-
const a = t.target.dataset.ord, l = !!a;
|
|
83
|
-
let h = t.clientX, r = t.clientY, c = n.x, w = n.y;
|
|
84
|
-
if (a) {
|
|
85
|
-
const g = t.clientX - i.x, d = t.clientY - i.y;
|
|
86
|
-
let m = 0, x = 0;
|
|
87
|
-
a === "ne" || a == "e" ? (m = g - (n.x + n.width), x = d - n.y, c = n.x, w = n.y + n.height) : a === "se" || a === "s" ? (m = g - (n.x + n.width), x = d - (n.y + n.height), c = n.x, w = n.y) : a === "sw" || a == "w" ? (m = g - n.x, x = d - (n.y + n.height), c = n.x + n.width, w = n.y) : (a === "nw" || a == "n") && (m = g - n.x, x = d - n.y, c = n.x + n.width, w = n.y + n.height), h = c + i.x + m, r = w + i.y + x;
|
|
88
|
-
}
|
|
89
|
-
this.evData = {
|
|
90
|
-
startClientX: h,
|
|
91
|
-
startClientY: r,
|
|
92
|
-
startCropX: c,
|
|
93
|
-
startCropY: w,
|
|
94
|
-
clientX: t.clientX,
|
|
95
|
-
clientY: t.clientY,
|
|
96
|
-
isResize: l,
|
|
97
|
-
ord: a
|
|
98
|
-
}, this.mouseDownOnCrop = !0, this.setState({ cropIsActive: !0 });
|
|
99
|
-
}), u(this, "onComponentPointerDown", (t) => {
|
|
100
|
-
const { crop: e, disabled: o, locked: i, keepSelection: n, onChange: a } = this.props, l = this.getBox();
|
|
101
|
-
if (o || i || n && e)
|
|
102
|
-
return;
|
|
103
|
-
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
104
|
-
const h = t.clientX - l.x, r = t.clientY - l.y, c = {
|
|
105
|
-
unit: "px",
|
|
106
|
-
x: h,
|
|
107
|
-
y: r,
|
|
108
|
-
width: 0,
|
|
109
|
-
height: 0
|
|
110
|
-
};
|
|
111
|
-
this.evData = {
|
|
112
|
-
startClientX: t.clientX,
|
|
113
|
-
startClientY: t.clientY,
|
|
114
|
-
startCropX: h,
|
|
115
|
-
startCropY: r,
|
|
116
|
-
clientX: t.clientX,
|
|
117
|
-
clientY: t.clientY,
|
|
118
|
-
isResize: !0
|
|
119
|
-
}, this.mouseDownOnCrop = !0, a(C(c, l.width, l.height), f(c, l.width, l.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
|
|
120
|
-
}), u(this, "onDocPointerMove", (t) => {
|
|
121
|
-
const { crop: e, disabled: o, onChange: i, onDragStart: n } = this.props, a = this.getBox();
|
|
122
|
-
if (o || !e || !this.mouseDownOnCrop)
|
|
123
|
-
return;
|
|
124
|
-
t.cancelable && t.preventDefault(), this.dragStarted || (this.dragStarted = !0, n && n(t));
|
|
125
|
-
const { evData: l } = this;
|
|
126
|
-
l.clientX = t.clientX, l.clientY = t.clientY;
|
|
127
|
-
let h;
|
|
128
|
-
l.isResize ? h = this.resizeCrop() : h = this.dragCrop(), Y(e, h) || i(
|
|
129
|
-
C(h, a.width, a.height),
|
|
130
|
-
f(h, a.width, a.height)
|
|
131
|
-
);
|
|
132
|
-
}), u(this, "onComponentKeyDown", (t) => {
|
|
133
|
-
const { crop: e, disabled: o, onChange: i, onComplete: n } = this.props;
|
|
134
|
-
if (o)
|
|
135
|
-
return;
|
|
136
|
-
const a = t.key;
|
|
137
|
-
let l = !1;
|
|
138
|
-
if (!e)
|
|
139
|
-
return;
|
|
140
|
-
const h = this.getBox(), r = this.makePixelCrop(h), c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? y.nudgeStepLarge : t.shiftKey ? y.nudgeStepMedium : y.nudgeStep;
|
|
141
|
-
if (a === "ArrowLeft" ? (r.x -= c, l = !0) : a === "ArrowRight" ? (r.x += c, l = !0) : a === "ArrowUp" ? (r.y -= c, l = !0) : a === "ArrowDown" && (r.y += c, l = !0), l) {
|
|
142
|
-
t.cancelable && t.preventDefault(), r.x = R(r.x, 0, h.width - r.width), r.y = R(r.y, 0, h.height - r.height);
|
|
143
|
-
const w = C(r, h.width, h.height), g = f(r, h.width, h.height);
|
|
144
|
-
i(w, g), n && n(w, g);
|
|
145
|
-
}
|
|
146
|
-
}), u(this, "onHandlerKeyDown", (t, e) => {
|
|
147
|
-
const {
|
|
148
|
-
aspect: o = 0,
|
|
149
|
-
crop: i,
|
|
150
|
-
disabled: n,
|
|
151
|
-
minWidth: a = 0,
|
|
152
|
-
minHeight: l = 0,
|
|
153
|
-
maxWidth: h,
|
|
154
|
-
maxHeight: r,
|
|
155
|
-
onChange: c,
|
|
156
|
-
onComplete: w
|
|
157
|
-
} = this.props, g = this.getBox();
|
|
158
|
-
if (n || !i)
|
|
159
|
-
return;
|
|
160
|
-
if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight")
|
|
161
|
-
t.stopPropagation(), t.preventDefault();
|
|
162
|
-
else
|
|
163
|
-
return;
|
|
164
|
-
const d = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? y.nudgeStepLarge : t.shiftKey ? y.nudgeStepMedium : y.nudgeStep, m = C(i, g.width, g.height), x = S(m, t.key, d, e), b = _(
|
|
165
|
-
x,
|
|
166
|
-
o,
|
|
167
|
-
e,
|
|
168
|
-
g.width,
|
|
169
|
-
g.height,
|
|
170
|
-
a,
|
|
171
|
-
l,
|
|
172
|
-
h,
|
|
173
|
-
r
|
|
174
|
-
);
|
|
175
|
-
if (!Y(i, b)) {
|
|
176
|
-
const D = f(b, g.width, g.height);
|
|
177
|
-
c(b, D), w && w(b, D);
|
|
178
|
-
}
|
|
179
|
-
}), u(this, "onDocPointerDone", (t) => {
|
|
180
|
-
const { crop: e, disabled: o, onComplete: i, onDragEnd: n } = this.props, a = this.getBox();
|
|
181
|
-
this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, n && n(t), i && i(C(e, a.width, a.height), f(e, a.width, a.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
|
|
182
|
-
}), u(this, "onDragFocus", () => {
|
|
183
|
-
var t;
|
|
184
|
-
(t = this.componentRef.current) == null || t.scrollTo(0, 0);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
get document() {
|
|
188
|
-
return document;
|
|
189
|
-
}
|
|
190
|
-
// We unfortunately get the bounding box every time as x+y changes
|
|
191
|
-
// due to scrolling.
|
|
192
|
-
getBox() {
|
|
193
|
-
const t = this.mediaRef.current;
|
|
194
|
-
if (!t)
|
|
195
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
196
|
-
const { x: e, y: o, width: i, height: n } = t.getBoundingClientRect();
|
|
197
|
-
return { x: e, y: o, width: i, height: n };
|
|
198
|
-
}
|
|
199
|
-
componentDidUpdate(t) {
|
|
200
|
-
const { crop: e, onComplete: o } = this.props;
|
|
201
|
-
if (o && !t.crop && e) {
|
|
202
|
-
const { width: i, height: n } = this.getBox();
|
|
203
|
-
i && n && o(C(e, i, n), f(e, i, n));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
componentWillUnmount() {
|
|
207
|
-
this.resizeObserver && this.resizeObserver.disconnect(), this.unbindDocMove();
|
|
208
|
-
}
|
|
209
|
-
bindDocMove() {
|
|
210
|
-
this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove, M), this.document.addEventListener("pointerup", this.onDocPointerDone, M), this.document.addEventListener("pointercancel", this.onDocPointerDone, M), this.docMoveBound = !0);
|
|
211
|
-
}
|
|
212
|
-
unbindDocMove() {
|
|
213
|
-
this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove, M), this.document.removeEventListener("pointerup", this.onDocPointerDone, M), this.document.removeEventListener("pointercancel", this.onDocPointerDone, M), this.docMoveBound = !1);
|
|
214
|
-
}
|
|
215
|
-
getCropStyle() {
|
|
216
|
-
const { crop: t } = this.props;
|
|
217
|
-
if (t)
|
|
218
|
-
return {
|
|
219
|
-
top: `${t.y}${t.unit}`,
|
|
220
|
-
left: `${t.x}${t.unit}`,
|
|
221
|
-
width: `${t.width}${t.unit}`,
|
|
222
|
-
height: `${t.height}${t.unit}`
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
dragCrop() {
|
|
226
|
-
const { evData: t } = this, e = this.getBox(), o = this.makePixelCrop(e), i = t.clientX - t.startClientX, n = t.clientY - t.startClientY;
|
|
227
|
-
return o.x = R(t.startCropX + i, 0, e.width - o.width), o.y = R(t.startCropY + n, 0, e.height - o.height), o;
|
|
228
|
-
}
|
|
229
|
-
getPointRegion(t, e, o, i) {
|
|
230
|
-
const { evData: n } = this, a = n.clientX - t.x, l = n.clientY - t.y;
|
|
231
|
-
let h;
|
|
232
|
-
i && e ? h = e === "nw" || e === "n" || e === "ne" : h = l < n.startCropY;
|
|
233
|
-
let r;
|
|
234
|
-
return o && e ? r = e === "nw" || e === "w" || e === "sw" : r = a < n.startCropX, r ? h ? "nw" : "sw" : h ? "ne" : "se";
|
|
235
|
-
}
|
|
236
|
-
resolveMinDimensions(t, e, o = 0, i = 0) {
|
|
237
|
-
const n = Math.min(o, t.width), a = Math.min(i, t.height);
|
|
238
|
-
return !e || !n && !a ? [n, a] : e > 1 ? n ? [n, n / e] : [a * e, a] : a ? [a * e, a] : [n, n / e];
|
|
239
|
-
}
|
|
240
|
-
resizeCrop() {
|
|
241
|
-
const { evData: t } = this, { aspect: e = 0, maxWidth: o, maxHeight: i } = this.props, n = this.getBox(), [a, l] = this.resolveMinDimensions(n, e, this.props.minWidth, this.props.minHeight);
|
|
242
|
-
let h = this.makePixelCrop(n);
|
|
243
|
-
const r = this.getPointRegion(n, t.ord, a, l), c = t.ord || r;
|
|
244
|
-
let w = t.clientX - t.startClientX, g = t.clientY - t.startClientY;
|
|
245
|
-
(a && c === "nw" || c === "w" || c === "sw") && (w = Math.min(w, -a)), (l && c === "nw" || c === "n" || c === "ne") && (g = Math.min(g, -l));
|
|
246
|
-
const d = {
|
|
247
|
-
unit: "px",
|
|
248
|
-
x: 0,
|
|
249
|
-
y: 0,
|
|
250
|
-
width: 0,
|
|
251
|
-
height: 0
|
|
252
|
-
};
|
|
253
|
-
r === "ne" ? (d.x = t.startCropX, d.width = w, e ? (d.height = d.width / e, d.y = t.startCropY - d.height) : (d.height = Math.abs(g), d.y = t.startCropY - d.height)) : r === "se" ? (d.x = t.startCropX, d.y = t.startCropY, d.width = w, e ? d.height = d.width / e : d.height = g) : r === "sw" ? (d.x = t.startCropX + w, d.y = t.startCropY, d.width = Math.abs(w), e ? d.height = d.width / e : d.height = g) : r === "nw" && (d.x = t.startCropX + w, d.width = Math.abs(w), e ? (d.height = d.width / e, d.y = t.startCropY - d.height) : (d.height = Math.abs(g), d.y = t.startCropY + g));
|
|
254
|
-
const m = _(
|
|
255
|
-
d,
|
|
256
|
-
e,
|
|
257
|
-
r,
|
|
258
|
-
n.width,
|
|
259
|
-
n.height,
|
|
260
|
-
a,
|
|
261
|
-
l,
|
|
262
|
-
o,
|
|
263
|
-
i
|
|
264
|
-
);
|
|
265
|
-
return e || y.xyOrds.indexOf(c) > -1 ? h = m : y.xOrds.indexOf(c) > -1 ? (h.x = m.x, h.width = m.width) : y.yOrds.indexOf(c) > -1 && (h.y = m.y, h.height = m.height), h.x = R(h.x, 0, n.width - h.width), h.y = R(h.y, 0, n.height - h.height), h;
|
|
266
|
-
}
|
|
267
|
-
renderCropSelection() {
|
|
268
|
-
const {
|
|
269
|
-
ariaLabels: t = y.defaultProps.ariaLabels,
|
|
270
|
-
disabled: e,
|
|
271
|
-
locked: o,
|
|
272
|
-
renderSelectionAddon: i,
|
|
273
|
-
ruleOfThirds: n,
|
|
274
|
-
crop: a
|
|
275
|
-
} = this.props, l = this.getCropStyle();
|
|
276
|
-
if (a)
|
|
277
|
-
return /* @__PURE__ */ p.createElement(
|
|
278
|
-
"div",
|
|
279
|
-
{
|
|
280
|
-
style: l,
|
|
281
|
-
className: "ReactCrop__crop-selection",
|
|
282
|
-
onPointerDown: this.onCropPointerDown,
|
|
283
|
-
"aria-label": t.cropArea,
|
|
284
|
-
tabIndex: 0,
|
|
285
|
-
onKeyDown: this.onComponentKeyDown,
|
|
286
|
-
role: "group"
|
|
287
|
-
},
|
|
288
|
-
!e && !o && /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__drag-elements", onFocus: this.onDragFocus }, /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__drag-bar ord-n", "data-ord": "n" }), /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__drag-bar ord-e", "data-ord": "e" }), /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__drag-bar ord-s", "data-ord": "s" }), /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__drag-bar ord-w", "data-ord": "w" }), /* @__PURE__ */ p.createElement(
|
|
289
|
-
"div",
|
|
290
|
-
{
|
|
291
|
-
className: "ReactCrop__drag-handle ord-nw",
|
|
292
|
-
"data-ord": "nw",
|
|
293
|
-
tabIndex: 0,
|
|
294
|
-
"aria-label": t.nwDragHandle,
|
|
295
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "nw"),
|
|
296
|
-
role: "button"
|
|
297
|
-
}
|
|
298
|
-
), /* @__PURE__ */ p.createElement(
|
|
299
|
-
"div",
|
|
300
|
-
{
|
|
301
|
-
className: "ReactCrop__drag-handle ord-n",
|
|
302
|
-
"data-ord": "n",
|
|
303
|
-
tabIndex: 0,
|
|
304
|
-
"aria-label": t.nDragHandle,
|
|
305
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "n"),
|
|
306
|
-
role: "button"
|
|
307
|
-
}
|
|
308
|
-
), /* @__PURE__ */ p.createElement(
|
|
309
|
-
"div",
|
|
310
|
-
{
|
|
311
|
-
className: "ReactCrop__drag-handle ord-ne",
|
|
312
|
-
"data-ord": "ne",
|
|
313
|
-
tabIndex: 0,
|
|
314
|
-
"aria-label": t.neDragHandle,
|
|
315
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "ne"),
|
|
316
|
-
role: "button"
|
|
317
|
-
}
|
|
318
|
-
), /* @__PURE__ */ p.createElement(
|
|
319
|
-
"div",
|
|
320
|
-
{
|
|
321
|
-
className: "ReactCrop__drag-handle ord-e",
|
|
322
|
-
"data-ord": "e",
|
|
323
|
-
tabIndex: 0,
|
|
324
|
-
"aria-label": t.eDragHandle,
|
|
325
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "e"),
|
|
326
|
-
role: "button"
|
|
327
|
-
}
|
|
328
|
-
), /* @__PURE__ */ p.createElement(
|
|
329
|
-
"div",
|
|
330
|
-
{
|
|
331
|
-
className: "ReactCrop__drag-handle ord-se",
|
|
332
|
-
"data-ord": "se",
|
|
333
|
-
tabIndex: 0,
|
|
334
|
-
"aria-label": t.seDragHandle,
|
|
335
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "se"),
|
|
336
|
-
role: "button"
|
|
337
|
-
}
|
|
338
|
-
), /* @__PURE__ */ p.createElement(
|
|
339
|
-
"div",
|
|
340
|
-
{
|
|
341
|
-
className: "ReactCrop__drag-handle ord-s",
|
|
342
|
-
"data-ord": "s",
|
|
343
|
-
tabIndex: 0,
|
|
344
|
-
"aria-label": t.sDragHandle,
|
|
345
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "s"),
|
|
346
|
-
role: "button"
|
|
347
|
-
}
|
|
348
|
-
), /* @__PURE__ */ p.createElement(
|
|
349
|
-
"div",
|
|
350
|
-
{
|
|
351
|
-
className: "ReactCrop__drag-handle ord-sw",
|
|
352
|
-
"data-ord": "sw",
|
|
353
|
-
tabIndex: 0,
|
|
354
|
-
"aria-label": t.swDragHandle,
|
|
355
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "sw"),
|
|
356
|
-
role: "button"
|
|
357
|
-
}
|
|
358
|
-
), /* @__PURE__ */ p.createElement(
|
|
359
|
-
"div",
|
|
360
|
-
{
|
|
361
|
-
className: "ReactCrop__drag-handle ord-w",
|
|
362
|
-
"data-ord": "w",
|
|
363
|
-
tabIndex: 0,
|
|
364
|
-
"aria-label": t.wDragHandle,
|
|
365
|
-
onKeyDown: (h) => this.onHandlerKeyDown(h, "w"),
|
|
366
|
-
role: "button"
|
|
367
|
-
}
|
|
368
|
-
)),
|
|
369
|
-
i && /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__selection-addon", onPointerDown: (h) => h.stopPropagation() }, i(this.state)),
|
|
370
|
-
n && /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ p.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" }))
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
makePixelCrop(t) {
|
|
374
|
-
const e = { ...E, ...this.props.crop || {} };
|
|
375
|
-
return C(e, t.width, t.height);
|
|
376
|
-
}
|
|
377
|
-
render() {
|
|
378
|
-
const { aspect: t, children: e, circularCrop: o, className: i, crop: n, disabled: a, locked: l, style: h, ruleOfThirds: r } = this.props, { cropIsActive: c, newCropIsBeingDrawn: w } = this.state, g = n ? this.renderCropSelection() : null, d = P(
|
|
379
|
-
"ReactCrop",
|
|
380
|
-
i,
|
|
381
|
-
c && "ReactCrop--active",
|
|
382
|
-
a && "ReactCrop--disabled",
|
|
383
|
-
l && "ReactCrop--locked",
|
|
384
|
-
w && "ReactCrop--new-crop",
|
|
385
|
-
n && t && "ReactCrop--fixed-aspect",
|
|
386
|
-
n && o && "ReactCrop--circular-crop",
|
|
387
|
-
n && r && "ReactCrop--rule-of-thirds",
|
|
388
|
-
!this.dragStarted && n && !n.width && !n.height && "ReactCrop--invisible-crop",
|
|
389
|
-
o && "ReactCrop--no-animate"
|
|
390
|
-
);
|
|
391
|
-
return /* @__PURE__ */ p.createElement("div", { ref: this.componentRef, className: d, style: h }, /* @__PURE__ */ p.createElement("div", { ref: this.mediaRef, className: "ReactCrop__child-wrapper", onPointerDown: this.onComponentPointerDown }, e), n ? /* @__PURE__ */ p.createElement("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%" }, /* @__PURE__ */ p.createElement("defs", null, /* @__PURE__ */ p.createElement("mask", { id: `hole-${this.instanceId}` }, /* @__PURE__ */ p.createElement("rect", { width: "100%", height: "100%", fill: "white" }), o ? /* @__PURE__ */ p.createElement(
|
|
392
|
-
"ellipse",
|
|
393
|
-
{
|
|
394
|
-
cx: `${n.x + n.width / 2}${n.unit}`,
|
|
395
|
-
cy: `${n.y + n.height / 2}${n.unit}`,
|
|
396
|
-
rx: `${n.width / 2}${n.unit}`,
|
|
397
|
-
ry: `${n.height / 2}${n.unit}`,
|
|
398
|
-
fill: "black"
|
|
399
|
-
}
|
|
400
|
-
) : /* @__PURE__ */ p.createElement(
|
|
401
|
-
"rect",
|
|
402
|
-
{
|
|
403
|
-
x: `${n.x}${n.unit}`,
|
|
404
|
-
y: `${n.y}${n.unit}`,
|
|
405
|
-
width: `${n.width}${n.unit}`,
|
|
406
|
-
height: `${n.height}${n.unit}`,
|
|
407
|
-
fill: "black"
|
|
408
|
-
}
|
|
409
|
-
))), /* @__PURE__ */ p.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, g);
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
u(v, "xOrds", ["e", "w"]), u(v, "yOrds", ["n", "s"]), u(v, "xyOrds", ["nw", "ne", "se", "sw"]), u(v, "nudgeStep", 1), u(v, "nudgeStepMedium", 10), u(v, "nudgeStepLarge", 100), u(v, "defaultProps", {
|
|
413
|
-
ariaLabels: {
|
|
414
|
-
cropArea: "Use the arrow keys to move the crop selection area",
|
|
415
|
-
nwDragHandle: "Use the arrow keys to move the north west drag handle to change the crop selection area",
|
|
416
|
-
nDragHandle: "Use the up and down arrow keys to move the north drag handle to change the crop selection area",
|
|
417
|
-
neDragHandle: "Use the arrow keys to move the north east drag handle to change the crop selection area",
|
|
418
|
-
eDragHandle: "Use the up and down arrow keys to move the east drag handle to change the crop selection area",
|
|
419
|
-
seDragHandle: "Use the arrow keys to move the south east drag handle to change the crop selection area",
|
|
420
|
-
sDragHandle: "Use the up and down arrow keys to move the south drag handle to change the crop selection area",
|
|
421
|
-
swDragHandle: "Use the arrow keys to move the south west drag handle to change the crop selection area",
|
|
422
|
-
wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
let B = v;
|
|
426
|
-
export {
|
|
427
|
-
N as B,
|
|
428
|
-
C as D,
|
|
429
|
-
O as L,
|
|
430
|
-
B as S,
|
|
431
|
-
f as v
|
|
432
|
-
};
|
package/dist/index-YnD2EP-S.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
function c(e) {
|
|
2
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3
|
-
}
|
|
4
|
-
var o = { exports: {} };
|
|
5
|
-
var i;
|
|
6
|
-
function p() {
|
|
7
|
-
return i || (i = 1, (function(e) {
|
|
8
|
-
(function() {
|
|
9
|
-
var u = {}.hasOwnProperty;
|
|
10
|
-
function s() {
|
|
11
|
-
for (var t = "", r = 0; r < arguments.length; r++) {
|
|
12
|
-
var n = arguments[r];
|
|
13
|
-
n && (t = a(t, f(n)));
|
|
14
|
-
}
|
|
15
|
-
return t;
|
|
16
|
-
}
|
|
17
|
-
function f(t) {
|
|
18
|
-
if (typeof t == "string" || typeof t == "number")
|
|
19
|
-
return t;
|
|
20
|
-
if (typeof t != "object")
|
|
21
|
-
return "";
|
|
22
|
-
if (Array.isArray(t))
|
|
23
|
-
return s.apply(null, t);
|
|
24
|
-
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
25
|
-
return t.toString();
|
|
26
|
-
var r = "";
|
|
27
|
-
for (var n in t)
|
|
28
|
-
u.call(t, n) && t[n] && (r = a(r, n));
|
|
29
|
-
return r;
|
|
30
|
-
}
|
|
31
|
-
function a(t, r) {
|
|
32
|
-
return r ? t ? t + " " + r : t + r : t;
|
|
33
|
-
}
|
|
34
|
-
e.exports ? (s.default = s, e.exports = s) : window.classNames = s;
|
|
35
|
-
})();
|
|
36
|
-
})(o)), o.exports;
|
|
37
|
-
}
|
|
38
|
-
var l = p();
|
|
39
|
-
const m = /* @__PURE__ */ c(l);
|
|
40
|
-
export {
|
|
41
|
-
m as c,
|
|
42
|
-
c as g
|
|
43
|
-
};
|
package/dist/index-h5oTv8GF.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import { u as y, e as m } from "./extendSxProp-BaUCVMKV.js";
|
|
4
|
-
import { P as e, k as d, T as b } from "./createTheme-BoOmbNvy.js";
|
|
5
|
-
import { G as T, d as h } from "./chainPropTypes-DgqFdXGi.js";
|
|
6
|
-
function E(t) {
|
|
7
|
-
return t == null || Object.keys(t).length === 0;
|
|
8
|
-
}
|
|
9
|
-
function p(t) {
|
|
10
|
-
const {
|
|
11
|
-
styles: r,
|
|
12
|
-
defaultTheme: l = {}
|
|
13
|
-
} = t;
|
|
14
|
-
return /* @__PURE__ */ a(T, {
|
|
15
|
-
styles: typeof r == "function" ? (n) => r(E(n) ? l : n) : r
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
process.env.NODE_ENV !== "production" && (p.propTypes = {
|
|
19
|
-
defaultTheme: e.object,
|
|
20
|
-
styles: e.oneOfType([e.array, e.string, e.object, e.func])
|
|
21
|
-
});
|
|
22
|
-
function u(t) {
|
|
23
|
-
const r = d(t);
|
|
24
|
-
return t !== r && r.styles ? (r.styles.match(/^@layer\s+[^{]*$/) || (r.styles = `@layer global{${r.styles}}`), r) : t;
|
|
25
|
-
}
|
|
26
|
-
function f({
|
|
27
|
-
styles: t,
|
|
28
|
-
themeId: r,
|
|
29
|
-
defaultTheme: l = {}
|
|
30
|
-
}) {
|
|
31
|
-
const o = y(l), n = r && o[r] || o;
|
|
32
|
-
let s = typeof t == "function" ? t(n) : t;
|
|
33
|
-
return n.modularCssLayers && (Array.isArray(s) ? s = s.map((i) => u(typeof i == "function" ? i(n) : i)) : s = u(s)), /* @__PURE__ */ a(p, {
|
|
34
|
-
styles: s
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
process.env.NODE_ENV !== "production" && (f.propTypes = {
|
|
38
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
39
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
40
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
41
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
42
|
-
/**
|
|
43
|
-
* @ignore
|
|
44
|
-
*/
|
|
45
|
-
defaultTheme: e.object,
|
|
46
|
-
/**
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
styles: e.oneOfType([e.array, e.func, e.number, e.object, e.string, e.bool]),
|
|
50
|
-
/**
|
|
51
|
-
* @ignore
|
|
52
|
-
*/
|
|
53
|
-
themeId: e.string
|
|
54
|
-
});
|
|
55
|
-
function c(t) {
|
|
56
|
-
return /* @__PURE__ */ a(f, {
|
|
57
|
-
...t,
|
|
58
|
-
defaultTheme: h,
|
|
59
|
-
themeId: b
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
process.env.NODE_ENV !== "production" && (c.propTypes = {
|
|
63
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
64
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
65
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
66
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
67
|
-
/**
|
|
68
|
-
* The styles you want to apply globally.
|
|
69
|
-
*/
|
|
70
|
-
styles: e.oneOfType([e.array, e.func, e.number, e.object, e.string, e.bool])
|
|
71
|
-
});
|
|
72
|
-
function x(t) {
|
|
73
|
-
return function(l) {
|
|
74
|
-
return (
|
|
75
|
-
// Pigment CSS `globalCss` support callback with theme inside an object but `GlobalStyles` support theme as a callback value.
|
|
76
|
-
/* @__PURE__ */ a(c, {
|
|
77
|
-
styles: typeof t == "function" ? (o) => t({
|
|
78
|
-
theme: o,
|
|
79
|
-
...l
|
|
80
|
-
}) : t
|
|
81
|
-
})
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function N() {
|
|
86
|
-
return m;
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
x as g,
|
|
90
|
-
N as i
|
|
91
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { p as s } from "./chainPropTypes-DgqFdXGi.js";
|
|
2
|
-
const l = {
|
|
3
|
-
theme: void 0
|
|
4
|
-
};
|
|
5
|
-
function u(o) {
|
|
6
|
-
let m, n;
|
|
7
|
-
return function(t) {
|
|
8
|
-
let e = m;
|
|
9
|
-
return (e === void 0 || t.theme !== n) && (l.theme = t.theme, e = s(o(l)), m = e, n = t.theme), e;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const r = u;
|
|
13
|
-
export {
|
|
14
|
-
r as m
|
|
15
|
-
};
|