@salutejs/plasma-new-hope 0.184.0-canary.1533.11640514070.0 → 0.184.0-canary.1534.11679645702.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/emotion/cjs/components/_Icon/Icon.assets/ArrowBarDown.js +23 -0
  2. package/emotion/cjs/components/_Icon/Icons/IconArrowBarDown.js +22 -0
  3. package/emotion/cjs/components/_Icon/index.js +8 -1
  4. package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.js +220 -0
  5. package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +58 -0
  6. package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.styles.js +80 -0
  7. package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.template-docs.mdx +136 -0
  8. package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.types.js +5 -0
  9. package/emotion/es/components/_Icon/Icon.assets/ArrowBarDown.js +16 -0
  10. package/emotion/es/components/_Icon/Icons/IconArrowBarDown.js +15 -0
  11. package/emotion/es/components/_Icon/index.js +2 -1
  12. package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.js +212 -0
  13. package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +58 -0
  14. package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.styles.js +73 -0
  15. package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.template-docs.mdx +136 -0
  16. package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.types.js +1 -0
  17. package/package.json +4 -4
  18. package/styled-components/cjs/components/_Icon/Icon.assets/ArrowBarDown.js +23 -0
  19. package/styled-components/cjs/components/_Icon/Icons/IconArrowBarDown.js +22 -0
  20. package/styled-components/cjs/components/_Icon/index.js +8 -1
  21. package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.js +220 -0
  22. package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +58 -0
  23. package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.styles.js +33 -0
  24. package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.template-docs.mdx +136 -0
  25. package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.types.js +5 -0
  26. package/styled-components/es/components/_Icon/Icon.assets/ArrowBarDown.js +16 -0
  27. package/styled-components/es/components/_Icon/Icons/IconArrowBarDown.js +15 -0
  28. package/styled-components/es/components/_Icon/index.js +2 -1
  29. package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.js +212 -0
  30. package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +58 -0
  31. package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.styles.js +26 -0
  32. package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.template-docs.mdx +136 -0
  33. package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.types.js +1 -0
  34. package/types/components/_Icon/Icon.assets/ArrowBarDown.d.ts +4 -0
  35. package/types/components/_Icon/Icon.assets/ArrowBarDown.d.ts.map +1 -0
  36. package/types/components/_Icon/Icons/IconArrowBarDown.d.ts +4 -0
  37. package/types/components/_Icon/Icons/IconArrowBarDown.d.ts.map +1 -0
  38. package/types/components/_Icon/index.d.ts +1 -0
  39. package/types/components/_Icon/index.d.ts.map +1 -1
  40. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.d.ts +22 -0
  41. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.d.ts.map +1 -0
  42. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.styles.d.ts +15 -0
  43. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.styles.d.ts.map +1 -0
  44. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.types.d.ts +80 -0
  45. package/types/examples/plasma_b2c/components/Dropzone/Dropzone.types.d.ts.map +1 -0
@@ -0,0 +1,212 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _IconArrowBarDown;
3
+ var _excluded = ["className", "style", "acceptedFileFormats", "multiple", "title", "description", "icon", "iconPlacement", "size", "view", "disabled", "stretch", "width", "onDragEnter", "onDragLeave", "onDragOver", "onDrop", "validator", "onDropFiles", "onClick", "onChange", "onChoseFiles"];
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
16
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
24
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
+ import React, { forwardRef, useRef, useState } from 'react';
26
+ import { useForkRef } from '@salutejs/plasma-core';
27
+ import { cx, getSizeValueFromProp } from '../../../../utils';
28
+ import { IconArrowBarDown } from '../../../../components/_Icon';
29
+ import { classes, Content, Description, HiddenInput, privateTokens, StyledRoot, Title, TitleWrapper } from './Dropzone.styles';
30
+ export var Dropzone = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
31
+ var className = _ref.className,
32
+ style = _ref.style,
33
+ acceptedFileFormats = _ref.acceptedFileFormats,
34
+ multiple = _ref.multiple,
35
+ title = _ref.title,
36
+ description = _ref.description,
37
+ icon = _ref.icon,
38
+ iconPlacement = _ref.iconPlacement,
39
+ size = _ref.size,
40
+ view = _ref.view,
41
+ disabled = _ref.disabled,
42
+ stretch = _ref.stretch,
43
+ width = _ref.width,
44
+ onDragEnter = _ref.onDragEnter,
45
+ onDragLeave = _ref.onDragLeave,
46
+ onDragOver = _ref.onDragOver,
47
+ onDrop = _ref.onDrop,
48
+ validator = _ref.validator,
49
+ onDropFiles = _ref.onDropFiles,
50
+ onClick = _ref.onClick,
51
+ onChange = _ref.onChange,
52
+ onChoseFiles = _ref.onChoseFiles,
53
+ rest = _objectWithoutProperties(_ref, _excluded);
54
+ var _useState = useState(false),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ isDropzoneActive = _useState2[0],
57
+ setIsDropzoneActive = _useState2[1];
58
+ var inputRef = useRef(null);
59
+ var forkInputRef = useForkRef(outerRef, inputRef);
60
+ var accept = acceptedFileFormats === null || acceptedFileFormats === void 0 ? void 0 : acceptedFileFormats.join(',');
61
+ var innerWidth = width ? getSizeValueFromProp(width) : 'fit-content';
62
+ var processFiles = /*#__PURE__*/function () {
63
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(rawFiles, callback, afterAction) {
64
+ var files, res;
65
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ if (!(rawFiles && rawFiles.length > 0)) {
69
+ _context.next = 12;
70
+ break;
71
+ }
72
+ files = _toConsumableArray(rawFiles);
73
+ res = {
74
+ acceptedFiles: files
75
+ };
76
+ if (!validator) {
77
+ _context.next = 7;
78
+ break;
79
+ }
80
+ _context.next = 6;
81
+ return validator === null || validator === void 0 ? void 0 : validator(files);
82
+ case 6:
83
+ res = _context.sent;
84
+ case 7:
85
+ console.log(res);
86
+ if (!callback) {
87
+ _context.next = 11;
88
+ break;
89
+ }
90
+ _context.next = 11;
91
+ return callback(res);
92
+ case 11:
93
+ if (afterAction) {
94
+ afterAction();
95
+ }
96
+ case 12:
97
+ case "end":
98
+ return _context.stop();
99
+ }
100
+ }, _callee);
101
+ }));
102
+ return function processFiles(_x, _x2, _x3) {
103
+ return _ref2.apply(this, arguments);
104
+ };
105
+ }();
106
+ var handleDragEnter = function handleDragEnter(event) {
107
+ event.preventDefault();
108
+ event.stopPropagation();
109
+ if (onDragEnter) {
110
+ onDragEnter();
111
+ }
112
+ var rawFiles = event.dataTransfer.files;
113
+ if (rawFiles && rawFiles.length > 0) {
114
+ setIsDropzoneActive(true);
115
+ }
116
+ };
117
+ var handleDragLeave = function handleDragLeave(event) {
118
+ event.preventDefault();
119
+ if (onDragLeave) {
120
+ onDragLeave();
121
+ }
122
+ setIsDropzoneActive(false);
123
+ };
124
+ var handleDragOver = function handleDragOver(event) {
125
+ event.preventDefault();
126
+ if (onDragOver) {
127
+ onDragOver();
128
+ }
129
+ var rawFiles = event.dataTransfer.files;
130
+ if (!isDropzoneActive && rawFiles && rawFiles.length > 0) {
131
+ setIsDropzoneActive(true);
132
+ }
133
+ };
134
+ var handleDrop = /*#__PURE__*/function () {
135
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
136
+ var rawFiles, afterAction;
137
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
138
+ while (1) switch (_context2.prev = _context2.next) {
139
+ case 0:
140
+ event.preventDefault();
141
+ event.persist();
142
+ if (onDrop) {
143
+ onDrop();
144
+ }
145
+ rawFiles = event.dataTransfer.files;
146
+ afterAction = function afterAction() {
147
+ return event.dataTransfer.clearData();
148
+ };
149
+ _context2.next = 7;
150
+ return processFiles(rawFiles, onDropFiles, afterAction);
151
+ case 7:
152
+ case "end":
153
+ return _context2.stop();
154
+ }
155
+ }, _callee2);
156
+ }));
157
+ return function handleDrop(_x4) {
158
+ return _ref3.apply(this, arguments);
159
+ };
160
+ }();
161
+ var handleClick = function handleClick(event) {
162
+ if (!inputRef.current) {
163
+ return;
164
+ }
165
+ inputRef.current.click();
166
+ if (onClick) {
167
+ onClick(event);
168
+ }
169
+ };
170
+ var handleChange = /*#__PURE__*/function () {
171
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {
172
+ var rawFiles;
173
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
174
+ while (1) switch (_context3.prev = _context3.next) {
175
+ case 0:
176
+ if (onChange) {
177
+ onChange(event);
178
+ }
179
+ rawFiles = event.target.files;
180
+ _context3.next = 4;
181
+ return processFiles(rawFiles, onChoseFiles);
182
+ case 4:
183
+ case "end":
184
+ return _context3.stop();
185
+ }
186
+ }, _callee3);
187
+ }));
188
+ return function handleChange(_x5) {
189
+ return _ref4.apply(this, arguments);
190
+ };
191
+ }();
192
+ return /*#__PURE__*/React.createElement(StyledRoot, {
193
+ className: cx(className, isDropzoneActive && classes.active, stretch && classes.stretch),
194
+ tabIndex: 0,
195
+ onDragEnter: handleDragEnter,
196
+ onDragLeave: handleDragLeave,
197
+ onDragOver: handleDragOver,
198
+ onDrop: handleDrop,
199
+ onClick: handleClick,
200
+ style: _objectSpread(_objectSpread({}, style), {}, _defineProperty({}, privateTokens.width, innerWidth))
201
+ }, /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(TitleWrapper, null, icon || _IconArrowBarDown || (_IconArrowBarDown = /*#__PURE__*/React.createElement(IconArrowBarDown, {
202
+ color: "inherit",
203
+ size: "s"
204
+ })), title && /*#__PURE__*/React.createElement(Title, null, title)), description && /*#__PURE__*/React.createElement(Description, null, description)), /*#__PURE__*/React.createElement(HiddenInput, _extends({
205
+ ref: forkInputRef,
206
+ type: "file",
207
+ accept: accept,
208
+ multiple: multiple,
209
+ tabIndex: -1,
210
+ onChange: handleChange
211
+ }, rest)));
212
+ });
@@ -0,0 +1,58 @@
1
+ import React, { ComponentProps } from 'react';
2
+ import type { StoryObj, Meta } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+ import { disableProps } from '@salutejs/plasma-sb-utils';
5
+
6
+ import { WithTheme } from '../../../_helpers';
7
+
8
+ import { Dropzone } from './Dropzone';
9
+
10
+ const onDragEnter = action('onDragEnter');
11
+ const onDragLeave = action('onDragLeave');
12
+ const onDrop = action('onDrop');
13
+ const onDropFiles = action('onDropFiles');
14
+ const onChange = action('onChange');
15
+ const onChoseFiles = action('onChoseFiles');
16
+
17
+ const iconPlacement = ['top', 'left'];
18
+
19
+ const meta: Meta<typeof Dropzone> = {
20
+ title: 'plasma_b2c/Dropzone',
21
+ component: Dropzone,
22
+ decorators: [WithTheme],
23
+ argTypes: {
24
+ iconPlacement: {
25
+ control: {
26
+ type: 'inline-radio',
27
+ options: iconPlacement,
28
+ },
29
+ defaultValue: 'top',
30
+ },
31
+ ...disableProps(['view', 'size']),
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+
37
+ type StoryPropsDefault = ComponentProps<typeof Dropzone>;
38
+
39
+ export const Default: StoryObj<StoryPropsDefault> = {
40
+ args: {
41
+ iconPlacement: 'top',
42
+ width: 240,
43
+ disabled: false,
44
+ title: 'Click to upload',
45
+ description: 'or drag and drop files here',
46
+ },
47
+ render: (args) => (
48
+ <Dropzone
49
+ {...args}
50
+ onDragEnter={onDragEnter}
51
+ onDragLeave={onDragLeave}
52
+ onDrop={onDrop}
53
+ onDropFiles={onDropFiles}
54
+ onChange={onChange}
55
+ onChoseFiles={onChoseFiles}
56
+ />
57
+ ),
58
+ };
@@ -0,0 +1,26 @@
1
+ import styled from 'styled-components';
2
+ export var privateTokens = {
3
+ width: '--plasma_private-dropzone-width'
4
+ };
5
+ export var classes = {
6
+ stretch: 'dropzone-stretch',
7
+ active: 'dropzone-active'
8
+ };
9
+ export var StyledRoot = /*#__PURE__*/styled.div.withConfig({
10
+ componentId: "plasma-new-hope__sc-o8ygcm-0"
11
+ })(["padding:1.5rem;border-radius:1.25rem;border:1px dashed var(--outline-secondary);background:var(--surface-solid-card);height:8.75rem;width:var(", ");position:relative;display:flex;align-items:center;justify-content:center;&.", "{width:100%;}&:not(.", "):hover{border-color:#4a4a4a;}&.", "{border-color:var(--outline-accent);&:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background:var(--overlay-soft);}}"], privateTokens.width, classes.stretch, classes.active, classes.active);
12
+ export var Content = /*#__PURE__*/styled.div.withConfig({
13
+ componentId: "plasma-new-hope__sc-o8ygcm-1"
14
+ })(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.75rem;"]);
15
+ export var TitleWrapper = /*#__PURE__*/styled.div.withConfig({
16
+ componentId: "plasma-new-hope__sc-o8ygcm-2"
17
+ })(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;color:var(--text-primary);"]);
18
+ export var Title = /*#__PURE__*/styled.span.withConfig({
19
+ componentId: "plasma-new-hope__sc-o8ygcm-3"
20
+ })(["font-family:var(--plasma-typo-body-h4-font-family);font-size:var(--plasma-typo-body-h4-font-size);font-style:var(--plasma-typo-body-h4-font-style);font-weight:var(--plasma-typo-body-h4-bold-font-weight);letter-spacing:var(--plasma-typo-body-h4-letter-spacing);line-height:var(--plasma-typo-body-h4-line-height);"]);
21
+ export var Description = /*#__PURE__*/styled.span.withConfig({
22
+ componentId: "plasma-new-hope__sc-o8ygcm-4"
23
+ })(["font-family:var(--plasma-typo-body-s-font-family);font-size:var(--plasma-typo-body-s-font-size);font-style:var(--plasma-typo-body-s-font-style);font-weight:var(--plasma-typo-body-s-font-weight);letter-spacing:var(--plasma-typo-body-s-letter-spacing);line-height:var(--plasma-typo-body-s-line-height);color:var(--text-secondary);"]);
24
+ export var HiddenInput = /*#__PURE__*/styled.input.withConfig({
25
+ componentId: "plasma-new-hope__sc-o8ygcm-5"
26
+ })(["display:none;"]);
@@ -0,0 +1,136 @@
1
+ ---
2
+ id: dropzone
3
+ title: Dropzone
4
+ ---
5
+
6
+ import { PropsTable } from '@site/src/components';
7
+
8
+ # Dropzone
9
+ Компонент для загрузки файлов, без отображения индикации загрузки.
10
+ Компонент не предполагает наличия валиации, так как является частью Upload.
11
+ Но валидацию можно задать с помощью callback `validator`.
12
+ <PropsTable name="Dropzone" />
13
+
14
+ # Типизация
15
+
16
+ ```tsx
17
+ type DropzoneProps = {
18
+ /**
19
+ * Массив форматов файлов, которые могут быть прикреплены (см. HTML-атрибут 'accept' для 'input').
20
+ */
21
+ acceptedFileFormats?: string[];
22
+ /**
23
+ * Позовляет выбирать несколько файлов для загрузки
24
+ */
25
+ multiple?: boolean;
26
+ /**
27
+ * Слот для Title
28
+ */
29
+ title?: string;
30
+ /**
31
+ * Слот для описания
32
+ */
33
+ description?: ReactNode;
34
+ /**
35
+ * Слот для иконки
36
+ */
37
+ icon?: ReactNode;
38
+ /**
39
+ * Расположение иконки
40
+ * @default 'left'
41
+ */
42
+ iconPlacement?: 'top' | 'left';
43
+ /**
44
+ * Размер компонента
45
+ */
46
+ size?: string;
47
+ /**
48
+ * Вид компонента
49
+ */
50
+ view?: string;
51
+ /**
52
+ * Компонент неактивен
53
+ */
54
+ disabled?: boolean;
55
+ /**
56
+ * Компонент растягивается на всю доступную ширину
57
+ */
58
+ stretch?: boolean;
59
+ /**
60
+ * Функция, вызываемая в момент вхождения курсора внутрь границ Dropzone
61
+ */
62
+ onDragEnter?: () => void;
63
+ /**
64
+ * Функция, вызываемая в момент выхода курсора из Dropzone
65
+ */
66
+ onDragLeave?: () => void;
67
+ /**
68
+ * Функция, вызываемая при нахождении курсора внутри Dropzone
69
+ */
70
+ onDragOver?: () => void;
71
+ /**
72
+ * Функция, вызываемая при drop файлов
73
+ */
74
+ onDrop?: () => void;
75
+ /**
76
+ * Функция, вызываемая для валидации файлов, перед onDropFiles
77
+ */
78
+ validator?: (files: File[]) => ValidatorReturnType;
79
+ /**
80
+ * Функция, вызываемая при наличии файлов, после onDrop
81
+ */
82
+ onDropFiles?: FileProcessHandler;
83
+ /**
84
+ * Функция, вызываемая при выборе файлов
85
+ */
86
+ onChoseFiles?: FileProcessHandler;
87
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'accept'>;
88
+ ```
89
+
90
+ # Пример
91
+
92
+ ```tsx live
93
+ import React from 'react';
94
+ import { Dropzone } from '@salutejs/{{ package }}';
95
+
96
+ export function App() {
97
+ const onDragEnter = () => {
98
+ console.log("onDragEnter")
99
+ }
100
+
101
+ const onDragLeave = () => {
102
+ console.log("onDragLeave")
103
+ }
104
+
105
+ const onDrop = () => {
106
+ console.log("onDrop")
107
+ }
108
+
109
+ const onDropFiles = () => {
110
+ console.log("onDropFiles")
111
+ }
112
+
113
+ const onChange = () => {
114
+ console.log("onChange")
115
+ }
116
+
117
+ const onChoseFiles = () => {
118
+ console.log("onChoseFiles")
119
+ }
120
+
121
+ return (
122
+ <Dropzone
123
+ iconPlacement="top"
124
+ width="240"
125
+ title="Click to upload"
126
+ description="or drag and drop files here"
127
+ onDragEnter={onDragEnter}
128
+ onDragLeave={onDragLeave}
129
+ onDrop={onDrop}
130
+ onDropFiles={onDropFiles}
131
+ onChange={onChange}
132
+ onChoseFiles={onChoseFiles}
133
+ />
134
+ );
135
+ }
136
+ ```
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconProps } from '../IconRoot';
3
+ export declare const ArrowBarDown: React.FC<IconProps>;
4
+ //# sourceMappingURL=ArrowBarDown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrowBarDown.d.ts","sourceRoot":"","sources":["../../../../src/components/_Icon/Icon.assets/ArrowBarDown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAS5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconProps } from '../IconRoot';
3
+ export declare const IconArrowBarDown: React.FC<IconProps>;
4
+ //# sourceMappingURL=IconArrowBarDown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconArrowBarDown.d.ts","sourceRoot":"","sources":["../../../../src/components/_Icon/Icons/IconArrowBarDown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAEhD,CAAC"}
@@ -25,4 +25,5 @@ export { IconBlankPdfOutline } from './Icons/IconBlankPdfOutline';
25
25
  export { IconBlankTxtOutline } from './Icons/IconBlankTxtOutline';
26
26
  export { IconBlankXlsOutline } from './Icons/IconBlankXlsOutline';
27
27
  export { IconInfoCircleOutline } from './Icons/IconInfoCircleOutline';
28
+ export { IconArrowBarDown } from './Icons/IconArrowBarDown';
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/_Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/_Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { FileProcessHandler } from './Dropzone.types';
3
+ export declare const Dropzone: React.ForwardRefExoticComponent<{
4
+ acceptedFileFormats?: string[] | undefined;
5
+ multiple?: boolean | undefined;
6
+ title?: string | undefined;
7
+ description?: React.ReactNode;
8
+ icon?: React.ReactNode;
9
+ iconPlacement?: "left" | "top" | undefined;
10
+ size?: string | undefined;
11
+ view?: string | undefined;
12
+ disabled?: boolean | undefined;
13
+ stretch?: boolean | undefined;
14
+ onDragEnter?: (() => void) | undefined;
15
+ onDragLeave?: (() => void) | undefined;
16
+ onDragOver?: (() => void) | undefined;
17
+ onDrop?: (() => void) | undefined;
18
+ validator?: ((files: File[]) => import("./Dropzone.types").ValidatorReturnType) | undefined;
19
+ onDropFiles?: FileProcessHandler | undefined;
20
+ onChoseFiles?: FileProcessHandler | undefined;
21
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "accept"> & React.RefAttributes<HTMLInputElement>>;
22
+ //# sourceMappingURL=Dropzone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Dropzone/Dropzone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAO5D,OAAO,EAA2B,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAY/E,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;wGA8KpB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ export declare const privateTokens: {
3
+ width: string;
4
+ };
5
+ export declare const classes: {
6
+ stretch: string;
7
+ active: string;
8
+ };
9
+ export declare const StyledRoot: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
10
+ export declare const Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
11
+ export declare const TitleWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
12
+ export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
13
+ export declare const Description: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
14
+ export declare const HiddenInput: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Record<never, unknown>>;
15
+ //# sourceMappingURL=Dropzone.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.styles.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Dropzone/Dropzone.styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa;;CAEzB,CAAC;AAEF,eAAO,MAAM,OAAO;;;CAGnB,CAAC;AAEF,eAAO,MAAM,UAAU,qKAiCtB,CAAC;AAEF,eAAO,MAAM,OAAO,qKAMnB,CAAC;AAEF,eAAO,MAAM,YAAY,qKAOxB,CAAC;AAEF,eAAO,MAAM,KAAK,uKAOjB,CAAC;AAEF,eAAO,MAAM,WAAW,uKASvB,CAAC;AAEF,eAAO,MAAM,WAAW,8KAEvB,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { InputHTMLAttributes, ReactNode } from 'react';
2
+ export declare type FileArgs = {
3
+ acceptedFiles: File[];
4
+ rejectedFiles?: File[];
5
+ error?: string;
6
+ };
7
+ export declare type ValidatorReturnType = Promise<FileArgs>;
8
+ export declare type FileProcessHandler = (files: FileArgs) => Promise<void> | void;
9
+ export declare type DropzoneProps = {
10
+ /**
11
+ * Массив форматов файлов, которые могут быть прикреплены (см. HTML-атрибут 'accept' для 'input').
12
+ */
13
+ acceptedFileFormats?: string[];
14
+ /**
15
+ * Позовляет выбирать несколько файлов для загрузки
16
+ */
17
+ multiple?: boolean;
18
+ /**
19
+ * Слот для Title
20
+ */
21
+ title?: string;
22
+ /**
23
+ * Слот для описания
24
+ */
25
+ description?: ReactNode;
26
+ /**
27
+ * Слот для иконки
28
+ */
29
+ icon?: ReactNode;
30
+ /**
31
+ * Расположение иконки
32
+ * @default 'left'
33
+ */
34
+ iconPlacement?: 'top' | 'left';
35
+ /**
36
+ * Размер компонента
37
+ */
38
+ size?: string;
39
+ /**
40
+ * Вид компонента
41
+ */
42
+ view?: string;
43
+ /**
44
+ * Компонент неактивен
45
+ */
46
+ disabled?: boolean;
47
+ /**
48
+ * Компонент растягивается на всю доступную ширину
49
+ */
50
+ stretch?: boolean;
51
+ /**
52
+ * Функция, вызываемая в момент вхождения курсора внутрь границ Dropzone
53
+ */
54
+ onDragEnter?: () => void;
55
+ /**
56
+ * Функция, вызываемая в момент выхода курсора из Dropzone
57
+ */
58
+ onDragLeave?: () => void;
59
+ /**
60
+ * Функция, вызываемая при нахождении курсора внутри Dropzone
61
+ */
62
+ onDragOver?: () => void;
63
+ /**
64
+ * Функция, вызываемая при drop файлов
65
+ */
66
+ onDrop?: () => void;
67
+ /**
68
+ * Функция, вызываемая для валидации файлов, перед onDropFiles
69
+ */
70
+ validator?: (files: File[]) => ValidatorReturnType;
71
+ /**
72
+ * Функция, вызываемая при наличии файлов, после onDrop
73
+ */
74
+ onDropFiles?: FileProcessHandler;
75
+ /**
76
+ * Функция, вызываемая при выборе файлов
77
+ */
78
+ onChoseFiles?: FileProcessHandler;
79
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'accept'>;
80
+ //# sourceMappingURL=Dropzone.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.types.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Dropzone/Dropzone.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,oBAAY,QAAQ,GAAG;IACnB,aAAa,EAAE,IAAI,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACpD,oBAAY,kBAAkB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE3E,oBAAY,aAAa,GAAG;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,mBAAmB,CAAC;IACnD;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;OAEG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACrC,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC"}