) {
// ARCHITECTURE: Script Tag Pattern
// USWDS is loaded globally via script tag in .storybook/preview-head.html
// Components just render HTML - USWDS enhances automatically via window.USWDS
// ARCHITECTURE: USWDS-Mirrored Behavior Pattern
// Uses dedicated behavior file (usa-file-input-behavior.ts) that replicates USWDS source exactly
super.firstUpdated(changedProperties);
// Wait for DOM to be fully rendered
await this.updateComplete;
await new Promise((resolve) => requestAnimationFrame(() => resolve(undefined)));
// Initialize using mirrored USWDS behavior
this.cleanup = initializeFileInput(this);
}
override disconnectedCallback() {
super.disconnectedCallback();
this.cleanup?.();
}
private renderRequiredIndicator() {
return this.required
? html`*`
: '';
}
private renderHint() {
return this.hint
? html`${this.hint}
`
: '';
}
// Light DOM is handled by USWDSBaseComponent
override render() {
const groupClasses = ['usa-form-group', this.required ? 'usa-form-group--required' : '']
.filter(Boolean)
.join(' ');
const ariaDescribedBy = this.hint ? `${this.inputId}-hint` : '';
// Provide EXACTLY what USWDS file input expects:
// Simple input with usa-file-input class
// USWDS will create the full drag-and-drop structure
return html`
${this.renderHint()}
`;
}
}