{"version":3,"file":"radios.bundle.mjs","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/component.mjs","../../../../src/govuk/components/radios/radios.mjs"],"sourcesContent":["/**\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 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-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\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 * Check for valid scope\n *\n * @internal\n * @template {Element | Document} ScopeType\n * @param {unknown | ScopeType} $scope - Scope of the document to search within\n * @returns {$scope is ScopeType} Whether the scope can be queried\n */\nexport function isScope($scope) {\n  return !!$scope && ($scope instanceof Element || $scope instanceof Document)\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","import { formatErrorMessage, isObject } 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 (isObject(messageOrOptions)) {\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      // Prepend with module name (optional)\n      if (component) {\n        message = formatErrorMessage(component, message)\n      }\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 {Element | Document | null} [element] - The element in error (optional)\n * @property {ComponentWithModuleName} [component] - Component throwing the error (optional)\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 {string} [expectedType] - The type that was expected for the identifier (optional)\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 { ElementError } from '../../errors/index.mjs'\n\n/**\n * Radios component\n *\n * @preserve\n */\nexport class Radios extends Component {\n  /** @private */\n  $inputs\n\n  /**\n   * Radios can be associated with a 'conditionally revealed' content block –\n   * for example, a radio for 'Phone' could reveal an additional form field for\n   * the user to enter their phone number.\n   *\n   * These associations are made using a `data-aria-controls` attribute, which\n   * is promoted to an aria-controls attribute during initialisation.\n   *\n   * We also need to restore the state of any conditional reveals on the page\n   * (for example if the user has navigated back), and set up event handlers to\n   * keep the reveal in sync with the radio state.\n   *\n   * @param {Element | null} $root - HTML element to use for radios\n   */\n  constructor($root) {\n    super($root)\n\n    const $inputs = this.$root.querySelectorAll('input[type=\"radio\"]')\n    if (!$inputs.length) {\n      throw new ElementError({\n        component: Radios,\n        identifier: 'Form inputs (`<input type=\"radio\">`)'\n      })\n    }\n\n    this.$inputs = $inputs\n\n    this.$inputs.forEach(($input) => {\n      const targetId = $input.getAttribute('data-aria-controls')\n\n      // Skip radios without data-aria-controls attributes\n      if (!targetId) {\n        return\n      }\n\n      // Throw if target conditional element does not exist.\n      if (!document.getElementById(targetId)) {\n        throw new ElementError({\n          component: Radios,\n          identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n        })\n      }\n\n      // Promote the data-aria-controls attribute to a aria-controls attribute\n      // so that the relationship is exposed in the AOM\n      $input.setAttribute('aria-controls', targetId)\n      $input.removeAttribute('data-aria-controls')\n    })\n\n    // When the page is restored after navigating 'back' in some browsers the\n    // state of form controls is not restored until *after* the DOMContentLoaded\n    // event is fired, so we need to sync after the pageshow event.\n    window.addEventListener('pageshow', () => this.syncAllConditionalReveals())\n\n    // Although we've set up handlers to sync state on the pageshow event, init\n    // could be called after those events have fired, for example if they are\n    // added to the page dynamically, so sync now too.\n    this.syncAllConditionalReveals()\n\n    // Handle events\n    this.$root.addEventListener('click', (event) => this.handleClick(event))\n  }\n\n  /**\n   * Sync the conditional reveal states for all radio buttons in this component.\n   *\n   * @private\n   */\n  syncAllConditionalReveals() {\n    this.$inputs.forEach(($input) =>\n      this.syncConditionalRevealWithInputState($input)\n    )\n  }\n\n  /**\n   * Sync conditional reveal with the input state\n   *\n   * Synchronise the visibility of the conditional reveal, and its accessible\n   * state, with the input's checked state.\n   *\n   * @private\n   * @param {HTMLInputElement} $input - Radio input\n   */\n  syncConditionalRevealWithInputState($input) {\n    const targetId = $input.getAttribute('aria-controls')\n    if (!targetId) {\n      return\n    }\n\n    const $target = document.getElementById(targetId)\n    if ($target?.classList.contains('govuk-radios__conditional')) {\n      const inputIsChecked = $input.checked\n\n      $input.setAttribute('aria-expanded', inputIsChecked.toString())\n      $target.classList.toggle(\n        'govuk-radios__conditional--hidden',\n        !inputIsChecked\n      )\n    }\n  }\n\n  /**\n   * Click event handler\n   *\n   * Handle a click within the component root – if the click occurred on a radio, sync\n   * the state of the conditional reveal for all radio buttons in the same form\n   * with the same name (because checking one radio could have un-checked a\n   * radio under the root of another Radio component)\n   *\n   * @private\n   * @param {MouseEvent} event - Click event\n   */\n  handleClick(event) {\n    const $clickedInput = event.target\n\n    // Ignore clicks on things that aren't radio buttons\n    if (\n      !($clickedInput instanceof HTMLInputElement) ||\n      $clickedInput.type !== 'radio'\n    ) {\n      return\n    }\n\n    // We only need to consider radios with conditional reveals, which will have\n    // aria-controls attributes.\n    const $allInputs = document.querySelectorAll(\n      'input[type=\"radio\"][aria-controls]'\n    )\n\n    const $clickedInputForm = $clickedInput.form\n    const $clickedInputName = $clickedInput.name\n\n    $allInputs.forEach(($input) => {\n      const hasSameFormOwner = $input.form === $clickedInputForm\n      const hasSameName = $input.name === $clickedInputName\n\n      if (hasSameName && hasSameFormOwner) {\n        this.syncConditionalRevealWithInputState($input)\n      }\n    })\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-radios'\n}\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isArray","option","Array","isObject","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","Radios","$inputs","querySelectorAll","length","forEach","$input","targetId","getAttribute","getElementById","removeAttribute","window","addEventListener","syncAllConditionalReveals","event","handleClick","syncConditionalRevealWithInputState","$target","inputIsChecked","checked","toString","toggle","$clickedInput","target","HTMLInputElement","type","$allInputs","$clickedInputForm","form","$clickedInputName","hasSameFormOwner","hasSameName"],"mappings":"AAmFO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;EAClD,IAAI,CAACF,MAAM,EAAE;AACX,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,OAAOA,MAAM,CAACG,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC;AAC9D;AASA,SAASC,OAAOA,CAACC,MAAM,EAAE;AACvB,EAAA,OAAOC,KAAK,CAACF,OAAO,CAACC,MAAM,CAAC;AAC9B;AAUO,SAASE,QAAQA,CAACF,MAAM,EAAE;AAC/B,EAAA,OAAO,CAAC,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,CAACD,OAAO,CAACC,MAAM,CAAC;AACnE;AAsBO,SAASG,kBAAkBA,CAACC,SAAS,EAAEC,OAAO,EAAE;AACrD,EAAA,OAAO,GAAGD,SAAS,CAACd,UAAU,CAAA,EAAA,EAAKe,OAAO,CAAA,CAAE;AAC9C;AAQA;AACA;AACA;AACA;;AC7IO,MAAMC,kBAAkB,SAASC,KAAK,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAA,IAAA,CAC5CC,IAAI,GAAG,oBAAoB;AAAA,EAAA;AAC7B;AAKO,MAAMC,YAAY,SAASL,kBAAkB,CAAC;AAGnD;AACF;AACA;AACA;AACA;AACEE,EAAAA,WAAWA,CAACd,MAAM,GAAGC,QAAQ,CAACC,IA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