triafly-ui-kit 1.0.23 → 1.0.24
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 +93 -93
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/Accordeon.css +1 -0
- package/dist/assets/Alert.css +1 -0
- package/dist/assets/Avatar.css +1 -0
- package/dist/assets/Badge.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/ButtonsArray.css +1 -0
- package/dist/assets/Checkbox.css +1 -0
- package/dist/assets/CliTextareaInput.css +1 -0
- package/dist/assets/CustomLink.css +1 -0
- package/dist/assets/DatePicker.css +1 -0
- package/dist/assets/DropdownInput.css +1 -0
- package/dist/assets/DropdownMenu.css +1 -0
- package/dist/assets/FileUpload.css +1 -0
- package/dist/assets/FormRoot.css +1 -0
- package/dist/assets/Loader.css +1 -0
- package/dist/assets/ModalWindow.css +1 -0
- package/dist/assets/Pagination.css +1 -0
- package/dist/assets/Radio.css +1 -0
- package/dist/assets/SearchInput.css +1 -0
- package/dist/assets/Skeleton.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/Table.css +1 -0
- package/dist/assets/Tabs.css +1 -0
- package/dist/assets/TextInput.css +1 -0
- package/dist/assets/TextareaInput.css +1 -0
- package/dist/assets/ToastContext.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/assets/Tooltip2.css +1 -0
- package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
- package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
- package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
- package/dist/components/Ui/Accordeon/Accordeon.js +33 -0
- package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
- package/dist/components/Ui/Accordeon/index.js +4 -0
- package/dist/components/Ui/Alert/Alert.js +14 -0
- package/dist/components/Ui/Alert/index.js +4 -0
- package/dist/components/Ui/Avatar/Avatar.js +10 -0
- package/dist/components/Ui/Avatar/index.js +4 -0
- package/dist/components/Ui/Badge/Badge.js +43 -0
- package/dist/components/Ui/Badge/index.js +4 -0
- package/dist/components/Ui/Button/Button.js +49 -0
- package/dist/components/Ui/Button/index.js +4 -0
- package/dist/components/Ui/ButtonsArray/ButtonsArray.js +28 -0
- package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
- package/dist/components/Ui/ButtonsArray/index.js +4 -0
- package/dist/components/Ui/Checkbox/Checkbox.js +39 -0
- package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
- package/dist/components/Ui/Checkbox/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +121 -0
- package/dist/components/Ui/CliTextareaInput/index.js +23 -0
- package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
- package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
- package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
- package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
- package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
- package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
- package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
- package/dist/components/Ui/CustomLink/CustomLink.js +49 -0
- package/dist/components/Ui/CustomLink/index.js +4 -0
- package/dist/components/Ui/DatePicker/DatePicker.js +175 -0
- package/dist/components/Ui/DatePicker/DatePicker.stories.js +114 -0
- package/dist/components/Ui/DatePicker/index.js +4 -0
- package/dist/components/Ui/DropdownInput/DropdownInput.js +91 -0
- package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
- package/dist/components/Ui/DropdownInput/index.js +4 -0
- package/dist/components/Ui/DropdownMenu/DropdownMenu.js +83 -0
- package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
- package/dist/components/Ui/DropdownMenu/index.js +4 -0
- package/dist/components/Ui/FileUpload/FileUpload.js +615 -0
- package/dist/components/Ui/FileUpload/fn.js +10 -0
- package/dist/components/Ui/FileUpload/index.js +4 -0
- package/dist/components/Ui/FileUpload/types.js +1 -0
- package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
- package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
- package/dist/components/Ui/Form/FormItem/fn.js +25 -0
- package/dist/components/Ui/Form/FormItem/types.js +1 -0
- package/dist/components/Ui/Form/FormRoot/FormRoot.js +25 -0
- package/dist/components/Ui/Form/FormRoot/index.js +4 -0
- package/dist/components/Ui/Form/FormRoot/types.js +1 -0
- package/dist/components/Ui/Form/index.js +6 -0
- package/dist/components/Ui/Form/useForm/index.js +4 -0
- package/dist/components/Ui/Form/useForm/useForm.js +111 -0
- package/dist/components/Ui/Form/utils/fn.js +31 -0
- package/dist/components/Ui/Form/utils/types.js +1 -0
- package/dist/components/Ui/Icons/Icons.js +577 -0
- package/dist/components/Ui/Icons/index.js +97 -0
- package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
- package/dist/components/Ui/Loader/Loader.js +6 -0
- package/dist/components/Ui/Loader/index.js +4 -0
- package/dist/components/Ui/ModalWindow/ModalWindow.js +50 -0
- package/dist/components/Ui/ModalWindow/index.js +4 -0
- package/dist/components/Ui/Pagination/Pagination.js +294 -0
- package/dist/components/Ui/Pagination/index.js +4 -0
- package/dist/components/Ui/Radio/Radio.js +30 -0
- package/dist/components/Ui/Radio/Radio.stories.js +42 -0
- package/dist/components/Ui/Radio/index.js +4 -0
- package/dist/components/Ui/SearchInput/SearchData.js +30 -0
- package/dist/components/Ui/SearchInput/SearchInput.js +109 -0
- package/dist/components/Ui/Skeleton/Skeleton.js +28 -0
- package/dist/components/Ui/Skeleton/index.js +4 -0
- package/dist/components/Ui/Switch/Switch.js +25 -0
- package/dist/components/Ui/Switch/index.js +4 -0
- package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +79 -0
- package/dist/components/Ui/Table/Table.js +160 -0
- package/dist/components/Ui/Table/TableTypes.js +1 -0
- package/dist/components/Ui/Table/index.js +4 -0
- package/dist/components/Ui/Tabs/Tabs.js +24 -0
- package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
- package/dist/components/Ui/Tabs/index.js +4 -0
- package/dist/components/Ui/TextInput/TextInput.js +85 -0
- package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
- package/dist/components/Ui/TextInput/index.js +4 -0
- package/dist/components/Ui/TextareaInput/TextareaInput.js +68 -0
- package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
- package/dist/components/Ui/TextareaInput/index.js +4 -0
- package/dist/components/Ui/Tooltip/Tooltip.js +92 -0
- package/dist/components/Ui/Tooltip/Tooltip.stories.js +92 -0
- package/dist/components/Ui/Tooltip/index.js +4 -0
- package/dist/context/ToastContext/ToastContext.js +40 -0
- package/dist/context/ToastContext/index.js +5 -0
- package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
- package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
- package/dist/context/TriaflyContext/hooks/index.js +8 -0
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
- package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
- package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
- package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
- package/dist/context/TriaflyContext/index.js +12 -0
- package/dist/index-2QXL0WYc.js +45 -0
- package/dist/main.d.ts +1243 -0
- package/dist/main.js +164 -0
- package/dist/vite-env.d.js +1 -0
- package/package.json +106 -106
@@ -0,0 +1,109 @@
|
|
1
|
+
import { jsxs as I, Fragment as T, jsx as l } from "react/jsx-runtime";
|
2
|
+
import { useState as o, useRef as H, useEffect as w } from "react";
|
3
|
+
import { TextInput as U } from "../TextInput/TextInput.js";
|
4
|
+
import { IconCaretUpDown as q } from "../Icons/Icons.js";
|
5
|
+
import '../../../assets/SearchInput.css';const z = ({
|
6
|
+
name: k = "SearchInput",
|
7
|
+
label: x,
|
8
|
+
placeholder: y = "",
|
9
|
+
type: N = "text",
|
10
|
+
id: $,
|
11
|
+
isDisabled: h = !1,
|
12
|
+
errorMessage: F = "",
|
13
|
+
hasError: V = !1,
|
14
|
+
className: D = "",
|
15
|
+
isClearable: E,
|
16
|
+
isLoading: L,
|
17
|
+
value: c = "",
|
18
|
+
onChange: s,
|
19
|
+
options: n = []
|
20
|
+
}) => {
|
21
|
+
const [m, v] = o(c), [j, i] = o(""), [u, p] = o([]), [d, r] = o(!1), [g, A] = o(!1), [B, C] = o(!1), f = H(null);
|
22
|
+
w(() => {
|
23
|
+
if (c) {
|
24
|
+
const e = n.find((t) => t.value === c);
|
25
|
+
i(e ? e.label : c);
|
26
|
+
} else
|
27
|
+
i("");
|
28
|
+
}, [c, n]), w(() => {
|
29
|
+
if (m.trim() === "" && g) {
|
30
|
+
p(n);
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
const e = n.filter(
|
34
|
+
(t) => t.label.toLowerCase().includes(m.toLowerCase())
|
35
|
+
);
|
36
|
+
p(e);
|
37
|
+
}, [m, n, g]), w(() => {
|
38
|
+
const e = (t) => {
|
39
|
+
f.current && !f.current.contains(t.target) && r(!1);
|
40
|
+
};
|
41
|
+
return document.addEventListener("mousedown", e), () => {
|
42
|
+
document.removeEventListener("mousedown", e);
|
43
|
+
};
|
44
|
+
}, []);
|
45
|
+
const K = (e) => {
|
46
|
+
const t = e.target.value;
|
47
|
+
v(t), i(t), s == null || s(t), r(!0);
|
48
|
+
}, b = (e) => {
|
49
|
+
v(e.value), i(e.label), s == null || s(e.value), r(!1);
|
50
|
+
}, O = () => {
|
51
|
+
A(!0), r(!0), p(n);
|
52
|
+
}, P = (e) => {
|
53
|
+
e.key === "Enter" && u.length > 0 && d && b(u[0]);
|
54
|
+
}, S = (e) => {
|
55
|
+
var t;
|
56
|
+
if (e.stopPropagation(), !d) {
|
57
|
+
const a = (t = f.current) == null ? void 0 : t.getBoundingClientRect(), R = window.innerHeight - ((a == null ? void 0 : a.bottom) || 0);
|
58
|
+
C(R < 304);
|
59
|
+
}
|
60
|
+
r((a) => !a);
|
61
|
+
};
|
62
|
+
return /* @__PURE__ */ I(T, { children: [
|
63
|
+
/* @__PURE__ */ l(
|
64
|
+
U,
|
65
|
+
{
|
66
|
+
name: k,
|
67
|
+
label: x,
|
68
|
+
type: N,
|
69
|
+
className: `${D}`,
|
70
|
+
value: j,
|
71
|
+
onChange: K,
|
72
|
+
placeholder: y,
|
73
|
+
id: $,
|
74
|
+
isDisabled: h,
|
75
|
+
isClearable: E,
|
76
|
+
hasError: V,
|
77
|
+
errorMessage: F,
|
78
|
+
isLoading: L,
|
79
|
+
onFocus: O,
|
80
|
+
onKeyDown: P
|
81
|
+
}
|
82
|
+
),
|
83
|
+
/* @__PURE__ */ I("div", { className: "dropdown-input-test", children: [
|
84
|
+
/* @__PURE__ */ l("div", { className: "caret", onClick: S, children: /* @__PURE__ */ l(q, {}) }),
|
85
|
+
d && g && u.length > 0 && /* @__PURE__ */ l(
|
86
|
+
"div",
|
87
|
+
{
|
88
|
+
className: `input-box
|
89
|
+
${d ? "opened" : ""}
|
90
|
+
${h ? "disabled" : ""}`,
|
91
|
+
ref: f,
|
92
|
+
onClick: S,
|
93
|
+
children: /* @__PURE__ */ l("ul", { className: `options ${B ? "above" : ""}`, children: u.map((e, t) => /* @__PURE__ */ l(
|
94
|
+
"li",
|
95
|
+
{
|
96
|
+
onClick: () => b(e),
|
97
|
+
children: e.label
|
98
|
+
},
|
99
|
+
`${e.value}-${t}`
|
100
|
+
)) })
|
101
|
+
}
|
102
|
+
)
|
103
|
+
] })
|
104
|
+
] });
|
105
|
+
};
|
106
|
+
z.displayName = "SearchInput";
|
107
|
+
export {
|
108
|
+
z as SearchInput
|
109
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
2
|
+
import { c as r } from "../../../index-2QXL0WYc.js";
|
3
|
+
import '../../../assets/Skeleton.css';const c = "_skeleton_yatxz_1", d = "_animated_yatxz_6", e = {
|
4
|
+
skeleton: c,
|
5
|
+
animated: d
|
6
|
+
}, x = ({
|
7
|
+
width: t = "100%",
|
8
|
+
height: s = "100%",
|
9
|
+
borderRadius: a = "4px",
|
10
|
+
circle: o = !1,
|
11
|
+
animated: n = !0,
|
12
|
+
className: l,
|
13
|
+
style: m
|
14
|
+
}) => /* @__PURE__ */ i(
|
15
|
+
"div",
|
16
|
+
{
|
17
|
+
className: r(e.skeleton, { [e.animated]: n }, l),
|
18
|
+
style: {
|
19
|
+
width: t,
|
20
|
+
height: s,
|
21
|
+
borderRadius: o ? "50%" : a,
|
22
|
+
...m
|
23
|
+
}
|
24
|
+
}
|
25
|
+
);
|
26
|
+
export {
|
27
|
+
x as Skeleton
|
28
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { jsx as c, jsxs as t } from "react/jsx-runtime";
|
2
|
+
import '../../../assets/Switch.css';const d = ({
|
3
|
+
label: s,
|
4
|
+
isDisabled: e,
|
5
|
+
isChecked: a = !1,
|
6
|
+
onChange: i,
|
7
|
+
name: l = "Switch"
|
8
|
+
}) => /* @__PURE__ */ c("div", { className: "switch-container", children: /* @__PURE__ */ t("label", { className: `switch ${e ? "disabled" : ""}`, children: [
|
9
|
+
/* @__PURE__ */ c(
|
10
|
+
"input",
|
11
|
+
{
|
12
|
+
name: l,
|
13
|
+
type: "checkbox",
|
14
|
+
checked: a,
|
15
|
+
onChange: i,
|
16
|
+
disabled: e
|
17
|
+
}
|
18
|
+
),
|
19
|
+
s,
|
20
|
+
/* @__PURE__ */ c("span", { className: "slider" })
|
21
|
+
] }) });
|
22
|
+
d.displayName = "Switch";
|
23
|
+
export {
|
24
|
+
d as Switch
|
25
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
2
|
+
import b from "react";
|
3
|
+
import { g } from "../../../../_commonjsHelpers-C6fGbg64.js";
|
4
|
+
import { c as s } from "../../../../index-2QXL0WYc.js";
|
5
|
+
var p, c;
|
6
|
+
function y() {
|
7
|
+
return c || (c = 1, p = function r(t, e) {
|
8
|
+
if (t === e) return !0;
|
9
|
+
if (t && e && typeof t == "object" && typeof e == "object") {
|
10
|
+
if (t.constructor !== e.constructor) return !1;
|
11
|
+
var o, n, u;
|
12
|
+
if (Array.isArray(t)) {
|
13
|
+
if (o = t.length, o != e.length) return !1;
|
14
|
+
for (n = o; n-- !== 0; )
|
15
|
+
if (!r(t[n], e[n])) return !1;
|
16
|
+
return !0;
|
17
|
+
}
|
18
|
+
if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
|
19
|
+
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
|
20
|
+
if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
|
21
|
+
if (u = Object.keys(t), o = u.length, o !== Object.keys(e).length) return !1;
|
22
|
+
for (n = o; n-- !== 0; )
|
23
|
+
if (!Object.prototype.hasOwnProperty.call(e, u[n])) return !1;
|
24
|
+
for (n = o; n-- !== 0; ) {
|
25
|
+
var f = u[n];
|
26
|
+
if (!r(t[f], e[f])) return !1;
|
27
|
+
}
|
28
|
+
return !0;
|
29
|
+
}
|
30
|
+
return t !== t && e !== e;
|
31
|
+
}), p;
|
32
|
+
}
|
33
|
+
var O = y();
|
34
|
+
const i = /* @__PURE__ */ g(O), S = b.memo(
|
35
|
+
({
|
36
|
+
record: r,
|
37
|
+
columns: t,
|
38
|
+
rowKey: e,
|
39
|
+
rowClassName: o,
|
40
|
+
index: n,
|
41
|
+
stickyLeft: u,
|
42
|
+
onClickTr: f,
|
43
|
+
bordered: m
|
44
|
+
}) => {
|
45
|
+
const d = (a) => {
|
46
|
+
!a.target.closest("[data-no-bubble]") && f && f(r);
|
47
|
+
};
|
48
|
+
return /* @__PURE__ */ l(
|
49
|
+
"tr",
|
50
|
+
{
|
51
|
+
className: s(
|
52
|
+
"table-component__wrapper__table__tbody__tr",
|
53
|
+
o == null ? void 0 : o(r, n),
|
54
|
+
{
|
55
|
+
"table-component__wrapper__table__tbody__tr--hoverable": !!f
|
56
|
+
}
|
57
|
+
),
|
58
|
+
onClick: d,
|
59
|
+
children: t.map((a, _) => /* @__PURE__ */ l(
|
60
|
+
"td",
|
61
|
+
{
|
62
|
+
className: s("table-component__wrapper__table__tbody__td", a.className, {
|
63
|
+
"table-component__wrapper__table__tbody__td--bordered": m,
|
64
|
+
"table-component__wrapper__table__tbody__td--sticky-left": u && _ === 0
|
65
|
+
}),
|
66
|
+
align: a.align,
|
67
|
+
children: a.render ? a.render(r[a.dataIndex], r) : String(r[a.dataIndex] ?? "")
|
68
|
+
},
|
69
|
+
`${a.key}-${_}`
|
70
|
+
))
|
71
|
+
},
|
72
|
+
typeof e == "function" ? e(r) : String(r[e])
|
73
|
+
);
|
74
|
+
},
|
75
|
+
(r, t) => i(r.columns, t.columns) && i(r.record, t.record)
|
76
|
+
);
|
77
|
+
export {
|
78
|
+
S as MemoizedRow
|
79
|
+
};
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
2
|
+
import U, { useState as N, useEffect as q, useCallback as d } from "react";
|
3
|
+
import { c as o } from "../../../index-2QXL0WYc.js";
|
4
|
+
import { IconCaretDown as w, IconCaretUp as F } from "../Icons/Icons.js";
|
5
|
+
import { MemoizedRow as G } from "./MemoizedRow/MemoizedRow.js";
|
6
|
+
import { Loader as H } from "../Loader/Loader.js";
|
7
|
+
import '../../../assets/Table.css';const y = {
|
8
|
+
asc: /* @__PURE__ */ t(w, { viewBox: "0 -6 24 24", "aria-hidden": "true" }),
|
9
|
+
desc: /* @__PURE__ */ t(F, { viewBox: "0 -4 24 24", "aria-hidden": "true" }),
|
10
|
+
default: /* @__PURE__ */ t(w, { viewBox: "0 -6 24 24", "aria-hidden": "true" })
|
11
|
+
};
|
12
|
+
function J({
|
13
|
+
columns: f,
|
14
|
+
dataSource: c,
|
15
|
+
rowKey: i,
|
16
|
+
tableClassName: v,
|
17
|
+
theadClassName: k,
|
18
|
+
trTheadClassNames: x,
|
19
|
+
thTheadClassNames: D,
|
20
|
+
tbodyClassName: I,
|
21
|
+
wrapperClassName: A,
|
22
|
+
borderBottom: u = !1,
|
23
|
+
stickyHeader: C = !1,
|
24
|
+
stickyLeft: h = !1,
|
25
|
+
bordered: l = !1,
|
26
|
+
rowClassName: j,
|
27
|
+
defaultSort: B,
|
28
|
+
onClickTr: m,
|
29
|
+
onClickTrHeader: R,
|
30
|
+
loading: S = !1
|
31
|
+
}) {
|
32
|
+
const [T, b] = N(c), [n, z] = N(
|
33
|
+
B || null
|
34
|
+
);
|
35
|
+
q(() => {
|
36
|
+
b(c);
|
37
|
+
}, [c]);
|
38
|
+
const $ = d(
|
39
|
+
(e) => typeof i == "function" ? i(e) : typeof i == "string" && i in e ? String(e[i]) : "unknown",
|
40
|
+
[i]
|
41
|
+
), g = d((e, a) => {
|
42
|
+
b((p) => [...p].sort((L, M) => {
|
43
|
+
const s = L[e], r = M[e];
|
44
|
+
return typeof s == "string" && typeof r == "string" ? a === "asc" ? s.localeCompare(r) : r.localeCompare(s) : typeof s == "number" && typeof r == "number" ? a === "asc" ? s - r : r - s : s instanceof Date && r instanceof Date ? a === "asc" ? s.getTime() - r.getTime() : r.getTime() - s.getTime() : 0;
|
45
|
+
})), z({ key: e, order: a });
|
46
|
+
}, []), E = d(
|
47
|
+
(e) => {
|
48
|
+
const p = (n == null ? void 0 : n.key) === e && n.order === "asc" ? "desc" : "asc";
|
49
|
+
g(e, p);
|
50
|
+
},
|
51
|
+
[n, g]
|
52
|
+
);
|
53
|
+
return /* @__PURE__ */ t("div", { className: o("table-component", A), children: /* @__PURE__ */ t(
|
54
|
+
"div",
|
55
|
+
{
|
56
|
+
className: o(
|
57
|
+
"table-component__wrapper",
|
58
|
+
{
|
59
|
+
bordered: l,
|
60
|
+
borderBottom: u
|
61
|
+
},
|
62
|
+
v
|
63
|
+
),
|
64
|
+
children: /* @__PURE__ */ _(
|
65
|
+
"table",
|
66
|
+
{
|
67
|
+
className: o("table-component__wrapper__table", {
|
68
|
+
bordered: l,
|
69
|
+
borderBottom: u
|
70
|
+
}),
|
71
|
+
children: [
|
72
|
+
/* @__PURE__ */ t(
|
73
|
+
"thead",
|
74
|
+
{
|
75
|
+
className: o(
|
76
|
+
"table-component__wrapper__table__thead",
|
77
|
+
{
|
78
|
+
stickyHeader: C
|
79
|
+
},
|
80
|
+
k
|
81
|
+
),
|
82
|
+
children: /* @__PURE__ */ t(
|
83
|
+
"tr",
|
84
|
+
{
|
85
|
+
className: o(
|
86
|
+
"table-component__wrapper__table__thead__tr",
|
87
|
+
x
|
88
|
+
),
|
89
|
+
onClick: R,
|
90
|
+
children: f.map((e, a) => /* @__PURE__ */ t(
|
91
|
+
"th",
|
92
|
+
{
|
93
|
+
className: o(
|
94
|
+
"table-component__wrapper__table__thead__th",
|
95
|
+
{
|
96
|
+
bordered: l,
|
97
|
+
stickyLeft: h && a === 0
|
98
|
+
},
|
99
|
+
D
|
100
|
+
),
|
101
|
+
style: {
|
102
|
+
...e.width ? { width: e.width } : {},
|
103
|
+
...e.align ? { textAlign: e.align } : {}
|
104
|
+
},
|
105
|
+
onClick: () => e.sorted && E(e.key),
|
106
|
+
children: /* @__PURE__ */ _("div", { className: "th-content", children: [
|
107
|
+
e.title,
|
108
|
+
e.sorted && /* @__PURE__ */ t("span", { className: "sort-icon", children: (n == null ? void 0 : n.key) === e.key ? y[n.order] : y.default })
|
109
|
+
] })
|
110
|
+
},
|
111
|
+
`${e.key}-${a}`
|
112
|
+
))
|
113
|
+
}
|
114
|
+
)
|
115
|
+
}
|
116
|
+
),
|
117
|
+
/* @__PURE__ */ _("tbody", { className: o("table-component__wrapper__table__tbody", I), children: [
|
118
|
+
T.map((e, a) => /* @__PURE__ */ t(
|
119
|
+
G,
|
120
|
+
{
|
121
|
+
record: e,
|
122
|
+
onClickTr: () => m == null ? void 0 : m(e),
|
123
|
+
columns: f,
|
124
|
+
rowKey: i,
|
125
|
+
rowClassName: j,
|
126
|
+
index: a,
|
127
|
+
stickyLeft: h,
|
128
|
+
bordered: l
|
129
|
+
},
|
130
|
+
$(e)
|
131
|
+
)),
|
132
|
+
S ? /* @__PURE__ */ t(
|
133
|
+
"div",
|
134
|
+
{
|
135
|
+
style: {
|
136
|
+
position: "absolute",
|
137
|
+
top: 0,
|
138
|
+
left: 0,
|
139
|
+
right: 0,
|
140
|
+
bottom: 0,
|
141
|
+
display: "flex",
|
142
|
+
justifyContent: "center",
|
143
|
+
alignItems: "center",
|
144
|
+
backgroundColor: "rgba(255, 255, 255, 0.7)",
|
145
|
+
zIndex: 10
|
146
|
+
},
|
147
|
+
children: /* @__PURE__ */ t(H, { className: "centered" })
|
148
|
+
}
|
149
|
+
) : null
|
150
|
+
] })
|
151
|
+
]
|
152
|
+
}
|
153
|
+
)
|
154
|
+
}
|
155
|
+
) });
|
156
|
+
}
|
157
|
+
const Z = U.memo(J);
|
158
|
+
export {
|
159
|
+
Z as Table
|
160
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { useState as v } from "react";
|
3
|
+
import '../../../assets/Tabs.css';const f = ({ items: s, defaultActiveKey: t, onChange: d }) => {
|
4
|
+
var c, b;
|
5
|
+
const [l, i] = v(t || ((c = s[0]) == null ? void 0 : c.key)), n = (a) => {
|
6
|
+
s.some((r) => r.key === a && !r.disabled) && (i(a), d == null || d(a));
|
7
|
+
};
|
8
|
+
return /* @__PURE__ */ o("div", { className: "tabs", children: [
|
9
|
+
/* @__PURE__ */ e("div", { className: "tabs-bar", children: s.map((a) => /* @__PURE__ */ e(
|
10
|
+
"button",
|
11
|
+
{
|
12
|
+
onClick: () => !a.disabled && n(a.key),
|
13
|
+
className: `tab-button ${l === a.key ? "active" : ""} ${a.disabled ? "disabled" : ""}`,
|
14
|
+
disabled: a.disabled,
|
15
|
+
children: a.label
|
16
|
+
},
|
17
|
+
a.key
|
18
|
+
)) }),
|
19
|
+
/* @__PURE__ */ e("div", { className: "tabs-content", children: (b = s.find((a) => a.key === l)) == null ? void 0 : b.children })
|
20
|
+
] });
|
21
|
+
};
|
22
|
+
export {
|
23
|
+
f as Tabs
|
24
|
+
};
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
2
|
+
import { Tabs as t } from "./Tabs.js";
|
3
|
+
const n = {
|
4
|
+
title: "UIKit/Tabs",
|
5
|
+
component: t,
|
6
|
+
tags: ["autodocs"],
|
7
|
+
argTypes: {
|
8
|
+
items: {
|
9
|
+
control: "object",
|
10
|
+
description: "Массив объектов вкладок {label: string, content: ReactNode}"
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}, s = {
|
14
|
+
args: {
|
15
|
+
items: [
|
16
|
+
{
|
17
|
+
key: "profile",
|
18
|
+
label: "Профиль",
|
19
|
+
children: /* @__PURE__ */ e("div", { children: "Информация о пользователе" })
|
20
|
+
},
|
21
|
+
{
|
22
|
+
key: "settings",
|
23
|
+
label: "Настройки",
|
24
|
+
children: /* @__PURE__ */ e("div", { children: "Параметры аккаунта" })
|
25
|
+
},
|
26
|
+
{
|
27
|
+
key: "notifications",
|
28
|
+
label: "Уведомления",
|
29
|
+
children: /* @__PURE__ */ e("div", { children: "Настройки уведомлений" })
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}, a = {
|
34
|
+
args: {
|
35
|
+
items: [
|
36
|
+
{
|
37
|
+
key: "favorites",
|
38
|
+
label: "Избранное",
|
39
|
+
children: /* @__PURE__ */ e("div", { children: "Ваши избранные элементы" })
|
40
|
+
},
|
41
|
+
{
|
42
|
+
key: "projects",
|
43
|
+
label: "Проекты",
|
44
|
+
children: /* @__PURE__ */ e("div", { children: "Список ваших проектов" })
|
45
|
+
}
|
46
|
+
]
|
47
|
+
},
|
48
|
+
decorators: [
|
49
|
+
(i) => /* @__PURE__ */ e("div", { style: { maxWidth: "500px", margin: "0 auto" }, children: /* @__PURE__ */ e(i, {}) })
|
50
|
+
]
|
51
|
+
}, c = {
|
52
|
+
args: {
|
53
|
+
items: [
|
54
|
+
{
|
55
|
+
key: "single",
|
56
|
+
label: "Единственная вкладка",
|
57
|
+
children: /* @__PURE__ */ e("div", { children: "Контент единственной вкладки" })
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
61
|
+
};
|
62
|
+
export {
|
63
|
+
s as Basic,
|
64
|
+
c as SingleTab,
|
65
|
+
a as StyledTabs,
|
66
|
+
n as default
|
67
|
+
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { jsxs as m, jsx as e, Fragment as b } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as g, useState as A } from "react";
|
3
|
+
import { IconX as F, IconCheck as R, IconSearch as T, IconLock as X, IconAt as q } from "../Icons/Icons.js";
|
4
|
+
import { Loader as B } from "../Loader/Loader.js";
|
5
|
+
import '../../../assets/TextInput.css';const D = g(
|
6
|
+
({
|
7
|
+
label: t,
|
8
|
+
placeholder: h = "",
|
9
|
+
value: n,
|
10
|
+
// Значение из пропсов
|
11
|
+
type: f = "text",
|
12
|
+
name: I = "TextInput",
|
13
|
+
id: v,
|
14
|
+
isDisabled: x = !1,
|
15
|
+
iconType: c,
|
16
|
+
errorMessage: l = !1,
|
17
|
+
hasError: N = !1,
|
18
|
+
onChange: a,
|
19
|
+
// Обработчик из пропсов
|
20
|
+
className: p,
|
21
|
+
isClearable: r,
|
22
|
+
isLoading: i,
|
23
|
+
onFocus: k,
|
24
|
+
onKeyDown: z,
|
25
|
+
onBlur: $
|
26
|
+
}, w) => {
|
27
|
+
const [C, o] = A(""), s = n !== void 0, u = s ? n : C, j = (d) => {
|
28
|
+
const V = d.target.value;
|
29
|
+
s || o(V), a && a(d);
|
30
|
+
}, L = () => {
|
31
|
+
s && a ? a({ target: { value: "" } }) : o("");
|
32
|
+
}, S = () => {
|
33
|
+
switch (c) {
|
34
|
+
case "email":
|
35
|
+
return /* @__PURE__ */ e(q, { className: "icon", size: 20 });
|
36
|
+
case "password":
|
37
|
+
return /* @__PURE__ */ e(X, { className: "icon", size: 20 });
|
38
|
+
case "search":
|
39
|
+
return /* @__PURE__ */ e(T, { className: "icon", size: 20 });
|
40
|
+
case "checkmark":
|
41
|
+
return /* @__PURE__ */ e(R, { className: "icon", size: 20 });
|
42
|
+
default:
|
43
|
+
return /* @__PURE__ */ e(b, {});
|
44
|
+
}
|
45
|
+
};
|
46
|
+
return /* @__PURE__ */ m(
|
47
|
+
"div",
|
48
|
+
{
|
49
|
+
className: `text-input
|
50
|
+
${p}
|
51
|
+
${N && "invalid"}
|
52
|
+
${r && "clearable"}`,
|
53
|
+
children: [
|
54
|
+
t && /* @__PURE__ */ e("label", { children: t }),
|
55
|
+
/* @__PURE__ */ m("div", { className: `input-container ${c ? `has-icon icon-${c}` : ""}`, children: [
|
56
|
+
/* @__PURE__ */ e(
|
57
|
+
"input",
|
58
|
+
{
|
59
|
+
onBlur: $,
|
60
|
+
type: f,
|
61
|
+
value: u,
|
62
|
+
onChange: j,
|
63
|
+
placeholder: h,
|
64
|
+
name: I,
|
65
|
+
id: v,
|
66
|
+
disabled: x,
|
67
|
+
ref: w,
|
68
|
+
onFocus: k,
|
69
|
+
onKeyDown: z
|
70
|
+
}
|
71
|
+
),
|
72
|
+
S(),
|
73
|
+
r && u && !i && /* @__PURE__ */ e("div", { className: "clear-value", onClick: L, children: /* @__PURE__ */ e(F, { size: 20 }) }),
|
74
|
+
i && /* @__PURE__ */ e(B, {})
|
75
|
+
] }),
|
76
|
+
l && /* @__PURE__ */ e("span", { className: "helper-text", children: l })
|
77
|
+
]
|
78
|
+
}
|
79
|
+
);
|
80
|
+
}
|
81
|
+
);
|
82
|
+
D.displayName = "TextInput";
|
83
|
+
export {
|
84
|
+
D as TextInput
|
85
|
+
};
|