@react-native-ama/forms 1.0.0 → 1.0.1-alpha.2

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 (97) hide show
  1. package/dist/{forms/src/hooks → hooks}/useTextInput.d.ts +8 -8
  2. package/package.json +5 -5
  3. package/dist/core/src/components/AMAProvider.d.ts +0 -26
  4. package/dist/core/src/components/AMAProvider.js +0 -147
  5. package/dist/core/src/components/AutofocusContainer.d.ts +0 -9
  6. package/dist/core/src/components/AutofocusContainer.js +0 -58
  7. package/dist/core/src/components/HideChildrenFromAccessibilityTree.d.ts +0 -6
  8. package/dist/core/src/components/HideChildrenFromAccessibilityTree.js +0 -40
  9. package/dist/core/src/hooks/useButtonChecks.d.ts +0 -6
  10. package/dist/core/src/hooks/useButtonChecks.js +0 -51
  11. package/dist/core/src/hooks/useChecks.d.ts +0 -15
  12. package/dist/core/src/hooks/useChecks.js +0 -152
  13. package/dist/core/src/hooks/useFocus.d.ts +0 -4
  14. package/dist/core/src/hooks/useFocus.js +0 -55
  15. package/dist/core/src/hooks/useTimedAction.d.ts +0 -3
  16. package/dist/core/src/hooks/useTimedAction.js +0 -63
  17. package/dist/core/src/index.d.ts +0 -7
  18. package/dist/core/src/index.js +0 -20
  19. package/dist/internal/src/checks/checkAccessibilityRole.d.ts +0 -3
  20. package/dist/internal/src/checks/checkAccessibilityRole.js +0 -32
  21. package/dist/internal/src/checks/checkFocusTrap.d.ts +0 -8
  22. package/dist/internal/src/checks/checkFocusTrap.js +0 -34
  23. package/dist/internal/src/checks/checkForAccessibilityState.d.ts +0 -7
  24. package/dist/internal/src/checks/checkForAccessibilityState.js +0 -48
  25. package/dist/internal/src/checks/checkMinimumSize.d.ts +0 -3
  26. package/dist/internal/src/checks/checkMinimumSize.js +0 -29
  27. package/dist/internal/src/checks/contrastChecker.d.ts +0 -8
  28. package/dist/internal/src/checks/contrastChecker.js +0 -77
  29. package/dist/internal/src/checks/noUndefinedProperty.d.ts +0 -8
  30. package/dist/internal/src/checks/noUndefinedProperty.js +0 -14
  31. package/dist/internal/src/checks/uppercaseChecker.d.ts +0 -8
  32. package/dist/internal/src/checks/uppercaseChecker.js +0 -18
  33. package/dist/internal/src/checks/uppercaseStringChecker.d.ts +0 -8
  34. package/dist/internal/src/checks/uppercaseStringChecker.js +0 -29
  35. package/dist/internal/src/index.d.ts +0 -20
  36. package/dist/internal/src/index.js +0 -56
  37. package/dist/internal/src/types.d.ts +0 -17
  38. package/dist/internal/src/types.js +0 -2
  39. package/dist/internal/src/utils/applyStyle.d.ts +0 -9
  40. package/dist/internal/src/utils/applyStyle.js +0 -33
  41. package/dist/internal/src/utils/constants.d.ts +0 -3
  42. package/dist/internal/src/utils/constants.js +0 -32
  43. package/dist/internal/src/utils/error.style.d.ts +0 -6
  44. package/dist/internal/src/utils/error.style.js +0 -11
  45. package/dist/internal/src/utils/generateAccessibilityStateFromProp.d.ts +0 -9
  46. package/dist/internal/src/utils/generateAccessibilityStateFromProp.js +0 -35
  47. package/dist/internal/src/utils/getPropertyFromStyle.d.ts +0 -2
  48. package/dist/internal/src/utils/getPropertyFromStyle.js +0 -10
  49. package/dist/internal/src/utils/interpolateAnimationStates.d.ts +0 -2
  50. package/dist/internal/src/utils/interpolateAnimationStates.js +0 -43
  51. package/dist/internal/src/utils/isFocused.d.ts +0 -2
  52. package/dist/internal/src/utils/isFocused.js +0 -7
  53. package/dist/internal/src/utils/logger.d.ts +0 -16
  54. package/dist/internal/src/utils/logger.js +0 -53
  55. package/dist/internal/src/utils/logger.rules.d.ts +0 -15
  56. package/dist/internal/src/utils/logger.rules.js +0 -74
  57. package/dist/internal/src/utils/maybeGenerateStringFromElement.d.ts +0 -2
  58. package/dist/internal/src/utils/maybeGenerateStringFromElement.js +0 -51
  59. package/dist/internal/src/utils/minimumTouchableSize.d.ts +0 -3
  60. package/dist/internal/src/utils/minimumTouchableSize.js +0 -9
  61. package/dist/react-native/src/components/ExpandablePressable.d.ts +0 -6
  62. package/dist/react-native/src/components/ExpandablePressable.js +0 -26
  63. package/dist/react-native/src/components/Pressable.d.ts +0 -5
  64. package/dist/react-native/src/components/Pressable.js +0 -49
  65. package/dist/react-native/src/components/SwitchListItem.d.ts +0 -12
  66. package/dist/react-native/src/components/SwitchListItem.js +0 -44
  67. package/dist/react-native/src/components/SwitchWrapper.d.ts +0 -11
  68. package/dist/react-native/src/components/SwitchWrapper.js +0 -36
  69. package/dist/react-native/src/components/Text.d.ts +0 -6
  70. package/dist/react-native/src/components/Text.js +0 -77
  71. package/dist/react-native/src/components/TouchableOpacity.d.ts +0 -6
  72. package/dist/react-native/src/components/TouchableOpacity.js +0 -48
  73. package/dist/react-native/src/components/TouchableWithoutFeedback.d.ts +0 -5
  74. package/dist/react-native/src/components/TouchableWithoutFeedback.js +0 -48
  75. package/dist/react-native/src/hooks/useExpandable.d.ts +0 -13
  76. package/dist/react-native/src/hooks/useExpandable.js +0 -31
  77. package/dist/react-native/src/hooks/usePressable.d.ts +0 -16
  78. package/dist/react-native/src/hooks/usePressable.js +0 -44
  79. package/dist/react-native/src/hooks/useSwitch.d.ts +0 -10
  80. package/dist/react-native/src/hooks/useSwitch.js +0 -25
  81. package/dist/react-native/src/index.d.ts +0 -10
  82. package/dist/react-native/src/index.js +0 -25
  83. /package/dist/{forms/src/components → components}/Form.d.ts +0 -0
  84. /package/dist/{forms/src/components → components}/Form.js +0 -0
  85. /package/dist/{forms/src/components → components}/FormField.d.ts +0 -0
  86. /package/dist/{forms/src/components → components}/FormField.js +0 -0
  87. /package/dist/{forms/src/components → components}/FormSubmit.d.ts +0 -0
  88. /package/dist/{forms/src/components → components}/FormSubmit.js +0 -0
  89. /package/dist/{forms/src/components → components}/FormSwitch.d.ts +0 -0
  90. /package/dist/{forms/src/components → components}/FormSwitch.js +0 -0
  91. /package/dist/{forms/src/components → components}/TextInput.d.ts +0 -0
  92. /package/dist/{forms/src/components → components}/TextInput.js +0 -0
  93. /package/dist/{forms/src/hooks → hooks}/useFormField.d.ts +0 -0
  94. /package/dist/{forms/src/hooks → hooks}/useFormField.js +0 -0
  95. /package/dist/{forms/src/hooks → hooks}/useTextInput.js +0 -0
  96. /package/dist/{forms/src/index.d.ts → index.d.ts} +0 -0
  97. /package/dist/{forms/src/index.js → index.js} +0 -0
@@ -1,36 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SwitchWrapper = void 0;
18
- const internal_1 = require("@react-native-ama/internal");
19
- const react_1 = __importDefault(require("react"));
20
- const react_native_1 = require("react-native");
21
- const react_native_2 = require("react-native");
22
- const useSwitch_1 = require("../hooks/useSwitch");
23
- const SwitchWrapperBase = (_a) => {
24
- var { children } = _a, rest = __rest(_a, ["children"]);
25
- const _b = (0, useSwitch_1.useSwitch)(rest), { style: switchStyle } = _b, otherSwitchProps = __rest(_b, ["style"]);
26
- return (<react_native_2.TouchableWithoutFeedback {...otherSwitchProps}>
27
- <react_native_1.View style={[switchStyle, style.switch]}>{children}</react_native_1.View>
28
- </react_native_2.TouchableWithoutFeedback>);
29
- };
30
- exports.SwitchWrapper = react_1.default.memo(SwitchWrapperBase);
31
- const style = react_native_2.StyleSheet.create({
32
- switch: {
33
- minHeight: internal_1.MINIMUM_TOUCHABLE_SIZE,
34
- minWidth: internal_1.MINIMUM_TOUCHABLE_SIZE,
35
- },
36
- });
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import { TextProps as RNTextProps } from 'react-native';
3
- export type TextProps = RNTextProps & {
4
- autofocus?: boolean;
5
- };
6
- export declare const Text: ({ autofocus, ...rest }: TextProps) => React.JSX.Element;
@@ -1,77 +0,0 @@
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 __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.Text = void 0;
38
- const core_1 = require("@react-native-ama/core");
39
- const internal_1 = require("@react-native-ama/internal");
40
- const React = __importStar(require("react"));
41
- const react_native_1 = require("react-native");
42
- const Text = (_a) => {
43
- var { autofocus } = _a, rest = __rest(_a, ["autofocus"]);
44
- const textRef = React.useRef(null);
45
- (0, core_1.useFocus)(autofocus ? textRef : undefined);
46
- const checks = __DEV__ ? core_1.useChecks === null || core_1.useChecks === void 0 ? void 0 : (0, core_1.useChecks)() : undefined;
47
- const isAccessible = rest.accessible !== false;
48
- __DEV__ &&
49
- isAccessible &&
50
- rest.children &&
51
- (checks === null || checks === void 0 ? void 0 : checks.uppercaseChecker({
52
- style: rest.style,
53
- extra: rest,
54
- accessibilityLabel: rest.accessibilityLabel,
55
- }));
56
- __DEV__ &&
57
- isAccessible &&
58
- (checks === null || checks === void 0 ? void 0 : checks.noUppercaseStringChecker({
59
- text: rest.accessibilityLabel,
60
- canBeEmpty: true,
61
- }));
62
- __DEV__ &&
63
- rest.onPress &&
64
- (checks === null || checks === void 0 ? void 0 : checks.noUndefinedProperty({
65
- properties: rest,
66
- property: 'accessibilityRole',
67
- rule: 'NO_ACCESSIBILITY_ROLE',
68
- }));
69
- const role = autofocus ? 'header' : rest.accessibilityRole;
70
- return __DEV__ ? (<react_native_1.Text ref={textRef} {...rest} accessibilityRole={role} style={internal_1.applyStyle === null || internal_1.applyStyle === void 0 ? void 0 : (0, internal_1.applyStyle)({
71
- // @ts-ignore
72
- style: rest.style,
73
- // @ts-ignore
74
- debugStyle: checks === null || checks === void 0 ? void 0 : checks.debugStyle,
75
- })} onLayout={rest.onPress ? checks === null || checks === void 0 ? void 0 : checks.onLayout : undefined}/>) : (<react_native_1.Text ref={textRef} {...rest} accessibilityRole={role}/>);
76
- };
77
- exports.Text = Text;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import type { PropsWithChildren } from 'react';
3
- import { TouchableOpacityProps as RNTouchableOpacityProps } from 'react-native';
4
- import { type UsePressable } from '../hooks/usePressable';
5
- export type TouchableOpacityProps = PropsWithChildren<UsePressable<RNTouchableOpacityProps>>;
6
- export declare const TouchableOpacity: React.MemoExoticComponent<({ children, ...rest }: TouchableOpacityProps) => React.JSX.Element>;
@@ -1,48 +0,0 @@
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 __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.TouchableOpacity = void 0;
38
- const React = __importStar(require("react"));
39
- const react_native_1 = require("react-native");
40
- const usePressable_1 = require("../hooks/usePressable");
41
- const TouchableOpacityBase = (_a) => {
42
- var { children } = _a, rest = __rest(_a, ["children"]);
43
- const pressableProps = (0, usePressable_1.usePressable)(rest, children);
44
- return (<react_native_1.TouchableOpacity {...rest} {...pressableProps}>
45
- {children}
46
- </react_native_1.TouchableOpacity>);
47
- };
48
- exports.TouchableOpacity = React.memo(TouchableOpacityBase);
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import { TouchableWithoutFeedbackProps as RNTouchableWithoutFeedbackProps } from 'react-native';
3
- import { UsePressable } from '../hooks/usePressable';
4
- export type TouchableWithoutFeedbackProps = React.PropsWithChildren<UsePressable<RNTouchableWithoutFeedbackProps>>;
5
- export declare const TouchableWithoutFeedback: ({ children, ...rest }: TouchableWithoutFeedbackProps) => React.JSX.Element;
@@ -1,48 +0,0 @@
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 __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.TouchableWithoutFeedback = void 0;
38
- const React = __importStar(require("react"));
39
- const react_native_1 = require("react-native");
40
- const usePressable_1 = require("../hooks/usePressable");
41
- const TouchableWithoutFeedback = (_a) => {
42
- var { children } = _a, rest = __rest(_a, ["children"]);
43
- const pressableProps = (0, usePressable_1.usePressable)(rest, children);
44
- return (<react_native_1.TouchableWithoutFeedback {...rest} {...pressableProps}>
45
- {children}
46
- </react_native_1.TouchableWithoutFeedback>);
47
- };
48
- exports.TouchableWithoutFeedback = TouchableWithoutFeedback;
@@ -1,13 +0,0 @@
1
- export type UseExpandable<T> = Omit<T, 'accessibilityRole'> & {
2
- expanded: boolean;
3
- };
4
- export declare const useExpandable: <T>(props: UseExpandable<T>) => ({
5
- accessibilityRole: any;
6
- } & Omit<T, "accessibilityRole"> & {
7
- style: any;
8
- expanded: boolean;
9
- }) | ({
10
- accessibilityRole: any;
11
- } & Omit<T, "accessibilityRole"> & {
12
- expanded: boolean;
13
- });
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useExpandable = void 0;
4
- const core_1 = require("@react-native-ama/core");
5
- const internal_1 = require("@react-native-ama/internal");
6
- const useExpandable = (props) => {
7
- const checks = __DEV__ ? core_1.useChecks === null || core_1.useChecks === void 0 ? void 0 : (0, core_1.useChecks)() : undefined;
8
- __DEV__ &&
9
- (checks === null || checks === void 0 ? void 0 : checks.noUndefinedProperty({
10
- properties: props,
11
- // @ts-ignore
12
- property: 'expanded',
13
- rule: 'NO_UNDEFINED',
14
- }));
15
- __DEV__ &&
16
- (checks === null || checks === void 0 ? void 0 : checks.noUndefinedProperty({
17
- properties: props,
18
- // @ts-ignore
19
- property: 'accessibilityLabel',
20
- rule: 'NO_UNDEFINED',
21
- }));
22
- /* block:end */
23
- return __DEV__
24
- ? Object.assign(Object.assign({ accessibilityRole: 'button' }, props), { style: internal_1.applyStyle === null || internal_1.applyStyle === void 0 ? void 0 : (0, internal_1.applyStyle)({
25
- // @ts-ignore
26
- style: props.style,
27
- // @ts-ignore
28
- debugStyle: checks === null || checks === void 0 ? void 0 : checks.debugStyle,
29
- }) }) : Object.assign({ accessibilityRole: 'button' }, props);
30
- };
31
- exports.useExpandable = useExpandable;
@@ -1,16 +0,0 @@
1
- import type { AMAAccessibilityState, AccessibilityRoles } from '@react-native-ama/internal';
2
- import type React from 'react';
3
- import type { AccessibilityRole, AccessibilityState, LayoutChangeEvent, PressableStateCallbackType } from 'react-native';
4
- export type UsePressable<T> = Omit<T, 'accessibilityRole' | 'accessibilityLabel'> & AMAAccessibilityState & AccessibilityRoles & {
5
- accessibilityLabel: string;
6
- } & {
7
- onLayout?: (event: LayoutChangeEvent) => void;
8
- };
9
- type ReturnUsePressable = {
10
- accessibilityState: AccessibilityState;
11
- accessibilityRole: AccessibilityRole;
12
- onLayout?: (event: LayoutChangeEvent) => void;
13
- style?: Record<string, any>;
14
- };
15
- export declare const usePressable: <T>(props: Partial<UsePressable<T>>, children?: React.ReactNode | ((state: PressableStateCallbackType) => React.ReactNode)) => ReturnUsePressable;
16
- export {};
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePressable = void 0;
4
- const useButtonChecks_1 = require("@react-native-ama/core/src/hooks/useButtonChecks");
5
- const internal_1 = require("@react-native-ama/internal");
6
- const react_native_1 = require("react-native");
7
- const usePressable = (props, children) => {
8
- const accessibilityRole = react_native_1.Platform.OS === 'ios' &&
9
- IOS_BUTTON_ACCESSIBILITY_ROLES.includes(props.accessibilityRole)
10
- ? 'button'
11
- : props.accessibilityRole;
12
- const accessibilityState = (0, internal_1.generateAccessibilityStateFromProp)(Object.assign(Object.assign({}, props), { accessibilityRole }));
13
- const ignoreContrastCheck = __DEV__
14
- ? // @ts-ignore
15
- props.disabled && (0, internal_1.shouldIgnoreContrastCheckForDisabledElement)()
16
- : null;
17
- const checks = __DEV__
18
- ? useButtonChecks_1.useButtonChecks === null || useButtonChecks_1.useButtonChecks === void 0 ? void 0 : (0, useButtonChecks_1.useButtonChecks)(Object.assign(Object.assign({}, props), { accessibilityRole, accessibilityState }), children, !ignoreContrastCheck)
19
- : null;
20
- return __DEV__
21
- ? {
22
- accessibilityState,
23
- // @ts-ignore
24
- onLayout: evt => {
25
- if (props.onLayout) {
26
- props.onLayout(evt);
27
- }
28
- checks === null || checks === void 0 ? void 0 : checks.onLayout(evt);
29
- },
30
- // @ts-ignore
31
- style: checks.debugStyle,
32
- accessibilityRole,
33
- }
34
- : {
35
- accessibilityState,
36
- accessibilityRole,
37
- };
38
- };
39
- exports.usePressable = usePressable;
40
- const IOS_BUTTON_ACCESSIBILITY_ROLES = [
41
- 'checkbox',
42
- 'togglebutton',
43
- 'radio',
44
- ];
@@ -1,10 +0,0 @@
1
- import type { ViewProps } from 'react-native';
2
- type UseSwitch = Omit<ViewProps, 'children' | 'accessibilityRole' | 'accessibilityLabel'> & {
3
- accessibilityLabel: string;
4
- };
5
- type UseSwitchReturn = Omit<ViewProps, 'children' | 'accessibilityRole' | 'accessibilityLabel'> & {
6
- accessibilityLabel: string;
7
- accessibilityRole: 'switch';
8
- };
9
- export declare const useSwitch: (props: UseSwitch) => UseSwitchReturn;
10
- export {};
@@ -1,25 +0,0 @@
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.useSwitch = void 0;
7
- const core_1 = require("@react-native-ama/core");
8
- const internal_1 = require("@react-native-ama/internal");
9
- const react_1 = __importDefault(require("react"));
10
- const useSwitch = (props) => {
11
- const accessibilityState = react_1.default.useMemo(() => (0, internal_1.generateAccessibilityStateFromProp)(props), [props]);
12
- const checks = __DEV__
13
- ? core_1.useButtonChecks === null || core_1.useButtonChecks === void 0 ? void 0 : (0, core_1.useButtonChecks)(Object.assign(Object.assign({}, props), { accessibilityRole: 'switch' }))
14
- : undefined;
15
- return __DEV__
16
- ? Object.assign(Object.assign({ accessibilityRole: 'switch', accessibilityState }, props), {
17
- // @ts-ignore
18
- onLayout: checks.onLayout, style: internal_1.applyStyle === null || internal_1.applyStyle === void 0 ? void 0 : (0, internal_1.applyStyle)({
19
- // @ts-ignore
20
- style: props.style,
21
- // @ts-ignore
22
- debugStyle: checks.debugStyle,
23
- }) }) : Object.assign({ accessibilityRole: 'switch', accessibilityState }, props);
24
- };
25
- exports.useSwitch = useSwitch;
@@ -1,10 +0,0 @@
1
- export { ExpandablePressable } from './components/ExpandablePressable';
2
- export { SwitchListItem, type SwitchListItemProps, } from './components/SwitchListItem';
3
- export { SwitchWrapper } from './components/SwitchWrapper';
4
- export { Text } from './components/Text';
5
- export { TouchableOpacity, type TouchableOpacityProps, } from './components/TouchableOpacity';
6
- export { TouchableWithoutFeedback, type TouchableWithoutFeedbackProps, } from './components/TouchableWithoutFeedback';
7
- export { Pressable, type PressableProps } from './components/Pressable';
8
- export { useExpandable } from './hooks/useExpandable';
9
- export { usePressable, type UsePressable } from './hooks/usePressable';
10
- export { useSwitch } from './hooks/useSwitch';
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSwitch = exports.usePressable = exports.useExpandable = exports.Pressable = exports.TouchableWithoutFeedback = exports.TouchableOpacity = exports.Text = exports.SwitchWrapper = exports.SwitchListItem = exports.ExpandablePressable = void 0;
4
- // Components
5
- var ExpandablePressable_1 = require("./components/ExpandablePressable");
6
- Object.defineProperty(exports, "ExpandablePressable", { enumerable: true, get: function () { return ExpandablePressable_1.ExpandablePressable; } });
7
- var SwitchListItem_1 = require("./components/SwitchListItem");
8
- Object.defineProperty(exports, "SwitchListItem", { enumerable: true, get: function () { return SwitchListItem_1.SwitchListItem; } });
9
- var SwitchWrapper_1 = require("./components/SwitchWrapper");
10
- Object.defineProperty(exports, "SwitchWrapper", { enumerable: true, get: function () { return SwitchWrapper_1.SwitchWrapper; } });
11
- var Text_1 = require("./components/Text");
12
- Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
13
- var TouchableOpacity_1 = require("./components/TouchableOpacity");
14
- Object.defineProperty(exports, "TouchableOpacity", { enumerable: true, get: function () { return TouchableOpacity_1.TouchableOpacity; } });
15
- var TouchableWithoutFeedback_1 = require("./components/TouchableWithoutFeedback");
16
- Object.defineProperty(exports, "TouchableWithoutFeedback", { enumerable: true, get: function () { return TouchableWithoutFeedback_1.TouchableWithoutFeedback; } });
17
- var Pressable_1 = require("./components/Pressable");
18
- Object.defineProperty(exports, "Pressable", { enumerable: true, get: function () { return Pressable_1.Pressable; } });
19
- // Hooks
20
- var useExpandable_1 = require("./hooks/useExpandable");
21
- Object.defineProperty(exports, "useExpandable", { enumerable: true, get: function () { return useExpandable_1.useExpandable; } });
22
- var usePressable_1 = require("./hooks/usePressable");
23
- Object.defineProperty(exports, "usePressable", { enumerable: true, get: function () { return usePressable_1.usePressable; } });
24
- var useSwitch_1 = require("./hooks/useSwitch");
25
- Object.defineProperty(exports, "useSwitch", { enumerable: true, get: function () { return useSwitch_1.useSwitch; } });
File without changes
File without changes
File without changes
File without changes