@capillarytech/blaze-ui 5.21.0 → 5.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapLanguageProvider/actions.js +125 -0
- package/CapLanguageProvider/actions.js.map +1 -0
- package/CapLanguageProvider/constants.js +37 -0
- package/CapLanguageProvider/constants.js.map +1 -0
- package/package.json +1 -1
- package/CapActionBar/README.md +0 -11
- package/CapAdvancedIcon/README.md +0 -185
- package/CapAdvancedIcon/use-cases.md +0 -44
- package/CapAlert/README.md +0 -144
- package/CapAppNotEnabled/README.md +0 -84
- package/CapAskAira/README.md +0 -328
- package/CapBanner/README.md +0 -4
- package/CapBlock/README.md +0 -175
- package/CapBorderedBox/Status.md +0 -40
- package/CapCSVFileUploader/README.md +0 -124
- package/CapCSVFileUploader/Status.md +0 -47
- package/CapCard/README.md +0 -85
- package/CapCard/Status.md +0 -41
- package/CapCardBox/README.md +0 -169
- package/CapCardBox/Status.md +0 -52
- package/CapCarousel/README.md +0 -190
- package/CapCarousel/Status.md +0 -73
- package/CapCheckbox/README.md +0 -254
- package/CapCheckbox/Status.md +0 -41
- package/CapColorPicker/README.md +0 -112
- package/CapColorPicker/Status.md +0 -52
- package/CapColorPicker/tests/USE_CASES_ANALYSIS.md +0 -92
- package/CapColoredTag/README.md +0 -167
- package/CapColoredTag/Status.md +0 -49
- package/CapConditionPreview/MIGRATION_ANALYSIS.md +0 -70
- package/CapConditionPreview/README.md +0 -40
- package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +0 -65
- package/CapCustomCard/README.md +0 -182
- package/CapCustomCard/Status.md +0 -40
- package/CapCustomCarousel/Status.md +0 -69
- package/CapCustomCheckboxList/README.md +0 -178
- package/CapCustomCheckboxList/Status.md +0 -52
- package/CapCustomCheckboxList/tests/USE_CASES_ANALYSIS.md +0 -174
- package/CapCustomList/README.md +0 -117
- package/CapCustomList/Status.md +0 -77
- package/CapCustomList/tests/USE_CASES_ANALYSIS.md +0 -124
- package/CapCustomSelect/README.md +0 -38
- package/CapDatePicker/README.md +0 -139
- package/CapDateRangePicker/README.md +0 -159
- package/CapDateTimePicker/README.md +0 -136
- package/CapDateTimeRangePicker/README.md +0 -243
- package/CapDivider/README.md +0 -122
- package/CapDrawer/README.md +0 -207
- package/CapDrawer/Status.md +0 -52
- package/CapDrawer/tests/MISSING_USE_CASES.md +0 -170
- package/CapDropdown/README.md +0 -515
- package/CapDropdown/Status.md +0 -45
- package/CapDropdown/tests/USE_CASES_ANALYSIS.md +0 -137
- package/CapError/README.md +0 -88
- package/CapErrorBoundary/CapErrorBoundary-use-cases.md +0 -89
- package/CapErrorBoundary/README.md +0 -150
- package/CapErrorStateIllustration/README.md +0 -222
- package/CapErrorStateIllustration/USE_CASES.md +0 -33
- package/CapExpressionEditor/README.md +0 -32
- package/CapForm/README.md +0 -132
- package/CapForm/Status.md +0 -40
- package/CapForm/tests/PHASE1_UNFULFILLED_USE_CASES.md +0 -113
- package/CapForm/tests/USE_CASES_ANALYSIS.md +0 -119
- package/CapFormItem/README.md +0 -320
- package/CapFormItem/Status.md +0 -73
- package/CapFormItem/tests/USE_CASES_ANALYSIS.md +0 -84
- package/CapGraph/README.md +0 -69
- package/CapGraph/USE_CASES.md +0 -66
- package/CapHamburgerMenu/README.md +0 -234
- package/CapHamburgerMenu/USE_CASES.md +0 -48
- package/CapHeader/Status.md +0 -41
- package/CapHeading/README.md +0 -220
- package/CapHeading/Status.md +0 -41
- package/CapIcon/README.md +0 -207
- package/CapIllustration/Status.md +0 -41
- package/CapImage/README.md +0 -50
- package/CapImportMFEComponent/README.md +0 -121
- package/CapInfoNote/Status.md +0 -40
- package/CapInfoNote/tests/USE_CASES_ANALYSIS.md +0 -114
- package/CapInput/README.md +0 -196
- package/CapInput/Status.md +0 -123
- package/CapInput/tests/USE_CASES_ANALYSIS.md +0 -169
- package/CapLanguageProvider/CapLanguageProvider-use-cases.md +0 -56
- package/CapLanguageProvider/README.md +0 -206
- package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +0 -50
- package/CapLevelGraphRenderer/README.md +0 -123
- package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +0 -120
- package/CapLink/README.md +0 -203
- package/CapLink/Status.md +0 -32
- package/CapLink/tests/CapLink.missingUseCases.md +0 -95
- package/CapList/README.md +0 -129
- package/CapList/Status.md +0 -69
- package/CapListLayout/README.md +0 -7
- package/CapLogin/README.md +0 -7
- package/CapMenu/README.md +0 -86
- package/CapModal/README.md +0 -357
- package/CapModal/Status.md +0 -52
- package/CapModal/tests/USE_CASES_GAPS.md +0 -207
- package/CapMultiSelect/README.md +0 -170
- package/CapMultiSelect/tests/USE_CASES_ANALYSIS.md +0 -29
- package/CapMultiSelectDatePicker/README.md +0 -11
- package/CapNavigation/README.md +0 -72
- package/CapNotification/README.md +0 -228
- package/CapNotificationDropdown/README.md +0 -5
- package/CapPopover/README.md +0 -234
- package/CapProgress/Status.md +0 -40
- package/CapRadio/Status.md +0 -54
- package/CapRadioButton/README.md +0 -152
- package/CapRadioButton/Status.md +0 -70
- package/CapRadioButton/tests/USE_CASES_ANALYSIS.md +0 -120
- package/CapRadioCard/README.md +0 -161
- package/CapRadioCard/Status.md +0 -78
- package/CapRadioGroup/README.md +0 -141
- package/CapRadioGroup/Status.md +0 -59
- package/CapReorderComponent/README.md +0 -179
- package/CapReorderComponent/Status.md +0 -41
- package/CapRoadMap/README.md +0 -126
- package/CapRoadMap/Status.md +0 -53
- package/CapRoadMap/tests/USE_CASE_GAPS.md +0 -92
- package/CapRow/README.md +0 -424
- package/CapSKUUploader/README.md +0 -189
- package/CapSKUUploader/Status.md +0 -66
- package/CapSecondaryTopBar/README.md +0 -7
- package/CapSelect/README.md +0 -243
- package/CapSelectFilter/README.md +0 -121
- package/CapShape/README.md +0 -96
- package/CapShape/Status.md +0 -36
- package/CapShape/tests/USE_CASES_ANALYSIS.md +0 -120
- package/CapSideBar/README.md +0 -298
- package/CapSideBar/Status.md +0 -5
- package/CapSlideBox/README.md +0 -68
- package/CapSlider/README.md +0 -423
- package/CapSlider/Status.md +0 -48
- package/CapSlider/tests/TEST_COVERAGE.md +0 -118
- package/CapSnackBar/README.md +0 -222
- package/CapSnackBar/Status.md +0 -41
- package/CapSomethingWentWrong/README.md +0 -97
- package/CapSplit/README.md +0 -19
- package/CapStatisticCard/README.md +0 -138
- package/CapStatus/README.md +0 -148
- package/CapStatus/Status.md +0 -40
- package/CapSteps/Status.md +0 -40
- package/CapStepsAccordian/README.md +0 -305
- package/CapStepsAccordian/Status.md +0 -48
- package/CapSupportVideosWrapper/README.md +0 -14
- package/CapSwitch/README.md +0 -351
- package/CapTab/README.md +0 -406
- package/CapTab/Status.md +0 -104
- package/CapTab/tests/USE_CASE_GAPS.md +0 -143
- package/CapTabV3/ANALYSIS.md +0 -60
- package/CapTabV3/README.md +0 -156
- package/CapTabV3/Status.md +0 -52
- package/CapTabV3/tests/USE_CASE_GAPS.md +0 -149
- package/CapTable/README.md +0 -160
- package/CapTable/Status.md +0 -41
- package/CapTag/README.md +0 -16
- package/CapTagDropdown/README.md +0 -171
- package/CapTagDropdown/Status.md +0 -55
- package/CapTimePicker/README.md +0 -170
- package/CapTooltip/README.md +0 -336
- package/CapTooltipWithInfo/Status.md +0 -75
- package/CapTopBar/README.md +0 -146
- package/CapTree/README.md +0 -124
- package/CapTree/Status.md +0 -48
- package/CapTree/tests/STATUS.md +0 -154
- package/CapTreeSelect/README.md +0 -217
- package/CapTreeSelect/Status.md +0 -52
- package/CapTruncateList/README.md +0 -13
- package/CapUnifiedSelect/README.md +0 -40
- package/CapUploader/README.md +0 -313
- package/CapUploader/Status.md +0 -76
- package/CapUploader/tests/USE_CASES_ANALYSIS.md +0 -225
- package/CapUserProfile/README.md +0 -105
- package/CapUserProfile/Status.md +0 -95
- package/CapVirtualList/README.md +0 -162
- package/CapVirtualList/Status.md +0 -71
- package/assets/HOCs/ComponentWithLabelHOC/README.md +0 -230
package/CapUploader/README.md
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
# CapUploader
|
|
2
|
-
|
|
3
|
-
A wrapper component around Ant Design's Upload component that provides consistent styling and a simplified API for file uploads in Capillary applications.
|
|
4
|
-
|
|
5
|
-
## Migration from cap-ui-library
|
|
6
|
-
|
|
7
|
-
This component has been migrated from `@capillarytech/cap-ui-library` to `@capillarytech/blaze-ui` with the following changes:
|
|
8
|
-
|
|
9
|
-
- Converted from JavaScript to TypeScript
|
|
10
|
-
- Converted from styled-components to SCSS modules
|
|
11
|
-
- Migrated to Ant Design v6 APIs
|
|
12
|
-
- Added TypeScript interfaces for props
|
|
13
|
-
- Maintained backward compatibility with the existing API
|
|
14
|
-
|
|
15
|
-
## Breaking Changes
|
|
16
|
-
|
|
17
|
-
**No breaking changes from cap-ui-library v8.x**
|
|
18
|
-
|
|
19
|
-
The component maintains backward compatibility with all existing props. All Ant Design Upload props are passed through directly to the underlying Upload component.
|
|
20
|
-
|
|
21
|
-
## Deprecated Props
|
|
22
|
-
|
|
23
|
-
### Ant Design Upload Component Props
|
|
24
|
-
|
|
25
|
-
**No deprecated props** - The Ant Design Upload component does not have deprecated props in v6 that require backward compatibility mapping.
|
|
26
|
-
|
|
27
|
-
The Upload component in Ant Design v6 does not have any deprecated props that were renamed or removed. Unlike popup components (Dropdown, Tooltip, etc.), the Upload component did not undergo prop name changes in the v5 to v6 migration.
|
|
28
|
-
|
|
29
|
-
**Verified Ant Design Components Used:**
|
|
30
|
-
- **Upload** - No deprecated props in Ant Design v6
|
|
31
|
-
|
|
32
|
-
**Common Ant Design deprecated props that do NOT apply to Upload:**
|
|
33
|
-
- `visible` → `open` (not applicable - Upload is not a popup component)
|
|
34
|
-
- `onVisibleChange` → `onOpenChange` (not applicable - Upload is not a popup component)
|
|
35
|
-
- `overlayClassName` → `classNames.root` (not applicable - Upload doesn't have overlay)
|
|
36
|
-
- `overlayStyle` → `styles.root` (not applicable - Upload doesn't have overlay)
|
|
37
|
-
|
|
38
|
-
## Prop Changes
|
|
39
|
-
|
|
40
|
-
### Cap Component Props
|
|
41
|
-
|
|
42
|
-
| Prop | Type | Default | Description |
|
|
43
|
-
|------|------|---------|-------------|
|
|
44
|
-
| `className` | `string` | `undefined` | Additional CSS class name for the uploader wrapper |
|
|
45
|
-
| All other Ant Design Upload props | `UploadProps` | - | Passed through to underlying Upload component |
|
|
46
|
-
|
|
47
|
-
### Ant Design Upload Props (All Supported)
|
|
48
|
-
|
|
49
|
-
All Ant Design Upload props are supported and passed through directly. Common props include:
|
|
50
|
-
|
|
51
|
-
| Prop | Type | Description |
|
|
52
|
-
|------|------|-------------|
|
|
53
|
-
| `action` | `string` | Upload URL endpoint |
|
|
54
|
-
| `accept` | `string` | Accepted file types (e.g., ".jpg,.png") |
|
|
55
|
-
| `beforeUpload` | `(file: File, fileList: File[]) => boolean \| Promise<boolean>` | Validation function called before upload |
|
|
56
|
-
| `fileList` | `UploadFile[]` | Controlled file list |
|
|
57
|
-
| `onChange` | `(info: UploadChangeParam) => void` | Callback when file list changes |
|
|
58
|
-
| `onRemove` | `(file: UploadFile) => boolean \| void \| Promise<boolean \| void>` | Callback when file is removed |
|
|
59
|
-
| `disabled` | `boolean` | Whether upload is disabled |
|
|
60
|
-
| `multiple` | `boolean` | Allow multiple files |
|
|
61
|
-
| `maxCount` | `number` | Maximum number of files |
|
|
62
|
-
| `listType` | `'text' \| 'picture' \| 'picture-card'` | Upload list style |
|
|
63
|
-
| `showUploadList` | `boolean \| UploadListProps` | Show upload list |
|
|
64
|
-
| `name` | `string` | File field name (default: 'file') |
|
|
65
|
-
| `headers` | `Record<string, string>` | Custom headers |
|
|
66
|
-
| `data` | `Record<string, any>` | Additional form data |
|
|
67
|
-
| `method` | `'post' \| 'put'` | HTTP method (default: 'post') |
|
|
68
|
-
| `withCredentials` | `boolean` | Send cookies with request |
|
|
69
|
-
| `openFileDialogOnClick` | `boolean` | Open file dialog on click (default: true) |
|
|
70
|
-
|
|
71
|
-
For a complete list of all supported props, refer to the [Ant Design Upload documentation](https://ant.design/components/upload).
|
|
72
|
-
|
|
73
|
-
## API Changes
|
|
74
|
-
|
|
75
|
-
- **TypeScript Support:** Full TypeScript support with exported `CapUploaderProps` interface
|
|
76
|
-
- **Ant Design Version:** Upgraded from Ant Design v3 to v6
|
|
77
|
-
- **Styling:** Migrated from styled-components to SCSS modules
|
|
78
|
-
|
|
79
|
-
## Behavioral Changes
|
|
80
|
-
|
|
81
|
-
None. The component behaves identically to the original cap-ui-library implementation.
|
|
82
|
-
|
|
83
|
-
## Static Properties
|
|
84
|
-
|
|
85
|
-
The component exposes `CapUploader.CapDragger` for drag-and-drop uploads:
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
89
|
-
|
|
90
|
-
<CapUploader.CapDragger
|
|
91
|
-
action="/upload"
|
|
92
|
-
onChange={handleChange}
|
|
93
|
-
>
|
|
94
|
-
<p className="ant-upload-drag-icon">📁</p>
|
|
95
|
-
<p className="ant-upload-text">Click or drag file to this area to upload</p>
|
|
96
|
-
</CapUploader.CapDragger>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Usage Examples
|
|
100
|
-
|
|
101
|
-
### Basic Usage
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
105
|
-
|
|
106
|
-
function FileUpload() {
|
|
107
|
-
const handleChange = (info) => {
|
|
108
|
-
console.log('File list:', info.fileList);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<CapUploader
|
|
113
|
-
action="/api/upload"
|
|
114
|
-
onChange={handleChange}
|
|
115
|
-
/>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Controlled File List
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
124
|
-
import { useState } from 'react';
|
|
125
|
-
import type { UploadFile } from 'antd';
|
|
126
|
-
|
|
127
|
-
function ControlledUpload() {
|
|
128
|
-
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
|
129
|
-
|
|
130
|
-
const handleChange = (info) => {
|
|
131
|
-
setFileList(info.fileList);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<CapUploader
|
|
136
|
-
action="/api/upload"
|
|
137
|
-
fileList={fileList}
|
|
138
|
-
onChange={handleChange}
|
|
139
|
-
/>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### File Type Validation
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
148
|
-
import { message } from 'antd';
|
|
149
|
-
|
|
150
|
-
function ValidatedUpload() {
|
|
151
|
-
const handleBeforeUpload = (file) => {
|
|
152
|
-
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
153
|
-
if (!isJPG) {
|
|
154
|
-
message.error('You can only upload JPG/PNG files!');
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
158
|
-
if (!isLt2M) {
|
|
159
|
-
message.error('Image must be smaller than 2MB!');
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
return true;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<CapUploader
|
|
167
|
-
action="/api/upload"
|
|
168
|
-
accept=".jpg,.jpeg,.png"
|
|
169
|
-
beforeUpload={handleBeforeUpload}
|
|
170
|
-
/>
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Multiple Files with Limit
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
179
|
-
|
|
180
|
-
function MultipleUpload() {
|
|
181
|
-
return (
|
|
182
|
-
<CapUploader
|
|
183
|
-
action="/api/upload"
|
|
184
|
-
multiple
|
|
185
|
-
maxCount={5}
|
|
186
|
-
/>
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Picture Upload
|
|
192
|
-
|
|
193
|
-
```tsx
|
|
194
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
195
|
-
|
|
196
|
-
function PictureUpload() {
|
|
197
|
-
return (
|
|
198
|
-
<CapUploader
|
|
199
|
-
action="/api/upload"
|
|
200
|
-
listType="picture"
|
|
201
|
-
accept="image/*"
|
|
202
|
-
/>
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Drag and Drop Upload
|
|
208
|
-
|
|
209
|
-
```tsx
|
|
210
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
211
|
-
|
|
212
|
-
function DragDropUpload() {
|
|
213
|
-
return (
|
|
214
|
-
<CapUploader.CapDragger
|
|
215
|
-
action="/api/upload"
|
|
216
|
-
multiple
|
|
217
|
-
>
|
|
218
|
-
<p className="ant-upload-drag-icon">📁</p>
|
|
219
|
-
<p className="ant-upload-text">Click or drag file to this area to upload</p>
|
|
220
|
-
<p className="ant-upload-hint">Support for single or bulk upload</p>
|
|
221
|
-
</CapUploader.CapDragger>
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Migration Steps for Consumers
|
|
227
|
-
|
|
228
|
-
### 1. Update Import
|
|
229
|
-
|
|
230
|
-
```tsx
|
|
231
|
-
// Before (cap-ui-library)
|
|
232
|
-
import CapUploader from '@capillarytech/cap-ui-library/CapUploader';
|
|
233
|
-
|
|
234
|
-
// After (blaze-ui)
|
|
235
|
-
import { CapUploader } from '@capillarytech/blaze-ui';
|
|
236
|
-
// or
|
|
237
|
-
import CapUploader from '@capillarytech/blaze-ui/CapUploader';
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### 2. Usage (No Changes Required)
|
|
241
|
-
|
|
242
|
-
All existing code will continue to work without modifications:
|
|
243
|
-
|
|
244
|
-
```tsx
|
|
245
|
-
// Works exactly the same
|
|
246
|
-
<CapUploader
|
|
247
|
-
action="/api/upload"
|
|
248
|
-
onChange={handleChange}
|
|
249
|
-
multiple
|
|
250
|
-
maxCount={5}
|
|
251
|
-
/>
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### 3. TypeScript (New Benefit)
|
|
255
|
-
|
|
256
|
-
If using TypeScript, you now get full type checking:
|
|
257
|
-
|
|
258
|
-
```tsx
|
|
259
|
-
import { CapUploader, CapUploaderProps } from '@capillarytech/blaze-ui';
|
|
260
|
-
import type { UploadFile } from 'antd';
|
|
261
|
-
|
|
262
|
-
const props: CapUploaderProps = {
|
|
263
|
-
action: '/api/upload',
|
|
264
|
-
accept: '.jpg,.png',
|
|
265
|
-
multiple: true,
|
|
266
|
-
maxCount: 5,
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
<CapUploader {...props} />
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## TypeScript
|
|
273
|
-
|
|
274
|
-
```tsx
|
|
275
|
-
import { CapUploader, CapUploaderProps } from '@capillarytech/blaze-ui';
|
|
276
|
-
import type { UploadFile, UploadChangeParam } from 'antd';
|
|
277
|
-
|
|
278
|
-
const props: CapUploaderProps = {
|
|
279
|
-
className: 'custom-uploader',
|
|
280
|
-
action: '/api/upload',
|
|
281
|
-
accept: '.jpg,.jpeg,.png',
|
|
282
|
-
multiple: true,
|
|
283
|
-
maxCount: 5,
|
|
284
|
-
onChange: (info: UploadChangeParam) => {
|
|
285
|
-
console.log('Upload info:', info);
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
<CapUploader {...props} />
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## Styling
|
|
293
|
-
|
|
294
|
-
The component uses SCSS modules with the following class structure:
|
|
295
|
-
|
|
296
|
-
- `.cap-uploader-v2` - Main wrapper class
|
|
297
|
-
- All Ant Design Upload classes are preserved and work as expected
|
|
298
|
-
|
|
299
|
-
All styles use SCSS variables from `components/styled/variables` for consistency.
|
|
300
|
-
|
|
301
|
-
## Notes
|
|
302
|
-
|
|
303
|
-
- The component wraps Ant Design's Upload component and passes all props through directly
|
|
304
|
-
- All Ant Design Upload props are supported through prop spreading
|
|
305
|
-
- The component maintains backward compatibility with existing designs and class names
|
|
306
|
-
- `CapUploader.CapDragger` is available for drag-and-drop upload functionality
|
|
307
|
-
- No deprecated props require migration - the Upload component did not have prop changes in Ant Design v6
|
|
308
|
-
|
|
309
|
-
## References
|
|
310
|
-
|
|
311
|
-
- [Ant Design Upload Component](https://ant.design/components/upload)
|
|
312
|
-
- [Ant Design v6 Migration Guide](https://ant.design/docs/react/migration-v6)
|
|
313
|
-
- [CapUploader Storybook Stories](../../stories/CapUploader.stories.tsx)
|
package/CapUploader/Status.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Migration Status: CapUploader
|
|
2
|
-
|
|
3
|
-
**Last Updated**: 2026-02-06 19:21:53
|
|
4
|
-
|
|
5
|
-
## Migration Steps
|
|
6
|
-
|
|
7
|
-
- [x] **Step 0**: Setup branch and remote tracking
|
|
8
|
-
- [x] **Step 1**: Migration Prompt 1 (Main migration)
|
|
9
|
-
- [x] **Step 1.5**: Export component in blaze-ui/components/index.ts
|
|
10
|
-
- [x] **Step 2**: Migration Prompt 2 (Storybook support)
|
|
11
|
-
- [x] **Step 2.5**: Verify deprecated props and prop changes (REQUIRED - enforced)
|
|
12
|
-
- [x] **Step 3**: Migration Prompt 3 (Unit tests)
|
|
13
|
-
- [x] **Step 4**: Migration Prompt 4 (Visual test cases)
|
|
14
|
-
- [x] **Step 5**: Linting (ESLint)
|
|
15
|
-
- [x] **Step 6**: Pre-build Validation
|
|
16
|
-
- [x] **Step 7**: Build blaze-ui
|
|
17
|
-
- [x] **Step 8**: Visual Testing
|
|
18
|
-
- [x] **Step 9**: CSS Analysis (if mismatches found)
|
|
19
|
-
- [x] **Step 9.5**: CSS Analysis Completed
|
|
20
|
-
- [x] **Step 10**: Git Commit & Push to branch (pre-commit hook will run tests)
|
|
21
|
-
- [x] **Step 11**: Create Pull Request
|
|
22
|
-
|
|
23
|
-
## Deprecated Props Verification
|
|
24
|
-
|
|
25
|
-
✅ **Verification Complete** - 2026-01-31
|
|
26
|
-
|
|
27
|
-
### Ant Design Components Used
|
|
28
|
-
- **Upload** - No deprecated props in Ant Design v6
|
|
29
|
-
|
|
30
|
-
### Verification Results
|
|
31
|
-
|
|
32
|
-
**No deprecated props found** - The Ant Design Upload component does not have deprecated props in v6 that require backward compatibility mapping.
|
|
33
|
-
|
|
34
|
-
**Analysis:**
|
|
35
|
-
- CapUploader wraps Ant Design's Upload component
|
|
36
|
-
- Upload component is not a popup component (unlike Dropdown, Tooltip, etc.)
|
|
37
|
-
- Upload component did not undergo prop name changes in Ant Design v5 → v6 migration
|
|
38
|
-
- Common deprecated props (`visible` → `open`, `overlayClassName` → `classNames.root`, etc.) do not apply to Upload
|
|
39
|
-
|
|
40
|
-
**Documentation:**
|
|
41
|
-
- ✅ README.md created with complete "Deprecated Props" section
|
|
42
|
-
- ✅ Documented that Upload has no deprecated props
|
|
43
|
-
- ✅ Verified against ANTD_V6_MIGRATION.md - Upload not listed in deprecated API fixes
|
|
44
|
-
- ✅ No backward compatibility code needed
|
|
45
|
-
- ✅ No @deprecated JSDoc comments needed (no deprecated props exist)
|
|
46
|
-
|
|
47
|
-
**Reference:**
|
|
48
|
-
- README.md: `/components/CapUploader/README.md`
|
|
49
|
-
- Migration Guide: `/docs/ANTD_V6_MIGRATION.md`
|
|
50
|
-
|
|
51
|
-
**Note**: Step 2.5 is REQUIRED and enforced.
|
|
52
|
-
- Focus: **Ant Design component prop changes** (e.g., Dropdown, Input, Alert, Tooltip, etc.)
|
|
53
|
-
- Reference: MIGRATION_CHANGELOG_TEMPLATE.md for format, ANTD_V6_MIGRATION.md for Ant Design deprecated APIs
|
|
54
|
-
- Skip: If original component doesn't exist in cap-ui-library
|
|
55
|
-
- All deprecated Ant Design props and prop changes must be documented before proceeding.
|
|
56
|
-
|
|
57
|
-
## Visual Testing Results
|
|
58
|
-
|
|
59
|
-
**Last Test**: 2026-02-06 19:21:53
|
|
60
|
-
**Maximum Mismatch**: 15.62%
|
|
61
|
-
|
|
62
|
-
### Mismatched Variants:
|
|
63
|
-
- picture-card:15.62%
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## CSS Fixes Applied
|
|
67
|
-
|
|
68
|
-
**Date**: 2026-01-31 16:50:31
|
|
69
|
-
**Summary**: CSS fixes applied based on visual testing analysis.
|
|
70
|
-
|
|
71
|
-
_See full analysis in: `/Users/sarahkhader/repos/migration/blaze-ui/tools/visual-testing/report/CapUploader/css-fix-analysis.md`_
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
## Notes
|
|
75
|
-
|
|
76
|
-
_No notes yet._
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
# CapUploader Use Cases Analysis
|
|
2
|
-
|
|
3
|
-
**Date**: 2026-01-31
|
|
4
|
-
**Status**: Comprehensive test suite created
|
|
5
|
-
|
|
6
|
-
## Phase 0: Use Cases Extraction
|
|
7
|
-
|
|
8
|
-
**Note**: Google Sheets access was not available during test creation. Tests were created based on:
|
|
9
|
-
- Component API (`types.ts`)
|
|
10
|
-
- Storybook stories (`CapUploader.stories.tsx`)
|
|
11
|
-
- Ant Design Upload documentation patterns
|
|
12
|
-
- Common upload component use cases from codebase
|
|
13
|
-
|
|
14
|
-
## Phase 1: Use Cases NOT Fulfilled by Component
|
|
15
|
-
|
|
16
|
-
### Component Architecture
|
|
17
|
-
|
|
18
|
-
CapUploader is a **thin wrapper** around Ant Design's Upload component. It provides:
|
|
19
|
-
1. Consistent className (`cap-uploader-v2`)
|
|
20
|
-
2. Static property `CapDragger` for drag-and-drop functionality
|
|
21
|
-
3. Pass-through of all Ant Design Upload props
|
|
22
|
-
|
|
23
|
-
### Use Cases Analysis
|
|
24
|
-
|
|
25
|
-
#### ✅ Fulfilled (via Ant Design Upload)
|
|
26
|
-
|
|
27
|
-
The following use cases are **fulfilled** through Ant Design Upload props:
|
|
28
|
-
|
|
29
|
-
1. **Basic File Upload**
|
|
30
|
-
- ✅ Single file upload
|
|
31
|
-
- ✅ Multiple file upload (`multiple` prop)
|
|
32
|
-
- ✅ File type restrictions (`accept` prop)
|
|
33
|
-
- ✅ File size validation (`beforeUpload` callback)
|
|
34
|
-
- ✅ Maximum file count (`maxCount` prop)
|
|
35
|
-
|
|
36
|
-
2. **Upload Configuration**
|
|
37
|
-
- ✅ Custom upload endpoint (`action` prop)
|
|
38
|
-
- ✅ HTTP method selection (`method` prop: 'post' | 'put')
|
|
39
|
-
- ✅ Custom headers (`headers` prop)
|
|
40
|
-
- ✅ Additional form data (`data` prop)
|
|
41
|
-
- ✅ CORS credentials (`withCredentials` prop)
|
|
42
|
-
|
|
43
|
-
3. **File List Management**
|
|
44
|
-
- ✅ Controlled file list (`fileList` prop)
|
|
45
|
-
- ✅ File list change callbacks (`onChange` callback)
|
|
46
|
-
- ✅ File removal (`onRemove` callback)
|
|
47
|
-
- ✅ File preview (`onPreview` callback)
|
|
48
|
-
- ✅ File download (`onDownload` callback)
|
|
49
|
-
|
|
50
|
-
4. **UI Customization**
|
|
51
|
-
- ✅ List type variants (`listType`: 'text' | 'picture' | 'picture-card')
|
|
52
|
-
- ✅ Show/hide upload list (`showUploadList` prop)
|
|
53
|
-
- ✅ Custom item rendering (`itemRender` prop)
|
|
54
|
-
- ✅ Custom icon rendering (`iconRender` prop)
|
|
55
|
-
- ✅ Custom preview function (`previewFile` prop)
|
|
56
|
-
|
|
57
|
-
5. **Validation & Error Handling**
|
|
58
|
-
- ✅ Pre-upload validation (`beforeUpload` callback)
|
|
59
|
-
- ✅ Error state handling (via `fileList` status)
|
|
60
|
-
- ✅ Upload progress tracking (via `fileList` percent)
|
|
61
|
-
|
|
62
|
-
6. **Drag and Drop**
|
|
63
|
-
- ✅ Drag-and-drop upload (`CapUploader.CapDragger`)
|
|
64
|
-
|
|
65
|
-
7. **Accessibility**
|
|
66
|
-
- ✅ Keyboard navigation (inherited from Ant Design)
|
|
67
|
-
- ✅ ARIA attributes support (via props)
|
|
68
|
-
|
|
69
|
-
#### ⚠️ Potentially Missing (Requires Wrapper Logic)
|
|
70
|
-
|
|
71
|
-
The following use cases might **require additional wrapper functionality** that is not currently implemented:
|
|
72
|
-
|
|
73
|
-
1. **Built-in File Size Validation**
|
|
74
|
-
- ❌ No built-in `maxSize` prop (requires `beforeUpload` callback)
|
|
75
|
-
- ❌ No built-in `minSize` prop (requires `beforeUpload` callback)
|
|
76
|
-
- **Workaround**: Use `beforeUpload` callback for validation
|
|
77
|
-
|
|
78
|
-
2. **Built-in File Type Validation Messages**
|
|
79
|
-
- ❌ No automatic error messages for invalid file types
|
|
80
|
-
- **Workaround**: Use `beforeUpload` callback with custom messaging
|
|
81
|
-
|
|
82
|
-
3. **CSV-Specific Features**
|
|
83
|
-
- ❌ No built-in CSV parsing/validation (see `CapCSVFileUploader` for CSV-specific needs)
|
|
84
|
-
- ❌ No built-in row count display
|
|
85
|
-
- **Note**: This is intentional - CSV features are in separate component
|
|
86
|
-
|
|
87
|
-
4. **Custom Upload UI Components**
|
|
88
|
-
- ❌ No pre-built upload button component (requires custom children)
|
|
89
|
-
- ❌ No pre-built upload area component (use `CapDragger` instead)
|
|
90
|
-
- **Note**: This is by design - component is a wrapper, not a full UI kit
|
|
91
|
-
|
|
92
|
-
5. **Advanced Progress Tracking**
|
|
93
|
-
- ❌ No built-in progress percentage display (Ant Design shows progress bar)
|
|
94
|
-
- ❌ No built-in upload speed calculation
|
|
95
|
-
- **Workaround**: Use `onChange` callback with `file.percent`
|
|
96
|
-
|
|
97
|
-
6. **Batch Operations**
|
|
98
|
-
- ❌ No built-in "select all" / "remove all" functionality
|
|
99
|
-
- **Workaround**: Implement via `fileList` state management
|
|
100
|
-
|
|
101
|
-
7. **File Transformation**
|
|
102
|
-
- ❌ No built-in image compression/resizing
|
|
103
|
-
- ❌ No built-in file format conversion
|
|
104
|
-
- **Workaround**: Use `beforeUpload` or `customRequest` for transformations
|
|
105
|
-
|
|
106
|
-
8. **Upload Queue Management**
|
|
107
|
-
- ❌ No built-in upload queue/pause/resume functionality
|
|
108
|
-
- **Workaround**: Implement via `customRequest` with manual queue management
|
|
109
|
-
|
|
110
|
-
### Recommendations
|
|
111
|
-
|
|
112
|
-
1. **For Basic Upload Needs**: ✅ CapUploader is sufficient
|
|
113
|
-
2. **For CSV Upload**: Use `CapCSVFileUploader` component
|
|
114
|
-
3. **For Advanced Features**: Extend CapUploader with wrapper logic or use `customRequest`
|
|
115
|
-
4. **For Drag-and-Drop**: Use `CapUploader.CapDragger`
|
|
116
|
-
|
|
117
|
-
### Component Design Philosophy
|
|
118
|
-
|
|
119
|
-
CapUploader follows a **minimal wrapper** approach:
|
|
120
|
-
- ✅ Provides consistent styling (`cap-uploader-v2` class)
|
|
121
|
-
- ✅ Exposes Ant Design Upload functionality
|
|
122
|
-
- ✅ Maintains backward compatibility
|
|
123
|
-
- ❌ Does NOT add wrapper-specific features (by design)
|
|
124
|
-
|
|
125
|
-
This design allows:
|
|
126
|
-
- Maximum flexibility (all Ant Design features accessible)
|
|
127
|
-
- Minimal maintenance overhead
|
|
128
|
-
- Easy migration from Ant Design Upload to CapUploader
|
|
129
|
-
|
|
130
|
-
## Phase 2: Test Coverage
|
|
131
|
-
|
|
132
|
-
### Test Files Created
|
|
133
|
-
|
|
134
|
-
1. **`CapUploader.test.tsx`** - Comprehensive test suite (758 lines)
|
|
135
|
-
2. **`CapUploader.mockData.ts`** - Reusable test data and props
|
|
136
|
-
|
|
137
|
-
### Test Coverage Areas
|
|
138
|
-
|
|
139
|
-
✅ **Default Rendering and Initialization** (5 tests)
|
|
140
|
-
- Base class application
|
|
141
|
-
- Custom className handling
|
|
142
|
-
- CapDragger static property
|
|
143
|
-
|
|
144
|
-
✅ **Prop Variations** (15+ tests)
|
|
145
|
-
- Basic configuration props
|
|
146
|
-
- File list management
|
|
147
|
-
- List type variants
|
|
148
|
-
- HTTP configuration
|
|
149
|
-
|
|
150
|
-
✅ **User Interactions** (5+ tests)
|
|
151
|
-
- File selection
|
|
152
|
-
- Multiple file selection
|
|
153
|
-
- Disabled state handling
|
|
154
|
-
- File type restrictions
|
|
155
|
-
|
|
156
|
-
✅ **Callbacks and Event Handlers** (10+ tests)
|
|
157
|
-
- onChange callback
|
|
158
|
-
- onRemove callback
|
|
159
|
-
- beforeUpload callback
|
|
160
|
-
- customRequest callback
|
|
161
|
-
- onPreview callback
|
|
162
|
-
- onDownload callback
|
|
163
|
-
|
|
164
|
-
✅ **Edge Cases** (10+ tests)
|
|
165
|
-
- Empty/undefined values
|
|
166
|
-
- Max count limits
|
|
167
|
-
- Large files
|
|
168
|
-
- Mixed file statuses
|
|
169
|
-
- Error handling
|
|
170
|
-
- Promise-based beforeUpload
|
|
171
|
-
|
|
172
|
-
✅ **Accessibility** (6 tests)
|
|
173
|
-
- Keyboard navigation
|
|
174
|
-
- ARIA attributes
|
|
175
|
-
- Disabled state
|
|
176
|
-
- Focus management
|
|
177
|
-
|
|
178
|
-
✅ **Backward Compatibility** (3 tests)
|
|
179
|
-
- Ant Design props pass-through
|
|
180
|
-
- className functionality
|
|
181
|
-
- Rest props handling
|
|
182
|
-
|
|
183
|
-
✅ **Data Flow and State Management** (4 tests)
|
|
184
|
-
- Controlled fileList updates
|
|
185
|
-
- File removal logic
|
|
186
|
-
- State synchronization
|
|
187
|
-
|
|
188
|
-
✅ **Conditional Rendering** (5 tests)
|
|
189
|
-
- showUploadList toggle
|
|
190
|
-
- List type rendering
|
|
191
|
-
- Disabled state rendering
|
|
192
|
-
|
|
193
|
-
✅ **CapDragger Static Property** (4 tests)
|
|
194
|
-
- Component rendering
|
|
195
|
-
- Props pass-through
|
|
196
|
-
- File selection
|
|
197
|
-
- className handling
|
|
198
|
-
|
|
199
|
-
### Total Test Count
|
|
200
|
-
|
|
201
|
-
**~70+ test cases** covering all major functionality areas.
|
|
202
|
-
|
|
203
|
-
### Test Patterns Used
|
|
204
|
-
|
|
205
|
-
- ✅ `it.each` for repetitive prop variations
|
|
206
|
-
- ✅ Reusable helper functions (`renderWithProps`)
|
|
207
|
-
- ✅ Mock data in separate file
|
|
208
|
-
- ✅ Focus on functional behavior (not styling)
|
|
209
|
-
- ✅ User interaction testing with `@testing-library/user-event`
|
|
210
|
-
- ✅ Accessibility testing
|
|
211
|
-
- ✅ Edge case coverage
|
|
212
|
-
|
|
213
|
-
## Next Steps
|
|
214
|
-
|
|
215
|
-
1. **Run Test Suite**: Execute tests to verify coverage
|
|
216
|
-
2. **Coverage Report**: Generate coverage report to verify 90%+ target
|
|
217
|
-
3. **Google Sheets Sync**: If access becomes available, cross-reference use cases
|
|
218
|
-
4. **Documentation**: Update README with test coverage information
|
|
219
|
-
|
|
220
|
-
## Notes
|
|
221
|
-
|
|
222
|
-
- Tests follow codebase patterns from `CapButton`, `CapTag`, `CapLabel` tests
|
|
223
|
-
- No component source code was modified (tests only)
|
|
224
|
-
- Tests use `@testing-library/react` (not enzyme, matching codebase pattern)
|
|
225
|
-
- Mock data is reusable and follows DRY principles
|