@ministryofjustice/frontend 6.0.0 → 7.0.0

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 (29) hide show
  1. package/moj/all.bundle.js +16 -6
  2. package/moj/all.bundle.js.map +1 -1
  3. package/moj/all.bundle.mjs +16 -6
  4. package/moj/all.bundle.mjs.map +1 -1
  5. package/moj/common/moj-frontend-version.mjs +2 -2
  6. package/moj/common/moj-frontend-version.mjs.map +1 -1
  7. package/moj/components/date-picker/date-picker.bundle.js +11 -1
  8. package/moj/components/date-picker/date-picker.bundle.js.map +1 -1
  9. package/moj/components/date-picker/date-picker.bundle.mjs +11 -1
  10. package/moj/components/date-picker/date-picker.bundle.mjs.map +1 -1
  11. package/moj/components/date-picker/date-picker.mjs +11 -1
  12. package/moj/components/date-picker/date-picker.mjs.map +1 -1
  13. package/moj/components/messages/README.md +1 -1
  14. package/moj/components/multi-file-upload/multi-file-upload.bundle.js +3 -3
  15. package/moj/components/multi-file-upload/multi-file-upload.bundle.js.map +1 -1
  16. package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs +3 -3
  17. package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs.map +1 -1
  18. package/moj/components/multi-file-upload/multi-file-upload.mjs +3 -3
  19. package/moj/components/multi-file-upload/multi-file-upload.mjs.map +1 -1
  20. package/moj/components/pagination/template.njk +2 -2
  21. package/moj/components/timeline/README.md +1 -1
  22. package/moj/core/_moj-frontend-properties.scss +1 -1
  23. package/moj/moj-frontend.min.css +1 -1
  24. package/moj/moj-frontend.min.css.map +1 -1
  25. package/moj/moj-frontend.min.js +1 -1
  26. package/moj/moj-frontend.min.js.map +1 -1
  27. package/moj/objects/_scrollable-pane.scss +2 -2
  28. package/moj/objects/_scrollable-pane.scss.map +1 -1
  29. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"multi-file-upload.bundle.mjs","sources":["../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../node_modules/govuk-frontend/dist/govuk/common/configuration.mjs","../../../../src/moj/components/multi-file-upload/multi-file-upload.mjs"],"sourcesContent":["function getBreakpoint(name) {\n const property = `--govuk-breakpoint-${name}`;\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n return {\n property,\n value: value || undefined\n };\n}\nfunction setFocus($element, options = {}) {\n var _options$onBeforeFocu;\n const isFocusable = $element.getAttribute('tabindex');\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1');\n }\n function onFocus() {\n $element.addEventListener('blur', onBlur, {\n once: true\n });\n }\n function onBlur() {\n var _options$onBlur;\n (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n if (!isFocusable) {\n $element.removeAttribute('tabindex');\n }\n }\n $element.addEventListener('focus', onFocus, {\n once: true\n });\n (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n if (!$scope) {\n return false;\n }\n return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n return Array.isArray(option);\n}\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction isScope($scope) {\n return !!$scope && ($scope instanceof Element || $scope instanceof Document);\n}\nfunction formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\nexport { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { isObject, formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n constructor(...args) {\n super(...args);\n this.name = 'GOVUKFrontendError';\n }\n}\nclass SupportError extends GOVUKFrontendError {\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';\n super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n this.name = 'SupportError';\n }\n}\nclass ConfigError extends GOVUKFrontendError {\n constructor(...args) {\n super(...args);\n this.name = 'ConfigError';\n }\n}\nclass ElementError extends GOVUKFrontendError {\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n if (isObject(messageOrOptions)) {\n const {\n component,\n identifier,\n element,\n expectedType\n } = messageOrOptions;\n message = identifier;\n message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n if (component) {\n message = formatErrorMessage(component, message);\n }\n }\n super(message);\n this.name = 'ElementError';\n }\n}\nclass InitError extends GOVUKFrontendError {\n constructor(componentOrMessage) {\n const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n super(message);\n this.name = 'InitError';\n }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root;\n }\n constructor($root) {\n this._$root = void 0;\n const childConstructor = this.constructor;\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`);\n }\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n });\n } else {\n this._$root = $root;\n }\n childConstructor.checkSupport();\n this.checkInitialised();\n const moduleName = childConstructor.moduleName;\n this.$root.setAttribute(`data-${moduleName}-init`, '');\n }\n checkInitialised() {\n const constructor = this.constructor;\n const moduleName = constructor.moduleName;\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor);\n }\n }\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError();\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from '../component.mjs';\nimport { ConfigError } from '../errors/index.mjs';\nimport { isObject, formatErrorMessage, isScope } from './index.mjs';\n\nconst configOverride = Symbol.for('configOverride');\nclass ConfigurableComponent extends Component {\n [configOverride](param) {\n return {};\n }\n\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {ConfigurationType} - the root element of component\n */\n get config() {\n return this._config;\n }\n constructor($root, config) {\n super($root);\n this._config = void 0;\n const childConstructor = this.constructor;\n if (!isObject(childConstructor.defaults)) {\n throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));\n }\n const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);\n this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);\n }\n}\nfunction normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : '';\n let output;\n let outputType = property == null ? void 0 : property.type;\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean';\n }\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number';\n }\n }\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true';\n break;\n case 'number':\n output = Number(trimmedValue);\n break;\n default:\n output = value;\n }\n return output;\n}\nfunction normaliseDataset(Component, dataset) {\n if (!isObject(Component.schema)) {\n throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));\n }\n const out = {};\n const entries = Object.entries(Component.schema.properties);\n for (const entry of entries) {\n const [namespace, property] = entry;\n const field = namespace.toString();\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property);\n }\n if ((property == null ? void 0 : property.type) === 'object') {\n out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);\n }\n }\n return out;\n}\nfunction normaliseOptions(scopeOrOptions) {\n let $scope = document;\n let onError;\n if (isObject(scopeOrOptions)) {\n const options = scopeOrOptions;\n if (isScope(options.scope) || options.scope === null) {\n $scope = options.scope;\n }\n if (typeof options.onError === 'function') {\n onError = options.onError;\n }\n }\n if (isScope(scopeOrOptions)) {\n $scope = scopeOrOptions;\n } else if (scopeOrOptions === null) {\n $scope = null;\n } else if (typeof scopeOrOptions === 'function') {\n onError = scopeOrOptions;\n }\n return {\n scope: $scope,\n onError\n };\n}\nfunction mergeConfigs(...configObjects) {\n const formattedConfigObject = {};\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key];\n const override = configObject[key];\n if (isObject(option) && isObject(override)) {\n formattedConfigObject[key] = mergeConfigs(option, override);\n } else {\n formattedConfigObject[key] = override;\n }\n }\n }\n return formattedConfigObject;\n}\nfunction validateConfig(schema, config) {\n const validationErrors = [];\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = [];\n if (Array.isArray(conditions)) {\n for (const {\n required,\n errorMessage\n } of conditions) {\n if (!required.every(key => !!config[key])) {\n errors.push(errorMessage);\n }\n }\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors);\n }\n }\n }\n return validationErrors;\n}\nfunction extractConfigByNamespace(schema, dataset, namespace) {\n const property = schema.properties[namespace];\n if ((property == null ? void 0 : property.type) !== 'object') {\n return;\n }\n const newObject = {\n [namespace]: {}\n };\n for (const [key, value] of Object.entries(dataset)) {\n let current = newObject;\n const keyParts = key.split('.');\n for (const [index, name] of keyParts.entries()) {\n if (isObject(current)) {\n if (index < keyParts.length - 1) {\n if (!isObject(current[name])) {\n current[name] = {};\n }\n current = current[name];\n } else if (key !== namespace) {\n current[name] = normaliseString(value);\n }\n }\n }\n }\n return newObject[namespace];\n}\n/**\n * Schema for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} Schema\n * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties\n * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions\n */\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n/**\n * Schema condition for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} SchemaCondition\n * @property {(keyof ConfigurationType)[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration\n * @property {ConfigurationType} [defaults] - The default values of the configuration of the component\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n/**\n * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'\n */\n\nexport { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };\n//# sourceMappingURL=configuration.mjs.map\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { ConfigurableComponent } from 'govuk-frontend'\n\n/**\n * @augments {ConfigurableComponent<MultiFileUploadConfig>}\n */\nexport class MultiFileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for multi file upload\n * @param {MultiFileUploadConfig} [config] - Multi file upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n if (!MultiFileUpload.isSupported()) {\n return this\n }\n\n const $feedbackContainer =\n this.config.feedbackContainer.element ??\n this.$root.querySelector(this.config.feedbackContainer.selector)\n\n if (!$feedbackContainer || !($feedbackContainer instanceof HTMLElement)) {\n return this\n }\n\n this.$feedbackContainer = $feedbackContainer\n\n this.setupFileInput()\n this.setupDropzone()\n this.setupLabel()\n this.setupStatusBox()\n\n this.$root.addEventListener('click', this.onFileDeleteClick.bind(this))\n this.$root.classList.add('moj-multi-file-upload--enhanced')\n }\n\n setupDropzone() {\n this.$dropzone = document.createElement('div')\n this.$dropzone.classList.add('moj-multi-file-upload__dropzone')\n\n this.$dropzone.addEventListener('dragover', this.onDragOver.bind(this))\n this.$dropzone.addEventListener('dragleave', this.onDragLeave.bind(this))\n this.$dropzone.addEventListener('drop', this.onDrop.bind(this))\n\n this.$fileInput.replaceWith(this.$dropzone)\n this.$dropzone.appendChild(this.$fileInput)\n }\n\n setupLabel() {\n const $label = document.createElement('label')\n $label.setAttribute('for', this.$fileInput.id)\n $label.classList.add('govuk-button', 'govuk-button--secondary')\n $label.textContent = this.config.dropzoneButtonText\n\n const $hint = document.createElement('p')\n $hint.classList.add('govuk-body')\n $hint.textContent = this.config.dropzoneHintText\n\n this.$label = $label\n this.$dropzone.append($hint)\n this.$dropzone.append($label)\n }\n\n setupFileInput() {\n this.$fileInput = /** @type {HTMLInputElement} */ (\n this.$root.querySelector('.moj-multi-file-upload__input')\n )\n this.$fileInput.addEventListener('change', this.onFileChange.bind(this))\n this.$fileInput.addEventListener('focus', this.onFileFocus.bind(this))\n this.$fileInput.addEventListener('blur', this.onFileBlur.bind(this))\n }\n\n setupStatusBox() {\n this.$status = document.createElement('div')\n this.$status.classList.add('govuk-visually-hidden')\n this.$status.setAttribute('aria-live', 'polite')\n this.$status.setAttribute('role', 'status')\n this.$dropzone.append(this.$status)\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDragOver(event) {\n event.preventDefault()\n this.$dropzone.classList.add('moj-multi-file-upload--dragover')\n }\n\n onDragLeave() {\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDrop(event) {\n event.preventDefault()\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(event.dataTransfer.files)\n }\n\n /**\n * @param {FileList} files - File list\n */\n uploadFiles(files) {\n for (const file of Array.from(files)) {\n this.uploadFile(file)\n }\n }\n\n onFileChange() {\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(this.$fileInput.files)\n\n const $fileInput = this.$fileInput.cloneNode(true)\n if (!$fileInput || !($fileInput instanceof HTMLInputElement)) {\n return\n }\n\n $fileInput.value = ''\n this.$fileInput.replaceWith($fileInput)\n\n this.setupFileInput()\n this.$fileInput.focus()\n }\n\n onFileFocus() {\n this.$label.classList.add('moj-multi-file-upload--focused')\n }\n\n onFileBlur() {\n this.$label.classList.remove('moj-multi-file-upload--focused')\n }\n\n /**\n * @param {UploadResponseSuccess['success']} success\n */\n getSuccessHtml(success) {\n return `<span class=\"moj-multi-file-upload__success\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"/></svg>${success.messageHtml}</span>`\n }\n\n /**\n * @param {UploadResponseError['error']} error\n */\n getErrorHtml(error) {\n return `<span class=\"moj-multi-file-upload__error\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\"/></svg>${error.message}</span>`\n }\n\n /**\n * @param {File} file\n */\n getFileRow(file) {\n const $row = document.createElement('div')\n\n $row.classList.add('govuk-summary-list__row', 'moj-multi-file-upload__row')\n\n $row.innerHTML = `\n <div class=\"govuk-summary-list__value moj-multi-file-upload__message\">\n <span class=\"moj-multi-file-upload__filename\">${file.name}</span>\n <span class=\"moj-multi-file-upload__progress\">0%</span>\n </div>\n <div class=\"govuk-summary-list__actions moj-multi-file-upload__actions\"></div>\n `\n\n return $row\n }\n\n /**\n * @param {UploadResponseFile} file\n */\n getDeleteButton(file) {\n const $button = document.createElement('button')\n\n $button.setAttribute('type', 'button')\n $button.setAttribute('name', 'delete')\n $button.setAttribute('value', file.filename)\n\n $button.classList.add(\n 'moj-multi-file-upload__delete',\n 'govuk-button',\n 'govuk-button--secondary',\n 'govuk-!-margin-bottom-0'\n )\n\n $button.innerHTML = `Delete <span class=\"govuk-visually-hidden\">${file.originalname}</span>`\n\n return $button\n }\n\n /**\n * @param {File} file\n */\n uploadFile(file) {\n this.config.hooks.entryHook(this, file)\n\n const $item = this.getFileRow(file)\n const $message = $item.querySelector('.moj-multi-file-upload__message')\n const $actions = $item.querySelector('.moj-multi-file-upload__actions')\n const $progress = $item.querySelector('.moj-multi-file-upload__progress')\n\n const formData = new FormData()\n formData.append('documents', file)\n\n this.$feedbackContainer\n .querySelector('.moj-multi-file-upload__list')\n .append($item)\n\n const xhr = new XMLHttpRequest()\n\n const onLoad = () => {\n if (\n xhr.status < 200 ||\n xhr.status >= 300 ||\n !('success' in xhr.response)\n ) {\n return onError()\n }\n\n $message.innerHTML = this.getSuccessHtml(xhr.response.success)\n this.$status.textContent = xhr.response.success.messageText\n\n $actions.append(this.getDeleteButton(xhr.response.file))\n this.config.hooks.exitHook(this, file, xhr, xhr.responseText)\n }\n\n const onError = () => {\n const error = new Error(\n xhr.response && 'error' in xhr.response\n ? xhr.response.error.message\n : xhr.statusText || 'Upload failed'\n )\n\n $message.innerHTML = this.getErrorHtml(error)\n this.$status.textContent = error.message\n\n this.config.hooks.errorHook(this, file, xhr, xhr.responseText, error)\n }\n\n xhr.addEventListener('load', onLoad)\n xhr.addEventListener('error', onError)\n\n xhr.upload.addEventListener('progress', (event) => {\n if (!event.lengthComputable) {\n return\n }\n\n const percentComplete = Math.round((event.loaded / event.total) * 100)\n $progress.textContent = ` ${percentComplete}%`\n })\n\n xhr.open('POST', this.config.uploadUrl)\n xhr.responseType = 'json'\n\n xhr.send(formData)\n }\n\n /**\n * @param {MouseEvent} event - Click event\n */\n onFileDeleteClick(event) {\n const $button = event.target\n\n if (\n !$button ||\n !($button instanceof HTMLButtonElement) ||\n !$button.classList.contains('moj-multi-file-upload__delete')\n ) {\n return\n }\n\n event.preventDefault() // if user refreshes page and then deletes\n\n const xhr = new XMLHttpRequest()\n\n xhr.addEventListener('load', () => {\n if (xhr.status < 200 || xhr.status >= 300) {\n return\n }\n\n const $rows = Array.from(\n this.$feedbackContainer.querySelectorAll('.moj-multi-file-upload__row')\n )\n\n if ($rows.length === 1) {\n this.$feedbackContainer.classList.add('moj-hidden')\n }\n\n const $rowDelete = $rows.find(($row) => $row.contains($button))\n if ($rowDelete) $rowDelete.remove()\n\n this.config.hooks.deleteHook(this, undefined, xhr, xhr.responseText)\n })\n\n xhr.open('POST', this.config.deleteUrl)\n xhr.setRequestHeader('Content-Type', 'application/json')\n xhr.responseType = 'json'\n\n xhr.send(\n JSON.stringify({\n [$button.name]: $button.value\n })\n )\n }\n\n static isSupported() {\n return (\n this.isDragAndDropSupported() &&\n this.isFormDataSupported() &&\n this.isFileApiSupported()\n )\n }\n\n static isDragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n }\n\n static isFormDataSupported() {\n return typeof FormData === 'function'\n }\n\n static isFileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'moj-multi-file-upload'\n\n /**\n * Multi file upload default config\n *\n * @type {MultiFileUploadConfig}\n */\n static defaults = Object.freeze({\n uploadStatusText: 'Uploading files, please wait',\n dropzoneHintText: 'Drag and drop files here or',\n dropzoneButtonText: 'Choose files',\n feedbackContainer: {\n selector: '.moj-multi-file__uploaded-files'\n },\n hooks: {\n entryHook: () => {},\n exitHook: () => {},\n errorHook: () => {},\n deleteHook: () => {}\n }\n })\n\n /**\n * Multi file upload config schema\n *\n * @satisfies {Schema<MultiFileUploadConfig>}\n */\n static schema = Object.freeze(\n /** @type {const} */ ({\n properties: {\n uploadUrl: { type: 'string' },\n deleteUrl: { type: 'string' },\n uploadStatusText: { type: 'string' },\n dropzoneHintText: { type: 'string' },\n dropzoneButtonText: { type: 'string' },\n feedbackContainer: { type: 'object' },\n hooks: { type: 'object' }\n }\n })\n )\n}\n\n/**\n * Multi file upload config\n *\n * @typedef {object} MultiFileUploadConfig\n * @property {string} [uploadUrl] - File upload URL\n * @property {string} [deleteUrl] - File delete URL\n * @property {string} [uploadStatusText] - Upload status text\n * @property {string} [dropzoneHintText] - Dropzone hint text\n * @property {string} [dropzoneButtonText] - Dropzone button text\n * @property {object} [feedbackContainer] - Feedback container config\n * @property {string} [feedbackContainer.selector] - Selector for feedback container\n * @property {Element | null} [feedbackContainer.element] - HTML element for feedback container\n * @property {MultiFileUploadHooks} [hooks] - Upload hooks\n */\n\n/**\n * Multi file upload hooks\n *\n * @typedef {object} MultiFileUploadHooks\n * @property {OnUploadFileEntryHook} [entryHook] - File upload entry hook\n * @property {OnUploadFileExitHook} [exitHook] - File upload exit hook\n * @property {OnUploadFileErrorHook} [errorHook] - File upload error hook\n * @property {OnUploadFileDeleteHook} [deleteHook] - File delete hook\n */\n\n/**\n * Upload hook: File entry\n *\n * @callback OnUploadFileEntryHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n */\n\n/**\n * Upload hook: File exit\n *\n * @callback OnUploadFileExitHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * Upload hook: File error\n *\n * @callback OnUploadFileErrorHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n * @param {Error} errorThrown - Error thrown\n */\n\n/**\n * Upload hook: File delete\n *\n * @callback OnUploadFileDeleteHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} [file] - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * @typedef {object} UploadResponseSuccess\n * @property {{ messageText: string, messageHtml: string }} success - Response success\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseError\n * @property {{ message: string }} error - Response error\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseFile\n * @property {string} filename - File name\n * @property {string} originalname - Original file name\n */\n\n/**\n * @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'\n */\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isArray","option","Array","isObject","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ConfigError","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","configOverride","Symbol","for","ConfigurableComponent","param","config","_config","defaults","datasetConfig","normaliseDataset","dataset","mergeConfigs","normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","schema","out","entries","Object","properties","entry","namespace","field","toString","extractConfigByNamespace","configObjects","formattedConfigObject","configObject","key","keys","override","newObject","current","keyParts","split","index","MultiFileUpload","_this$config$feedback","$feedbackContainer","feedbackContainer","querySelector","selector","setupFileInput","setupDropzone","setupLabel","setupStatusBox","addEventListener","onFileDeleteClick","bind","add","$dropzone","createElement","onDragOver","onDragLeave","onDrop","$fileInput","replaceWith","appendChild","$label","id","textContent","dropzoneButtonText","$hint","dropzoneHintText","append","onFileChange","onFileFocus","onFileBlur","$status","event","preventDefault","remove","uploadStatusText","uploadFiles","dataTransfer","files","file","from","uploadFile","cloneNode","HTMLInputElement","focus","getSuccessHtml","success","messageHtml","getErrorHtml","error","getFileRow","$row","innerHTML","getDeleteButton","$button","filename","originalname","hooks","entryHook","$item","$message","$actions","$progress","formData","FormData","xhr","XMLHttpRequest","onLoad","status","response","onError","messageText","exitHook","responseText","statusText","errorHook","upload","lengthComputable","percentComplete","Math","round","loaded","total","open","uploadUrl","responseType","send","target","HTMLButtonElement","$rows","querySelectorAll","$rowDelete","find","deleteHook","undefined","deleteUrl","setRequestHeader","JSON","stringify","isDragAndDropSupported","isFormDataSupported","isFileApiSupported","div","ondrop","input","freeze"],"mappings":"AAmFO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO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,UAAU,GAAG,uBAAuB;AAE3C;AACF;AACA;AACA;AACA;AA9UaqF,eAAe,CA+UnBtC,QAAQ,GAAGoB,MAAM,CAAC4H,MAAM,CAAC;AAC9BtE,EAAAA,gBAAgB,EAAE,8BAA8B;AAChDT,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CF,EAAAA,kBAAkB,EAAE,cAAc;AAClCtB,EAAAA,iBAAiB,EAAE;AACjBE,IAAAA,QAAQ,EAAE;GACX;AACDqD,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;AACnBc,IAAAA,QAAQ,EAAEA,MAAM,CAAC,CAAC;AAClBG,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;IACnBkB,UAAU,EAAEA,MAAM,CAAC;AACrB;AACF,CAAC,CAAC;AAEF;AACF;AACA;AACA;AACA;AAlWa9F,eAAe,CAmWnBrB,MAAM,GAAGG,MAAM,CAAC4H,MAAM,qBACL;AACpB3H,EAAAA,UAAU,EAAE;AACVsG,IAAAA,SAAS,EAAE;AAAE/G,MAAAA,IAAI,EAAE;KAAU;AAC7B0H,IAAAA,SAAS,EAAE;AAAE1H,MAAAA,IAAI,EAAE;KAAU;AAC7B8D,IAAAA,gBAAgB,EAAE;AAAE9D,MAAAA,IAAI,EAAE;KAAU;AACpCqD,IAAAA,gBAAgB,EAAE;AAAErD,MAAAA,IAAI,EAAE;KAAU;AACpCmD,IAAAA,kBAAkB,EAAE;AAAEnD,MAAAA,IAAI,EAAE;KAAU;AACtC6B,IAAAA,iBAAiB,EAAE;AAAE7B,MAAAA,IAAI,EAAE;KAAU;AACrCoF,IAAAA,KAAK,EAAE;AAAEpF,MAAAA,IAAI,EAAE;AAAS;AAC1B;AACF,CACF,CAAC;;;;","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"multi-file-upload.bundle.mjs","sources":["../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../node_modules/govuk-frontend/dist/govuk/common/configuration.mjs","../../../../src/moj/components/multi-file-upload/multi-file-upload.mjs"],"sourcesContent":["function getBreakpoint(name) {\n const property = `--govuk-breakpoint-${name}`;\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n return {\n property,\n value: value || undefined\n };\n}\nfunction setFocus($element, options = {}) {\n var _options$onBeforeFocu;\n const isFocusable = $element.getAttribute('tabindex');\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1');\n }\n function onFocus() {\n $element.addEventListener('blur', onBlur, {\n once: true\n });\n }\n function onBlur() {\n var _options$onBlur;\n (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n if (!isFocusable) {\n $element.removeAttribute('tabindex');\n }\n }\n $element.addEventListener('focus', onFocus, {\n once: true\n });\n (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n if (!$scope) {\n return false;\n }\n return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n return Array.isArray(option);\n}\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction isScope($scope) {\n return !!$scope && ($scope instanceof Element || $scope instanceof Document);\n}\nfunction formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\nexport { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { isObject, formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n constructor(...args) {\n super(...args);\n this.name = 'GOVUKFrontendError';\n }\n}\nclass SupportError extends GOVUKFrontendError {\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';\n super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n this.name = 'SupportError';\n }\n}\nclass ConfigError extends GOVUKFrontendError {\n constructor(...args) {\n super(...args);\n this.name = 'ConfigError';\n }\n}\nclass ElementError extends GOVUKFrontendError {\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n if (isObject(messageOrOptions)) {\n const {\n component,\n identifier,\n element,\n expectedType\n } = messageOrOptions;\n message = identifier;\n message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n if (component) {\n message = formatErrorMessage(component, message);\n }\n }\n super(message);\n this.name = 'ElementError';\n }\n}\nclass InitError extends GOVUKFrontendError {\n constructor(componentOrMessage) {\n const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n super(message);\n this.name = 'InitError';\n }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root;\n }\n constructor($root) {\n this._$root = void 0;\n const childConstructor = this.constructor;\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`);\n }\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n });\n } else {\n this._$root = $root;\n }\n childConstructor.checkSupport();\n this.checkInitialised();\n const moduleName = childConstructor.moduleName;\n this.$root.setAttribute(`data-${moduleName}-init`, '');\n }\n checkInitialised() {\n const constructor = this.constructor;\n const moduleName = constructor.moduleName;\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor);\n }\n }\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError();\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from '../component.mjs';\nimport { ConfigError } from '../errors/index.mjs';\nimport { isObject, formatErrorMessage, isScope } from './index.mjs';\n\nconst configOverride = Symbol.for('configOverride');\nclass ConfigurableComponent extends Component {\n [configOverride](param) {\n return {};\n }\n\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {ConfigurationType} - the root element of component\n */\n get config() {\n return this._config;\n }\n constructor($root, config) {\n super($root);\n this._config = void 0;\n const childConstructor = this.constructor;\n if (!isObject(childConstructor.defaults)) {\n throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));\n }\n const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);\n this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);\n }\n}\nfunction normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : '';\n let output;\n let outputType = property == null ? void 0 : property.type;\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean';\n }\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number';\n }\n }\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true';\n break;\n case 'number':\n output = Number(trimmedValue);\n break;\n default:\n output = value;\n }\n return output;\n}\nfunction normaliseDataset(Component, dataset) {\n if (!isObject(Component.schema)) {\n throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));\n }\n const out = {};\n const entries = Object.entries(Component.schema.properties);\n for (const entry of entries) {\n const [namespace, property] = entry;\n const field = namespace.toString();\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property);\n }\n if ((property == null ? void 0 : property.type) === 'object') {\n out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);\n }\n }\n return out;\n}\nfunction normaliseOptions(scopeOrOptions) {\n let $scope = document;\n let onError;\n if (isObject(scopeOrOptions)) {\n const options = scopeOrOptions;\n if (isScope(options.scope) || options.scope === null) {\n $scope = options.scope;\n }\n if (typeof options.onError === 'function') {\n onError = options.onError;\n }\n }\n if (isScope(scopeOrOptions)) {\n $scope = scopeOrOptions;\n } else if (scopeOrOptions === null) {\n $scope = null;\n } else if (typeof scopeOrOptions === 'function') {\n onError = scopeOrOptions;\n }\n return {\n scope: $scope,\n onError\n };\n}\nfunction mergeConfigs(...configObjects) {\n const formattedConfigObject = {};\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key];\n const override = configObject[key];\n if (isObject(option) && isObject(override)) {\n formattedConfigObject[key] = mergeConfigs(option, override);\n } else {\n formattedConfigObject[key] = override;\n }\n }\n }\n return formattedConfigObject;\n}\nfunction validateConfig(schema, config) {\n const validationErrors = [];\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = [];\n if (Array.isArray(conditions)) {\n for (const {\n required,\n errorMessage\n } of conditions) {\n if (!required.every(key => !!config[key])) {\n errors.push(errorMessage);\n }\n }\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors);\n }\n }\n }\n return validationErrors;\n}\nfunction extractConfigByNamespace(schema, dataset, namespace) {\n const property = schema.properties[namespace];\n if ((property == null ? void 0 : property.type) !== 'object') {\n return;\n }\n const newObject = {\n [namespace]: {}\n };\n for (const [key, value] of Object.entries(dataset)) {\n let current = newObject;\n const keyParts = key.split('.');\n for (const [index, name] of keyParts.entries()) {\n if (isObject(current)) {\n if (index < keyParts.length - 1) {\n if (!isObject(current[name])) {\n current[name] = {};\n }\n current = current[name];\n } else if (key !== namespace) {\n current[name] = normaliseString(value);\n }\n }\n }\n }\n return newObject[namespace];\n}\n/**\n * Schema for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} Schema\n * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties\n * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions\n */\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n/**\n * Schema condition for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} SchemaCondition\n * @property {(keyof ConfigurationType)[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration\n * @property {ConfigurationType} [defaults] - The default values of the configuration of the component\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n/**\n * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'\n */\n\nexport { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };\n//# sourceMappingURL=configuration.mjs.map\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { ConfigurableComponent } from 'govuk-frontend'\n\n/**\n * @augments {ConfigurableComponent<MultiFileUploadConfig>}\n */\nexport class MultiFileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for multi file upload\n * @param {MultiFileUploadConfig} [config] - Multi file upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n if (!MultiFileUpload.isSupported()) {\n return this\n }\n\n const $feedbackContainer =\n this.config.feedbackContainer.element ??\n this.$root.querySelector(this.config.feedbackContainer.selector)\n\n if (!$feedbackContainer || !($feedbackContainer instanceof HTMLElement)) {\n return this\n }\n\n this.$feedbackContainer = $feedbackContainer\n\n this.setupFileInput()\n this.setupDropzone()\n this.setupLabel()\n this.setupStatusBox()\n\n this.$root.addEventListener('click', this.onFileDeleteClick.bind(this))\n this.$root.classList.add('moj-multi-file-upload--enhanced')\n }\n\n setupDropzone() {\n this.$dropzone = document.createElement('div')\n this.$dropzone.classList.add('moj-multi-file-upload__dropzone')\n\n this.$dropzone.addEventListener('dragover', this.onDragOver.bind(this))\n this.$dropzone.addEventListener('dragleave', this.onDragLeave.bind(this))\n this.$dropzone.addEventListener('drop', this.onDrop.bind(this))\n\n this.$fileInput.replaceWith(this.$dropzone)\n this.$dropzone.appendChild(this.$fileInput)\n }\n\n setupLabel() {\n const $label = document.createElement('label')\n $label.setAttribute('for', this.$fileInput.id)\n $label.classList.add('govuk-button', 'govuk-button--secondary')\n $label.textContent = this.config.dropzoneButtonText\n\n const $hint = document.createElement('p')\n $hint.classList.add('govuk-body')\n $hint.textContent = this.config.dropzoneHintText\n\n this.$label = $label\n this.$dropzone.append($hint)\n this.$dropzone.append($label)\n }\n\n setupFileInput() {\n this.$fileInput = /** @type {HTMLInputElement} */ (\n this.$root.querySelector('.moj-multi-file-upload__input')\n )\n this.$fileInput.addEventListener('change', this.onFileChange.bind(this))\n this.$fileInput.addEventListener('focus', this.onFileFocus.bind(this))\n this.$fileInput.addEventListener('blur', this.onFileBlur.bind(this))\n }\n\n setupStatusBox() {\n this.$status = document.createElement('div')\n this.$status.classList.add('govuk-visually-hidden')\n this.$status.setAttribute('aria-live', 'polite')\n this.$status.setAttribute('role', 'status')\n this.$dropzone.append(this.$status)\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDragOver(event) {\n event.preventDefault()\n this.$dropzone.classList.add('moj-multi-file-upload--dragover')\n }\n\n onDragLeave() {\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDrop(event) {\n event.preventDefault()\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(event.dataTransfer.files)\n }\n\n /**\n * @param {FileList} files - File list\n */\n uploadFiles(files) {\n for (const file of Array.from(files)) {\n this.uploadFile(file)\n }\n }\n\n onFileChange() {\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(this.$fileInput.files)\n\n const $fileInput = this.$fileInput.cloneNode(true)\n if (!$fileInput || !($fileInput instanceof HTMLInputElement)) {\n return\n }\n\n $fileInput.value = ''\n this.$fileInput.replaceWith($fileInput)\n\n this.setupFileInput()\n this.$fileInput.focus()\n }\n\n onFileFocus() {\n this.$label.classList.add('moj-multi-file-upload--focused')\n }\n\n onFileBlur() {\n this.$label.classList.remove('moj-multi-file-upload--focused')\n }\n\n /**\n * @param {UploadResponseSuccess['success']} success\n */\n getSuccessHtml(success) {\n return `<span class=\"moj-multi-file-upload__success\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"/></svg>${success.messageHtml}</span>`\n }\n\n /**\n * @param {UploadResponseError['error']} error\n */\n getErrorHtml(error) {\n return `<span class=\"moj-multi-file-upload__error\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\"/></svg>${error.message}</span>`\n }\n\n /**\n * @param {File} file\n */\n getFileRow(file) {\n const $row = document.createElement('div')\n\n $row.classList.add('govuk-summary-list__row', 'moj-multi-file-upload__row')\n\n $row.innerHTML = `\n <div class=\"govuk-summary-list__value moj-multi-file-upload__message\">\n <span class=\"moj-multi-file-upload__filename\">${file.name}</span>\n <span class=\"moj-multi-file-upload__progress\">0%</span>\n </div>\n <div class=\"govuk-summary-list__actions moj-multi-file-upload__actions\"></div>\n `\n\n return $row\n }\n\n /**\n * @param {UploadResponseFile} file\n */\n getDeleteButton(file) {\n const $button = document.createElement('button')\n\n $button.setAttribute('type', 'button')\n $button.setAttribute('name', 'delete')\n $button.setAttribute('value', file.filename)\n\n $button.classList.add(\n 'moj-multi-file-upload__delete',\n 'govuk-button',\n 'govuk-button--secondary',\n 'govuk-!-margin-bottom-0'\n )\n\n $button.innerHTML = `Delete <span class=\"govuk-visually-hidden\">${file.originalname}</span>`\n\n return $button\n }\n\n /**\n * @param {File} file\n */\n uploadFile(file) {\n this.config.hooks.entryHook(this, file)\n\n const $item = this.getFileRow(file)\n const $message = $item.querySelector('.moj-multi-file-upload__message')\n const $actions = $item.querySelector('.moj-multi-file-upload__actions')\n const $progress = $item.querySelector('.moj-multi-file-upload__progress')\n\n const formData = new FormData()\n formData.append('documents', file)\n\n this.$feedbackContainer\n .querySelector('.moj-multi-file-upload__list')\n .append($item)\n\n const xhr = new XMLHttpRequest()\n\n const onLoad = () => {\n if (\n xhr.status < 200 ||\n xhr.status >= 300 ||\n !('success' in xhr.response)\n ) {\n return onError()\n }\n\n $message.innerHTML = this.getSuccessHtml(xhr.response.success)\n this.$status.textContent = xhr.response.success.messageText\n\n $actions.append(this.getDeleteButton(xhr.response.file))\n this.config.hooks.exitHook(this, file, xhr, xhr.statusText)\n }\n\n const onError = () => {\n const error = new Error(\n xhr.response && 'error' in xhr.response\n ? xhr.response.error.message\n : xhr.statusText || 'Upload failed'\n )\n\n $message.innerHTML = this.getErrorHtml(error)\n this.$status.textContent = error.message\n\n this.config.hooks.errorHook(this, file, xhr, xhr.statusText, error)\n }\n\n xhr.addEventListener('load', onLoad)\n xhr.addEventListener('error', onError)\n\n xhr.upload.addEventListener('progress', (event) => {\n if (!event.lengthComputable) {\n return\n }\n\n const percentComplete = Math.round((event.loaded / event.total) * 100)\n $progress.textContent = ` ${percentComplete}%`\n })\n\n xhr.open('POST', this.config.uploadUrl)\n xhr.responseType = 'json'\n\n xhr.send(formData)\n }\n\n /**\n * @param {MouseEvent} event - Click event\n */\n onFileDeleteClick(event) {\n const $button = event.target\n\n if (\n !$button ||\n !($button instanceof HTMLButtonElement) ||\n !$button.classList.contains('moj-multi-file-upload__delete')\n ) {\n return\n }\n\n event.preventDefault() // if user refreshes page and then deletes\n\n const xhr = new XMLHttpRequest()\n\n xhr.addEventListener('load', () => {\n if (xhr.status < 200 || xhr.status >= 300) {\n return\n }\n\n const $rows = Array.from(\n this.$feedbackContainer.querySelectorAll('.moj-multi-file-upload__row')\n )\n\n if ($rows.length === 1) {\n this.$feedbackContainer.classList.add('moj-hidden')\n }\n\n const $rowDelete = $rows.find(($row) => $row.contains($button))\n if ($rowDelete) $rowDelete.remove()\n\n this.config.hooks.deleteHook(this, undefined, xhr, xhr.statusText)\n })\n\n xhr.open('POST', this.config.deleteUrl)\n xhr.setRequestHeader('Content-Type', 'application/json')\n xhr.responseType = 'json'\n\n xhr.send(\n JSON.stringify({\n [$button.name]: $button.value\n })\n )\n }\n\n static isSupported() {\n return (\n this.isDragAndDropSupported() &&\n this.isFormDataSupported() &&\n this.isFileApiSupported()\n )\n }\n\n static isDragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n }\n\n static isFormDataSupported() {\n return typeof FormData === 'function'\n }\n\n static isFileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'moj-multi-file-upload'\n\n /**\n * Multi file upload default config\n *\n * @type {MultiFileUploadConfig}\n */\n static defaults = Object.freeze({\n uploadStatusText: 'Uploading files, please wait',\n dropzoneHintText: 'Drag and drop files here or',\n dropzoneButtonText: 'Choose files',\n feedbackContainer: {\n selector: '.moj-multi-file__uploaded-files'\n },\n hooks: {\n entryHook: () => {},\n exitHook: () => {},\n errorHook: () => {},\n deleteHook: () => {}\n }\n })\n\n /**\n * Multi file upload config schema\n *\n * @satisfies {Schema<MultiFileUploadConfig>}\n */\n static schema = Object.freeze(\n /** @type {const} */ ({\n properties: {\n uploadUrl: { type: 'string' },\n deleteUrl: { type: 'string' },\n uploadStatusText: { type: 'string' },\n dropzoneHintText: { type: 'string' },\n dropzoneButtonText: { type: 'string' },\n feedbackContainer: { type: 'object' },\n hooks: { type: 'object' }\n }\n })\n )\n}\n\n/**\n * Multi file upload config\n *\n * @typedef {object} MultiFileUploadConfig\n * @property {string} [uploadUrl] - File upload URL\n * @property {string} [deleteUrl] - File delete URL\n * @property {string} [uploadStatusText] - Upload status text\n * @property {string} [dropzoneHintText] - Dropzone hint text\n * @property {string} [dropzoneButtonText] - Dropzone button text\n * @property {object} [feedbackContainer] - Feedback container config\n * @property {string} [feedbackContainer.selector] - Selector for feedback container\n * @property {Element | null} [feedbackContainer.element] - HTML element for feedback container\n * @property {MultiFileUploadHooks} [hooks] - Upload hooks\n */\n\n/**\n * Multi file upload hooks\n *\n * @typedef {object} MultiFileUploadHooks\n * @property {OnUploadFileEntryHook} [entryHook] - File upload entry hook\n * @property {OnUploadFileExitHook} [exitHook] - File upload exit hook\n * @property {OnUploadFileErrorHook} [errorHook] - File upload error hook\n * @property {OnUploadFileDeleteHook} [deleteHook] - File delete hook\n */\n\n/**\n * Upload hook: File entry\n *\n * @callback OnUploadFileEntryHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n */\n\n/**\n * Upload hook: File exit\n *\n * @callback OnUploadFileExitHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * Upload hook: File error\n *\n * @callback OnUploadFileErrorHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n * @param {Error} errorThrown - Error thrown\n */\n\n/**\n * Upload hook: File delete\n *\n * @callback OnUploadFileDeleteHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} [file] - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * @typedef {object} UploadResponseSuccess\n * @property {{ messageText: string, messageHtml: string }} success - Response success\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseError\n * @property {{ message: string }} error - Response error\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseFile\n * @property {string} filename - File name\n * @property {string} originalname - Original file name\n */\n\n/**\n * @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'\n */\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isArray","option","Array","isObject","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ConfigError","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","configOverride","Symbol","for","ConfigurableComponent","param","config","_config","defaults","datasetConfig","normaliseDataset","dataset","mergeConfigs","normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","schema","out","entries","Object","properties","entry","namespace","field","toString","extractConfigByNamespace","configObjects","formattedConfigObject","configObject","key","keys","override","newObject","current","keyParts","split","index","MultiFileUpload","_this$config$feedback","$feedbackContainer","feedbackContainer","querySelector","selector","setupFileInput","setupDropzone","setupLabel","setupStatusBox","addEventListener","onFileDeleteClick","bind","add","$dropzone","createElement","onDragOver","onDragLeave","onDrop","$fileInput","replaceWith","appendChild","$label","id","textContent","dropzoneButtonText","$hint","dropzoneHintText","append","onFileChange","onFileFocus","onFileBlur","$status","event","preventDefault","remove","uploadStatusText","uploadFiles","dataTransfer","files","file","from","uploadFile","cloneNode","HTMLInputElement","focus","getSuccessHtml","success","messageHtml","getErrorHtml","error","getFileRow","$row","innerHTML","getDeleteButton","$button","filename","originalname","hooks","entryHook","$item","$message","$actions","$progress","formData","FormData","xhr","XMLHttpRequest","onLoad","status","response","onError","messageText","exitHook","statusText","errorHook","upload","lengthComputable","percentComplete","Math","round","loaded","total","open","uploadUrl","responseType","send","target","HTMLButtonElement","$rows","querySelectorAll","$rowDelete","find","deleteHook","undefined","deleteUrl","setRequestHeader","JSON","stringify","isDragAndDropSupported","isFormDataSupported","isFileApiSupported","div","ondrop","input","freeze"],"mappings":"AAmFO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGC,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AACA;AACA;AACA;AA9UaqF,eAAe,CA+UnBtC,QAAQ,GAAGoB,MAAM,CAAC2H,MAAM,CAAC;AAC9BrE,EAAAA,gBAAgB,EAAE,8BAA8B;AAChDT,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CF,EAAAA,kBAAkB,EAAE,cAAc;AAClCtB,EAAAA,iBAAiB,EAAE;AACjBE,IAAAA,QAAQ,EAAE;GACX;AACDqD,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;AACnBc,IAAAA,QAAQ,EAAEA,MAAM,CAAC,CAAC;AAClBE,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;IACnBkB,UAAU,EAAEA,MAAM,CAAC;AACrB;AACF,CAAC,CAAC;AAEF;AACF;AACA;AACA;AACA;AAlWa7F,eAAe,CAmWnBrB,MAAM,GAAGG,MAAM,CAAC2H,MAAM,qBACL;AACpB1H,EAAAA,UAAU,EAAE;AACVqG,IAAAA,SAAS,EAAE;AAAE9G,MAAAA,IAAI,EAAE;KAAU;AAC7ByH,IAAAA,SAAS,EAAE;AAAEzH,MAAAA,IAAI,EAAE;KAAU;AAC7B8D,IAAAA,gBAAgB,EAAE;AAAE9D,MAAAA,IAAI,EAAE;KAAU;AACpCqD,IAAAA,gBAAgB,EAAE;AAAErD,MAAAA,IAAI,EAAE;KAAU;AACpCmD,IAAAA,kBAAkB,EAAE;AAAEnD,MAAAA,IAAI,EAAE;KAAU;AACtC6B,IAAAA,iBAAiB,EAAE;AAAE7B,MAAAA,IAAI,EAAE;KAAU;AACrCoF,IAAAA,KAAK,EAAE;AAAEpF,MAAAA,IAAI,EAAE;AAAS;AAC1B;AACF,CACF,CAAC;;;;","x_google_ignoreList":[0,1,2,3]}
@@ -178,13 +178,13 @@ class MultiFileUpload extends ConfigurableComponent {
178
178
  $message.innerHTML = this.getSuccessHtml(xhr.response.success);
179
179
  this.$status.textContent = xhr.response.success.messageText;
180
180
  $actions.append(this.getDeleteButton(xhr.response.file));
181
- this.config.hooks.exitHook(this, file, xhr, xhr.responseText);
181
+ this.config.hooks.exitHook(this, file, xhr, xhr.statusText);
182
182
  };
183
183
  const onError = () => {
184
184
  const error = new Error(xhr.response && 'error' in xhr.response ? xhr.response.error.message : xhr.statusText || 'Upload failed');
185
185
  $message.innerHTML = this.getErrorHtml(error);
186
186
  this.$status.textContent = error.message;
187
- this.config.hooks.errorHook(this, file, xhr, xhr.responseText, error);
187
+ this.config.hooks.errorHook(this, file, xhr, xhr.statusText, error);
188
188
  };
189
189
  xhr.addEventListener('load', onLoad);
190
190
  xhr.addEventListener('error', onError);
@@ -221,7 +221,7 @@ class MultiFileUpload extends ConfigurableComponent {
221
221
  }
222
222
  const $rowDelete = $rows.find($row => $row.contains($button));
223
223
  if ($rowDelete) $rowDelete.remove();
224
- this.config.hooks.deleteHook(this, undefined, xhr, xhr.responseText);
224
+ this.config.hooks.deleteHook(this, undefined, xhr, xhr.statusText);
225
225
  });
226
226
  xhr.open('POST', this.config.deleteUrl);
227
227
  xhr.setRequestHeader('Content-Type', 'application/json');
@@ -1 +1 @@
1
- {"version":3,"file":"multi-file-upload.mjs","sources":["../../../../src/moj/components/multi-file-upload/multi-file-upload.mjs"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { ConfigurableComponent } from 'govuk-frontend'\n\n/**\n * @augments {ConfigurableComponent<MultiFileUploadConfig>}\n */\nexport class MultiFileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for multi file upload\n * @param {MultiFileUploadConfig} [config] - Multi file upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n if (!MultiFileUpload.isSupported()) {\n return this\n }\n\n const $feedbackContainer =\n this.config.feedbackContainer.element ??\n this.$root.querySelector(this.config.feedbackContainer.selector)\n\n if (!$feedbackContainer || !($feedbackContainer instanceof HTMLElement)) {\n return this\n }\n\n this.$feedbackContainer = $feedbackContainer\n\n this.setupFileInput()\n this.setupDropzone()\n this.setupLabel()\n this.setupStatusBox()\n\n this.$root.addEventListener('click', this.onFileDeleteClick.bind(this))\n this.$root.classList.add('moj-multi-file-upload--enhanced')\n }\n\n setupDropzone() {\n this.$dropzone = document.createElement('div')\n this.$dropzone.classList.add('moj-multi-file-upload__dropzone')\n\n this.$dropzone.addEventListener('dragover', this.onDragOver.bind(this))\n this.$dropzone.addEventListener('dragleave', this.onDragLeave.bind(this))\n this.$dropzone.addEventListener('drop', this.onDrop.bind(this))\n\n this.$fileInput.replaceWith(this.$dropzone)\n this.$dropzone.appendChild(this.$fileInput)\n }\n\n setupLabel() {\n const $label = document.createElement('label')\n $label.setAttribute('for', this.$fileInput.id)\n $label.classList.add('govuk-button', 'govuk-button--secondary')\n $label.textContent = this.config.dropzoneButtonText\n\n const $hint = document.createElement('p')\n $hint.classList.add('govuk-body')\n $hint.textContent = this.config.dropzoneHintText\n\n this.$label = $label\n this.$dropzone.append($hint)\n this.$dropzone.append($label)\n }\n\n setupFileInput() {\n this.$fileInput = /** @type {HTMLInputElement} */ (\n this.$root.querySelector('.moj-multi-file-upload__input')\n )\n this.$fileInput.addEventListener('change', this.onFileChange.bind(this))\n this.$fileInput.addEventListener('focus', this.onFileFocus.bind(this))\n this.$fileInput.addEventListener('blur', this.onFileBlur.bind(this))\n }\n\n setupStatusBox() {\n this.$status = document.createElement('div')\n this.$status.classList.add('govuk-visually-hidden')\n this.$status.setAttribute('aria-live', 'polite')\n this.$status.setAttribute('role', 'status')\n this.$dropzone.append(this.$status)\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDragOver(event) {\n event.preventDefault()\n this.$dropzone.classList.add('moj-multi-file-upload--dragover')\n }\n\n onDragLeave() {\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDrop(event) {\n event.preventDefault()\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(event.dataTransfer.files)\n }\n\n /**\n * @param {FileList} files - File list\n */\n uploadFiles(files) {\n for (const file of Array.from(files)) {\n this.uploadFile(file)\n }\n }\n\n onFileChange() {\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(this.$fileInput.files)\n\n const $fileInput = this.$fileInput.cloneNode(true)\n if (!$fileInput || !($fileInput instanceof HTMLInputElement)) {\n return\n }\n\n $fileInput.value = ''\n this.$fileInput.replaceWith($fileInput)\n\n this.setupFileInput()\n this.$fileInput.focus()\n }\n\n onFileFocus() {\n this.$label.classList.add('moj-multi-file-upload--focused')\n }\n\n onFileBlur() {\n this.$label.classList.remove('moj-multi-file-upload--focused')\n }\n\n /**\n * @param {UploadResponseSuccess['success']} success\n */\n getSuccessHtml(success) {\n return `<span class=\"moj-multi-file-upload__success\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"/></svg>${success.messageHtml}</span>`\n }\n\n /**\n * @param {UploadResponseError['error']} error\n */\n getErrorHtml(error) {\n return `<span class=\"moj-multi-file-upload__error\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\"/></svg>${error.message}</span>`\n }\n\n /**\n * @param {File} file\n */\n getFileRow(file) {\n const $row = document.createElement('div')\n\n $row.classList.add('govuk-summary-list__row', 'moj-multi-file-upload__row')\n\n $row.innerHTML = `\n <div class=\"govuk-summary-list__value moj-multi-file-upload__message\">\n <span class=\"moj-multi-file-upload__filename\">${file.name}</span>\n <span class=\"moj-multi-file-upload__progress\">0%</span>\n </div>\n <div class=\"govuk-summary-list__actions moj-multi-file-upload__actions\"></div>\n `\n\n return $row\n }\n\n /**\n * @param {UploadResponseFile} file\n */\n getDeleteButton(file) {\n const $button = document.createElement('button')\n\n $button.setAttribute('type', 'button')\n $button.setAttribute('name', 'delete')\n $button.setAttribute('value', file.filename)\n\n $button.classList.add(\n 'moj-multi-file-upload__delete',\n 'govuk-button',\n 'govuk-button--secondary',\n 'govuk-!-margin-bottom-0'\n )\n\n $button.innerHTML = `Delete <span class=\"govuk-visually-hidden\">${file.originalname}</span>`\n\n return $button\n }\n\n /**\n * @param {File} file\n */\n uploadFile(file) {\n this.config.hooks.entryHook(this, file)\n\n const $item = this.getFileRow(file)\n const $message = $item.querySelector('.moj-multi-file-upload__message')\n const $actions = $item.querySelector('.moj-multi-file-upload__actions')\n const $progress = $item.querySelector('.moj-multi-file-upload__progress')\n\n const formData = new FormData()\n formData.append('documents', file)\n\n this.$feedbackContainer\n .querySelector('.moj-multi-file-upload__list')\n .append($item)\n\n const xhr = new XMLHttpRequest()\n\n const onLoad = () => {\n if (\n xhr.status < 200 ||\n xhr.status >= 300 ||\n !('success' in xhr.response)\n ) {\n return onError()\n }\n\n $message.innerHTML = this.getSuccessHtml(xhr.response.success)\n this.$status.textContent = xhr.response.success.messageText\n\n $actions.append(this.getDeleteButton(xhr.response.file))\n this.config.hooks.exitHook(this, file, xhr, xhr.responseText)\n }\n\n const onError = () => {\n const error = new Error(\n xhr.response && 'error' in xhr.response\n ? xhr.response.error.message\n : xhr.statusText || 'Upload failed'\n )\n\n $message.innerHTML = this.getErrorHtml(error)\n this.$status.textContent = error.message\n\n this.config.hooks.errorHook(this, file, xhr, xhr.responseText, error)\n }\n\n xhr.addEventListener('load', onLoad)\n xhr.addEventListener('error', onError)\n\n xhr.upload.addEventListener('progress', (event) => {\n if (!event.lengthComputable) {\n return\n }\n\n const percentComplete = Math.round((event.loaded / event.total) * 100)\n $progress.textContent = ` ${percentComplete}%`\n })\n\n xhr.open('POST', this.config.uploadUrl)\n xhr.responseType = 'json'\n\n xhr.send(formData)\n }\n\n /**\n * @param {MouseEvent} event - Click event\n */\n onFileDeleteClick(event) {\n const $button = event.target\n\n if (\n !$button ||\n !($button instanceof HTMLButtonElement) ||\n !$button.classList.contains('moj-multi-file-upload__delete')\n ) {\n return\n }\n\n event.preventDefault() // if user refreshes page and then deletes\n\n const xhr = new XMLHttpRequest()\n\n xhr.addEventListener('load', () => {\n if (xhr.status < 200 || xhr.status >= 300) {\n return\n }\n\n const $rows = Array.from(\n this.$feedbackContainer.querySelectorAll('.moj-multi-file-upload__row')\n )\n\n if ($rows.length === 1) {\n this.$feedbackContainer.classList.add('moj-hidden')\n }\n\n const $rowDelete = $rows.find(($row) => $row.contains($button))\n if ($rowDelete) $rowDelete.remove()\n\n this.config.hooks.deleteHook(this, undefined, xhr, xhr.responseText)\n })\n\n xhr.open('POST', this.config.deleteUrl)\n xhr.setRequestHeader('Content-Type', 'application/json')\n xhr.responseType = 'json'\n\n xhr.send(\n JSON.stringify({\n [$button.name]: $button.value\n })\n )\n }\n\n static isSupported() {\n return (\n this.isDragAndDropSupported() &&\n this.isFormDataSupported() &&\n this.isFileApiSupported()\n )\n }\n\n static isDragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n }\n\n static isFormDataSupported() {\n return typeof FormData === 'function'\n }\n\n static isFileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'moj-multi-file-upload'\n\n /**\n * Multi file upload default config\n *\n * @type {MultiFileUploadConfig}\n */\n static defaults = Object.freeze({\n uploadStatusText: 'Uploading files, please wait',\n dropzoneHintText: 'Drag and drop files here or',\n dropzoneButtonText: 'Choose files',\n feedbackContainer: {\n selector: '.moj-multi-file__uploaded-files'\n },\n hooks: {\n entryHook: () => {},\n exitHook: () => {},\n errorHook: () => {},\n deleteHook: () => {}\n }\n })\n\n /**\n * Multi file upload config schema\n *\n * @satisfies {Schema<MultiFileUploadConfig>}\n */\n static schema = Object.freeze(\n /** @type {const} */ ({\n properties: {\n uploadUrl: { type: 'string' },\n deleteUrl: { type: 'string' },\n uploadStatusText: { type: 'string' },\n dropzoneHintText: { type: 'string' },\n dropzoneButtonText: { type: 'string' },\n feedbackContainer: { type: 'object' },\n hooks: { type: 'object' }\n }\n })\n )\n}\n\n/**\n * Multi file upload config\n *\n * @typedef {object} MultiFileUploadConfig\n * @property {string} [uploadUrl] - File upload URL\n * @property {string} [deleteUrl] - File delete URL\n * @property {string} [uploadStatusText] - Upload status text\n * @property {string} [dropzoneHintText] - Dropzone hint text\n * @property {string} [dropzoneButtonText] - Dropzone button text\n * @property {object} [feedbackContainer] - Feedback container config\n * @property {string} [feedbackContainer.selector] - Selector for feedback container\n * @property {Element | null} [feedbackContainer.element] - HTML element for feedback container\n * @property {MultiFileUploadHooks} [hooks] - Upload hooks\n */\n\n/**\n * Multi file upload hooks\n *\n * @typedef {object} MultiFileUploadHooks\n * @property {OnUploadFileEntryHook} [entryHook] - File upload entry hook\n * @property {OnUploadFileExitHook} [exitHook] - File upload exit hook\n * @property {OnUploadFileErrorHook} [errorHook] - File upload error hook\n * @property {OnUploadFileDeleteHook} [deleteHook] - File delete hook\n */\n\n/**\n * Upload hook: File entry\n *\n * @callback OnUploadFileEntryHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n */\n\n/**\n * Upload hook: File exit\n *\n * @callback OnUploadFileExitHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * Upload hook: File error\n *\n * @callback OnUploadFileErrorHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n * @param {Error} errorThrown - Error thrown\n */\n\n/**\n * Upload hook: File delete\n *\n * @callback OnUploadFileDeleteHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} [file] - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * @typedef {object} UploadResponseSuccess\n * @property {{ messageText: string, messageHtml: string }} success - Response success\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseError\n * @property {{ message: string }} error - Response error\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseFile\n * @property {string} filename - File name\n * @property {string} originalname - Original file name\n */\n\n/**\n * @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'\n */\n"],"names":["MultiFileUpload","ConfigurableComponent","constructor","$root","config","_this$config$feedback","isSupported","$feedbackContainer","feedbackContainer","element","querySelector","selector","HTMLElement","setupFileInput","setupDropzone","setupLabel","setupStatusBox","addEventListener","onFileDeleteClick","bind","classList","add","$dropzone","document","createElement","onDragOver","onDragLeave","onDrop","$fileInput","replaceWith","appendChild","$label","setAttribute","id","textContent","dropzoneButtonText","$hint","dropzoneHintText","append","onFileChange","onFileFocus","onFileBlur","$status","event","preventDefault","remove","uploadStatusText","uploadFiles","dataTransfer","files","file","Array","from","uploadFile","cloneNode","HTMLInputElement","value","focus","getSuccessHtml","success","messageHtml","getErrorHtml","error","message","getFileRow","$row","innerHTML","name","getDeleteButton","$button","filename","originalname","hooks","entryHook","$item","$message","$actions","$progress","formData","FormData","xhr","XMLHttpRequest","onLoad","status","response","onError","messageText","exitHook","responseText","Error","statusText","errorHook","upload","lengthComputable","percentComplete","Math","round","loaded","total","open","uploadUrl","responseType","send","target","HTMLButtonElement","contains","$rows","querySelectorAll","length","$rowDelete","find","deleteHook","undefined","deleteUrl","setRequestHeader","JSON","stringify","isDragAndDropSupported","isFormDataSupported","isFileApiSupported","div","ondrop","input","type","moduleName","defaults","Object","freeze","schema","properties"],"mappings":";;AAAA;;;AAIA;AACA;AACA;AACO,MAAMA,eAAe,SAASC,qBAAqB,CAAC;AACzD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAAA,IAAA,IAAAC,qBAAA;AAC9B,IAAA,KAAK,CAACF,KAAK,EAAEC,MAAM,CAAC;AAEpB,IAAA,IAAI,CAACJ,eAAe,CAACM,WAAW,EAAE,EAAE;AAClC,MAAA,OAAO,IAAI;AACb,IAAA;IAEA,MAAMC,kBAAkB,GAAA,CAAAF,qBAAA,GACtB,IAAI,CAACD,MAAM,CAACI,iBAAiB,CAACC,OAAO,KAAA,IAAA,GAAAJ,qBAAA,GACrC,IAAI,CAACF,KAAK,CAACO,aAAa,CAAC,IAAI,CAACN,MAAM,CAACI,iBAAiB,CAACG,QAAQ,CAAC;IAElE,IAAI,CAACJ,kBAAkB,IAAI,EAAEA,kBAAkB,YAAYK,WAAW,CAAC,EAAE;AACvE,MAAA,OAAO,IAAI;AACb,IAAA;IAEA,IAAI,CAACL,kBAAkB,GAAGA,kBAAkB;IAE5C,IAAI,CAACM,cAAc,EAAE;IACrB,IAAI,CAACC,aAAa,EAAE;IACpB,IAAI,CAACC,UAAU,EAAE;IACjB,IAAI,CAACC,cAAc,EAAE;AAErB,IAAA,IAAI,CAACb,KAAK,CAACc,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAACC,iBAAiB,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAChB,KAAK,CAACiB,SAAS,CAACC,GAAG,CAAC,iCAAiC,CAAC;AAC7D,EAAA;AAEAP,EAAAA,aAAaA,GAAG;IACd,IAAI,CAACQ,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAC9C,IAAI,CAACF,SAAS,CAACF,SA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AAAA,IAAI,EAAE;KAAU;AACtCnH,IAAAA,iBAAiB,EAAE;AAAEmH,MAAAA,IAAI,EAAE;KAAU;AACrCnD,IAAAA,KAAK,EAAE;AAAEmD,MAAAA,IAAI,EAAE;AAAS;AAC1B;AACF,CACF,CAAC;;;;"}
1
+ {"version":3,"file":"multi-file-upload.mjs","sources":["../../../../src/moj/components/multi-file-upload/multi-file-upload.mjs"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { ConfigurableComponent } from 'govuk-frontend'\n\n/**\n * @augments {ConfigurableComponent<MultiFileUploadConfig>}\n */\nexport class MultiFileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for multi file upload\n * @param {MultiFileUploadConfig} [config] - Multi file upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n if (!MultiFileUpload.isSupported()) {\n return this\n }\n\n const $feedbackContainer =\n this.config.feedbackContainer.element ??\n this.$root.querySelector(this.config.feedbackContainer.selector)\n\n if (!$feedbackContainer || !($feedbackContainer instanceof HTMLElement)) {\n return this\n }\n\n this.$feedbackContainer = $feedbackContainer\n\n this.setupFileInput()\n this.setupDropzone()\n this.setupLabel()\n this.setupStatusBox()\n\n this.$root.addEventListener('click', this.onFileDeleteClick.bind(this))\n this.$root.classList.add('moj-multi-file-upload--enhanced')\n }\n\n setupDropzone() {\n this.$dropzone = document.createElement('div')\n this.$dropzone.classList.add('moj-multi-file-upload__dropzone')\n\n this.$dropzone.addEventListener('dragover', this.onDragOver.bind(this))\n this.$dropzone.addEventListener('dragleave', this.onDragLeave.bind(this))\n this.$dropzone.addEventListener('drop', this.onDrop.bind(this))\n\n this.$fileInput.replaceWith(this.$dropzone)\n this.$dropzone.appendChild(this.$fileInput)\n }\n\n setupLabel() {\n const $label = document.createElement('label')\n $label.setAttribute('for', this.$fileInput.id)\n $label.classList.add('govuk-button', 'govuk-button--secondary')\n $label.textContent = this.config.dropzoneButtonText\n\n const $hint = document.createElement('p')\n $hint.classList.add('govuk-body')\n $hint.textContent = this.config.dropzoneHintText\n\n this.$label = $label\n this.$dropzone.append($hint)\n this.$dropzone.append($label)\n }\n\n setupFileInput() {\n this.$fileInput = /** @type {HTMLInputElement} */ (\n this.$root.querySelector('.moj-multi-file-upload__input')\n )\n this.$fileInput.addEventListener('change', this.onFileChange.bind(this))\n this.$fileInput.addEventListener('focus', this.onFileFocus.bind(this))\n this.$fileInput.addEventListener('blur', this.onFileBlur.bind(this))\n }\n\n setupStatusBox() {\n this.$status = document.createElement('div')\n this.$status.classList.add('govuk-visually-hidden')\n this.$status.setAttribute('aria-live', 'polite')\n this.$status.setAttribute('role', 'status')\n this.$dropzone.append(this.$status)\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDragOver(event) {\n event.preventDefault()\n this.$dropzone.classList.add('moj-multi-file-upload--dragover')\n }\n\n onDragLeave() {\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n }\n\n /**\n * @param {DragEvent} event - Drag event\n */\n onDrop(event) {\n event.preventDefault()\n this.$dropzone.classList.remove('moj-multi-file-upload--dragover')\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(event.dataTransfer.files)\n }\n\n /**\n * @param {FileList} files - File list\n */\n uploadFiles(files) {\n for (const file of Array.from(files)) {\n this.uploadFile(file)\n }\n }\n\n onFileChange() {\n this.$feedbackContainer.classList.remove('moj-hidden')\n this.$status.textContent = this.config.uploadStatusText\n this.uploadFiles(this.$fileInput.files)\n\n const $fileInput = this.$fileInput.cloneNode(true)\n if (!$fileInput || !($fileInput instanceof HTMLInputElement)) {\n return\n }\n\n $fileInput.value = ''\n this.$fileInput.replaceWith($fileInput)\n\n this.setupFileInput()\n this.$fileInput.focus()\n }\n\n onFileFocus() {\n this.$label.classList.add('moj-multi-file-upload--focused')\n }\n\n onFileBlur() {\n this.$label.classList.remove('moj-multi-file-upload--focused')\n }\n\n /**\n * @param {UploadResponseSuccess['success']} success\n */\n getSuccessHtml(success) {\n return `<span class=\"moj-multi-file-upload__success\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"/></svg>${success.messageHtml}</span>`\n }\n\n /**\n * @param {UploadResponseError['error']} error\n */\n getErrorHtml(error) {\n return `<span class=\"moj-multi-file-upload__error\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\"/></svg>${error.message}</span>`\n }\n\n /**\n * @param {File} file\n */\n getFileRow(file) {\n const $row = document.createElement('div')\n\n $row.classList.add('govuk-summary-list__row', 'moj-multi-file-upload__row')\n\n $row.innerHTML = `\n <div class=\"govuk-summary-list__value moj-multi-file-upload__message\">\n <span class=\"moj-multi-file-upload__filename\">${file.name}</span>\n <span class=\"moj-multi-file-upload__progress\">0%</span>\n </div>\n <div class=\"govuk-summary-list__actions moj-multi-file-upload__actions\"></div>\n `\n\n return $row\n }\n\n /**\n * @param {UploadResponseFile} file\n */\n getDeleteButton(file) {\n const $button = document.createElement('button')\n\n $button.setAttribute('type', 'button')\n $button.setAttribute('name', 'delete')\n $button.setAttribute('value', file.filename)\n\n $button.classList.add(\n 'moj-multi-file-upload__delete',\n 'govuk-button',\n 'govuk-button--secondary',\n 'govuk-!-margin-bottom-0'\n )\n\n $button.innerHTML = `Delete <span class=\"govuk-visually-hidden\">${file.originalname}</span>`\n\n return $button\n }\n\n /**\n * @param {File} file\n */\n uploadFile(file) {\n this.config.hooks.entryHook(this, file)\n\n const $item = this.getFileRow(file)\n const $message = $item.querySelector('.moj-multi-file-upload__message')\n const $actions = $item.querySelector('.moj-multi-file-upload__actions')\n const $progress = $item.querySelector('.moj-multi-file-upload__progress')\n\n const formData = new FormData()\n formData.append('documents', file)\n\n this.$feedbackContainer\n .querySelector('.moj-multi-file-upload__list')\n .append($item)\n\n const xhr = new XMLHttpRequest()\n\n const onLoad = () => {\n if (\n xhr.status < 200 ||\n xhr.status >= 300 ||\n !('success' in xhr.response)\n ) {\n return onError()\n }\n\n $message.innerHTML = this.getSuccessHtml(xhr.response.success)\n this.$status.textContent = xhr.response.success.messageText\n\n $actions.append(this.getDeleteButton(xhr.response.file))\n this.config.hooks.exitHook(this, file, xhr, xhr.statusText)\n }\n\n const onError = () => {\n const error = new Error(\n xhr.response && 'error' in xhr.response\n ? xhr.response.error.message\n : xhr.statusText || 'Upload failed'\n )\n\n $message.innerHTML = this.getErrorHtml(error)\n this.$status.textContent = error.message\n\n this.config.hooks.errorHook(this, file, xhr, xhr.statusText, error)\n }\n\n xhr.addEventListener('load', onLoad)\n xhr.addEventListener('error', onError)\n\n xhr.upload.addEventListener('progress', (event) => {\n if (!event.lengthComputable) {\n return\n }\n\n const percentComplete = Math.round((event.loaded / event.total) * 100)\n $progress.textContent = ` ${percentComplete}%`\n })\n\n xhr.open('POST', this.config.uploadUrl)\n xhr.responseType = 'json'\n\n xhr.send(formData)\n }\n\n /**\n * @param {MouseEvent} event - Click event\n */\n onFileDeleteClick(event) {\n const $button = event.target\n\n if (\n !$button ||\n !($button instanceof HTMLButtonElement) ||\n !$button.classList.contains('moj-multi-file-upload__delete')\n ) {\n return\n }\n\n event.preventDefault() // if user refreshes page and then deletes\n\n const xhr = new XMLHttpRequest()\n\n xhr.addEventListener('load', () => {\n if (xhr.status < 200 || xhr.status >= 300) {\n return\n }\n\n const $rows = Array.from(\n this.$feedbackContainer.querySelectorAll('.moj-multi-file-upload__row')\n )\n\n if ($rows.length === 1) {\n this.$feedbackContainer.classList.add('moj-hidden')\n }\n\n const $rowDelete = $rows.find(($row) => $row.contains($button))\n if ($rowDelete) $rowDelete.remove()\n\n this.config.hooks.deleteHook(this, undefined, xhr, xhr.statusText)\n })\n\n xhr.open('POST', this.config.deleteUrl)\n xhr.setRequestHeader('Content-Type', 'application/json')\n xhr.responseType = 'json'\n\n xhr.send(\n JSON.stringify({\n [$button.name]: $button.value\n })\n )\n }\n\n static isSupported() {\n return (\n this.isDragAndDropSupported() &&\n this.isFormDataSupported() &&\n this.isFileApiSupported()\n )\n }\n\n static isDragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n }\n\n static isFormDataSupported() {\n return typeof FormData === 'function'\n }\n\n static isFileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'moj-multi-file-upload'\n\n /**\n * Multi file upload default config\n *\n * @type {MultiFileUploadConfig}\n */\n static defaults = Object.freeze({\n uploadStatusText: 'Uploading files, please wait',\n dropzoneHintText: 'Drag and drop files here or',\n dropzoneButtonText: 'Choose files',\n feedbackContainer: {\n selector: '.moj-multi-file__uploaded-files'\n },\n hooks: {\n entryHook: () => {},\n exitHook: () => {},\n errorHook: () => {},\n deleteHook: () => {}\n }\n })\n\n /**\n * Multi file upload config schema\n *\n * @satisfies {Schema<MultiFileUploadConfig>}\n */\n static schema = Object.freeze(\n /** @type {const} */ ({\n properties: {\n uploadUrl: { type: 'string' },\n deleteUrl: { type: 'string' },\n uploadStatusText: { type: 'string' },\n dropzoneHintText: { type: 'string' },\n dropzoneButtonText: { type: 'string' },\n feedbackContainer: { type: 'object' },\n hooks: { type: 'object' }\n }\n })\n )\n}\n\n/**\n * Multi file upload config\n *\n * @typedef {object} MultiFileUploadConfig\n * @property {string} [uploadUrl] - File upload URL\n * @property {string} [deleteUrl] - File delete URL\n * @property {string} [uploadStatusText] - Upload status text\n * @property {string} [dropzoneHintText] - Dropzone hint text\n * @property {string} [dropzoneButtonText] - Dropzone button text\n * @property {object} [feedbackContainer] - Feedback container config\n * @property {string} [feedbackContainer.selector] - Selector for feedback container\n * @property {Element | null} [feedbackContainer.element] - HTML element for feedback container\n * @property {MultiFileUploadHooks} [hooks] - Upload hooks\n */\n\n/**\n * Multi file upload hooks\n *\n * @typedef {object} MultiFileUploadHooks\n * @property {OnUploadFileEntryHook} [entryHook] - File upload entry hook\n * @property {OnUploadFileExitHook} [exitHook] - File upload exit hook\n * @property {OnUploadFileErrorHook} [errorHook] - File upload error hook\n * @property {OnUploadFileDeleteHook} [deleteHook] - File delete hook\n */\n\n/**\n * Upload hook: File entry\n *\n * @callback OnUploadFileEntryHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n */\n\n/**\n * Upload hook: File exit\n *\n * @callback OnUploadFileExitHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * Upload hook: File error\n *\n * @callback OnUploadFileErrorHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} file - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n * @param {Error} errorThrown - Error thrown\n */\n\n/**\n * Upload hook: File delete\n *\n * @callback OnUploadFileDeleteHook\n * @param {InstanceType<typeof MultiFileUpload>} upload - Multi file upload\n * @param {File} [file] - File upload\n * @param {XMLHttpRequest} xhr - XMLHttpRequest\n * @param {string} textStatus - Text status\n */\n\n/**\n * @typedef {object} UploadResponseSuccess\n * @property {{ messageText: string, messageHtml: string }} success - Response success\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseError\n * @property {{ message: string }} error - Response error\n * @property {UploadResponseFile} file - Response file\n */\n\n/**\n * @typedef {object} UploadResponseFile\n * @property {string} filename - File name\n * @property {string} originalname - Original file name\n */\n\n/**\n * @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'\n */\n"],"names":["MultiFileUpload","ConfigurableComponent","constructor","$root","config","_this$config$feedback","isSupported","$feedbackContainer","feedbackContainer","element","querySelector","selector","HTMLElement","setupFileInput","setupDropzone","setupLabel","setupStatusBox","addEventListener","onFileDeleteClick","bind","classList","add","$dropzone","document","createElement","onDragOver","onDragLeave","onDrop","$fileInput","replaceWith","appendChild","$label","setAttribute","id","textContent","dropzoneButtonText","$hint","dropzoneHintText","append","onFileChange","onFileFocus","onFileBlur","$status","event","preventDefault","remove","uploadStatusText","uploadFiles","dataTransfer","files","file","Array","from","uploadFile","cloneNode","HTMLInputElement","value","focus","getSuccessHtml","success","messageHtml","getErrorHtml","error","message","getFileRow","$row","innerHTML","name","getDeleteButton","$button","filename","originalname","hooks","entryHook","$item","$message","$actions","$progress","formData","FormData","xhr","XMLHttpRequest","onLoad","status","response","onError","messageText","exitHook","statusText","Error","errorHook","upload","lengthComputable","percentComplete","Math","round","loaded","total","open","uploadUrl","responseType","send","target","HTMLButtonElement","contains","$rows","querySelectorAll","length","$rowDelete","find","deleteHook","undefined","deleteUrl","setRequestHeader","JSON","stringify","isDragAndDropSupported","isFormDataSupported","isFileApiSupported","div","ondrop","input","type","moduleName","defaults","Object","freeze","schema","properties"],"mappings":";;AAAA;;;AAIA;AACA;AACA;AACO,MAAMA,eAAe,SAASC,qBAAqB,CAAC;AACzD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAAA,IAAA,IAAAC,qBAAA;AAC9B,IAAA,KAAK,CAACF,KAAK,EAAEC,MAAM,CAAC;AAEpB,IAAA,IAAI,CAACJ,eAAe,CAACM,WAAW,EAAE,EAAE;AAClC,MAAA,OAAO,IAAI;AACb,IAAA;IAEA,MAAMC,kBAAkB,GAAA,CAAAF,qBAAA,GACtB,IAAI,CAACD,MAAM,CAACI,iBAAiB,CAACC,OAAO,KAAA,I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;AAC/CF,EAAAA,kBAAkB,EAAE,cAAc;AAClC3B,EAAAA,iBAAiB,EAAE;AACjBG,IAAAA,QAAQ,EAAE;GACX;AACD6D,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;AACnBc,IAAAA,QAAQ,EAAEA,MAAM,CAAC,CAAC;AAClBG,IAAAA,SAAS,EAAEA,MAAM,CAAC,CAAC;IACnBoB,UAAU,EAAEA,MAAM,CAAC;AACrB;AACF,CAAC,CAAC;AAEF;AACF;AACA;AACA;AACA;AAlWa9G,eAAe,CAmWnB+H,MAAM,GAAGF,MAAM,CAACC,MAAM,qBACL;AACpBE,EAAAA,UAAU,EAAE;AACV7B,IAAAA,SAAS,EAAE;AAAEuB,MAAAA,IAAI,EAAE;KAAU;AAC7BV,IAAAA,SAAS,EAAE;AAAEU,MAAAA,IAAI,EAAE;KAAU;AAC7B5E,IAAAA,gBAAgB,EAAE;AAAE4E,MAAAA,IAAI,EAAE;KAAU;AACpCrF,IAAAA,gBAAgB,EAAE;AAAEqF,MAAAA,IAAI,EAAE;KAAU;AACpCvF,IAAAA,kBAAkB,EAAE;AAAEuF,MAAAA,IAAI,EAAE;KAAU;AACtClH,IAAAA,iBAAiB,EAAE;AAAEkH,MAAAA,IAAI,EAAE;KAAU;AACrClD,IAAAA,KAAK,EAAE;AAAEkD,MAAAA,IAAI,EAAE;AAAS;AAC1B;AACF,CACF,CAAC;;;;"}
@@ -12,9 +12,9 @@
12
12
  <li class="moj-pagination__item moj-pagination__item--dots">…</li>
13
13
  {% else %}
14
14
  {%- if item.selected %}
15
- <li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.items | length }}" aria-current="page">{{ item.text }}</li>
15
+ <li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ (params.items | last).text }}" aria-current="page">{{ item.text }}</li>
16
16
  {% else %}
17
- <li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.items | length }}">{{ item.text }}</a></li>
17
+ <li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ (params.items | last).text }}">{{ item.text }}</a></li>
18
18
  {% endif -%}
19
19
  {% endif -%}
20
20
  {% endfor -%}
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### Installation
6
6
 
7
- You will need to install the MoJ Frontend Nunjucks filters to use the `mojTimeline()` Nunjucks macro:
7
+ You will need to install the MOJ Frontend Nunjucks filters to use the `mojTimeline()` Nunjucks macro:
8
8
 
9
9
  1. Import the filters
10
10
 
@@ -1,7 +1,7 @@
1
1
  :root {
2
2
  // This variable is automatically overwritten during builds and releases.
3
3
  // It doesn't need to be updated manually.
4
- --moj-frontend-version: "6.0.0";
4
+ --moj-frontend-version: "7.0.0";
5
5
  }
6
6
 
7
7
  /*# sourceMappingURL=_moj-frontend-properties.scss.map */