@efficiency-point/design-system 0.0.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/README.md +334 -0
- package/dist/components/DSBadge/DSBadge.d.ts +13 -0
- package/dist/components/DSBadge/DSBadge.d.ts.map +1 -0
- package/dist/components/DSButton/DSButton.d.ts +12 -0
- package/dist/components/DSButton/DSButton.d.ts.map +1 -0
- package/dist/components/DSCheckbox/DSCheckbox.d.ts +20 -0
- package/dist/components/DSCheckbox/DSCheckbox.d.ts.map +1 -0
- package/dist/components/DSDataTable/DSDataTable.d.ts +48 -0
- package/dist/components/DSDataTable/DSDataTable.d.ts.map +1 -0
- package/dist/components/DSDateRange/DSDateRange.d.ts +28 -0
- package/dist/components/DSDateRange/DSDateRange.d.ts.map +1 -0
- package/dist/components/DSDateTimePicker/DSDateTimePicker.d.ts +21 -0
- package/dist/components/DSDateTimePicker/DSDateTimePicker.d.ts.map +1 -0
- package/dist/components/DSDropDown/DSDropDown.d.ts +25 -0
- package/dist/components/DSDropDown/DSDropDown.d.ts.map +1 -0
- package/dist/components/DSDropDownMultiple/DSDropDownMultiple.d.ts +19 -0
- package/dist/components/DSDropDownMultiple/DSDropDownMultiple.d.ts.map +1 -0
- package/dist/components/DSFilters/DSFilters.d.ts +54 -0
- package/dist/components/DSFilters/DSFilters.d.ts.map +1 -0
- package/dist/components/DSIcon/DSIcon.d.ts +8 -0
- package/dist/components/DSIcon/DSIcon.d.ts.map +1 -0
- package/dist/components/DSInfoBlock/DSInfoBlock.d.ts +12 -0
- package/dist/components/DSInfoBlock/DSInfoBlock.d.ts.map +1 -0
- package/dist/components/DSInput/DSInput.d.ts +28 -0
- package/dist/components/DSInput/DSInput.d.ts.map +1 -0
- package/dist/components/DSLoader/DSLoader.d.ts +9 -0
- package/dist/components/DSLoader/DSLoader.d.ts.map +1 -0
- package/dist/components/DSModal/DSModal.d.ts +7 -0
- package/dist/components/DSModal/DSModal.d.ts.map +1 -0
- package/dist/components/DSModal/ModalSystemProvider.d.ts +9 -0
- package/dist/components/DSModal/ModalSystemProvider.d.ts.map +1 -0
- package/dist/components/DSModal/builtins.d.ts +34 -0
- package/dist/components/DSModal/builtins.d.ts.map +1 -0
- package/dist/components/DSModal/modal.store.d.ts +15 -0
- package/dist/components/DSModal/modal.store.d.ts.map +1 -0
- package/dist/components/DSModal/modal.types.d.ts +30 -0
- package/dist/components/DSModal/modal.types.d.ts.map +1 -0
- package/dist/components/DSModal/useModals.d.ts +12 -0
- package/dist/components/DSModal/useModals.d.ts.map +1 -0
- package/dist/components/DSPageLoader/DSPageLoader.d.ts +6 -0
- package/dist/components/DSPageLoader/DSPageLoader.d.ts.map +1 -0
- package/dist/components/DSRadioButton/DSRadioButton.d.ts +13 -0
- package/dist/components/DSRadioButton/DSRadioButton.d.ts.map +1 -0
- package/dist/components/DSSkeleton/DSSkeleton.d.ts +12 -0
- package/dist/components/DSSkeleton/DSSkeleton.d.ts.map +1 -0
- package/dist/components/DSSort/DSSort.d.ts +23 -0
- package/dist/components/DSSort/DSSort.d.ts.map +1 -0
- package/dist/components/DSTimePeriodPicker/DSTimePeriodPicker.d.ts +23 -0
- package/dist/components/DSTimePeriodPicker/DSTimePeriodPicker.d.ts.map +1 -0
- package/dist/components/DSToast/DSToast.d.ts +7 -0
- package/dist/components/DSToast/DSToast.d.ts.map +1 -0
- package/dist/components/DSToast/DSToastProvider.d.ts +5 -0
- package/dist/components/DSToast/DSToastProvider.d.ts.map +1 -0
- package/dist/components/DSToast/toast.store.d.ts +10 -0
- package/dist/components/DSToast/toast.store.d.ts.map +1 -0
- package/dist/components/DSToast/toast.types.d.ts +18 -0
- package/dist/components/DSToast/toast.types.d.ts.map +1 -0
- package/dist/components/DSToast/useToast.d.ts +12 -0
- package/dist/components/DSToast/useToast.d.ts.map +1 -0
- package/dist/components/DSTooltip/DSTooltip.d.ts +13 -0
- package/dist/components/DSTooltip/DSTooltip.d.ts.map +1 -0
- package/dist/components/DSVideoPlayerFrame/DSVideoPlayerFrame.d.ts +25 -0
- package/dist/components/DSVideoPlayerFrame/DSVideoPlayerFrame.d.ts.map +1 -0
- package/dist/components/Field/DSField.d.ts +18 -0
- package/dist/components/Field/DSField.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +1411 -0
- package/dist/style.css +2 -0
- package/package.json +88 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1411 @@
|
|
|
1
|
+
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement as r, forwardRef as i, isValidElement as a, useEffect as o, useId as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { createColumnHelper as d, createSortedRowModel as f, rowSortingFeature as p, tableFeatures as m, useTable as h } from "@tanstack/react-table";
|
|
4
|
+
import { createPortal as g } from "react-dom";
|
|
5
|
+
import { create as _ } from "zustand";
|
|
6
|
+
var v = {
|
|
7
|
+
badge: "_badge_l4qbw_1",
|
|
8
|
+
sm: "_sm_l4qbw_2",
|
|
9
|
+
md: "_md_l4qbw_3",
|
|
10
|
+
neutral: "_neutral_l4qbw_4",
|
|
11
|
+
info: "_info_l4qbw_5",
|
|
12
|
+
success: "_success_l4qbw_6",
|
|
13
|
+
warning: "_warning_l4qbw_7",
|
|
14
|
+
error: "_error_l4qbw_8",
|
|
15
|
+
dot: "_dot_l4qbw_9",
|
|
16
|
+
icon: "_icon_l4qbw_10",
|
|
17
|
+
label: "_label_l4qbw_11"
|
|
18
|
+
}, y = ({ children: e, variant: r = "neutral", size: i = "md", dot: a = !1, icon: o, className: s = "" }) => /* @__PURE__ */ n("span", {
|
|
19
|
+
className: `${v.badge} ${v[r]} ${v[i]} ${s}`,
|
|
20
|
+
children: [
|
|
21
|
+
a && /* @__PURE__ */ t("span", {
|
|
22
|
+
className: v.dot,
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}),
|
|
25
|
+
o && /* @__PURE__ */ t("span", {
|
|
26
|
+
className: v.icon,
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: o
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ t("span", {
|
|
31
|
+
className: v.label,
|
|
32
|
+
children: e
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
}), b = {
|
|
36
|
+
loader: "_loader_pslm9_1",
|
|
37
|
+
"ds-spin": "_ds-spin_pslm9_1",
|
|
38
|
+
primary: "_primary_pslm9_11",
|
|
39
|
+
secondary: "_secondary_pslm9_12",
|
|
40
|
+
light: "_light_pslm9_13",
|
|
41
|
+
danger: "_danger_pslm9_14"
|
|
42
|
+
}, x = ({ variant: e = "primary", label: n = "Загрузка", className: r = "", decorative: i = !1 }) => /* @__PURE__ */ t("span", {
|
|
43
|
+
className: `${b.loader} ${b[e]} ${r}`,
|
|
44
|
+
role: i ? void 0 : "status",
|
|
45
|
+
"aria-label": i ? void 0 : n,
|
|
46
|
+
"aria-hidden": i || void 0
|
|
47
|
+
}), S = {
|
|
48
|
+
button: "_button_3nz3z_1",
|
|
49
|
+
sm: "_sm_3nz3z_16",
|
|
50
|
+
md: "_md_3nz3z_17",
|
|
51
|
+
lg: "_lg_3nz3z_18",
|
|
52
|
+
primary: "_primary_3nz3z_19",
|
|
53
|
+
secondary: "_secondary_3nz3z_20",
|
|
54
|
+
outline: "_outline_3nz3z_21",
|
|
55
|
+
ghost: "_ghost_3nz3z_22",
|
|
56
|
+
empty: "_empty_3nz3z_22",
|
|
57
|
+
destructive: "_destructive_3nz3z_23",
|
|
58
|
+
destructiveOutline: "_destructiveOutline_3nz3z_24"
|
|
59
|
+
}, C = i(({ children: e, variant: n = "primary", size: r = "md", isLoading: i = !1, loadingLabel: a = "Загрузка", disabled: o, type: s = "button", className: c = "", ...l }, u) => /* @__PURE__ */ t("button", {
|
|
60
|
+
ref: u,
|
|
61
|
+
type: s,
|
|
62
|
+
className: `${S.button} ${S[n]} ${S[r]} ${c}`,
|
|
63
|
+
disabled: o || i,
|
|
64
|
+
"aria-busy": i || void 0,
|
|
65
|
+
...l,
|
|
66
|
+
children: i ? /* @__PURE__ */ t(x, {
|
|
67
|
+
variant: "light",
|
|
68
|
+
label: a
|
|
69
|
+
}) : e
|
|
70
|
+
}));
|
|
71
|
+
C.displayName = "DSButton";
|
|
72
|
+
var w = {
|
|
73
|
+
label: "_label_5v0ym_1",
|
|
74
|
+
required: "_required_5v0ym_12",
|
|
75
|
+
error: "_error_5v0ym_13",
|
|
76
|
+
optional: "_optional_5v0ym_17",
|
|
77
|
+
hint: "_hint_5v0ym_18",
|
|
78
|
+
disabled: "_disabled_5v0ym_24",
|
|
79
|
+
message: "_message_5v0ym_28",
|
|
80
|
+
success: "_success_5v0ym_36"
|
|
81
|
+
}, T = ({ children: e, required: r = !1, optionalText: i, disabled: a = !1, className: o = "", ...s }) => /* @__PURE__ */ n("label", {
|
|
82
|
+
className: `${w.label} ${a ? w.disabled : ""} ${o}`,
|
|
83
|
+
...s,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ t("span", { children: e }),
|
|
86
|
+
r && /* @__PURE__ */ t("span", {
|
|
87
|
+
className: w.required,
|
|
88
|
+
"aria-hidden": "true",
|
|
89
|
+
children: "*"
|
|
90
|
+
}),
|
|
91
|
+
i && /* @__PURE__ */ t("span", {
|
|
92
|
+
className: w.optional,
|
|
93
|
+
children: i
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}), E = ({ children: e, variant: n = "hint", id: r, live: i = !1, className: a = "" }) => /* @__PURE__ */ t("span", {
|
|
97
|
+
id: r,
|
|
98
|
+
className: `${w.message} ${w[n]} ${a}`,
|
|
99
|
+
role: i && n === "error" ? "alert" : void 0,
|
|
100
|
+
"aria-live": i && n !== "error" ? "polite" : void 0,
|
|
101
|
+
children: e
|
|
102
|
+
}), D = {
|
|
103
|
+
wrapper: "_wrapper_1l5cg_1",
|
|
104
|
+
label: "_label_1l5cg_2",
|
|
105
|
+
input: "_input_1l5cg_3",
|
|
106
|
+
control: "_control_1l5cg_4",
|
|
107
|
+
disabled: "_disabled_1l5cg_7",
|
|
108
|
+
controlError: "_controlError_1l5cg_9"
|
|
109
|
+
}, O = ({ checked: e, onChange: r, label: i, hint: a, error: c, disabled: u = !1, readOnly: d = !1, className: f = "", name: p, id: m, indeterminate: h = !1, ...g }) => {
|
|
110
|
+
let _ = s(), v = m ?? `ds-checkbox-${p ?? _}`, y = l(null), b = a ? `${v}-hint` : void 0, x = c ? `${v}-error` : void 0;
|
|
111
|
+
return o(() => {
|
|
112
|
+
y.current && (y.current.indeterminate = h && !e);
|
|
113
|
+
}, [e, h]), /* @__PURE__ */ n("div", {
|
|
114
|
+
className: `${D.wrapper} ${f}`,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ n("label", {
|
|
117
|
+
className: `${D.label} ${u ? D.disabled : ""}`,
|
|
118
|
+
htmlFor: v,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ t("input", {
|
|
121
|
+
ref: y,
|
|
122
|
+
id: v,
|
|
123
|
+
name: p,
|
|
124
|
+
type: "checkbox",
|
|
125
|
+
checked: e,
|
|
126
|
+
disabled: u,
|
|
127
|
+
"aria-readonly": d || void 0,
|
|
128
|
+
"aria-invalid": !!c,
|
|
129
|
+
"aria-describedby": [b, x].filter(Boolean).join(" ") || void 0,
|
|
130
|
+
className: D.input,
|
|
131
|
+
onChange: (e) => {
|
|
132
|
+
d || r?.(e.target.checked, e);
|
|
133
|
+
},
|
|
134
|
+
...g
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ t("span", {
|
|
137
|
+
className: `${D.control} ${c ? D.controlError : ""}`,
|
|
138
|
+
"aria-hidden": "true",
|
|
139
|
+
children: h && !e ? "−" : e ? "✓" : ""
|
|
140
|
+
}),
|
|
141
|
+
i && /* @__PURE__ */ t("span", { children: i })
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
a && !c && /* @__PURE__ */ t(E, {
|
|
145
|
+
id: b,
|
|
146
|
+
children: a
|
|
147
|
+
}),
|
|
148
|
+
c && /* @__PURE__ */ t(E, {
|
|
149
|
+
id: x,
|
|
150
|
+
variant: "error",
|
|
151
|
+
children: c
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
}, k = {
|
|
156
|
+
wrapper: "_wrapper_1kr9x_1",
|
|
157
|
+
input: "_input_1kr9x_2",
|
|
158
|
+
error: "_error_1kr9x_5"
|
|
159
|
+
}, A = (e) => String(e).padStart(2, "0"), j = (e, t) => {
|
|
160
|
+
if (!e) return "";
|
|
161
|
+
let n = `${e.getFullYear()}-${A(e.getMonth() + 1)}-${A(e.getDate())}`, r = `${A(e.getHours())}:${A(e.getMinutes())}`;
|
|
162
|
+
return t === "date" ? n : t === "time" ? r : `${n}T${r}`;
|
|
163
|
+
}, M = (e, t) => {
|
|
164
|
+
if (!e) return null;
|
|
165
|
+
if (t === "time") {
|
|
166
|
+
let [t, n] = e.split(":").map(Number), r = /* @__PURE__ */ new Date();
|
|
167
|
+
return r.setHours(t ?? 0, n ?? 0, 0, 0), r;
|
|
168
|
+
}
|
|
169
|
+
let n = new Date(t === "date" ? `${e}T00:00` : e);
|
|
170
|
+
return Number.isNaN(n.getTime()) ? null : n;
|
|
171
|
+
}, N = ({ value: e, onChange: r, mode: i = "date", label: a, hint: o, error: c, disabled: l = !1, readOnly: u = !1, required: d = !1, min: f, max: p, id: m, name: h, className: g = "" }) => {
|
|
172
|
+
let _ = s(), v = m ?? `ds-date-time-${h ?? _}`, y = o ? `${v}-hint` : void 0, b = c ? `${v}-error` : void 0, x = i === "datetime" ? "datetime-local" : i;
|
|
173
|
+
return /* @__PURE__ */ n("div", {
|
|
174
|
+
className: `${k.wrapper} ${g}`,
|
|
175
|
+
children: [
|
|
176
|
+
a && /* @__PURE__ */ t(T, {
|
|
177
|
+
htmlFor: v,
|
|
178
|
+
required: d,
|
|
179
|
+
disabled: l,
|
|
180
|
+
children: a
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ t("input", {
|
|
183
|
+
id: v,
|
|
184
|
+
name: h,
|
|
185
|
+
type: x,
|
|
186
|
+
value: j(e, i),
|
|
187
|
+
min: j(f ?? null, i) || void 0,
|
|
188
|
+
max: j(p ?? null, i) || void 0,
|
|
189
|
+
disabled: l,
|
|
190
|
+
readOnly: u,
|
|
191
|
+
required: d,
|
|
192
|
+
"aria-invalid": !!c,
|
|
193
|
+
"aria-describedby": [y, b].filter(Boolean).join(" ") || void 0,
|
|
194
|
+
className: `${k.input} ${c ? k.error : ""}`,
|
|
195
|
+
onChange: (e) => r?.(M(e.target.value, i)),
|
|
196
|
+
onKeyDown: (e) => {
|
|
197
|
+
e.key === "Escape" && e.currentTarget.blur();
|
|
198
|
+
}
|
|
199
|
+
}),
|
|
200
|
+
o && !c && /* @__PURE__ */ t(E, {
|
|
201
|
+
id: y,
|
|
202
|
+
children: o
|
|
203
|
+
}),
|
|
204
|
+
c && /* @__PURE__ */ t(E, {
|
|
205
|
+
id: b,
|
|
206
|
+
variant: "error",
|
|
207
|
+
children: c
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
}, P = {
|
|
212
|
+
root: "_root_9h2e2_1",
|
|
213
|
+
legend: "_legend_9h2e2_2",
|
|
214
|
+
range: "_range_9h2e2_3"
|
|
215
|
+
}, F = (e) => !!(e.from && e.to && e.from.getTime() <= e.to.getTime()), ee = ({ value: e, onChange: r, onDraftChange: i, mode: a = "date", fromLabel: o = "От", toLabel: s = "До", hint: c, error: l, min: u, max: d, disabled: f = !1, readOnly: p = !1, required: m = !1, className: h = "" }) => {
|
|
216
|
+
let g = l ?? (e.from && e.to && e.from > e.to ? "Дата «От» не может быть позже даты «До»" : void 0), _ = (e) => {
|
|
217
|
+
i?.(e), F(e) && r?.(e);
|
|
218
|
+
};
|
|
219
|
+
return /* @__PURE__ */ n("fieldset", {
|
|
220
|
+
className: `${P.root} ${h}`,
|
|
221
|
+
disabled: f,
|
|
222
|
+
children: [/* @__PURE__ */ n("div", {
|
|
223
|
+
className: P.range,
|
|
224
|
+
children: [/* @__PURE__ */ t(N, {
|
|
225
|
+
value: e.from,
|
|
226
|
+
mode: a === "datetime" ? "datetime" : a,
|
|
227
|
+
label: o,
|
|
228
|
+
min: u,
|
|
229
|
+
max: e.to ?? d,
|
|
230
|
+
disabled: f,
|
|
231
|
+
readOnly: p,
|
|
232
|
+
required: m,
|
|
233
|
+
error: g,
|
|
234
|
+
onChange: (t) => _({
|
|
235
|
+
...e,
|
|
236
|
+
from: t
|
|
237
|
+
})
|
|
238
|
+
}), /* @__PURE__ */ t(N, {
|
|
239
|
+
value: e.to,
|
|
240
|
+
mode: a === "datetime" ? "datetime" : a,
|
|
241
|
+
label: s,
|
|
242
|
+
min: e.from ?? u,
|
|
243
|
+
max: d,
|
|
244
|
+
disabled: f,
|
|
245
|
+
readOnly: p,
|
|
246
|
+
required: m,
|
|
247
|
+
error: g,
|
|
248
|
+
onChange: (t) => _({
|
|
249
|
+
...e,
|
|
250
|
+
to: t
|
|
251
|
+
})
|
|
252
|
+
})]
|
|
253
|
+
}), c && !g && /* @__PURE__ */ t(E, { children: c })]
|
|
254
|
+
});
|
|
255
|
+
}, I = {
|
|
256
|
+
group: "_group_1st6r_1",
|
|
257
|
+
skeleton: "_skeleton_1st6r_2",
|
|
258
|
+
text: "_text_1st6r_3",
|
|
259
|
+
rectangular: "_rectangular_1st6r_4",
|
|
260
|
+
circular: "_circular_1st6r_5",
|
|
261
|
+
animated: "_animated_1st6r_6",
|
|
262
|
+
"ds-skeleton": "_ds-skeleton_1st6r_1"
|
|
263
|
+
}, L = ({ variant: e = "text", width: n = "100%", height: r, lines: i = 1, animated: a = !0, className: o = "" }) => /* @__PURE__ */ t("span", {
|
|
264
|
+
className: `${I.group} ${o}`,
|
|
265
|
+
"aria-hidden": "true",
|
|
266
|
+
children: Array.from({ length: Math.max(1, i) }, (o, s) => /* @__PURE__ */ t("span", {
|
|
267
|
+
className: `${I.skeleton} ${I[e]} ${a ? I.animated : ""}`,
|
|
268
|
+
style: {
|
|
269
|
+
width: s === i - 1 && i > 1 ? "70%" : n,
|
|
270
|
+
height: r
|
|
271
|
+
}
|
|
272
|
+
}, s))
|
|
273
|
+
}), R = {
|
|
274
|
+
wrapper: "_wrapper_dkn63_1",
|
|
275
|
+
label: "_label_dkn63_17",
|
|
276
|
+
container: "_container_dkn63_29",
|
|
277
|
+
trigger: "_trigger_dkn63_37",
|
|
278
|
+
disabledText: "_disabledText_dkn63_39",
|
|
279
|
+
value: "_value_dkn63_109",
|
|
280
|
+
placeholder: "_placeholder_dkn63_111",
|
|
281
|
+
chevron: "_chevron_dkn63_137",
|
|
282
|
+
chevronOpen: "_chevronOpen_dkn63_163",
|
|
283
|
+
menu: "_menu_dkn63_171",
|
|
284
|
+
option: "_option_dkn63_207",
|
|
285
|
+
selected: "_selected_dkn63_245",
|
|
286
|
+
message: "_message_dkn63_265",
|
|
287
|
+
error: "_error_dkn63_267",
|
|
288
|
+
errorState: "_errorState_dkn63_293"
|
|
289
|
+
}, z = (e, t, n) => {
|
|
290
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
291
|
+
let i = (t + r * n + e.length) % e.length;
|
|
292
|
+
if (!e[i]?.disabled) return i;
|
|
293
|
+
}
|
|
294
|
+
return -1;
|
|
295
|
+
}, B = ({ options: r, value: i, onChange: a, placeholder: d = "Выберите опцию", disabled: f = !1, stringWhileDisabled: p = !1, label: m, error: h, hint: g, className: _ = "", name: v, id: y, needMark: b = !0, maxMenuHeight: x }) => {
|
|
296
|
+
let S = s(), C = y ?? `ds-dropdown-${v ?? S}`, [w, T] = u(!1), E = l(null), D = l(null), O = l([]), k = c(() => r.find((e) => e.value === i), [r, i]), A = g ? `${C}-hint` : void 0, j = h ? `${C}-error` : void 0, M = [A, j].filter(Boolean).join(" ") || void 0, N = f && p;
|
|
297
|
+
o(() => {
|
|
298
|
+
let e = (e) => {
|
|
299
|
+
E.current?.contains(e.target) || T(!1);
|
|
300
|
+
}, t = (e) => {
|
|
301
|
+
e.key === "Escape" && w && (T(!1), D.current?.focus());
|
|
302
|
+
};
|
|
303
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
304
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
305
|
+
};
|
|
306
|
+
}, [w]);
|
|
307
|
+
let P = (e, t) => {
|
|
308
|
+
let n = z(r, e, t);
|
|
309
|
+
O.current[n]?.focus(), O.current[n]?.scrollIntoView({ block: "nearest" });
|
|
310
|
+
}, F = (e) => {
|
|
311
|
+
e.disabled || (a?.(e.value, e), T(!1), D.current?.focus());
|
|
312
|
+
};
|
|
313
|
+
return /* @__PURE__ */ n("div", {
|
|
314
|
+
ref: E,
|
|
315
|
+
className: [
|
|
316
|
+
R.wrapper,
|
|
317
|
+
h ? R.errorState : "",
|
|
318
|
+
_
|
|
319
|
+
].filter(Boolean).join(" "),
|
|
320
|
+
children: [
|
|
321
|
+
m && /* @__PURE__ */ t("label", {
|
|
322
|
+
htmlFor: N ? void 0 : C,
|
|
323
|
+
className: R.label,
|
|
324
|
+
children: m
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ t("div", {
|
|
327
|
+
className: R.container,
|
|
328
|
+
children: N ? /* @__PURE__ */ t("div", {
|
|
329
|
+
id: C,
|
|
330
|
+
className: R.disabledText,
|
|
331
|
+
"aria-describedby": M,
|
|
332
|
+
children: k?.label ?? d
|
|
333
|
+
}) : /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ n("button", {
|
|
334
|
+
ref: D,
|
|
335
|
+
id: C,
|
|
336
|
+
type: "button",
|
|
337
|
+
name: v,
|
|
338
|
+
className: R.trigger,
|
|
339
|
+
disabled: f,
|
|
340
|
+
"aria-haspopup": "listbox",
|
|
341
|
+
"aria-expanded": w,
|
|
342
|
+
"aria-controls": `${C}-listbox`,
|
|
343
|
+
"aria-describedby": M,
|
|
344
|
+
"aria-invalid": !!h,
|
|
345
|
+
onClick: () => T((e) => !e),
|
|
346
|
+
onKeyDown: (e) => {
|
|
347
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
348
|
+
e.preventDefault(), T(!0);
|
|
349
|
+
let t = e.key === "ArrowDown" ? 1 : -1;
|
|
350
|
+
requestAnimationFrame(() => P(e.key === "ArrowDown" ? 0 : r.length - 1, t));
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
children: [/* @__PURE__ */ t("span", {
|
|
354
|
+
className: k ? R.value : R.placeholder,
|
|
355
|
+
children: k?.label ?? d
|
|
356
|
+
}), /* @__PURE__ */ t("span", {
|
|
357
|
+
className: `${R.chevron} ${w ? R.chevronOpen : ""}`,
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
children: /* @__PURE__ */ t("svg", {
|
|
360
|
+
viewBox: "0 0 20 20",
|
|
361
|
+
fill: "none",
|
|
362
|
+
children: /* @__PURE__ */ t("path", {
|
|
363
|
+
d: "M5 7.5L10 12.5L15 7.5",
|
|
364
|
+
stroke: "currentColor",
|
|
365
|
+
strokeWidth: "1.8",
|
|
366
|
+
strokeLinecap: "round",
|
|
367
|
+
strokeLinejoin: "round"
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
})]
|
|
371
|
+
}), w && /* @__PURE__ */ t("ul", {
|
|
372
|
+
id: `${C}-listbox`,
|
|
373
|
+
className: R.menu,
|
|
374
|
+
role: "listbox",
|
|
375
|
+
"aria-label": m,
|
|
376
|
+
style: { maxHeight: x },
|
|
377
|
+
children: r.map((e, a) => {
|
|
378
|
+
let o = e.value === i;
|
|
379
|
+
return /* @__PURE__ */ t("li", {
|
|
380
|
+
role: "presentation",
|
|
381
|
+
children: /* @__PURE__ */ n("button", {
|
|
382
|
+
ref: (e) => {
|
|
383
|
+
O.current[a] = e;
|
|
384
|
+
},
|
|
385
|
+
type: "button",
|
|
386
|
+
role: "option",
|
|
387
|
+
"aria-selected": o,
|
|
388
|
+
disabled: e.disabled,
|
|
389
|
+
className: `${R.option} ${o ? R.selected : ""}`,
|
|
390
|
+
onClick: () => F(e),
|
|
391
|
+
onKeyDown: (e) => {
|
|
392
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), P(a + (e.key === "ArrowDown" ? 1 : -1), e.key === "ArrowDown" ? 1 : -1)), e.key === "Tab" && T(!1), e.key === "Home" || e.key === "End") {
|
|
393
|
+
e.preventDefault();
|
|
394
|
+
let t = e.key === "Home" ? 1 : -1;
|
|
395
|
+
P(e.key === "Home" ? 0 : r.length - 1, t);
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
children: [/* @__PURE__ */ t("span", { children: e.label }), o && b && /* @__PURE__ */ t("span", {
|
|
399
|
+
"aria-hidden": "true",
|
|
400
|
+
children: "✓"
|
|
401
|
+
})]
|
|
402
|
+
})
|
|
403
|
+
}, e.value);
|
|
404
|
+
})
|
|
405
|
+
})] })
|
|
406
|
+
}),
|
|
407
|
+
g && !h && /* @__PURE__ */ t("span", {
|
|
408
|
+
id: A,
|
|
409
|
+
className: R.message,
|
|
410
|
+
children: g
|
|
411
|
+
}),
|
|
412
|
+
h && /* @__PURE__ */ t("span", {
|
|
413
|
+
id: j,
|
|
414
|
+
className: R.error,
|
|
415
|
+
children: h
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
});
|
|
419
|
+
}, V = (e) => `${e.id}:${e.direction}`, te = ({ options: e, value: n, onChange: r, label: i = "Сортировка", placeholder: a = "Выберите сортировку", disabled: o = !1, className: s }) => {
|
|
420
|
+
let c = e.flatMap((e) => [{
|
|
421
|
+
value: V({
|
|
422
|
+
id: e.id,
|
|
423
|
+
direction: "asc"
|
|
424
|
+
}),
|
|
425
|
+
label: e.ascLabel ?? `${e.label} · по возрастанию`,
|
|
426
|
+
disabled: e.disabled
|
|
427
|
+
}, {
|
|
428
|
+
value: V({
|
|
429
|
+
id: e.id,
|
|
430
|
+
direction: "desc"
|
|
431
|
+
}),
|
|
432
|
+
label: e.descLabel ?? `${e.label} · по убыванию`,
|
|
433
|
+
disabled: e.disabled
|
|
434
|
+
}]);
|
|
435
|
+
return /* @__PURE__ */ t(B, {
|
|
436
|
+
options: c,
|
|
437
|
+
value: n ? V(n) : "",
|
|
438
|
+
label: i,
|
|
439
|
+
placeholder: a,
|
|
440
|
+
disabled: o,
|
|
441
|
+
className: s,
|
|
442
|
+
onChange: (e) => {
|
|
443
|
+
let t = e.lastIndexOf(":");
|
|
444
|
+
r?.({
|
|
445
|
+
id: e.slice(0, t),
|
|
446
|
+
direction: e.slice(t + 1)
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}, H = {
|
|
451
|
+
root: "_root_i4d62_1",
|
|
452
|
+
tableWrap: "_tableWrap_i4d62_2",
|
|
453
|
+
table: "_table_i4d62_2",
|
|
454
|
+
sticky: "_sticky_i4d62_8",
|
|
455
|
+
sortButton: "_sortButton_i4d62_9",
|
|
456
|
+
state: "_state_i4d62_11",
|
|
457
|
+
cards: "_cards_i4d62_12",
|
|
458
|
+
mobileSort: "_mobileSort_i4d62_12",
|
|
459
|
+
card: "_card_i4d62_12",
|
|
460
|
+
spanTwo: "_spanTwo_i4d62_19",
|
|
461
|
+
default: "_default_i4d62_21",
|
|
462
|
+
tableOnMobile: "_tableOnMobile_i4d62_21",
|
|
463
|
+
wide: "_wide_i4d62_23"
|
|
464
|
+
}, ne = m({
|
|
465
|
+
rowSortingFeature: p,
|
|
466
|
+
sortedRowModel: f()
|
|
467
|
+
}), re = (e, t) => {
|
|
468
|
+
let n = /* @__PURE__ */ new Set();
|
|
469
|
+
for (let t of e) {
|
|
470
|
+
if (!t.id.trim()) return "Идентификатор колонки не может быть пустым";
|
|
471
|
+
if (n.has(t.id)) return `Идентификатор колонки «${t.id}» повторяется`;
|
|
472
|
+
n.add(t.id);
|
|
473
|
+
}
|
|
474
|
+
for (let n = 0; n < t.length; n += 1) for (let r of e) if (typeof r.accessor == "string" && !(r.accessor in t[n])) return `В строке ${n + 1} отсутствует колонка «${r.id}»`;
|
|
475
|
+
return null;
|
|
476
|
+
}, ie = ({ columns: e, data: r, tableOnMobile: i = !1, breakpoint: a = "default", sorting: o, onSortingChange: s, renderMobileCard: l, getRowId: f, caption: p, ariaLabel: m, loading: g = !1, error: _, emptyState: v = "Нет данных", stickyHeader: y = !1, maxHeight: b, className: x = "" }) => {
|
|
477
|
+
let [S, C] = u([]), w = o ?? S, T = c(() => re(e, r), [e, r]), E = c(() => d(), []), D = c(() => E.columns(e.map((e) => {
|
|
478
|
+
let t = e.accessor;
|
|
479
|
+
return E.accessor(typeof t == "function" ? t : (e) => e[t], {
|
|
480
|
+
id: e.id,
|
|
481
|
+
header: () => e.header,
|
|
482
|
+
cell: (t) => e.cell?.(t.row.original, t.getValue()) ?? String(t.getValue() ?? ""),
|
|
483
|
+
enableSorting: !0,
|
|
484
|
+
sortDescFirst: e.sortDescFirst
|
|
485
|
+
});
|
|
486
|
+
})), [e, E]), O = h({
|
|
487
|
+
features: ne,
|
|
488
|
+
columns: D,
|
|
489
|
+
data: r,
|
|
490
|
+
state: { sorting: w },
|
|
491
|
+
onSortingChange: (e) => {
|
|
492
|
+
let t = typeof e == "function" ? e(w) : e;
|
|
493
|
+
o === void 0 && C(t), s?.(t);
|
|
494
|
+
},
|
|
495
|
+
getRowId: f
|
|
496
|
+
}), k = O.getRowModel().rows, A = e.map((e) => ({
|
|
497
|
+
id: e.id,
|
|
498
|
+
label: typeof e.header == "string" ? e.header : e.id
|
|
499
|
+
})), j = [
|
|
500
|
+
H.root,
|
|
501
|
+
a === "wide" ? H.wide : H.default,
|
|
502
|
+
i ? H.tableOnMobile : "",
|
|
503
|
+
x
|
|
504
|
+
].filter(Boolean).join(" "), M = T ?? _;
|
|
505
|
+
return /* @__PURE__ */ n("section", {
|
|
506
|
+
className: j,
|
|
507
|
+
"aria-busy": g,
|
|
508
|
+
children: [
|
|
509
|
+
!i && !g && !M && k.length > 0 && /* @__PURE__ */ t(te, {
|
|
510
|
+
className: H.mobileSort,
|
|
511
|
+
options: A,
|
|
512
|
+
value: w[0] ? {
|
|
513
|
+
id: w[0].id,
|
|
514
|
+
direction: w[0].desc ? "desc" : "asc"
|
|
515
|
+
} : null,
|
|
516
|
+
onChange: (e) => O.setSorting([{
|
|
517
|
+
id: e.id,
|
|
518
|
+
desc: e.direction === "desc"
|
|
519
|
+
}])
|
|
520
|
+
}),
|
|
521
|
+
/* @__PURE__ */ t("div", {
|
|
522
|
+
className: H.tableWrap,
|
|
523
|
+
style: { maxHeight: b },
|
|
524
|
+
children: /* @__PURE__ */ n("table", {
|
|
525
|
+
className: H.table,
|
|
526
|
+
"aria-label": m,
|
|
527
|
+
children: [
|
|
528
|
+
p && /* @__PURE__ */ t("caption", { children: p }),
|
|
529
|
+
/* @__PURE__ */ t("thead", {
|
|
530
|
+
className: y ? H.sticky : "",
|
|
531
|
+
children: O.getHeaderGroups().map((e) => /* @__PURE__ */ t("tr", { children: e.headers.map((e) => {
|
|
532
|
+
let r = e.column.getIsSorted();
|
|
533
|
+
return /* @__PURE__ */ t("th", {
|
|
534
|
+
scope: "col",
|
|
535
|
+
"aria-sort": r === "asc" ? "ascending" : r === "desc" ? "descending" : "none",
|
|
536
|
+
children: /* @__PURE__ */ n("button", {
|
|
537
|
+
type: "button",
|
|
538
|
+
className: H.sortButton,
|
|
539
|
+
onClick: e.column.getToggleSortingHandler(),
|
|
540
|
+
children: [/* @__PURE__ */ t(O.FlexRender, { header: e }), /* @__PURE__ */ t("span", {
|
|
541
|
+
"aria-hidden": "true",
|
|
542
|
+
children: r === "asc" ? "↑" : r === "desc" ? "↓" : "↕"
|
|
543
|
+
})]
|
|
544
|
+
})
|
|
545
|
+
}, e.id);
|
|
546
|
+
}) }, e.id))
|
|
547
|
+
}),
|
|
548
|
+
/* @__PURE__ */ t("tbody", { children: g ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
549
|
+
colSpan: e.length,
|
|
550
|
+
children: /* @__PURE__ */ t(L, { lines: 3 })
|
|
551
|
+
}) }) : M ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
552
|
+
className: H.state,
|
|
553
|
+
colSpan: e.length,
|
|
554
|
+
children: M
|
|
555
|
+
}) }) : k.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
556
|
+
className: H.state,
|
|
557
|
+
colSpan: e.length,
|
|
558
|
+
children: v
|
|
559
|
+
}) }) : k.map((e) => /* @__PURE__ */ t("tr", { children: e.getAllCells().map((e) => /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(O.FlexRender, { cell: e }) }, e.id)) }, e.id)) })
|
|
560
|
+
]
|
|
561
|
+
})
|
|
562
|
+
}),
|
|
563
|
+
!i && /* @__PURE__ */ t("div", {
|
|
564
|
+
className: H.cards,
|
|
565
|
+
role: "list",
|
|
566
|
+
"aria-label": m ?? p,
|
|
567
|
+
children: g ? /* @__PURE__ */ t(L, { lines: 4 }) : M ? /* @__PURE__ */ t("div", {
|
|
568
|
+
className: H.state,
|
|
569
|
+
children: M
|
|
570
|
+
}) : k.length === 0 ? /* @__PURE__ */ t("div", {
|
|
571
|
+
className: H.state,
|
|
572
|
+
children: v
|
|
573
|
+
}) : k.map((r) => {
|
|
574
|
+
if (l) return /* @__PURE__ */ t("div", {
|
|
575
|
+
role: "listitem",
|
|
576
|
+
children: l({
|
|
577
|
+
row: r.original,
|
|
578
|
+
columns: e
|
|
579
|
+
})
|
|
580
|
+
}, r.id);
|
|
581
|
+
let i = e.filter((e) => !e.mobile?.hideOnMobile).sort((e, t) => (e.mobile?.mobileOrder ?? 0) - (t.mobile?.mobileOrder ?? 0)), a = i.find((e) => e.mobile?.primary) ?? i.find((e) => e.mobile?.mobileVariant !== "actions"), o = (e) => typeof e.accessor == "function" ? e.accessor(r.original) : r.original[e.accessor], s = (e) => e.mobile?.renderMobile?.(r.original, o(e)) ?? e.cell?.(r.original, o(e)) ?? String(o(e) ?? "");
|
|
582
|
+
return /* @__PURE__ */ n("article", {
|
|
583
|
+
role: "listitem",
|
|
584
|
+
className: H.card,
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ t("h3", { children: a ? s(a) : `Строка ${r.index + 1}` }),
|
|
587
|
+
/* @__PURE__ */ t("dl", { children: i.filter((e) => e !== a && e.mobile?.mobileVariant !== "actions").map((e) => /* @__PURE__ */ n("div", {
|
|
588
|
+
className: e.mobile?.mobileSpan === 2 ? H.spanTwo : "",
|
|
589
|
+
children: [/* @__PURE__ */ t("dt", { children: e.mobile?.mobileLabel ?? e.header }), /* @__PURE__ */ t("dd", { children: s(e) })]
|
|
590
|
+
}, e.id)) }),
|
|
591
|
+
i.filter((e) => e.mobile?.mobileVariant === "actions").map((e) => /* @__PURE__ */ t("footer", { children: s(e) }, e.id))
|
|
592
|
+
]
|
|
593
|
+
}, r.id);
|
|
594
|
+
})
|
|
595
|
+
})
|
|
596
|
+
]
|
|
597
|
+
});
|
|
598
|
+
}, ae = ({ options: e, value: r, onChange: i, placeholder: a = "Выберите опции", disabled: d = !1, label: f, error: p, hint: m, className: h = "", name: g, id: _, closeOnSelect: v = !1, maxMenuHeight: y }) => {
|
|
599
|
+
let b = s(), x = _ ?? `ds-dropdown-multiple-${g ?? b}`, [S, C] = u(!1), w = l(null), T = l(null), E = l([]), D = c(() => e.filter((e) => r.includes(e.value)), [e, r]), O = D.map((e) => e.label).join(", "), k = m ? `${x}-hint` : void 0, A = p ? `${x}-error` : void 0;
|
|
600
|
+
o(() => {
|
|
601
|
+
let e = (e) => {
|
|
602
|
+
w.current?.contains(e.target) || C(!1);
|
|
603
|
+
}, t = (e) => {
|
|
604
|
+
e.key === "Escape" && S && (C(!1), T.current?.focus());
|
|
605
|
+
};
|
|
606
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
607
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
608
|
+
};
|
|
609
|
+
}, [S]);
|
|
610
|
+
let j = (t) => {
|
|
611
|
+
if (t.disabled) return;
|
|
612
|
+
let n = r.includes(t.value) ? r.filter((e) => e !== t.value) : [...r, t.value];
|
|
613
|
+
i?.(n, e.filter((e) => n.includes(e.value))), v && (C(!1), T.current?.focus());
|
|
614
|
+
}, M = (t, n) => {
|
|
615
|
+
let r = z(e, t, n);
|
|
616
|
+
E.current[r]?.focus(), E.current[r]?.scrollIntoView({ block: "nearest" });
|
|
617
|
+
};
|
|
618
|
+
return /* @__PURE__ */ n("div", {
|
|
619
|
+
ref: w,
|
|
620
|
+
className: [
|
|
621
|
+
R.wrapper,
|
|
622
|
+
p ? R.errorState : "",
|
|
623
|
+
h
|
|
624
|
+
].filter(Boolean).join(" "),
|
|
625
|
+
children: [
|
|
626
|
+
f && /* @__PURE__ */ t("label", {
|
|
627
|
+
htmlFor: x,
|
|
628
|
+
className: R.label,
|
|
629
|
+
children: f
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ n("div", {
|
|
632
|
+
className: R.container,
|
|
633
|
+
children: [/* @__PURE__ */ n("button", {
|
|
634
|
+
ref: T,
|
|
635
|
+
id: x,
|
|
636
|
+
type: "button",
|
|
637
|
+
name: g,
|
|
638
|
+
className: R.trigger,
|
|
639
|
+
disabled: d,
|
|
640
|
+
"aria-haspopup": "listbox",
|
|
641
|
+
"aria-expanded": S,
|
|
642
|
+
"aria-controls": `${x}-listbox`,
|
|
643
|
+
"aria-describedby": [k, A].filter(Boolean).join(" ") || void 0,
|
|
644
|
+
"aria-invalid": !!p,
|
|
645
|
+
onClick: () => C((e) => !e),
|
|
646
|
+
onKeyDown: (t) => {
|
|
647
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
648
|
+
t.preventDefault(), C(!0);
|
|
649
|
+
let n = t.key === "ArrowDown" ? 1 : -1;
|
|
650
|
+
requestAnimationFrame(() => M(t.key === "ArrowDown" ? 0 : e.length - 1, n));
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
children: [/* @__PURE__ */ t("span", {
|
|
654
|
+
className: D.length ? R.value : R.placeholder,
|
|
655
|
+
children: O || a
|
|
656
|
+
}), /* @__PURE__ */ t("span", {
|
|
657
|
+
className: `${R.chevron} ${S ? R.chevronOpen : ""}`,
|
|
658
|
+
"aria-hidden": "true",
|
|
659
|
+
children: "⌄"
|
|
660
|
+
})]
|
|
661
|
+
}), S && /* @__PURE__ */ t("ul", {
|
|
662
|
+
id: `${x}-listbox`,
|
|
663
|
+
className: R.menu,
|
|
664
|
+
role: "listbox",
|
|
665
|
+
"aria-label": f,
|
|
666
|
+
"aria-multiselectable": "true",
|
|
667
|
+
style: { maxHeight: y },
|
|
668
|
+
children: e.map((i, a) => {
|
|
669
|
+
let o = r.includes(i.value);
|
|
670
|
+
return /* @__PURE__ */ t("li", {
|
|
671
|
+
role: "presentation",
|
|
672
|
+
children: /* @__PURE__ */ n("button", {
|
|
673
|
+
ref: (e) => {
|
|
674
|
+
E.current[a] = e;
|
|
675
|
+
},
|
|
676
|
+
type: "button",
|
|
677
|
+
role: "option",
|
|
678
|
+
"aria-selected": o,
|
|
679
|
+
disabled: i.disabled,
|
|
680
|
+
className: `${R.option} ${o ? R.selected : ""}`,
|
|
681
|
+
onClick: () => j(i),
|
|
682
|
+
onKeyDown: (t) => {
|
|
683
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
684
|
+
t.preventDefault();
|
|
685
|
+
let e = t.key === "ArrowDown" ? 1 : -1;
|
|
686
|
+
M(a + e, e);
|
|
687
|
+
}
|
|
688
|
+
if (t.key === "Home" || t.key === "End") {
|
|
689
|
+
t.preventDefault();
|
|
690
|
+
let n = t.key === "Home" ? 1 : -1;
|
|
691
|
+
M(t.key === "Home" ? 0 : e.length - 1, n);
|
|
692
|
+
}
|
|
693
|
+
t.key === "Tab" && C(!1);
|
|
694
|
+
},
|
|
695
|
+
children: [/* @__PURE__ */ t("span", { children: i.label }), /* @__PURE__ */ t("span", {
|
|
696
|
+
"aria-hidden": "true",
|
|
697
|
+
children: o ? "✓" : ""
|
|
698
|
+
})]
|
|
699
|
+
})
|
|
700
|
+
}, i.value);
|
|
701
|
+
})
|
|
702
|
+
})]
|
|
703
|
+
}),
|
|
704
|
+
m && !p && /* @__PURE__ */ t("span", {
|
|
705
|
+
id: k,
|
|
706
|
+
className: R.message,
|
|
707
|
+
children: m
|
|
708
|
+
}),
|
|
709
|
+
p && /* @__PURE__ */ t("span", {
|
|
710
|
+
id: A,
|
|
711
|
+
className: R.error,
|
|
712
|
+
children: p
|
|
713
|
+
})
|
|
714
|
+
]
|
|
715
|
+
});
|
|
716
|
+
}, oe = {
|
|
717
|
+
approve: "M4 12l5 5L20 6",
|
|
718
|
+
reject: "M5 5l14 14M19 5L5 19",
|
|
719
|
+
edit: "M4 20h4L19 9l-4-4L4 16v4z",
|
|
720
|
+
cross: "M5 5l14 14M19 5L5 19",
|
|
721
|
+
chevron: "M6 9l6 6 6-6",
|
|
722
|
+
basket: "M4 7h16l-1 13H5L4 7zm3 0V4h10v3",
|
|
723
|
+
info: "M12 10v7m0-10v.01",
|
|
724
|
+
warning: "M12 4L3 20h18L12 4zm0 5v5m0 3v.01"
|
|
725
|
+
}, se = ({ name: e, title: r, width: i = 24, height: a = 24, ...o }) => /* @__PURE__ */ n("svg", {
|
|
726
|
+
viewBox: "0 0 24 24",
|
|
727
|
+
width: i,
|
|
728
|
+
height: a,
|
|
729
|
+
fill: "none",
|
|
730
|
+
stroke: "currentColor",
|
|
731
|
+
strokeWidth: "1.8",
|
|
732
|
+
strokeLinecap: "round",
|
|
733
|
+
strokeLinejoin: "round",
|
|
734
|
+
role: r ? "img" : void 0,
|
|
735
|
+
"aria-hidden": !r || void 0,
|
|
736
|
+
focusable: "false",
|
|
737
|
+
...o,
|
|
738
|
+
children: [r && /* @__PURE__ */ t("title", { children: r }), /* @__PURE__ */ t("path", { d: oe[e] })]
|
|
739
|
+
}), U = {
|
|
740
|
+
root: "_root_1897l_1",
|
|
741
|
+
header: "_header_1897l_11",
|
|
742
|
+
title: "_title_1897l_21",
|
|
743
|
+
dismiss: "_dismiss_1897l_28",
|
|
744
|
+
content: "_content_1897l_57"
|
|
745
|
+
}, ce = ({ title: e, children: r, dismissible: i = !1, onDismiss: a, dismissLabel: o = "Закрыть информационный блок", headingAs: c = "h3", className: l = "" }) => {
|
|
746
|
+
let u = `ds-info-block-${s()}`;
|
|
747
|
+
return /* @__PURE__ */ n("section", {
|
|
748
|
+
className: `${U.root} ${l}`,
|
|
749
|
+
"aria-labelledby": u,
|
|
750
|
+
children: [/* @__PURE__ */ n("header", {
|
|
751
|
+
className: U.header,
|
|
752
|
+
children: [/* @__PURE__ */ t(c, {
|
|
753
|
+
id: u,
|
|
754
|
+
className: U.title,
|
|
755
|
+
children: e
|
|
756
|
+
}), i && /* @__PURE__ */ t("button", {
|
|
757
|
+
type: "button",
|
|
758
|
+
className: U.dismiss,
|
|
759
|
+
onClick: a,
|
|
760
|
+
"aria-label": o,
|
|
761
|
+
children: /* @__PURE__ */ t("svg", {
|
|
762
|
+
viewBox: "0 0 20 20",
|
|
763
|
+
"aria-hidden": "true",
|
|
764
|
+
children: /* @__PURE__ */ t("path", {
|
|
765
|
+
d: "M5 5L15 15M15 5L5 15",
|
|
766
|
+
fill: "none",
|
|
767
|
+
stroke: "currentColor",
|
|
768
|
+
strokeWidth: "1.8",
|
|
769
|
+
strokeLinecap: "round"
|
|
770
|
+
})
|
|
771
|
+
})
|
|
772
|
+
})]
|
|
773
|
+
}), /* @__PURE__ */ t("div", {
|
|
774
|
+
className: U.content,
|
|
775
|
+
children: r
|
|
776
|
+
})]
|
|
777
|
+
});
|
|
778
|
+
}, W = {
|
|
779
|
+
wrapper: "_wrapper_1bpdz_1",
|
|
780
|
+
control: "_control_1bpdz_3",
|
|
781
|
+
input: "_input_1bpdz_5",
|
|
782
|
+
disabledText: "_disabledText_1bpdz_5",
|
|
783
|
+
inputError: "_inputError_1bpdz_11",
|
|
784
|
+
clear: "_clear_1bpdz_13"
|
|
785
|
+
}, le = ({ value: e, onChange: r, type: i = "text", placeholder: a = "", disabled: o = !1, readOnly: c = !1, stringWhileDisabled: u = !1, label: d, error: f, hint: p, className: m = "", name: h, id: g, clearable: _ = !0, required: v = !1, ...y }) => {
|
|
786
|
+
let b = s(), x = g ?? `ds-input-${h ?? b}`, S = l(null), C = p ? `${x}-hint` : void 0, w = f ? `${x}-error` : void 0, D = String(e ?? ""), O = [C, w].filter(Boolean).join(" ") || void 0;
|
|
787
|
+
return /* @__PURE__ */ n("div", {
|
|
788
|
+
className: `${W.wrapper} ${m}`,
|
|
789
|
+
children: [
|
|
790
|
+
d && /* @__PURE__ */ t(T, {
|
|
791
|
+
htmlFor: x,
|
|
792
|
+
required: v,
|
|
793
|
+
disabled: o,
|
|
794
|
+
children: d
|
|
795
|
+
}),
|
|
796
|
+
o && u ? /* @__PURE__ */ t("div", {
|
|
797
|
+
id: x,
|
|
798
|
+
className: W.disabledText,
|
|
799
|
+
"aria-describedby": O,
|
|
800
|
+
children: D || a
|
|
801
|
+
}) : /* @__PURE__ */ n("div", {
|
|
802
|
+
className: W.control,
|
|
803
|
+
children: [/* @__PURE__ */ t("input", {
|
|
804
|
+
ref: S,
|
|
805
|
+
id: x,
|
|
806
|
+
name: h,
|
|
807
|
+
type: i,
|
|
808
|
+
value: D,
|
|
809
|
+
placeholder: a,
|
|
810
|
+
disabled: o,
|
|
811
|
+
readOnly: c,
|
|
812
|
+
required: v,
|
|
813
|
+
"aria-invalid": !!f,
|
|
814
|
+
"aria-describedby": O,
|
|
815
|
+
className: `${W.input} ${f ? W.inputError : ""}`,
|
|
816
|
+
onChange: (e) => {
|
|
817
|
+
i === "number" && e.target.value !== "" ? r?.(Number(e.target.value), e) : r?.(e.target.value, e);
|
|
818
|
+
},
|
|
819
|
+
...y
|
|
820
|
+
}), _ && D && !o && !c && /* @__PURE__ */ t("button", {
|
|
821
|
+
type: "button",
|
|
822
|
+
className: W.clear,
|
|
823
|
+
"aria-label": "Очистить поле",
|
|
824
|
+
onClick: () => {
|
|
825
|
+
let e = S.current;
|
|
826
|
+
e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.focus());
|
|
827
|
+
},
|
|
828
|
+
children: "×"
|
|
829
|
+
})]
|
|
830
|
+
}),
|
|
831
|
+
p && !f && /* @__PURE__ */ t(E, {
|
|
832
|
+
id: C,
|
|
833
|
+
children: p
|
|
834
|
+
}),
|
|
835
|
+
f && /* @__PURE__ */ t(E, {
|
|
836
|
+
id: w,
|
|
837
|
+
variant: "error",
|
|
838
|
+
children: f
|
|
839
|
+
})
|
|
840
|
+
]
|
|
841
|
+
});
|
|
842
|
+
}, G = {
|
|
843
|
+
wrapper: "_wrapper_8srjz_1",
|
|
844
|
+
input: "_input_8srjz_11",
|
|
845
|
+
switch: "_switch_8srjz_18",
|
|
846
|
+
thumb: "_thumb_8srjz_34",
|
|
847
|
+
label: "_label_8srjz_56",
|
|
848
|
+
disabled: "_disabled_8srjz_62"
|
|
849
|
+
}, ue = ({ checked: e, onChange: r, label: i, disabled: a = !1, readOnly: o = !1, className: c = "", name: l, id: u, value: d }) => {
|
|
850
|
+
let f = s(), p = u ?? `ds-radio-button-${l ?? f}`;
|
|
851
|
+
return /* @__PURE__ */ n("label", {
|
|
852
|
+
htmlFor: p,
|
|
853
|
+
className: `${G.wrapper} ${a ? G.disabled : ""} ${c}`,
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ t("input", {
|
|
856
|
+
id: p,
|
|
857
|
+
className: G.input,
|
|
858
|
+
type: "checkbox",
|
|
859
|
+
role: "switch",
|
|
860
|
+
name: l,
|
|
861
|
+
value: d,
|
|
862
|
+
checked: e,
|
|
863
|
+
disabled: a,
|
|
864
|
+
"aria-readonly": o || void 0,
|
|
865
|
+
onChange: (e) => {
|
|
866
|
+
o || r?.(e.target.checked, e);
|
|
867
|
+
}
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ t("span", {
|
|
870
|
+
className: G.switch,
|
|
871
|
+
"aria-hidden": "true",
|
|
872
|
+
children: /* @__PURE__ */ t("span", { className: G.thumb })
|
|
873
|
+
}),
|
|
874
|
+
i && /* @__PURE__ */ t("span", {
|
|
875
|
+
className: G.label,
|
|
876
|
+
children: i
|
|
877
|
+
})
|
|
878
|
+
]
|
|
879
|
+
});
|
|
880
|
+
}, K = {
|
|
881
|
+
root: "_root_kepgo_1",
|
|
882
|
+
grid: "_grid_kepgo_3",
|
|
883
|
+
actions: "_actions_kepgo_5"
|
|
884
|
+
}, de = ({ filters: e, values: r, onChange: i, onApply: a, onReset: o, applyMode: s = "instant", loading: c = !1, disabled: l = !1, className: u = "" }) => {
|
|
885
|
+
let d = (e, t) => {
|
|
886
|
+
let n = {
|
|
887
|
+
...r,
|
|
888
|
+
[e]: t
|
|
889
|
+
};
|
|
890
|
+
i?.(n, e), s === "instant" && a?.(n);
|
|
891
|
+
};
|
|
892
|
+
return /* @__PURE__ */ n("section", {
|
|
893
|
+
className: `${K.root} ${u}`,
|
|
894
|
+
"aria-label": "Фильтры",
|
|
895
|
+
"aria-busy": c,
|
|
896
|
+
children: [/* @__PURE__ */ t("div", {
|
|
897
|
+
className: K.grid,
|
|
898
|
+
children: e.filter((e) => !e.hidden).map((e) => {
|
|
899
|
+
let n = l || c || e.disabled, i = r[e.id];
|
|
900
|
+
if (e.type === "input") return /* @__PURE__ */ t(le, {
|
|
901
|
+
label: e.label,
|
|
902
|
+
hint: e.hint,
|
|
903
|
+
placeholder: e.placeholder,
|
|
904
|
+
type: e.inputType,
|
|
905
|
+
value: i ?? "",
|
|
906
|
+
disabled: n,
|
|
907
|
+
onChange: (t) => d(e.id, t)
|
|
908
|
+
}, e.id);
|
|
909
|
+
if (e.type === "dropdown") return /* @__PURE__ */ t(B, {
|
|
910
|
+
label: e.label,
|
|
911
|
+
hint: e.hint,
|
|
912
|
+
placeholder: e.placeholder,
|
|
913
|
+
options: e.options,
|
|
914
|
+
value: String(i ?? ""),
|
|
915
|
+
disabled: n,
|
|
916
|
+
onChange: (t) => d(e.id, t)
|
|
917
|
+
}, e.id);
|
|
918
|
+
if (e.type === "multiple") return /* @__PURE__ */ t(ae, {
|
|
919
|
+
label: e.label,
|
|
920
|
+
hint: e.hint,
|
|
921
|
+
placeholder: e.placeholder,
|
|
922
|
+
options: e.options,
|
|
923
|
+
value: Array.isArray(i) ? i : [],
|
|
924
|
+
disabled: n,
|
|
925
|
+
onChange: (t) => d(e.id, t)
|
|
926
|
+
}, e.id);
|
|
927
|
+
if (e.type === "checkbox") return /* @__PURE__ */ t(O, {
|
|
928
|
+
label: e.label,
|
|
929
|
+
hint: e.hint,
|
|
930
|
+
checked: !!i,
|
|
931
|
+
disabled: n,
|
|
932
|
+
onChange: (t) => d(e.id, t)
|
|
933
|
+
}, e.id);
|
|
934
|
+
if (e.type === "radio") return /* @__PURE__ */ t(ue, {
|
|
935
|
+
label: e.label,
|
|
936
|
+
checked: !!i,
|
|
937
|
+
disabled: n,
|
|
938
|
+
onChange: (t) => d(e.id, t)
|
|
939
|
+
}, e.id);
|
|
940
|
+
let a = i && typeof i == "object" && !Array.isArray(i) ? i : {
|
|
941
|
+
from: null,
|
|
942
|
+
to: null
|
|
943
|
+
};
|
|
944
|
+
return /* @__PURE__ */ t(ee, {
|
|
945
|
+
hint: e.hint,
|
|
946
|
+
mode: e.mode,
|
|
947
|
+
min: e.min,
|
|
948
|
+
max: e.max,
|
|
949
|
+
value: a,
|
|
950
|
+
disabled: n,
|
|
951
|
+
onDraftChange: (t) => d(e.id, t)
|
|
952
|
+
}, e.id);
|
|
953
|
+
})
|
|
954
|
+
}), (o || s === "manual") && /* @__PURE__ */ n("div", {
|
|
955
|
+
className: K.actions,
|
|
956
|
+
children: [o && /* @__PURE__ */ t(C, {
|
|
957
|
+
variant: "destructiveOutline",
|
|
958
|
+
disabled: l || c,
|
|
959
|
+
onClick: o,
|
|
960
|
+
children: "Сбросить"
|
|
961
|
+
}), s === "manual" && /* @__PURE__ */ t(C, {
|
|
962
|
+
isLoading: c,
|
|
963
|
+
disabled: l,
|
|
964
|
+
onClick: () => a?.(r),
|
|
965
|
+
children: "Применить"
|
|
966
|
+
})]
|
|
967
|
+
})]
|
|
968
|
+
});
|
|
969
|
+
}, fe = 0, q = _((e) => ({
|
|
970
|
+
modals: [],
|
|
971
|
+
openModal: (t, n = {}, r = {}) => {
|
|
972
|
+
fe += 1;
|
|
973
|
+
let i = `ds-modal-${fe}`;
|
|
974
|
+
return e((e) => ({ modals: [...e.modals, {
|
|
975
|
+
id: i,
|
|
976
|
+
name: t,
|
|
977
|
+
payload: n,
|
|
978
|
+
closeOnEscape: r.closeOnEscape ?? !0,
|
|
979
|
+
closeOnBackdrop: r.closeOnBackdrop ?? !0
|
|
980
|
+
}] })), i;
|
|
981
|
+
},
|
|
982
|
+
closeModal: (t) => e((e) => ({ modals: e.modals.filter((e) => e.id !== t) })),
|
|
983
|
+
closeTopModal: () => e((e) => ({ modals: e.modals.slice(0, -1) })),
|
|
984
|
+
closeAllModals: () => e({ modals: [] })
|
|
985
|
+
})), pe = () => q.setState({ modals: [] }), J = {
|
|
986
|
+
layer: "_layer_bl99k_1",
|
|
987
|
+
backdrop: "_backdrop_bl99k_2",
|
|
988
|
+
panel: "_panel_bl99k_3",
|
|
989
|
+
header: "_header_bl99k_5",
|
|
990
|
+
title: "_title_bl99k_6",
|
|
991
|
+
description: "_description_bl99k_7",
|
|
992
|
+
content: "_content_bl99k_8"
|
|
993
|
+
}, me = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])", Y = ({ children: e, title: r, description: i, modalId: a, closeLabel: c = "Закрыть модальное окно", className: u = "", role: d = "dialog" }) => {
|
|
994
|
+
let f = s(), p = s(), m = l(null), h = q((e) => e.closeModal);
|
|
995
|
+
return o(() => {
|
|
996
|
+
let e = document.activeElement, t = m.current;
|
|
997
|
+
return (t?.querySelector(me) ?? t)?.focus(), () => e?.focus();
|
|
998
|
+
}, []), /* @__PURE__ */ n("div", {
|
|
999
|
+
ref: m,
|
|
1000
|
+
className: `${J.panel} ${u}`,
|
|
1001
|
+
role: d,
|
|
1002
|
+
"aria-modal": "true",
|
|
1003
|
+
"aria-labelledby": r ? f : void 0,
|
|
1004
|
+
"aria-describedby": i ? p : void 0,
|
|
1005
|
+
tabIndex: -1,
|
|
1006
|
+
onKeyDown: (e) => {
|
|
1007
|
+
if (e.key !== "Tab") return;
|
|
1008
|
+
let t = Array.from(m.current?.querySelectorAll(me) ?? []);
|
|
1009
|
+
if (!t.length) {
|
|
1010
|
+
e.preventDefault();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
let n = t[0], r = t[t.length - 1];
|
|
1014
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r?.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n?.focus());
|
|
1015
|
+
},
|
|
1016
|
+
children: [
|
|
1017
|
+
(r || c) && /* @__PURE__ */ n("header", {
|
|
1018
|
+
className: J.header,
|
|
1019
|
+
children: [r && /* @__PURE__ */ t("h2", {
|
|
1020
|
+
id: f,
|
|
1021
|
+
className: J.title,
|
|
1022
|
+
children: r
|
|
1023
|
+
}), /* @__PURE__ */ t(C, {
|
|
1024
|
+
variant: "ghost",
|
|
1025
|
+
size: "sm",
|
|
1026
|
+
"aria-label": c,
|
|
1027
|
+
onClick: () => h(a),
|
|
1028
|
+
children: "×"
|
|
1029
|
+
})]
|
|
1030
|
+
}),
|
|
1031
|
+
i && /* @__PURE__ */ t("p", {
|
|
1032
|
+
id: p,
|
|
1033
|
+
className: J.description,
|
|
1034
|
+
children: i
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ t("div", {
|
|
1037
|
+
className: J.content,
|
|
1038
|
+
children: e
|
|
1039
|
+
})
|
|
1040
|
+
]
|
|
1041
|
+
});
|
|
1042
|
+
}, he = ({ registry: e }) => {
|
|
1043
|
+
let n = q((e) => e.modals), r = q((e) => e.closeModal), i = q((e) => e.closeAllModals);
|
|
1044
|
+
return o(() => {
|
|
1045
|
+
let e = (e) => {
|
|
1046
|
+
if (e.key !== "Escape") return;
|
|
1047
|
+
let t = q.getState().modals.at(-1);
|
|
1048
|
+
t?.closeOnEscape && r(t.id);
|
|
1049
|
+
};
|
|
1050
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1051
|
+
}, [r]), !n.length || typeof document > "u" ? null : g(/* @__PURE__ */ t("div", {
|
|
1052
|
+
className: J.layer,
|
|
1053
|
+
"aria-label": "Модальные окна",
|
|
1054
|
+
children: n.map((a, o) => {
|
|
1055
|
+
let s = e[a.name];
|
|
1056
|
+
return s ? /* @__PURE__ */ t("div", {
|
|
1057
|
+
className: J.backdrop,
|
|
1058
|
+
"aria-hidden": o !== n.length - 1 || void 0,
|
|
1059
|
+
onMouseDown: (e) => {
|
|
1060
|
+
e.target === e.currentTarget && a.closeOnBackdrop && r(a.id);
|
|
1061
|
+
},
|
|
1062
|
+
children: /* @__PURE__ */ t(s, {
|
|
1063
|
+
...a.payload,
|
|
1064
|
+
modalId: a.id,
|
|
1065
|
+
close: () => r(a.id),
|
|
1066
|
+
closeAll: i
|
|
1067
|
+
})
|
|
1068
|
+
}, a.id) : null;
|
|
1069
|
+
})
|
|
1070
|
+
}), document.body);
|
|
1071
|
+
}, ge = ({ registry: r, children: i, lockBodyScroll: a = !0 }) => {
|
|
1072
|
+
let s = q((e) => e.modals.length);
|
|
1073
|
+
return o(() => {
|
|
1074
|
+
if (!a || s === 0) return;
|
|
1075
|
+
let e = document.body.style.overflow;
|
|
1076
|
+
return document.body.style.overflow = "hidden", () => {
|
|
1077
|
+
document.body.style.overflow = e;
|
|
1078
|
+
};
|
|
1079
|
+
}, [a, s]), /* @__PURE__ */ n(e, { children: [i, /* @__PURE__ */ t(he, { registry: r })] });
|
|
1080
|
+
}, _e = (e) => e, X = {
|
|
1081
|
+
message: "_message_187g8_1",
|
|
1082
|
+
actions: "_actions_187g8_2"
|
|
1083
|
+
}, ve = /* @__PURE__ */ new Map(), ye = 0, be = ({ modalId: e, close: r, title: i = "Подтверждение", message: a = "Продолжить действие?", confirmLabel: o = "Подтвердить", cancelLabel: s = "Отмена", tone: c = "default", requestId: l }) => {
|
|
1084
|
+
let u = (e) => {
|
|
1085
|
+
ve.get(l)?.(e), ve.delete(l), r();
|
|
1086
|
+
};
|
|
1087
|
+
return /* @__PURE__ */ n(Y, {
|
|
1088
|
+
modalId: e,
|
|
1089
|
+
title: i,
|
|
1090
|
+
role: "alertdialog",
|
|
1091
|
+
children: [/* @__PURE__ */ t("p", {
|
|
1092
|
+
className: X.message,
|
|
1093
|
+
children: a
|
|
1094
|
+
}), /* @__PURE__ */ n("div", {
|
|
1095
|
+
className: X.actions,
|
|
1096
|
+
children: [/* @__PURE__ */ t(C, {
|
|
1097
|
+
variant: "outline",
|
|
1098
|
+
onClick: () => u(!1),
|
|
1099
|
+
children: s
|
|
1100
|
+
}), /* @__PURE__ */ t(C, {
|
|
1101
|
+
variant: c === "danger" ? "destructive" : "primary",
|
|
1102
|
+
onClick: () => u(!0),
|
|
1103
|
+
children: o
|
|
1104
|
+
})]
|
|
1105
|
+
})]
|
|
1106
|
+
});
|
|
1107
|
+
}, xe = ({ modalId: e, close: r, title: i = "Ошибка", message: a, closeLabel: o = "Закрыть" }) => /* @__PURE__ */ n(Y, {
|
|
1108
|
+
modalId: e,
|
|
1109
|
+
title: i,
|
|
1110
|
+
role: "alertdialog",
|
|
1111
|
+
children: [/* @__PURE__ */ t("p", {
|
|
1112
|
+
className: X.message,
|
|
1113
|
+
children: a
|
|
1114
|
+
}), /* @__PURE__ */ t("div", {
|
|
1115
|
+
className: X.actions,
|
|
1116
|
+
children: /* @__PURE__ */ t(C, {
|
|
1117
|
+
onClick: r,
|
|
1118
|
+
children: o
|
|
1119
|
+
})
|
|
1120
|
+
})]
|
|
1121
|
+
}), Se = _e({
|
|
1122
|
+
ConfirmModal: be,
|
|
1123
|
+
ErrorModal: xe
|
|
1124
|
+
}), Ce = () => {
|
|
1125
|
+
let e = q((e) => e.openModal);
|
|
1126
|
+
return (t = {}) => new Promise((n) => {
|
|
1127
|
+
ye += 1;
|
|
1128
|
+
let r = `confirm-${ye}`;
|
|
1129
|
+
ve.set(r, n), e("ConfirmModal", {
|
|
1130
|
+
...t,
|
|
1131
|
+
requestId: r
|
|
1132
|
+
}, { closeOnEscape: !1 });
|
|
1133
|
+
});
|
|
1134
|
+
}, we = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e && typeof e.message == "string" ? e.message : "Произошла неизвестная ошибка", Te = () => {
|
|
1135
|
+
let e = q((e) => e.openModal);
|
|
1136
|
+
return { showError: (t, n) => e("ErrorModal", {
|
|
1137
|
+
title: n,
|
|
1138
|
+
message: we(t)
|
|
1139
|
+
}) };
|
|
1140
|
+
}, Ee = _(() => ({})), De = _(() => ({})), Oe = () => {
|
|
1141
|
+
let e = q((e) => e.modals), t = q((e) => e.openModal);
|
|
1142
|
+
return {
|
|
1143
|
+
openModal: (e, n = {}, r) => t(e, n, r),
|
|
1144
|
+
closeModal: q((e) => e.closeModal),
|
|
1145
|
+
closeTopModal: q((e) => e.closeTopModal),
|
|
1146
|
+
closeAllModals: q((e) => e.closeAllModals),
|
|
1147
|
+
isOpen: (t) => e.some((e) => e.name === t),
|
|
1148
|
+
count: e.length
|
|
1149
|
+
};
|
|
1150
|
+
}, ke = { root: "_root_1j70j_1" }, Ae = ({ label: e = "Загрузка страницы", className: r = "" }) => /* @__PURE__ */ n("div", {
|
|
1151
|
+
className: `${ke.root} ${r}`,
|
|
1152
|
+
role: "status",
|
|
1153
|
+
"aria-label": e,
|
|
1154
|
+
children: [/* @__PURE__ */ t(x, { decorative: !0 }), /* @__PURE__ */ t("span", { children: e })]
|
|
1155
|
+
}), je = {
|
|
1156
|
+
root: "_root_ig8lp_1",
|
|
1157
|
+
legend: "_legend_ig8lp_2",
|
|
1158
|
+
range: "_range_ig8lp_3"
|
|
1159
|
+
}, Me = [
|
|
1160
|
+
{
|
|
1161
|
+
value: "1",
|
|
1162
|
+
label: "День"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
value: "2",
|
|
1166
|
+
label: "Неделя"
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
value: "3",
|
|
1170
|
+
label: "Месяц"
|
|
1171
|
+
}
|
|
1172
|
+
], Ne = {
|
|
1173
|
+
day: 1,
|
|
1174
|
+
week: 2,
|
|
1175
|
+
month: 3
|
|
1176
|
+
}, Pe = ({ value: e, onChange: r, label: i, hint: a, error: o, disabled: s = !1, min: c, max: l, className: u = "", periodTypeOptions: d = Me }) => /* @__PURE__ */ n("fieldset", {
|
|
1177
|
+
className: `${je.root} ${u}`,
|
|
1178
|
+
disabled: s,
|
|
1179
|
+
children: [
|
|
1180
|
+
i && /* @__PURE__ */ t("legend", {
|
|
1181
|
+
className: je.legend,
|
|
1182
|
+
children: i
|
|
1183
|
+
}),
|
|
1184
|
+
/* @__PURE__ */ t(B, {
|
|
1185
|
+
options: d,
|
|
1186
|
+
value: String(e.periodType),
|
|
1187
|
+
disabled: s,
|
|
1188
|
+
onChange: (t) => r?.({
|
|
1189
|
+
...e,
|
|
1190
|
+
periodType: Number(t)
|
|
1191
|
+
}),
|
|
1192
|
+
label: "Тип периода"
|
|
1193
|
+
}),
|
|
1194
|
+
/* @__PURE__ */ n("div", {
|
|
1195
|
+
className: je.range,
|
|
1196
|
+
children: [/* @__PURE__ */ t(N, {
|
|
1197
|
+
value: e.startDate,
|
|
1198
|
+
onChange: (t) => r?.({
|
|
1199
|
+
...e,
|
|
1200
|
+
startDate: t
|
|
1201
|
+
}),
|
|
1202
|
+
label: "Начало",
|
|
1203
|
+
min: c,
|
|
1204
|
+
max: l,
|
|
1205
|
+
disabled: s
|
|
1206
|
+
}), /* @__PURE__ */ t(N, {
|
|
1207
|
+
value: e.endDate,
|
|
1208
|
+
onChange: (t) => r?.({
|
|
1209
|
+
...e,
|
|
1210
|
+
endDate: t
|
|
1211
|
+
}),
|
|
1212
|
+
label: "Окончание",
|
|
1213
|
+
min: e.startDate ?? c,
|
|
1214
|
+
max: l,
|
|
1215
|
+
disabled: s
|
|
1216
|
+
})]
|
|
1217
|
+
}),
|
|
1218
|
+
a && !o && /* @__PURE__ */ t(E, { children: a }),
|
|
1219
|
+
o && /* @__PURE__ */ t(E, {
|
|
1220
|
+
variant: "error",
|
|
1221
|
+
children: o
|
|
1222
|
+
})
|
|
1223
|
+
]
|
|
1224
|
+
}), Z = {
|
|
1225
|
+
viewport: "_viewport_v7rog_1",
|
|
1226
|
+
"top-right": "_top-right_v7rog_2",
|
|
1227
|
+
"top-left": "_top-left_v7rog_3",
|
|
1228
|
+
"bottom-right": "_bottom-right_v7rog_4",
|
|
1229
|
+
"bottom-left": "_bottom-left_v7rog_5",
|
|
1230
|
+
toast: "_toast_v7rog_6",
|
|
1231
|
+
body: "_body_v7rog_7",
|
|
1232
|
+
icon: "_icon_v7rog_8",
|
|
1233
|
+
info: "_info_v7rog_9",
|
|
1234
|
+
success: "_success_v7rog_10",
|
|
1235
|
+
warning: "_warning_v7rog_11",
|
|
1236
|
+
error: "_error_v7rog_12"
|
|
1237
|
+
}, Fe = ({ toast: e, onClose: r }) => {
|
|
1238
|
+
let [i, a] = u(!1), s = l(e.duration), c = l(Date.now());
|
|
1239
|
+
return o(() => {
|
|
1240
|
+
if (i || e.duration <= 0) return;
|
|
1241
|
+
c.current = Date.now();
|
|
1242
|
+
let t = setTimeout(() => r(e.id), s.current);
|
|
1243
|
+
return () => {
|
|
1244
|
+
clearTimeout(t), s.current = Math.max(0, s.current - (Date.now() - c.current));
|
|
1245
|
+
};
|
|
1246
|
+
}, [
|
|
1247
|
+
r,
|
|
1248
|
+
i,
|
|
1249
|
+
e.duration,
|
|
1250
|
+
e.id
|
|
1251
|
+
]), /* @__PURE__ */ n("article", {
|
|
1252
|
+
className: `${Z.toast} ${Z[e.variant]}`,
|
|
1253
|
+
role: e.variant === "error" ? "alert" : "status",
|
|
1254
|
+
"aria-live": e.variant === "error" ? "assertive" : "polite",
|
|
1255
|
+
onMouseEnter: () => a(!0),
|
|
1256
|
+
onMouseLeave: () => a(!1),
|
|
1257
|
+
onFocus: () => a(!0),
|
|
1258
|
+
onBlur: () => a(!1),
|
|
1259
|
+
children: [
|
|
1260
|
+
/* @__PURE__ */ t(se, {
|
|
1261
|
+
name: e.variant === "warning" ? "warning" : "info",
|
|
1262
|
+
className: Z.icon
|
|
1263
|
+
}),
|
|
1264
|
+
/* @__PURE__ */ n("div", {
|
|
1265
|
+
className: Z.body,
|
|
1266
|
+
children: [
|
|
1267
|
+
e.title && /* @__PURE__ */ t("strong", { children: e.title }),
|
|
1268
|
+
/* @__PURE__ */ t("div", { children: e.message }),
|
|
1269
|
+
e.action && /* @__PURE__ */ t(C, {
|
|
1270
|
+
variant: "ghost",
|
|
1271
|
+
size: "sm",
|
|
1272
|
+
onClick: () => {
|
|
1273
|
+
e.action?.onClick(), (e.action?.dismissOnClick ?? !0) && r(e.id);
|
|
1274
|
+
},
|
|
1275
|
+
children: e.action.label
|
|
1276
|
+
})
|
|
1277
|
+
]
|
|
1278
|
+
}),
|
|
1279
|
+
e.closable && /* @__PURE__ */ t(C, {
|
|
1280
|
+
variant: "ghost",
|
|
1281
|
+
size: "sm",
|
|
1282
|
+
"aria-label": "Закрыть уведомление",
|
|
1283
|
+
onClick: () => r(e.id),
|
|
1284
|
+
children: "×"
|
|
1285
|
+
})
|
|
1286
|
+
]
|
|
1287
|
+
});
|
|
1288
|
+
}, Ie = 0, Q = _((e) => ({
|
|
1289
|
+
toasts: [],
|
|
1290
|
+
showToast: (t) => {
|
|
1291
|
+
Ie += 1;
|
|
1292
|
+
let n = `ds-toast-${Ie}`;
|
|
1293
|
+
return e((e) => ({ toasts: [...e.toasts, {
|
|
1294
|
+
variant: "info",
|
|
1295
|
+
duration: 5e3,
|
|
1296
|
+
closable: !0,
|
|
1297
|
+
...t,
|
|
1298
|
+
id: n
|
|
1299
|
+
}] })), n;
|
|
1300
|
+
},
|
|
1301
|
+
removeToast: (t) => e((e) => ({ toasts: e.toasts.filter((e) => e.id !== t) })),
|
|
1302
|
+
clearToasts: () => e({ toasts: [] })
|
|
1303
|
+
})), Le = () => Q.setState({ toasts: [] }), Re = ({ position: e = "top-right" }) => {
|
|
1304
|
+
let n = Q((e) => e.toasts), r = Q((e) => e.removeToast);
|
|
1305
|
+
return /* @__PURE__ */ t("div", {
|
|
1306
|
+
className: `${Z.viewport} ${Z[e]}`,
|
|
1307
|
+
"aria-label": "Уведомления",
|
|
1308
|
+
children: n.map((e) => /* @__PURE__ */ t(Fe, {
|
|
1309
|
+
toast: e,
|
|
1310
|
+
onClose: r
|
|
1311
|
+
}, e.id))
|
|
1312
|
+
});
|
|
1313
|
+
}, ze = () => {
|
|
1314
|
+
let e = Q((e) => e.showToast), t = Q((e) => e.removeToast), n = Q((e) => e.clearToasts), r = (t) => (n) => e({
|
|
1315
|
+
...n,
|
|
1316
|
+
variant: t
|
|
1317
|
+
});
|
|
1318
|
+
return {
|
|
1319
|
+
showToast: e,
|
|
1320
|
+
infoToast: r("info"),
|
|
1321
|
+
successToast: r("success"),
|
|
1322
|
+
warningToast: r("warning"),
|
|
1323
|
+
errorToast: r("error"),
|
|
1324
|
+
removeToast: t,
|
|
1325
|
+
clearToasts: n
|
|
1326
|
+
};
|
|
1327
|
+
}, Be = {
|
|
1328
|
+
root: "_root_2bxal_1",
|
|
1329
|
+
tooltip: "_tooltip_2bxal_2",
|
|
1330
|
+
"ds-tooltip-in": "_ds-tooltip-in_2bxal_1",
|
|
1331
|
+
top: "_top_2bxal_3",
|
|
1332
|
+
bottom: "_bottom_2bxal_4",
|
|
1333
|
+
left: "_left_2bxal_5",
|
|
1334
|
+
right: "_right_2bxal_6"
|
|
1335
|
+
}, Ve = ({ content: e, children: i, placement: c = "top", delay: d = 450, disabled: f = !1, maxWidth: p = 280, className: m = "" }) => {
|
|
1336
|
+
let h = s(), [g, _] = u(!1), v = l(null), y = () => {
|
|
1337
|
+
f || !e || (v.current = setTimeout(() => _(!0), d));
|
|
1338
|
+
}, b = () => {
|
|
1339
|
+
v.current && clearTimeout(v.current), _(!1);
|
|
1340
|
+
};
|
|
1341
|
+
if (o(() => {
|
|
1342
|
+
let e = (e) => {
|
|
1343
|
+
e.key === "Escape" && b();
|
|
1344
|
+
};
|
|
1345
|
+
return document.addEventListener("keydown", e), () => {
|
|
1346
|
+
document.removeEventListener("keydown", e), v.current && clearTimeout(v.current);
|
|
1347
|
+
};
|
|
1348
|
+
}, []), !a(i)) return i;
|
|
1349
|
+
let x = r(i, {
|
|
1350
|
+
"aria-describedby": g ? h : void 0,
|
|
1351
|
+
onMouseEnter: y,
|
|
1352
|
+
onMouseLeave: b,
|
|
1353
|
+
onFocus: y,
|
|
1354
|
+
onBlur: b
|
|
1355
|
+
});
|
|
1356
|
+
return /* @__PURE__ */ n("span", {
|
|
1357
|
+
className: `${Be.root} ${m}`,
|
|
1358
|
+
onPointerDown: g ? b : y,
|
|
1359
|
+
children: [x, g && /* @__PURE__ */ t("span", {
|
|
1360
|
+
id: h,
|
|
1361
|
+
role: "tooltip",
|
|
1362
|
+
className: `${Be.tooltip} ${Be[c]}`,
|
|
1363
|
+
style: { maxWidth: p },
|
|
1364
|
+
children: e
|
|
1365
|
+
})]
|
|
1366
|
+
});
|
|
1367
|
+
}, $ = {
|
|
1368
|
+
root: "_root_tgni1_1",
|
|
1369
|
+
frame: "_frame_tgni1_2",
|
|
1370
|
+
video: "_video_tgni1_3",
|
|
1371
|
+
overlay: "_overlay_tgni1_4",
|
|
1372
|
+
error: "_error_tgni1_4",
|
|
1373
|
+
caption: "_caption_tgni1_7"
|
|
1374
|
+
}, He = ({ sources: e, tracks: r = [], title: i, aspectRatio: a = "16 / 9", objectFit: o = "contain", loading: s = !1, error: c, fallback: l, className: d = "", controls: f = !0, playsInline: p = !0, ...m }) => {
|
|
1375
|
+
let [h, g] = u(!1), _ = c ?? (h ? "Не удалось воспроизвести видео" : void 0);
|
|
1376
|
+
return /* @__PURE__ */ n("figure", {
|
|
1377
|
+
className: `${$.root} ${d}`,
|
|
1378
|
+
children: [/* @__PURE__ */ n("div", {
|
|
1379
|
+
className: $.frame,
|
|
1380
|
+
style: { aspectRatio: a },
|
|
1381
|
+
children: [
|
|
1382
|
+
!_ && e.length > 0 && /* @__PURE__ */ n("video", {
|
|
1383
|
+
...m,
|
|
1384
|
+
"aria-label": i,
|
|
1385
|
+
controls: f,
|
|
1386
|
+
playsInline: p,
|
|
1387
|
+
className: $.video,
|
|
1388
|
+
style: { objectFit: o },
|
|
1389
|
+
onError: (e) => {
|
|
1390
|
+
g(!0), m.onError?.(e);
|
|
1391
|
+
},
|
|
1392
|
+
children: [e.map((e) => /* @__PURE__ */ t("source", { ...e }, `${e.src}-${e.type}`)), r.map((e) => /* @__PURE__ */ t("track", { ...e }, `${e.src}-${e.srcLang}`))]
|
|
1393
|
+
}),
|
|
1394
|
+
s && /* @__PURE__ */ t("div", {
|
|
1395
|
+
className: $.overlay,
|
|
1396
|
+
children: /* @__PURE__ */ t(x, { label: "Загрузка видео" })
|
|
1397
|
+
}),
|
|
1398
|
+
(_ || e.length === 0) && /* @__PURE__ */ t("div", {
|
|
1399
|
+
className: $.error,
|
|
1400
|
+
role: "alert",
|
|
1401
|
+
children: l ?? _ ?? "Источник видео не указан"
|
|
1402
|
+
})
|
|
1403
|
+
]
|
|
1404
|
+
}), /* @__PURE__ */ t("figcaption", {
|
|
1405
|
+
className: $.caption,
|
|
1406
|
+
children: i
|
|
1407
|
+
})]
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
//#endregion
|
|
1411
|
+
export { be as ConfirmModal, y as DSBadge, C as DSButton, O as DSCheckbox, ie as DSDataTable, ee as DSDateRange, N as DSDateTimePicker, B as DSDropDown, ae as DSDropDownMultiple, T as DSFieldLabel, E as DSFieldMessage, de as DSFilters, se as DSIcon, ce as DSInfoBlock, le as DSInput, x as DSLoader, he as DSModal, Y as DSModalFrame, Ae as DSPageLoader, ue as DSRadioButton, L as DSSkeleton, te as DSSort, Pe as DSTimePeriodPicker, Fe as DSToast, Re as DSToastProvider, Ve as DSTooltip, He as DSVideoPlayerFrame, Ne as DS_PERIOD_TYPE_CODES, xe as ErrorModal, ge as ModalSystemProvider, Se as builtInModalRegistry, _e as defineModalRegistry, j as formatDateTimeLocalValue, we as getErrorMessage, z as getNextEnabledOptionIndex, F as isValidDateRange, M as parseDateTimeLocalValue, pe as resetModalStore, Le as resetToastStore, Ce as useConfirmModal, Ee as useConfirmModalStore, Te as useErrorModal, De as useErrorModalStore, Oe as useModals, q as useModalsStore, ze as useToast, Q as useToastStore, re as validateDSDataTableData };
|