@storybook/addon-a11y 10.5.0-alpha.1 → 10.5.0-alpha.10

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);
@@ -128,15 +146,7 @@ var vitestMatchersExtended = !1, decorators = [withVisionSimulator], afterEach =
128
146
  globals,
129
147
  viewMode
130
148
  }) => {
131
- let a11yParameter = parameters2.a11y, a11yGlobals = globals.a11y, shouldRunEnvironmentIndependent = !!!globals.ghostStories && a11yParameter?.disable !== !0 && a11yParameter?.test !== "off" && a11yGlobals?.manual !== !0, getMode = () => {
132
- switch (a11yParameter?.test) {
133
- case "todo":
134
- return "warning";
135
- case "error":
136
- default:
137
- return "failed";
138
- }
139
- };
149
+ let a11yParameter = parameters2.a11y, a11yGlobals = globals.a11y, shouldRunEnvironmentIndependent = !!!globals.ghostStories && a11yParameter?.disable !== !0 && a11yParameter?.test !== "off" && a11yGlobals?.manual !== !0, getMode = () => a11yParameter?.test === "todo" ? "warning" : "failed";
140
150
  if (shouldRunEnvironmentIndependent && viewMode === "story")
141
151
  try {
142
152
  let result = await run(a11yParameter, storyId);
@@ -149,7 +159,7 @@ var vitestMatchersExtended = !1, decorators = [withVisionSimulator], afterEach =
149
159
  status: hasViolations ? getMode() : "passed"
150
160
  }), getIsVitestStandaloneRun() && hasViolations && getMode() === "failed") {
151
161
  if (!vitestMatchersExtended) {
152
- let { toHaveNoViolations } = await import("./matchers-5TDFFDYO.js");
162
+ let { toHaveNoViolations } = await import("./matchers-JIUQ3HVY.js");
153
163
  expect.extend({ toHaveNoViolations }), vitestMatchersExtended = !0;
154
164
  }
155
165
  expect(result).toHaveNoViolations();
@@ -184,7 +184,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
184
184
  }
185
185
 
186
186
  // ../../../node_modules/vitest-axe/node_modules/chalk/source/index.js
187
- var { stdout: stdoutColor, stderr: stderrColor } = browser_default, GENERATOR = Symbol("GENERATOR"), STYLER = Symbol("STYLER"), IS_EMPTY = Symbol("IS_EMPTY"), levelMapping = [
187
+ var { stdout: stdoutColor, stderr: stderrColor } = browser_default, GENERATOR = /* @__PURE__ */ Symbol("GENERATOR"), STYLER = /* @__PURE__ */ Symbol("STYLER"), IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY"), levelMapping = [
188
188
  "ansi",
189
189
  "ansi",
190
190
  "ansi256",
@@ -725,8 +725,8 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
725
725
  }), require_react_is_production_min = __commonJS({
726
726
  "node_modules/react-is/cjs/react-is.production.min.js"(exports) {
727
727
  "use strict";
728
- var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u;
729
- u = Symbol.for("react.module.reference");
728
+ var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
729
+ u = /* @__PURE__ */ Symbol.for("react.module.reference");
730
730
  function v(a) {
731
731
  if (typeof a == "object" && a !== null) {
732
732
  var r = a.$$typeof;
@@ -794,8 +794,8 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
794
794
  "use strict";
795
795
  process.env.NODE_ENV !== "production" && (function() {
796
796
  "use strict";
797
- var REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_MODULE_REFERENCE;
798
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
797
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen"), enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_MODULE_REFERENCE;
798
+ REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
799
799
  function isValidElementType(type) {
800
800
  return !!(typeof type == "string" || typeof type == "function" || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing || typeof type == "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0));
801
801
  }
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-P5J2FJ2Z.js";
4
4
  import {
5
5
  PARAM_KEY
6
6
  } from "./_browser-chunks/chunk-7OPMK7TU.js";
package/dist/manager.js CHANGED
@@ -1095,7 +1095,9 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
1095
1095
  return $6vYhU$react.useEffect(() => (context.itemMap.set(ref, {
1096
1096
  ref,
1097
1097
  ...itemData
1098
- }), () => void context.itemMap.delete(ref))), $6vYhU$react.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
1098
+ }), () => {
1099
+ context.itemMap.delete(ref);
1100
+ })), $6vYhU$react.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
1099
1101
  [ITEM_DATA_ATTR]: "",
1100
1102
  ref: composedRefs
1101
1103
  }, children);
@@ -1225,7 +1227,7 @@ var $8927f6f2acc4f386$var$NODES = [
1225
1227
  let Node = $4q5Fq$forwardRef((props, forwardedRef) => {
1226
1228
  let { asChild, ...primitiveProps } = props, Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac13602 : node;
1227
1229
  return $4q5Fq$useEffect(() => {
1228
- window[Symbol.for("radix-ui")] = !0;
1230
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0;
1229
1231
  }, []), $4q5Fq$createElement(Comp, _extends({}, primitiveProps, {
1230
1232
  ref: forwardedRef
1231
1233
  }));
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ho59ciwzpnm from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ho59ciwzpnm from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ho59ciwzpnm from "node:module";
1
+ import CJS_COMPAT_NODE_URL_hmxbx1bn0fp from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_hmxbx1bn0fp from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_hmxbx1bn0fp from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ho59ciwzpnm.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ho59ciwzpnm.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ho59ciwzpnm.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_hmxbx1bn0fp.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_hmxbx1bn0fp.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_hmxbx1bn0fp.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_ho59ciwzpnm from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ho59ciwzpnm from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ho59ciwzpnm from "node:module";
1
+ import CJS_COMPAT_NODE_URL_hmxbx1bn0fp from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_hmxbx1bn0fp from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_hmxbx1bn0fp from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ho59ciwzpnm.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ho59ciwzpnm.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ho59ciwzpnm.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_hmxbx1bn0fp.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_hmxbx1bn0fp.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_hmxbx1bn0fp.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-P5J2FJ2Z.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.1",
3
+ "version": "10.5.0-alpha.10",
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.1"
76
+ "storybook": "^10.5.0-alpha.10"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"