@storybook/addon-a11y 10.5.0-alpha.2 → 10.5.0-alpha.3

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.
@@ -43,7 +43,23 @@ var { document: document3 } = global2, channel = addons.getChannel(), DEFAULT_PA
43
43
  // In component testing, landmarks are not always present
44
44
  // and the rule check can cause false positives
45
45
  "region"
46
- ], queue = [], isRunning = !1, runNext = async () => {
46
+ ], getDisabledRules = (rules = []) => {
47
+ let disabledRules = {};
48
+ for (let { id, enabled } of rules)
49
+ !id || typeof enabled != "boolean" || (enabled ? delete disabledRules[id] : disabledRules[id] = { enabled: !1 });
50
+ return disabledRules;
51
+ }, mergeDisabledRulesIntoRunOptions = (options, config) => {
52
+ if (!options.runOnly)
53
+ return options;
54
+ let disabledRules = getDisabledRules(config.rules);
55
+ return Object.keys(disabledRules).length === 0 ? options : {
56
+ ...options,
57
+ rules: {
58
+ ...disabledRules,
59
+ ...options.rules
60
+ }
61
+ };
62
+ }, queue = [], isRunning = !1, runNext = async () => {
47
63
  if (queue.length === 0) {
48
64
  isRunning = !1;
49
65
  return;
@@ -69,12 +85,14 @@ var { document: document3 } = global2, channel = addons.getChannel(), DEFAULT_PA
69
85
  ...config,
70
86
  rules: [...DISABLED_RULES.map((id) => ({ id, enabled: !1 })), ...config?.rules ?? []]
71
87
  };
72
- return axe.configure(configWithDefault), new Promise((resolve, reject) => {
88
+ axe.configure(configWithDefault);
89
+ let optionsWithDisabledRules = mergeDisabledRulesIntoRunOptions(options, configWithDefault);
90
+ return new Promise((resolve, reject) => {
73
91
  let highlightsRoot = document3?.getElementById("storybook-highlights-root");
74
92
  highlightsRoot && (highlightsRoot.style.display = "none");
75
93
  let task = async () => {
76
94
  try {
77
- let result = await axe.run(context, options), resultWithLinks = withLinkPaths(result, storyId);
95
+ let result = await axe.run(context, optionsWithDisabledRules), resultWithLinks = withLinkPaths(result, storyId);
78
96
  resolve(resultWithLinks);
79
97
  } catch (error) {
80
98
  reject(error);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  preview_exports
3
- } from "./_browser-chunks/chunk-2FVV6YOY.js";
3
+ } from "./_browser-chunks/chunk-ZXL7I4W4.js";
4
4
  import {
5
5
  PARAM_KEY
6
6
  } from "./_browser-chunks/chunk-7OPMK7TU.js";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_kx7mpl0sca from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_kx7mpl0sca from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_kx7mpl0sca from "node:module";
1
+ import CJS_COMPAT_NODE_URL_1tqgp91xoly from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_1tqgp91xoly from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_1tqgp91xoly from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_kx7mpl0sca.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_kx7mpl0sca.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_kx7mpl0sca.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_1tqgp91xoly.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_1tqgp91xoly.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_1tqgp91xoly.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_kx7mpl0sca from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_kx7mpl0sca from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_kx7mpl0sca from "node:module";
1
+ import CJS_COMPAT_NODE_URL_1tqgp91xoly from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_1tqgp91xoly from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_1tqgp91xoly from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_kx7mpl0sca.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_kx7mpl0sca.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_kx7mpl0sca.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_1tqgp91xoly.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_1tqgp91xoly.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_1tqgp91xoly.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preview.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  decorators,
4
4
  initialGlobals,
5
5
  parameters
6
- } from "./_browser-chunks/chunk-2FVV6YOY.js";
6
+ } from "./_browser-chunks/chunk-ZXL7I4W4.js";
7
7
  import "./_browser-chunks/chunk-7OPMK7TU.js";
8
8
  import "./_browser-chunks/chunk-4BE7D4DS.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "10.5.0-alpha.2",
3
+ "version": "10.5.0-alpha.3",
4
4
  "description": "Storybook Addon A11y: Test UI component compliance with WCAG web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -73,7 +73,7 @@
73
73
  "vitest-axe": "^0.1.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "storybook": "^10.5.0-alpha.2"
76
+ "storybook": "^10.5.0-alpha.3"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"