Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new config schema allOf condition support #4791

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

colinrotherham
Copy link
Contributor

To offload some old code here's support for allOf schema conditions (alongside anyOf)

Might never need this, but to prevent i18n or rememberExpanded being accidentally overridden by null/undefined:

/**
  * Accordion config schema
  *
  * @constant
  * @satisfies {Schema}
  */
static schema = Object.freeze({
  allOf: [
    {
      required: ['i18n'],
      errorMessage: '"i18n" must be provided'
    },
    {
      required: ['rememberExpanded'],
      errorMessage: '"rememberExpanded" must be provided'
    }
  ]
})

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4791 February 23, 2024 17:39 Inactive
Copy link

github-actions bot commented Feb 23, 2024

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 112.86 KiB
dist/govuk-frontend-development.min.js 39.47 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 81.45 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 76.5 KiB
packages/govuk-frontend/dist/govuk/all.mjs 3.86 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 112.85 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 39.46 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 72.33 KiB 37.64 KiB
accordion.mjs 22.71 KiB 12.85 KiB
button.mjs 5.98 KiB 2.69 KiB
character-count.mjs 22.49 KiB 9.96 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 7.89 KiB 3.46 KiB
exit-this-page.mjs 17.1 KiB 9.26 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 6.26 KiB 2.62 KiB
radios.mjs 4.83 KiB 2.38 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.13 KiB 6.11 KiB

View stats and visualisations on the review app


Action run for fd0af85

This comment was marked as off-topic.

This comment was marked as off-topic.

colinrotherham and others added 8 commits March 8, 2024 16:43
Since we only pass in `DOMStringMap` values, this removes all tests for `normaliseDataset()` that don’t pass in strings

We also prevent unnecessary data attributes (e.g. `data-module="govuk-accordion"’) from being merged into the config

See: #4230
We can reduce the code we use by expanding dot-separated data-attributes at the point we read them

This lets us remove `flattenConfigs()` since we can use nested configs everywhere
Do you want a `data-example="2024"` to stay as a string?

Data attributes now understand component config schema types

Extra checks added to guard against objects, arrays and non-finite numbers (NaN, Infinity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants