@salutejs/plasma-new-hope 0.194.1-canary.1569.11908076676.0 → 0.195.0-canary.1534.11911237435.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +333 -0
- package/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/cjs/components/Dropzone/Dropzone.css +15 -0
- package/cjs/components/Dropzone/Dropzone.js +252 -0
- package/cjs/components/Dropzone/Dropzone.js.map +1 -0
- package/cjs/components/Dropzone/Dropzone.styles.js +47 -0
- package/cjs/components/Dropzone/Dropzone.styles.js.map +1 -0
- package/cjs/components/Dropzone/Dropzone.styles_1fo7dbq.css +7 -0
- package/cjs/components/Dropzone/Dropzone.tokens.js +47 -0
- package/cjs/components/Dropzone/Dropzone.tokens.js.map +1 -0
- package/cjs/components/Dropzone/variations/_disabled/base.js +9 -0
- package/cjs/components/Dropzone/variations/_disabled/base.js.map +1 -0
- package/cjs/components/Dropzone/variations/_disabled/base_3qwygi.css +1 -0
- package/cjs/components/Dropzone/variations/_size/base.js +9 -0
- package/cjs/components/Dropzone/variations/_size/base.js.map +1 -0
- package/cjs/components/Dropzone/variations/_size/base_1bt22g1.css +1 -0
- package/cjs/components/Dropzone/variations/_view/base.js +9 -0
- package/cjs/components/Dropzone/variations/_view/base.js.map +1 -0
- package/cjs/components/Dropzone/variations/_view/base_1pdzq6t.css +1 -0
- package/cjs/components/Switch/Switch.css +1 -1
- package/cjs/components/Switch/Switch.tokens.js +1 -2
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/cjs/components/_Icon/Icon.assets/ArrowBarDown.js +24 -0
- package/cjs/components/_Icon/Icon.assets/ArrowBarDown.js.map +1 -0
- package/cjs/components/_Icon/Icons/IconArrowBarDown.js +23 -0
- package/cjs/components/_Icon/Icons/IconArrowBarDown.js.map +1 -0
- package/cjs/index.css +15 -1
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Dropzone/Dropzone.js +271 -0
- package/emotion/cjs/components/Dropzone/Dropzone.styles.js +67 -0
- package/emotion/cjs/components/Dropzone/Dropzone.template-docs.mdx +136 -0
- package/emotion/cjs/components/Dropzone/Dropzone.tokens.js +44 -0
- package/emotion/cjs/components/Dropzone/Dropzone.types.js +5 -0
- package/emotion/cjs/components/Dropzone/index.js +31 -0
- package/emotion/cjs/components/Dropzone/variations/_disabled/base.js +9 -0
- package/emotion/cjs/components/Dropzone/variations/_disabled/tokens.json +4 -0
- package/emotion/cjs/components/Dropzone/variations/_size/base.js +10 -0
- package/emotion/cjs/components/Dropzone/variations/_size/tokens.json +19 -0
- package/emotion/cjs/components/Dropzone/variations/_view/base.js +10 -0
- package/emotion/cjs/components/Dropzone/variations/_view/tokens.json +9 -0
- package/emotion/cjs/components/Switch/Switch.tokens.js +1 -2
- package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/cjs/components/_Icon/Icon.assets/ArrowBarDown.js +23 -0
- package/emotion/cjs/components/_Icon/Icons/IconArrowBarDown.js +22 -0
- package/emotion/cjs/components/_Icon/index.js +8 -1
- package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.config.js +25 -0
- package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Dropzone/Dropzone.config.js +25 -0
- package/emotion/cjs/examples/plasma_web/components/Dropzone/Dropzone.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Dropzone/Dropzone.js +263 -0
- package/emotion/es/components/Dropzone/Dropzone.styles.js +60 -0
- package/emotion/es/components/Dropzone/Dropzone.template-docs.mdx +136 -0
- package/emotion/es/components/Dropzone/Dropzone.tokens.js +38 -0
- package/emotion/es/components/Dropzone/Dropzone.types.js +1 -0
- package/emotion/es/components/Dropzone/index.js +2 -0
- package/emotion/es/components/Dropzone/variations/_disabled/base.js +3 -0
- package/emotion/es/components/Dropzone/variations/_disabled/tokens.json +4 -0
- package/emotion/es/components/Dropzone/variations/_size/base.js +4 -0
- package/emotion/es/components/Dropzone/variations/_size/tokens.json +19 -0
- package/emotion/es/components/Dropzone/variations/_view/base.js +4 -0
- package/emotion/es/components/Dropzone/variations/_view/tokens.json +9 -0
- package/emotion/es/components/Switch/Switch.tokens.js +1 -2
- package/emotion/es/components/Switch/_toggleSize/base.js +2 -2
- package/emotion/es/components/_Icon/Icon.assets/ArrowBarDown.js +16 -0
- package/emotion/es/components/_Icon/Icons/IconArrowBarDown.js +15 -0
- package/emotion/es/components/_Icon/index.js +2 -1
- package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.config.js +19 -0
- package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Dropzone/Dropzone.config.js +19 -0
- package/emotion/es/examples/plasma_web/components/Dropzone/Dropzone.js +5 -0
- package/emotion/es/examples/plasma_web/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/es/index.js +2 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +332 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/es/components/Dropzone/Dropzone.css +15 -0
- package/es/components/Dropzone/Dropzone.js +247 -0
- package/es/components/Dropzone/Dropzone.js.map +1 -0
- package/es/components/Dropzone/Dropzone.styles.js +37 -0
- package/es/components/Dropzone/Dropzone.styles.js.map +1 -0
- package/es/components/Dropzone/Dropzone.styles_1fo7dbq.css +7 -0
- package/es/components/Dropzone/Dropzone.tokens.js +41 -0
- package/es/components/Dropzone/Dropzone.tokens.js.map +1 -0
- package/es/components/Dropzone/variations/_disabled/base.js +5 -0
- package/es/components/Dropzone/variations/_disabled/base.js.map +1 -0
- package/es/components/Dropzone/variations/_disabled/base_3qwygi.css +1 -0
- package/es/components/Dropzone/variations/_size/base.js +5 -0
- package/es/components/Dropzone/variations/_size/base.js.map +1 -0
- package/es/components/Dropzone/variations/_size/base_1bt22g1.css +1 -0
- package/es/components/Dropzone/variations/_view/base.js +5 -0
- package/es/components/Dropzone/variations/_view/base.js.map +1 -0
- package/es/components/Dropzone/variations/_view/base_1pdzq6t.css +1 -0
- package/es/components/Switch/Switch.css +1 -1
- package/es/components/Switch/Switch.tokens.js +1 -2
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_toggleSize/base.js +1 -1
- package/es/components/Switch/_toggleSize/base.js.map +1 -1
- package/es/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/es/components/_Icon/Icon.assets/ArrowBarDown.js +20 -0
- package/es/components/_Icon/Icon.assets/ArrowBarDown.js.map +1 -0
- package/es/components/_Icon/Icons/IconArrowBarDown.js +19 -0
- package/es/components/_Icon/Icons/IconArrowBarDown.js.map +1 -0
- package/es/index.css +15 -1
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Dropzone/Dropzone.js +271 -0
- package/styled-components/cjs/components/Dropzone/Dropzone.styles.js +29 -0
- package/styled-components/cjs/components/Dropzone/Dropzone.template-docs.mdx +136 -0
- package/styled-components/cjs/components/Dropzone/Dropzone.tokens.js +44 -0
- package/styled-components/cjs/components/Dropzone/Dropzone.types.js +5 -0
- package/styled-components/cjs/components/Dropzone/index.js +31 -0
- package/styled-components/cjs/components/Dropzone/variations/_disabled/base.js +9 -0
- package/styled-components/cjs/components/Dropzone/variations/_disabled/tokens.json +4 -0
- package/styled-components/cjs/components/Dropzone/variations/_size/base.js +10 -0
- package/styled-components/cjs/components/Dropzone/variations/_size/tokens.json +19 -0
- package/styled-components/cjs/components/Dropzone/variations/_view/base.js +10 -0
- package/styled-components/cjs/components/Dropzone/variations/_view/tokens.json +9 -0
- package/styled-components/cjs/components/Switch/Switch.tokens.js +1 -2
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/cjs/components/_Icon/Icon.assets/ArrowBarDown.js +23 -0
- package/styled-components/cjs/components/_Icon/Icons/IconArrowBarDown.js +22 -0
- package/styled-components/cjs/components/_Icon/index.js +8 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.config.js +25 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropzone/Dropzone.config.js +25 -0
- package/styled-components/cjs/examples/plasma_web/components/Dropzone/Dropzone.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Dropzone/Dropzone.js +263 -0
- package/styled-components/es/components/Dropzone/Dropzone.styles.js +21 -0
- package/styled-components/es/components/Dropzone/Dropzone.template-docs.mdx +136 -0
- package/styled-components/es/components/Dropzone/Dropzone.tokens.js +38 -0
- package/styled-components/es/components/Dropzone/Dropzone.types.js +1 -0
- package/styled-components/es/components/Dropzone/index.js +2 -0
- package/styled-components/es/components/Dropzone/variations/_disabled/base.js +3 -0
- package/styled-components/es/components/Dropzone/variations/_disabled/tokens.json +4 -0
- package/styled-components/es/components/Dropzone/variations/_size/base.js +4 -0
- package/styled-components/es/components/Dropzone/variations/_size/tokens.json +19 -0
- package/styled-components/es/components/Dropzone/variations/_view/base.js +4 -0
- package/styled-components/es/components/Dropzone/variations/_view/tokens.json +9 -0
- package/styled-components/es/components/Switch/Switch.tokens.js +1 -2
- package/styled-components/es/components/Switch/_toggleSize/base.js +2 -2
- package/styled-components/es/components/_Icon/Icon.assets/ArrowBarDown.js +16 -0
- package/styled-components/es/components/_Icon/Icons/IconArrowBarDown.js +15 -0
- package/styled-components/es/components/_Icon/index.js +2 -1
- package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.config.js +19 -0
- package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Dropzone/Dropzone.config.js +19 -0
- package/styled-components/es/examples/plasma_web/components/Dropzone/Dropzone.js +5 -0
- package/styled-components/es/examples/plasma_web/components/Dropzone/Dropzone.stories.tsx +57 -0
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/es/index.js +2 -1
- package/types/components/Dropzone/Dropzone.d.ts +59 -0
- package/types/components/Dropzone/Dropzone.d.ts.map +1 -0
- package/types/components/Dropzone/Dropzone.styles.d.ts +9 -0
- package/types/components/Dropzone/Dropzone.styles.d.ts.map +1 -0
- package/types/components/Dropzone/Dropzone.tokens.d.ts +39 -0
- package/types/components/Dropzone/Dropzone.tokens.d.ts.map +1 -0
- package/types/components/Dropzone/Dropzone.types.d.ts +77 -0
- package/types/components/Dropzone/Dropzone.types.d.ts.map +1 -0
- package/types/components/Dropzone/index.d.ts +3 -0
- package/types/components/Dropzone/index.d.ts.map +1 -0
- package/types/components/Dropzone/variations/_disabled/base.d.ts +2 -0
- package/types/components/Dropzone/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/Dropzone/variations/_size/base.d.ts +2 -0
- package/types/components/Dropzone/variations/_size/base.d.ts.map +1 -0
- package/types/components/Dropzone/variations/_view/base.d.ts +2 -0
- package/types/components/Dropzone/variations/_view/base.d.ts.map +1 -0
- package/types/components/Switch/Switch.tokens.d.ts +1 -2
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
- package/types/components/_Icon/Icon.assets/ArrowBarDown.d.ts +4 -0
- package/types/components/_Icon/Icon.assets/ArrowBarDown.d.ts.map +1 -0
- package/types/components/_Icon/Icons/IconArrowBarDown.d.ts +4 -0
- package/types/components/_Icon/Icons/IconArrowBarDown.d.ts.map +1 -0
- package/types/components/_Icon/index.d.ts +1 -0
- package/types/components/_Icon/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Dropzone/Dropzone.config.d.ts +18 -0
- package/types/examples/plasma_b2c/components/Dropzone/Dropzone.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Dropzone/Dropzone.d.ts +29 -0
- package/types/examples/plasma_b2c/components/Dropzone/Dropzone.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Dropzone/Dropzone.config.d.ts +18 -0
- package/types/examples/plasma_web/components/Dropzone/Dropzone.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Dropzone/Dropzone.d.ts +29 -0
- package/types/examples/plasma_web/components/Dropzone/Dropzone.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_o6rjc1.css +0 -1
- package/es/components/Switch/_toggleSize/base_o6rjc1.css +0 -1
@@ -0,0 +1,21 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { css } from 'styled-components';
|
3
|
+
export var base = /*#__PURE__*/css(["position:relative;display:flex;align-items:center;justify-content:center;cursor:pointer;"]);
|
4
|
+
export var DropzoneHandlerOverlay = /*#__PURE__*/styled.div.withConfig({
|
5
|
+
componentId: "plasma-new-hope__sc-mq500f-0"
|
6
|
+
})(["position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;"]);
|
7
|
+
export var Content = /*#__PURE__*/styled.div.withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-mq500f-1"
|
9
|
+
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;user-select:none;"]);
|
10
|
+
export var TitleWrapper = /*#__PURE__*/styled.div.withConfig({
|
11
|
+
componentId: "plasma-new-hope__sc-mq500f-2"
|
12
|
+
})([""]);
|
13
|
+
export var Title = /*#__PURE__*/styled.span.withConfig({
|
14
|
+
componentId: "plasma-new-hope__sc-mq500f-3"
|
15
|
+
})([""]);
|
16
|
+
export var Description = /*#__PURE__*/styled.span.withConfig({
|
17
|
+
componentId: "plasma-new-hope__sc-mq500f-4"
|
18
|
+
})([""]);
|
19
|
+
export var HiddenInput = /*#__PURE__*/styled.input.withConfig({
|
20
|
+
componentId: "plasma-new-hope__sc-mq500f-5"
|
21
|
+
})(["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,38 @@
|
|
1
|
+
export var classes = {
|
2
|
+
stretch: 'dropzone-stretch',
|
3
|
+
active: 'dropzone-active',
|
4
|
+
verticalContentPlacing: 'dropzone-vertical-content-placing',
|
5
|
+
disabled: 'dropzone-disabled'
|
6
|
+
};
|
7
|
+
export var privateTokens = {
|
8
|
+
width: '--plasma_private-dropzone-width',
|
9
|
+
height: '--plasma_private-dropzone-height'
|
10
|
+
};
|
11
|
+
export var tokens = {
|
12
|
+
background: '--plasma-dropzone-background',
|
13
|
+
backgroundHover: '--plasma-dropzone-background-hover',
|
14
|
+
overlayColorActive: '--plasma-dropzone-overlay-color-active',
|
15
|
+
border: '--plasma-dropzone-border-color',
|
16
|
+
borderColorHover: '--plasma-dropzone-border-color-hover',
|
17
|
+
borderColorActive: '--plasma-dropzone-border-color-active',
|
18
|
+
titleColor: '--plasma-dropzone-title-color',
|
19
|
+
descriptionColor: '--plasma-dropzone-description-color',
|
20
|
+
padding: '--plasma-dropzone-padding',
|
21
|
+
borderRadius: '--plasma-dropzone-border-radius',
|
22
|
+
contentGap: '--plasma-dropzone-content-gap',
|
23
|
+
titleWrapperGap: '--plasma-dropzone-title-wrapper-gap',
|
24
|
+
titleWrapperGapColumn: '--plasma-dropzone-title-wrapper-column-gap',
|
25
|
+
titleFontFamily: '--plasma-dropzone-title-font-family',
|
26
|
+
titleFontSize: '--plasma-dropzone-title-font-size',
|
27
|
+
titleFontStyle: '--plasma-dropzone-title-font-style',
|
28
|
+
titleFontWeight: '--plasma-dropzone-title-font-weight',
|
29
|
+
titleLetterSpacing: '--plasma-dropzone-title-letter-spacing',
|
30
|
+
titleLineHeight: '--plasma-dropzone-title-line-height',
|
31
|
+
descriptionFontFamily: '--plasma-dropzone-description-font-family',
|
32
|
+
descriptionFontSize: '--plasma-dropzone-description-font-size',
|
33
|
+
descriptionFontStyle: '--plasma-dropzone-description-font-style',
|
34
|
+
descriptionFontWeight: '--plasma-dropzone-description-font-weight',
|
35
|
+
descriptionLetterSpacing: '--plasma-dropzone-description-letter-spacing',
|
36
|
+
descriptionLineHeight: '--plasma-dropzone-description-line-height',
|
37
|
+
disabledOpacity: '--plasma-dropzone-disabled-opacity'
|
38
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, privateTokens, tokens } from '../../Dropzone.tokens';
|
3
|
+
import { Content, Description, DropzoneHandlerOverlay, Title, TitleWrapper } from '../../Dropzone.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["padding:var(", ");border-radius:var(", ");height:var(", ");width:var(", ");&.", "{width:100%;}", "{border-radius:var(", ");}", "{gap:var(", ");}", "{display:flex;align-items:center;justify-content:center;gap:var(", ");&.", "{flex-direction:column;gap:var(", ");}}", "{font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}", "{font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}"], tokens.padding, tokens.borderRadius, privateTokens.height, privateTokens.width, classes.stretch, DropzoneHandlerOverlay, tokens.borderRadius, Content, tokens.contentGap, TitleWrapper, tokens.titleWrapperGap, classes.verticalContentPlacing, tokens.titleWrapperGapColumn, Title, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, Description, tokens.descriptionFontFamily, tokens.descriptionFontSize, tokens.descriptionFontStyle, tokens.descriptionFontWeight, tokens.descriptionLetterSpacing, tokens.descriptionLineHeight);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[
|
2
|
+
"--plasma-dropzone-padding",
|
3
|
+
"--plasma-dropzone-border-radius",
|
4
|
+
"--plasma-dropzone-content-gap",
|
5
|
+
"--plasma-dropzone-title-wrapper-gap",
|
6
|
+
"--plasma-dropzone-title-wrapper-gap",
|
7
|
+
"--plasma-dropzone-title-font-family",
|
8
|
+
"--plasma-dropzone-title-font-size",
|
9
|
+
"--plasma-dropzone-title-font-style",
|
10
|
+
"--plasma-dropzone-title-font-weight",
|
11
|
+
"--plasma-dropzone-title-letter-spacing",
|
12
|
+
"--plasma-dropzone-title-line-height",
|
13
|
+
"--plasma-dropzone-description-font-family",
|
14
|
+
"--plasma-dropzone-description-font-size",
|
15
|
+
"--plasma-dropzone-description-font-style",
|
16
|
+
"--plasma-dropzone-description-font-weight",
|
17
|
+
"--plasma-dropzone-description-letter-spacing",
|
18
|
+
"--plasma-dropzone-description-line-height"
|
19
|
+
]
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, tokens } from '../../Dropzone.tokens';
|
3
|
+
import { Description, DropzoneHandlerOverlay, TitleWrapper } from '../../Dropzone.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["background:var(", ");border:var(", ");&:not(.", "):hover,&:not(.", "):focus-within{background:var(", ");border-color:var(", ");outline:none;}&.", "{border-color:var(", ");", "{background:var(", ");}}", "{color:var(", ");}", "{color:var(", ");}"], tokens.background, tokens.border, classes.active, classes.active, tokens.backgroundHover, tokens.borderColorHover, classes.active, tokens.borderColorActive, DropzoneHandlerOverlay, tokens.overlayColorActive, TitleWrapper, tokens.titleColor, Description, tokens.descriptionColor);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
[
|
2
|
+
"--plasma-dropzone-background",
|
3
|
+
"--plasma-dropzone-overlay-color-active",
|
4
|
+
"--plasma-dropzone-border-color",
|
5
|
+
"--plasma-dropzone-border-color-hover",
|
6
|
+
"--plasma-dropzone-border-color-active",
|
7
|
+
"--plasma-dropzone-title-color",
|
8
|
+
"--plasma-dropzone-description-color"
|
9
|
+
]
|
@@ -23,8 +23,7 @@ export var tokens = {
|
|
23
23
|
verticalGap: '--plasma-switch-vertical-gap',
|
24
24
|
trackWidth: '--plasma-switch__track-width',
|
25
25
|
trackHeight: '--plasma-switch__track-height',
|
26
|
-
|
27
|
-
trackBorderWidthOff: '--plasma-switch__track-checked_false-border-width',
|
26
|
+
trackBorderWidth: '--plasma-switch__track-border',
|
28
27
|
trackBorderColorOn: '--plasma-switch__track-checked_true-border-color',
|
29
28
|
trackBorderColorOnHover: '--plasma-switch__track-checked_true_hovered_true-border-color',
|
30
29
|
trackBorderColorOff: '--plasma-switch__track-checked_false-border-color',
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
2
|
import { tokens } from '../Switch.tokens';
|
3
|
-
import {
|
4
|
-
export var base = /*#__PURE__*/css(["", "{box-sizing:border-box;flex:0 0 var(", ");border-style:solid;border-width:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");&::after{width:var(", ");height:var(", ");border-radius:var(", ");margin:auto var(", ");}}
|
3
|
+
import { StyledTrigger } from '../Switch.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["", "{box-sizing:border-box;flex:0 0 var(", ");border-style:solid;border-width:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");&::after{width:var(", ");height:var(", ");border-radius:var(", ");margin:auto var(", ");}}:active:not([disabled]) ", "::after{width:calc(var(", ") * var(", ",1));}"], StyledTrigger, tokens.trackWidth, tokens.trackBorderWidth, tokens.trackBorderRadius, tokens.trackWidth, tokens.trackHeight, tokens.thumbSize, tokens.thumbSize, tokens.thumbBorderRadius, tokens.thumbOffset, StyledTrigger, tokens.thumbSize, tokens.thumbPressScale);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
var _path;
|
2
|
+
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); }
|
3
|
+
import React from 'react';
|
4
|
+
export var ArrowBarDown = function ArrowBarDown(props) {
|
5
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
6
|
+
width: "100%",
|
7
|
+
viewBox: "0 0 16 16",
|
8
|
+
fill: "none",
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
10
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
11
|
+
fillRule: "evenodd",
|
12
|
+
clipRule: "evenodd",
|
13
|
+
d: "M7.95833 1.875C8.23448 1.875 8.45833 2.09886 8.45833 2.375V10.4043L11.2686 7.54868C11.4623 7.35186 11.7789 7.34933 11.9757 7.54302C12.1725 7.73672 12.1751 8.05329 11.9814 8.25011L8.3147 11.9759C8.21782 12.0744 8.08453 12.1283 7.94645 12.1251C7.80837 12.1218 7.67779 12.0615 7.5857 11.9586L4.25237 8.23278C4.06824 8.02698 4.08582 7.71088 4.29162 7.52676C4.49742 7.34264 4.81351 7.36021 4.99763 7.56601L7.45833 10.3164V2.375C7.45833 2.09886 7.68219 1.875 7.95833 1.875ZM2.5 14.0001C2.5 13.724 2.72386 13.5001 3 13.5001H13C13.2761 13.5001 13.5 13.724 13.5 14.0001C13.5 14.2763 13.2761 14.5001 13 14.5001H3C2.72386 14.5001 2.5 14.2763 2.5 14.0001Z",
|
14
|
+
fill: "currentColor"
|
15
|
+
})));
|
16
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ArrowBarDown } from '../Icon.assets/ArrowBarDown';
|
3
|
+
import { IconRoot } from '../IconRoot';
|
4
|
+
export var IconArrowBarDown = function IconArrowBarDown(_ref) {
|
5
|
+
var _ref$size = _ref.size,
|
6
|
+
size = _ref$size === void 0 ? 'xs' : _ref$size,
|
7
|
+
color = _ref.color,
|
8
|
+
className = _ref.className;
|
9
|
+
return /*#__PURE__*/React.createElement(IconRoot, {
|
10
|
+
className: className,
|
11
|
+
size: size,
|
12
|
+
color: color,
|
13
|
+
icon: ArrowBarDown
|
14
|
+
});
|
15
|
+
};
|
@@ -24,4 +24,5 @@ export { IconBlankOutline } from './Icons/IconBlankOutline';
|
|
24
24
|
export { IconBlankPdfOutline } from './Icons/IconBlankPdfOutline';
|
25
25
|
export { IconBlankTxtOutline } from './Icons/IconBlankTxtOutline';
|
26
26
|
export { IconBlankXlsOutline } from './Icons/IconBlankXlsOutline';
|
27
|
-
export { IconInfoCircleOutline } from './Icons/IconInfoCircleOutline';
|
27
|
+
export { IconInfoCircleOutline } from './Icons/IconInfoCircleOutline';
|
28
|
+
export { IconArrowBarDown } from './Icons/IconArrowBarDown';
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { dropzoneTokens } from '../../../../components/Dropzone';
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'default',
|
6
|
+
size: 'm'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
"default": /*#__PURE__*/css(["", ":var(--surface-solid-card);", ":var(--surface-solid-card-hover);", ":var(--overlay-soft);", ":0.063rem dashed var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--text-primary);", ":var(--text-secondary);"], dropzoneTokens.background, dropzoneTokens.backgroundHover, dropzoneTokens.overlayColorActive, dropzoneTokens.border, dropzoneTokens.borderColorHover, dropzoneTokens.borderColorActive, dropzoneTokens.titleColor, dropzoneTokens.descriptionColor)
|
11
|
+
},
|
12
|
+
size: {
|
13
|
+
m: /*#__PURE__*/css(["", ":1.5rem;", ":1.25rem;", ":0.75rem;", ":0.375rem;", ":0.5rem;", ":var(--plasma-typo-h4-font-family);", ":var(--plasma-typo-h4-font-size);", ":var(--plasma-typo-h4-font-style);", ":var(--plasma-typo-h4-bold-font-weight);", ":var(--plasma-typo-h4-letter-spacing);", ":var(--plasma-typo-h4-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], dropzoneTokens.padding, dropzoneTokens.borderRadius, dropzoneTokens.contentGap, dropzoneTokens.titleWrapperGap, dropzoneTokens.titleWrapperGapColumn, dropzoneTokens.titleFontFamily, dropzoneTokens.titleFontSize, dropzoneTokens.titleFontStyle, dropzoneTokens.titleFontWeight, dropzoneTokens.titleLetterSpacing, dropzoneTokens.titleLineHeight, dropzoneTokens.descriptionFontFamily, dropzoneTokens.descriptionFontSize, dropzoneTokens.descriptionFontStyle, dropzoneTokens.descriptionFontWeight, dropzoneTokens.descriptionLetterSpacing, dropzoneTokens.descriptionLineHeight)
|
14
|
+
},
|
15
|
+
disabled: {
|
16
|
+
"true": /*#__PURE__*/css(["", ":0.4;"], dropzoneTokens.disabledOpacity)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { dropzoneConfig } from '../../../../components/Dropzone';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './Dropzone.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(dropzoneConfig, config);
|
5
|
+
export var Dropzone = /*#__PURE__*/component(mergedConfig);
|
@@ -0,0 +1,57 @@
|
|
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 onChange = action('onChange');
|
14
|
+
const onChoseFiles = action('onChoseFiles');
|
15
|
+
|
16
|
+
const iconPlacements = ['top', 'left'];
|
17
|
+
|
18
|
+
const meta: Meta<typeof Dropzone> = {
|
19
|
+
title: 'plasma_b2c/Dropzone',
|
20
|
+
component: Dropzone,
|
21
|
+
decorators: [WithTheme],
|
22
|
+
argTypes: {
|
23
|
+
iconPlacement: {
|
24
|
+
options: iconPlacements,
|
25
|
+
control: {
|
26
|
+
type: 'inline-radio',
|
27
|
+
},
|
28
|
+
defaultValue: 'top',
|
29
|
+
},
|
30
|
+
...disableProps(['view', 'size']),
|
31
|
+
},
|
32
|
+
};
|
33
|
+
|
34
|
+
export default meta;
|
35
|
+
|
36
|
+
type StoryPropsDefault = ComponentProps<typeof Dropzone>;
|
37
|
+
|
38
|
+
export const Default: StoryObj<StoryPropsDefault> = {
|
39
|
+
args: {
|
40
|
+
iconPlacement: 'top',
|
41
|
+
width: 400,
|
42
|
+
height: 280,
|
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
|
+
onChange={onChange}
|
54
|
+
onChoseFiles={onChoseFiles}
|
55
|
+
/>
|
56
|
+
),
|
57
|
+
};
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":0rem;", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.trackBorderWidth, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":0.875rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBorderWidth, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { dropzoneTokens } from '../../../../components/Dropzone';
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'default',
|
6
|
+
size: 'm'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
"default": /*#__PURE__*/css(["", ":var(--surface-solid-card);", ":var(--surface-solid-card-hover);", ":var(--overlay-soft);", ":0.063rem dashed var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--text-primary);", ":var(--text-secondary);"], dropzoneTokens.background, dropzoneTokens.backgroundHover, dropzoneTokens.overlayColorActive, dropzoneTokens.border, dropzoneTokens.borderColorHover, dropzoneTokens.borderColorActive, dropzoneTokens.titleColor, dropzoneTokens.descriptionColor)
|
11
|
+
},
|
12
|
+
size: {
|
13
|
+
m: /*#__PURE__*/css(["", ":1.5rem;", ":1.25rem;", ":0.75rem;", ":0.375rem;", ":0.5rem;", ":var(--plasma-typo-h4-font-family);", ":var(--plasma-typo-h4-font-size);", ":var(--plasma-typo-h4-font-style);", ":var(--plasma-typo-h4-bold-font-weight);", ":var(--plasma-typo-h4-letter-spacing);", ":var(--plasma-typo-h4-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], dropzoneTokens.padding, dropzoneTokens.borderRadius, dropzoneTokens.contentGap, dropzoneTokens.titleWrapperGap, dropzoneTokens.titleWrapperGapColumn, dropzoneTokens.titleFontFamily, dropzoneTokens.titleFontSize, dropzoneTokens.titleFontStyle, dropzoneTokens.titleFontWeight, dropzoneTokens.titleLetterSpacing, dropzoneTokens.titleLineHeight, dropzoneTokens.descriptionFontFamily, dropzoneTokens.descriptionFontSize, dropzoneTokens.descriptionFontStyle, dropzoneTokens.descriptionFontWeight, dropzoneTokens.descriptionLetterSpacing, dropzoneTokens.descriptionLineHeight)
|
14
|
+
},
|
15
|
+
disabled: {
|
16
|
+
"true": /*#__PURE__*/css(["", ":0.4;"], dropzoneTokens.disabledOpacity)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { dropzoneConfig } from '../../../../components/Dropzone';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './Dropzone.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(dropzoneConfig, config);
|
5
|
+
export var Dropzone = /*#__PURE__*/component(mergedConfig);
|
@@ -0,0 +1,57 @@
|
|
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 onChange = action('onChange');
|
14
|
+
const onChoseFiles = action('onChoseFiles');
|
15
|
+
|
16
|
+
const iconPlacements = ['top', 'left'];
|
17
|
+
|
18
|
+
const meta: Meta<typeof Dropzone> = {
|
19
|
+
title: 'plasma_web/Dropzone',
|
20
|
+
component: Dropzone,
|
21
|
+
decorators: [WithTheme],
|
22
|
+
argTypes: {
|
23
|
+
iconPlacement: {
|
24
|
+
options: iconPlacements,
|
25
|
+
control: {
|
26
|
+
type: 'inline-radio',
|
27
|
+
},
|
28
|
+
defaultValue: 'top',
|
29
|
+
},
|
30
|
+
...disableProps(['view', 'size']),
|
31
|
+
},
|
32
|
+
};
|
33
|
+
|
34
|
+
export default meta;
|
35
|
+
|
36
|
+
type StoryPropsDefault = ComponentProps<typeof Dropzone>;
|
37
|
+
|
38
|
+
export const Default: StoryObj<StoryPropsDefault> = {
|
39
|
+
args: {
|
40
|
+
iconPlacement: 'top',
|
41
|
+
width: 400,
|
42
|
+
height: 280,
|
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
|
+
onChange={onChange}
|
54
|
+
onChoseFiles={onChoseFiles}
|
55
|
+
/>
|
56
|
+
),
|
57
|
+
};
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":0rem;", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.trackBorderWidth, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":0.875rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBorderWidth, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -63,4 +63,5 @@ export * from './components/Editable';
|
|
63
63
|
export * from './components/Mask';
|
64
64
|
export * from './components/Attach';
|
65
65
|
export * from './components/ViewContainer';
|
66
|
-
export * from './components/NumberInput';
|
66
|
+
export * from './components/NumberInput';
|
67
|
+
export * from './components/Dropzone';
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { RootProps } from '../../engines';
|
3
|
+
import type { DropzoneRootProps, FileProcessHandler } from './Dropzone.types';
|
4
|
+
export declare const dropzoneRoot: (Root: RootProps<HTMLDivElement, DropzoneRootProps>) => React.ForwardRefExoticComponent<{
|
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?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
15
|
+
onDragLeave?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
16
|
+
onDragOver?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
17
|
+
validator?: ((files: File[]) => import("./Dropzone.types").ValidatorReturnType) | undefined;
|
18
|
+
onDrop?: FileProcessHandler | undefined;
|
19
|
+
onChoseFiles?: FileProcessHandler | undefined;
|
20
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
21
|
+
export declare const dropzoneConfig: {
|
22
|
+
name: string;
|
23
|
+
tag: string;
|
24
|
+
layout: (Root: RootProps<HTMLDivElement, DropzoneRootProps>) => React.ForwardRefExoticComponent<{
|
25
|
+
multiple?: boolean | undefined;
|
26
|
+
title?: string | undefined;
|
27
|
+
description?: React.ReactNode;
|
28
|
+
icon?: React.ReactNode;
|
29
|
+
iconPlacement?: "left" | "top" | undefined;
|
30
|
+
size?: string | undefined;
|
31
|
+
view?: string | undefined;
|
32
|
+
disabled?: boolean | undefined;
|
33
|
+
stretch?: boolean | undefined;
|
34
|
+
onDragEnter?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
35
|
+
onDragLeave?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
36
|
+
onDragOver?: ((event: React.DragEvent<HTMLDivElement>) => void) | undefined;
|
37
|
+
validator?: ((files: File[]) => import("./Dropzone.types").ValidatorReturnType) | undefined;
|
38
|
+
onDrop?: FileProcessHandler | undefined;
|
39
|
+
onChoseFiles?: FileProcessHandler | undefined;
|
40
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
41
|
+
base: import("@linaria/core").LinariaClassName;
|
42
|
+
variations: {
|
43
|
+
view: {
|
44
|
+
css: import("@linaria/core").LinariaClassName;
|
45
|
+
};
|
46
|
+
size: {
|
47
|
+
css: import("@linaria/core").LinariaClassName;
|
48
|
+
};
|
49
|
+
disabled: {
|
50
|
+
css: import("@linaria/core").LinariaClassName;
|
51
|
+
attrs: boolean;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
defaults: {
|
55
|
+
view: string;
|
56
|
+
size: string;
|
57
|
+
};
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=Dropzone.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Dropzone.d.ts","sourceRoot":"","sources":["../../../src/components/Dropzone/Dropzone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAiB,iBAAiB,EAAY,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAevG,eAAO,MAAM,YAAY,SAAU,UAAU,cAAc,EAAE,iBAAiB,CAAC;;;;;;;;;;;;;;;;wFAyM1E,CAAC;AAEN,eAAO,MAAM,cAAc;;;mBA3MQ,UAAU,cAAc,EAAE,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgO9E,CAAC"}
|