@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.
@@ -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';
@@ -0,0 +1,4 @@
1
+ import { Dropzone as e } from "./dropzone.component.js";
2
+ export {
3
+ e as Dropzone
4
+ };
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 I } from "./controls/interactives/dropdown/dropdown.component.js";
14
- import { Input as R } from "./controls/interactives/input/input.component.js";
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 G } from "./controls/primitives/caption/caption.component.js";
20
- import { Choice as U } from "./controls/primitives/choice/choice.component.js";
21
- import { ErrorMessage as j } from "./controls/primitives/error-message/error-message.component.js";
22
- import { HiddenInput as z } from "./controls/primitives/hidden-input/hidden-input.component.js";
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 { BottomBar as ro } from "./components/bottom-bar/bottom-bar.component.js";
29
- import { Certifications as to } from "./components/certifications/certifications.component.js";
30
- import { DataProtectedLabel as mo } from "./components/data-protected-label/data-protected-label.component.js";
31
- import { Dialog as fo } from "./components/dialog/dialog.component.js";
32
- import { DialogArticle as no } from "./components/dialog-article/dialog-article.component.js";
33
- import { Expenses as co } from "./components/expenses/expenses.component.js";
34
- import { Footer as so } from "./components/footer/footer.component.js";
35
- import { FormRow as go } from "./components/form-row/form-row.component.js";
36
- import { Header as Co } from "./components/header/header.component.js";
37
- import { InfoPanel as Lo } from "./components/info-panel/info-panel.component.js";
38
- import { Information as bo } from "./components/information/information.component.js";
39
- import { Layout as Ao } from "./components/layout/layout.component.js";
40
- import { Line as Po } from "./components/line/line.component.js";
41
- import { Loader as Do } from "./components/loader/loader.component.js";
42
- import { MainAttachment as ho } from "./components/main-attachment/main-attachment.component.js";
43
- import { Message as yo } from "./components/message/message.component.js";
44
- import { MessageBlock as ko } from "./components/message-block/message-block.component.js";
45
- import { NotFound as Ho } from "./components/not-found/not-found.component.js";
46
- import { Payment as No } from "./components/payment/payment.component.js";
47
- import { PriceLine as Wo } from "./components/price-line/price-line.component.js";
48
- import { Sidebar as qo } from "./components/sidebar/sidebar.component.js";
49
- import { Signature as Jo } from "./components/signature/signature.component.js";
50
- import { Svg as Oo } from "./utils/svg/svg.component.js";
51
- import { Text as Vo } from "./components/text/text.component.js";
52
- import { UserPanel as Yo } from "./components/user-panel/user-panel.component.js";
53
- import { Warranty as _o } from "./components/warranty/warranty.component.js";
54
- import { clsx as or, convertToEuro as rr } from "./utils/functions/functions.util.js";
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
- ro as BottomBar,
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
- G as Caption,
65
+ z as Caption,
65
66
  F as CardImage,
66
67
  T as CardText,
67
- to as Certifications,
68
+ mo as Certifications,
68
69
  S as Checkbox,
69
- U as Choice,
70
- mo as DataProtectedLabel,
71
- fo as Dialog,
72
- no as DialogArticle,
73
- I as Dropdown,
74
- j as ErrorMessage,
75
- co as Expenses,
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
- so as Footer,
80
- go as FormRow,
81
- Co as Header,
82
- z as HiddenInput,
83
- Lo as InfoPanel,
84
- bo as Information,
85
- R as Input,
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
- Ao as Layout,
88
- Po as Line,
89
- Do as Loader,
90
- ho as MainAttachment,
91
- yo as Message,
92
- ko as MessageBlock,
93
- Ho as NotFound,
94
- No as Payment,
95
- Wo as PriceLine,
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
- qo as Sidebar,
100
- Jo as Signature,
101
+ Jo as Sidebar,
102
+ Oo as Signature,
101
103
  X as Status,
102
- Oo as Svg,
103
- Vo as Text,
104
+ Vo as Svg,
105
+ Yo as Text,
104
106
  w as TextArea,
105
107
  E as TextField,
106
- Yo as UserPanel,
107
- _o as Warranty,
108
- or as clsx,
109
- rr as convertToEuro
108
+ _o as UserPanel,
109
+ or as Warranty,
110
+ er as clsx,
111
+ tr as convertToEuro
110
112
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arthurzakharov/ui-kit",
3
3
  "private": false,
4
- "version": "2.8.0",
4
+ "version": "2.9.0",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",