Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(HXFileInputElement): modify File Input component #509

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions docs/components/file/file-input-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Util from '../../_util';

(function () {
const ICONS = [ 'upload', 'paperclip' ];

const VARIANTS = [
{ label: 'Primary', val: 'hxPrimary' },
{ label: 'Secondary', val: '', default: true },
{ label: 'Tertiary', val: 'hxTertiary' },
{ label: 'Primary', val: 'hxBtn hxPrimary' },
{ label: 'Secondary', val: 'hxBtn', default: true },
{ label: 'Tertiary', val: 'hxBtn hxTertiary' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to look into reducing repetitive .hxBtn class from refactored implementation, before the v0.17.0 release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to do this in this p/r or no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not right now, but we do need a fast follow

];

if (document.getElementById('vue-fileInputDemo')) {
Expand All @@ -15,6 +15,7 @@ import Util from '../../_util';
data: {
icon: ICONS[0],
icons: ICONS,
isDisabled: false,
isMultiple: false,
label: 'Upload File',
variant: VARIANTS[1],
Expand All @@ -31,22 +32,24 @@ import Util from '../../_util';
attrIcon: function () {
return `icon="${this.icon}"`;
},
attrLabel: function () {
if (this.label !== '') {
return `label="${this.label}"`;
} else {
return '';
}
},
snippet: function () {
return Util.snippet(`
<hx-file-input
${this.attrClass}
${this.attrIcon}
${this.attrLabel}
>
<input ${this.isMultiple ? 'multiple ' : ''}type="file" />
</hx-file-input>
<hx-file-control>
<input
${this.isDisabled ? 'disabled' : ''}
${this.isMultiple ? 'multiple ' : ''}
id="fileInputDemo"
type="file"
/>
<label for="fileInputDemo">
<hx-file-input
${this.attrClass}
${this.attrIcon}
>
${this.label}
</hx-file-input>
</label>
</hx-file-control>
`);
},
},
Expand Down
74 changes: 56 additions & 18 deletions docs/components/file/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
also:
components/file/test-drop-fence.html: Testing - Drop Fence
components/file/test-drop-zone.html: Testing - Drop Zone
components/file/test-file-selector.html: Testing - File Selector
components/file/test-file-input.html: Testing - File Input
components/file/test-file-tile.html: Testing - File Tile
components/icon: Icon
elements/hx-drop-fence: <hx-drop-fence>
Expand Down Expand Up @@ -42,11 +42,17 @@ <h2 id="drop-zone">Drop Zone</h2>
<hx-drop-fence>
<p>
Drop files here or
<hx-file-input
class="hxTertiary"
label="browse your files">
<input type="file" />
</hx-file-input>.
<hx-file-control>
<input
id="fileInputDropZoneDemo"
type="file"
/>
<label for="fileInputDropZoneDemo">
<hx-file-input class="hxBtn hxTertiary">
browse your files
</hx-file-input>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate extra inline spacing. (non-blocking)

</label>
</hx-file-control>
</p>
</hx-drop-fence>
</hx-drop-zone>
Expand All @@ -58,11 +64,17 @@ <h2 id="drop-zone">Drop Zone</h2>
<hx-drop-fence>
<p>
Drop files here or
<hx-file-input
class="hxTertiary"
label="browse your files">
<input type="file" />
</hx-file-input>.
<hx-file-control>
<input
id="fileInputDropZoneDemo"
type="file"
/>
<label for="fileInputDropZoneDemo">
<hx-file-input class="hxBtn hxTertiary">
browse your files
</hx-file-input>
</label>
</hx-file-control>
</p>
</hx-drop-fence>
</hx-drop-zone>
Expand All @@ -73,7 +85,7 @@ <h2 id="drop-zone">Drop Zone</h2>

<section>
<header>
<h2 id="file-selector">File Selector</h2>
<h2 id="file-input">File Input</h2>
<p class="hxSubBody">Added: v0.13.0</p>
{# TODO: add section description #}
</header>
Expand Down Expand Up @@ -129,6 +141,18 @@ <h2 id="file-selector">File Selector</h2>

<fieldset>
<legend class="beta-hxFieldName">Control Options</legend>
<hx-checkbox-control>
<input
id="chkIsDisabled"
type="checkbox"
v-model="isDisabled"
/>
<label for="chkIsDisabled">
<hx-checkbox></hx-checkbox>
Disabled
</label>
</hx-checkbox-control>

<hx-checkbox-control>
<input
id="chkIsMultiple"
Expand All @@ -145,22 +169,36 @@ <h2 id="file-selector">File Selector</h2>
</header>

<div>
<hx-file-input
:class="variant.val"
:icon="icon"
:label="label"
>
<hx-file-control>
<input
id="fileInputDemo"
type="file"
:disabled="isDisabled"
:multiple="isMultiple"
/>
</hx-file-input>
<label for="fileInputDemo">
<hx-file-input
:class="variant.val"
:icon="icon"
>
{% raw %}{{label}}{% endraw %}
</hx-file-input>
</label>
</hx-file-control>
</div>

<footer>
<pre><code v-text="snippet"></code></pre>
</footer>
</div>
<p class="hxSubdued hxSubBody">
<hx-icon type="exclamation-triangle"></hx-icon>
Microsoft browsers never match the <code>input[type="file"]:active</code> CSS selector.
</p>
<p class="hxSubdued hxSubBody">
<hx-icon type="exclamation-triangle"></hx-icon>
Microsoft browsers apply two tab stops on <code>&lt;input type="file"&gt;</code> elements.
</p>
</section>

<section>
Expand Down
Loading