Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #482 from aledavila/file-uploader-x
Browse files Browse the repository at this point in the history
feat(file-uploader): add experimental file uploader
  • Loading branch information
alisonjoseph authored Nov 29, 2018
2 parents 5a16b9d + f12d2d4 commit e4da079
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 2,252 deletions.
Binary file removed .yarn-offline-mirror/carbon-components-9.56.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/carbon-components-9.57.0.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@carbon/icons-react": "^0.0.1-alpha.12",
"@reach/router": "^1.2.1",
"@storybook/addon-info": "^4.0.9",
"carbon-components": "^9.56.3",
"carbon-components": "^9.57.0",
"carbon-components-react": "6.52.1",
"carbon-icons": "^7.0.7",
"classnames": "^2.2.6",
Expand Down
16 changes: 16 additions & 0 deletions src/content/experimental/file-uploader/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
label: Experimental
title: File Uploader
tabs: ['Code', 'Usage']
---

<page-intro>**File Uploader** allows the user to transfer a file or submit content of their own.</page-intro>

<component
name="File Uploader"
component="file-uploader"
variation="file-uploader"
experimental="true"
>
</component>
<component-docs component="file-uploader"></component-docs>
29 changes: 29 additions & 0 deletions src/content/experimental/file-uploader/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
label: Experimental
title: File Uploader
tabs: ['Code', 'Usage']
---

## General

- A File Uploader is commonly found in forms, but they can also live as stand alone elements.
- **Add files** is the default text that appears with the File Uploader.
- A File Uploader should always be accompanied by **Submit** or **Upload**, which is to be styled as a [Secondary Button](/components/button).
- Use an ellipsis (...) if the filename extends beyond the width of its parent element.

## Basic interaction

1. The user may select 1 or more files to upload at a time. By default, any file type is accepted, but you can add parameters to validate a specific file type.
2. The action of clicking **Add files** will trigger a browser-specific upload window.
3. Once the user chooses files to upload, the browser-specific upload window closes and the files will appear below the **Add files** button.
4. User clicks **Submit** or **Upload** to submit their data.
5. Any errors that may occur with the file should appear as an inline error
[Notification](/components/notification).

## Upload state

Developers using File Uploader will be able to use JavaScript to inject a Loading component when selected files are actually being uploaded.

## Removing files

Developers will use JavaScript to inject a “close” button on each file that is selected to be uploaded. It's up to the developer to code the logic for removing these files individually. However, keep in mind that this kind of editing isn't supported natively in the browser.
2 changes: 1 addition & 1 deletion src/data/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"vanilla": "ready",
"react": "ready",
"angular": "not-available",
"experimental": "under-review"
"experimental": "ready"
},
{
"item": "Form",
Expand Down
3 changes: 3 additions & 0 deletions src/data/navigation/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
"dropdown": {
"title": "Dropdown"
},
"file-uploader": {
"title": "File Uploader"
},
"inline-loading": {
"title": "Inline Loading"
},
Expand Down
20 changes: 20 additions & 0 deletions src/html/file-uploader/file-uploader.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="bx--form-item">
<strong class="bx--file--label">Account photo</strong>
<p class="bx--label-description">only .jpg and .png files. 500kb max file size.</p>
<div class="bx--file" data-file>
<label
for="your-file-importer-id-here"
class="bx--file-btn bx--btn bx--btn--primary bx--btn--sm"
role="button"
tabindex="0">Add file</label>
<input
type="file"
class="bx--file-input"
id="your-file-importer-id-here"
data-file-uploader
data-target="[data-file-container]"
multiple
/>
<div data-file-container class="bx--file-container"></div>
</div>
</div>
2,253 changes: 3 additions & 2,250 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit e4da079

Please sign in to comment.