@operato/input 10.29.30 → 10.29.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/coverage/lcov-report/base.css +224 -0
  3. package/coverage/lcov-report/block-navigation.js +87 -0
  4. package/coverage/lcov-report/favicon.png +0 -0
  5. package/coverage/lcov-report/index.html +776 -0
  6. package/coverage/lcov-report/prettify.css +1 -0
  7. package/coverage/lcov-report/prettify.js +2 -0
  8. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  9. package/coverage/lcov-report/sorter.js +210 -0
  10. package/coverage/lcov-report/webpack/bootstrap.html +118 -0
  11. package/coverage/lcov-report/webpack/index.html +116 -0
  12. package/coverage/lcov-report/webpack/runtime/define property getters.html +118 -0
  13. package/coverage/lcov-report/webpack/runtime/global.html +118 -0
  14. package/coverage/lcov-report/webpack/runtime/hasOwnProperty shorthand.html +118 -0
  15. package/coverage/lcov-report/webpack/runtime/index.html +161 -0
  16. package/coverage/lcov-report/webpack/runtime/make namespace object.html +118 -0
  17. package/coverage/lcov.info +46428 -0
  18. package/dist/src/ox-form-field.js +5 -0
  19. package/dist/src/ox-form-field.js.map +1 -1
  20. package/dist/src/ox-input-file.d.ts +59 -0
  21. package/dist/src/ox-input-file.js +302 -41
  22. package/dist/src/ox-input-file.js.map +1 -1
  23. package/dist/test/ox-input-file.test.d.ts +1 -0
  24. package/dist/test/ox-input-file.test.js +202 -0
  25. package/dist/test/ox-input-file.test.js.map +1 -0
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +4 -4
  28. package/test/ox-input-file.test.ts +267 -0
  29. package/translations/en.json +9 -0
  30. package/translations/es.json +9 -0
  31. package/translations/ja.json +9 -0
  32. package/translations/ko.json +9 -0
  33. package/translations/ms.json +9 -0
  34. package/translations/zh.json +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-file.js","sourceRoot":"","sources":["../../src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Ae;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA0C;AAErE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;iDAC1C;AAE7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;mDAC1C;AAET;IAArB,KAAK,CAAC,aAAa,CAAC;8CAA6B;AA5FvC,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAkMvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { FileDropHelper } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { InputStyles } from './input-styles.js'\n\n@customElement('ox-input-file')\nexport class OxInputFile extends OxFormField {\n static styles = [\n InputStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n border-radius: var(--md-sys-shape-corner-small);\n align-items: center;\n justify-content: center;\n padding: calc(var(--ox-input-gap) * 2);\n min-height: 100px;\n text-transform: capitalize;\n\n border: 1px dashed var(--md-sys-color-outline-variant);\n background-color: var(--md-sys-color-surface);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n }\n :host > span {\n color: var(--md-sys-color-primary);\n font-weight: var(--md-sys-typescale-label-medium-weight, var(--md-ref-typeface-weight-medium, 500));\n }\n\n :host > md-icon {\n color: var(--md-sys-color-primary);\n --md-icon-size: var(--file-uploader-icon-size, 36px);\n }\n\n :host(.candrop) {\n background-color: var(--md-sys-color-primary-fixed);\n border: 1px dashed var(--md-sys-color-primary-fixed-dim);\n }\n\n #input-file {\n display: none;\n }\n\n label {\n position: relative;\n width: auto;\n border: none;\n text-transform: capitalize;\n\n padding: var(--file-uploader-label-padding);\n border-radius: var(--file-uploader-label-border-radius);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-surface-variant);\n }\n\n ul {\n max-width: 500px;\n width: 100%;\n list-style: none;\n margin: 5px 0 0 0;\n padding: 0;\n max-height: 46px;\n overflow: auto;\n background-color: var(--md-sys-color-on-primary);\n }\n li {\n text-align: left;\n\n padding: 3px 5px 2px 5px;\n border-bottom: var(--file-uploader-li-border-bottom);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n display: flex;\n align-items: center;\n }\n li md-icon {\n cursor: pointer;\n font-size: var(--icon-size-small);\n margin-left: auto;\n }\n li md-icon:hover,\n li md-icon:active {\n color: var(--md-sys-color-error);\n }\n `\n ]\n\n @property({ type: Boolean }) multiple?: boolean\n @property({ type: String }) accept?: string\n @property({ type: String }) icon?: string = 'upload'\n @property({ type: String }) label?: string\n @property({ type: String }) description?: string = 'drop files here!'\n @property({ type: Boolean, reflect: true, attribute: 'hide-filelist' })\n hideFileList: boolean = false\n @property({ type: Boolean, reflect: true, attribute: 'attach-filelist' })\n attachFileList: boolean = false\n\n @query('#input-file') fileInput!: HTMLInputElement\n\n render() {\n var files: File[] = this.value || []\n\n return html`\n <md-icon>${this.icon || 'upload'}</md-icon>\n\n <span>${this.description || 'drop files here!'}</span>\n\n <input\n id=\"input-file\"\n type=\"file\"\n accept=${this.accept}\n ?multiple=${this.multiple}\n hidden\n capture=\"environment\"\n @change=${(e: Event) => this._onChangeValue(e)}\n ?disabled=${this.disabled}\n />\n\n <label for=\"input-file\">${this.label || 'select files'}</label>\n\n ${!this.hideFileList && files?.length\n ? html` <ul>\n ${files.map(\n file => html`\n <li>\n - ${file.name}\n <md-icon\n @click=${(e: Event) => {\n if (this.disabled) {\n return\n }\n files.splice(files.indexOf(file), 1)\n this.value = [...files]\n this._notifyChange()\n }}\n >delete_outline</md-icon\n >\n </li>\n `\n )}\n </ul>`\n : html``}\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && !(this.value instanceof Array)) {\n this.value = !this.value ? [] : [this.value]\n }\n }\n\n firstUpdated() {\n FileDropHelper.set(this)\n\n this.addEventListener('file-drop', (e: Event) => {\n if (this.disabled) {\n return\n }\n\n const detail = (e as CustomEvent).detail\n this.value = this.multiple ? detail : detail[0] ? [detail[0]] : []\n\n this._notifyChange()\n })\n }\n\n get files() {\n return this.value\n }\n\n reset() {\n this.fileInput.value = ''\n this.value = []\n\n this._notifyChange()\n }\n\n _onChangeValue(e: Event) {\n const fileInput = e.currentTarget as HTMLInputElement\n const files = this.value || []\n\n this.value = this.attachFileList\n ? [...files, ...Array.from(fileInput.files as FileList)]\n : [...Array.from(fileInput.files as FileList)]\n\n fileInput.files = null\n\n this._notifyChange()\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-file.js","sourceRoot":"","sources":["../../src/ox-input-file.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAiC,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE/H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,WAAW,EA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AAiB,EAAE,CAAC;mDAC1C;AAGa;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAuB;AAGlC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAyB;AAMkB;IAAzE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;mDAAgC;AAMzE;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAA0B;AAGb;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAuB;AAGtC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAkB;AAEvB;IAArB,KAAK,CAAC,aAAa,CAAC;8CAA6B;AAEjC;IAAhB,KAAK,EAAE;6CAAqC;AAC5B;IAAhB,KAAK,EAAE;kDAAwE;AArLrE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA2cvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, nothing, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { actionHeight, ButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { FileDropHelper, FileRefusal, FileUploadLimits, fileUploadLimits, narrowLimits, sortPickedFiles } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { InputStyles } from './input-styles.js'\n\nconst megabytes = (bytes: number) =>\n bytes >= 1048576 ? `${Math.round((bytes / 1048576) * 10) / 10}MB` : `${Math.max(1, Math.round(bytes / 1024))}KB`\n\n/**\n * Picks files — the one picker for every screen.\n *\n * Two looks:\n * (default) a drop box, for a screen where the file is the subject (an import, an attachment gallery)\n * quiet text buttons only — 「첨부」, then the picked name with 「바꾸기」「빼기」 — for a screen that is\n * read first (a 360 section, a form row). The drop area is `dropTarget` (the section) and\n * shows only while a file is dragged over it.\n *\n * Both refuse on the spot what the server would refuse after the upload: a type outside `accept`\n * (a drop skips the native filter), a file over the server's size limit, more files than it takes.\n * The limits are the server's own numbers (`fileUploadLimits` in @operato/utils), never written here.\n *\n * The owner uploads; while it does, it sets `progress` (0‒1) and the picker shows it.\n *\n * A panel with its own look styles the quiet buttons through `::part(attach | replace | remove)` and puts its\n * own icon in the attach button through `slot=\"icon\"`. File names are shown as written.\n */\n@customElement('ox-input-file')\nexport class OxInputFile extends OxFormField {\n static styles = [\n InputStyles,\n ScrollbarStyles,\n ButtonStyles,\n css`\n :host(:not([quiet])) {\n display: flex;\n flex-direction: column;\n border-radius: var(--md-sys-shape-corner-small);\n align-items: center;\n justify-content: center;\n padding: calc(var(--ox-input-gap) * 2);\n min-height: 100px;\n\n border: 1px dashed var(--md-sys-color-outline-variant);\n background-color: var(--md-sys-color-surface);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n }\n :host(:not([quiet])) > span {\n color: var(--md-sys-color-primary);\n font-weight: var(--md-sys-typescale-label-medium-weight, var(--md-ref-typeface-weight-medium, 500));\n }\n\n :host(:not([quiet])) > md-icon {\n color: var(--md-sys-color-primary);\n --md-icon-size: var(--file-uploader-icon-size, 36px);\n }\n\n :host(.candrop:not([quiet])) {\n background-color: var(--md-sys-color-primary-fixed);\n border: 1px dashed var(--md-sys-color-primary-fixed-dim);\n }\n\n #input-file {\n display: none;\n }\n\n label {\n position: relative;\n width: auto;\n border: none;\n\n padding: var(--file-uploader-label-padding);\n border-radius: var(--file-uploader-label-border-radius);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-surface-variant);\n }\n\n ul {\n max-width: 500px;\n width: 100%;\n list-style: none;\n margin: 5px 0 0 0;\n padding: 0;\n max-height: 46px;\n overflow: auto;\n background-color: var(--md-sys-color-on-primary);\n }\n li {\n text-align: left;\n\n padding: 3px 5px 2px 5px;\n border-bottom: var(--file-uploader-li-border-bottom);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n display: flex;\n align-items: center;\n }\n li md-icon {\n cursor: pointer;\n font-size: var(--icon-size-small);\n margin-left: auto;\n }\n li md-icon:hover,\n li md-icon:active {\n color: var(--md-sys-color-error);\n }\n\n /* ── quiet ── no box: the words are the control. */\n /* --ox-actions-align: a section heading's actions slot says end, and the refusal line follows it. */\n :host([quiet]) {\n display: inline-flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: var(--ox-actions-align, start);\n gap: var(--spacing-small, 4px);\n /* The name reads at the size of what is around it (a form row, a heading); the buttons keep theirs. */\n font-size: inherit;\n color: var(--md-sys-color-on-surface);\n border-radius: var(--md-sys-shape-corner-small, 4px);\n }\n\n :host([quiet].candrop) {\n outline: 1px dashed var(--md-sys-color-primary);\n outline-offset: 2px;\n }\n\n .picked {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n min-width: 0;\n }\n\n .picked .name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: var(--ox-input-file-name-width, 24em);\n }\n\n .picked .size,\n .progress {\n color: var(--md-sys-color-on-surface-variant);\n font-variant-numeric: tabular-nums;\n }\n\n /* A place that is tapped with a thumb (a phone form) raises it; a heading or a row keeps the cell height. */\n :host([quiet]) button {\n height: var(--ox-input-file-action-height, ${actionHeight('--cell-action-height')});\n }\n\n .picked md-icon {\n --md-icon-size: 16px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .picked img {\n width: 20px;\n height: 20px;\n object-fit: cover;\n border-radius: 2px;\n }\n\n .refusal {\n flex-basis: 100%;\n text-align: var(--ox-actions-align, start);\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n ]\n\n @property({ type: Boolean }) multiple?: boolean\n @property({ type: String }) accept?: string\n /** The drop box's icon (upload when not given); in the quiet look, shown before the attach word only when given. */\n @property({ type: String }) icon?: string\n @property({ type: String }) label?: string\n @property({ type: String }) description?: string\n @property({ type: Boolean, reflect: true, attribute: 'hide-filelist' })\n hideFileList: boolean = false\n @property({ type: Boolean, reflect: true, attribute: 'attach-filelist' })\n attachFileList: boolean = false\n\n /** Text buttons instead of the drop box — for a screen that is read first. */\n @property({ type: Boolean, reflect: true }) quiet: boolean = false\n\n /** Where a file may be dropped. The picker itself when not given; a 360 passes its section. */\n @property({ attribute: false }) dropTarget?: HTMLElement\n\n /**\n * The owner's own button (a page action) calls `pick()`: the picker draws no button of its own, only what it\n * refused and the upload progress, where the owner placed it.\n */\n @property({ type: Boolean, reflect: true, attribute: 'outside-trigger' }) outsideTrigger: boolean = false\n\n /**\n * A screen's own limits, handed down by the server (an AI mode's attachment policy) — never written on the screen.\n * The picker uses the tighter of these and the server's upload limits.\n */\n @property({ attribute: false }) limits?: FileUploadLimits\n\n /** The file is read in the browser and never uploaded: the server's upload limits do not apply (accept still does). */\n @property({ type: Boolean, reflect: true }) local: boolean = false\n\n /** Upload progress 0‒1, set by the owner while it uploads; the buttons wait meanwhile. */\n @property({ type: Number }) progress?: number\n\n @query('#input-file') fileInput!: HTMLInputElement\n\n @state() private refusals: FileRefusal[] = []\n @state() private refusalLimits: { maxFileSize?: number; maxFiles?: number } = {}\n\n private dropArea?: HTMLElement\n private undoDrop?: () => void\n private previews = new Map<File, string>()\n\n private onFileDrop = (e: Event) => {\n if (this.disabled || this.readonly || this.uploading) {\n return\n }\n\n const files = (e as CustomEvent).detail as File[]\n this.take(this.multiple ? files : files.slice(0, 1))\n }\n\n private get uploading() {\n return typeof this.progress === 'number'\n }\n\n render() {\n return this.quiet ? this.renderQuiet() : this.renderBox()\n }\n\n private renderInput() {\n return html`<input\n id=\"input-file\"\n type=\"file\"\n accept=${this.accept || ''}\n ?multiple=${this.multiple}\n hidden\n capture=\"environment\"\n @change=${(e: Event) => this._onChangeValue(e)}\n ?disabled=${this.disabled || this.readonly}\n />`\n }\n\n private renderBox() {\n var files: File[] = this.value || []\n\n return html`\n <md-icon>${this.icon || 'upload'}</md-icon>\n\n <span>${this.description || i18next.t('text.drop files here', { defaultValue: 'drop files here!' })}</span>\n\n ${this.renderInput()}\n\n <label for=\"input-file\">${this.label || i18next.t('label.select files', { defaultValue: 'select files' })}</label>\n\n ${!this.hideFileList && files?.length\n ? html` <ul>\n ${files.map(\n file => html`\n <li>\n - ${file.name}\n <md-icon\n @click=${(e: Event) => {\n if (this.disabled) {\n return\n }\n this.removeFile(file)\n }}\n >delete_outline</md-icon\n >\n </li>\n `\n )}\n </ul>`\n : html``}\n ${this.renderRefusals()} ${this.renderProgress()}\n `\n }\n\n private renderQuiet() {\n const files: File[] = this.value || []\n const busy = this.disabled || this.readonly || this.uploading\n const shown = this.hideFileList ? [] : files\n\n if (this.outsideTrigger) {\n return html`${this.renderInput()} ${this.renderProgress()} ${this.renderRefusals()}`\n }\n\n return html`\n ${this.renderInput()}\n ${shown.map(\n file => html`<span class=\"picked\">\n ${this.renderKind(file)}\n <span class=\"name\" title=${file.name}>${file.name}</span>\n <span class=\"size\">${megabytes(file.size)}</span>\n ${!this.multiple\n ? html`<button type=\"button\" part=\"replace\" quiet small ?disabled=${busy} @click=${() => this.pick()}>\n ${i18next.t('label.replace file', { defaultValue: 'replace' })}\n </button>`\n : nothing}\n <button type=\"button\" part=\"remove\" quiet small danger ?disabled=${busy} @click=${() => this.removeFile(file)}>\n ${i18next.t('label.remove file', { defaultValue: 'remove' })}\n </button>\n </span>`\n )}\n ${this.multiple || !shown.length\n ? html`<button type=\"button\" part=\"attach\" quiet small ?disabled=${busy} @click=${() => this.pick()}>\n <slot name=\"icon\">${this.icon ? html`<md-icon>${this.icon}</md-icon>` : nothing}</slot>${this.label || i18next.t('label.attach file', { defaultValue: 'attach' })}\n </button>`\n : nothing}\n ${this.renderProgress()} ${this.renderRefusals()}\n `\n }\n\n /* A picture shows itself; anything else is told by its kind. */\n private renderKind(file: File) {\n const preview = this.previews.get(file)\n if (preview) return html`<img src=${preview} alt=\"\" />`\n\n const icon = file.type === 'application/pdf' ? 'picture_as_pdf' : 'draft'\n return html`<md-icon>${icon}</md-icon>`\n }\n\n private renderProgress() {\n if (!this.uploading) return nothing\n\n const percent = Math.round(Math.min(1, Math.max(0, this.progress!)) * 100)\n return html`<span class=\"progress\" role=\"status\">\n ${i18next.t('text.uploading file', { percent, defaultValue: `uploading ${percent}%` })}\n </span>`\n }\n\n private renderRefusals() {\n if (!this.refusals.length) return nothing\n\n const { maxFileSize, maxFiles } = this.refusalLimits\n return html`<div class=\"refusal\" role=\"alert\">\n ${this.refusals.map(({ file, reason }) =>\n reason === 'type'\n ? i18next.t('text.file refused for type', { name: file.name, defaultValue: `${file.name}: not a type taken here` })\n : reason === 'size'\n ? i18next.t('text.file refused for size', {\n name: file.name,\n limit: megabytes(maxFileSize!),\n defaultValue: `${file.name}: over ${megabytes(maxFileSize!)}`\n })\n : i18next.t('text.file refused for count', {\n name: file.name,\n limit: maxFiles,\n defaultValue: `${file.name}: ${maxFiles} files at most`\n })\n ).join(' · ')}\n </div>`\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && !(this.value instanceof Array)) {\n this.value = !this.value ? [] : [this.value]\n }\n\n if (changes.has('value')) {\n this.syncPreviews()\n }\n\n if (changes.has('dropTarget')) {\n this.setDropArea()\n }\n }\n\n connectedCallback() {\n super.connectedCallback()\n if (this.hasUpdated) this.setDropArea()\n }\n\n firstUpdated() {\n this.setDropArea()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.undoDrop?.()\n this.dropArea?.removeEventListener('file-drop', this.onFileDrop)\n this.undoDrop = this.dropArea = undefined\n\n this.previews.forEach(url => URL.revokeObjectURL(url))\n this.previews.clear()\n }\n\n private setDropArea() {\n const area: HTMLElement = this.dropTarget || (this as HTMLElement)\n if (area === this.dropArea) return\n\n this.undoDrop?.()\n this.dropArea?.removeEventListener('file-drop', this.onFileDrop)\n\n this.dropArea = area\n this.undoDrop = FileDropHelper.set(area)\n area.addEventListener('file-drop', this.onFileDrop)\n }\n\n private syncPreviews() {\n const files: File[] = this.value || []\n\n this.previews.forEach((url, file) => {\n if (!files.includes(file)) {\n URL.revokeObjectURL(url)\n this.previews.delete(file)\n }\n })\n\n if (!this.quiet) return\n\n files.forEach(file => {\n if (!this.previews.has(file) && file.type?.startsWith('image/')) {\n this.previews.set(file, URL.createObjectURL(file))\n }\n })\n }\n\n get files() {\n return this.value\n }\n\n /** Opens the file dialog — for an owner whose own button starts the pick. */\n pick() {\n if (this.disabled || this.readonly || this.uploading) return\n this.fileInput?.click()\n }\n\n reset() {\n if (this.fileInput) this.fileInput.value = ''\n this.value = []\n this.refusals = []\n\n this._notifyChange()\n }\n\n private removeFile(file: File) {\n const files: File[] = this.value || []\n\n this.value = files.filter(one => one !== file)\n this.refusals = []\n this._notifyChange()\n }\n\n private async take(picked: File[]) {\n const files: File[] = this.value || []\n const keep = this.attachFileList\n const limits = this.local ? narrowLimits(this.limits) : narrowLimits(this.limits, await fileUploadLimits())\n\n const { taken, refused } = sortPickedFiles(picked, {\n accept: this.accept,\n limits,\n already: keep ? files.length : 0\n })\n\n this.refusals = refused\n this.refusalLimits = limits\n\n if (!taken.length) return\n\n this.value = keep ? [...files, ...taken] : taken\n this._notifyChange()\n }\n\n _onChangeValue(e: Event) {\n const fileInput = e.currentTarget as HTMLInputElement\n const picked = Array.from(fileInput.files as FileList)\n\n /* The same file picked again must still raise change. */\n fileInput.value = ''\n\n this.take(picked)\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ import '../src/ox-input-file.js';
@@ -0,0 +1,202 @@
1
+ import { aTimeout, expect, fixture } from '@open-wc/testing';
2
+ import { html } from 'lit';
3
+ import { registerFileUploadLimits } from '@operato/utils';
4
+ import '../src/ox-input-file.js';
5
+ /**
6
+ * The one file picker.
7
+ *
8
+ * ## Why this is tested
9
+ *
10
+ * Every screen that takes a file goes through this element, and a 360 uses its quiet look. What
11
+ * must hold:
12
+ *
13
+ * ```
14
+ * quiet no box: an attach button; once picked, the name with replace and remove
15
+ * refusal a type outside accept or a file over the server's limit never becomes the value,
16
+ * and says so in place — a drop skips the native accept filter
17
+ * drop target a drop lands on the element the owner gives (a 360 section), and only there
18
+ * progress while the owner uploads, the buttons wait and the percent shows
19
+ * ```
20
+ */
21
+ describe('ox-input-file', () => {
22
+ const file = (name, type, size = 10) => new File([new Uint8Array(size)], name, { type });
23
+ const drop = (area, ...files) => {
24
+ const dataTransfer = new DataTransfer();
25
+ files.forEach(one => dataTransfer.items.add(one));
26
+ area.dispatchEvent(new DragEvent('drop', { dataTransfer, bubbles: true, cancelable: true }));
27
+ };
28
+ const settle = async (el) => {
29
+ await aTimeout(0);
30
+ await el.updateComplete;
31
+ };
32
+ const buttons = (el) => [...el.renderRoot.querySelectorAll('button')];
33
+ /* The theme token the box border is drawn with; without it the border falls away and every look reads 'none'. */
34
+ before(() => document.documentElement.style.setProperty('--md-sys-color-outline-variant', 'gray'));
35
+ after(() => document.documentElement.style.removeProperty('--md-sys-color-outline-variant'));
36
+ afterEach(() => registerFileUploadLimits(async () => ({})));
37
+ it('draws no box when quiet, and shows the picked name with replace and remove', async () => {
38
+ const el = await fixture(html `<ox-input-file quiet accept="image/*,application/pdf"></ox-input-file>`);
39
+ expect(getComputedStyle(el).borderTopStyle, 'quiet still draws a box').to.equal('none');
40
+ expect(buttons(el).length, 'one attach button before a pick').to.equal(1);
41
+ let changes = 0;
42
+ el.addEventListener('change', () => changes++);
43
+ drop(el, file('paper.pdf', 'application/pdf'));
44
+ await settle(el);
45
+ expect(el.value.map((one) => one.name)).to.deep.equal(['paper.pdf']);
46
+ expect(el.renderRoot.querySelector('.picked .name').textContent).to.equal('paper.pdf');
47
+ expect(buttons(el).length, 'replace and remove').to.equal(2);
48
+ const remove = buttons(el).find(one => one.hasAttribute('danger'));
49
+ remove.click();
50
+ await el.updateComplete;
51
+ expect(el.value).to.deep.equal([]);
52
+ expect(changes).to.equal(2);
53
+ });
54
+ it('refuses a type outside accept and a file over the server limit, in place', async () => {
55
+ registerFileUploadLimits(async () => ({ maxFileSize: 20 }));
56
+ const el = await fixture(html `<ox-input-file quiet multiple accept="image/*"></ox-input-file>`);
57
+ drop(el, file('note.txt', 'text/plain'), file('big.png', 'image/png', 50), file('ok.png', 'image/png', 5));
58
+ await settle(el);
59
+ expect(el.value.map((one) => one.name)).to.deep.equal(['ok.png']);
60
+ const refusal = el.renderRoot.querySelector('[role="alert"]');
61
+ expect(refusal, 'no refusal shown').to.exist;
62
+ expect(refusal.textContent).to.contain('note.txt');
63
+ expect(refusal.textContent).to.contain('big.png');
64
+ });
65
+ it('takes a drop on the given target and lets go of the old one', async () => {
66
+ const section = document.createElement('section');
67
+ const other = document.createElement('section');
68
+ document.body.append(section, other);
69
+ const el = await fixture(html `<ox-input-file quiet .dropTarget=${section}></ox-input-file>`);
70
+ drop(section, file('a.pdf', 'application/pdf'));
71
+ await settle(el);
72
+ expect(el.value.map((one) => one.name)).to.deep.equal(['a.pdf']);
73
+ el.dropTarget = other;
74
+ await el.updateComplete;
75
+ drop(section, file('b.pdf', 'application/pdf'));
76
+ await settle(el);
77
+ expect(el.value.map((one) => one.name), 'the old target still takes drops').to.deep.equal(['a.pdf']);
78
+ section.dispatchEvent(new DragEvent('dragenter', { bubbles: true }));
79
+ expect(section.classList.contains('candrop'), 'the old target still lights up').to.equal(false);
80
+ drop(other, file('c.pdf', 'application/pdf'));
81
+ await settle(el);
82
+ expect(el.value.map((one) => one.name)).to.deep.equal(['c.pdf']);
83
+ section.remove();
84
+ other.remove();
85
+ });
86
+ it('waits while the owner uploads and shows the percent', async () => {
87
+ const el = await fixture(html `<ox-input-file quiet .progress=${0.4}></ox-input-file>`);
88
+ expect(buttons(el).every(one => one.disabled), 'a button works mid-upload').to.equal(true);
89
+ expect(el.renderRoot.querySelector('[role="status"]').textContent).to.contain('40');
90
+ drop(el, file('a.pdf', 'application/pdf'));
91
+ await settle(el);
92
+ expect(el.value ?? [], 'a drop landed mid-upload').to.deep.equal([]);
93
+ });
94
+ it('keeps its button at the end where its place says so, with the refusal under it', async () => {
95
+ const wrap = await fixture(html `<div style="--ox-actions-align: end; display: flex; justify-content: flex-end; width: 400px">
96
+ <ox-input-file quiet accept="image/*"></ox-input-file>
97
+ </div>`);
98
+ const el = wrap.querySelector('ox-input-file');
99
+ drop(el, file('a-rather-long-file-name-that-was-refused.txt', 'text/plain'));
100
+ await settle(el);
101
+ const host = el.getBoundingClientRect();
102
+ const button = buttons(el)[0].getBoundingClientRect();
103
+ const refusal = el.renderRoot.querySelector('[role="alert"]');
104
+ expect(Math.abs(host.right - button.right), 'the button left the end').to.be.below(1);
105
+ expect(getComputedStyle(refusal).textAlign).to.equal('end');
106
+ });
107
+ it('writes the picked name at the size of its surroundings', async () => {
108
+ const wrap = await fixture(html `<div style="font-size: 11px"><ox-input-file quiet></ox-input-file></div>`);
109
+ const el = wrap.querySelector('ox-input-file');
110
+ drop(el, file('a.pdf', 'application/pdf'));
111
+ await settle(el);
112
+ expect(getComputedStyle(el.renderRoot.querySelector('.picked .name')).fontSize).to.equal('11px');
113
+ });
114
+ it('starts at the start when nothing says otherwise', async () => {
115
+ const el = await fixture(html `<ox-input-file quiet accept="image/*"></ox-input-file>`);
116
+ drop(el, file('a-rather-long-file-name-that-was-refused.txt', 'text/plain'));
117
+ await settle(el);
118
+ expect(Math.abs(el.getBoundingClientRect().left - buttons(el)[0].getBoundingClientRect().left)).to.be.below(1);
119
+ });
120
+ it('shows an icon only when given one, and takes its button height from its place', async () => {
121
+ const plain = await fixture(html `<ox-input-file quiet></ox-input-file>`);
122
+ expect(!!buttons(plain)[0].querySelector('md-icon'), 'an icon nobody asked for').to.equal(false);
123
+ const wrap = await fixture(html `<div style="--ox-input-file-action-height: 40px">
124
+ <ox-input-file quiet icon="photo_camera" label="take"></ox-input-file>
125
+ </div>`);
126
+ const camera = wrap.querySelector('ox-input-file');
127
+ const button = buttons(camera)[0];
128
+ expect(button.querySelector('md-icon')?.textContent).to.equal('photo_camera');
129
+ expect(button.getBoundingClientRect().height).to.equal(40);
130
+ });
131
+ it('draws no button of its own when a page action starts the pick, and still refuses in place', async () => {
132
+ const el = await fixture(html `<ox-input-file quiet outside-trigger accept="application/pdf"></ox-input-file>`);
133
+ expect(buttons(el).length, 'a second trigger beside the page action').to.equal(0);
134
+ let opened = 0;
135
+ el.fileInput.click = () => opened++;
136
+ el.pick();
137
+ expect(opened, 'pick() did not open the dialog').to.equal(1);
138
+ drop(el, file('register.xlsx', 'application/vnd.ms-excel'));
139
+ await settle(el);
140
+ expect(!!el.renderRoot.querySelector('[role="alert"]'), 'the refusal is not shown').to.equal(true);
141
+ });
142
+ it('leaves the server limits out for a file read in the browser, and still checks the type', async () => {
143
+ registerFileUploadLimits(async () => ({ maxFileSize: 20 }));
144
+ const el = await fixture(html `<ox-input-file quiet local accept=".json"></ox-input-file>`);
145
+ drop(el, file('samples.json', 'application/json', 50));
146
+ await settle(el);
147
+ expect(el.value.map((one) => one.name), 'a local file was held to the upload limit').to.deep.equal(['samples.json']);
148
+ drop(el, file('notes.txt', 'text/plain'));
149
+ await settle(el);
150
+ expect(el.value.map((one) => one.name)).to.deep.equal(['samples.json']);
151
+ expect(!!el.renderRoot.querySelector('[role="alert"]')).to.equal(true);
152
+ });
153
+ it('takes a screen limit tighter than the server, and never a looser one', async () => {
154
+ registerFileUploadLimits(async () => ({ maxFileSize: 100 }));
155
+ const el = await fixture(html `<ox-input-file quiet multiple .limits=${{ maxFileSize: 20 }}></ox-input-file>`);
156
+ drop(el, file('small.png', 'image/png', 10), file('middle.png', 'image/png', 50));
157
+ await settle(el);
158
+ expect(el.value.map((one) => one.name), 'the screen limit was not applied').to.deep.equal(['small.png']);
159
+ el.limits = { maxFileSize: 1000 };
160
+ drop(el, file('large.png', 'image/png', 500));
161
+ await settle(el);
162
+ expect(el.value.map((one) => one.name), 'a screen loosened the server limit').to.deep.equal(['small.png']);
163
+ });
164
+ it('shows a file name as written, in the box and in a refusal', async () => {
165
+ const el = await fixture(html `<ox-input-file accept="image/*"></ox-input-file>`);
166
+ drop(el, file('notes.txt', 'text/plain'));
167
+ await settle(el);
168
+ expect(getComputedStyle(el.renderRoot.querySelector('[role="alert"]')).textTransform, 'the refusal recased the name').to.equal('none');
169
+ el.accept = '';
170
+ drop(el, file('model.figpkg', ''));
171
+ await settle(el);
172
+ expect(getComputedStyle(el.renderRoot.querySelector('li')).textTransform, 'the list recased the name').to.equal('none');
173
+ });
174
+ it('lets a panel style its quiet buttons by part and give the attach button its own icon', async () => {
175
+ const el = await fixture(html `<ox-input-file quiet><span slot="icon" id="tile">▣</span></ox-input-file>`);
176
+ const attach = el.renderRoot.querySelector('[part="attach"]');
177
+ expect(!!attach, 'no attach part').to.equal(true);
178
+ const slot = attach.querySelector('slot[name="icon"]');
179
+ expect(slot.assignedElements().map(one => one.id)).to.deep.equal(['tile']);
180
+ drop(el, file('a.pdf', 'application/pdf'));
181
+ await settle(el);
182
+ expect([...el.renderRoot.querySelectorAll('[part]')].map((one) => one.getAttribute('part'))).to.deep.equal(['replace', 'remove']);
183
+ });
184
+ it('hands its files to the form data as files', async () => {
185
+ const form = await fixture(html `<form><ox-input-file name="papers" multiple></ox-input-file></form>`);
186
+ const el = form.querySelector('ox-input-file');
187
+ drop(el, file('a.pdf', 'application/pdf'), file('b.png', 'image/png'));
188
+ await settle(el);
189
+ const sent = new FormData(form).getAll('papers');
190
+ expect(sent.every(one => one instanceof File), 'a file went as text').to.equal(true);
191
+ expect(sent.map(one => one.name)).to.deep.equal(['a.pdf', 'b.png']);
192
+ });
193
+ it('keeps the drop box when not quiet', async () => {
194
+ const el = await fixture(html `<ox-input-file></ox-input-file>`);
195
+ expect(getComputedStyle(el).borderTopStyle).to.equal('dashed');
196
+ expect(el.renderRoot.querySelector('label[for="input-file"]')).to.exist;
197
+ drop(el, file('a.bin', ''));
198
+ await settle(el);
199
+ expect(el.renderRoot.querySelectorAll('li').length).to.equal(1);
200
+ });
201
+ });
202
+ //# sourceMappingURL=ox-input-file.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-file.test.js","sourceRoot":"","sources":["../../test/ox-input-file.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,OAAO,yBAAyB,CAAA;AAEhC;;;;;;;;;;;;;;;GAeG;AACH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAExG,MAAM,IAAI,GAAG,CAAC,IAAiB,EAAE,GAAG,KAAa,EAAE,EAAE;QACnD,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;QACvC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QACjD,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9F,CAAC,CAAA;IAED,MAAM,MAAM,GAAG,KAAK,EAAE,EAAO,EAAE,EAAE;QAC/B,MAAM,QAAQ,CAAC,CAAC,CAAC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CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,EAAE,GAAQ,MAAM,OAAO,CAAC,IAAI,CAAA,iCAAiC,CAAC,CAAA;QAEpE,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC9D,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA;QAEvE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3B,MAAM,MAAM,CAAC,EAAE,CAAC,CAAA;QAChB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { aTimeout, expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport { registerFileUploadLimits } from '@operato/utils'\n\nimport '../src/ox-input-file.js'\n\n/**\n * The one file picker.\n *\n * ## Why this is tested\n *\n * Every screen that takes a file goes through this element, and a 360 uses its quiet look. What\n * must hold:\n *\n * ```\n * quiet no box: an attach button; once picked, the name with replace and remove\n * refusal a type outside accept or a file over the server's limit never becomes the value,\n * and says so in place — a drop skips the native accept filter\n * drop target a drop lands on the element the owner gives (a 360 section), and only there\n * progress while the owner uploads, the buttons wait and the percent shows\n * ```\n */\ndescribe('ox-input-file', () => {\n const file = (name: string, type: string, size = 10) => new File([new Uint8Array(size)], name, { type })\n\n const drop = (area: HTMLElement, ...files: File[]) => {\n const dataTransfer = new DataTransfer()\n files.forEach(one => dataTransfer.items.add(one))\n area.dispatchEvent(new DragEvent('drop', { dataTransfer, bubbles: true, cancelable: true }))\n }\n\n const settle = async (el: any) => {\n await aTimeout(0)\n await el.updateComplete\n }\n\n const buttons = (el: any) => [...el.renderRoot.querySelectorAll('button')] as HTMLButtonElement[]\n\n /* The theme token the box border is drawn with; without it the border falls away and every look reads 'none'. */\n before(() => document.documentElement.style.setProperty('--md-sys-color-outline-variant', 'gray'))\n after(() => document.documentElement.style.removeProperty('--md-sys-color-outline-variant'))\n\n afterEach(() => registerFileUploadLimits(async () => ({})))\n\n it('draws no box when quiet, and shows the picked name with replace and remove', async () => {\n const el: any = await fixture(html`<ox-input-file quiet accept=\"image/*,application/pdf\"></ox-input-file>`)\n\n expect(getComputedStyle(el).borderTopStyle, 'quiet still draws a box').to.equal('none')\n expect(buttons(el).length, 'one attach button before a pick').to.equal(1)\n\n let changes = 0\n el.addEventListener('change', () => changes++)\n\n drop(el, file('paper.pdf', 'application/pdf'))\n await settle(el)\n\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['paper.pdf'])\n expect(el.renderRoot.querySelector('.picked .name').textContent).to.equal('paper.pdf')\n expect(buttons(el).length, 'replace and remove').to.equal(2)\n\n const remove = buttons(el).find(one => one.hasAttribute('danger'))!\n remove.click()\n await el.updateComplete\n\n expect(el.value).to.deep.equal([])\n expect(changes).to.equal(2)\n })\n\n it('refuses a type outside accept and a file over the server limit, in place', async () => {\n registerFileUploadLimits(async () => ({ maxFileSize: 20 }))\n\n const el: any = await fixture(html`<ox-input-file quiet multiple accept=\"image/*\"></ox-input-file>`)\n\n drop(el, file('note.txt', 'text/plain'), file('big.png', 'image/png', 50), file('ok.png', 'image/png', 5))\n await settle(el)\n\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['ok.png'])\n\n const refusal = el.renderRoot.querySelector('[role=\"alert\"]')\n expect(refusal, 'no refusal shown').to.exist\n expect(refusal.textContent).to.contain('note.txt')\n expect(refusal.textContent).to.contain('big.png')\n })\n\n it('takes a drop on the given target and lets go of the old one', async () => {\n const section = document.createElement('section')\n const other = document.createElement('section')\n document.body.append(section, other)\n\n const el: any = await fixture(html`<ox-input-file quiet .dropTarget=${section}></ox-input-file>`)\n\n drop(section, file('a.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['a.pdf'])\n\n el.dropTarget = other\n await el.updateComplete\n\n drop(section, file('b.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name), 'the old target still takes drops').to.deep.equal(['a.pdf'])\n\n section.dispatchEvent(new DragEvent('dragenter', { bubbles: true }))\n expect(section.classList.contains('candrop'), 'the old target still lights up').to.equal(false)\n\n drop(other, file('c.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['c.pdf'])\n\n section.remove()\n other.remove()\n })\n\n it('waits while the owner uploads and shows the percent', async () => {\n const el: any = await fixture(html`<ox-input-file quiet .progress=${0.4}></ox-input-file>`)\n\n expect(buttons(el).every(one => one.disabled), 'a button works mid-upload').to.equal(true)\n expect(el.renderRoot.querySelector('[role=\"status\"]').textContent).to.contain('40')\n\n drop(el, file('a.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value ?? [], 'a drop landed mid-upload').to.deep.equal([])\n })\n\n it('keeps its button at the end where its place says so, with the refusal under it', async () => {\n const wrap: any = await fixture(html`<div style=\"--ox-actions-align: end; display: flex; justify-content: flex-end; width: 400px\">\n <ox-input-file quiet accept=\"image/*\"></ox-input-file>\n </div>`)\n const el: any = wrap.querySelector('ox-input-file')\n\n drop(el, file('a-rather-long-file-name-that-was-refused.txt', 'text/plain'))\n await settle(el)\n\n const host = el.getBoundingClientRect()\n const button = buttons(el)[0].getBoundingClientRect()\n const refusal = el.renderRoot.querySelector('[role=\"alert\"]')\n\n expect(Math.abs(host.right - button.right), 'the button left the end').to.be.below(1)\n expect(getComputedStyle(refusal).textAlign).to.equal('end')\n })\n\n it('writes the picked name at the size of its surroundings', async () => {\n const wrap: any = await fixture(html`<div style=\"font-size: 11px\"><ox-input-file quiet></ox-input-file></div>`)\n const el: any = wrap.querySelector('ox-input-file')\n\n drop(el, file('a.pdf', 'application/pdf'))\n await settle(el)\n\n expect(getComputedStyle(el.renderRoot.querySelector('.picked .name')).fontSize).to.equal('11px')\n })\n\n it('starts at the start when nothing says otherwise', async () => {\n const el: any = await fixture(html`<ox-input-file quiet accept=\"image/*\"></ox-input-file>`)\n\n drop(el, file('a-rather-long-file-name-that-was-refused.txt', 'text/plain'))\n await settle(el)\n\n expect(Math.abs(el.getBoundingClientRect().left - buttons(el)[0].getBoundingClientRect().left)).to.be.below(1)\n })\n\n it('shows an icon only when given one, and takes its button height from its place', async () => {\n const plain: any = await fixture(html`<ox-input-file quiet></ox-input-file>`)\n expect(!!buttons(plain)[0].querySelector('md-icon'), 'an icon nobody asked for').to.equal(false)\n\n const wrap: any = await fixture(html`<div style=\"--ox-input-file-action-height: 40px\">\n <ox-input-file quiet icon=\"photo_camera\" label=\"take\"></ox-input-file>\n </div>`)\n const camera: any = wrap.querySelector('ox-input-file')\n const button = buttons(camera)[0]\n\n expect(button.querySelector('md-icon')?.textContent).to.equal('photo_camera')\n expect(button.getBoundingClientRect().height).to.equal(40)\n })\n\n it('draws no button of its own when a page action starts the pick, and still refuses in place', async () => {\n const el: any = await fixture(html`<ox-input-file quiet outside-trigger accept=\"application/pdf\"></ox-input-file>`)\n\n expect(buttons(el).length, 'a second trigger beside the page action').to.equal(0)\n\n let opened = 0\n el.fileInput.click = () => opened++\n el.pick()\n expect(opened, 'pick() did not open the dialog').to.equal(1)\n\n drop(el, file('register.xlsx', 'application/vnd.ms-excel'))\n await settle(el)\n expect(!!el.renderRoot.querySelector('[role=\"alert\"]'), 'the refusal is not shown').to.equal(true)\n })\n\n it('leaves the server limits out for a file read in the browser, and still checks the type', async () => {\n registerFileUploadLimits(async () => ({ maxFileSize: 20 }))\n const el: any = await fixture(html`<ox-input-file quiet local accept=\".json\"></ox-input-file>`)\n\n drop(el, file('samples.json', 'application/json', 50))\n await settle(el)\n expect(el.value.map((one: File) => one.name), 'a local file was held to the upload limit').to.deep.equal(['samples.json'])\n\n drop(el, file('notes.txt', 'text/plain'))\n await settle(el)\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['samples.json'])\n expect(!!el.renderRoot.querySelector('[role=\"alert\"]')).to.equal(true)\n })\n\n it('takes a screen limit tighter than the server, and never a looser one', async () => {\n registerFileUploadLimits(async () => ({ maxFileSize: 100 }))\n const el: any = await fixture(html`<ox-input-file quiet multiple .limits=${{ maxFileSize: 20 }}></ox-input-file>`)\n\n drop(el, file('small.png', 'image/png', 10), file('middle.png', 'image/png', 50))\n await settle(el)\n expect(el.value.map((one: File) => one.name), 'the screen limit was not applied').to.deep.equal(['small.png'])\n\n el.limits = { maxFileSize: 1000 }\n drop(el, file('large.png', 'image/png', 500))\n await settle(el)\n expect(el.value.map((one: File) => one.name), 'a screen loosened the server limit').to.deep.equal(['small.png'])\n })\n\n it('shows a file name as written, in the box and in a refusal', async () => {\n const el: any = await fixture(html`<ox-input-file accept=\"image/*\"></ox-input-file>`)\n\n drop(el, file('notes.txt', 'text/plain'))\n await settle(el)\n expect(getComputedStyle(el.renderRoot.querySelector('[role=\"alert\"]')).textTransform, 'the refusal recased the name').to.equal('none')\n\n el.accept = ''\n drop(el, file('model.figpkg', ''))\n await settle(el)\n expect(getComputedStyle(el.renderRoot.querySelector('li')).textTransform, 'the list recased the name').to.equal('none')\n })\n\n it('lets a panel style its quiet buttons by part and give the attach button its own icon', async () => {\n const el: any = await fixture(html`<ox-input-file quiet><span slot=\"icon\" id=\"tile\">▣</span></ox-input-file>`)\n\n const attach = el.renderRoot.querySelector('[part=\"attach\"]')\n expect(!!attach, 'no attach part').to.equal(true)\n const slot = attach.querySelector('slot[name=\"icon\"]') as HTMLSlotElement\n expect(slot.assignedElements().map(one => one.id)).to.deep.equal(['tile'])\n\n drop(el, file('a.pdf', 'application/pdf'))\n await settle(el)\n expect([...el.renderRoot.querySelectorAll('[part]')].map((one: Element) => one.getAttribute('part'))).to.deep.equal(['replace', 'remove'])\n })\n\n it('hands its files to the form data as files', async () => {\n const form: any = await fixture(html`<form><ox-input-file name=\"papers\" multiple></ox-input-file></form>`)\n const el: any = form.querySelector('ox-input-file')\n\n drop(el, file('a.pdf', 'application/pdf'), file('b.png', 'image/png'))\n await settle(el)\n\n const sent = new FormData(form).getAll('papers') as File[]\n expect(sent.every(one => one instanceof File), 'a file went as text').to.equal(true)\n expect(sent.map(one => one.name)).to.deep.equal(['a.pdf', 'b.png'])\n })\n\n it('keeps the drop box when not quiet', async () => {\n const el: any = await fixture(html`<ox-input-file></ox-input-file>`)\n\n expect(getComputedStyle(el).borderTopStyle).to.equal('dashed')\n expect(el.renderRoot.querySelector('label[for=\"input-file\"]')).to.exist\n\n drop(el, file('a.bin', ''))\n await settle(el)\n expect(el.renderRoot.querySelectorAll('li').length).to.equal(1)\n })\n})\n"]}