@arthurzakharov/ui-kit 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/dropzone-iRe6v-43.css +1 -0
- package/dist/components/dropzone/dropzone.component.d.ts +14 -0
- package/dist/components/dropzone/dropzone.component.js +107 -0
- package/dist/components/dropzone/index.d.ts +1 -0
- package/dist/components/dropzone/index.js +4 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +69 -67
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._Dropzone_14jbn_1{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--rm-ui-padding-xs);width:100%;min-height:160px;padding:var(--rm-ui-padding-md);border:2px dashed var(--rm-ui-grey-300);border-radius:var(--rm-ui-border-radius-md, 8px);background-color:var(--rm-ui-grey-50);text-align:center;cursor:pointer;transition:border-color .12s ease,background-color .12s ease}._Dropzone_14jbn_1:hover,._Active_14jbn_21{border-color:var(--rm-ui-color-theme-primary);background-color:var(--rm-ui-color-background-primary, #fff)}._Dropzone_14jbn_1:focus-visible{outline:2px solid var(--rm-ui-color-focus);outline-offset:2px}._Disabled_14jbn_31{cursor:not-allowed;opacity:.5}._HiddenInput_14jbn_36{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}._Icon_14jbn_48{color:var(--rm-ui-color-theme-primary)}._Invitation_14jbn_52{font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary)}._HelpText_14jbn_58{font-size:var(--rm-ui-font-size-body-small);line-height:var(--rm-ui-line-height-body-small);color:var(--rm-ui-color-text-secondary)}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Base } from '../../utils/types';
|
|
3
|
+
export type DropzoneRejectionReason = 'tooLarge' | 'wrongType';
|
|
4
|
+
export interface DropzoneProps extends Base {
|
|
5
|
+
accept: string;
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
maxSize?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
invitation: ReactNode;
|
|
10
|
+
helpText?: ReactNode;
|
|
11
|
+
onDrop: (files: File[]) => void;
|
|
12
|
+
onReject?: (files: File[], reason: DropzoneRejectionReason) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const Dropzone: ({ accept, multiple, maxSize, disabled, invitation, helpText, onDrop, onReject, ...base }: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsxs as C, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as N, useState as T } from "react";
|
|
3
|
+
import { Upload as L } from "lucide-react";
|
|
4
|
+
import { baseProps as I, clsx as P } from "../../utils/functions/functions.util.js";
|
|
5
|
+
import '../../assets/dropzone-iRe6v-43.css';const W = "_Dropzone_14jbn_1", k = "_Active_14jbn_21", E = "_Disabled_14jbn_31", K = "_HiddenInput_14jbn_36", O = "_Icon_14jbn_48", $ = "_Invitation_14jbn_52", B = "_HelpText_14jbn_58", o = {
|
|
6
|
+
Dropzone: W,
|
|
7
|
+
Active: k,
|
|
8
|
+
Disabled: E,
|
|
9
|
+
HiddenInput: K,
|
|
10
|
+
Icon: O,
|
|
11
|
+
Invitation: $,
|
|
12
|
+
HelpText: B
|
|
13
|
+
}, F = (r, u) => {
|
|
14
|
+
const s = u.split(",").map((n) => n.trim()).filter(Boolean);
|
|
15
|
+
return s.length === 0 ? !0 : s.some((n) => {
|
|
16
|
+
if (n.startsWith("."))
|
|
17
|
+
return r.name.toLowerCase().endsWith(n.toLowerCase());
|
|
18
|
+
if (n.endsWith("/*")) {
|
|
19
|
+
const f = n.slice(0, -1);
|
|
20
|
+
return r.type.startsWith(f);
|
|
21
|
+
}
|
|
22
|
+
return r.type === n;
|
|
23
|
+
});
|
|
24
|
+
}, M = ({
|
|
25
|
+
accept: r,
|
|
26
|
+
multiple: u = !1,
|
|
27
|
+
maxSize: s,
|
|
28
|
+
disabled: n = !1,
|
|
29
|
+
invitation: f,
|
|
30
|
+
helpText: d,
|
|
31
|
+
onDrop: y,
|
|
32
|
+
onReject: c,
|
|
33
|
+
...D
|
|
34
|
+
}) => {
|
|
35
|
+
const h = N(null), [b, g] = T(!1), _ = I(D, "data-testid", "dropzone"), x = (t) => {
|
|
36
|
+
const l = [], a = [], i = [];
|
|
37
|
+
for (const e of t) {
|
|
38
|
+
if (!F(e, r)) {
|
|
39
|
+
i.push(e);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (s !== void 0 && e.size > s) {
|
|
43
|
+
a.push(e);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
l.push(e);
|
|
47
|
+
}
|
|
48
|
+
return { accepted: l, tooLarge: a, wrongType: i };
|
|
49
|
+
}, m = (t) => {
|
|
50
|
+
if (!t || t.length === 0) return;
|
|
51
|
+
const l = Array.from(t), { accepted: a, tooLarge: i, wrongType: e } = x(l);
|
|
52
|
+
a.length > 0 && y(a), i.length > 0 && c && c(i, "tooLarge"), e.length > 0 && c && c(e, "wrongType");
|
|
53
|
+
}, A = () => {
|
|
54
|
+
n || h.current?.click();
|
|
55
|
+
}, H = (t) => {
|
|
56
|
+
n || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), h.current?.click());
|
|
57
|
+
}, w = (t) => {
|
|
58
|
+
m(t.target.files), t.target.value = "";
|
|
59
|
+
}, v = (t) => {
|
|
60
|
+
t.preventDefault(), t.stopPropagation(), !n && g(!0);
|
|
61
|
+
}, z = (t) => {
|
|
62
|
+
t.preventDefault(), t.stopPropagation(), g(!1);
|
|
63
|
+
}, j = (t) => {
|
|
64
|
+
t.preventDefault(), t.stopPropagation(), g(!1), !n && m(t.dataTransfer.files);
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ C(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
"data-testid": _,
|
|
70
|
+
className: P(o.Dropzone, I(D, "className"), {
|
|
71
|
+
[o.Active]: b,
|
|
72
|
+
[o.Disabled]: n
|
|
73
|
+
}),
|
|
74
|
+
role: "button",
|
|
75
|
+
tabIndex: n ? -1 : 0,
|
|
76
|
+
"aria-disabled": n,
|
|
77
|
+
onClick: A,
|
|
78
|
+
onKeyDown: H,
|
|
79
|
+
onDragOver: v,
|
|
80
|
+
onDragEnter: v,
|
|
81
|
+
onDragLeave: z,
|
|
82
|
+
onDrop: j,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ p(
|
|
85
|
+
"input",
|
|
86
|
+
{
|
|
87
|
+
ref: h,
|
|
88
|
+
type: "file",
|
|
89
|
+
className: o.HiddenInput,
|
|
90
|
+
accept: r,
|
|
91
|
+
multiple: u,
|
|
92
|
+
disabled: n,
|
|
93
|
+
onChange: w,
|
|
94
|
+
"data-testid": `${_}-input`,
|
|
95
|
+
tabIndex: -1
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ p(L, { size: 32, className: o.Icon, "aria-hidden": !0 }),
|
|
99
|
+
/* @__PURE__ */ p("div", { className: o.Invitation, children: f }),
|
|
100
|
+
d != null && /* @__PURE__ */ p("div", { className: o.HelpText, children: d })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
M as Dropzone
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dropzone, type DropzoneProps, type DropzoneRejectionReason } from './dropzone.component';
|
package/dist/main.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { RadioLabel, type RadioLabelProps } from './controls/primitives/radio-la
|
|
|
25
25
|
export { Status, type StatusProps } from './controls/primitives/status';
|
|
26
26
|
export { Accordion, type AccordionProps } from './components/accordion';
|
|
27
27
|
export { AccordionTable, type AccordionTableProps } from './components/accordion-table/accordion-table.component';
|
|
28
|
+
export { Dropzone, type DropzoneProps, type DropzoneRejectionReason } from './components/dropzone';
|
|
28
29
|
export { BottomBar } from './components/bottom-bar';
|
|
29
30
|
export { Certifications, type CertificationsProps } from './components/certifications';
|
|
30
31
|
export { DataProtectedLabel } from './components/data-protected-label';
|
package/dist/main.js
CHANGED
|
@@ -10,101 +10,103 @@ import { ButtonText as B } from "./controls/buttons/button-text/button-text.comp
|
|
|
10
10
|
import { CardImage as F } from "./controls/interactives/card-image/card-image.component.js";
|
|
11
11
|
import { CardText as T } from "./controls/interactives/card-text/card-text.component.js";
|
|
12
12
|
import { Checkbox as S } from "./controls/interactives/checkbox/checkbox.component.js";
|
|
13
|
-
import { Dropdown as
|
|
14
|
-
import { Input as
|
|
13
|
+
import { Dropdown as D } from "./controls/interactives/dropdown/dropdown.component.js";
|
|
14
|
+
import { Input as P } from "./controls/interactives/input/input.component.js";
|
|
15
15
|
import { Radio as M } from "./controls/interactives/radio/radio.component.js";
|
|
16
16
|
import { TextArea as w } from "./controls/interactives/text-area/text-area.component.js";
|
|
17
17
|
import { TextField as E } from "./controls/interactives/text-field/text-field.component.js";
|
|
18
18
|
import { Box as v } from "./controls/primitives/box/box.component.js";
|
|
19
|
-
import { Caption as
|
|
20
|
-
import { Choice as
|
|
21
|
-
import { ErrorMessage as
|
|
22
|
-
import { HiddenInput as
|
|
19
|
+
import { Caption as z } from "./controls/primitives/caption/caption.component.js";
|
|
20
|
+
import { Choice as N } from "./controls/primitives/choice/choice.component.js";
|
|
21
|
+
import { ErrorMessage as W } from "./controls/primitives/error-message/error-message.component.js";
|
|
22
|
+
import { HiddenInput as q } from "./controls/primitives/hidden-input/hidden-input.component.js";
|
|
23
23
|
import { Label as K } from "./controls/primitives/label/label.component.js";
|
|
24
24
|
import { RadioLabel as Q } from "./controls/primitives/radio-label/radio-label.component.js";
|
|
25
25
|
import { Status as X } from "./controls/primitives/status/status.component.js";
|
|
26
26
|
import { Accordion as Z } from "./components/accordion/accordion.component.js";
|
|
27
27
|
import { AccordionTable as $ } from "./components/accordion-table/accordion-table.component.js";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
28
|
+
import { Dropzone as ro } from "./components/dropzone/dropzone.component.js";
|
|
29
|
+
import { BottomBar as to } from "./components/bottom-bar/bottom-bar.component.js";
|
|
30
|
+
import { Certifications as mo } from "./components/certifications/certifications.component.js";
|
|
31
|
+
import { DataProtectedLabel as fo } from "./components/data-protected-label/data-protected-label.component.js";
|
|
32
|
+
import { Dialog as no } from "./components/dialog/dialog.component.js";
|
|
33
|
+
import { DialogArticle as co } from "./components/dialog-article/dialog-article.component.js";
|
|
34
|
+
import { Expenses as so } from "./components/expenses/expenses.component.js";
|
|
35
|
+
import { Footer as go } from "./components/footer/footer.component.js";
|
|
36
|
+
import { FormRow as Co } from "./components/form-row/form-row.component.js";
|
|
37
|
+
import { Header as Lo } from "./components/header/header.component.js";
|
|
38
|
+
import { InfoPanel as bo } from "./components/info-panel/info-panel.component.js";
|
|
39
|
+
import { Information as Ao } from "./components/information/information.component.js";
|
|
40
|
+
import { Layout as Io } from "./components/layout/layout.component.js";
|
|
41
|
+
import { Line as Ro } from "./components/line/line.component.js";
|
|
42
|
+
import { Loader as ho } from "./components/loader/loader.component.js";
|
|
43
|
+
import { MainAttachment as yo } from "./components/main-attachment/main-attachment.component.js";
|
|
44
|
+
import { Message as ko } from "./components/message/message.component.js";
|
|
45
|
+
import { MessageBlock as Ho } from "./components/message-block/message-block.component.js";
|
|
46
|
+
import { NotFound as Go } from "./components/not-found/not-found.component.js";
|
|
47
|
+
import { Payment as Uo } from "./components/payment/payment.component.js";
|
|
48
|
+
import { PriceLine as jo } from "./components/price-line/price-line.component.js";
|
|
49
|
+
import { Sidebar as Jo } from "./components/sidebar/sidebar.component.js";
|
|
50
|
+
import { Signature as Oo } from "./components/signature/signature.component.js";
|
|
51
|
+
import { Svg as Vo } from "./utils/svg/svg.component.js";
|
|
52
|
+
import { Text as Yo } from "./components/text/text.component.js";
|
|
53
|
+
import { UserPanel as _o } from "./components/user-panel/user-panel.component.js";
|
|
54
|
+
import { Warranty as or } from "./components/warranty/warranty.component.js";
|
|
55
|
+
import { clsx as er, convertToEuro as tr } from "./utils/functions/functions.util.js";
|
|
55
56
|
import './assets/main-DZmlIs7j.css';export {
|
|
56
57
|
Z as Accordion,
|
|
57
58
|
$ as AccordionTable,
|
|
58
|
-
|
|
59
|
+
to as BottomBar,
|
|
59
60
|
v as Box,
|
|
60
61
|
d as Button,
|
|
61
62
|
l as ButtonCard,
|
|
62
63
|
u as ButtonRadio,
|
|
63
64
|
B as ButtonText,
|
|
64
|
-
|
|
65
|
+
z as Caption,
|
|
65
66
|
F as CardImage,
|
|
66
67
|
T as CardText,
|
|
67
|
-
|
|
68
|
+
mo as Certifications,
|
|
68
69
|
S as Checkbox,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
N as Choice,
|
|
71
|
+
fo as DataProtectedLabel,
|
|
72
|
+
no as Dialog,
|
|
73
|
+
co as DialogArticle,
|
|
74
|
+
D as Dropdown,
|
|
75
|
+
ro as Dropzone,
|
|
76
|
+
W as ErrorMessage,
|
|
77
|
+
so as Expenses,
|
|
76
78
|
t as FadeGrow,
|
|
77
79
|
m as FadeScale,
|
|
78
80
|
f as FadeSlide,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
go as Footer,
|
|
82
|
+
Co as FormRow,
|
|
83
|
+
Lo as Header,
|
|
84
|
+
q as HiddenInput,
|
|
85
|
+
bo as InfoPanel,
|
|
86
|
+
Ao as Information,
|
|
87
|
+
P as Input,
|
|
86
88
|
K as Label,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
Io as Layout,
|
|
90
|
+
Ro as Line,
|
|
91
|
+
ho as Loader,
|
|
92
|
+
yo as MainAttachment,
|
|
93
|
+
ko as Message,
|
|
94
|
+
Ho as MessageBlock,
|
|
95
|
+
Go as NotFound,
|
|
96
|
+
Uo as Payment,
|
|
97
|
+
jo as PriceLine,
|
|
96
98
|
M as Radio,
|
|
97
99
|
Q as RadioLabel,
|
|
98
100
|
n as Rotate,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
Jo as Sidebar,
|
|
102
|
+
Oo as Signature,
|
|
101
103
|
X as Status,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
Vo as Svg,
|
|
105
|
+
Yo as Text,
|
|
104
106
|
w as TextArea,
|
|
105
107
|
E as TextField,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
_o as UserPanel,
|
|
109
|
+
or as Warranty,
|
|
110
|
+
er as clsx,
|
|
111
|
+
tr as convertToEuro
|
|
110
112
|
};
|