@efficiency-point/design-system 0.0.30 → 0.0.32
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/components/DSDateTimePicker/DSDateTimePicker.d.ts +3 -1
- package/dist/components/DSDateTimePicker/DSDateTimePicker.d.ts.map +1 -1
- package/dist/components/DSDropDown/DSDropDown.d.ts +2 -1
- package/dist/components/DSDropDown/DSDropDown.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.es.js +362 -346
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -153,23 +153,26 @@ var T = {
|
|
|
153
153
|
]
|
|
154
154
|
});
|
|
155
155
|
}, A = {
|
|
156
|
-
wrapper: "
|
|
157
|
-
trigger: "
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
wrapper: "_wrapper_1or7y_1",
|
|
157
|
+
trigger: "_trigger_1or7y_17",
|
|
158
|
+
lg: "_lg_1or7y_51",
|
|
159
|
+
chevron: "_chevron_1or7y_63",
|
|
160
|
+
chevronOpen: "_chevronOpen_1or7y_89",
|
|
161
|
+
nav: "_nav_1or7y_99",
|
|
162
|
+
day: "_day_1or7y_101",
|
|
163
|
+
monthSelect: "_monthSelect_1or7y_103",
|
|
164
|
+
yearInput: "_yearInput_1or7y_105",
|
|
165
|
+
timeInput: "_timeInput_1or7y_107",
|
|
166
|
+
value: "_value_1or7y_131",
|
|
167
|
+
placeholder: "_placeholder_1or7y_139",
|
|
168
|
+
error: "_error_1or7y_147",
|
|
169
|
+
panel: "_panel_1or7y_155",
|
|
170
|
+
calendarHeader: "_calendarHeader_1or7y_181",
|
|
171
|
+
weekdays: "_weekdays_1or7y_271",
|
|
172
|
+
days: "_days_1or7y_273",
|
|
173
|
+
outside: "_outside_1or7y_309",
|
|
174
|
+
selected: "_selected_1or7y_317",
|
|
175
|
+
timeLabel: "_timeLabel_1or7y_337"
|
|
173
176
|
}, j = [
|
|
174
177
|
"Пн",
|
|
175
178
|
"Вт",
|
|
@@ -220,50 +223,50 @@ var T = {
|
|
|
220
223
|
}, ee = (e, t) => !!(e && e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate()), te = (e, t, n) => {
|
|
221
224
|
let r = P(e).getTime();
|
|
222
225
|
return !!(t && r < P(t).getTime() || n && r > P(n).getTime());
|
|
223
|
-
}, z = 8, ne = 6, B = ({ value: r, onChange: i, mode: a = "date", label: m, placeholder: h, hint: g, error: _, disabled: v = !1, readOnly: y = !1, required: b = !1, min: x, max: S,
|
|
224
|
-
let
|
|
226
|
+
}, z = 8, ne = 6, B = ({ value: r, onChange: i, mode: a = "date", label: m, placeholder: h, hint: g, error: _, disabled: v = !1, readOnly: y = !1, required: b = !1, min: x, max: S, size: C = "md", id: w, name: T, className: O = "" }) => {
|
|
227
|
+
let k = c(), N = w ?? `ds-date-time-${T ?? k}`, P = g ? `${N}-hint` : void 0, B = _ ? `${N}-error` : void 0, V = d(null), H = d(null), re = d(null), [U, W] = f(!1), [G, K] = f(r ?? /* @__PURE__ */ new Date()), [ie, ae] = f(F(r, "time")), [q, oe] = f(null), se = u(() => R(G), [G]), ce = a !== "time", le = a !== "date";
|
|
225
228
|
s(() => {
|
|
226
|
-
r &&
|
|
229
|
+
r && K(r), ae(F(r, "time"));
|
|
227
230
|
}, [r]);
|
|
228
|
-
let
|
|
229
|
-
let e =
|
|
231
|
+
let J = o(() => {
|
|
232
|
+
let e = H.current, t = re.current;
|
|
230
233
|
if (!e || !t) return;
|
|
231
234
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight - n.bottom - z, o = n.top - z, s = a < r.height && o > a, c = Math.max(120, s ? o : a), l = s ? Math.max(z, n.top - r.height - ne) : n.bottom + ne, u = n.left, d = i - r.width - z;
|
|
232
|
-
|
|
235
|
+
oe({
|
|
233
236
|
top: l,
|
|
234
237
|
left: Math.max(z, Math.min(u, d)),
|
|
235
238
|
maxHeight: c
|
|
236
239
|
});
|
|
237
240
|
}, []);
|
|
238
241
|
l(() => {
|
|
239
|
-
if (!
|
|
240
|
-
|
|
242
|
+
if (!U) {
|
|
243
|
+
oe(null);
|
|
241
244
|
return;
|
|
242
245
|
}
|
|
243
|
-
return
|
|
244
|
-
window.removeEventListener("resize",
|
|
246
|
+
return J(), window.addEventListener("resize", J), window.addEventListener("scroll", J, !0), () => {
|
|
247
|
+
window.removeEventListener("resize", J), window.removeEventListener("scroll", J, !0);
|
|
245
248
|
};
|
|
246
249
|
}, [
|
|
247
|
-
V,
|
|
248
|
-
K,
|
|
249
250
|
U,
|
|
250
|
-
|
|
251
|
+
J,
|
|
252
|
+
G,
|
|
253
|
+
ie
|
|
251
254
|
]), s(() => {
|
|
252
|
-
if (!
|
|
255
|
+
if (!U) return;
|
|
253
256
|
let e = (e) => {
|
|
254
|
-
let t = e.target, n =
|
|
255
|
-
!n && !r &&
|
|
257
|
+
let t = e.target, n = V.current?.contains(t), r = re.current?.contains(t);
|
|
258
|
+
!n && !r && W(!1);
|
|
256
259
|
}, t = (e) => {
|
|
257
|
-
e.key === "Escape" && (
|
|
260
|
+
e.key === "Escape" && (W(!1), H.current?.focus());
|
|
258
261
|
};
|
|
259
262
|
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
260
263
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
261
264
|
};
|
|
262
|
-
}, [
|
|
263
|
-
let
|
|
265
|
+
}, [U]);
|
|
266
|
+
let ue = (e) => {
|
|
264
267
|
if (te(e, x, S)) return;
|
|
265
268
|
let t = new Date(e);
|
|
266
|
-
t.setHours(r?.getHours() ?? 0, r?.getMinutes() ?? 0, 0, 0), i?.(t), a === "date" &&
|
|
269
|
+
t.setHours(r?.getHours() ?? 0, r?.getMinutes() ?? 0, 0, 0), i?.(t), a === "date" && W(!1);
|
|
267
270
|
}, de = (e) => {
|
|
268
271
|
if (ae(e), !e) {
|
|
269
272
|
i?.(null);
|
|
@@ -271,23 +274,23 @@ var T = {
|
|
|
271
274
|
}
|
|
272
275
|
let t = I(e, "time");
|
|
273
276
|
if (!t) return;
|
|
274
|
-
let n = new Date(a === "datetime" ? r ??
|
|
277
|
+
let n = new Date(a === "datetime" ? r ?? G : /* @__PURE__ */ new Date());
|
|
275
278
|
n.setHours(t.getHours(), t.getMinutes(), 0, 0), !(x && n < x || S && n > S) && i?.(n);
|
|
276
|
-
}, fe = h ?? (a === "date" ? "Выберите дату" : a === "time" ? "Введите время" : "Выберите дату и время"), pe = [
|
|
277
|
-
ref:
|
|
279
|
+
}, fe = h ?? (a === "date" ? "Выберите дату" : a === "time" ? "Введите время" : "Выберите дату и время"), pe = [P, B].filter(Boolean).join(" ") || void 0, me = U && !y ? /* @__PURE__ */ n("div", {
|
|
280
|
+
ref: re,
|
|
278
281
|
className: A.panel,
|
|
279
282
|
role: "dialog",
|
|
280
283
|
"aria-label": m ?? fe,
|
|
281
|
-
style:
|
|
282
|
-
top:
|
|
283
|
-
left:
|
|
284
|
-
maxHeight:
|
|
284
|
+
style: q ? {
|
|
285
|
+
top: q.top,
|
|
286
|
+
left: q.left,
|
|
287
|
+
maxHeight: q.maxHeight
|
|
285
288
|
} : {
|
|
286
289
|
visibility: "hidden",
|
|
287
290
|
top: 0,
|
|
288
291
|
left: 0
|
|
289
292
|
},
|
|
290
|
-
children: [
|
|
293
|
+
children: [ce && /* @__PURE__ */ n(e, { children: [
|
|
291
294
|
/* @__PURE__ */ n("div", {
|
|
292
295
|
className: A.calendarHeader,
|
|
293
296
|
children: [
|
|
@@ -295,14 +298,14 @@ var T = {
|
|
|
295
298
|
type: "button",
|
|
296
299
|
className: A.nav,
|
|
297
300
|
"aria-label": "Предыдущий месяц",
|
|
298
|
-
onClick: () =>
|
|
301
|
+
onClick: () => K(new Date(G.getFullYear(), G.getMonth() - 1, 1)),
|
|
299
302
|
children: "‹"
|
|
300
303
|
}),
|
|
301
304
|
/* @__PURE__ */ t("select", {
|
|
302
305
|
className: A.monthSelect,
|
|
303
306
|
"aria-label": "Месяц",
|
|
304
|
-
value:
|
|
305
|
-
onChange: (e) =>
|
|
307
|
+
value: G.getMonth(),
|
|
308
|
+
onChange: (e) => K(new Date(G.getFullYear(), Number(e.target.value), 1)),
|
|
306
309
|
children: M.map((e, n) => /* @__PURE__ */ t("option", {
|
|
307
310
|
value: n,
|
|
308
311
|
children: e
|
|
@@ -312,14 +315,14 @@ var T = {
|
|
|
312
315
|
className: A.yearInput,
|
|
313
316
|
type: "number",
|
|
314
317
|
"aria-label": "Год",
|
|
315
|
-
value:
|
|
316
|
-
onChange: (e) =>
|
|
318
|
+
value: G.getFullYear(),
|
|
319
|
+
onChange: (e) => K(new Date(Number(e.target.value), G.getMonth(), 1))
|
|
317
320
|
}),
|
|
318
321
|
/* @__PURE__ */ t("button", {
|
|
319
322
|
type: "button",
|
|
320
323
|
className: A.nav,
|
|
321
324
|
"aria-label": "Следующий месяц",
|
|
322
|
-
onClick: () =>
|
|
325
|
+
onClick: () => K(new Date(G.getFullYear(), G.getMonth() + 1, 1)),
|
|
323
326
|
children: "›"
|
|
324
327
|
})
|
|
325
328
|
]
|
|
@@ -330,85 +333,96 @@ var T = {
|
|
|
330
333
|
}),
|
|
331
334
|
/* @__PURE__ */ t("div", {
|
|
332
335
|
className: A.days,
|
|
333
|
-
children:
|
|
336
|
+
children: se.map((e) => {
|
|
334
337
|
let n = ee(r, e);
|
|
335
338
|
return /* @__PURE__ */ t("button", {
|
|
336
339
|
type: "button",
|
|
337
|
-
className: `${A.day} ${e.getMonth() ===
|
|
340
|
+
className: `${A.day} ${e.getMonth() === G.getMonth() ? "" : A.outside} ${n ? A.selected : ""}`,
|
|
338
341
|
disabled: te(e, x, S),
|
|
339
342
|
"aria-pressed": n,
|
|
340
|
-
onClick: () =>
|
|
343
|
+
onClick: () => ue(e),
|
|
341
344
|
children: e.getDate()
|
|
342
345
|
}, e.toISOString());
|
|
343
346
|
})
|
|
344
347
|
})
|
|
345
|
-
] }),
|
|
348
|
+
] }), le && /* @__PURE__ */ n("label", {
|
|
346
349
|
className: A.timeLabel,
|
|
347
350
|
children: [/* @__PURE__ */ t("span", { children: "Время" }), /* @__PURE__ */ t("input", {
|
|
348
351
|
className: A.timeInput,
|
|
349
352
|
type: "time",
|
|
350
|
-
value:
|
|
353
|
+
value: ie,
|
|
351
354
|
onChange: (e) => de(e.target.value)
|
|
352
355
|
})]
|
|
353
356
|
})]
|
|
354
357
|
}) : null;
|
|
355
358
|
return /* @__PURE__ */ n("div", {
|
|
356
|
-
ref:
|
|
357
|
-
className: `${A.wrapper} ${
|
|
359
|
+
ref: V,
|
|
360
|
+
className: `${A.wrapper} ${O}`,
|
|
358
361
|
children: [
|
|
359
362
|
m && /* @__PURE__ */ t(E, {
|
|
360
|
-
htmlFor:
|
|
363
|
+
htmlFor: N,
|
|
361
364
|
required: b,
|
|
362
365
|
disabled: v,
|
|
363
366
|
children: m
|
|
364
367
|
}),
|
|
365
368
|
/* @__PURE__ */ n("button", {
|
|
366
|
-
ref:
|
|
367
|
-
id:
|
|
368
|
-
name:
|
|
369
|
+
ref: H,
|
|
370
|
+
id: N,
|
|
371
|
+
name: T,
|
|
369
372
|
type: "button",
|
|
370
|
-
className: `${A.trigger} ${_ ? A.error : ""}`,
|
|
373
|
+
className: `${A.trigger} ${A[C]} ${_ ? A.error : ""}`,
|
|
371
374
|
disabled: v,
|
|
372
375
|
"aria-readonly": y || void 0,
|
|
373
|
-
"aria-expanded":
|
|
376
|
+
"aria-expanded": U,
|
|
374
377
|
"aria-haspopup": "dialog",
|
|
375
378
|
"aria-describedby": pe,
|
|
376
379
|
onClick: () => {
|
|
377
|
-
y ||
|
|
380
|
+
y || W((e) => !e);
|
|
378
381
|
},
|
|
379
382
|
children: [/* @__PURE__ */ t("span", {
|
|
380
383
|
className: r ? A.value : A.placeholder,
|
|
381
384
|
children: L(r, a) || fe
|
|
382
385
|
}), /* @__PURE__ */ t("span", {
|
|
386
|
+
className: [A.chevron, me ? A.chevronOpen : ""].filter(Boolean).join(" "),
|
|
383
387
|
"aria-hidden": "true",
|
|
384
|
-
children: "
|
|
388
|
+
children: /* @__PURE__ */ t("svg", {
|
|
389
|
+
viewBox: "0 0 20 20",
|
|
390
|
+
fill: "none",
|
|
391
|
+
children: /* @__PURE__ */ t("path", {
|
|
392
|
+
d: "M5 7.5L10 12.5L15 7.5",
|
|
393
|
+
stroke: "currentColor",
|
|
394
|
+
strokeWidth: "1.8",
|
|
395
|
+
strokeLinecap: "round",
|
|
396
|
+
strokeLinejoin: "round"
|
|
397
|
+
})
|
|
398
|
+
})
|
|
385
399
|
})]
|
|
386
400
|
}),
|
|
387
401
|
me && p(me, document.body),
|
|
388
402
|
g && !_ && /* @__PURE__ */ t(D, {
|
|
389
|
-
id:
|
|
403
|
+
id: P,
|
|
390
404
|
children: g
|
|
391
405
|
}),
|
|
392
406
|
_ && /* @__PURE__ */ t(D, {
|
|
393
|
-
id:
|
|
407
|
+
id: B,
|
|
394
408
|
variant: "error",
|
|
395
409
|
children: _
|
|
396
410
|
})
|
|
397
411
|
]
|
|
398
412
|
});
|
|
399
|
-
},
|
|
413
|
+
}, V = {
|
|
400
414
|
root: "_root_1q42e_1",
|
|
401
415
|
legend: "_legend_1q42e_3",
|
|
402
416
|
range: "_range_1q42e_5"
|
|
403
|
-
},
|
|
417
|
+
}, H = (e) => !!(e.from && e.to && e.from.getTime() <= e.to.getTime()), re = ({ 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 = "" }) => {
|
|
404
418
|
let g = l ?? (e.from && e.to && e.from > e.to ? "Дата «От» не может быть позже даты «До»" : void 0), _ = (e) => {
|
|
405
|
-
i?.(e),
|
|
419
|
+
i?.(e), H(e) && r?.(e);
|
|
406
420
|
};
|
|
407
421
|
return /* @__PURE__ */ n("fieldset", {
|
|
408
|
-
className: `${
|
|
422
|
+
className: `${V.root} ${h}`,
|
|
409
423
|
disabled: f,
|
|
410
424
|
children: [/* @__PURE__ */ n("div", {
|
|
411
|
-
className:
|
|
425
|
+
className: V.range,
|
|
412
426
|
children: [/* @__PURE__ */ t(B, {
|
|
413
427
|
value: e.from,
|
|
414
428
|
mode: a === "datetime" ? "datetime" : a,
|
|
@@ -440,7 +454,7 @@ var T = {
|
|
|
440
454
|
})]
|
|
441
455
|
}), c && !g && /* @__PURE__ */ t(D, { children: c })]
|
|
442
456
|
});
|
|
443
|
-
},
|
|
457
|
+
}, U = {
|
|
444
458
|
group: "_group_1fs9e_1",
|
|
445
459
|
skeleton: "_skeleton_1fs9e_3",
|
|
446
460
|
text: "_text_1fs9e_5",
|
|
@@ -448,104 +462,104 @@ var T = {
|
|
|
448
462
|
circular: "_circular_1fs9e_9",
|
|
449
463
|
animated: "_animated_1fs9e_11",
|
|
450
464
|
"ds-skeleton": "_ds-skeleton_1fs9e_1"
|
|
451
|
-
},
|
|
452
|
-
className: `${
|
|
465
|
+
}, W = ({ variant: e = "text", width: n = "100%", height: r, lines: i = 1, animated: a = !0, className: o = "" }) => /* @__PURE__ */ t("span", {
|
|
466
|
+
className: `${U.group} ${o}`,
|
|
453
467
|
"aria-hidden": "true",
|
|
454
468
|
children: Array.from({ length: Math.max(1, i) }, (o, s) => /* @__PURE__ */ t("span", {
|
|
455
|
-
className: `${
|
|
469
|
+
className: `${U.skeleton} ${U[e]} ${a ? U.animated : ""}`,
|
|
456
470
|
style: {
|
|
457
471
|
width: s === i - 1 && i > 1 ? "70%" : n,
|
|
458
472
|
height: r
|
|
459
473
|
}
|
|
460
474
|
}, s))
|
|
461
|
-
}),
|
|
462
|
-
wrapper: "
|
|
463
|
-
label: "
|
|
464
|
-
lg: "
|
|
465
|
-
container: "
|
|
466
|
-
trigger: "
|
|
467
|
-
disabledText: "
|
|
468
|
-
sm: "
|
|
469
|
-
md: "
|
|
470
|
-
value: "
|
|
471
|
-
placeholder: "
|
|
472
|
-
chevron: "
|
|
473
|
-
chevronOpen: "
|
|
474
|
-
menu: "
|
|
475
|
-
option: "
|
|
476
|
-
selected: "
|
|
477
|
-
message: "
|
|
478
|
-
error: "
|
|
479
|
-
errorState: "
|
|
480
|
-
},
|
|
475
|
+
}), G = {
|
|
476
|
+
wrapper: "_wrapper_134up_1",
|
|
477
|
+
label: "_label_134up_17",
|
|
478
|
+
lg: "_lg_134up_29",
|
|
479
|
+
container: "_container_134up_37",
|
|
480
|
+
trigger: "_trigger_134up_45",
|
|
481
|
+
disabledText: "_disabledText_134up_47",
|
|
482
|
+
sm: "_sm_134up_69",
|
|
483
|
+
md: "_md_134up_79",
|
|
484
|
+
value: "_value_134up_149",
|
|
485
|
+
placeholder: "_placeholder_134up_151",
|
|
486
|
+
chevron: "_chevron_134up_203",
|
|
487
|
+
chevronOpen: "_chevronOpen_134up_229",
|
|
488
|
+
menu: "_menu_134up_237",
|
|
489
|
+
option: "_option_134up_267",
|
|
490
|
+
selected: "_selected_134up_337",
|
|
491
|
+
message: "_message_134up_357",
|
|
492
|
+
error: "_error_134up_359",
|
|
493
|
+
errorState: "_errorState_134up_385"
|
|
494
|
+
}, K = 8, ie = 6, ae = 120, q = (e, t, n) => {
|
|
481
495
|
if (!e.length) return -1;
|
|
482
496
|
for (let r = 0; r < e.length; r += 1) {
|
|
483
497
|
let i = (t + r * n + e.length) % e.length;
|
|
484
498
|
if (!e[i]?.disabled) return i;
|
|
485
499
|
}
|
|
486
500
|
return -1;
|
|
487
|
-
},
|
|
501
|
+
}, oe = (e) => {
|
|
488
502
|
if (typeof e == "number") return e;
|
|
489
503
|
if (typeof e == "string") {
|
|
490
504
|
let t = Number.parseFloat(e);
|
|
491
505
|
if (Number.isFinite(t)) return t;
|
|
492
506
|
}
|
|
493
507
|
return Infinity;
|
|
494
|
-
},
|
|
495
|
-
let
|
|
496
|
-
let e =
|
|
508
|
+
}, se = ({ options: e, value: r, onChange: i, placeholder: a = "Выберите опцию", disabled: m = !1, stringWhileDisabled: h = !1, label: g, error: _, size: v = "md", hint: y, className: b = "", required: x = !1, name: S, id: C, needMark: w = !0, maxMenuHeight: T }) => {
|
|
509
|
+
let D = c(), O = C ?? `ds-dropdown-${S ?? D}`, k = `${O}-listbox`, [A, j] = f(!1), [M, N] = f(null), P = d(null), F = d(null), I = d(null), L = d([]), R = u(() => e.find((e) => e.value === r), [e, r]), ee = y ? `${O}-hint` : void 0, te = _ ? `${O}-error` : void 0, z = [ee, te].filter(Boolean).join(" ") || void 0, ne = m && h, B = o(() => {
|
|
510
|
+
let e = F.current, t = I.current;
|
|
497
511
|
if (!e || !t) return;
|
|
498
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight - n.bottom -
|
|
499
|
-
|
|
512
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight - n.bottom - K, o = n.top - K, s = a < r.height && o > a, c = Math.max(ae, s ? o : a), l = oe(T), u = Math.min(c, l), d = n.left, f = i - n.width - K, p = Math.max(K, Math.min(d, f)), m = s ? Math.max(K, n.top - r.height - ie) : n.bottom + ie;
|
|
513
|
+
N({
|
|
500
514
|
top: m,
|
|
501
515
|
left: p,
|
|
502
516
|
width: n.width,
|
|
503
517
|
maxHeight: u
|
|
504
518
|
});
|
|
505
|
-
}, [
|
|
519
|
+
}, [T]);
|
|
506
520
|
l(() => {
|
|
507
|
-
if (!
|
|
508
|
-
|
|
521
|
+
if (!A) {
|
|
522
|
+
N(null);
|
|
509
523
|
return;
|
|
510
524
|
}
|
|
511
|
-
return
|
|
512
|
-
window.removeEventListener("resize",
|
|
525
|
+
return B(), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), () => {
|
|
526
|
+
window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0);
|
|
513
527
|
};
|
|
514
528
|
}, [
|
|
515
|
-
|
|
516
|
-
|
|
529
|
+
A,
|
|
530
|
+
B,
|
|
517
531
|
e.length
|
|
518
532
|
]), s(() => {
|
|
519
|
-
if (!
|
|
533
|
+
if (!A) return;
|
|
520
534
|
let e = (e) => {
|
|
521
|
-
let t = e.target, n =
|
|
522
|
-
!n && !r &&
|
|
535
|
+
let t = e.target, n = P.current?.contains(t), r = I.current?.contains(t);
|
|
536
|
+
!n && !r && j(!1);
|
|
523
537
|
}, t = (e) => {
|
|
524
|
-
e.key === "Escape" && (
|
|
538
|
+
e.key === "Escape" && (j(!1), F.current?.focus());
|
|
525
539
|
};
|
|
526
540
|
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
527
541
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
528
542
|
};
|
|
529
|
-
}, [
|
|
530
|
-
let
|
|
531
|
-
let r =
|
|
543
|
+
}, [A]);
|
|
544
|
+
let V = (t, n) => {
|
|
545
|
+
let r = q(e, t, n);
|
|
532
546
|
if (r === -1) return;
|
|
533
|
-
let i =
|
|
547
|
+
let i = L.current[r];
|
|
534
548
|
i?.focus(), i?.scrollIntoView({ block: "nearest" });
|
|
535
|
-
},
|
|
536
|
-
e.disabled || (i?.(e.value, e),
|
|
537
|
-
}, re =
|
|
538
|
-
ref:
|
|
539
|
-
id:
|
|
540
|
-
className:
|
|
549
|
+
}, H = (e) => {
|
|
550
|
+
e.disabled || (i?.(e.value, e), j(!1), F.current?.focus());
|
|
551
|
+
}, re = A ? /* @__PURE__ */ t("ul", {
|
|
552
|
+
ref: I,
|
|
553
|
+
id: k,
|
|
554
|
+
className: G.menu,
|
|
541
555
|
role: "listbox",
|
|
542
556
|
"aria-label": g,
|
|
543
|
-
style:
|
|
557
|
+
style: M ? {
|
|
544
558
|
position: "fixed",
|
|
545
|
-
top:
|
|
546
|
-
left:
|
|
547
|
-
width:
|
|
548
|
-
maxHeight:
|
|
559
|
+
top: M.top,
|
|
560
|
+
left: M.left,
|
|
561
|
+
width: M.width,
|
|
562
|
+
maxHeight: M.maxHeight
|
|
549
563
|
} : {
|
|
550
564
|
position: "fixed",
|
|
551
565
|
top: 0,
|
|
@@ -559,32 +573,32 @@ var T = {
|
|
|
559
573
|
role: "presentation",
|
|
560
574
|
children: /* @__PURE__ */ n("button", {
|
|
561
575
|
ref: (e) => {
|
|
562
|
-
|
|
576
|
+
L.current[a] = e;
|
|
563
577
|
},
|
|
564
578
|
type: "button",
|
|
565
579
|
role: "option",
|
|
566
580
|
"aria-selected": o,
|
|
567
581
|
disabled: i.disabled,
|
|
568
582
|
className: [
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
o ?
|
|
583
|
+
G[v],
|
|
584
|
+
G.option,
|
|
585
|
+
o ? G.selected : ""
|
|
572
586
|
].filter(Boolean).join(" "),
|
|
573
|
-
onClick: () =>
|
|
587
|
+
onClick: () => H(i),
|
|
574
588
|
onKeyDown: (t) => {
|
|
575
589
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
576
590
|
t.preventDefault();
|
|
577
591
|
let e = t.key === "ArrowDown" ? 1 : -1;
|
|
578
|
-
|
|
592
|
+
V(a + e, e);
|
|
579
593
|
}
|
|
580
|
-
if (t.key === "Tab" &&
|
|
594
|
+
if (t.key === "Tab" && j(!1), t.key === "Home" || t.key === "End") {
|
|
581
595
|
t.preventDefault();
|
|
582
596
|
let n = t.key === "Home" ? 1 : -1;
|
|
583
|
-
|
|
597
|
+
V(t.key === "Home" ? 0 : e.length - 1, n);
|
|
584
598
|
}
|
|
585
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
599
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), H(i));
|
|
586
600
|
},
|
|
587
|
-
children: [/* @__PURE__ */ t("span", { children: i.label }), o &&
|
|
601
|
+
children: [/* @__PURE__ */ t("span", { children: i.label }), o && w && /* @__PURE__ */ t("span", {
|
|
588
602
|
"aria-hidden": "true",
|
|
589
603
|
children: "✓"
|
|
590
604
|
})]
|
|
@@ -593,58 +607,60 @@ var T = {
|
|
|
593
607
|
})
|
|
594
608
|
}) : null;
|
|
595
609
|
return /* @__PURE__ */ n("div", {
|
|
596
|
-
ref:
|
|
610
|
+
ref: P,
|
|
597
611
|
className: [
|
|
598
|
-
|
|
599
|
-
_ ?
|
|
612
|
+
G.wrapper,
|
|
613
|
+
_ ? G.errorState : "",
|
|
600
614
|
b
|
|
601
615
|
].filter(Boolean).join(" "),
|
|
602
616
|
children: [
|
|
603
|
-
g && /* @__PURE__ */ t(
|
|
604
|
-
|
|
605
|
-
|
|
617
|
+
g && /* @__PURE__ */ t(E, {
|
|
618
|
+
required: x,
|
|
619
|
+
disabled: m,
|
|
620
|
+
htmlFor: ne ? void 0 : O,
|
|
621
|
+
className: `${G.label} ${G[v]}`,
|
|
606
622
|
children: g
|
|
607
623
|
}),
|
|
608
624
|
/* @__PURE__ */ t("div", {
|
|
609
|
-
className:
|
|
610
|
-
children:
|
|
611
|
-
id:
|
|
612
|
-
className:
|
|
613
|
-
"aria-describedby":
|
|
614
|
-
children:
|
|
625
|
+
className: G.container,
|
|
626
|
+
children: ne ? /* @__PURE__ */ t("div", {
|
|
627
|
+
id: O,
|
|
628
|
+
className: G.disabledText,
|
|
629
|
+
"aria-describedby": z,
|
|
630
|
+
children: R?.label ?? a
|
|
615
631
|
}) : /* @__PURE__ */ n("button", {
|
|
616
|
-
ref:
|
|
617
|
-
id:
|
|
632
|
+
ref: F,
|
|
633
|
+
id: O,
|
|
618
634
|
type: "button",
|
|
619
|
-
name:
|
|
620
|
-
className: `${
|
|
635
|
+
name: S,
|
|
636
|
+
className: `${G.trigger} ${G[v]}`,
|
|
621
637
|
disabled: m,
|
|
622
638
|
"aria-haspopup": "listbox",
|
|
623
|
-
"aria-expanded":
|
|
624
|
-
"aria-controls":
|
|
625
|
-
"aria-describedby":
|
|
639
|
+
"aria-expanded": A,
|
|
640
|
+
"aria-controls": k,
|
|
641
|
+
"aria-describedby": z,
|
|
626
642
|
"aria-invalid": !!_,
|
|
627
|
-
onClick: () =>
|
|
643
|
+
onClick: () => j((e) => !e),
|
|
628
644
|
onKeyDown: (t) => {
|
|
629
645
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
630
|
-
t.preventDefault(),
|
|
646
|
+
t.preventDefault(), j(!0);
|
|
631
647
|
let n = t.key === "ArrowDown" ? 1 : -1;
|
|
632
648
|
requestAnimationFrame(() => {
|
|
633
|
-
|
|
649
|
+
V(t.key === "ArrowDown" ? 0 : e.length - 1, n);
|
|
634
650
|
});
|
|
635
651
|
}
|
|
636
|
-
if (t.key === "Enter" &&
|
|
652
|
+
if (t.key === "Enter" && A) {
|
|
637
653
|
t.preventDefault();
|
|
638
654
|
let n = e.findIndex((e) => e.value === r);
|
|
639
|
-
|
|
655
|
+
V(n >= 0 ? n : 0, 1);
|
|
640
656
|
}
|
|
641
657
|
},
|
|
642
658
|
children: [/* @__PURE__ */ t("span", {
|
|
643
|
-
className: `${
|
|
644
|
-
${
|
|
645
|
-
children:
|
|
659
|
+
className: `${R ? G.value : G.placeholder}
|
|
660
|
+
${G[v]}`,
|
|
661
|
+
children: R?.label ?? a
|
|
646
662
|
}), /* @__PURE__ */ t("span", {
|
|
647
|
-
className: [
|
|
663
|
+
className: [G.chevron, A ? G.chevronOpen : ""].filter(Boolean).join(" "),
|
|
648
664
|
"aria-hidden": "true",
|
|
649
665
|
children: /* @__PURE__ */ t("svg", {
|
|
650
666
|
viewBox: "0 0 20 20",
|
|
@@ -660,38 +676,38 @@ var T = {
|
|
|
660
676
|
})]
|
|
661
677
|
})
|
|
662
678
|
}),
|
|
663
|
-
|
|
679
|
+
A && p(re, document.body),
|
|
664
680
|
y && !_ && /* @__PURE__ */ t("span", {
|
|
665
|
-
id:
|
|
666
|
-
className:
|
|
681
|
+
id: ee,
|
|
682
|
+
className: G.message,
|
|
667
683
|
children: y
|
|
668
684
|
}),
|
|
669
685
|
_ && /* @__PURE__ */ t("span", {
|
|
670
|
-
id:
|
|
671
|
-
className:
|
|
686
|
+
id: te,
|
|
687
|
+
className: G.error,
|
|
672
688
|
children: _
|
|
673
689
|
})
|
|
674
690
|
]
|
|
675
691
|
});
|
|
676
|
-
},
|
|
692
|
+
}, ce = (e) => `${e.id}:${e.direction}`, le = ({ options: e, value: n, onChange: r, label: i = "Сортировка", placeholder: a = "Выберите сортировку", disabled: o = !1, className: s }) => {
|
|
677
693
|
let c = e.flatMap((e) => [{
|
|
678
|
-
value:
|
|
694
|
+
value: ce({
|
|
679
695
|
id: e.id,
|
|
680
696
|
direction: "asc"
|
|
681
697
|
}),
|
|
682
698
|
label: e.ascLabel ?? `${e.label} · по возрастанию`,
|
|
683
699
|
disabled: e.disabled
|
|
684
700
|
}, {
|
|
685
|
-
value:
|
|
701
|
+
value: ce({
|
|
686
702
|
id: e.id,
|
|
687
703
|
direction: "desc"
|
|
688
704
|
}),
|
|
689
705
|
label: e.descLabel ?? `${e.label} · по убыванию`,
|
|
690
706
|
disabled: e.disabled
|
|
691
707
|
}]);
|
|
692
|
-
return /* @__PURE__ */ t(
|
|
708
|
+
return /* @__PURE__ */ t(se, {
|
|
693
709
|
options: c,
|
|
694
|
-
value: n ?
|
|
710
|
+
value: n ? ce(n) : "",
|
|
695
711
|
label: i,
|
|
696
712
|
placeholder: a,
|
|
697
713
|
disabled: o,
|
|
@@ -704,7 +720,7 @@ var T = {
|
|
|
704
720
|
});
|
|
705
721
|
}
|
|
706
722
|
});
|
|
707
|
-
},
|
|
723
|
+
}, J = {
|
|
708
724
|
root: "_root_epm0h_1",
|
|
709
725
|
tableWrap: "_tableWrap_epm0h_3",
|
|
710
726
|
table: "_table_epm0h_3",
|
|
@@ -719,10 +735,10 @@ var T = {
|
|
|
719
735
|
default: "_default_epm0h_47",
|
|
720
736
|
tableOnMobile: "_tableOnMobile_epm0h_47",
|
|
721
737
|
wide: "_wide_epm0h_51"
|
|
722
|
-
},
|
|
738
|
+
}, ue = g({
|
|
723
739
|
rowSortingFeature: h,
|
|
724
740
|
sortedRowModel: m()
|
|
725
|
-
}),
|
|
741
|
+
}), de = (e, t) => {
|
|
726
742
|
let n = /* @__PURE__ */ new Set();
|
|
727
743
|
for (let t of e) {
|
|
728
744
|
if (!t.id.trim()) return "Идентификатор колонки не может быть пустым";
|
|
@@ -734,36 +750,36 @@ var T = {
|
|
|
734
750
|
for (let t of e) if (typeof t.accessor == "string" && !(t.accessor in r)) return `В строке ${n + 1} отсутствует колонка «${t.id}»`;
|
|
735
751
|
}
|
|
736
752
|
return null;
|
|
737
|
-
},
|
|
753
|
+
}, fe = (e, t) => typeof e == "function" ? e(t) : t[e], pe = (e) => {
|
|
738
754
|
if (e == null || e === "") return null;
|
|
739
755
|
let t = Date.parse(String(e));
|
|
740
756
|
return Number.isNaN(t) ? null : t;
|
|
741
|
-
},
|
|
742
|
-
let r =
|
|
757
|
+
}, me = (e, t, n) => {
|
|
758
|
+
let r = pe(e.getValue(n)), i = pe(t.getValue(n));
|
|
743
759
|
return r === null && i === null ? 0 : r === null ? -1 : i === null ? 1 : r - i;
|
|
744
|
-
},
|
|
760
|
+
}, he = (e, t, n) => {
|
|
745
761
|
let r = e.getValue(n), i = t.getValue(n);
|
|
746
762
|
return r == null && i == null ? 0 : r == null ? -1 : i == null ? 1 : Number(r) - Number(i);
|
|
747
|
-
},
|
|
763
|
+
}, ge = (e, t, n) => {
|
|
748
764
|
let r = e.getValue(n), i = t.getValue(n);
|
|
749
765
|
return r == null && i == null ? 0 : r == null ? -1 : i == null ? 1 : Number(!!r) - Number(!!i);
|
|
750
|
-
},
|
|
766
|
+
}, _e = (e, t, n) => {
|
|
751
767
|
let r = String(e.getValue(n) ?? ""), i = String(t.getValue(n) ?? "");
|
|
752
768
|
return r.localeCompare(i, void 0, {
|
|
753
769
|
numeric: !0,
|
|
754
770
|
sensitivity: "base"
|
|
755
771
|
});
|
|
756
|
-
},
|
|
772
|
+
}, ve = (e) => {
|
|
757
773
|
switch (e) {
|
|
758
|
-
case "date": return
|
|
759
|
-
case "number": return
|
|
760
|
-
case "boolean": return
|
|
774
|
+
case "date": return me;
|
|
775
|
+
case "number": return he;
|
|
776
|
+
case "boolean": return ge;
|
|
761
777
|
case "text":
|
|
762
|
-
case void 0: return
|
|
778
|
+
case void 0: return _e;
|
|
763
779
|
case "custom": return;
|
|
764
780
|
}
|
|
765
|
-
},
|
|
766
|
-
let t = (t) =>
|
|
781
|
+
}, ye = (e) => {
|
|
782
|
+
let t = (t) => fe(e.accessor, t), n = e.sortFn ?? ve(e.dataType), r = e.enableSorting ?? (e.dataType !== "custom" && n !== void 0), i = {
|
|
767
783
|
id: e.id,
|
|
768
784
|
accessorFn: t,
|
|
769
785
|
header: () => e.header,
|
|
@@ -775,9 +791,9 @@ var T = {
|
|
|
775
791
|
sortDescFirst: e.sortDescFirst
|
|
776
792
|
};
|
|
777
793
|
return n !== void 0 && (i.sortFn = n), i;
|
|
778
|
-
},
|
|
779
|
-
let [S, C] = f([]), w = o ?? S, T = u(() =>
|
|
780
|
-
features:
|
|
794
|
+
}, be = ({ columns: e, data: r, tableOnMobile: i = !1, breakpoint: a = "default", sorting: o, onSortingChange: s, renderMobileCard: c, getRowId: l, caption: d, ariaLabel: p, loading: m = !1, error: h, emptyState: g = "Нет данных", stickyHeader: v = !1, maxHeight: y, className: b = "", onRowClick: x }) => {
|
|
795
|
+
let [S, C] = f([]), w = o ?? S, T = u(() => de(e, r), [e, r]), E = u(() => e.map(ye), [e]), D = _({
|
|
796
|
+
features: ue,
|
|
781
797
|
columns: E,
|
|
782
798
|
data: r,
|
|
783
799
|
state: { sorting: w },
|
|
@@ -790,17 +806,17 @@ var T = {
|
|
|
790
806
|
id: e.id,
|
|
791
807
|
label: typeof e.header == "string" ? e.header : e.id
|
|
792
808
|
})), A = [
|
|
793
|
-
|
|
794
|
-
a === "wide" ?
|
|
795
|
-
i ?
|
|
809
|
+
J.root,
|
|
810
|
+
a === "wide" ? J.wide : J.default,
|
|
811
|
+
i ? J.tableOnMobile : "",
|
|
796
812
|
b
|
|
797
813
|
].filter(Boolean).join(" "), j = T ?? h;
|
|
798
814
|
return /* @__PURE__ */ n("section", {
|
|
799
815
|
className: A,
|
|
800
816
|
"aria-busy": m,
|
|
801
817
|
children: [
|
|
802
|
-
!i && !m && !j && O.length > 0 && k.length > 0 && /* @__PURE__ */ t(
|
|
803
|
-
className:
|
|
818
|
+
!i && !m && !j && O.length > 0 && k.length > 0 && /* @__PURE__ */ t(le, {
|
|
819
|
+
className: J.mobileSort,
|
|
804
820
|
options: k,
|
|
805
821
|
value: w[0] ? {
|
|
806
822
|
id: w[0].id,
|
|
@@ -812,15 +828,15 @@ var T = {
|
|
|
812
828
|
}])
|
|
813
829
|
}),
|
|
814
830
|
/* @__PURE__ */ t("div", {
|
|
815
|
-
className:
|
|
831
|
+
className: J.tableWrap,
|
|
816
832
|
style: { maxHeight: y },
|
|
817
833
|
children: /* @__PURE__ */ n("table", {
|
|
818
|
-
className:
|
|
834
|
+
className: J.table,
|
|
819
835
|
"aria-label": p,
|
|
820
836
|
children: [
|
|
821
837
|
d && /* @__PURE__ */ t("caption", { children: d }),
|
|
822
838
|
/* @__PURE__ */ t("thead", {
|
|
823
|
-
className: v ?
|
|
839
|
+
className: v ? J.sticky : "",
|
|
824
840
|
children: D.getHeaderGroups().map((e) => /* @__PURE__ */ t("tr", { children: e.headers.map((e) => {
|
|
825
841
|
let r = e.column.getIsSorted(), i = e.column.getCanSort(), a = e.column.getToggleSortingHandler();
|
|
826
842
|
return /* @__PURE__ */ t("th", {
|
|
@@ -828,7 +844,7 @@ var T = {
|
|
|
828
844
|
"aria-sort": r === "asc" ? "ascending" : r === "desc" ? "descending" : "none",
|
|
829
845
|
children: /* @__PURE__ */ n("button", {
|
|
830
846
|
type: "button",
|
|
831
|
-
className:
|
|
847
|
+
className: J.sortButton,
|
|
832
848
|
disabled: !i,
|
|
833
849
|
onClick: a,
|
|
834
850
|
children: [/* @__PURE__ */ t(D.FlexRender, { header: e }), /* @__PURE__ */ t("span", {
|
|
@@ -841,17 +857,17 @@ var T = {
|
|
|
841
857
|
}),
|
|
842
858
|
/* @__PURE__ */ t("tbody", { children: m ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
843
859
|
colSpan: e.length,
|
|
844
|
-
children: /* @__PURE__ */ t(
|
|
860
|
+
children: /* @__PURE__ */ t(W, { lines: 3 })
|
|
845
861
|
}) }) : j ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
846
|
-
className:
|
|
862
|
+
className: J.state,
|
|
847
863
|
colSpan: e.length,
|
|
848
864
|
children: j
|
|
849
865
|
}) }) : O.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
850
|
-
className:
|
|
866
|
+
className: J.state,
|
|
851
867
|
colSpan: e.length,
|
|
852
868
|
children: g
|
|
853
869
|
}) }) : O.map((e) => /* @__PURE__ */ t("tr", {
|
|
854
|
-
className: x ?
|
|
870
|
+
className: x ? J.clickableRow : void 0,
|
|
855
871
|
onClick: () => x?.(e.original),
|
|
856
872
|
onKeyDown: (t) => {
|
|
857
873
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), x?.(e.original));
|
|
@@ -864,14 +880,14 @@ var T = {
|
|
|
864
880
|
})
|
|
865
881
|
}),
|
|
866
882
|
!i && /* @__PURE__ */ t("div", {
|
|
867
|
-
className:
|
|
883
|
+
className: J.cards,
|
|
868
884
|
role: "list",
|
|
869
885
|
"aria-label": p ?? d,
|
|
870
|
-
children: m ? /* @__PURE__ */ t(
|
|
871
|
-
className:
|
|
886
|
+
children: m ? /* @__PURE__ */ t(W, { lines: 4 }) : j ? /* @__PURE__ */ t("div", {
|
|
887
|
+
className: J.state,
|
|
872
888
|
children: j
|
|
873
889
|
}) : O.length === 0 ? /* @__PURE__ */ t("div", {
|
|
874
|
-
className:
|
|
890
|
+
className: J.state,
|
|
875
891
|
children: g
|
|
876
892
|
}) : O.map((r) => {
|
|
877
893
|
if (c) return /* @__PURE__ */ t("div", {
|
|
@@ -881,14 +897,14 @@ var T = {
|
|
|
881
897
|
columns: e
|
|
882
898
|
})
|
|
883
899
|
}, r.id);
|
|
884
|
-
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) =>
|
|
900
|
+
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) => fe(e.accessor, r.original), s = (e) => e.mobile?.renderMobile?.(r.original, o(e)) ?? e.cell?.(r.original, o(e)) ?? String(o(e) ?? "");
|
|
885
901
|
return /* @__PURE__ */ n("article", {
|
|
886
902
|
role: "listitem",
|
|
887
|
-
className:
|
|
903
|
+
className: J.card,
|
|
888
904
|
children: [
|
|
889
905
|
/* @__PURE__ */ t("h3", { children: a ? s(a) : `Строка ${r.index + 1}` }),
|
|
890
906
|
/* @__PURE__ */ t("dl", { children: i.filter((e) => e !== a && e.mobile?.mobileVariant !== "actions").map((e) => /* @__PURE__ */ n("div", {
|
|
891
|
-
className: e.mobile?.mobileSpan === 2 ?
|
|
907
|
+
className: e.mobile?.mobileSpan === 2 ? J.spanTwo : "",
|
|
892
908
|
children: [/* @__PURE__ */ t("dt", { children: e.mobile?.mobileLabel ?? e.header }), /* @__PURE__ */ t("dd", { children: s(e) })]
|
|
893
909
|
}, e.id)) }),
|
|
894
910
|
i.filter((e) => e.mobile?.mobileVariant === "actions").map((e) => /* @__PURE__ */ t("footer", { children: s(e) }, e.id))
|
|
@@ -898,7 +914,7 @@ var T = {
|
|
|
898
914
|
})
|
|
899
915
|
]
|
|
900
916
|
});
|
|
901
|
-
},
|
|
917
|
+
}, xe = ({ options: e, value: r, onChange: i, placeholder: a = "Выберите опции", disabled: o = !1, label: l, error: p, hint: m, className: h = "", name: g, id: _, closeOnSelect: v = !1, maxMenuHeight: y }) => {
|
|
902
918
|
let b = c(), x = _ ?? `ds-dropdown-multiple-${g ?? b}`, [S, C] = f(!1), w = d(null), T = d(null), E = d([]), D = u(() => 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;
|
|
903
919
|
s(() => {
|
|
904
920
|
let e = (e) => {
|
|
@@ -915,30 +931,30 @@ var T = {
|
|
|
915
931
|
let n = r.includes(t.value) ? r.filter((e) => e !== t.value) : [...r, t.value];
|
|
916
932
|
i?.(n, e.filter((e) => n.includes(e.value))), v && (C(!1), T.current?.focus());
|
|
917
933
|
}, M = (t, n) => {
|
|
918
|
-
let r =
|
|
934
|
+
let r = q(e, t, n);
|
|
919
935
|
E.current[r]?.focus(), E.current[r]?.scrollIntoView({ block: "nearest" });
|
|
920
936
|
};
|
|
921
937
|
return /* @__PURE__ */ n("div", {
|
|
922
938
|
ref: w,
|
|
923
939
|
className: [
|
|
924
|
-
|
|
925
|
-
p ?
|
|
940
|
+
G.wrapper,
|
|
941
|
+
p ? G.errorState : "",
|
|
926
942
|
h
|
|
927
943
|
].filter(Boolean).join(" "),
|
|
928
944
|
children: [
|
|
929
945
|
l && /* @__PURE__ */ t("label", {
|
|
930
946
|
htmlFor: x,
|
|
931
|
-
className:
|
|
947
|
+
className: G.label,
|
|
932
948
|
children: l
|
|
933
949
|
}),
|
|
934
950
|
/* @__PURE__ */ n("div", {
|
|
935
|
-
className:
|
|
951
|
+
className: G.container,
|
|
936
952
|
children: [/* @__PURE__ */ n("button", {
|
|
937
953
|
ref: T,
|
|
938
954
|
id: x,
|
|
939
955
|
type: "button",
|
|
940
956
|
name: g,
|
|
941
|
-
className:
|
|
957
|
+
className: G.trigger,
|
|
942
958
|
disabled: o,
|
|
943
959
|
"aria-haspopup": "listbox",
|
|
944
960
|
"aria-expanded": S,
|
|
@@ -954,16 +970,16 @@ var T = {
|
|
|
954
970
|
}
|
|
955
971
|
},
|
|
956
972
|
children: [/* @__PURE__ */ t("span", {
|
|
957
|
-
className: D.length ?
|
|
973
|
+
className: D.length ? G.value : G.placeholder,
|
|
958
974
|
children: O || a
|
|
959
975
|
}), /* @__PURE__ */ t("span", {
|
|
960
|
-
className: `${
|
|
976
|
+
className: `${G.chevron} ${S ? G.chevronOpen : ""}`,
|
|
961
977
|
"aria-hidden": "true",
|
|
962
978
|
children: "⌄"
|
|
963
979
|
})]
|
|
964
980
|
}), S && /* @__PURE__ */ t("ul", {
|
|
965
981
|
id: `${x}-listbox`,
|
|
966
|
-
className:
|
|
982
|
+
className: G.menu,
|
|
967
983
|
role: "listbox",
|
|
968
984
|
"aria-label": l,
|
|
969
985
|
"aria-multiselectable": "true",
|
|
@@ -980,7 +996,7 @@ var T = {
|
|
|
980
996
|
role: "option",
|
|
981
997
|
"aria-selected": o,
|
|
982
998
|
disabled: i.disabled,
|
|
983
|
-
className: `${
|
|
999
|
+
className: `${G.option} ${o ? G.selected : ""}`,
|
|
984
1000
|
onClick: () => j(i),
|
|
985
1001
|
onKeyDown: (t) => {
|
|
986
1002
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
@@ -1006,17 +1022,17 @@ var T = {
|
|
|
1006
1022
|
}),
|
|
1007
1023
|
m && !p && /* @__PURE__ */ t("span", {
|
|
1008
1024
|
id: k,
|
|
1009
|
-
className:
|
|
1025
|
+
className: G.message,
|
|
1010
1026
|
children: m
|
|
1011
1027
|
}),
|
|
1012
1028
|
p && /* @__PURE__ */ t("span", {
|
|
1013
1029
|
id: A,
|
|
1014
|
-
className:
|
|
1030
|
+
className: G.error,
|
|
1015
1031
|
children: p
|
|
1016
1032
|
})
|
|
1017
1033
|
]
|
|
1018
1034
|
});
|
|
1019
|
-
},
|
|
1035
|
+
}, Se = {
|
|
1020
1036
|
approve: "M4 12l5 5L20 6",
|
|
1021
1037
|
reject: "M5 5l14 14M19 5L5 19",
|
|
1022
1038
|
edit: "M4 20h4L19 9l-4-4L4 16v4z",
|
|
@@ -1025,7 +1041,7 @@ var T = {
|
|
|
1025
1041
|
basket: "M4 7h16l-1 13H5L4 7zm3 0V4h10v3",
|
|
1026
1042
|
info: "M12 10v7m0-10v.01",
|
|
1027
1043
|
warning: "M12 4L3 20h18L12 4zm0 5v5m0 3v.01"
|
|
1028
|
-
},
|
|
1044
|
+
}, Ce = ({ name: e, title: r, width: i = 24, height: a = 24, ...o }) => /* @__PURE__ */ n("svg", {
|
|
1029
1045
|
viewBox: "0 0 24 24",
|
|
1030
1046
|
width: i,
|
|
1031
1047
|
height: a,
|
|
@@ -1038,27 +1054,27 @@ var T = {
|
|
|
1038
1054
|
"aria-hidden": !r || void 0,
|
|
1039
1055
|
focusable: "false",
|
|
1040
1056
|
...o,
|
|
1041
|
-
children: [r && /* @__PURE__ */ t("title", { children: r }), /* @__PURE__ */ t("path", { d:
|
|
1042
|
-
}),
|
|
1057
|
+
children: [r && /* @__PURE__ */ t("title", { children: r }), /* @__PURE__ */ t("path", { d: Se[e] })]
|
|
1058
|
+
}), we = {
|
|
1043
1059
|
root: "_root_1y2s8_1",
|
|
1044
1060
|
header: "_header_1y2s8_21",
|
|
1045
1061
|
title: "_title_1y2s8_41",
|
|
1046
1062
|
dismiss: "_dismiss_1y2s8_55",
|
|
1047
1063
|
content: "_content_1y2s8_113"
|
|
1048
|
-
},
|
|
1064
|
+
}, Te = ({ title: e, children: r, dismissible: i = !1, onDismiss: a, dismissLabel: o = "Закрыть информационный блок", headingAs: s = "h3", className: l = "" }) => {
|
|
1049
1065
|
let u = `ds-info-block-${c()}`;
|
|
1050
1066
|
return /* @__PURE__ */ n("section", {
|
|
1051
|
-
className: `${
|
|
1067
|
+
className: `${we.root} ${l}`,
|
|
1052
1068
|
"aria-labelledby": u,
|
|
1053
1069
|
children: [/* @__PURE__ */ n("header", {
|
|
1054
|
-
className:
|
|
1070
|
+
className: we.header,
|
|
1055
1071
|
children: [/* @__PURE__ */ t(s, {
|
|
1056
1072
|
id: u,
|
|
1057
|
-
className:
|
|
1073
|
+
className: we.title,
|
|
1058
1074
|
children: e
|
|
1059
1075
|
}), i && /* @__PURE__ */ t("button", {
|
|
1060
1076
|
type: "button",
|
|
1061
|
-
className:
|
|
1077
|
+
className: we.dismiss,
|
|
1062
1078
|
onClick: a,
|
|
1063
1079
|
"aria-label": o,
|
|
1064
1080
|
children: /* @__PURE__ */ t("svg", {
|
|
@@ -1074,11 +1090,11 @@ var T = {
|
|
|
1074
1090
|
})
|
|
1075
1091
|
})]
|
|
1076
1092
|
}), /* @__PURE__ */ t("div", {
|
|
1077
|
-
className:
|
|
1093
|
+
className: we.content,
|
|
1078
1094
|
children: r
|
|
1079
1095
|
})]
|
|
1080
1096
|
});
|
|
1081
|
-
},
|
|
1097
|
+
}, Y = {
|
|
1082
1098
|
wrapper: "_wrapper_v5lkp_1",
|
|
1083
1099
|
control: "_control_v5lkp_3",
|
|
1084
1100
|
input: "_input_v5lkp_5",
|
|
@@ -1088,12 +1104,12 @@ var T = {
|
|
|
1088
1104
|
lg: "_lg_v5lkp_65",
|
|
1089
1105
|
inputError: "_inputError_v5lkp_77",
|
|
1090
1106
|
trailingAction: "_trailingAction_v5lkp_79"
|
|
1091
|
-
},
|
|
1107
|
+
}, Ee = ({ value: e, onChange: r, type: i = "text", placeholder: a = "", disabled: o = !1, readOnly: l = !1, stringWhileDisabled: u = !1, label: p, error: m, hint: h, className: g = "", name: _, id: v, size: y = "md", clearable: b = !0, required: x = !1, selectTextOnFocus: S = !1, isPassword: C = !1, passwordVisibleLabel: w = "Скрыть пароль", passwordHiddenLabel: T = "Показать пароль", onFocus: O, ...k }) => {
|
|
1092
1108
|
let A = c(), j = v ?? `ds-input-${_ ?? A}`, M = d(null), [N, P] = f(!1), F = h ? `${j}-hint` : void 0, I = m ? `${j}-error` : void 0, L = String(e ?? ""), R = [F, I].filter(Boolean).join(" ") || void 0, ee = C ? N ? "text" : "password" : i;
|
|
1093
1109
|
return s(() => {
|
|
1094
1110
|
C || P(!1);
|
|
1095
1111
|
}, [C]), /* @__PURE__ */ n("div", {
|
|
1096
|
-
className: `${
|
|
1112
|
+
className: `${Y.wrapper} ${g}`,
|
|
1097
1113
|
children: [
|
|
1098
1114
|
p && /* @__PURE__ */ t(E, {
|
|
1099
1115
|
htmlFor: j,
|
|
@@ -1103,11 +1119,11 @@ var T = {
|
|
|
1103
1119
|
}),
|
|
1104
1120
|
o && u ? /* @__PURE__ */ t("div", {
|
|
1105
1121
|
id: j,
|
|
1106
|
-
className:
|
|
1122
|
+
className: Y.disabledText,
|
|
1107
1123
|
"aria-describedby": R,
|
|
1108
1124
|
children: L || a
|
|
1109
1125
|
}) : /* @__PURE__ */ n("div", {
|
|
1110
|
-
className:
|
|
1126
|
+
className: Y.control,
|
|
1111
1127
|
children: [
|
|
1112
1128
|
/* @__PURE__ */ t("input", {
|
|
1113
1129
|
ref: M,
|
|
@@ -1121,7 +1137,7 @@ var T = {
|
|
|
1121
1137
|
required: x,
|
|
1122
1138
|
"aria-invalid": !!m,
|
|
1123
1139
|
"aria-describedby": R,
|
|
1124
|
-
className: `${
|
|
1140
|
+
className: `${Y.input} ${Y[y]} ${m ? Y.inputError : ""}`,
|
|
1125
1141
|
onChange: (e) => {
|
|
1126
1142
|
if (i === "number" && !C) {
|
|
1127
1143
|
let t = e.target.value === "" ? "" : Number(e.target.value);
|
|
@@ -1137,7 +1153,7 @@ var T = {
|
|
|
1137
1153
|
}),
|
|
1138
1154
|
C && /* @__PURE__ */ t("button", {
|
|
1139
1155
|
type: "button",
|
|
1140
|
-
className:
|
|
1156
|
+
className: Y.trailingAction,
|
|
1141
1157
|
disabled: o,
|
|
1142
1158
|
"aria-label": N ? w : T,
|
|
1143
1159
|
"aria-pressed": N,
|
|
@@ -1158,7 +1174,7 @@ var T = {
|
|
|
1158
1174
|
}),
|
|
1159
1175
|
!C && b && L && !o && !l && /* @__PURE__ */ t("button", {
|
|
1160
1176
|
type: "button",
|
|
1161
|
-
className:
|
|
1177
|
+
className: Y.trailingAction,
|
|
1162
1178
|
"aria-label": "Очистить поле",
|
|
1163
1179
|
onClick: () => {
|
|
1164
1180
|
let e = M.current;
|
|
@@ -1179,22 +1195,22 @@ var T = {
|
|
|
1179
1195
|
})
|
|
1180
1196
|
]
|
|
1181
1197
|
});
|
|
1182
|
-
},
|
|
1198
|
+
}, De = {
|
|
1183
1199
|
wrapper: "_wrapper_vu1ob_1",
|
|
1184
1200
|
input: "_input_vu1ob_21",
|
|
1185
1201
|
switch: "_switch_vu1ob_35",
|
|
1186
1202
|
thumb: "_thumb_vu1ob_67",
|
|
1187
1203
|
label: "_label_vu1ob_111",
|
|
1188
1204
|
disabled: "_disabled_vu1ob_123"
|
|
1189
|
-
},
|
|
1205
|
+
}, Oe = ({ checked: e, onChange: r, label: i, disabled: a = !1, readOnly: o = !1, className: s = "", name: l, id: u, value: d }) => {
|
|
1190
1206
|
let f = c(), p = u ?? `ds-radio-button-${l ?? f}`;
|
|
1191
1207
|
return /* @__PURE__ */ n("label", {
|
|
1192
1208
|
htmlFor: p,
|
|
1193
|
-
className: `${
|
|
1209
|
+
className: `${De.wrapper} ${a ? De.disabled : ""} ${s}`,
|
|
1194
1210
|
children: [
|
|
1195
1211
|
/* @__PURE__ */ t("input", {
|
|
1196
1212
|
id: p,
|
|
1197
|
-
className:
|
|
1213
|
+
className: De.input,
|
|
1198
1214
|
type: "checkbox",
|
|
1199
1215
|
role: "switch",
|
|
1200
1216
|
name: l,
|
|
@@ -1207,21 +1223,21 @@ var T = {
|
|
|
1207
1223
|
}
|
|
1208
1224
|
}),
|
|
1209
1225
|
/* @__PURE__ */ t("span", {
|
|
1210
|
-
className:
|
|
1226
|
+
className: De.switch,
|
|
1211
1227
|
"aria-hidden": "true",
|
|
1212
|
-
children: /* @__PURE__ */ t("span", { className:
|
|
1228
|
+
children: /* @__PURE__ */ t("span", { className: De.thumb })
|
|
1213
1229
|
}),
|
|
1214
1230
|
i && /* @__PURE__ */ t("span", {
|
|
1215
|
-
className:
|
|
1231
|
+
className: De.label,
|
|
1216
1232
|
children: i
|
|
1217
1233
|
})
|
|
1218
1234
|
]
|
|
1219
1235
|
});
|
|
1220
|
-
},
|
|
1236
|
+
}, ke = {
|
|
1221
1237
|
root: "_root_kepgo_1",
|
|
1222
1238
|
grid: "_grid_kepgo_3",
|
|
1223
1239
|
actions: "_actions_kepgo_5"
|
|
1224
|
-
},
|
|
1240
|
+
}, Ae = ({ filters: e, values: r, onChange: i, onApply: a, onReset: o, applyMode: s = "instant", loading: c = !1, disabled: l = !1, className: u = "" }) => {
|
|
1225
1241
|
let d = (e, t) => {
|
|
1226
1242
|
let n = {
|
|
1227
1243
|
...r,
|
|
@@ -1230,11 +1246,11 @@ var T = {
|
|
|
1230
1246
|
i?.(n, e), s === "instant" && a?.(n);
|
|
1231
1247
|
};
|
|
1232
1248
|
return /* @__PURE__ */ n("section", {
|
|
1233
|
-
className: `${
|
|
1249
|
+
className: `${ke.root} ${u}`,
|
|
1234
1250
|
"aria-label": "Фильтры",
|
|
1235
1251
|
"aria-busy": c,
|
|
1236
1252
|
children: [/* @__PURE__ */ t("div", {
|
|
1237
|
-
className:
|
|
1253
|
+
className: ke.grid,
|
|
1238
1254
|
children: e.filter((e) => !e.hidden).map((e) => {
|
|
1239
1255
|
let n = l || c || e.disabled, i = r[e.id];
|
|
1240
1256
|
if (e.type === "input") {
|
|
@@ -1244,19 +1260,19 @@ var T = {
|
|
|
1244
1260
|
placeholder: e.placeholder,
|
|
1245
1261
|
disabled: n
|
|
1246
1262
|
};
|
|
1247
|
-
return e.inputType === "number" ? /* @__PURE__ */ t(
|
|
1263
|
+
return e.inputType === "number" ? /* @__PURE__ */ t(Ee, {
|
|
1248
1264
|
...r,
|
|
1249
1265
|
type: "number",
|
|
1250
1266
|
value: i ?? "",
|
|
1251
1267
|
onChange: (t) => d(e.id, t)
|
|
1252
|
-
}, e.id) : /* @__PURE__ */ t(
|
|
1268
|
+
}, e.id) : /* @__PURE__ */ t(Ee, {
|
|
1253
1269
|
...r,
|
|
1254
1270
|
type: "text",
|
|
1255
1271
|
value: String(i ?? ""),
|
|
1256
1272
|
onChange: (t) => d(e.id, t)
|
|
1257
1273
|
}, e.id);
|
|
1258
1274
|
}
|
|
1259
|
-
if (e.type === "dropdown") return /* @__PURE__ */ t(
|
|
1275
|
+
if (e.type === "dropdown") return /* @__PURE__ */ t(se, {
|
|
1260
1276
|
label: e.label,
|
|
1261
1277
|
hint: e.hint,
|
|
1262
1278
|
placeholder: e.placeholder,
|
|
@@ -1265,7 +1281,7 @@ var T = {
|
|
|
1265
1281
|
disabled: n,
|
|
1266
1282
|
onChange: (t) => d(e.id, t)
|
|
1267
1283
|
}, e.id);
|
|
1268
|
-
if (e.type === "multiple") return /* @__PURE__ */ t(
|
|
1284
|
+
if (e.type === "multiple") return /* @__PURE__ */ t(xe, {
|
|
1269
1285
|
label: e.label,
|
|
1270
1286
|
hint: e.hint,
|
|
1271
1287
|
placeholder: e.placeholder,
|
|
@@ -1281,7 +1297,7 @@ var T = {
|
|
|
1281
1297
|
disabled: n,
|
|
1282
1298
|
onChange: (t) => d(e.id, t)
|
|
1283
1299
|
}, e.id);
|
|
1284
|
-
if (e.type === "radio") return /* @__PURE__ */ t(
|
|
1300
|
+
if (e.type === "radio") return /* @__PURE__ */ t(Oe, {
|
|
1285
1301
|
label: e.label,
|
|
1286
1302
|
checked: !!i,
|
|
1287
1303
|
disabled: n,
|
|
@@ -1291,7 +1307,7 @@ var T = {
|
|
|
1291
1307
|
from: null,
|
|
1292
1308
|
to: null
|
|
1293
1309
|
};
|
|
1294
|
-
return /* @__PURE__ */ t(
|
|
1310
|
+
return /* @__PURE__ */ t(re, {
|
|
1295
1311
|
hint: e.hint,
|
|
1296
1312
|
mode: e.mode,
|
|
1297
1313
|
min: e.min,
|
|
@@ -1302,7 +1318,7 @@ var T = {
|
|
|
1302
1318
|
}, e.id);
|
|
1303
1319
|
})
|
|
1304
1320
|
}), (o || s === "manual") && /* @__PURE__ */ n("div", {
|
|
1305
|
-
className:
|
|
1321
|
+
className: ke.actions,
|
|
1306
1322
|
children: [o && /* @__PURE__ */ t(w, {
|
|
1307
1323
|
variant: "destructiveOutline",
|
|
1308
1324
|
disabled: l || c,
|
|
@@ -1316,7 +1332,7 @@ var T = {
|
|
|
1316
1332
|
})]
|
|
1317
1333
|
})]
|
|
1318
1334
|
});
|
|
1319
|
-
},
|
|
1335
|
+
}, X = {
|
|
1320
1336
|
wrapper: "_wrapper_1ymdr_1",
|
|
1321
1337
|
dropzone: "_dropzone_1ymdr_3",
|
|
1322
1338
|
dragActive: "_dragActive_1ymdr_5",
|
|
@@ -1330,12 +1346,12 @@ var T = {
|
|
|
1330
1346
|
file: "_file_1ymdr_19",
|
|
1331
1347
|
fileName: "_fileName_1ymdr_23",
|
|
1332
1348
|
fileSize: "_fileSize_1ymdr_25"
|
|
1333
|
-
},
|
|
1349
|
+
}, je = (e) => `${e.name}:${e.size}:${e.lastModified}`, Me = (e) => e < 1024 ? `${e} Б` : e < 1048576 ? `${(e / 1024).toFixed(1)} КБ` : `${(e / 1024 / 1024).toFixed(1)} МБ`, Ne = (e, t) => !t || t.split(",").map((e) => e.trim().toLowerCase()).some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t) : t.endsWith("/*") ? e.type.startsWith(t.slice(0, -1)) : e.type.toLowerCase() === t), Pe = ({ value: r, onChange: i, multiple: a = !1, accept: o, maxSize: s, maxFiles: l, label: u, hint: p, error: m, required: h = !1, disabled: g = !1, readOnly: _ = !1, name: v, id: y, className: b = "", dropLabel: x = "Перетащите файлы в эту область", browseLabel: S = "Выбрать файлы", addMoreLabel: C = "Добавить ещё", onReject: T }) => {
|
|
1334
1350
|
let O = c(), k = y ?? `ds-file-input-${v ?? O}`, A = d(null), j = d(0), [M, N] = f(!1), P = p ? `${k}-hint` : void 0, F = m ? `${k}-error` : void 0, I = [P, F].filter(Boolean).join(" ") || void 0, L = !g && !_, R = (e) => {
|
|
1335
|
-
let t = [], n = new Set(r.map(
|
|
1351
|
+
let t = [], n = new Set(r.map(je)), c = e.filter((e) => Ne(e, o) ? s !== void 0 && e.size > s ? (t.push({
|
|
1336
1352
|
file: e,
|
|
1337
1353
|
reason: "maxSize"
|
|
1338
|
-
}), !1) : !n.has(
|
|
1354
|
+
}), !1) : !n.has(je(e)) && (n.add(je(e)), !0) : (t.push({
|
|
1339
1355
|
file: e,
|
|
1340
1356
|
reason: "accept"
|
|
1341
1357
|
}), !1)), u = a ? l : 1, d = a ? [...r, ...c] : c.slice(-1);
|
|
@@ -1345,7 +1361,7 @@ var T = {
|
|
|
1345
1361
|
})), d = d.slice(0, u)), t.length && T?.(t), c.length && i?.(d), A.current && (A.current.value = "");
|
|
1346
1362
|
};
|
|
1347
1363
|
return /* @__PURE__ */ n("div", {
|
|
1348
|
-
className: `${
|
|
1364
|
+
className: `${X.wrapper} ${b}`,
|
|
1349
1365
|
children: [
|
|
1350
1366
|
u && /* @__PURE__ */ t(E, {
|
|
1351
1367
|
htmlFor: k,
|
|
@@ -1354,7 +1370,7 @@ var T = {
|
|
|
1354
1370
|
children: u
|
|
1355
1371
|
}),
|
|
1356
1372
|
/* @__PURE__ */ n("div", {
|
|
1357
|
-
className: `${
|
|
1373
|
+
className: `${X.dropzone} ${M ? X.dragActive : ""} ${g ? X.disabled : ""} ${m ? X.error : ""}`,
|
|
1358
1374
|
onDragEnter: (e) => {
|
|
1359
1375
|
e.preventDefault(), L && ++j.current === 1 && N(!0);
|
|
1360
1376
|
},
|
|
@@ -1369,7 +1385,7 @@ var T = {
|
|
|
1369
1385
|
ref: A,
|
|
1370
1386
|
id: k,
|
|
1371
1387
|
name: v,
|
|
1372
|
-
className:
|
|
1388
|
+
className: X.nativeInput,
|
|
1373
1389
|
type: "file",
|
|
1374
1390
|
multiple: a,
|
|
1375
1391
|
accept: o,
|
|
@@ -1380,19 +1396,19 @@ var T = {
|
|
|
1380
1396
|
onChange: (e) => R(Array.from(e.target.files ?? []))
|
|
1381
1397
|
}), r.length ? /* @__PURE__ */ n(e, { children: [
|
|
1382
1398
|
/* @__PURE__ */ t("ul", {
|
|
1383
|
-
className:
|
|
1399
|
+
className: X.files,
|
|
1384
1400
|
"aria-live": "polite",
|
|
1385
1401
|
children: r.map((e, a) => /* @__PURE__ */ n("li", {
|
|
1386
|
-
className:
|
|
1402
|
+
className: X.file,
|
|
1387
1403
|
children: [
|
|
1388
1404
|
/* @__PURE__ */ t("span", {
|
|
1389
|
-
className:
|
|
1405
|
+
className: X.fileName,
|
|
1390
1406
|
title: e.name,
|
|
1391
1407
|
children: e.name
|
|
1392
1408
|
}),
|
|
1393
1409
|
/* @__PURE__ */ t("span", {
|
|
1394
|
-
className:
|
|
1395
|
-
children:
|
|
1410
|
+
className: X.fileSize,
|
|
1411
|
+
children: Me(e.size)
|
|
1396
1412
|
}),
|
|
1397
1413
|
L && /* @__PURE__ */ t(w, {
|
|
1398
1414
|
variant: "empty",
|
|
@@ -1402,31 +1418,31 @@ var T = {
|
|
|
1402
1418
|
children: "×"
|
|
1403
1419
|
})
|
|
1404
1420
|
]
|
|
1405
|
-
},
|
|
1421
|
+
}, je(e)))
|
|
1406
1422
|
}),
|
|
1407
1423
|
L && (a || r.length === 0) && /* @__PURE__ */ t(w, {
|
|
1408
|
-
className:
|
|
1424
|
+
className: X.browseButton,
|
|
1409
1425
|
size: "sm",
|
|
1410
1426
|
onClick: () => A.current?.click(),
|
|
1411
1427
|
children: C
|
|
1412
1428
|
}),
|
|
1413
1429
|
L && !a && /* @__PURE__ */ t(w, {
|
|
1414
|
-
className:
|
|
1430
|
+
className: X.browseButton,
|
|
1415
1431
|
size: "sm",
|
|
1416
1432
|
onClick: () => A.current?.click(),
|
|
1417
1433
|
children: S
|
|
1418
1434
|
})
|
|
1419
1435
|
] }) : /* @__PURE__ */ n("div", {
|
|
1420
|
-
className:
|
|
1436
|
+
className: X.empty,
|
|
1421
1437
|
children: [
|
|
1422
1438
|
/* @__PURE__ */ t("span", {
|
|
1423
|
-
className:
|
|
1439
|
+
className: X.uploadIcon,
|
|
1424
1440
|
"aria-hidden": "true",
|
|
1425
1441
|
children: "↑"
|
|
1426
1442
|
}),
|
|
1427
1443
|
/* @__PURE__ */ t("strong", { children: M ? "Отпустите файлы здесь" : x }),
|
|
1428
1444
|
!M && L && /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", { children: "или" }), /* @__PURE__ */ t(w, {
|
|
1429
|
-
className:
|
|
1445
|
+
className: X.browseButton,
|
|
1430
1446
|
onClick: () => A.current?.click(),
|
|
1431
1447
|
children: S
|
|
1432
1448
|
})] })
|
|
@@ -1445,11 +1461,11 @@ var T = {
|
|
|
1445
1461
|
})
|
|
1446
1462
|
]
|
|
1447
1463
|
});
|
|
1448
|
-
},
|
|
1464
|
+
}, Fe = 0, Z = v((e) => ({
|
|
1449
1465
|
modals: [],
|
|
1450
1466
|
openModal: (t, n = {}, r = {}) => {
|
|
1451
|
-
|
|
1452
|
-
let i = `ds-modal-${
|
|
1467
|
+
Fe += 1;
|
|
1468
|
+
let i = `ds-modal-${Fe}`;
|
|
1453
1469
|
return e((e) => ({ modals: [...e.modals, {
|
|
1454
1470
|
id: i,
|
|
1455
1471
|
name: t,
|
|
@@ -1461,7 +1477,7 @@ var T = {
|
|
|
1461
1477
|
closeModal: (t) => e((e) => ({ modals: e.modals.filter((e) => e.id !== t) })),
|
|
1462
1478
|
closeTopModal: () => e((e) => ({ modals: e.modals.slice(0, -1) })),
|
|
1463
1479
|
closeAllModals: () => e({ modals: [] })
|
|
1464
|
-
})),
|
|
1480
|
+
})), Ie = () => Z.setState({ modals: [] }), Q = {
|
|
1465
1481
|
layer: "_layer_1nb2z_1",
|
|
1466
1482
|
backdrop: "_backdrop_1nb2z_3",
|
|
1467
1483
|
panel: "_panel_1nb2z_5",
|
|
@@ -1469,14 +1485,14 @@ var T = {
|
|
|
1469
1485
|
title: "_title_1nb2z_11",
|
|
1470
1486
|
description: "_description_1nb2z_13",
|
|
1471
1487
|
content: "_content_1nb2z_15"
|
|
1472
|
-
},
|
|
1473
|
-
let f = c(), p = c(), m = d(null), h =
|
|
1488
|
+
}, Le = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])", Re = ({ children: e, title: r, description: i, modalId: a, closeLabel: o = "Закрыть модальное окно", className: l = "", role: u = "dialog" }) => {
|
|
1489
|
+
let f = c(), p = c(), m = d(null), h = Z((e) => e.closeModal);
|
|
1474
1490
|
return s(() => {
|
|
1475
1491
|
let e = document.activeElement, t = m.current;
|
|
1476
|
-
return (t?.querySelector(
|
|
1492
|
+
return (t?.querySelector(Le) ?? t)?.focus(), () => e?.focus();
|
|
1477
1493
|
}, []), /* @__PURE__ */ n("div", {
|
|
1478
1494
|
ref: m,
|
|
1479
|
-
className: `${
|
|
1495
|
+
className: `${Q.panel} ${l}`,
|
|
1480
1496
|
role: u,
|
|
1481
1497
|
"aria-modal": "true",
|
|
1482
1498
|
"aria-labelledby": r ? f : void 0,
|
|
@@ -1484,7 +1500,7 @@ var T = {
|
|
|
1484
1500
|
tabIndex: -1,
|
|
1485
1501
|
onKeyDown: (e) => {
|
|
1486
1502
|
if (e.key !== "Tab") return;
|
|
1487
|
-
let t = Array.from(m.current?.querySelectorAll(
|
|
1503
|
+
let t = Array.from(m.current?.querySelectorAll(Le) ?? []);
|
|
1488
1504
|
if (!t.length) {
|
|
1489
1505
|
e.preventDefault();
|
|
1490
1506
|
return;
|
|
@@ -1494,10 +1510,10 @@ var T = {
|
|
|
1494
1510
|
},
|
|
1495
1511
|
children: [
|
|
1496
1512
|
(r || o) && /* @__PURE__ */ n("header", {
|
|
1497
|
-
className:
|
|
1513
|
+
className: Q.header,
|
|
1498
1514
|
children: [r && /* @__PURE__ */ t("h2", {
|
|
1499
1515
|
id: f,
|
|
1500
|
-
className:
|
|
1516
|
+
className: Q.title,
|
|
1501
1517
|
children: r
|
|
1502
1518
|
}), /* @__PURE__ */ t(w, {
|
|
1503
1519
|
variant: "empty",
|
|
@@ -1520,31 +1536,31 @@ var T = {
|
|
|
1520
1536
|
}),
|
|
1521
1537
|
i && /* @__PURE__ */ t("p", {
|
|
1522
1538
|
id: p,
|
|
1523
|
-
className:
|
|
1539
|
+
className: Q.description,
|
|
1524
1540
|
children: i
|
|
1525
1541
|
}),
|
|
1526
1542
|
/* @__PURE__ */ t("div", {
|
|
1527
|
-
className:
|
|
1543
|
+
className: Q.content,
|
|
1528
1544
|
children: e
|
|
1529
1545
|
})
|
|
1530
1546
|
]
|
|
1531
1547
|
});
|
|
1532
|
-
},
|
|
1533
|
-
let n =
|
|
1548
|
+
}, ze = ({ registry: e }) => {
|
|
1549
|
+
let n = Z((e) => e.modals), r = Z((e) => e.closeModal), i = Z((e) => e.closeAllModals);
|
|
1534
1550
|
return s(() => {
|
|
1535
1551
|
let e = (e) => {
|
|
1536
1552
|
if (e.key !== "Escape") return;
|
|
1537
|
-
let t =
|
|
1553
|
+
let t = Z.getState().modals.at(-1);
|
|
1538
1554
|
t?.closeOnEscape && r(t.id);
|
|
1539
1555
|
};
|
|
1540
1556
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1541
1557
|
}, [r]), !n.length || typeof document > "u" ? null : p(/* @__PURE__ */ t("div", {
|
|
1542
|
-
className:
|
|
1558
|
+
className: Q.layer,
|
|
1543
1559
|
"aria-label": "Модальные окна",
|
|
1544
1560
|
children: n.map((a, o) => {
|
|
1545
1561
|
let s = e[a.name];
|
|
1546
1562
|
return s ? /* @__PURE__ */ t("div", {
|
|
1547
|
-
className:
|
|
1563
|
+
className: Q.backdrop,
|
|
1548
1564
|
"aria-hidden": o !== n.length - 1 || void 0,
|
|
1549
1565
|
onMouseDown: (e) => {
|
|
1550
1566
|
e.target === e.currentTarget && a.closeOnBackdrop && r(a.id);
|
|
@@ -1558,31 +1574,31 @@ var T = {
|
|
|
1558
1574
|
}, a.id) : null;
|
|
1559
1575
|
})
|
|
1560
1576
|
}), document.body);
|
|
1561
|
-
},
|
|
1562
|
-
let o =
|
|
1577
|
+
}, Be = ({ registry: r, children: i, lockBodyScroll: a = !0 }) => {
|
|
1578
|
+
let o = Z((e) => e.modals.length);
|
|
1563
1579
|
return s(() => {
|
|
1564
1580
|
if (!a || o === 0) return;
|
|
1565
1581
|
let e = document.body.style.overflow;
|
|
1566
1582
|
return document.body.style.overflow = "hidden", () => {
|
|
1567
1583
|
document.body.style.overflow = e;
|
|
1568
1584
|
};
|
|
1569
|
-
}, [a, o]), /* @__PURE__ */ n(e, { children: [i, /* @__PURE__ */ t(
|
|
1570
|
-
},
|
|
1585
|
+
}, [a, o]), /* @__PURE__ */ n(e, { children: [i, /* @__PURE__ */ t(ze, { registry: r })] });
|
|
1586
|
+
}, Ve = (e) => e, He = {
|
|
1571
1587
|
message: "_message_1vtru_1",
|
|
1572
1588
|
actions: "_actions_1vtru_3"
|
|
1573
|
-
},
|
|
1589
|
+
}, Ue = /* @__PURE__ */ new Map(), We = 0, Ge = ({ modalId: e, close: r, title: i = "Подтверждение", message: a = "Продолжить действие?", confirmLabel: o = "Подтвердить", cancelLabel: s = "Отмена", tone: c = "default", requestId: l }) => {
|
|
1574
1590
|
let u = (e) => {
|
|
1575
|
-
|
|
1591
|
+
Ue.get(l)?.(e), Ue.delete(l), r();
|
|
1576
1592
|
};
|
|
1577
|
-
return /* @__PURE__ */ n(
|
|
1593
|
+
return /* @__PURE__ */ n(Re, {
|
|
1578
1594
|
modalId: e,
|
|
1579
1595
|
title: i,
|
|
1580
1596
|
role: "alertdialog",
|
|
1581
1597
|
children: [/* @__PURE__ */ t("p", {
|
|
1582
|
-
className:
|
|
1598
|
+
className: He.message,
|
|
1583
1599
|
children: a
|
|
1584
1600
|
}), /* @__PURE__ */ n("div", {
|
|
1585
|
-
className:
|
|
1601
|
+
className: He.actions,
|
|
1586
1602
|
children: [/* @__PURE__ */ t(w, {
|
|
1587
1603
|
variant: "outline",
|
|
1588
1604
|
onClick: () => u(!1),
|
|
@@ -1594,55 +1610,55 @@ var T = {
|
|
|
1594
1610
|
})]
|
|
1595
1611
|
})]
|
|
1596
1612
|
});
|
|
1597
|
-
},
|
|
1613
|
+
}, Ke = ({ modalId: e, close: r, title: i = "Ошибка", message: a, closeLabel: o = "Закрыть" }) => /* @__PURE__ */ n(Re, {
|
|
1598
1614
|
modalId: e,
|
|
1599
1615
|
title: i,
|
|
1600
1616
|
role: "alertdialog",
|
|
1601
1617
|
children: [/* @__PURE__ */ t("p", {
|
|
1602
|
-
className:
|
|
1618
|
+
className: He.message,
|
|
1603
1619
|
children: a
|
|
1604
1620
|
}), /* @__PURE__ */ t("div", {
|
|
1605
|
-
className:
|
|
1621
|
+
className: He.actions,
|
|
1606
1622
|
children: /* @__PURE__ */ t(w, {
|
|
1607
1623
|
onClick: r,
|
|
1608
1624
|
children: o
|
|
1609
1625
|
})
|
|
1610
1626
|
})]
|
|
1611
|
-
}),
|
|
1612
|
-
ConfirmModal:
|
|
1613
|
-
ErrorModal:
|
|
1614
|
-
}),
|
|
1615
|
-
let e =
|
|
1627
|
+
}), qe = Ve({
|
|
1628
|
+
ConfirmModal: Ge,
|
|
1629
|
+
ErrorModal: Ke
|
|
1630
|
+
}), Je = () => {
|
|
1631
|
+
let e = Z((e) => e.openModal);
|
|
1616
1632
|
return (t = {}) => new Promise((n) => {
|
|
1617
|
-
|
|
1618
|
-
let r = `confirm-${
|
|
1619
|
-
|
|
1633
|
+
We += 1;
|
|
1634
|
+
let r = `confirm-${We}`;
|
|
1635
|
+
Ue.set(r, n), e("ConfirmModal", {
|
|
1620
1636
|
...t,
|
|
1621
1637
|
requestId: r
|
|
1622
1638
|
}, { closeOnEscape: !1 });
|
|
1623
1639
|
});
|
|
1624
|
-
},
|
|
1625
|
-
let e =
|
|
1640
|
+
}, Ye = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e && typeof e.message == "string" ? e.message : "Произошла неизвестная ошибка", Xe = () => {
|
|
1641
|
+
let e = Z((e) => e.openModal);
|
|
1626
1642
|
return { showError: (t, n) => e("ErrorModal", {
|
|
1627
1643
|
title: n,
|
|
1628
|
-
message:
|
|
1644
|
+
message: Ye(t)
|
|
1629
1645
|
}) };
|
|
1630
|
-
},
|
|
1631
|
-
let e =
|
|
1646
|
+
}, Ze = v(() => ({})), Qe = v(() => ({})), $e = () => {
|
|
1647
|
+
let e = Z((e) => e.modals), t = Z((e) => e.openModal);
|
|
1632
1648
|
return {
|
|
1633
1649
|
openModal: (e, n = {}, r) => t(e, n, r),
|
|
1634
|
-
closeModal:
|
|
1635
|
-
closeTopModal:
|
|
1636
|
-
closeAllModals:
|
|
1650
|
+
closeModal: Z((e) => e.closeModal),
|
|
1651
|
+
closeTopModal: Z((e) => e.closeTopModal),
|
|
1652
|
+
closeAllModals: Z((e) => e.closeAllModals),
|
|
1637
1653
|
isOpen: (t) => e.some((e) => e.name === t),
|
|
1638
1654
|
count: e.length
|
|
1639
1655
|
};
|
|
1640
|
-
},
|
|
1641
|
-
className: `${
|
|
1656
|
+
}, et = { root: "_root_fvxpr_1" }, tt = ({ label: e = "Загрузка страницы", className: r = "" }) => /* @__PURE__ */ n("div", {
|
|
1657
|
+
className: `${et.root} ${r}`,
|
|
1642
1658
|
role: "status",
|
|
1643
1659
|
"aria-label": e,
|
|
1644
1660
|
children: [/* @__PURE__ */ t(S, { decorative: !0 }), /* @__PURE__ */ t("span", { children: e })]
|
|
1645
|
-
}),
|
|
1661
|
+
}), nt = {
|
|
1646
1662
|
viewport: "_viewport_15mi5_1",
|
|
1647
1663
|
"top-right": "_top-right_15mi5_3",
|
|
1648
1664
|
"top-left": "_top-left_15mi5_5",
|
|
@@ -1655,7 +1671,7 @@ var T = {
|
|
|
1655
1671
|
success: "_success_15mi5_19",
|
|
1656
1672
|
warning: "_warning_15mi5_21",
|
|
1657
1673
|
error: "_error_15mi5_23"
|
|
1658
|
-
},
|
|
1674
|
+
}, rt = (e) => {
|
|
1659
1675
|
let r;
|
|
1660
1676
|
return r = e === "info" ? /* @__PURE__ */ n("svg", {
|
|
1661
1677
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1741,7 +1757,7 @@ var T = {
|
|
|
1741
1757
|
/* @__PURE__ */ t("path", { d: "m9 9 6 6" })
|
|
1742
1758
|
]
|
|
1743
1759
|
}), r;
|
|
1744
|
-
},
|
|
1760
|
+
}, it = ({ toast: e, onClose: r }) => {
|
|
1745
1761
|
let [i, a] = f(!1), o = d(e.duration), c = d(Date.now());
|
|
1746
1762
|
return s(() => {
|
|
1747
1763
|
if (i || e.duration <= 0) return;
|
|
@@ -1756,7 +1772,7 @@ var T = {
|
|
|
1756
1772
|
e.duration,
|
|
1757
1773
|
e.id
|
|
1758
1774
|
]), /* @__PURE__ */ n("article", {
|
|
1759
|
-
className: `${
|
|
1775
|
+
className: `${nt.toast} ${nt[e.variant]}`,
|
|
1760
1776
|
role: e.variant === "error" ? "alert" : "status",
|
|
1761
1777
|
"aria-live": e.variant === "error" ? "assertive" : "polite",
|
|
1762
1778
|
onMouseEnter: () => a(!0),
|
|
@@ -1764,9 +1780,9 @@ var T = {
|
|
|
1764
1780
|
onFocus: () => a(!0),
|
|
1765
1781
|
onBlur: () => a(!1),
|
|
1766
1782
|
children: [
|
|
1767
|
-
/* @__PURE__ */ t("div", { children:
|
|
1783
|
+
/* @__PURE__ */ t("div", { children: rt(e.variant) }),
|
|
1768
1784
|
/* @__PURE__ */ n("div", {
|
|
1769
|
-
className:
|
|
1785
|
+
className: nt.body,
|
|
1770
1786
|
children: [
|
|
1771
1787
|
e.title && /* @__PURE__ */ t("strong", { children: e.title }),
|
|
1772
1788
|
/* @__PURE__ */ t("div", { children: e.message }),
|
|
@@ -1800,11 +1816,11 @@ var T = {
|
|
|
1800
1816
|
})
|
|
1801
1817
|
]
|
|
1802
1818
|
});
|
|
1803
|
-
},
|
|
1819
|
+
}, at = 0, ot = v((e) => ({
|
|
1804
1820
|
toasts: [],
|
|
1805
1821
|
showToast: (t) => {
|
|
1806
|
-
|
|
1807
|
-
let n = `ds-toast-${
|
|
1822
|
+
at += 1;
|
|
1823
|
+
let n = `ds-toast-${at}`;
|
|
1808
1824
|
return e((e) => ({ toasts: [...e.toasts, {
|
|
1809
1825
|
variant: "info",
|
|
1810
1826
|
duration: 5e3,
|
|
@@ -1815,18 +1831,18 @@ var T = {
|
|
|
1815
1831
|
},
|
|
1816
1832
|
removeToast: (t) => e((e) => ({ toasts: e.toasts.filter((e) => e.id !== t) })),
|
|
1817
1833
|
clearToasts: () => e({ toasts: [] })
|
|
1818
|
-
})), st = () =>
|
|
1819
|
-
let n =
|
|
1834
|
+
})), st = () => ot.setState({ toasts: [] }), ct = ({ position: e = "top-right" }) => {
|
|
1835
|
+
let n = ot((e) => e.toasts), r = ot((e) => e.removeToast);
|
|
1820
1836
|
return /* @__PURE__ */ t("div", {
|
|
1821
|
-
className: `${
|
|
1837
|
+
className: `${nt.viewport} ${nt[e]}`,
|
|
1822
1838
|
"aria-label": "Уведомления",
|
|
1823
|
-
children: n.map((e) => /* @__PURE__ */ t(
|
|
1839
|
+
children: n.map((e) => /* @__PURE__ */ t(it, {
|
|
1824
1840
|
toast: e,
|
|
1825
1841
|
onClose: r
|
|
1826
1842
|
}, e.id))
|
|
1827
1843
|
});
|
|
1828
1844
|
}, lt = () => {
|
|
1829
|
-
let e =
|
|
1845
|
+
let e = ot((e) => e.showToast), t = ot((e) => e.removeToast), n = ot((e) => e.clearToasts), r = o((t) => e({
|
|
1830
1846
|
...t,
|
|
1831
1847
|
variant: "info"
|
|
1832
1848
|
}), [e]), i = o((t) => e({
|
|
@@ -2028,4 +2044,4 @@ var T = {
|
|
|
2028
2044
|
}, [t]), n ? p(e, n) : null;
|
|
2029
2045
|
};
|
|
2030
2046
|
//#endregion
|
|
2031
|
-
export {
|
|
2047
|
+
export { Ge as ConfirmModal, gt as DSAccordion, b as DSBadge, w as DSButton, k as DSCheckbox, be as DSDataTable, re as DSDateRange, B as DSDateTimePicker, se as DSDropDown, xe as DSDropDownMultiple, E as DSFieldLabel, D as DSFieldMessage, Pe as DSFileInput, Ae as DSFilters, Ce as DSIcon, Te as DSInfoBlock, Ee as DSInput, S as DSLoader, ze as DSModal, Re as DSModalFrame, tt as DSPageLoader, ht as DSPopup, _t as DSPortal, Oe as DSRadioButton, W as DSSkeleton, le as DSSort, it as DSToast, ct as DSToastProvider, dt as DSTooltip, pt as DSVideoPlayerFrame, Ke as ErrorModal, Be as ModalSystemProvider, qe as builtInModalRegistry, Ve as defineModalRegistry, F as formatDateTimeLocalValue, Ye as getErrorMessage, q as getNextEnabledOptionIndex, H as isValidDateRange, I as parseDateTimeLocalValue, Ie as resetModalStore, st as resetToastStore, Je as useConfirmModal, Ze as useConfirmModalStore, Xe as useErrorModal, Qe as useErrorModalStore, $e as useModals, Z as useModalsStore, lt as useToast, ot as useToastStore, de as validateDSDataTableData };
|