2025-06-19 11:39:16 +00:00
|
|
|
import { html, css, cssManager } from '@design.estate/dees-element';
|
|
|
|
|
|
|
|
export const demoFunc = () => html`
|
|
|
|
<dees-demowrapper>
|
|
|
|
<style>
|
|
|
|
${css`
|
|
|
|
.demo-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: 24px;
|
|
|
|
padding: 24px;
|
|
|
|
max-width: 1200px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.upload-grid {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
gap: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
.upload-grid {
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.upload-box {
|
|
|
|
padding: 16px;
|
|
|
|
background: ${cssManager.bdTheme('#fff', '#2a2a2a')};
|
|
|
|
border-radius: 4px;
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e0e0e0', '#444')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.upload-box h4 {
|
|
|
|
margin-top: 0;
|
|
|
|
margin-bottom: 16px;
|
|
|
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.info-section {
|
|
|
|
margin-top: 32px;
|
|
|
|
padding: 16px;
|
|
|
|
background: ${cssManager.bdTheme('#fff3cd', '#332701')};
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#ffeaa7', '#664400')};
|
|
|
|
border-radius: 4px;
|
|
|
|
color: ${cssManager.bdTheme('#856404', '#ffecb5')};
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div class="demo-container">
|
2025-06-26 15:32:29 +00:00
|
|
|
<dees-panel .title=${'1. Basic File Upload'} .subtitle=${'Simple file upload with drag and drop support'}>
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Attachments'}
|
2025-06-26 15:32:29 +00:00
|
|
|
.description=${'Upload any files by clicking or dragging them here'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
|
|
|
|
<dees-input-fileupload
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Single File Only'}
|
|
|
|
.description=${'Only one file can be uploaded at a time'}
|
|
|
|
.multiple=${false}
|
|
|
|
.buttonText=${'Choose File'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
</dees-panel>
|
|
|
|
|
2025-06-26 15:32:29 +00:00
|
|
|
<dees-panel .title=${'2. File Type Restrictions'} .subtitle=${'Upload areas with specific file type requirements'}>
|
2025-06-19 11:39:16 +00:00
|
|
|
<div class="upload-grid">
|
|
|
|
<div class="upload-box">
|
2025-06-26 15:32:29 +00:00
|
|
|
<h4>Images Only</h4>
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Profile Picture'}
|
|
|
|
.description=${'JPG, PNG or GIF (max 5MB)'}
|
|
|
|
.accept=${'image/jpeg,image/png,image/gif'}
|
|
|
|
.maxSize=${5 * 1024 * 1024}
|
|
|
|
.multiple=${false}
|
|
|
|
.buttonText=${'Select Image'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="upload-box">
|
2025-06-26 15:32:29 +00:00
|
|
|
<h4>Documents Only</h4>
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Resume'}
|
|
|
|
.description=${'PDF or Word documents only'}
|
|
|
|
.accept=${".pdf,.doc,.docx,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"}
|
|
|
|
.buttonText=${'Select Document'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</dees-panel>
|
|
|
|
|
2025-06-26 15:32:29 +00:00
|
|
|
<dees-panel .title=${'3. Validation & Limits'} .subtitle=${'File size limits and validation examples'}>
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Small Files Only'}
|
|
|
|
.description=${'Maximum file size: 1MB'}
|
|
|
|
.maxSize=${1024 * 1024}
|
|
|
|
.buttonText=${'Upload Small File'}
|
|
|
|
></dees-input-fileupload>
|
|
|
|
|
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Limited Upload'}
|
|
|
|
.description=${'Maximum 3 files, each up to 2MB'}
|
|
|
|
.maxFiles=${3}
|
|
|
|
.maxSize=${2 * 1024 * 1024}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
|
|
|
|
<dees-input-fileupload
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Required Upload'}
|
|
|
|
.description=${'This field is required'}
|
|
|
|
.required=${true}
|
|
|
|
></dees-input-fileupload>
|
|
|
|
</dees-panel>
|
|
|
|
|
|
|
|
<dees-panel .title=${'4. States & Styling'} .subtitle=${'Different states and validation feedback'}>
|
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Disabled Upload'}
|
|
|
|
.description=${'File upload is currently disabled'}
|
2025-06-19 11:39:16 +00:00
|
|
|
.disabled=${true}
|
2025-06-26 15:32:29 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
|
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Pre-filled Example'}
|
|
|
|
.description=${'Component with pre-loaded files'}
|
|
|
|
.value=${[
|
|
|
|
new File(['Hello World'], 'example.txt', { type: 'text/plain' }),
|
|
|
|
new File(['Test Data'], 'data.json', { type: 'application/json' })
|
|
|
|
]}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
|
|
|
</dees-panel>
|
|
|
|
|
2025-06-26 15:32:29 +00:00
|
|
|
<dees-panel .title=${'5. Form Integration'} .subtitle=${'Complete form with various file upload scenarios'}>
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-form>
|
2025-06-26 15:32:29 +00:00
|
|
|
<h3 style="margin-top: 0; margin-bottom: 24px; color: ${cssManager.bdTheme('#333', '#fff')};">Job Application Form</h3>
|
|
|
|
|
|
|
|
<dees-input-text
|
|
|
|
.label=${'Full Name'}
|
|
|
|
.required=${true}
|
|
|
|
.key=${'fullName'}
|
|
|
|
></dees-input-text>
|
|
|
|
|
|
|
|
<dees-input-text
|
|
|
|
.label=${'Email'}
|
|
|
|
.inputType=${'email'}
|
|
|
|
.required=${true}
|
|
|
|
.key=${'email'}
|
|
|
|
></dees-input-text>
|
|
|
|
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Resume'}
|
2025-06-26 15:32:29 +00:00
|
|
|
.description=${'Required: PDF format only (max 10MB)'}
|
2025-06-19 11:39:16 +00:00
|
|
|
.required=${true}
|
2025-06-26 15:32:29 +00:00
|
|
|
.accept=${'application/pdf'}
|
|
|
|
.maxSize=${10 * 1024 * 1024}
|
|
|
|
.multiple=${false}
|
|
|
|
.key=${'resume'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
2025-06-26 15:32:29 +00:00
|
|
|
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'Portfolio'}
|
2025-06-26 15:32:29 +00:00
|
|
|
.description=${'Optional: Upload up to 5 work samples (images or PDFs, max 5MB each)'}
|
|
|
|
.accept=${'image/*,application/pdf'}
|
|
|
|
.maxFiles=${5}
|
|
|
|
.maxSize=${5 * 1024 * 1024}
|
|
|
|
.key=${'portfolio'}
|
|
|
|
></dees-input-fileupload>
|
|
|
|
|
|
|
|
<dees-input-fileupload
|
|
|
|
.label=${'References'}
|
|
|
|
.description=${'Upload reference letters (optional)'}
|
|
|
|
.accept=${".pdf,.doc,.docx"}
|
|
|
|
.key=${'references'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-fileupload>
|
2025-06-26 15:32:29 +00:00
|
|
|
|
2025-06-19 11:39:16 +00:00
|
|
|
<dees-input-text
|
2025-06-26 15:32:29 +00:00
|
|
|
.label=${'Additional Comments'}
|
2025-06-19 11:39:16 +00:00
|
|
|
.inputType=${'textarea'}
|
2025-06-26 15:32:29 +00:00
|
|
|
.description=${'Any additional information you would like to share'}
|
|
|
|
.key=${'comments'}
|
2025-06-19 11:39:16 +00:00
|
|
|
></dees-input-text>
|
2025-06-26 15:32:29 +00:00
|
|
|
|
|
|
|
<dees-form-submit .text=${'Submit Application'}></dees-form-submit>
|
2025-06-19 11:39:16 +00:00
|
|
|
</dees-form>
|
|
|
|
|
|
|
|
<div class="info-section">
|
2025-06-26 15:32:29 +00:00
|
|
|
<h4 style="margin-top: 0;">Enhanced Features:</h4>
|
|
|
|
<ul style="margin: 0; padding-left: 20px;">
|
|
|
|
<li>Drag & drop with visual feedback</li>
|
|
|
|
<li>File type restrictions via accept attribute</li>
|
|
|
|
<li>File size validation with custom limits</li>
|
|
|
|
<li>Maximum file count restrictions</li>
|
|
|
|
<li>Image preview thumbnails</li>
|
|
|
|
<li>File type-specific icons</li>
|
|
|
|
<li>Clear all button for multiple files</li>
|
|
|
|
<li>Proper validation states and messages</li>
|
|
|
|
<li>Keyboard accessible</li>
|
|
|
|
<li>Single or multiple file modes</li>
|
2025-06-19 11:39:16 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</dees-panel>
|
|
|
|
</div>
|
|
|
|
</dees-demowrapper>
|
|
|
|
`;
|