@memobit/libs 3.9.0 → 3.10.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.
- package/README.md +96 -95
- package/dist/components/Confetti/Confetti2.js +26 -25
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +9 -8
- package/dist/components/InputDate/InputDate2.js +16 -15
- package/dist/components/InputEmail/InputEmail2.js +22 -21
- package/dist/components/InputFile/InputFile2.js +9 -8
- package/dist/components/InputNumber/InputNumber2.js +7 -6
- package/dist/components/InputPassword/InputPassword2.js +6 -5
- package/dist/components/InputSearch/InputSearch2.js +18 -17
- package/dist/components/InputText/InputText2.js +6 -5
- package/dist/components/InputTextarea/InputTextarea2.js +11 -10
- package/dist/components/InputTime/InputTime2.js +35 -34
- package/dist/components/InputUrl/InputUrl2.js +20 -19
- package/dist/components/QuantitySelector/QuantitySelector2.js +19 -18
- package/dist/errors.d.ts +78 -0
- package/dist/errors.js +9 -0
- package/dist/helpers/ErrorReporting.js +179 -0
- package/dist/helpers/Logger.js +31 -0
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/memobit-icons.json +1 -41
- package/dist/styles/highlight.scss +6 -6
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +12 -6
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import './InputSearch.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import { InputText as
|
|
2
|
+
import { Icon as c } from "../Icon/Icon2.js";
|
|
3
|
+
import { Tooltip as C } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { InputText as S } from "../InputText/InputText2.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { jsx as r, jsxs as
|
|
8
|
-
var
|
|
9
|
-
const
|
|
6
|
+
import { forwardRef as j } from "react";
|
|
7
|
+
import { jsx as r, jsxs as w } from "react/jsx-runtime";
|
|
8
|
+
var T = j(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m, onBlur: l, onChange: o, onClick: p, onKeyDown: h, onKeyUp: f, placeholder: u = "Search...", readOnly: a = !1, required: d = !1, value: e, className: x = "" }, I) => {
|
|
9
|
+
const N = () => {
|
|
10
10
|
o?.("");
|
|
11
|
-
},
|
|
12
|
-
return /* @__PURE__ */
|
|
11
|
+
}, _ = e && e.length > 0 && !t && !a;
|
|
12
|
+
return /* @__PURE__ */ w("div", {
|
|
13
13
|
className: `input-search ${x}`,
|
|
14
14
|
children: [
|
|
15
15
|
/* @__PURE__ */ r("div", {
|
|
16
16
|
className: "input-search__icon",
|
|
17
|
-
children: /* @__PURE__ */ r(
|
|
17
|
+
children: /* @__PURE__ */ r(c, { name: "search" })
|
|
18
18
|
}),
|
|
19
|
-
/* @__PURE__ */ r(
|
|
19
|
+
/* @__PURE__ */ r(S, {
|
|
20
20
|
autoComplete: s,
|
|
21
21
|
autoFocus: i,
|
|
22
22
|
disabled: t,
|
|
@@ -28,18 +28,18 @@ var R = w(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m
|
|
|
28
28
|
onKeyDown: h,
|
|
29
29
|
onKeyUp: f,
|
|
30
30
|
placeholder: u,
|
|
31
|
-
readOnly:
|
|
31
|
+
readOnly: a,
|
|
32
32
|
required: d,
|
|
33
33
|
value: e,
|
|
34
|
-
ref:
|
|
34
|
+
ref: I
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
_ && /* @__PURE__ */ r(C, {
|
|
37
37
|
title: "Clear search",
|
|
38
38
|
children: /* @__PURE__ */ r("button", {
|
|
39
39
|
type: "button",
|
|
40
40
|
className: "input-search__clear",
|
|
41
|
-
onClick:
|
|
42
|
-
children: /* @__PURE__ */ r(
|
|
41
|
+
onClick: N,
|
|
42
|
+
children: /* @__PURE__ */ r(c, {
|
|
43
43
|
name: "clear",
|
|
44
44
|
size: "sm"
|
|
45
45
|
})
|
|
@@ -48,6 +48,7 @@ var R = w(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m
|
|
|
48
48
|
]
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
+
T.displayName = "InputSearch";
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
T as InputSearch
|
|
53
54
|
};
|
|
@@ -2,7 +2,7 @@ import './InputText.css';
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { forwardRef as w } from "react";
|
|
4
4
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var y = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highlighted: x, id: s, label: n, maxLength: u, onBlur: c, onChange: h, onClick: o, onKeyDown: d, onKeyUp: N, placeholder: f, readOnly: g = !1, required: p = !1, success: a, value: v }, $) => /* @__PURE__ */ i("div", {
|
|
6
6
|
className: `input-text-wrapper${x ? " input-text-highlighted" : ""}`,
|
|
7
7
|
children: [
|
|
8
8
|
n && /* @__PURE__ */ i("label", {
|
|
@@ -21,15 +21,15 @@ var F = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highli
|
|
|
21
21
|
className: `input-text ${e ? "input-text-error" : ""} ${a ? "input-text-success" : ""}`,
|
|
22
22
|
id: s,
|
|
23
23
|
maxLength: u,
|
|
24
|
-
placeholder:
|
|
24
|
+
placeholder: f,
|
|
25
25
|
ref: $,
|
|
26
26
|
value: v,
|
|
27
27
|
onBlur: c,
|
|
28
28
|
onChange: (j) => h?.(j.target.value),
|
|
29
29
|
onClick: o,
|
|
30
30
|
onKeyDown: d,
|
|
31
|
-
onKeyUp:
|
|
32
|
-
readOnly:
|
|
31
|
+
onKeyUp: N,
|
|
32
|
+
readOnly: g,
|
|
33
33
|
required: p
|
|
34
34
|
}),
|
|
35
35
|
e && /* @__PURE__ */ t("span", {
|
|
@@ -42,6 +42,7 @@ var F = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highli
|
|
|
42
42
|
})
|
|
43
43
|
]
|
|
44
44
|
}));
|
|
45
|
+
y.displayName = "InputText";
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
y as InputText
|
|
47
48
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import './InputTextarea.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
3
|
+
import { forwardRef as I } from "react";
|
|
4
|
+
import { jsx as a, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
var T = I(({ autoComplete: p = "on", autoFocus: i, cols: l, disabled: m, error: e, id: r, label: s, maxLength: x, onBlur: u, onChange: c, onClick: o, onKeyDown: d, onKeyUp: h, placeholder: N, required: f, rows: g, success: t, value: v }, j) => /* @__PURE__ */ n("div", {
|
|
6
6
|
className: "input-textarea-wrapper",
|
|
7
7
|
children: [
|
|
8
8
|
s && /* @__PURE__ */ n("label", {
|
|
9
9
|
htmlFor: r,
|
|
10
10
|
className: "input-textarea-label",
|
|
11
|
-
children: [s, f && /* @__PURE__ */
|
|
11
|
+
children: [s, f && /* @__PURE__ */ a("span", {
|
|
12
12
|
className: "input-textarea-required",
|
|
13
13
|
children: "*"
|
|
14
14
|
})]
|
|
15
15
|
}),
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ a("textarea", {
|
|
17
17
|
autoComplete: p,
|
|
18
18
|
autoFocus: i,
|
|
19
|
-
className: `input-textarea${
|
|
19
|
+
className: `input-textarea${e ? " input-textarea-error" : ""}${t ? " input-textarea-success" : ""}`,
|
|
20
20
|
cols: l,
|
|
21
21
|
disabled: m,
|
|
22
22
|
id: r,
|
|
@@ -31,16 +31,17 @@ var F = $(({ autoComplete: p = "on", autoFocus: i, cols: l, disabled: m, error:
|
|
|
31
31
|
rows: g,
|
|
32
32
|
value: v
|
|
33
33
|
}),
|
|
34
|
-
|
|
34
|
+
e && /* @__PURE__ */ a("span", {
|
|
35
35
|
className: "input-textarea-error-message",
|
|
36
|
-
children:
|
|
36
|
+
children: e
|
|
37
37
|
}),
|
|
38
|
-
t && /* @__PURE__ */
|
|
38
|
+
t && /* @__PURE__ */ a("span", {
|
|
39
39
|
className: "input-textarea-success-message",
|
|
40
40
|
children: t
|
|
41
41
|
})
|
|
42
42
|
]
|
|
43
43
|
}));
|
|
44
|
+
T.displayName = "InputTextarea";
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
+
T as InputTextarea
|
|
46
47
|
};
|
|
@@ -1,85 +1,86 @@
|
|
|
1
1
|
import './InputTime.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Popover as
|
|
2
|
+
import { Icon as R } from "../Icon/Icon2.js";
|
|
3
|
+
import { Popover as S } from "../Popover/Popover2.js";
|
|
4
4
|
import { TimePicker as j } from "../TimePicker/TimePicker2.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { forwardRef as w, useRef as y, useState as E } from "react";
|
|
7
|
-
import { jsx as e, jsxs as
|
|
8
|
-
var
|
|
7
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
8
|
+
var b = (i) => i.toString().padStart(2, "0"), O = (i) => {
|
|
9
9
|
const [n, t] = (i ?? "").split(":").map(Number);
|
|
10
10
|
return {
|
|
11
11
|
hours: Number.isFinite(n) ? n : 0,
|
|
12
12
|
minutes: Number.isFinite(t) ? t : 0,
|
|
13
13
|
seconds: 0
|
|
14
14
|
};
|
|
15
|
-
},
|
|
16
|
-
const [
|
|
17
|
-
p?.(`${
|
|
15
|
+
}, q = w(({ autoFocus: i, disabled: n, error: t, highlighted: v, id: o, label: c, max: k, min: g, minuteStep: C = 1, onBlur: $, onChange: p, onClick: I, onKeyDown: T, onKeyUp: x, readOnly: u = !1, required: d = !1, success: a, value: f, withClock: l = !1 }, F) => {
|
|
16
|
+
const [m, h] = E(!1), N = y(null), P = (s) => {
|
|
17
|
+
p?.(`${b(s.hours)}:${b(s.minutes)}`);
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
className: `input-time-wrapper${
|
|
19
|
+
return /* @__PURE__ */ r("div", {
|
|
20
|
+
className: `input-time-wrapper${v ? " input-time-highlighted" : ""}`,
|
|
21
21
|
children: [
|
|
22
|
-
c && /* @__PURE__ */
|
|
22
|
+
c && /* @__PURE__ */ r("label", {
|
|
23
23
|
htmlFor: o,
|
|
24
24
|
className: "input-time-label",
|
|
25
|
-
children: [c,
|
|
25
|
+
children: [c, d && /* @__PURE__ */ e("span", {
|
|
26
26
|
className: "input-time-required",
|
|
27
27
|
children: "*"
|
|
28
28
|
})]
|
|
29
29
|
}),
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
ref:
|
|
32
|
-
className: `input-time-field${
|
|
30
|
+
/* @__PURE__ */ r("div", {
|
|
31
|
+
ref: N,
|
|
32
|
+
className: `input-time-field${l ? " input-time-field--with-clock" : ""}`,
|
|
33
33
|
children: [/* @__PURE__ */ e("input", {
|
|
34
34
|
autoFocus: i,
|
|
35
35
|
disabled: n,
|
|
36
36
|
type: "time",
|
|
37
|
-
className: `input-time${t ? " input-time-error" : ""}${
|
|
37
|
+
className: `input-time${t ? " input-time-error" : ""}${a ? " input-time-success" : ""}`,
|
|
38
38
|
id: o,
|
|
39
39
|
max: k,
|
|
40
40
|
min: g,
|
|
41
|
-
ref:
|
|
42
|
-
value:
|
|
41
|
+
ref: F,
|
|
42
|
+
value: f ?? "",
|
|
43
43
|
onBlur: $,
|
|
44
44
|
onChange: (s) => p?.(s.target.value || void 0),
|
|
45
|
-
onClick:
|
|
46
|
-
onKeyDown:
|
|
47
|
-
onKeyUp:
|
|
45
|
+
onClick: I,
|
|
46
|
+
onKeyDown: T,
|
|
47
|
+
onKeyUp: x,
|
|
48
48
|
readOnly: u,
|
|
49
|
-
required:
|
|
50
|
-
}),
|
|
51
|
-
className: `input-time-clock-button${
|
|
49
|
+
required: d
|
|
50
|
+
}), l && /* @__PURE__ */ e("button", {
|
|
51
|
+
className: `input-time-clock-button${m ? " input-time-clock-button--active" : ""}`,
|
|
52
52
|
disabled: n || u,
|
|
53
|
-
onClick: () =>
|
|
53
|
+
onClick: () => h(!m),
|
|
54
54
|
title: "Pick on a clock",
|
|
55
55
|
type: "button",
|
|
56
|
-
children: /* @__PURE__ */ e(
|
|
56
|
+
children: /* @__PURE__ */ e(R, { name: "time" })
|
|
57
57
|
})]
|
|
58
58
|
}),
|
|
59
59
|
t && /* @__PURE__ */ e("span", {
|
|
60
60
|
className: "input-time-error-message",
|
|
61
61
|
children: t
|
|
62
62
|
}),
|
|
63
|
-
|
|
63
|
+
a && /* @__PURE__ */ e("span", {
|
|
64
64
|
className: "input-time-success-message",
|
|
65
|
-
children:
|
|
65
|
+
children: a
|
|
66
66
|
}),
|
|
67
|
-
|
|
68
|
-
visible:
|
|
69
|
-
onClose: () =>
|
|
70
|
-
anchorEl:
|
|
67
|
+
l && /* @__PURE__ */ e(S, {
|
|
68
|
+
visible: m,
|
|
69
|
+
onClose: () => h(!1),
|
|
70
|
+
anchorEl: N.current,
|
|
71
71
|
children: /* @__PURE__ */ e(j, {
|
|
72
72
|
collapsibleClock: !1,
|
|
73
73
|
label: "",
|
|
74
74
|
minuteStep: C,
|
|
75
|
-
onChange:
|
|
76
|
-
value: O(
|
|
75
|
+
onChange: P,
|
|
76
|
+
value: O(f),
|
|
77
77
|
withClock: !0
|
|
78
78
|
})
|
|
79
79
|
})
|
|
80
80
|
]
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
+
q.displayName = "InputTime";
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
q as InputTime
|
|
85
86
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import './InputUrl.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { forwardRef as
|
|
3
|
+
import { forwardRef as j, useState as A } from "react";
|
|
4
4
|
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var B = "Please enter a valid URL (e.g. https://example.com)", F = (l) => {
|
|
6
6
|
try {
|
|
7
7
|
const e = new URL(l);
|
|
8
8
|
return e.protocol === "http:" || e.protocol === "https:";
|
|
9
9
|
} catch {
|
|
10
10
|
return !1;
|
|
11
11
|
}
|
|
12
|
-
},
|
|
13
|
-
const [c, d] =
|
|
12
|
+
}, b = j(({ autoFocus: l, disabled: e, error: f, highlighted: v, id: u, label: i, maxLength: g, onBlur: E, onChange: N, onClick: R, onKeyDown: U, onKeyUp: x, onValidationChange: p, placeholder: y = "https://...", readOnly: L = !1, required: o = !1, success: a, validationErrorMessage: w, value: I }, S) => {
|
|
13
|
+
const [c, d] = A(void 0), h = (r) => {
|
|
14
14
|
if (!r)
|
|
15
|
-
return d(void 0),
|
|
16
|
-
const n =
|
|
17
|
-
return d(n ? void 0 :
|
|
15
|
+
return d(void 0), p?.(!0), !0;
|
|
16
|
+
const n = F(r);
|
|
17
|
+
return d(n ? void 0 : w ?? B), p?.(n), n;
|
|
18
|
+
}, _ = (r) => {
|
|
19
|
+
N?.(r), c && h(r);
|
|
18
20
|
}, $ = (r) => {
|
|
19
|
-
R?.(r), c && h(r);
|
|
20
|
-
}, j = (r) => {
|
|
21
21
|
h(r.target.value), E?.(r);
|
|
22
22
|
}, s = f ?? c;
|
|
23
23
|
return /* @__PURE__ */ m("div", {
|
|
@@ -26,7 +26,7 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
|
|
|
26
26
|
i && /* @__PURE__ */ m("label", {
|
|
27
27
|
htmlFor: u,
|
|
28
28
|
className: "input-url-label",
|
|
29
|
-
children: [i,
|
|
29
|
+
children: [i, o && /* @__PURE__ */ t("span", {
|
|
30
30
|
className: "input-url-required",
|
|
31
31
|
children: "*"
|
|
32
32
|
})]
|
|
@@ -38,16 +38,16 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
|
|
|
38
38
|
className: `input-url${s ? " input-url-error" : ""}${a ? " input-url-success" : ""}`,
|
|
39
39
|
id: u,
|
|
40
40
|
maxLength: g,
|
|
41
|
-
placeholder:
|
|
42
|
-
ref:
|
|
43
|
-
value:
|
|
44
|
-
onBlur:
|
|
45
|
-
onChange: (r) =>
|
|
46
|
-
onClick:
|
|
41
|
+
placeholder: y,
|
|
42
|
+
ref: S,
|
|
43
|
+
value: I,
|
|
44
|
+
onBlur: $,
|
|
45
|
+
onChange: (r) => _(r.target.value),
|
|
46
|
+
onClick: R,
|
|
47
47
|
onKeyDown: U,
|
|
48
48
|
onKeyUp: x,
|
|
49
|
-
readOnly:
|
|
50
|
-
required:
|
|
49
|
+
readOnly: L,
|
|
50
|
+
required: o
|
|
51
51
|
}),
|
|
52
52
|
s && /* @__PURE__ */ t("span", {
|
|
53
53
|
className: "input-url-error-message",
|
|
@@ -60,6 +60,7 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
|
|
|
60
60
|
]
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
+
b.displayName = "InputUrl";
|
|
63
64
|
export {
|
|
64
|
-
|
|
65
|
+
b as InputUrl
|
|
65
66
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import './QuantitySelector.css';
|
|
2
|
-
import { Button as
|
|
2
|
+
import { Button as q } from "../Button/Button2.js";
|
|
3
3
|
import { InputNumber as I } from "../InputNumber/InputNumber2.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { forwardRef as S } from "react";
|
|
6
6
|
import { jsx as s, jsxs as u } from "react/jsx-runtime";
|
|
7
|
-
var
|
|
7
|
+
var $ = S(({ disabled: n = !1, error: c, id: d, inputWidth: f, label: y, max: t, min: r = 0, onChange: i, readOnlyInput: p = !1, required: h = !1, step: a = 1, success: o, value: l }, v) => {
|
|
8
8
|
const N = f || (t !== void 0 ? Math.max(String(t).length, String(r).length, 3) : 3), m = () => {
|
|
9
9
|
if (n) return;
|
|
10
|
-
const e = (
|
|
10
|
+
const e = (l ?? 0) - a;
|
|
11
11
|
r !== void 0 && e < r || i?.(e);
|
|
12
12
|
}, b = () => {
|
|
13
13
|
if (n) return;
|
|
14
|
-
const e = (
|
|
14
|
+
const e = (l ?? 0) + a;
|
|
15
15
|
t !== void 0 && e > t || i?.(e);
|
|
16
16
|
}, g = (e) => {
|
|
17
|
-
if (!
|
|
17
|
+
if (!p) {
|
|
18
18
|
if (e === void 0) {
|
|
19
19
|
i?.(void 0);
|
|
20
20
|
return;
|
|
@@ -36,18 +36,18 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
|
|
|
36
36
|
y && /* @__PURE__ */ u("label", {
|
|
37
37
|
htmlFor: d,
|
|
38
38
|
className: "quantity-selector-label",
|
|
39
|
-
children: [y,
|
|
39
|
+
children: [y, h && /* @__PURE__ */ s("span", {
|
|
40
40
|
className: "quantity-selector-required",
|
|
41
41
|
children: "*"
|
|
42
42
|
})]
|
|
43
43
|
}),
|
|
44
44
|
/* @__PURE__ */ u("div", {
|
|
45
|
-
className: `quantity-selector${
|
|
45
|
+
className: `quantity-selector${p ? " quantity-selector-readonly" : ""}${c ? " quantity-selector-error" : ""}${o ? " quantity-selector-success" : ""}`,
|
|
46
46
|
style: { "--digits": N },
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */ s(
|
|
48
|
+
/* @__PURE__ */ s(q, {
|
|
49
49
|
className: "quantity-selector-button quantity-selector-button-decrease",
|
|
50
|
-
disabled: n || r !== void 0 && (
|
|
50
|
+
disabled: n || r !== void 0 && (l ?? 0) <= r,
|
|
51
51
|
onClick: m,
|
|
52
52
|
size: "small",
|
|
53
53
|
variant: "default",
|
|
@@ -63,13 +63,13 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
|
|
|
63
63
|
min: r,
|
|
64
64
|
onChange: g,
|
|
65
65
|
ref: v,
|
|
66
|
-
step:
|
|
67
|
-
value:
|
|
66
|
+
step: a,
|
|
67
|
+
value: l
|
|
68
68
|
})
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */ s(
|
|
70
|
+
/* @__PURE__ */ s(q, {
|
|
71
71
|
className: "quantity-selector-button quantity-selector-button-increase",
|
|
72
|
-
disabled: n || t !== void 0 && (
|
|
72
|
+
disabled: n || t !== void 0 && (l ?? 0) >= t,
|
|
73
73
|
onClick: b,
|
|
74
74
|
size: "small",
|
|
75
75
|
variant: "default",
|
|
@@ -78,17 +78,18 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
|
|
|
78
78
|
})
|
|
79
79
|
]
|
|
80
80
|
}),
|
|
81
|
-
|
|
81
|
+
c && /* @__PURE__ */ s("span", {
|
|
82
82
|
className: "quantity-selector-error-message",
|
|
83
|
-
children:
|
|
83
|
+
children: c
|
|
84
84
|
}),
|
|
85
|
-
|
|
85
|
+
o && /* @__PURE__ */ s("span", {
|
|
86
86
|
className: "quantity-selector-success-message",
|
|
87
|
-
children:
|
|
87
|
+
children: o
|
|
88
88
|
})
|
|
89
89
|
]
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
+
$.displayName = "QuantitySelector";
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
$ as QuantitySelector
|
|
94
95
|
};
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare type ErrorReportContext = Record<string, unknown>;
|
|
2
|
+
|
|
3
|
+
export declare interface ErrorReportingConfig {
|
|
4
|
+
/** The app id registered in the hub, e.g. `garage`. */
|
|
5
|
+
appId: string;
|
|
6
|
+
/** The hub ingest URL, e.g. `https://hub.memobit.ro/api/errors/ingest`. */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** Turns reporting off for this run, e.g. `import.meta.env.PROD` to report only from production builds. Defaults to true. */
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/** Shown in the hub next to each error. Defaults to `production`. */
|
|
11
|
+
environment?: string;
|
|
12
|
+
/** Build or commit the errors came from. */
|
|
13
|
+
release?: string;
|
|
14
|
+
/** Also report `console.error` and `console.warn` calls. Defaults to true. */
|
|
15
|
+
captureConsole?: boolean;
|
|
16
|
+
/** Messages to drop, on top of the built-in browser noise filters. */
|
|
17
|
+
ignore?: (string | RegExp)[];
|
|
18
|
+
/** Most events sent per page load or process run. Defaults to 200. */
|
|
19
|
+
maxEventsPerSession?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Error reporting shared by every memobit app, in the browser and in Node. Errors and
|
|
24
|
+
* warnings are batched and POSTed to the hub's errors/ingest endpoint, which groups them,
|
|
25
|
+
* lists them on the hub's Errors page and emails on new errors and on spikes.
|
|
26
|
+
*
|
|
27
|
+
* React-free on purpose (it ships through the `@memobit/libs/errors` entry), so Node
|
|
28
|
+
* servers can use it too. The hub can switch reporting off — globally, per app, or
|
|
29
|
+
* automatically on a spike — and the reporter then stays quiet for as long as it is told.
|
|
30
|
+
*/
|
|
31
|
+
export declare type ErrorReportLevel = 'error' | 'warning';
|
|
32
|
+
|
|
33
|
+
/** Sends whatever is queued now instead of waiting for the next batch. */
|
|
34
|
+
export declare const flushErrorReports: () => Promise<void>;
|
|
35
|
+
|
|
36
|
+
/** Browser apps: call once, before rendering. */
|
|
37
|
+
export declare const installErrorReporting: (config: ErrorReportingConfig) => void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Node servers: call once at startup, passing `process`. Unhandled rejections reach
|
|
41
|
+
* Node's uncaught-exception path, so both are covered. Listening there would stop the
|
|
42
|
+
* crash Node normally does, so — unless the server has its own handler — the process
|
|
43
|
+
* still exits with code 1, once the report is sent (or after 3s).
|
|
44
|
+
*/
|
|
45
|
+
export declare const installNodeErrorReporting: (nodeProcess: NodeProcessLike, config: ErrorReportingConfig) => void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Use in place of `console.*` in app code. `debug` and `info` only write to the console;
|
|
49
|
+
* `warn` and `error` also report to the hub once error reporting is installed — and only
|
|
50
|
+
* once, even though the console capture is on.
|
|
51
|
+
*/
|
|
52
|
+
export declare const logger: {
|
|
53
|
+
debug: (message: string, context?: ErrorReportContext) => void;
|
|
54
|
+
info: (message: string, context?: ErrorReportContext) => void;
|
|
55
|
+
warn: (message: string, context?: ErrorReportContext) => void;
|
|
56
|
+
/** `error` is the caught value, if there is one; its stack is kept. */
|
|
57
|
+
error: (message: string, error?: unknown, context?: ErrorReportContext) => void;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** The part of Node's `process` the reporter needs; pass `process` itself. */
|
|
61
|
+
export declare interface NodeProcessLike {
|
|
62
|
+
on(event: 'uncaughtException', listener: (error: Error) => void): unknown;
|
|
63
|
+
listenerCount(event: 'uncaughtException'): number;
|
|
64
|
+
exit(code?: number): void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Reports a caught error you handled but still want to know about. */
|
|
68
|
+
declare const reportError_2: (error: unknown, context?: ErrorReportContext) => void;
|
|
69
|
+
export { reportError_2 as reportError }
|
|
70
|
+
|
|
71
|
+
export { }
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
declare global {
|
|
75
|
+
interface Window {
|
|
76
|
+
__VERSIONS__: FullVersionInfo;
|
|
77
|
+
}
|
|
78
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { flushErrorReports as o, installErrorReporting as t, installNodeErrorReporting as e, reportError as p } from "./helpers/ErrorReporting.js";
|
|
2
|
+
import { logger as l } from "./helpers/Logger.js";
|
|
3
|
+
export {
|
|
4
|
+
o as flushErrorReports,
|
|
5
|
+
t as installErrorReporting,
|
|
6
|
+
e as installNodeErrorReporting,
|
|
7
|
+
l as logger,
|
|
8
|
+
p as reportError
|
|
9
|
+
};
|