govuk_publishing_components 55.0.1 → 55.1.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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/file-upload.js +5 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +5 -2
  5. data/app/views/govuk_publishing_components/components/_file_upload.html.erb +13 -1
  6. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
  7. data/app/views/govuk_publishing_components/components/docs/file_upload.yml +6 -0
  8. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +1 -1
  9. data/lib/govuk_publishing_components/version.rb +1 -1
  10. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +313 -47
  11. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +312 -47
  13. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  14. data/node_modules/govuk-frontend/dist/govuk/all.mjs +2 -1
  15. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  16. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +21 -16
  17. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -1
  18. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  19. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +3 -0
  20. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  21. data/node_modules/govuk-frontend/dist/govuk/{govuk-frontend-component.mjs → component.mjs} +5 -5
  22. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  23. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +27 -19
  24. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  25. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +27 -19
  26. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +1 -1
  28. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +27 -19
  30. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +27 -19
  32. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +1 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  36. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +8 -0
  37. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  38. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +28 -20
  39. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  40. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +28 -20
  41. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  42. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +2 -2
  43. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  44. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +16 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +2 -2
  46. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  47. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +8 -5
  48. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +8 -5
  50. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  51. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  53. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +27 -19
  54. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  55. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +27 -19
  56. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +1 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +27 -19
  60. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +27 -19
  62. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +167 -0
  66. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  67. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +754 -0
  68. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  69. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +746 -0
  70. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  71. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +267 -0
  72. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +207 -16
  74. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  75. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  76. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  77. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  78. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  79. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  80. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  81. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  82. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  83. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  84. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +14 -10
  85. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  86. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +8 -5
  87. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +8 -5
  89. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +2 -2
  91. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  92. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +25 -12
  93. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +16 -2
  94. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +2 -2
  95. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  96. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  97. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +27 -19
  98. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  99. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +27 -19
  100. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  101. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  103. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +16 -2
  104. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +2 -2
  105. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +27 -20
  106. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +27 -20
  108. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  109. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +1 -2
  110. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  111. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  112. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  113. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +8 -5
  114. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  115. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +8 -5
  116. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  117. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +2 -2
  118. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  119. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +16 -1
  120. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  121. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  123. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +8 -5
  124. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -1
  125. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +8 -5
  126. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -1
  127. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +2 -2
  128. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -1
  129. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +9 -6
  130. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  131. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +9 -6
  132. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  133. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -3
  134. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  135. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +12 -21
  136. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  137. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +142 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +8 -5
  140. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  141. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +8 -5
  142. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  143. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +2 -2
  144. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +15 -1
  146. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +2 -2
  147. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  148. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +1 -1
  150. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  151. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  152. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  153. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  154. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  155. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +2 -2
  156. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  157. data/node_modules/govuk-frontend/dist/govuk/init.mjs +11 -11
  158. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  159. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +18 -5
  160. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  161. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  162. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  163. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
  164. data/node_modules/govuk-frontend/package.json +7 -7
  165. metadata +21 -5
  166. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  167. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload.bundle.mjs","sources":["../../../../src/govuk/common/closest-attribute-value.mjs","../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/component.mjs","../../../../src/govuk/common/configuration.mjs","../../../../src/govuk/i18n.mjs","../../../../src/govuk/components/file-upload/file-upload.mjs"],"sourcesContent":["/**\n * Returns the value of the given attribute closest to the given element (including itself)\n *\n * @internal\n * @param {Element} $element - The element to start walking the DOM tree up\n * @param {string} attributeName - The name of the attribute\n * @returns {string | null} Attribute value\n */\nexport function closestAttributeValue($element, attributeName) {\n const $closestElementWithAttribute = $element.closest(`[${attributeName}]`)\n return $closestElementWithAttribute\n ? $closestElementWithAttribute.getAttribute(attributeName)\n : null\n}\n","/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if component is already initialised\n *\n * @internal\n * @param {Element} $root - HTML element to be checked\n * @param {string} moduleName - name of component module\n * @returns {boolean} Whether component is already initialised\n */\nexport function isInitialised($root, moduleName) {\n return (\n $root instanceof HTMLElement &&\n $root.hasAttribute(`data-${moduleName}-init`)\n )\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 */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @template {Partial<Record<keyof ObjectType, unknown>>} [ObjectType=ObjectNested]\n * @param {unknown | ObjectType} option - Option to check\n * @returns {option is ObjectType} Whether the option is an object\n */\nexport function isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Format error message\n *\n * @internal\n * @param {ComponentWithModuleName} Component - Component that threw the error\n * @param {string} message - Error message\n * @returns {string} - Formatted error message\n */\nexport function formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`\n}\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @import { ObjectNested } from './configuration.mjs'\n */\n","import { formatErrorMessage } from '../common/index.mjs'\n\n/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @virtual\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\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 =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { component, identifier, element, expectedType } = messageOrOptions\n\n message = identifier\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n\n message = formatErrorMessage(component, message)\n }\n\n super(message)\n }\n}\n\n/**\n * Indicates that a component is already initialised\n */\nexport class InitError extends GOVUKFrontendError {\n name = 'InitError'\n\n /**\n * @internal\n * @param {ComponentWithModuleName | string} componentOrMessage - name of the component module\n */\n constructor(componentOrMessage) {\n const message =\n typeof componentOrMessage === 'string'\n ? componentOrMessage\n : formatErrorMessage(\n componentOrMessage,\n `Root element (\\`$root\\`) already initialised`\n )\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n * @property {ComponentWithModuleName} component - Component throwing the error\n */\n\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n","import { isInitialised, isSupported } from './common/index.mjs'\nimport { ElementError, InitError, SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Element} [RootElementType=HTMLElement]\n */\nexport class Component {\n /**\n * @type {typeof Element}\n */\n static elementType = HTMLElement\n\n // allows Typescript user to work around the lack of types\n // in GOVUKFrontend package, Typescript is not aware of $root\n // in components that extend GOVUKFrontendComponent\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\n /**\n * @protected\n * @type {RootElementType}\n */\n _$root\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n */\n constructor($root) {\n const childConstructor = /** @type {ChildClassConstructor} */ (\n this.constructor\n )\n\n // TypeScript does not enforce that inheriting classes will define a `moduleName`\n // (even if we add a `@virtual` `static moduleName` property to this class).\n // While we trust users to do this correctly, we do a little check to provide them\n // a helpful error message.\n //\n // After this, we'll be sure that `childConstructor` has a `moduleName`\n // as expected of the `ChildClassConstructor` we've cast `this.constructor` to.\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`)\n }\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 = /** @type {RootElementType} */ ($root)\n }\n\n childConstructor.checkSupport()\n\n this.checkInitialised()\n\n const moduleName = childConstructor.moduleName\n\n this.$root.setAttribute(`data-${moduleName}-init`, '')\n }\n\n /**\n * Validates whether component is already initialised\n *\n * @private\n * @throws {InitError} when component is already initialised\n */\n checkInitialised() {\n const constructor = /** @type {ChildClassConstructor} */ (this.constructor)\n const moduleName = constructor.moduleName\n\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor)\n }\n }\n\n /**\n * Validates whether components are supported\n *\n * @throws {SupportError} when the components are not supported\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 */\n","import { Component } from '../component.mjs'\nimport { ConfigError } from '../errors/index.mjs'\n\nimport { isObject, formatErrorMessage } from './index.mjs'\n\nexport const configOverride = Symbol.for('configOverride')\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @template {Element & { dataset: DOMStringMap }} [RootElementType=HTMLElement]\n * @augments Component<RootElementType>\n */\nexport class ConfigurableComponent extends Component {\n /**\n * configOverride\n *\n * Function which defines configuration overrides to prioritize\n * properties from the root element's dataset.\n *\n * It should take a subset of configuration as input and return\n * a new configuration object with properties that should be\n * overridden based on the root element's dataset. A Symbol\n * is used for indexing to prevent conflicts.\n *\n * @internal\n * @virtual\n * @param {Partial<ConfigurationType>} [param] - Configuration object\n * @returns {Partial<ConfigurationType>} return - Configuration object\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\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\n /**\n *\n * @type {ConfigurationType}\n */\n _config\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n * @param {ConfigurationType} [config] - HTML element to use for component\n */\n constructor($root, config) {\n super($root)\n\n const childConstructor =\n /** @type {ChildClassConstructor<ConfigurationType>} */ (this.constructor)\n\n if (!isObject(childConstructor.defaults)) {\n throw new ConfigError(\n formatErrorMessage(\n childConstructor,\n 'Config passed as parameter into constructor but no defaults defined'\n )\n )\n }\n\n const datasetConfig = /** @type {ConfigurationType} */ (\n normaliseDataset(childConstructor, this._$root.dataset)\n )\n\n this._config = /** @type {ConfigurationType} */ (\n mergeConfigs(\n childConstructor.defaults,\n config ?? {},\n this[configOverride](datasetConfig),\n datasetConfig\n )\n )\n }\n}\n\n/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @internal\n * @param {DOMStringMap[string]} value - The value to normalise\n * @param {SchemaProperty} [property] - Component schema property\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : ''\n\n let output\n let outputType = property?.type\n\n // No schema type set? Determine automatically\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean'\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number'\n }\n }\n\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true'\n break\n\n case 'number':\n output = Number(trimmedValue)\n break\n\n default:\n output = value\n }\n\n return output\n}\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using {@link normaliseString},\n * optionally expanding nested `i18n.field`\n *\n * @internal\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @template {[keyof ConfigurationType, SchemaProperty | undefined][]} SchemaEntryType\n * @param {{ schema?: Schema<ConfigurationType>, moduleName: string }} Component - Component class\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {ObjectNested} Normalised dataset\n */\nexport function normaliseDataset(Component, dataset) {\n if (!isObject(Component.schema)) {\n throw new ConfigError(\n formatErrorMessage(\n Component,\n 'Config passed as parameter into constructor but no schema defined'\n )\n )\n }\n\n const out = /** @type {ObjectNested} */ ({})\n const entries = /** @type {SchemaEntryType} */ (\n Object.entries(Component.schema.properties)\n )\n\n // Normalise top-level dataset ('data-*') values using schema types\n for (const entry of entries) {\n const [namespace, property] = entry\n\n // Cast the `namespace` to string so it can be used to access the dataset\n const field = namespace.toString()\n\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property)\n }\n\n /**\n * Extract and normalise nested object values automatically using\n * {@link normaliseString} but only schema object types are allowed\n */\n if (property?.type === 'object') {\n out[field] = extractConfigByNamespace(\n Component.schema,\n dataset,\n namespace\n )\n }\n }\n\n return out\n}\n\n/**\n * Config merging function\n *\n * Takes any number of objects and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge\n * @returns {{ [key: string]: unknown }} A merged config object\n */\nexport function mergeConfigs(...configObjects) {\n // Start with an empty object as our base\n /** @type {{ [key: string]: unknown }} */\n const formattedConfigObject = {}\n\n // Loop through each of the passed objects\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\n // Push their keys one-by-one into formattedConfigObject. Any duplicate\n // keys with object values will be merged, otherwise the new value will\n // override the existing value.\n if (isObject(option) && isObject(override)) {\n formattedConfigObject[key] = mergeConfigs(option, override)\n } else {\n // Apply override\n formattedConfigObject[key] = override\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Validate component config by schema\n *\n * Follows limited examples in JSON schema for wider support in future\n *\n * {@link https://ajv.js.org/json-schema.html#compound-keywords}\n * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}\n *\n * @internal\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @param {Schema<ConfigurationType>} schema - The schema of a component\n * @param {ConfigurationType} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n const validationErrors = []\n\n // Check errors for each schema\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = []\n\n // Check errors for each schema condition\n if (Array.isArray(conditions)) {\n for (const { required, errorMessage } of conditions) {\n if (!required.every((key) => !!config[key])) {\n errors.push(errorMessage) // Missing config key value\n }\n }\n\n // Check one condition passes or add errors\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors)\n }\n }\n }\n\n return validationErrors\n}\n\n/**\n * Extracts keys starting with a particular namespace from dataset ('data-*')\n * object, removing the namespace in the process, normalising all values\n *\n * @internal\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @param {Schema<ConfigurationType>} schema - The schema of a component\n * @param {DOMStringMap} dataset - The object to extract key-value pairs from\n * @param {keyof ConfigurationType} namespace - The namespace to filter keys with\n * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(schema, dataset, namespace) {\n const property = schema.properties[namespace]\n\n // Only extract configs for object schema properties\n if (property?.type !== 'object') {\n return\n }\n\n // Add default empty config\n const newObject = /** @type {Record<typeof namespace, ObjectNested>} */ ({\n [namespace]: {}\n })\n\n for (const [key, value] of Object.entries(dataset)) {\n /** @type {ObjectNested | ObjectNested[NestedKey]} */\n let current = newObject\n\n // Split the key into parts, using . as our namespace separator\n const keyParts = key.split('.')\n\n /**\n * Create new level per part\n *\n * e.g. 'i18n.textareaDescription.other' becomes\n * `{ i18n: { textareaDescription: { other } } }`\n */\n for (const [index, name] of keyParts.entries()) {\n if (isObject(current)) {\n // Drop down to nested object until the last part\n if (index < keyParts.length - 1) {\n // New nested object (optionally) replaces existing value\n if (!isObject(current[name])) {\n current[name] = {}\n }\n\n // Drop down into new or existing nested object\n current = current[name]\n } else if (key !== namespace) {\n // Normalised value (optionally) replaces existing value\n current[name] = normaliseString(value)\n }\n }\n }\n }\n\n return newObject[namespace]\n}\n\n/**\n * @internal\n * @typedef {keyof ObjectNested} NestedKey\n * @typedef {{ [key: string]: string | boolean | number | ObjectNested | undefined }} ObjectNested\n */\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/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\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/**\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/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n","/**\n * Internal support for selecting messages to render, with placeholder\n * interpolation and locale-aware number formatting and pluralisation\n *\n * @internal\n */\nexport class I18n {\n translations\n locale\n\n /**\n * @internal\n * @param {{ [key: string]: string | TranslationPluralForms }} translations - Key-value pairs of the translation strings to use.\n * @param {object} [config] - Configuration options for the function.\n * @param {string | null} [config.locale] - An overriding locale for the PluralRules functionality.\n */\n constructor(translations = {}, config = {}) {\n // Make list of translations available throughout function\n this.translations = translations\n\n // The locale to use for PluralRules and NumberFormat\n this.locale = config.locale ?? (document.documentElement.lang || 'en')\n }\n\n /**\n * The most used function - takes the key for a given piece of UI text and\n * returns the appropriate string.\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {{ [key: string]: unknown }} [options] - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The appropriate translation string.\n * @throws {Error} Lookup key required\n * @throws {Error} Options required for `${}` placeholders\n */\n t(lookupKey, options) {\n if (!lookupKey) {\n // Print a console error if no lookup key has been provided\n throw new Error('i18n: lookup key missing')\n }\n\n // Fetch the translation for that lookup key\n let translation = this.translations[lookupKey]\n\n // If the `count` option is set, determine which plural suffix is needed and\n // change the lookupKey to match. We check to see if it's numeric instead of\n // falsy, as this could legitimately be 0.\n if (typeof options?.count === 'number' && typeof translation === 'object') {\n const translationPluralForm =\n translation[this.getPluralSuffix(lookupKey, options.count)]\n\n // Update translation with plural suffix\n if (translationPluralForm) {\n translation = translationPluralForm\n }\n }\n\n if (typeof translation === 'string') {\n // Check for ${} placeholders in the translation string\n if (translation.match(/%{(.\\S+)}/)) {\n if (!options) {\n throw new Error(\n 'i18n: cannot replace placeholders in string if no option data provided'\n )\n }\n\n return this.replacePlaceholders(translation, options)\n }\n\n return translation\n }\n\n // If the key wasn't found in our translations object,\n // return the lookup key itself as the fallback\n return lookupKey\n }\n\n /**\n * Takes a translation string with placeholders, and replaces the placeholders\n * with the provided data\n *\n * @internal\n * @param {string} translationString - The translation string\n * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The translation string to output, with $\\{\\} placeholders replaced\n */\n replacePlaceholders(translationString, options) {\n const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length\n ? new Intl.NumberFormat(this.locale)\n : undefined\n\n return translationString.replace(\n /%{(.\\S+)}/g,\n\n /**\n * Replace translation string placeholders\n *\n * @internal\n * @param {string} placeholderWithBraces - Placeholder with braces\n * @param {string} placeholderKey - Placeholder key\n * @returns {string} Placeholder value\n */\n function (placeholderWithBraces, placeholderKey) {\n if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n const placeholderValue = options[placeholderKey]\n\n // If a user has passed `false` as the value for the placeholder\n // treat it as though the value should not be displayed\n if (\n placeholderValue === false ||\n (typeof placeholderValue !== 'number' &&\n typeof placeholderValue !== 'string')\n ) {\n return ''\n }\n\n // If the placeholder's value is a number, localise the number formatting\n if (typeof placeholderValue === 'number') {\n return formatter\n ? formatter.format(placeholderValue)\n : `${placeholderValue}`\n }\n\n return placeholderValue\n }\n\n throw new Error(\n `i18n: no data found to replace ${placeholderWithBraces} placeholder in string`\n )\n }\n )\n }\n\n /**\n * Check to see if the browser supports Intl.PluralRules\n *\n * It requires all conditions to be met in order to be supported:\n * - The implementation of Intl supports PluralRules (NOT true in Safari 10–12)\n * - The browser/OS has plural rules for the current locale (browser dependent)\n *\n * {@link https://browsersl.ist/#q=supports+es6-module+and+not+supports+intl-pluralrules}\n *\n * @internal\n * @returns {boolean} Returns true if all conditions are met. Returns false otherwise.\n */\n hasIntlPluralRulesSupport() {\n return Boolean(\n 'PluralRules' in window.Intl &&\n Intl.PluralRules.supportedLocalesOf(this.locale).length\n )\n }\n\n /**\n * Get the appropriate suffix for the plural form.\n *\n * Uses Intl.PluralRules (or our own fallback implementation) to get the\n * 'preferred' form to use for the given count.\n *\n * Checks that a translation has been provided for that plural form – if it\n * hasn't, it'll fall back to the 'other' plural form (unless that doesn't exist\n * either, in which case an error will be thrown)\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The suffix associated with the correct pluralisation for this locale.\n * @throws {Error} Plural form `.other` required when preferred plural form is missing\n */\n getPluralSuffix(lookupKey, count) {\n // Validate that the number is actually a number.\n //\n // Number(count) will turn anything that can't be converted to a Number type\n // into 'NaN'. isFinite filters out NaN, as it isn't a finite number.\n count = Number(count)\n if (!isFinite(count)) {\n return 'other'\n }\n\n // Fetch the translation for that lookup key\n const translation = this.translations[lookupKey]\n\n // Check to verify that all the requirements for Intl.PluralRules are met.\n // If so, we can use that instead of our custom implementation. Otherwise,\n // use the hardcoded fallback.\n const preferredForm = this.hasIntlPluralRulesSupport()\n ? new Intl.PluralRules(this.locale).select(count)\n : this.selectPluralFormUsingFallbackRules(count)\n\n // Use the correct plural form if provided\n if (typeof translation === 'object') {\n if (preferredForm in translation) {\n return preferredForm\n // Fall back to `other` if the plural form is missing, but log a warning\n // to the console\n } else if ('other' in translation) {\n console.warn(\n `i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`\n )\n\n return 'other'\n }\n }\n\n // If the required `other` plural form is missing, all we can do is error\n throw new Error(\n `i18n: Plural form \".other\" is required for \"${this.locale}\" locale`\n )\n }\n\n /**\n * Get the plural form using our fallback implementation\n *\n * This is split out into a separate function to make it easier to test the\n * fallback behaviour in an environment where Intl.PluralRules exists.\n *\n * @internal\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The pluralisation form for count in this locale.\n */\n selectPluralFormUsingFallbackRules(count) {\n // Currently our custom code can only handle positive integers, so let's\n // make sure our number is one of those.\n count = Math.abs(Math.floor(count))\n\n const ruleset = this.getPluralRulesForLocale()\n\n if (ruleset) {\n return I18n.pluralRules[ruleset](count)\n }\n\n return 'other'\n }\n\n /**\n * Work out which pluralisation rules to use for the current locale\n *\n * The locale may include a regional indicator (such as en-GB), but we don't\n * usually care about this part, as pluralisation rules are usually the same\n * regardless of region. There are exceptions, however, (e.g. Portuguese) so\n * this searches by both the full and shortened locale codes, just to be sure.\n *\n * @internal\n * @returns {string | undefined} The name of the pluralisation rule to use (a key for one\n * of the functions in this.pluralRules)\n */\n getPluralRulesForLocale() {\n const localeShort = this.locale.split('-')[0]\n\n // Look through the plural rules map to find which `pluralRule` is\n // appropriate for our current `locale`.\n for (const pluralRule in I18n.pluralRulesMap) {\n const languages = I18n.pluralRulesMap[pluralRule]\n if (languages.includes(this.locale) || languages.includes(localeShort)) {\n return pluralRule\n }\n }\n }\n\n /**\n * Map of plural rules to languages where those rules apply.\n *\n * Note: These groups are named for the most dominant or recognisable language\n * that uses each system. The groupings do not imply that the languages are\n * related to one another. Many languages have evolved the same systems\n * independently of one another.\n *\n * Code to support more languages can be found in the i18n spike:\n * {@link https://github.com/alphagov/govuk-frontend/blob/spike-i18n-support/src/govuk/i18n.mjs}\n *\n * Languages currently supported:\n *\n * Arabic: Arabic (ar)\n * Chinese: Burmese (my), Chinese (zh), Indonesian (id), Japanese (ja),\n * Javanese (jv), Korean (ko), Malay (ms), Thai (th), Vietnamese (vi)\n * French: Armenian (hy), Bangla (bn), French (fr), Gujarati (gu), Hindi (hi),\n * Persian Farsi (fa), Punjabi (pa), Zulu (zu)\n * German: Afrikaans (af), Albanian (sq), Azerbaijani (az), Basque (eu),\n * Bulgarian (bg), Catalan (ca), Danish (da), Dutch (nl), English (en),\n * Estonian (et), Finnish (fi), Georgian (ka), German (de), Greek (el),\n * Hungarian (hu), Luxembourgish (lb), Norwegian (no), Somali (so),\n * Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Turkish (tr),\n * Urdu (ur)\n * Irish: Irish Gaelic (ga)\n * Russian: Russian (ru), Ukrainian (uk)\n * Scottish: Scottish Gaelic (gd)\n * Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)\n * Welsh: Welsh (cy)\n *\n * @internal\n * @type {{ [key: string]: string[] }}\n */\n static pluralRulesMap = {\n arabic: ['ar'],\n chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],\n french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],\n german: [\n 'af',\n 'sq',\n 'az',\n 'eu',\n 'bg',\n 'ca',\n 'da',\n 'nl',\n 'en',\n 'et',\n 'fi',\n 'ka',\n 'de',\n 'el',\n 'hu',\n 'lb',\n 'no',\n 'so',\n 'sw',\n 'sv',\n 'ta',\n 'te',\n 'tr',\n 'ur'\n ],\n irish: ['ga'],\n russian: ['ru', 'uk'],\n scottish: ['gd'],\n spanish: ['pt-PT', 'it', 'es'],\n welsh: ['cy']\n }\n\n /**\n * Different pluralisation rule sets\n *\n * Returns the appropriate suffix for the plural form associated with `n`.\n * Possible suffixes: 'zero', 'one', 'two', 'few', 'many', 'other' (the actual\n * meaning of each differs per locale). 'other' should always exist, even in\n * languages without plurals, such as Chinese.\n * {@link https://cldr.unicode.org/index/cldr-spec/plural-rules}\n *\n * The count must be a positive integer. Negative numbers and decimals aren't accounted for\n *\n * @internal\n * @type {{ [key: string]: (count: number) => PluralRule }}\n */\n static pluralRules = {\n arabic(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n % 100 >= 3 && n % 100 <= 10) {\n return 'few'\n }\n if (n % 100 >= 11 && n % 100 <= 99) {\n return 'many'\n }\n return 'other'\n },\n chinese() {\n return 'other'\n },\n french(n) {\n return n === 0 || n === 1 ? 'one' : 'other'\n },\n german(n) {\n return n === 1 ? 'one' : 'other'\n },\n irish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n >= 3 && n <= 6) {\n return 'few'\n }\n if (n >= 7 && n <= 10) {\n return 'many'\n }\n return 'other'\n },\n russian(n) {\n const lastTwo = n % 100\n const last = lastTwo % 10\n if (last === 1 && lastTwo !== 11) {\n return 'one'\n }\n if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {\n return 'few'\n }\n if (\n last === 0 ||\n (last >= 5 && last <= 9) ||\n (lastTwo >= 11 && lastTwo <= 14)\n ) {\n return 'many'\n }\n // Note: The 'other' suffix is only used by decimal numbers in Russian.\n // We don't anticipate it being used, but it's here for consistency.\n return 'other'\n },\n scottish(n) {\n if (n === 1 || n === 11) {\n return 'one'\n }\n if (n === 2 || n === 12) {\n return 'two'\n }\n if ((n >= 3 && n <= 10) || (n >= 13 && n <= 19)) {\n return 'few'\n }\n return 'other'\n },\n spanish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n % 1000000 === 0 && n !== 0) {\n return 'many'\n }\n return 'other'\n },\n welsh(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n === 3) {\n return 'few'\n }\n if (n === 6) {\n return 'many'\n }\n return 'other'\n }\n }\n}\n\n/**\n * Plural rule category mnemonic tags\n *\n * @internal\n * @typedef {'zero' | 'one' | 'two' | 'few' | 'many' | 'other'} PluralRule\n */\n\n/**\n * Translated message by plural rule they correspond to.\n *\n * Allows to group pluralised messages under a single key when passing\n * translations to a component's constructor\n *\n * @internal\n * @typedef {object} TranslationPluralForms\n * @property {string} [other] - General plural form\n * @property {string} [zero] - Plural form used with 0\n * @property {string} [one] - Plural form used with 1\n * @property {string} [two] - Plural form used with 2\n * @property {string} [few] - Plural form used for a few\n * @property {string} [many] - Plural form used for many\n */\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { formatErrorMessage } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nexport class FileUpload extends ConfigurableComponent {\n /**\n * @private\n * @type {HTMLFileInputElement}\n */\n $input\n\n /**\n * @private\n */\n $button\n\n /**\n * @private\n */\n $status\n\n /** @private */\n i18n\n\n /** @private */\n id\n\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n const $input = this.$root.querySelector('input')\n\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n })\n }\n\n if ($input.type !== 'file') {\n throw new ElementError(\n formatErrorMessage(\n FileUpload,\n 'File input (`<input type=\"file\">`) attribute (`type`) is not `file`'\n )\n )\n }\n\n this.$input = /** @type {HTMLFileInputElement} */ ($input)\n this.$input.setAttribute('hidden', 'true')\n\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n })\n }\n\n this.id = this.$input.id\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue(this.$root, 'lang')\n })\n\n const $label = this.findLabel()\n // Add an ID to the label if it doesn't have one already\n // so it can be referenced by `aria-labelledby`\n if (!$label.id) {\n $label.id = `${this.id}-label`\n }\n\n // we need to copy the 'id' of the root element\n // to the new button replacement element\n // so that focus will work in the error summary\n this.$input.id = `${this.id}-input`\n\n // Create the file selection button\n const $button = document.createElement('button')\n $button.classList.add('govuk-file-upload-button')\n $button.type = 'button'\n $button.id = this.id\n $button.classList.add('govuk-file-upload-button--empty')\n\n // Copy `aria-describedby` if present so hints and errors\n // are associated to the `<button>`\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby')\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy)\n }\n\n // Create status element that shows what/how many files are selected\n const $status = document.createElement('span')\n $status.className = 'govuk-body govuk-file-upload-button__status'\n $status.setAttribute('aria-live', 'polite')\n $status.innerText = this.i18n.t('noFileChosen')\n\n $button.appendChild($status)\n\n const commaSpan = document.createElement('span')\n commaSpan.className = 'govuk-visually-hidden'\n commaSpan.innerText = ', '\n commaSpan.id = `${this.id}-comma`\n\n $button.appendChild(commaSpan)\n\n const containerSpan = document.createElement('span')\n containerSpan.className =\n 'govuk-file-upload-button__pseudo-button-container'\n\n const buttonSpan = document.createElement('span')\n buttonSpan.className =\n 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'\n buttonSpan.innerText = this.i18n.t('chooseFilesButton')\n\n containerSpan.appendChild(buttonSpan)\n\n // Add a space so the button and instruction read correctly\n // when CSS is disabled\n containerSpan.insertAdjacentText('beforeend', ' ')\n\n const instructionSpan = document.createElement('span')\n instructionSpan.className =\n 'govuk-body govuk-file-upload-button__instruction'\n instructionSpan.innerText = this.i18n.t('dropInstruction')\n\n containerSpan.appendChild(instructionSpan)\n\n $button.appendChild(containerSpan)\n $button.setAttribute(\n 'aria-labelledby',\n `${$label.id} ${commaSpan.id} ${$button.id}`\n )\n $button.addEventListener('click', this.onClick.bind(this))\n $button.addEventListener('dragover', (event) => {\n // prevent default to allow drop\n event.preventDefault()\n })\n\n // Assemble these all together\n this.$root.insertAdjacentElement('afterbegin', $button)\n\n this.$input.setAttribute('tabindex', '-1')\n this.$input.setAttribute('aria-hidden', 'true')\n\n // Make all these new variables available to the module\n this.$button = $button\n this.$status = $status\n\n // Bind change event to the underlying input\n this.$input.addEventListener('change', this.onChange.bind(this))\n\n // Synchronise the `disabled` state between the button and underlying input\n this.updateDisabledState()\n this.observeDisabledState()\n\n // Handle drop zone visibility\n // A live region to announce when users enter or leave the drop zone\n this.$announcements = document.createElement('span')\n this.$announcements.classList.add('govuk-file-upload-announcements')\n this.$announcements.classList.add('govuk-visually-hidden')\n this.$announcements.setAttribute('aria-live', 'assertive')\n this.$root.insertAdjacentElement('afterend', this.$announcements)\n\n // if there is no CSS and input is hidden\n // button will need to handle drop event\n this.$button.addEventListener('drop', this.onDrop.bind(this))\n\n // While user is dragging, it gets a little more complex because of Safari.\n // Safari doesn't fill `relatedTarget` on `dragleave` (nor `dragenter`).\n // This means we can't use `relatedTarget` to:\n // - check if the user is still within the wrapper\n // (`relatedTarget` being a descendant of the wrapper)\n // - check if the user is still over the viewport\n // (`relatedTarget` being null if outside)\n\n // Thanks to `dragenter` bubbling, we can listen on the `document` with a\n // single function and update the visibility based on whether we entered a\n // node inside or outside the wrapper.\n document.addEventListener(\n 'dragenter',\n this.updateDropzoneVisibility.bind(this)\n )\n\n // To detect if we're outside the document, we can track if there was a\n // `dragenter` event preceding a `dragleave`. If there wasn't, this means\n // we're outside the document.\n //\n // The order of events is guaranteed by the HTML specs:\n // https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true\n })\n\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n\n this.enteredAnotherElement = false\n })\n }\n\n /**\n * Updates the visibility of the dropzone as users enters the various elements on the page\n *\n * @param {DragEvent} event - The `dragenter` event\n */\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return\n\n // DOM interfaces only type `event.target` as `EventTarget`\n // so we first need to make sure it's a `Node`\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n // Only update the class and make the announcement if not already visible\n // to avoid repeated announcements on NVDA (2024.4) + Firefox (133)\n if (\n !this.$button.classList.contains(\n 'govuk-file-upload-button--dragging'\n )\n ) {\n this.showDraggingState()\n this.$announcements.innerText = this.i18n.t('enteredDropZone')\n }\n }\n } else {\n // Only hide the dropzone if it is visible to prevent announcing user\n // left the drop zone when they enter the page but haven't reached yet\n // the file upload component\n if (\n this.$button.classList.contains('govuk-file-upload-button--dragging')\n ) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n }\n }\n }\n\n /**\n * Show the drop zone visually\n */\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging')\n }\n\n /**\n * Hides the drop zone visually\n */\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging')\n }\n\n /**\n * Handles user dropping on the component\n *\n * @param {DragEvent} event - The `dragenter` event\n */\n onDrop(event) {\n event.preventDefault()\n\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files\n\n // Dispatch a `change` event so external code that would rely on the `<input>`\n // dispatching an event when files are dropped still work.\n // Use a `CustomEvent` so our events are distinguishable from browser's native events\n this.$input.dispatchEvent(new CustomEvent('change'))\n\n this.hideDraggingState()\n }\n }\n\n /**\n * Check if the value of the underlying input has changed\n */\n onChange() {\n const fileCount = this.$input.files.length\n\n if (fileCount === 0) {\n // If there are no files, show the default selection text\n this.$status.innerText = this.i18n.t('noFileChosen')\n this.$button.classList.add('govuk-file-upload-button--empty')\n } else {\n if (\n // If there is 1 file, just show the file name\n fileCount === 1\n ) {\n this.$status.innerText = this.$input.files[0].name\n } else {\n // Otherwise, tell the user how many files are selected\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n })\n }\n\n this.$button.classList.remove('govuk-file-upload-button--empty')\n }\n }\n\n /**\n * Looks up the `<label>` element associated to the field\n *\n * @private\n * @returns {HTMLElement} The `<label>` element associated to the field\n * @throws {ElementError} If the `<label>` cannot be found\n */\n findLabel() {\n // Use `label` in the selector so TypeScript knows the type fo `HTMLElement`\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`)\n\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n })\n }\n\n return $label\n }\n\n /**\n * When the button is clicked, emulate clicking the actual, hidden file input\n */\n onClick() {\n this.$input.click()\n }\n\n /**\n * Create a mutation observer to check if the input's attributes altered.\n */\n observeDisabledState() {\n const observer = new MutationObserver((mutationList) => {\n for (const mutation of mutationList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'disabled'\n ) {\n this.updateDisabledState()\n }\n }\n })\n\n observer.observe(this.$input, {\n attributes: true\n })\n }\n\n /**\n * Synchronise the `disabled` state between the input and replacement button.\n */\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled\n\n this.$root.classList.toggle(\n 'govuk-drop-zone--disabled',\n this.$button.disabled\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-file-upload'\n\n /**\n * File upload default config\n *\n * @see {@link FileUploadConfig}\n * @constant\n * @type {FileUploadConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n // the 'one' string isn't used as the component displays the filename\n // instead, however it's here for coverage's sake\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n })\n\n /**\n * File upload config schema\n *\n * @constant\n * @satisfies {Schema<FileUploadConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' }\n }\n })\n}\n\n/**\n * Checks if the given `DataTransfer` contains files\n *\n * @internal\n * @param {DataTransfer} dataTransfer - The `DataTransfer` to check\n * @returns {boolean} - `true` if it contains files or we can't infer it, `false` otherwise\n */\nfunction isContainingFiles(dataTransfer) {\n // Safari sometimes does not provide info about types :'(\n // In which case best not to assume anything and try to set the files\n const hasNoTypesInfo = dataTransfer.types.length === 0\n\n // When dragging images, there's a mix of mime types + Files\n // which we can't assign to the native input\n const isDraggingFiles = dataTransfer.types.some((type) => type === 'Files')\n\n return hasNoTypesInfo || isDraggingFiles\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n"],"names":["closestAttributeValue","$element","attributeName","$closestElementWithAttribute","closest","getAttribute","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","I18n","translations","_config$locale","locale","documentElement","lang","t","lookupKey","options","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","undefined","replace","placeholderWithBraces","placeholderKey","hasOwnProperty","call","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","window","PluralRules","preferredForm","select","selectPluralFormUsingFallbackRules","console","warn","Math","abs","floor","ruleset","getPluralRulesForLocale","pluralRules","localeShort","pluralRule","pluralRulesMap","languages","arabic","chinese","french","german","irish","russian","scottish","spanish","welsh","n","lastTwo","last","FileUpload","$input","$button","$status","i18n","id","querySelector","$label","findLabel","createElement","add","ariaDescribedBy","className","innerText","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","addEventListener","onClick","bind","event","preventDefault","insertAdjacentElement","onChange","updateDisabledState","observeDisabledState","$announcements","onDrop","updateDropzoneVisibility","enteredAnotherElement","disabled","hideDraggingState","target","Node","dataTransfer","isContainingFiles","showDraggingState","remove","files","dispatchEvent","CustomEvent","fileCount","click","observer","MutationObserver","mutationList","mutation","observe","attributes","toggle","freeze","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","one","other","enteredDropZone","leftDropZone","hasNoTypesInfo","types","isDraggingF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;AACF,CAAC,CAAC,CAAA;AAUJ,SAAS2H,iBAAiBA,CAACD,YAAY,EAAE;EAGvC,MAAMyB,cAAc,GAAGzB,YAAY,CAAC0B,KAAK,CAAClJ,MAAM,KAAK,CAAC,CAAA;AAItD,EAAA,MAAMmJ,eAAe,GAAG3B,YAAY,CAAC0B,KAAK,CAACE,IAAI,CAAEtJ,IAAI,IAAKA,IAAI,KAAK,OAAO,CAAC,CAAA;EAE3E,OAAOmJ,cAAc,IAAIE,eAAe,CAAA;AAC1C,CAAA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;"}
@@ -0,0 +1,267 @@
1
+ import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';
2
+ import { ConfigurableComponent } from '../../common/configuration.mjs';
3
+ import { formatErrorMessage } from '../../common/index.mjs';
4
+ import { ElementError } from '../../errors/index.mjs';
5
+ import { I18n } from '../../i18n.mjs';
6
+
7
+ /**
8
+ * File upload component
9
+ *
10
+ * @preserve
11
+ * @augments ConfigurableComponent<FileUploadConfig>
12
+ */
13
+ class FileUpload extends ConfigurableComponent {
14
+ /**
15
+ * @param {Element | null} $root - File input element
16
+ * @param {FileUploadConfig} [config] - File Upload config
17
+ */
18
+ constructor($root, config = {}) {
19
+ super($root, config);
20
+ this.$input = void 0;
21
+ this.$button = void 0;
22
+ this.$status = void 0;
23
+ this.i18n = void 0;
24
+ this.id = void 0;
25
+ const $input = this.$root.querySelector('input');
26
+ if ($input === null) {
27
+ throw new ElementError({
28
+ component: FileUpload,
29
+ identifier: 'File inputs (`<input type="file">`)'
30
+ });
31
+ }
32
+ if ($input.type !== 'file') {
33
+ throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
34
+ }
35
+ this.$input = $input;
36
+ this.$input.setAttribute('hidden', 'true');
37
+ if (!this.$input.id) {
38
+ throw new ElementError({
39
+ component: FileUpload,
40
+ identifier: 'File input (`<input type="file">`) attribute (`id`)'
41
+ });
42
+ }
43
+ this.id = this.$input.id;
44
+ this.i18n = new I18n(this.config.i18n, {
45
+ locale: closestAttributeValue(this.$root, 'lang')
46
+ });
47
+ const $label = this.findLabel();
48
+ if (!$label.id) {
49
+ $label.id = `${this.id}-label`;
50
+ }
51
+ this.$input.id = `${this.id}-input`;
52
+ const $button = document.createElement('button');
53
+ $button.classList.add('govuk-file-upload-button');
54
+ $button.type = 'button';
55
+ $button.id = this.id;
56
+ $button.classList.add('govuk-file-upload-button--empty');
57
+ const ariaDescribedBy = this.$input.getAttribute('aria-describedby');
58
+ if (ariaDescribedBy) {
59
+ $button.setAttribute('aria-describedby', ariaDescribedBy);
60
+ }
61
+ const $status = document.createElement('span');
62
+ $status.className = 'govuk-body govuk-file-upload-button__status';
63
+ $status.setAttribute('aria-live', 'polite');
64
+ $status.innerText = this.i18n.t('noFileChosen');
65
+ $button.appendChild($status);
66
+ const commaSpan = document.createElement('span');
67
+ commaSpan.className = 'govuk-visually-hidden';
68
+ commaSpan.innerText = ', ';
69
+ commaSpan.id = `${this.id}-comma`;
70
+ $button.appendChild(commaSpan);
71
+ const containerSpan = document.createElement('span');
72
+ containerSpan.className = 'govuk-file-upload-button__pseudo-button-container';
73
+ const buttonSpan = document.createElement('span');
74
+ buttonSpan.className = 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button';
75
+ buttonSpan.innerText = this.i18n.t('chooseFilesButton');
76
+ containerSpan.appendChild(buttonSpan);
77
+ containerSpan.insertAdjacentText('beforeend', ' ');
78
+ const instructionSpan = document.createElement('span');
79
+ instructionSpan.className = 'govuk-body govuk-file-upload-button__instruction';
80
+ instructionSpan.innerText = this.i18n.t('dropInstruction');
81
+ containerSpan.appendChild(instructionSpan);
82
+ $button.appendChild(containerSpan);
83
+ $button.setAttribute('aria-labelledby', `${$label.id} ${commaSpan.id} ${$button.id}`);
84
+ $button.addEventListener('click', this.onClick.bind(this));
85
+ $button.addEventListener('dragover', event => {
86
+ event.preventDefault();
87
+ });
88
+ this.$root.insertAdjacentElement('afterbegin', $button);
89
+ this.$input.setAttribute('tabindex', '-1');
90
+ this.$input.setAttribute('aria-hidden', 'true');
91
+ this.$button = $button;
92
+ this.$status = $status;
93
+ this.$input.addEventListener('change', this.onChange.bind(this));
94
+ this.updateDisabledState();
95
+ this.observeDisabledState();
96
+ this.$announcements = document.createElement('span');
97
+ this.$announcements.classList.add('govuk-file-upload-announcements');
98
+ this.$announcements.classList.add('govuk-visually-hidden');
99
+ this.$announcements.setAttribute('aria-live', 'assertive');
100
+ this.$root.insertAdjacentElement('afterend', this.$announcements);
101
+ this.$button.addEventListener('drop', this.onDrop.bind(this));
102
+ document.addEventListener('dragenter', this.updateDropzoneVisibility.bind(this));
103
+ document.addEventListener('dragenter', () => {
104
+ this.enteredAnotherElement = true;
105
+ });
106
+ document.addEventListener('dragleave', () => {
107
+ if (!this.enteredAnotherElement && !this.$button.disabled) {
108
+ this.hideDraggingState();
109
+ this.$announcements.innerText = this.i18n.t('leftDropZone');
110
+ }
111
+ this.enteredAnotherElement = false;
112
+ });
113
+ }
114
+
115
+ /**
116
+ * Updates the visibility of the dropzone as users enters the various elements on the page
117
+ *
118
+ * @param {DragEvent} event - The `dragenter` event
119
+ */
120
+ updateDropzoneVisibility(event) {
121
+ if (this.$button.disabled) return;
122
+ if (event.target instanceof Node) {
123
+ if (this.$root.contains(event.target)) {
124
+ if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
125
+ if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
126
+ this.showDraggingState();
127
+ this.$announcements.innerText = this.i18n.t('enteredDropZone');
128
+ }
129
+ }
130
+ } else {
131
+ if (this.$button.classList.contains('govuk-file-upload-button--dragging')) {
132
+ this.hideDraggingState();
133
+ this.$announcements.innerText = this.i18n.t('leftDropZone');
134
+ }
135
+ }
136
+ }
137
+ }
138
+ showDraggingState() {
139
+ this.$button.classList.add('govuk-file-upload-button--dragging');
140
+ }
141
+ hideDraggingState() {
142
+ this.$button.classList.remove('govuk-file-upload-button--dragging');
143
+ }
144
+
145
+ /**
146
+ * Handles user dropping on the component
147
+ *
148
+ * @param {DragEvent} event - The `dragenter` event
149
+ */
150
+ onDrop(event) {
151
+ event.preventDefault();
152
+ if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
153
+ this.$input.files = event.dataTransfer.files;
154
+ this.$input.dispatchEvent(new CustomEvent('change'));
155
+ this.hideDraggingState();
156
+ }
157
+ }
158
+ onChange() {
159
+ const fileCount = this.$input.files.length;
160
+ if (fileCount === 0) {
161
+ this.$status.innerText = this.i18n.t('noFileChosen');
162
+ this.$button.classList.add('govuk-file-upload-button--empty');
163
+ } else {
164
+ if (fileCount === 1) {
165
+ this.$status.innerText = this.$input.files[0].name;
166
+ } else {
167
+ this.$status.innerText = this.i18n.t('multipleFilesChosen', {
168
+ count: fileCount
169
+ });
170
+ }
171
+ this.$button.classList.remove('govuk-file-upload-button--empty');
172
+ }
173
+ }
174
+ findLabel() {
175
+ const $label = document.querySelector(`label[for="${this.$input.id}"]`);
176
+ if (!$label) {
177
+ throw new ElementError({
178
+ component: FileUpload,
179
+ identifier: `Field label (\`<label for=${this.$input.id}>\`)`
180
+ });
181
+ }
182
+ return $label;
183
+ }
184
+ onClick() {
185
+ this.$input.click();
186
+ }
187
+ observeDisabledState() {
188
+ const observer = new MutationObserver(mutationList => {
189
+ for (const mutation of mutationList) {
190
+ if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {
191
+ this.updateDisabledState();
192
+ }
193
+ }
194
+ });
195
+ observer.observe(this.$input, {
196
+ attributes: true
197
+ });
198
+ }
199
+ updateDisabledState() {
200
+ this.$button.disabled = this.$input.disabled;
201
+ this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
202
+ }
203
+ }
204
+ FileUpload.moduleName = 'govuk-file-upload';
205
+ FileUpload.defaults = Object.freeze({
206
+ i18n: {
207
+ chooseFilesButton: 'Choose file',
208
+ dropInstruction: 'or drop file',
209
+ noFileChosen: 'No file chosen',
210
+ multipleFilesChosen: {
211
+ one: '%{count} file chosen',
212
+ other: '%{count} files chosen'
213
+ },
214
+ enteredDropZone: 'Entered drop zone',
215
+ leftDropZone: 'Left drop zone'
216
+ }
217
+ });
218
+ FileUpload.schema = Object.freeze({
219
+ properties: {
220
+ i18n: {
221
+ type: 'object'
222
+ }
223
+ }
224
+ });
225
+ function isContainingFiles(dataTransfer) {
226
+ const hasNoTypesInfo = dataTransfer.types.length === 0;
227
+ const isDraggingFiles = dataTransfer.types.some(type => type === 'Files');
228
+ return hasNoTypesInfo || isDraggingFiles;
229
+ }
230
+
231
+ /**
232
+ * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement
233
+ */
234
+
235
+ /**
236
+ * File upload config
237
+ *
238
+ * @see {@link FileUpload.defaults}
239
+ * @typedef {object} FileUploadConfig
240
+ * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations
241
+ */
242
+
243
+ /**
244
+ * File upload translations
245
+ *
246
+ * @see {@link FileUpload.defaults.i18n}
247
+ * @typedef {object} FileUploadTranslations
248
+ *
249
+ * Messages used by the component
250
+ * @property {string} [chooseFile] - The text of the button that opens the file picker
251
+ * @property {string} [dropInstruction] - The text informing users they can drop files
252
+ * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files
253
+ * have been chosen by the user
254
+ * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user
255
+ * @property {string} [enteredDropZone] - The text announced by assistive technology
256
+ * when user drags files and enters the drop zone
257
+ * @property {string} [leftDropZone] - The text announced by assistive technology
258
+ * when user drags files and leaves the drop zone without dropping
259
+ */
260
+
261
+ /**
262
+ * @import { Schema } from '../../common/configuration.mjs'
263
+ * @import { TranslationPluralForms } from '../../i18n.mjs'
264
+ */
265
+
266
+ export { FileUpload };
267
+ //# sourceMappingURL=file-upload.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload.mjs","sources":["../../../../src/govuk/components/file-upload/file-upload.mjs"],"sourcesContent":["import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { formatErrorMessage } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nexport class FileUpload extends ConfigurableComponent {\n /**\n * @private\n * @type {HTMLFileInputElement}\n */\n $input\n\n /**\n * @private\n */\n $button\n\n /**\n * @private\n */\n $status\n\n /** @private */\n i18n\n\n /** @private */\n id\n\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n const $input = this.$root.querySelector('input')\n\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n })\n }\n\n if ($input.type !== 'file') {\n throw new ElementError(\n formatErrorMessage(\n FileUpload,\n 'File input (`<input type=\"file\">`) attribute (`type`) is not `file`'\n )\n )\n }\n\n this.$input = /** @type {HTMLFileInputElement} */ ($input)\n this.$input.setAttribute('hidden', 'true')\n\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n })\n }\n\n this.id = this.$input.id\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue(this.$root, 'lang')\n })\n\n const $label = this.findLabel()\n // Add an ID to the label if it doesn't have one already\n // so it can be referenced by `aria-labelledby`\n if (!$label.id) {\n $label.id = `${this.id}-label`\n }\n\n // we need to copy the 'id' of the root element\n // to the new button replacement element\n // so that focus will work in the error summary\n this.$input.id = `${this.id}-input`\n\n // Create the file selection button\n const $button = document.createElement('button')\n $button.classList.add('govuk-file-upload-button')\n $button.type = 'button'\n $button.id = this.id\n $button.classList.add('govuk-file-upload-button--empty')\n\n // Copy `aria-describedby` if present so hints and errors\n // are associated to the `<button>`\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby')\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy)\n }\n\n // Create status element that shows what/how many files are selected\n const $status = document.createElement('span')\n $status.className = 'govuk-body govuk-file-upload-button__status'\n $status.setAttribute('aria-live', 'polite')\n $status.innerText = this.i18n.t('noFileChosen')\n\n $button.appendChild($status)\n\n const commaSpan = document.createElement('span')\n commaSpan.className = 'govuk-visually-hidden'\n commaSpan.innerText = ', '\n commaSpan.id = `${this.id}-comma`\n\n $button.appendChild(commaSpan)\n\n const containerSpan = document.createElement('span')\n containerSpan.className =\n 'govuk-file-upload-button__pseudo-button-container'\n\n const buttonSpan = document.createElement('span')\n buttonSpan.className =\n 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'\n buttonSpan.innerText = this.i18n.t('chooseFilesButton')\n\n containerSpan.appendChild(buttonSpan)\n\n // Add a space so the button and instruction read correctly\n // when CSS is disabled\n containerSpan.insertAdjacentText('beforeend', ' ')\n\n const instructionSpan = document.createElement('span')\n instructionSpan.className =\n 'govuk-body govuk-file-upload-button__instruction'\n instructionSpan.innerText = this.i18n.t('dropInstruction')\n\n containerSpan.appendChild(instructionSpan)\n\n $button.appendChild(containerSpan)\n $button.setAttribute(\n 'aria-labelledby',\n `${$label.id} ${commaSpan.id} ${$button.id}`\n )\n $button.addEventListener('click', this.onClick.bind(this))\n $button.addEventListener('dragover', (event) => {\n // prevent default to allow drop\n event.preventDefault()\n })\n\n // Assemble these all together\n this.$root.insertAdjacentElement('afterbegin', $button)\n\n this.$input.setAttribute('tabindex', '-1')\n this.$input.setAttribute('aria-hidden', 'true')\n\n // Make all these new variables available to the module\n this.$button = $button\n this.$status = $status\n\n // Bind change event to the underlying input\n this.$input.addEventListener('change', this.onChange.bind(this))\n\n // Synchronise the `disabled` state between the button and underlying input\n this.updateDisabledState()\n this.observeDisabledState()\n\n // Handle drop zone visibility\n // A live region to announce when users enter or leave the drop zone\n this.$announcements = document.createElement('span')\n this.$announcements.classList.add('govuk-file-upload-announcements')\n this.$announcements.classList.add('govuk-visually-hidden')\n this.$announcements.setAttribute('aria-live', 'assertive')\n this.$root.insertAdjacentElement('afterend', this.$announcements)\n\n // if there is no CSS and input is hidden\n // button will need to handle drop event\n this.$button.addEventListener('drop', this.onDrop.bind(this))\n\n // While user is dragging, it gets a little more complex because of Safari.\n // Safari doesn't fill `relatedTarget` on `dragleave` (nor `dragenter`).\n // This means we can't use `relatedTarget` to:\n // - check if the user is still within the wrapper\n // (`relatedTarget` being a descendant of the wrapper)\n // - check if the user is still over the viewport\n // (`relatedTarget` being null if outside)\n\n // Thanks to `dragenter` bubbling, we can listen on the `document` with a\n // single function and update the visibility based on whether we entered a\n // node inside or outside the wrapper.\n document.addEventListener(\n 'dragenter',\n this.updateDropzoneVisibility.bind(this)\n )\n\n // To detect if we're outside the document, we can track if there was a\n // `dragenter` event preceding a `dragleave`. If there wasn't, this means\n // we're outside the document.\n //\n // The order of events is guaranteed by the HTML specs:\n // https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true\n })\n\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n\n this.enteredAnotherElement = false\n })\n }\n\n /**\n * Updates the visibility of the dropzone as users enters the various elements on the page\n *\n * @param {DragEvent} event - The `dragenter` event\n */\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return\n\n // DOM interfaces only type `event.target` as `EventTarget`\n // so we first need to make sure it's a `Node`\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n // Only update the class and make the announcement if not already visible\n // to avoid repeated announcements on NVDA (2024.4) + Firefox (133)\n if (\n !this.$button.classList.contains(\n 'govuk-file-upload-button--dragging'\n )\n ) {\n this.showDraggingState()\n this.$announcements.innerText = this.i18n.t('enteredDropZone')\n }\n }\n } else {\n // Only hide the dropzone if it is visible to prevent announcing user\n // left the drop zone when they enter the page but haven't reached yet\n // the file upload component\n if (\n this.$button.classList.contains('govuk-file-upload-button--dragging')\n ) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n }\n }\n }\n\n /**\n * Show the drop zone visually\n */\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging')\n }\n\n /**\n * Hides the drop zone visually\n */\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging')\n }\n\n /**\n * Handles user dropping on the component\n *\n * @param {DragEvent} event - The `dragenter` event\n */\n onDrop(event) {\n event.preventDefault()\n\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files\n\n // Dispatch a `change` event so external code that would rely on the `<input>`\n // dispatching an event when files are dropped still work.\n // Use a `CustomEvent` so our events are distinguishable from browser's native events\n this.$input.dispatchEvent(new CustomEvent('change'))\n\n this.hideDraggingState()\n }\n }\n\n /**\n * Check if the value of the underlying input has changed\n */\n onChange() {\n const fileCount = this.$input.files.length\n\n if (fileCount === 0) {\n // If there are no files, show the default selection text\n this.$status.innerText = this.i18n.t('noFileChosen')\n this.$button.classList.add('govuk-file-upload-button--empty')\n } else {\n if (\n // If there is 1 file, just show the file name\n fileCount === 1\n ) {\n this.$status.innerText = this.$input.files[0].name\n } else {\n // Otherwise, tell the user how many files are selected\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n })\n }\n\n this.$button.classList.remove('govuk-file-upload-button--empty')\n }\n }\n\n /**\n * Looks up the `<label>` element associated to the field\n *\n * @private\n * @returns {HTMLElement} The `<label>` element associated to the field\n * @throws {ElementError} If the `<label>` cannot be found\n */\n findLabel() {\n // Use `label` in the selector so TypeScript knows the type fo `HTMLElement`\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`)\n\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n })\n }\n\n return $label\n }\n\n /**\n * When the button is clicked, emulate clicking the actual, hidden file input\n */\n onClick() {\n this.$input.click()\n }\n\n /**\n * Create a mutation observer to check if the input's attributes altered.\n */\n observeDisabledState() {\n const observer = new MutationObserver((mutationList) => {\n for (const mutation of mutationList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'disabled'\n ) {\n this.updateDisabledState()\n }\n }\n })\n\n observer.observe(this.$input, {\n attributes: true\n })\n }\n\n /**\n * Synchronise the `disabled` state between the input and replacement button.\n */\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled\n\n this.$root.classList.toggle(\n 'govuk-drop-zone--disabled',\n this.$button.disabled\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-file-upload'\n\n /**\n * File upload default config\n *\n * @see {@link FileUploadConfig}\n * @constant\n * @type {FileUploadConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n // the 'one' string isn't used as the component displays the filename\n // instead, however it's here for coverage's sake\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n })\n\n /**\n * File upload config schema\n *\n * @constant\n * @satisfies {Schema<FileUploadConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' }\n }\n })\n}\n\n/**\n * Checks if the given `DataTransfer` contains files\n *\n * @internal\n * @param {DataTransfer} dataTransfer - The `DataTransfer` to check\n * @returns {boolean} - `true` if it contains files or we can't infer it, `false` otherwise\n */\nfunction isContainingFiles(dataTransfer) {\n // Safari sometimes does not provide info about types :'(\n // In which case best not to assume anything and try to set the files\n const hasNoTypesInfo = dataTransfer.types.length === 0\n\n // When dragging images, there's a mix of mime types + Files\n // which we can't assign to the native input\n const isDraggingFiles = dataTransfer.types.some((type) => type === 'Files')\n\n return hasNoTypesInfo || isDraggingFiles\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n"],"names":["FileUpload","ConfigurableComponent","constructor","$root","config","$input","$button","$status","i18n","id","querySelector","ElementError","component","identifier","type","formatErrorMessage","setAttribute","I18n","locale","closestAttributeValue","$label","findLabel","document","createElement","classList","add","ariaDescribedBy","getAttribute","className","innerText","t","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","addEventListener","onClick","bind","event","preventDefault","insertAdjacentElement","onChange","updateDisabledState","observeDisabledState","$announcements","onDrop","updateDropzoneVisibility","enteredAnotherElement","disabled","hideDraggingState","target","Node","contains","dataTransfer","isContainingFiles","showDraggingState","remove","files","dispatchEvent","CustomEvent","fileCount","length","name","count","click","observer","MutationObserver","mutationList","mutation","attributeName","observe","attributes","toggle","moduleName","defaults","Object","freeze","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","one","other","enteredDropZone","leftDropZone","schema","properties","hasNoTypesInfo","types","isDraggingFiles","some"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,SAASC,qBAAqB,CAAC;AAuBpD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAC9B,IAAA,KAAK,CAACD,KAAK,EAAEC,MAAM,CAAC,CAAA;AAAA,IAAA,IAAA,CAvBtBC,MAAM,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAKNC,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAKPC,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGPC,IAAI,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGJC,EAAE,GAAA,KAAA,CAAA,CAAA;IASA,MAAMJ,MAAM,GAAG,IAAI,CAACF,KAAK,CAACO,aAAa,CAAC,OAAO,CAAC,CAAA;IAEhD,IAAIL,MAAM,KAAK,IAAI,EAAE;MACnB,MAAM,IAAIM,YAAY,CAAC;AACrBC,QAAAA,SAAS,EAAEZ,UAAU;AACrBa,QAAAA,UAAU,EAAE,qCAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;AAEA,IAAA,IAAIR,MAAM,CAACS,IAAI,KAAK,MAAM,EAAE;MAC1B,MAAM,IAAIH,YAAY,CACpBI,kBAAkB,CAChBf,UAAU,EACV,qEACF,CACF,CAAC,CAAA;AACH,KAAA;IAEA,IAAI,CAACK,MAAM,GAAwCA,MAAO,CAAA;IAC1D,IAAI,CAACA,MAAM,CAACW,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AAE1C,IAAA,IAAI,CAAC,IAAI,CAACX,MAAM,CAACI,EAAE,EAAE;MACnB,MAAM,IAA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