import { DeesElement, property, state, html, customElement, type TemplateResult, css } from '@design.estate/dees-element'; import { actionButton, demoDocuments, demoFields, fakeDocument, icon, pill, workspaceBaseStyles, workspaceDemoFrame, type IDocumentRow, type IFieldPlacement } from './sdig-workspace.shared.js'; declare global { interface HTMLElementTagNameMap { 'sdig-workspace-sign': SdigWorkspaceSign; } } @customElement('sdig-workspace-sign') export class SdigWorkspaceSign extends DeesElement { public static demo = () => workspaceDemoFrame(html``); public static demoGroups = ['Signature Digital Workspace']; @property({ attribute: false }) public accessor document: IDocumentRow = demoDocuments[0]; @state() private accessor activeFieldId: string = 'f1'; @state() private accessor signedFieldIds: string[] = []; public static styles = [workspaceBaseStyles, css` .recipient-header { height: 56px; flex-shrink: 0; padding: 0 24px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; } .logomark { width: 28px; height: 28px; border-radius: 6px; background: var(--bg-el); border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-family: 'Plus Jakarta Sans', Inter, sans-serif; font-weight: 700; position: relative; } .logomark::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); } .sign-layout { flex: 1; display: flex; overflow: hidden; background: hsl(0 0% 96%); color: hsl(0 0% 10%); } :host-context(sdig-workspace[theme='dark']) .sign-layout { background: hsl(0 0% 6%); color: hsl(0 0% 95%); } .sign-body { flex: 1; overflow: auto; padding: 32px 32px 80px; display: flex; flex-direction: column; align-items: center; gap: 20px; } .sign-panel { width: 320px; border-left: 1px solid var(--border); background: var(--bg-card); padding: 20px; overflow: auto; flex-shrink: 0; } @media (max-width: 920px) { .recipient-header .actions { display: none; } .sign-layout { flex-direction: column; overflow: auto; } .sign-panel { width: 100%; border-left: 0; border-top: 1px solid var(--border); } .document-page { width: 560px; } } `]; private get signFields() { return demoFields.slice(0, 3); } private fieldIcon(type: IFieldPlacement['type']): string { if (type === 'signature') return 'sign'; if (type === 'date') return 'calendar'; return 'type'; } private signField(fieldId: string) { if (!this.signedFieldIds.includes(fieldId)) { this.signedFieldIds = [...this.signedFieldIds, fieldId]; } const next = this.signFields.find((field) => !this.signedFieldIds.includes(field.id) && field.id !== fieldId); if (next) this.activeFieldId = next.id; } private renderSignedValue(field: IFieldPlacement): TemplateResult { if (field.type === 'signature') return html`Sarah Chen`; if (field.type === 'date') return html`2026-05-02`; return html`Sarah Chen`; } public render(): TemplateResult { const document = this.document || demoDocuments[0]; const completed = this.signedFieldIds.length; const progress = Math.round((completed / this.signFields.length) * 100); const activeField = this.signFields.find((field) => field.id === this.activeFieldId) || this.signFields[0]; return html`
s
${document.title}
From ${document.sender} · ${document.id} · ${document.pages} pages
${icon('shield', 12)} Verified sender · DKIM ✓${actionButton('Decline', 'outline')}${actionButton('PDF', 'outline', 'download')}
${fakeDocument()} ${this.signFields.map((field) => { const filled = this.signedFieldIds.includes(field.id); const active = this.activeFieldId === field.id && !filled; return html`
!filled ? this.signField(field.id) : undefined}>${filled ? this.renderSignedValue(field) : html`${icon(this.fieldIcon(field.type), 12)}${active ? html`` : ''}${field.label}`}
`; })}
Page 1 of ${document.pages}
SC
Hi, Sarah
sarah@acme.com
Your progress
${completed} / ${this.signFields.length}
${this.signFields.length - completed === 0 ? 'All fields complete' : `${this.signFields.length - completed} fields remaining`}
Step by step
${this.signFields.map((field, index) => { const filled = this.signedFieldIds.includes(field.id); const active = this.activeFieldId === field.id && !filled; return html`
!filled ? this.activeFieldId = field.id : undefined}>${filled ? '✓' : index + 1}
${field.label}
${field.type} · page ${field.page}
${active ? icon('chevronRight', 12) : ''}
`; })}
By signing, you agree to the ESIGN Act & eIDAS terms.
IP 81.221.4.18 · Brussels, BE
`; } }