@react-native-ama/core 1.2.1 → 2.0.0-beta.1

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 (179) hide show
  1. package/dist/ReactNativeAma.types.d.ts +66 -0
  2. package/dist/ReactNativeAma.types.js +2 -0
  3. package/dist/ReactNativeAmaModule.d.ts +11 -0
  4. package/dist/ReactNativeAmaModule.js +5 -0
  5. package/dist/ReactNativeAmaModule.web.d.ts +9 -0
  6. package/dist/ReactNativeAmaModule.web.js +27 -0
  7. package/dist/ReactNativeAmaView.d.ts +3 -0
  8. package/dist/ReactNativeAmaView.js +32 -0
  9. package/dist/ReactNativeAmaView.web.d.ts +3 -0
  10. package/dist/ReactNativeAmaView.web.js +34 -0
  11. package/dist/{src/components → components}/AMAProvider.d.ts +4 -2
  12. package/dist/{src/components → components}/AMAProvider.js +19 -45
  13. package/dist/{src/components → components}/AutofocusContainer.d.ts +2 -1
  14. package/dist/{src/components → components}/HideChildrenFromAccessibilityTree.d.ts +1 -1
  15. package/dist/{src/components → components}/HideChildrenFromAccessibilityTree.js +7 -5
  16. package/dist/{src/hooks → hooks}/useFocus.js +10 -3
  17. package/dist/{src/index.d.ts → index.d.ts} +3 -2
  18. package/dist/index.js +38 -0
  19. package/dist/internals/checks/checkAriaLabel.d.ts +3 -0
  20. package/dist/internals/checks/checkAriaLabel.js +15 -0
  21. package/dist/internals/checks/checkAriaRole.d.ts +3 -0
  22. package/dist/internals/checks/checkAriaRole.js +48 -0
  23. package/dist/internals/checks/checkContrast.d.ts +3 -0
  24. package/dist/internals/checks/checkContrast.js +84 -0
  25. package/dist/internals/checks/checkImageAlt.d.ts +3 -0
  26. package/dist/internals/checks/checkImageAlt.js +20 -0
  27. package/dist/internals/checks/checkIsUppercase.d.ts +8 -0
  28. package/dist/internals/checks/checkIsUppercase.js +30 -0
  29. package/dist/internals/checks/checkLongNumber.d.ts +3 -0
  30. package/dist/internals/checks/checkLongNumber.js +31 -0
  31. package/dist/internals/checks/checkMinimumSize.d.ts +3 -0
  32. package/dist/internals/checks/checkMinimumSize.js +22 -0
  33. package/dist/internals/checks/checkTextInput.d.ts +3 -0
  34. package/dist/internals/checks/checkTextInput.js +51 -0
  35. package/dist/internals/checks/performChecks.d.ts +3 -0
  36. package/dist/internals/checks/performChecks.js +23 -0
  37. package/dist/internals/components/AMAErrorOverlay.d.ts +5 -0
  38. package/dist/internals/components/AMAErrorOverlay.js +334 -0
  39. package/dist/internals/components/AMARuleError.d.ts +7 -0
  40. package/dist/internals/components/AMARuleError.js +161 -0
  41. package/dist/internals/config.d.ts +23 -0
  42. package/dist/internals/config.js +33 -0
  43. package/dist/internals/types.d.ts +9 -0
  44. package/dist/internals/types.js +2 -0
  45. package/dist/internals/useAMADev.d.ts +8 -0
  46. package/dist/internals/useAMADev.dev.d.ts +2 -0
  47. package/dist/internals/useAMADev.dev.js +110 -0
  48. package/dist/internals/useAMADev.js +6 -0
  49. package/dist/internals/useAMADevNodeChecks.dev.d.ts +16 -0
  50. package/dist/internals/useAMADevNodeChecks.dev.js +115 -0
  51. package/dist/internals/useAMADevUiInteraction.dev.d.ts +7 -0
  52. package/dist/internals/useAMADevUiInteraction.dev.js +100 -0
  53. package/dist/internals/utils/amaClearHighlight.d.ts +2 -0
  54. package/dist/internals/utils/amaClearHighlight.js +12 -0
  55. package/dist/internals/utils/amaHighlightComponent.d.ts +3 -0
  56. package/dist/internals/utils/amaHighlightComponent.js +51 -0
  57. package/dist/internals/utils/constants.d.ts +3 -0
  58. package/dist/internals/utils/constants.js +32 -0
  59. package/dist/internals/utils/getErrorColor.d.ts +2 -0
  60. package/dist/internals/utils/getErrorColor.js +10 -0
  61. package/dist/internals/utils/getRuleAction.d.ts +2 -0
  62. package/dist/internals/utils/getRuleAction.js +40 -0
  63. package/dist/internals/utils/getRuleErrorInfo.d.ts +7 -0
  64. package/dist/internals/utils/getRuleErrorInfo.js +19 -0
  65. package/dist/internals/utils/ignoreContrastCheck.d.ts +1 -0
  66. package/dist/internals/utils/ignoreContrastCheck.js +15 -0
  67. package/dist/internals/utils/interpolateAnimationStates.d.ts +2 -0
  68. package/dist/internals/utils/interpolateAnimationStates.js +43 -0
  69. package/dist/internals/utils/isA11yLabelAllowed.d.ts +1 -0
  70. package/dist/internals/utils/isA11yLabelAllowed.js +14 -0
  71. package/dist/internals/utils/isRuleDisabled.d.ts +2 -0
  72. package/dist/internals/utils/isRuleDisabled.js +10 -0
  73. package/dist/internals/utils/logError.d.ts +2 -0
  74. package/dist/internals/utils/logError.js +36 -0
  75. package/dist/internals/utils/logFoundIssues.d.ts +2 -0
  76. package/dist/internals/utils/logFoundIssues.js +23 -0
  77. package/dist/internals/utils/logger.d.ts +6 -0
  78. package/dist/internals/utils/logger.js +15 -0
  79. package/dist/internals/utils/minimumTouchableSize.d.ts +1 -0
  80. package/dist/internals/utils/minimumTouchableSize.js +9 -0
  81. package/dist/internals/utils/platformHelpers.d.ts +2 -0
  82. package/dist/internals/utils/platformHelpers.js +6 -0
  83. package/dist/internals/utils/rules.d.ts +22 -0
  84. package/dist/internals/utils/rules.js +253 -0
  85. package/dist/scripts/create-config.js +4 -3
  86. package/package.json +62 -20
  87. package/src/ReactNativeAma.types.ts +70 -0
  88. package/src/ReactNativeAmaModule.ts +18 -0
  89. package/src/ReactNativeAmaModule.web.ts +14 -0
  90. package/src/ReactNativeAmaView.tsx +9 -0
  91. package/src/ReactNativeAmaView.web.tsx +15 -0
  92. package/src/__mocks__/ReactNativeAmaModule.ts +9 -0
  93. package/src/components/AMAProvider.integration.test.tsx +3 -96
  94. package/src/components/AMAProvider.test.tsx +9 -4
  95. package/src/components/AMAProvider.tsx +40 -76
  96. package/src/components/AutofocusContainer.test.tsx +4 -5
  97. package/src/components/AutofocusContainer.tsx +20 -5
  98. package/src/components/HideChildrenFromAccessibilityTree.test.tsx +23 -39
  99. package/src/components/HideChildrenFromAccessibilityTree.tsx +12 -11
  100. package/src/hooks/useFocus.test.ts +20 -20
  101. package/src/hooks/useFocus.ts +14 -6
  102. package/src/hooks/useTimedAction.android.test.ts +0 -1
  103. package/src/hooks/useTimedAction.ios.test.ts +0 -1
  104. package/src/hooks/useTimedAction.ts +0 -1
  105. package/src/index.ts +4 -2
  106. package/src/internals/checks/checkAriaLabel.test.ts +165 -0
  107. package/src/internals/checks/checkAriaLabel.ts +16 -0
  108. package/src/internals/checks/checkAriaRole.test.ts +429 -0
  109. package/src/internals/checks/checkAriaRole.ts +60 -0
  110. package/src/internals/checks/checkContrast.test.ts +278 -0
  111. package/src/internals/checks/checkContrast.ts +109 -0
  112. package/src/internals/checks/checkImageAlt.test.ts +125 -0
  113. package/src/internals/checks/checkImageAlt.ts +23 -0
  114. package/src/internals/checks/checkIsUppercase.test.ts +399 -0
  115. package/src/internals/checks/checkIsUppercase.ts +46 -0
  116. package/src/internals/checks/checkLongNumber.test.ts +111 -0
  117. package/src/internals/checks/checkLongNumber.ts +34 -0
  118. package/src/internals/checks/checkMinimumSize.test.ts +67 -0
  119. package/src/internals/checks/checkMinimumSize.ts +25 -0
  120. package/src/internals/checks/checkTextInput.ts +65 -0
  121. package/src/internals/checks/performChecks.test.ts +171 -0
  122. package/src/internals/checks/performChecks.ts +24 -0
  123. package/src/internals/components/AMAErrorOverlay.test.tsx +139 -0
  124. package/src/internals/components/AMAErrorOverlay.tsx +451 -0
  125. package/src/internals/components/AMARuleError.test.tsx +93 -0
  126. package/src/internals/components/AMARuleError.tsx +225 -0
  127. package/src/internals/config.ts +58 -0
  128. package/src/internals/types.ts +11 -0
  129. package/src/internals/useAMADev.dev.ts +153 -0
  130. package/src/internals/useAMADev.test.ts +260 -0
  131. package/src/internals/useAMADev.ts +17 -0
  132. package/src/internals/useAMADevNodeChecks.dev.ts +178 -0
  133. package/src/internals/useAMADevUiInteraction.dev.ts +164 -0
  134. package/src/internals/utils/amaClearHighlight.test.ts +21 -0
  135. package/src/internals/utils/amaClearHighlight.ts +8 -0
  136. package/src/internals/utils/amaHighlightComponent.test.ts +74 -0
  137. package/src/internals/utils/amaHighlightComponent.ts +46 -0
  138. package/src/internals/utils/constants.ts +33 -0
  139. package/src/internals/utils/devMode.test.ts +99 -0
  140. package/src/internals/utils/getErrorColor.test.ts +18 -0
  141. package/src/internals/utils/getErrorColor.ts +8 -0
  142. package/src/internals/utils/getRuleAction.ts +13 -0
  143. package/src/internals/utils/getRuleErrorInfo.test.ts +59 -0
  144. package/src/internals/utils/getRuleErrorInfo.ts +26 -0
  145. package/src/internals/utils/ignoreContrastCheck.test.ts +34 -0
  146. package/src/internals/utils/ignoreContrastCheck.ts +11 -0
  147. package/src/internals/utils/interpolateAnimation.test.ts +176 -0
  148. package/src/internals/utils/interpolateAnimationStates.ts +55 -0
  149. package/src/internals/utils/isA11yLabelAllowed.test.ts +39 -0
  150. package/src/internals/utils/isA11yLabelAllowed.ts +10 -0
  151. package/src/internals/utils/isRuleDisabled.test.ts +35 -0
  152. package/src/internals/utils/isRuleDisabled.ts +10 -0
  153. package/src/internals/utils/logError.test.ts +148 -0
  154. package/src/internals/utils/logError.ts +41 -0
  155. package/src/internals/utils/logFoundIssues.test.ts +98 -0
  156. package/src/internals/utils/logFoundIssues.ts +22 -0
  157. package/src/internals/utils/logger.test.ts +26 -0
  158. package/src/internals/utils/logger.ts +15 -0
  159. package/src/internals/utils/loggerMethods.test.ts +38 -0
  160. package/src/internals/utils/minimumTouchableSize.test.ts +28 -0
  161. package/src/internals/utils/minimumTouchableSize.tsx +9 -0
  162. package/src/internals/utils/platformHelpers.test.ts +11 -0
  163. package/src/internals/utils/platformHelpers.ts +4 -0
  164. package/src/internals/utils/rules.ts +363 -0
  165. package/src/scripts/create-config.ts +21 -0
  166. package/dist/src/hooks/useButtonChecks.d.ts +0 -6
  167. package/dist/src/hooks/useButtonChecks.js +0 -51
  168. package/dist/src/hooks/useChecks.d.ts +0 -15
  169. package/dist/src/hooks/useChecks.js +0 -152
  170. package/dist/src/index.js +0 -20
  171. package/src/hooks/useButtonChecks.ts +0 -73
  172. package/src/hooks/useChecks.test.ts +0 -214
  173. package/src/hooks/useChecks.ts +0 -207
  174. /package/dist/{src/components → components}/AutofocusContainer.js +0 -0
  175. /package/dist/{src/hooks → hooks}/useFocus.d.ts +0 -0
  176. /package/dist/{src/hooks → hooks}/useTimedAction.d.ts +0 -0
  177. /package/dist/{src/hooks → hooks}/useTimedAction.js +0 -0
  178. /package/dist/{src/utils → utils}/numerify.d.ts +0 -0
  179. /package/dist/{src/utils → utils}/numerify.js +0 -0
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.amaHighlightComponent = void 0;
16
+ const ReactNativeAmaModule_1 = __importDefault(require("../../ReactNativeAmaModule"));
17
+ const config_1 = __importDefault(require("../config"));
18
+ const rules_1 = require("./rules");
19
+ // Severity priority: Critical > Serious > Warning
20
+ const SEVERITY_PRIORITY = {
21
+ Critical: 3,
22
+ Serious: 2,
23
+ Warning: 1,
24
+ };
25
+ const getHighestSeverityColor = (issues) => {
26
+ var _a, _b;
27
+ let highestPriority = 0;
28
+ let highestSeverity = 'Warning';
29
+ for (const issue of issues) {
30
+ const severity = (_b = (_a = rules_1.RULES_HELP === null || rules_1.RULES_HELP === void 0 ? void 0 : rules_1.RULES_HELP[issue.rule]) === null || _a === void 0 ? void 0 : _a.severity) !== null && _b !== void 0 ? _b : 'Critical';
31
+ const priority = SEVERITY_PRIORITY[severity];
32
+ if (priority > highestPriority) {
33
+ highestPriority = priority;
34
+ highestSeverity = severity;
35
+ }
36
+ }
37
+ return rules_1.AMA_COLORS[highestSeverity];
38
+ };
39
+ exports.amaHighlightComponent = __DEV__
40
+ ? (issues, mode) => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _a, _b;
42
+ const issuesArray = Array.isArray(issues) ? issues : [issues];
43
+ if (issuesArray.length === 0) {
44
+ return null;
45
+ }
46
+ const viewId = issuesArray[0].viewId;
47
+ const color = getHighestSeverityColor(issuesArray);
48
+ const issueCount = issuesArray.length;
49
+ return ReactNativeAmaModule_1.default.highlight(viewId, (_b = mode !== null && mode !== void 0 ? mode : (_a = config_1.default.highlight) === null || _a === void 0 ? void 0 : _a.mode) !== null && _b !== void 0 ? _b : 'both', color, issueCount);
50
+ })
51
+ : null;
@@ -0,0 +1,3 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ export type MotionAnimationKey = Partial<keyof ViewStyle> | 'scale';
3
+ export declare const MOTION_ANIMATIONS: MotionAnimationKey[];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MOTION_ANIMATIONS = void 0;
4
+ exports.MOTION_ANIMATIONS = [
5
+ 'left',
6
+ 'bottom',
7
+ 'top',
8
+ 'right',
9
+ 'transform',
10
+ 'translateX',
11
+ 'translateY',
12
+ 'scaleX',
13
+ 'scaleY',
14
+ 'scale',
15
+ 'width',
16
+ 'height',
17
+ 'padding',
18
+ 'paddingBottom',
19
+ 'paddingLeft',
20
+ 'paddingRight',
21
+ 'paddingTop',
22
+ 'paddingVertical',
23
+ 'paddingHorizontal',
24
+ 'margin',
25
+ 'marginBottom',
26
+ 'marginLeft',
27
+ 'marginRight',
28
+ 'marginTop',
29
+ 'marginHorizontal',
30
+ 'marginVertical',
31
+ 'rotation',
32
+ ];
@@ -0,0 +1,2 @@
1
+ import { AmaRule } from '../types';
2
+ export declare const getErrorColor: (rule: AmaRule) => string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getErrorColor = void 0;
4
+ const rules_1 = require("./rules");
5
+ const getErrorColor = (rule) => {
6
+ var _a;
7
+ const theRule = rules_1.RULES_HELP === null || rules_1.RULES_HELP === void 0 ? void 0 : rules_1.RULES_HELP[rule];
8
+ return rules_1.AMA_COLORS[(_a = theRule === null || theRule === void 0 ? void 0 : theRule.severity) !== null && _a !== void 0 ? _a : 'Critical'];
9
+ };
10
+ exports.getErrorColor = getErrorColor;
@@ -0,0 +1,2 @@
1
+ import { AmaRule, AmaRuleAction } from '../types';
2
+ export declare const getRuleAction: ((rule: AmaRule) => AmaRuleAction) | null;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getRuleAction = void 0;
30
+ const config_1 = __importDefault(require("../config"));
31
+ const rules_1 = __importStar(require("./rules"));
32
+ exports.getRuleAction = __DEV__
33
+ ? (rule) => {
34
+ var _a;
35
+ const customRule = (rules_1.default === null || rules_1.default === void 0 ? void 0 : (0, rules_1.default)(rule))
36
+ ? (_a = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.rules) === null || _a === void 0 ? void 0 : _a[rule]
37
+ : undefined;
38
+ return customRule || rules_1.LOGGER_RULES[rule];
39
+ }
40
+ : null;
@@ -0,0 +1,7 @@
1
+ import { AmaError } from '../types';
2
+ export type A11ySeverity = 'Serious' | 'Critical' | 'Warning';
3
+ export declare const getAMARuleErrorInfo: ((issue: AmaError) => {
4
+ message: string;
5
+ url: string;
6
+ severity: import("./rules").A11ySeverity;
7
+ }) | null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAMARuleErrorInfo = void 0;
4
+ const rules_1 = require("./rules");
5
+ exports.getAMARuleErrorInfo = __DEV__
6
+ ? (issue) => {
7
+ const ruleHelp = rules_1.RULES_HELP[issue.rule];
8
+ if (!ruleHelp) {
9
+ console.error(`Missing rule help: ${issue.rule}`);
10
+ throw new Error(`Missing rule help: ${issue.rule}`);
11
+ }
12
+ let message = ruleHelp.message;
13
+ if (issue.extra) {
14
+ message += ': ' + issue.extra;
15
+ }
16
+ const url = `https://nearform.com/open-source/react-native-ama/${ruleHelp.url}`;
17
+ return { message, url, severity: ruleHelp.severity };
18
+ }
19
+ : null;
@@ -0,0 +1 @@
1
+ export declare const shouldIgnoreContrastCheckForDisabledElement: (() => false | import("./rules").AmaRuleAction) | null;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.shouldIgnoreContrastCheckForDisabledElement = void 0;
7
+ const config_1 = __importDefault(require("../config"));
8
+ const rules_1 = require("./rules");
9
+ exports.shouldIgnoreContrastCheckForDisabledElement = __DEV__
10
+ ? () => {
11
+ var _a;
12
+ return (((_a = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.rules) === null || _a === void 0 ? void 0 : _a.IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS) ||
13
+ rules_1.IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS);
14
+ }
15
+ : null;
@@ -0,0 +1,2 @@
1
+ import type { Animated } from 'react-native';
2
+ export declare const interpolateAnimationStates: (from: Record<string, any>, to: Record<string, any>, isReduceMotionEnabled: boolean, progressValue: Animated.Value, reduceMotionProgressValue: Animated.Value) => Record<string, any>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.interpolateAnimationStates = void 0;
15
+ const constants_1 = require("./constants");
16
+ const interpolateAnimationStates = (from, to, isReduceMotionEnabled, progressValue, reduceMotionProgressValue) => {
17
+ return Object.keys(from).reduce((outputAnimation, key) => {
18
+ const isMotionAnimation = constants_1.MOTION_ANIMATIONS.includes(key);
19
+ const progressKey = isReduceMotionEnabled && isMotionAnimation
20
+ ? reduceMotionProgressValue
21
+ : progressValue;
22
+ if (Array.isArray(from[key])) {
23
+ outputAnimation[key] = from[key].map((animationObject, index) => {
24
+ const _a = (0, exports.interpolateAnimationStates)(animationObject, to[key][index], isReduceMotionEnabled, progressValue, reduceMotionProgressValue), { __hasOnlyMotionAnimation } = _a, style = __rest(_a, ["__hasOnlyMotionAnimation"]);
25
+ outputAnimation.__hasOnlyMotionAnimation =
26
+ outputAnimation.__hasOnlyMotionAnimation &&
27
+ __hasOnlyMotionAnimation;
28
+ return style;
29
+ });
30
+ }
31
+ else {
32
+ outputAnimation[key] = progressKey.interpolate({
33
+ inputRange: [0, 1],
34
+ // @ts-ignore
35
+ outputRange: [from[key], to[key]],
36
+ });
37
+ outputAnimation.__hasOnlyMotionAnimation =
38
+ outputAnimation.__hasOnlyMotionAnimation && isMotionAnimation;
39
+ }
40
+ return outputAnimation;
41
+ }, { __hasOnlyMotionAnimation: true });
42
+ };
43
+ exports.interpolateAnimationStates = interpolateAnimationStates;
@@ -0,0 +1 @@
1
+ export declare const isAccessibilityLabelAllowed: ((accessibilityLabel: string) => boolean) | null;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isAccessibilityLabelAllowed = void 0;
7
+ const config_1 = __importDefault(require("../config"));
8
+ exports.isAccessibilityLabelAllowed = __DEV__
9
+ ? (accessibilityLabel) => {
10
+ var _a;
11
+ return (accessibilityLabel.length < config_1.default.uppercaseMinLength ||
12
+ ((_a = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.accessibilityLabelExceptions) === null || _a === void 0 ? void 0 : _a.includes(accessibilityLabel)));
13
+ }
14
+ : null;
@@ -0,0 +1,2 @@
1
+ import { AmaError } from '../types';
2
+ export declare const isRuleDisabled: ((error: AmaError) => boolean | undefined) | null;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRuleDisabled = void 0;
4
+ const getRuleAction_1 = require("./getRuleAction");
5
+ exports.isRuleDisabled = __DEV__
6
+ ? (error) => {
7
+ const action = getRuleAction_1.getRuleAction === null || getRuleAction_1.getRuleAction === void 0 ? void 0 : (0, getRuleAction_1.getRuleAction)(error.rule);
8
+ return action && action === 'PLEASE_FORGIVE_ME';
9
+ }
10
+ : null;
@@ -0,0 +1,2 @@
1
+ import { AmaError } from '../types';
2
+ export declare const logError: ((issue: AmaError) => void) | null;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logError = void 0;
7
+ const getRuleAction_1 = require("./getRuleAction");
8
+ const logger_1 = __importDefault(require("./logger"));
9
+ const rules_1 = require("./rules");
10
+ const getAMARuleErrorInfo = __DEV__
11
+ ? ({ rule, extra }) => {
12
+ const ruleHelp = rules_1.RULES_HELP[rule];
13
+ let message = ruleHelp.message;
14
+ if (extra) {
15
+ message += ': ' + extra;
16
+ }
17
+ const url = `https://nearform.com/open-source/react-native-ama/${ruleHelp.url}`;
18
+ return { message, url, severity: ruleHelp.severity };
19
+ }
20
+ : null;
21
+ exports.logError = __DEV__
22
+ ? (issue) => {
23
+ var _a;
24
+ const action = getRuleAction_1.getRuleAction === null || getRuleAction_1.getRuleAction === void 0 ? void 0 : (0, getRuleAction_1.getRuleAction)(issue.rule);
25
+ const log = action === 'MUST' || action === 'MUST_NOT'
26
+ ? logger_1.default === null || logger_1.default === void 0 ? void 0 : logger_1.default.error
27
+ : logger_1.default === null || logger_1.default === void 0 ? void 0 : logger_1.default.warn;
28
+ const { message, url } = (_a = getAMARuleErrorInfo === null || getAMARuleErrorInfo === void 0 ? void 0 : getAMARuleErrorInfo(issue)) !== null && _a !== void 0 ? _a : {};
29
+ log === null || log === void 0 ? void 0 : log(`${issue.rule}
30
+ Component: ${issue.label || '--- NO LABEL FOUND ---'} (#${issue.viewId})
31
+
32
+ ${message}
33
+
34
+ Learn about: ${url}\n`);
35
+ }
36
+ : null;
@@ -0,0 +1,2 @@
1
+ import { AmaError } from '../types';
2
+ export declare const logFoundIssues: ((issues: AmaError[]) => void) | null;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logFoundIssues = void 0;
7
+ const config_1 = __importDefault(require("../config"));
8
+ const logError_1 = require("./logError");
9
+ const logger_1 = __importDefault(require("./logger"));
10
+ exports.logFoundIssues = __DEV__
11
+ ? (issues) => {
12
+ if (issues.length === 0) {
13
+ return;
14
+ }
15
+ logger_1.default === null || logger_1.default === void 0 ? void 0 : logger_1.default.log(`Issues found: ${issues.length}`);
16
+ if (config_1.default.log !== 'always') {
17
+ return;
18
+ }
19
+ issues.forEach((issue) => {
20
+ logError_1.logError === null || logError_1.logError === void 0 ? void 0 : (0, logError_1.logError)(issue);
21
+ });
22
+ }
23
+ : null;
@@ -0,0 +1,6 @@
1
+ declare const logger: {
2
+ log: (msg: string) => void;
3
+ warn: (msg: string) => void;
4
+ error: (msg: string) => void;
5
+ } | null;
6
+ export default logger;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _log = __DEV__
4
+ ? (consoleMethod, msg) => {
5
+ consoleMethod(`[React Native AMA]: ${msg}`);
6
+ }
7
+ : null;
8
+ const logger = _log
9
+ ? {
10
+ log: (msg) => _log(console.debug, msg),
11
+ warn: (msg) => _log(console.warn, msg),
12
+ error: (msg) => _log(console.error, msg),
13
+ }
14
+ : null;
15
+ exports.default = logger;
@@ -0,0 +1 @@
1
+ export declare const MINIMUM_TOUCHABLE_SIZE: number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINIMUM_TOUCHABLE_SIZE = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const ANDROID_MINIMUM_TOUCHABLE_SIZE = 48;
6
+ const IOS_MINIMUM_TOUCHABLE_SIZE = 44;
7
+ exports.MINIMUM_TOUCHABLE_SIZE = react_native_1.Platform.OS === 'android'
8
+ ? ANDROID_MINIMUM_TOUCHABLE_SIZE
9
+ : IOS_MINIMUM_TOUCHABLE_SIZE;
@@ -0,0 +1,2 @@
1
+ export declare const IS_IOS: boolean;
2
+ export declare const IS_ANDROID: boolean;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IS_ANDROID = exports.IS_IOS = void 0;
4
+ const react_native_1 = require("react-native");
5
+ exports.IS_IOS = react_native_1.Platform.OS === 'ios';
6
+ exports.IS_ANDROID = react_native_1.Platform.OS === 'android';
@@ -0,0 +1,22 @@
1
+ export type AmaRule = 'BOTTOM_SHEET_CLOSE_ACTION' | 'CONTRAST_FAILED' | 'CONTRAST_FAILED_AAA' | 'FLATLIST_NO_COUNT_IN_PLURAL_MESSAGE' | 'FLATLIST_NO_COUNT_IN_SINGULAR_MESSAGE' | 'IMAGE_MISSING_ALT_TEXT' | 'MINIMUM_SIZE' | 'NO_ACCESSIBILITY_LABEL' | 'NO_ACCESSIBILITY_ROLE' | 'NO_FORM_ERROR' | 'INPUT_HAS_NO_VISIBLE_LABEL' | 'NO_KEYBOARD_TRAP' | 'NO_UNDEFINED' | 'NO_UPPERCASE_TEXT' | 'INCOMPATIBLE_ACCESSIBILITY_STATE' | 'INCOMPATIBLE_ACCESSIBILITY_ROLE' | 'INPUT_HAS_NO_VISIBLE_LABEL_ENDING_WITH_ASTERISK' | 'UPPERCASE_TEXT_NO_ACCESSIBILITY_LABEL' | 'NO_UPPERCASE_ACCESSIBILITY_LABEL' | 'NO_HEADER_FOUND' | 'NO_ACCESSIBILITY_STATE_SET' | 'INPUT_INVALID_RETURN_KEY' | 'INPUT_HAS_FOCUSABLE_LABEL' | 'LONG_NUMBER_NOT_FORMATTED';
2
+ export type AmaRuleAction = 'SHOULD_NOT' | 'MUST_NOT' | 'MUST' | 'SHOULD' | 'PLEASE_FORGIVE_ME';
3
+ export declare const NON_OVERRIDABLE_RULES: Array<AmaRule> | undefined;
4
+ export declare const LOGGER_RULES: Record<AmaRule, AmaRuleAction> | null;
5
+ export declare const CONTRAST_CHECKER_MAX_DEPTH = 5;
6
+ export declare const IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS = false;
7
+ export type A11ySeverity = 'Serious' | 'Critical' | 'Warning';
8
+ export type RuleHelp = {
9
+ [key in AmaRule]: {
10
+ url: string;
11
+ issue: string;
12
+ severity: A11ySeverity;
13
+ message: string;
14
+ howToFix: string | string[];
15
+ };
16
+ };
17
+ export declare const RULES_HELP: RuleHelp | null;
18
+ declare const canRuleBeOverridden: ((rule: AmaRule) => boolean) | null;
19
+ export declare const AMA_COLORS: {
20
+ [key in A11ySeverity]: string;
21
+ };
22
+ export default canRuleBeOverridden;