@alphakits/ui 2.4.2 → 2.4.4
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/calendar/components/months-table/component.js +22 -23
- package/dist/calendar/components/months-table/index.css +1 -1
- package/dist/calendar/components/months-table/index.module.css.js +4 -6
- package/dist/calendar/components/select-button/index.css +1 -1
- package/dist/calendar/index.css +1 -1
- package/dist/calendar-input/component.js +124 -121
- package/dist/checkbox-lists/mock.data.d.ts +81 -0
- package/dist/checkbox-lists/mock.data.js +207 -0
- package/dist/collapsable-row/fixtures.data.d.ts +99 -0
- package/dist/collapsable-row/fixtures.data.js +196 -0
- package/dist/confirm-popup/component.d.ts +21 -0
- package/dist/confirm-popup/component.js +119 -0
- package/dist/confirm-popup/index.css +1 -0
- package/dist/confirm-popup/index.d.ts +1 -0
- package/dist/confirm-popup/index.js +6 -0
- package/dist/confirm-popup/index.module.css.js +17 -0
- package/dist/form/component.js +16 -16
- package/dist/form/templates/filters-form/index.js +17 -17
- package/dist/form/templates/rest-form/form.js +75 -69
- package/dist/index.d.ts +1 -0
- package/dist/index.js +290 -286
- package/dist/modal/components/modals/modal.js +45 -42
- package/dist/popover/component.js +72 -55
- package/dist/radio-groups/mock.data.d.ts +9 -0
- package/dist/radio-groups/mock.data.js +82 -0
- package/dist/table/hooks/use-table-data.js +71 -67
- package/dist/theme-provider/default-themes.d.ts +4 -0
- package/dist/theme-provider/default-themes.js +4 -0
- package/dist/toast-plate/index.css +1 -1
- package/package.json +9 -27
package/dist/form/component.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ModalContext as x } from "../modal/context.js";
|
|
|
7
7
|
import { showError as T, showSuccess as F } from "../utils/show-toast/index.js";
|
|
8
8
|
import { RestForm as w } from "./templates/rest-form/index.js";
|
|
9
9
|
const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
10
|
-
const [i, c] = a.useState(!0), [f,
|
|
10
|
+
const [i, c] = a.useState(!0), [f, m] = a.useState(!1), [p, u] = a.useState(!1);
|
|
11
11
|
return a.useEffect(() => {
|
|
12
12
|
setTimeout(() => c(!1), 500);
|
|
13
13
|
}, []), /* @__PURE__ */ e(
|
|
@@ -17,30 +17,30 @@ const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
|
17
17
|
initialValues: M,
|
|
18
18
|
customValidationFields: ["bur"],
|
|
19
19
|
save: () => new Promise((b) => {
|
|
20
|
-
|
|
21
|
-
b(),
|
|
20
|
+
m(!0), setTimeout(() => {
|
|
21
|
+
b(), m(!1), F("", "Saved");
|
|
22
22
|
}, 3e3);
|
|
23
23
|
}),
|
|
24
24
|
remove: () => new Promise((b) => {
|
|
25
|
-
|
|
26
|
-
b(),
|
|
25
|
+
u(!0), setTimeout(() => {
|
|
26
|
+
b(), u(!1), T("Some error from server", "Error");
|
|
27
27
|
}, 3e3);
|
|
28
28
|
}),
|
|
29
29
|
title: "custom title other",
|
|
30
30
|
loading: i,
|
|
31
|
-
submitButtonText: "submit",
|
|
31
|
+
submitButtonText: "common:submit",
|
|
32
32
|
updating: f,
|
|
33
33
|
removing: p,
|
|
34
34
|
close: l?.close,
|
|
35
35
|
t: (b) => b,
|
|
36
|
-
children: ({ values: b, touched:
|
|
36
|
+
children: ({ values: b, touched: g, errors: r, handleChange: o }) => /* @__PURE__ */ C(S, { columns: 1, gr: 16, gc: 0, children: [
|
|
37
37
|
/* @__PURE__ */ e(
|
|
38
38
|
t,
|
|
39
39
|
{
|
|
40
40
|
label: "buz",
|
|
41
41
|
value: b.buz,
|
|
42
42
|
onChange: o("buz"),
|
|
43
|
-
error:
|
|
43
|
+
error: g.buz && r.buz
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
46
|
/* @__PURE__ */ e(
|
|
@@ -49,14 +49,14 @@ const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
|
49
49
|
label: "bur",
|
|
50
50
|
value: b.bur,
|
|
51
51
|
onChange: o("bur"),
|
|
52
|
-
error:
|
|
52
|
+
error: g.bur && r.bur
|
|
53
53
|
}
|
|
54
54
|
)
|
|
55
55
|
] })
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
}, O = (l) => {
|
|
59
|
-
const [i, c] = a.useState(!0), [f,
|
|
59
|
+
const [i, c] = a.useState(!0), [f, m] = a.useState(!1), [p, u] = a.useState(!1), { openModal: v } = a.useContext(x), d = v(V);
|
|
60
60
|
return a.useEffect(() => {
|
|
61
61
|
setTimeout(() => c(!1), 500);
|
|
62
62
|
}, []), /* @__PURE__ */ e(
|
|
@@ -66,13 +66,13 @@ const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
|
66
66
|
initialValues: E,
|
|
67
67
|
customValidationFields: ["bar"],
|
|
68
68
|
save: () => new Promise((r) => {
|
|
69
|
-
|
|
70
|
-
r(),
|
|
69
|
+
m(!0), setTimeout(() => {
|
|
70
|
+
r(), m(!1), F("", "Saved");
|
|
71
71
|
}, 3e3);
|
|
72
72
|
}),
|
|
73
73
|
remove: () => new Promise((r) => {
|
|
74
|
-
|
|
75
|
-
r(),
|
|
74
|
+
u(!0), setTimeout(() => {
|
|
75
|
+
r(), u(!1), T("Some error from server", "Error");
|
|
76
76
|
}, 3e3);
|
|
77
77
|
}),
|
|
78
78
|
title: "Настройки",
|
|
@@ -81,7 +81,7 @@ const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
|
81
81
|
},
|
|
82
82
|
softError: "Some error",
|
|
83
83
|
loading: i,
|
|
84
|
-
submitButtonText: "
|
|
84
|
+
submitButtonText: "common:save",
|
|
85
85
|
updating: f,
|
|
86
86
|
removing: p,
|
|
87
87
|
close: l?.close,
|
|
@@ -168,7 +168,7 @@ const E = { baz: "", bar: "" }, M = { buz: "", bur: "" }, V = (l) => {
|
|
|
168
168
|
error: o.bar && n.bar
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
/* @__PURE__ */ e(z, { onClick:
|
|
171
|
+
/* @__PURE__ */ e(z, { onClick: d, children: "openCrudModalOther" })
|
|
172
172
|
] })
|
|
173
173
|
}
|
|
174
174
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { Formik as d } from "formik";
|
|
3
3
|
import u from "react";
|
|
4
4
|
import { Button as i } from "../../../button/component.js";
|
|
@@ -8,42 +8,42 @@ const C = ({
|
|
|
8
8
|
initialValues: n,
|
|
9
9
|
defaultValues: m,
|
|
10
10
|
children: s,
|
|
11
|
-
submitCallback:
|
|
12
|
-
close:
|
|
13
|
-
t:
|
|
11
|
+
submitCallback: c,
|
|
12
|
+
close: r,
|
|
13
|
+
t: e
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
}, children: (
|
|
15
|
+
const l = p(n, m);
|
|
16
|
+
return /* @__PURE__ */ t(d, { initialValues: l, onSubmit: (o) => {
|
|
17
|
+
c(o), r();
|
|
18
|
+
}, children: (o) => (process.env.REACT_APP_STAGE, /* @__PURE__ */ t(
|
|
19
19
|
f,
|
|
20
20
|
{
|
|
21
|
-
title:
|
|
22
|
-
bottomAddons: /* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
21
|
+
title: e("common:filters"),
|
|
22
|
+
bottomAddons: /* @__PURE__ */ a(u.Fragment, { children: [
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
24
|
i,
|
|
25
25
|
{
|
|
26
26
|
view: "primary",
|
|
27
27
|
size: "s",
|
|
28
28
|
block: !0,
|
|
29
29
|
dataTestId: "buttonSave",
|
|
30
|
-
onClick: () =>
|
|
31
|
-
children:
|
|
30
|
+
onClick: () => o.submitForm(),
|
|
31
|
+
children: e("common:save")
|
|
32
32
|
}
|
|
33
33
|
),
|
|
34
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
35
|
i,
|
|
36
36
|
{
|
|
37
37
|
block: !0,
|
|
38
38
|
view: "secondary",
|
|
39
39
|
size: "s",
|
|
40
40
|
dataTestId: "buttonCancel",
|
|
41
|
-
onClick:
|
|
42
|
-
children:
|
|
41
|
+
onClick: r,
|
|
42
|
+
children: e("common:cancel")
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
] }),
|
|
46
|
-
children: s(
|
|
46
|
+
children: s(o)
|
|
47
47
|
}
|
|
48
48
|
)) });
|
|
49
49
|
};
|
|
@@ -1,115 +1,121 @@
|
|
|
1
|
-
import { jsxs as p, jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import A from "@alphakits/icons/dist/TrashM";
|
|
3
3
|
import D, { useContext as H, useRef as q, useCallback as x, useEffect as G } from "react";
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import { Button as w } from "../../../button/component.js";
|
|
5
|
+
import { showConfirm as J } from "../../../confirm-popup/component.js";
|
|
6
|
+
import { Flex as K } from "../../../flex/component.js";
|
|
7
|
+
import { FlexColumns as L } from "../../../flex-columns/component.js";
|
|
8
|
+
import { IconButton as N } from "../../../icon-button/component.js";
|
|
9
|
+
import { ModalContext as O } from "../../../modal/context.js";
|
|
10
|
+
import { Sidepanel as Q } from "../../../sidepanel/component.js";
|
|
11
|
+
import { ToastPlate as T } from "../../../toast-plate/component.js";
|
|
12
|
+
function se({
|
|
13
|
+
recordId: F,
|
|
14
|
+
title: I,
|
|
15
|
+
subtitle: R,
|
|
16
|
+
headerBottomAddons: h,
|
|
17
|
+
initialValues: y,
|
|
18
|
+
submitButtonText: M,
|
|
18
19
|
customFooter: B,
|
|
19
20
|
loading: n,
|
|
20
21
|
updating: i,
|
|
21
|
-
removing:
|
|
22
|
-
customValidationFields:
|
|
23
|
-
validate:
|
|
24
|
-
save:
|
|
25
|
-
remove:
|
|
22
|
+
removing: m,
|
|
23
|
+
customValidationFields: U,
|
|
24
|
+
validate: W,
|
|
25
|
+
save: X,
|
|
26
|
+
remove: c,
|
|
26
27
|
close: S,
|
|
27
|
-
back:
|
|
28
|
-
t:
|
|
29
|
-
children:
|
|
30
|
-
headerAddon:
|
|
31
|
-
error:
|
|
32
|
-
softError:
|
|
33
|
-
...
|
|
28
|
+
back: g,
|
|
29
|
+
t: e,
|
|
30
|
+
children: z,
|
|
31
|
+
headerAddon: b,
|
|
32
|
+
error: Y,
|
|
33
|
+
softError: s,
|
|
34
|
+
...P
|
|
34
35
|
}) {
|
|
35
|
-
const { setModalDirty:
|
|
36
|
-
!
|
|
37
|
-
const t =
|
|
36
|
+
const { setModalDirty: o, currentModalId: a } = H(O), l = q("");
|
|
37
|
+
!l.current && a && (l.current = a);
|
|
38
|
+
const t = l.current || a, { submitCount: d, handleSubmit: v, isValid: f, ...u } = P, C = !!F && !!c, k = x(
|
|
38
39
|
() => {
|
|
39
|
-
|
|
40
|
+
o(t, !1), v();
|
|
40
41
|
},
|
|
41
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
-
[t,
|
|
43
|
-
),
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
[t, o, v]
|
|
44
|
+
), V = x(async () => {
|
|
45
|
+
o(t, !1), await J({
|
|
46
|
+
title: e("common:deleteConfirm"),
|
|
47
|
+
confirmText: e("common:remove"),
|
|
48
|
+
cancelText: e("common:cancel"),
|
|
49
|
+
confirmView: "negative"
|
|
50
|
+
}) && c?.();
|
|
51
|
+
}, [t, e, o, c]);
|
|
46
52
|
G(() => {
|
|
47
|
-
n ||
|
|
48
|
-
}, [u.dirty, n, t,
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
n || o(t, u.dirty);
|
|
54
|
+
}, [u.dirty, n, t, o]);
|
|
55
|
+
const j = C || b ? /* @__PURE__ */ p(D.Fragment, { children: [
|
|
56
|
+
b,
|
|
57
|
+
C && /* @__PURE__ */ r(
|
|
58
|
+
N,
|
|
53
59
|
{
|
|
54
60
|
dataTestId: "removeTariffBtn",
|
|
55
61
|
size: "m",
|
|
56
62
|
disabled: i,
|
|
57
|
-
loading:
|
|
58
|
-
onClick:
|
|
59
|
-
icon:
|
|
63
|
+
loading: m,
|
|
64
|
+
onClick: V,
|
|
65
|
+
icon: A
|
|
60
66
|
}
|
|
61
67
|
)
|
|
62
68
|
] }) : null;
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
|
|
69
|
+
return /* @__PURE__ */ r(
|
|
70
|
+
Q,
|
|
65
71
|
{
|
|
66
|
-
headerRightAddons:
|
|
67
|
-
title:
|
|
68
|
-
subtitle:
|
|
69
|
-
loading: i ||
|
|
70
|
-
headerBottomAddons: (
|
|
71
|
-
|
|
72
|
-
!!
|
|
73
|
-
!f && !!
|
|
72
|
+
headerRightAddons: j,
|
|
73
|
+
title: I,
|
|
74
|
+
subtitle: R,
|
|
75
|
+
loading: i || m || n,
|
|
76
|
+
headerBottomAddons: (h || !!s || !f && !!d) && /* @__PURE__ */ p(L, { columns: 1, gr: 8, children: [
|
|
77
|
+
h,
|
|
78
|
+
!!s && /* @__PURE__ */ r(T, { view: "negative", children: s }),
|
|
79
|
+
!f && !!d && /* @__PURE__ */ r(T, { view: "negative", children: "Please correct errors before submitting form." })
|
|
74
80
|
] }),
|
|
75
|
-
back:
|
|
76
|
-
t:
|
|
77
|
-
bottomAddons: B || /* @__PURE__ */ p(
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
81
|
+
back: g,
|
|
82
|
+
t: e,
|
|
83
|
+
bottomAddons: B || /* @__PURE__ */ p(K, { gap: "md", children: [
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
w,
|
|
80
86
|
{
|
|
81
87
|
view: "primary",
|
|
82
88
|
size: "s",
|
|
83
89
|
block: !0,
|
|
84
90
|
loading: n,
|
|
85
|
-
disabled: i ||
|
|
91
|
+
disabled: i || m,
|
|
86
92
|
dataTestId: "buttonSave",
|
|
87
93
|
onClick: () => k(),
|
|
88
|
-
children:
|
|
94
|
+
children: e(M || "common:save")
|
|
89
95
|
}
|
|
90
96
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
97
|
+
/* @__PURE__ */ r(
|
|
98
|
+
w,
|
|
93
99
|
{
|
|
94
100
|
block: !0,
|
|
95
101
|
view: "secondary",
|
|
96
102
|
size: "s",
|
|
97
103
|
dataTestId: "buttonCancel",
|
|
98
104
|
onClick: S,
|
|
99
|
-
children:
|
|
105
|
+
children: e("common:cancel")
|
|
100
106
|
}
|
|
101
107
|
)
|
|
102
108
|
] }),
|
|
103
|
-
children:
|
|
104
|
-
submitCount:
|
|
109
|
+
children: z({
|
|
110
|
+
submitCount: d,
|
|
105
111
|
isValid: f,
|
|
106
112
|
handleSubmit: k,
|
|
107
|
-
initialValues:
|
|
113
|
+
initialValues: y,
|
|
108
114
|
...u
|
|
109
115
|
})
|
|
110
116
|
}
|
|
111
117
|
);
|
|
112
118
|
}
|
|
113
119
|
export {
|
|
114
|
-
|
|
120
|
+
se as Form
|
|
115
121
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './checkbox-group';
|
|
|
17
17
|
export * from './checkbox-lists';
|
|
18
18
|
export * from './collapsable-row';
|
|
19
19
|
export * from './collapse';
|
|
20
|
+
export * from './confirm-popup';
|
|
20
21
|
export * from './copy-button';
|
|
21
22
|
export * from './date';
|
|
22
23
|
export * from './date-switcher';
|