Skip to content

Commit 56d6913

Browse files
authored
Merge pull request #655 from dxc-technology/draft-3.13.0-file-input
[File-input] Add component documentation
2 parents 3413bfd + a9fe7eb commit 56d6913

21 files changed

+192
-2
lines changed
187 KB
Binary file not shown.
-1.15 MB
Binary file not shown.

guidelines/catalog.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@
154154
"key": "textarea",
155155
"name": "Textarea"
156156
},
157+
{
158+
"key": "file-input",
159+
"name": "File input"
160+
},
157161
{
158162
"key": "toggle",
159163
"name": "Toggle"
160164
},
161165
{
162-
"key": "upload",
163-
"name": "Upload"
166+
"key": "v3_upload",
167+
"name": "Upload (deprecated)"
164168
},
165169
{
166170
"key": "wizard",
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Input-file
2+
3+
The input-file component is used to choose files from any location in the local machine and update those files to the server where the application is hosted. It is a common procedure in applications where files are required like documents, images or other information in digital formats.
4+
5+
## Usage
6+
7+
### Do's
8+
9+
* Provide a meaninful label and helper text in order to help the user understand the files expected
10+
* When displaying errors, provide feedback about the type of error using the error message
11+
* When the input-file process fails, provide useful information instead of showing an error message using technical or undetermined information (i.e '0x94 ERROR_PATH_BUSY')
12+
13+
### Don'ts
14+
15+
* Use the input-file component to upload multiple files inside a modal dialog
16+
* Use a variant with drag and drop functionality when designing for mobile devices
17+
18+
19+
## Variants
20+
21+
![input-file component variants](images/input_file_variants.png)
22+
23+
_Input-file component variants_
24+
25+
| Name | Use case |
26+
| :----------- | :--------------------------------------------------------------------------------------- |
27+
| **File** | Use the file variant when designing for multidevice |
28+
| **Filedrop** | Use in large or complex forms when designing only for desktop |
29+
| **Dropzone** | Choose the dropzone when the main purpose of the content is to input-file files/images |
30+
31+
## States
32+
33+
The component input-file is made-up of an input (type: file) and a file-item(s).
34+
35+
### File
36+
37+
The element has the following states: **Enabled**, **hover**, **focus**, **active** and **disabled**.
38+
39+
![File variant states](images/input_file_states_file.png)
40+
41+
_File variant states_
42+
43+
### Filedrop
44+
45+
The element has the following states: **Enabled**, **hover**, **focus**, **active**, **dragover** and **disabled**.
46+
47+
![Filedrop variant states](images/input_file_states_filedrop.png)
48+
49+
_Filedrop variant states_
50+
51+
### Dropzone
52+
53+
The element has the following states: **Enabled**, **hover**, **focus**, **active**, **dragover** and **disabled**.
54+
55+
![Dropzone variant states](images/input_file_states_dropzone.png)
56+
57+
_Dropzone variant states_
58+
### File items
59+
60+
The element has the following states: **Enabled**, **hover/focus**, **active**, **loading** and **error**.
61+
62+
![File item states](images/input_file_states_fileitem.png)
63+
64+
_File item states_
65+
66+
## Anatomy
67+
68+
![Component input-file anatomy](images/input_file_anatomy.png)
69+
70+
1. Label
71+
2. Drag and drop area
72+
3. Error message
73+
4. Error indicator
74+
5. Action - Remove file
75+
6. Helper text
76+
7. input-file button
77+
8. File preview
78+
9. File name
79+
10. File item container
80+
81+
## File item with preview
82+
83+
When the files to upload are mainly images, the preview can provide more feedback to the user rather than the name of the file, preventing errors loading content.
84+
85+
![File item with preview example](images/input_file_fileitem_preview.png)
86+
87+
_File item with preview example_
88+
89+
## Single file input-file
90+
91+
In order to provide a compact version of the input-file component to accomodate any layout restriction, the variant file displays the file name in the same row instead of growing vertically.
92+
93+
![Variant file single input-file](images/input_file_single_file.png)
94+
95+
_Variant file single upload_
96+
97+
## Design Specifications
98+
99+
![Input-file design specifications](images/input_file_specs.png)
100+
101+
_Input-file design specifications_
102+
103+
### Color
104+
105+
#### Base
106+
107+
| Component token | Element | Core token | Value |
108+
| :---------------------------- | :-------------------------- | :-------------------------- | :------------ |
109+
| `dropBorderColor` | Drag and drop area | `color-black` | #000000 |
110+
| `fileItemBorderColor` | File item | `color-grey-300` | #cccccc |
111+
| `fileItemIconColor` | File item | `color-black` | #000000 |
112+
| `fileNameFontColor` | File name | `color-black` | #000000 |
113+
| `filePreviewBackgroundColor` | File preview | `color-color-grey-100` | #f2f2f2 |
114+
| `filePreviewIconColor` | File preview icon | `color-black` | #000000 |
115+
| `labelFontColor` | Label | `color-black` | #000000 |
116+
| `helperTextFontColor` | Helper text | `color-black` | #000000 |
117+
| `dropLabelFontColor` | Drop label | `color-black` | #000000 |
118+
119+
120+
#### Interactive
121+
122+
| Component token | Element | Core token | Value |
123+
| :-------------------------------------- | :-------------------------- | :-------------------------- | :------------ |
124+
| `disabledLabelFontColor` | Label:disabled | `color-grey-500` | #999999 |
125+
| `disabledHelperTextFontColor` | Helper text:disabled | `color-grey-500` | #999999 |
126+
| `disabledDropLabelFontColor` | Drop label:disabled | `color-grey-500` | #999999 |
127+
| `focusDropBorderColor` | Dnd border:focus | `color-blue-600` | #0095ff |
128+
| `disabledDropBorderColor` | Dnd border:disabled | `color-grey-500` | #999999 |
129+
| `focusDropBackgroundColor` | Dnd fill:focus | `color-blue-50` | #f5fbff |
130+
| `hoverFileItemIconBackgroundColor` | File item icon:hover | `color-grey-100` | #f2f2f2 |
131+
| `activeFileItemIconBackgroundColor` | File item icon:active | `color-grey-300` | #cccccc |
132+
| `errorFileItemBorderColor` | File item container:error | `color-red-700` | #d0011b |
133+
| `errorFileItemBackgroundColor` | File item container:error | `color-red-50` | #fff5f6 |
134+
| `errorFilePreviewBackgroundColor` | File item preview:error | `color-red-200` | #ffccd3 |
135+
| `errorMessageFontColor` | File item:error | `color-red-700` | #d0011b |
136+
137+
138+
### Typography
139+
140+
| Property | Element | Token | Value |
141+
| :-------------- | :------------- | :---------------------- | :-------------- |
142+
| `font-family` | Label | `font-family-sans` | Open Sans |
143+
| `font-size` | Label | `font-scale-02` | 0.875rem / 14px |
144+
| `font-weight` | Label | `font-bold` | 600 |
145+
| `line-height` | Label | `font-leading-loose-01` | 1.75em |
146+
| `font-family` | File item | `font-family-sans` | Open Sans |
147+
| `font-size` | File item | `font-scale-02` | 0.875rem / 14px |
148+
| `font-weight` | File item | `font-regular` | 400 |
149+
| `line-height` | File item | `font-leading-normal` | 1.5em |
150+
| `font-family` | Helper text | `font-family-sans` | Open Sans |
151+
| `font-size` | Helper text | `font-scale-01` | 12px |
152+
| `font-weight` | Helper text | `font-regular` | 400 |
153+
| `line-height` | Helper text | `font-leading-normal` | 1.5em |
154+
| `font-family` | Drop label | `font-family-sans` | Open Sans |
155+
| `font-size` | Drop label | `font-scale-03` | 1rem / 16px |
156+
| `font-weight` | Drop label | `font-regular` | 400 |
157+
| `font-family` | Error message | `font-family-sans` | Open Sans |
158+
| `font-size` | Error message | `font-scale-01` | 0.75rem / 12px |
159+
| `font-weight` | Error message | `font-regular` | 400 |
160+
| `line-height` | Error message | `font-leading-normal` | 1.5em |
161+
162+
### Border
163+
164+
| Property | Element | Token | Value |
165+
| :-------------- | :-------------------- | :---------------------- | :----------------- |
166+
| `border-style` | Drag and drop area | `border-style-dashed` | dashed |
167+
| `border-width` | Drag and drop area | `border-width-1` | 1px |
168+
| `border-radius` | Drag and drop area | `border-radius-large` | 0.375rem / 6px |
169+
| `border-style` | File item | `border-style-solid` | solid |
170+
| `border-width` | File item | `border-width-1` | 1px |
171+
| `border-radius` | File item | `border-radius-medium` | 0.25rem / 4px |
172+
173+
174+
## Links and references
175+
176+
* [React CDK component](https://developer.dxc.com/tools/react/next/#/components/fileInput)
177+
* [Angular CDK component](https://developer.dxc.com/tools/angular/next/#/components/fileInput)
178+
* [Adobe XD component](https://xd.adobe.com/view/e2c71e4d-54a9-461a-b269-fcb1b3ffe407-b794/)
179+
180+
____________________________________________________________
181+
182+
[Edit this page on Github](https://github.com/dxc-technology/halstack-style-guide/blob/master/guidelines/components/input-file/README.md)
30.9 KB
Loading
15.1 KB
Loading
18.2 KB
Loading
42.2 KB
Loading
62.2 KB
Loading
28.9 KB
Loading

0 commit comments

Comments
 (0)