@delightui/components 0.1.105 → 0.1.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -1
- package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/library.css +19 -6
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/library.css +19 -6
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +108 -2
- package/docs/README.md +264 -0
- package/docs/components/atoms/ActionImage.md +119 -0
- package/docs/components/atoms/Button.md +197 -0
- package/docs/components/atoms/Checkbox.md +299 -0
- package/docs/components/atoms/CheckboxItem.md +314 -0
- package/docs/components/atoms/Chip.md +380 -0
- package/docs/components/atoms/CustomToggle.md +270 -0
- package/docs/components/atoms/Icon.md +365 -0
- package/docs/components/atoms/IconButton.md +407 -0
- package/docs/components/atoms/Image.md +448 -0
- package/docs/components/atoms/Input.md +430 -0
- package/docs/components/atoms/ListItem.md +502 -0
- package/docs/components/atoms/Password.md +472 -0
- package/docs/components/atoms/RadioButton.md +614 -0
- package/docs/components/atoms/RadioButtonItem.md +588 -0
- package/docs/components/atoms/ResponsiveComponent.md +612 -0
- package/docs/components/atoms/SelectListItem.md +609 -0
- package/docs/components/atoms/Slider.md +605 -0
- package/docs/components/atoms/Spinner.md +605 -0
- package/docs/components/atoms/Text.md +463 -0
- package/docs/components/atoms/TextArea.md +670 -0
- package/docs/components/atoms/ToastNotification.md +668 -0
- package/docs/components/atoms/Toggle.md +737 -0
- package/docs/components/atoms/ToggleButton.md +751 -0
- package/docs/components/atoms/Tooltip.md +391 -0
- package/docs/components/molecules/Accordion.md +440 -0
- package/docs/components/molecules/AccordionGroup.md +547 -0
- package/docs/components/molecules/ActionCard.md +546 -0
- package/docs/components/molecules/Breadcrumb.md +403 -0
- package/docs/components/molecules/Breadcrumbs.md +485 -0
- package/docs/components/molecules/ButtonGroup.md +383 -0
- package/docs/components/molecules/Card.md +298 -0
- package/docs/components/molecules/ChipInput.md +646 -0
- package/docs/components/molecules/ContextMenu.md +768 -0
- package/docs/components/molecules/CustomTimeSelector.md +116 -0
- package/docs/components/molecules/DatePicker.md +516 -0
- package/docs/components/molecules/DateTimeSelector.md +166 -0
- package/docs/components/molecules/FormField.md +312 -0
- package/docs/components/molecules/Grid.md +577 -0
- package/docs/components/molecules/GridItem.md +834 -0
- package/docs/components/molecules/GridList.md +244 -0
- package/docs/components/molecules/List.md +485 -0
- package/docs/components/molecules/Modal.md +470 -0
- package/docs/components/molecules/ModalFooter.md +702 -0
- package/docs/components/molecules/ModalHeader.md +756 -0
- package/docs/components/molecules/ModalProvider.md +205 -0
- package/docs/components/molecules/Nav.md +530 -0
- package/docs/components/molecules/NavItem.md +572 -0
- package/docs/components/molecules/NavLink.md +499 -0
- package/docs/components/molecules/Option.md +521 -0
- package/docs/components/molecules/Pagination.md +592 -0
- package/docs/components/molecules/PaginationNumberField.md +722 -0
- package/docs/components/molecules/Popover.md +516 -0
- package/docs/components/molecules/ProgressBar.md +624 -0
- package/docs/components/molecules/RadioGroup.md +831 -0
- package/docs/components/molecules/RepeaterList.md +185 -0
- package/docs/components/molecules/Select.md +402 -0
- package/docs/components/molecules/SortableTrigger.md +82 -0
- package/docs/components/molecules/useModal.md +379 -0
- package/docs/components/organisms/Dropzone.md +346 -0
- package/docs/components/organisms/DropzoneClear.md +135 -0
- package/docs/components/organisms/DropzoneContent.md +216 -0
- package/docs/components/organisms/DropzoneFilename.md +191 -0
- package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
- package/docs/components/organisms/DropzoneTrigger.md +209 -0
- package/docs/components/organisms/Form.md +533 -0
- package/docs/components/organisms/SlideOutPanel.md +662 -0
- package/docs/components/organisms/TabContent.md +902 -0
- package/docs/components/organisms/TabItem.md +1091 -0
- package/docs/components/organisms/Table.md +611 -0
- package/docs/components/organisms/TableBody.md +679 -0
- package/docs/components/organisms/TableCell.md +482 -0
- package/docs/components/organisms/TableHeader.md +513 -0
- package/docs/components/organisms/TableHeaderCell.md +661 -0
- package/docs/components/organisms/TableRow.md +715 -0
- package/docs/components/organisms/Tabs.md +1330 -0
- package/docs/components/utils/ConditionalView.md +568 -0
- package/docs/components/utils/RenderStateView.md +726 -0
- package/docs/components/utils/WrapTextNodes.md +614 -0
- package/package.json +3 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# DropzoneClear
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A specialized button component for clearing files from a dropzone. It integrates with the Dropzone context to provide a one-click solution for removing all uploaded files, with customizable icon display and consistent styling that matches the dropzone interface.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- DropzoneClear
|
|
10
|
+
- ClearFiles
|
|
11
|
+
- ResetDropzone
|
|
12
|
+
- RemoveAllFiles
|
|
13
|
+
|
|
14
|
+
## Props Breakdown
|
|
15
|
+
|
|
16
|
+
**Extends:** `IconButton` component props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Required | Description |
|
|
19
|
+
|------|------|---------|----------|-------------|
|
|
20
|
+
| `icon` | `ReactNode` | `<Icon icon="CloseDelete" style="Outlined"/>` | No | Custom icon to display in the clear button |
|
|
21
|
+
|
|
22
|
+
Plus all `IconButton` props (size, disabled, className, etc.).
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
```tsx
|
|
28
|
+
import { Dropzone, DropzoneClear, DropzoneContent } from '@delightui/components';
|
|
29
|
+
|
|
30
|
+
function BasicDropzoneClearExample() {
|
|
31
|
+
return (
|
|
32
|
+
<Dropzone>
|
|
33
|
+
<DropzoneContent>
|
|
34
|
+
<p>Drop files here or click to upload</p>
|
|
35
|
+
<DropzoneClear />
|
|
36
|
+
</DropzoneContent>
|
|
37
|
+
</Dropzone>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Custom Icon
|
|
43
|
+
```tsx
|
|
44
|
+
import { Icon } from '@delightui/components';
|
|
45
|
+
|
|
46
|
+
function CustomIconExample() {
|
|
47
|
+
return (
|
|
48
|
+
<Dropzone>
|
|
49
|
+
<DropzoneContent>
|
|
50
|
+
<p>Upload your images</p>
|
|
51
|
+
<div className="dropzone-actions">
|
|
52
|
+
<DropzoneClear
|
|
53
|
+
icon={<Icon icon="Trash" style="Outlined" />}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</DropzoneContent>
|
|
57
|
+
</Dropzone>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### With File Count Display
|
|
63
|
+
```tsx
|
|
64
|
+
function FileCountExample() {
|
|
65
|
+
return (
|
|
66
|
+
<Dropzone>
|
|
67
|
+
<DropzoneContent>
|
|
68
|
+
{({ files }) => (
|
|
69
|
+
<>
|
|
70
|
+
<p>Drop files here</p>
|
|
71
|
+
{files.length > 0 && (
|
|
72
|
+
<div className="file-info">
|
|
73
|
+
<span>{files.length} file(s) selected</span>
|
|
74
|
+
<DropzoneClear size="Small" />
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
79
|
+
</DropzoneContent>
|
|
80
|
+
</Dropzone>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Styled Clear Button
|
|
86
|
+
```tsx
|
|
87
|
+
function StyledClearExample() {
|
|
88
|
+
return (
|
|
89
|
+
<Dropzone>
|
|
90
|
+
<DropzoneContent>
|
|
91
|
+
<div className="upload-area">
|
|
92
|
+
<p>Upload documents</p>
|
|
93
|
+
|
|
94
|
+
<div className="upload-controls">
|
|
95
|
+
<DropzoneClear
|
|
96
|
+
className="clear-button"
|
|
97
|
+
size="Medium"
|
|
98
|
+
icon={<Icon icon="RefreshCcw" style="Outlined" />}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</DropzoneContent>
|
|
103
|
+
</Dropzone>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Conditional Clear Button
|
|
109
|
+
```tsx
|
|
110
|
+
function ConditionalClearExample() {
|
|
111
|
+
return (
|
|
112
|
+
<Dropzone>
|
|
113
|
+
<DropzoneContent>
|
|
114
|
+
{({ files, isDragActive }) => (
|
|
115
|
+
<div className="dropzone-content">
|
|
116
|
+
{isDragActive ? (
|
|
117
|
+
<p>Drop files here...</p>
|
|
118
|
+
) : (
|
|
119
|
+
<>
|
|
120
|
+
<p>Click or drag files to upload</p>
|
|
121
|
+
{files.length > 0 && (
|
|
122
|
+
<div className="file-actions">
|
|
123
|
+
<span>{files.length} files ready</span>
|
|
124
|
+
<DropzoneClear />
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</DropzoneContent>
|
|
132
|
+
</Dropzone>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# DropzoneContent
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A specialized content component designed to display different states within a Dropzone component. DropzoneContent provides predefined styling and layout for empty, uploaded, and loading states, offering a consistent visual experience across different dropzone implementations.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- DropzoneContent
|
|
10
|
+
- Dropzone State
|
|
11
|
+
- Upload State
|
|
12
|
+
|
|
13
|
+
## Props Breakdown
|
|
14
|
+
|
|
15
|
+
**Extends:** Standalone interface (no HTML element inheritance)
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Required | Description |
|
|
18
|
+
|------|------|---------|----------|-------------|
|
|
19
|
+
| `type` | `'Empty' \| 'Uploaded' \| 'Loading'` | - | Yes | The state type to display |
|
|
20
|
+
| `className` | `string` | - | No | Additional CSS class names |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Basic Usage
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { DropzoneContent } from '@delightui/components';
|
|
28
|
+
|
|
29
|
+
function BasicDropzoneContentExample() {
|
|
30
|
+
return (
|
|
31
|
+
<div>
|
|
32
|
+
<DropzoneContent type="Empty" />
|
|
33
|
+
<DropzoneContent type="Loading" />
|
|
34
|
+
<DropzoneContent type="Uploaded" />
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Empty State
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { DropzoneContent } from '@delightui/components';
|
|
44
|
+
|
|
45
|
+
function EmptyStateExample() {
|
|
46
|
+
return (
|
|
47
|
+
<DropzoneContent
|
|
48
|
+
type="Empty"
|
|
49
|
+
className="custom-empty-state"
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Loading State
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { DropzoneContent } from '@delightui/components';
|
|
59
|
+
|
|
60
|
+
function LoadingStateExample() {
|
|
61
|
+
return (
|
|
62
|
+
<DropzoneContent
|
|
63
|
+
type="Loading"
|
|
64
|
+
className="custom-loading-state"
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Uploaded State
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { DropzoneContent } from '@delightui/components';
|
|
74
|
+
|
|
75
|
+
function UploadedStateExample() {
|
|
76
|
+
return (
|
|
77
|
+
<DropzoneContent
|
|
78
|
+
type="Uploaded"
|
|
79
|
+
className="custom-uploaded-state"
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Dynamic State
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { DropzoneContent } from '@delightui/components';
|
|
89
|
+
|
|
90
|
+
function DynamicStateExample() {
|
|
91
|
+
const [state, setState] = useState<'Empty' | 'Loading' | 'Uploaded'>('Empty');
|
|
92
|
+
|
|
93
|
+
const handleStateChange = () => {
|
|
94
|
+
setState('Loading');
|
|
95
|
+
setTimeout(() => setState('Uploaded'), 2000);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div>
|
|
100
|
+
<DropzoneContent type={state} />
|
|
101
|
+
<button onClick={handleStateChange}>
|
|
102
|
+
Start Upload Process
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### With Custom Styling
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { DropzoneContent } from '@delightui/components';
|
|
113
|
+
|
|
114
|
+
function CustomStyledExample() {
|
|
115
|
+
return (
|
|
116
|
+
<div style={{ display: 'flex', gap: '20px' }}>
|
|
117
|
+
<DropzoneContent
|
|
118
|
+
type="Empty"
|
|
119
|
+
className="bordered-state"
|
|
120
|
+
style={{ padding: '20px', border: '1px solid #ccc' }}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
<DropzoneContent
|
|
124
|
+
type="Loading"
|
|
125
|
+
className="loading-animation"
|
|
126
|
+
style={{ padding: '20px', backgroundColor: '#f0f8ff' }}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<DropzoneContent
|
|
130
|
+
type="Uploaded"
|
|
131
|
+
className="success-state"
|
|
132
|
+
style={{ padding: '20px', backgroundColor: '#f0fff0' }}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Integration with Dropzone
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { Dropzone, DropzoneContent } from '@delightui/components';
|
|
143
|
+
|
|
144
|
+
function IntegratedExample() {
|
|
145
|
+
const [files, setFiles] = useState<File[]>([]);
|
|
146
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
147
|
+
|
|
148
|
+
const getDropzoneState = (): 'Empty' | 'Loading' | 'Uploaded' => {
|
|
149
|
+
if (isUploading) return 'Loading';
|
|
150
|
+
if (files.length > 0) return 'Uploaded';
|
|
151
|
+
return 'Empty';
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<Dropzone
|
|
156
|
+
value={files}
|
|
157
|
+
onValueChange={setFiles}
|
|
158
|
+
empty={<DropzoneContent type="Empty" />}
|
|
159
|
+
loading={<DropzoneContent type="Loading" />}
|
|
160
|
+
uploaded={<DropzoneContent type="Uploaded" />}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Conditional Rendering
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
import { DropzoneContent } from '@delightui/components';
|
|
170
|
+
|
|
171
|
+
function ConditionalRenderingExample() {
|
|
172
|
+
const [showState, setShowState] = useState<'Empty' | 'Loading' | 'Uploaded' | null>(null);
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div>
|
|
176
|
+
<div style={{ marginBottom: '20px' }}>
|
|
177
|
+
<button onClick={() => setShowState('Empty')}>Show Empty</button>
|
|
178
|
+
<button onClick={() => setShowState('Loading')}>Show Loading</button>
|
|
179
|
+
<button onClick={() => setShowState('Uploaded')}>Show Uploaded</button>
|
|
180
|
+
<button onClick={() => setShowState(null)}>Hide</button>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
{showState && (
|
|
184
|
+
<DropzoneContent type={showState} />
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Accessibility Example
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { DropzoneContent } from '@delightui/components';
|
|
195
|
+
|
|
196
|
+
function AccessibilityExample() {
|
|
197
|
+
const [currentState, setCurrentState] = useState<'Empty' | 'Loading' | 'Uploaded'>('Empty');
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<div role="region" aria-label="File upload area">
|
|
201
|
+
<DropzoneContent
|
|
202
|
+
type={currentState}
|
|
203
|
+
className="accessible-dropzone-content"
|
|
204
|
+
aria-live="polite"
|
|
205
|
+
aria-describedby="upload-instructions"
|
|
206
|
+
/>
|
|
207
|
+
|
|
208
|
+
<div id="upload-instructions" style={{ marginTop: '10px' }}>
|
|
209
|
+
{currentState === 'Empty' && 'Drag and drop files here or click to browse'}
|
|
210
|
+
{currentState === 'Loading' && 'Please wait while your files are being uploaded'}
|
|
211
|
+
{currentState === 'Uploaded' && 'Files have been successfully uploaded'}
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
```
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# DropzoneFilename
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A text component that displays the filename of uploaded files in a dropzone. It automatically retrieves file information from the Dropzone context and renders the filename with consistent text styling, supporting multiple files through index selection.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- DropzoneFilename
|
|
10
|
+
- FileName
|
|
11
|
+
- FileNameDisplay
|
|
12
|
+
- UploadedFileName
|
|
13
|
+
|
|
14
|
+
## Props Breakdown
|
|
15
|
+
|
|
16
|
+
**Extends:** `Text` component props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Required | Description |
|
|
19
|
+
|------|------|---------|----------|-------------|
|
|
20
|
+
| `fileIndex` | `number` | `0` | No | Index of the file to display the name for |
|
|
21
|
+
|
|
22
|
+
Plus all `Text` component props (type, size, weight, color, etc.).
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
```tsx
|
|
28
|
+
import { Dropzone, DropzoneFilename, DropzoneContent } from '@delightui/components';
|
|
29
|
+
|
|
30
|
+
function BasicFilenameExample() {
|
|
31
|
+
return (
|
|
32
|
+
<Dropzone>
|
|
33
|
+
<DropzoneContent>
|
|
34
|
+
{({ files }) => (
|
|
35
|
+
<>
|
|
36
|
+
<p>Drop files here</p>
|
|
37
|
+
{files.length > 0 && (
|
|
38
|
+
<div className="file-display">
|
|
39
|
+
<DropzoneFilename />
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
</>
|
|
43
|
+
)}
|
|
44
|
+
</DropzoneContent>
|
|
45
|
+
</Dropzone>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Multiple Files Display
|
|
51
|
+
```tsx
|
|
52
|
+
function MultipleFilesExample() {
|
|
53
|
+
return (
|
|
54
|
+
<Dropzone multiple>
|
|
55
|
+
<DropzoneContent>
|
|
56
|
+
{({ files }) => (
|
|
57
|
+
<>
|
|
58
|
+
<p>Drop multiple files here</p>
|
|
59
|
+
{files.length > 0 && (
|
|
60
|
+
<div className="file-list">
|
|
61
|
+
<h4>Uploaded Files:</h4>
|
|
62
|
+
{files.map((_, index) => (
|
|
63
|
+
<div key={index} className="file-item">
|
|
64
|
+
<DropzoneFilename
|
|
65
|
+
fileIndex={index}
|
|
66
|
+
type="Body"
|
|
67
|
+
size="Small"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</>
|
|
74
|
+
)}
|
|
75
|
+
</DropzoneContent>
|
|
76
|
+
</Dropzone>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Styled Filename Display
|
|
82
|
+
```tsx
|
|
83
|
+
function StyledFilenameExample() {
|
|
84
|
+
return (
|
|
85
|
+
<Dropzone>
|
|
86
|
+
<DropzoneContent>
|
|
87
|
+
{({ files }) => (
|
|
88
|
+
<div className="upload-area">
|
|
89
|
+
<p>Upload your document</p>
|
|
90
|
+
|
|
91
|
+
{files.length > 0 && (
|
|
92
|
+
<div className="selected-file">
|
|
93
|
+
<Icon icon="Document" size="Small" />
|
|
94
|
+
<DropzoneFilename
|
|
95
|
+
type="Body"
|
|
96
|
+
weight="Medium"
|
|
97
|
+
color="Primary"
|
|
98
|
+
className="filename-text"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
</DropzoneContent>
|
|
105
|
+
</Dropzone>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### File List with Actions
|
|
111
|
+
```tsx
|
|
112
|
+
import { DropzoneClear, Icon, Button } from '@delightui/components';
|
|
113
|
+
|
|
114
|
+
function FileListWithActionsExample() {
|
|
115
|
+
return (
|
|
116
|
+
<Dropzone multiple>
|
|
117
|
+
<DropzoneContent>
|
|
118
|
+
{({ files }) => (
|
|
119
|
+
<>
|
|
120
|
+
<div className="upload-prompt">
|
|
121
|
+
<p>Upload files</p>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{files.length > 0 && (
|
|
125
|
+
<div className="file-management">
|
|
126
|
+
<div className="file-list">
|
|
127
|
+
{files.map((_, index) => (
|
|
128
|
+
<div key={index} className="file-entry">
|
|
129
|
+
<Icon icon="Document" size="Small" />
|
|
130
|
+
<DropzoneFilename
|
|
131
|
+
fileIndex={index}
|
|
132
|
+
type="Body"
|
|
133
|
+
size="Small"
|
|
134
|
+
className="file-name"
|
|
135
|
+
/>
|
|
136
|
+
<Button size="Small" type="Ghost">Remove</Button>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div className="file-actions">
|
|
142
|
+
<DropzoneClear size="Small" />
|
|
143
|
+
<Button size="Small">Upload All</Button>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
</>
|
|
148
|
+
)}
|
|
149
|
+
</DropzoneContent>
|
|
150
|
+
</Dropzone>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Truncated Long Filenames
|
|
156
|
+
```tsx
|
|
157
|
+
function TruncatedFilenameExample() {
|
|
158
|
+
return (
|
|
159
|
+
<Dropzone>
|
|
160
|
+
<DropzoneContent>
|
|
161
|
+
{({ files }) => (
|
|
162
|
+
<>
|
|
163
|
+
<p>Upload file</p>
|
|
164
|
+
|
|
165
|
+
{files.length > 0 && (
|
|
166
|
+
<div className="file-preview">
|
|
167
|
+
<div className="file-info">
|
|
168
|
+
<DropzoneFilename
|
|
169
|
+
type="Body"
|
|
170
|
+
size="Small"
|
|
171
|
+
className="truncated-filename"
|
|
172
|
+
style={{
|
|
173
|
+
maxWidth: '200px',
|
|
174
|
+
overflow: 'hidden',
|
|
175
|
+
textOverflow: 'ellipsis',
|
|
176
|
+
whiteSpace: 'nowrap'
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
<Text type="Caption" color="Secondary">
|
|
180
|
+
{Math.round(files[0]?.size / 1024)} KB
|
|
181
|
+
</Text>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
)}
|
|
187
|
+
</DropzoneContent>
|
|
188
|
+
</Dropzone>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
```
|