@react-native-ama/forms 1.0.0
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.
- package/dist/core/src/components/AMAProvider.d.ts +26 -0
- package/dist/core/src/components/AMAProvider.js +147 -0
- package/dist/core/src/components/AutofocusContainer.d.ts +9 -0
- package/dist/core/src/components/AutofocusContainer.js +58 -0
- package/dist/core/src/components/HideChildrenFromAccessibilityTree.d.ts +6 -0
- package/dist/core/src/components/HideChildrenFromAccessibilityTree.js +40 -0
- package/dist/core/src/hooks/useButtonChecks.d.ts +6 -0
- package/dist/core/src/hooks/useButtonChecks.js +51 -0
- package/dist/core/src/hooks/useChecks.d.ts +15 -0
- package/dist/core/src/hooks/useChecks.js +152 -0
- package/dist/core/src/hooks/useFocus.d.ts +4 -0
- package/dist/core/src/hooks/useFocus.js +55 -0
- package/dist/core/src/hooks/useTimedAction.d.ts +3 -0
- package/dist/core/src/hooks/useTimedAction.js +63 -0
- package/dist/core/src/index.d.ts +7 -0
- package/dist/core/src/index.js +20 -0
- package/dist/forms/src/components/Form.d.ts +24 -0
- package/dist/forms/src/components/Form.js +122 -0
- package/dist/forms/src/components/FormField.d.ts +7 -0
- package/dist/forms/src/components/FormField.js +52 -0
- package/dist/forms/src/components/FormSubmit.d.ts +10 -0
- package/dist/forms/src/components/FormSubmit.js +25 -0
- package/dist/forms/src/components/FormSwitch.d.ts +4 -0
- package/dist/forms/src/components/FormSwitch.js +15 -0
- package/dist/forms/src/components/TextInput.d.ts +26 -0
- package/dist/forms/src/components/TextInput.js +123 -0
- package/dist/forms/src/hooks/useFormField.d.ts +26 -0
- package/dist/forms/src/hooks/useFormField.js +92 -0
- package/dist/forms/src/hooks/useTextInput.d.ts +350 -0
- package/dist/forms/src/hooks/useTextInput.js +102 -0
- package/dist/forms/src/index.d.ts +16 -0
- package/dist/forms/src/index.js +24 -0
- package/dist/internal/src/checks/checkAccessibilityRole.d.ts +3 -0
- package/dist/internal/src/checks/checkAccessibilityRole.js +32 -0
- package/dist/internal/src/checks/checkFocusTrap.d.ts +8 -0
- package/dist/internal/src/checks/checkFocusTrap.js +34 -0
- package/dist/internal/src/checks/checkForAccessibilityState.d.ts +7 -0
- package/dist/internal/src/checks/checkForAccessibilityState.js +48 -0
- package/dist/internal/src/checks/checkMinimumSize.d.ts +3 -0
- package/dist/internal/src/checks/checkMinimumSize.js +29 -0
- package/dist/internal/src/checks/contrastChecker.d.ts +8 -0
- package/dist/internal/src/checks/contrastChecker.js +77 -0
- package/dist/internal/src/checks/noUndefinedProperty.d.ts +8 -0
- package/dist/internal/src/checks/noUndefinedProperty.js +14 -0
- package/dist/internal/src/checks/uppercaseChecker.d.ts +8 -0
- package/dist/internal/src/checks/uppercaseChecker.js +18 -0
- package/dist/internal/src/checks/uppercaseStringChecker.d.ts +8 -0
- package/dist/internal/src/checks/uppercaseStringChecker.js +29 -0
- package/dist/internal/src/index.d.ts +20 -0
- package/dist/internal/src/index.js +56 -0
- package/dist/internal/src/types.d.ts +17 -0
- package/dist/internal/src/types.js +2 -0
- package/dist/internal/src/utils/applyStyle.d.ts +9 -0
- package/dist/internal/src/utils/applyStyle.js +33 -0
- package/dist/internal/src/utils/constants.d.ts +3 -0
- package/dist/internal/src/utils/constants.js +32 -0
- package/dist/internal/src/utils/error.style.d.ts +6 -0
- package/dist/internal/src/utils/error.style.js +11 -0
- package/dist/internal/src/utils/generateAccessibilityStateFromProp.d.ts +9 -0
- package/dist/internal/src/utils/generateAccessibilityStateFromProp.js +35 -0
- package/dist/internal/src/utils/getPropertyFromStyle.d.ts +2 -0
- package/dist/internal/src/utils/getPropertyFromStyle.js +10 -0
- package/dist/internal/src/utils/interpolateAnimationStates.d.ts +2 -0
- package/dist/internal/src/utils/interpolateAnimationStates.js +43 -0
- package/dist/internal/src/utils/isFocused.d.ts +2 -0
- package/dist/internal/src/utils/isFocused.js +7 -0
- package/dist/internal/src/utils/logger.d.ts +16 -0
- package/dist/internal/src/utils/logger.js +53 -0
- package/dist/internal/src/utils/logger.rules.d.ts +15 -0
- package/dist/internal/src/utils/logger.rules.js +74 -0
- package/dist/internal/src/utils/maybeGenerateStringFromElement.d.ts +2 -0
- package/dist/internal/src/utils/maybeGenerateStringFromElement.js +51 -0
- package/dist/internal/src/utils/minimumTouchableSize.d.ts +3 -0
- package/dist/internal/src/utils/minimumTouchableSize.js +9 -0
- package/dist/react-native/src/components/ExpandablePressable.d.ts +6 -0
- package/dist/react-native/src/components/ExpandablePressable.js +26 -0
- package/dist/react-native/src/components/Pressable.d.ts +5 -0
- package/dist/react-native/src/components/Pressable.js +49 -0
- package/dist/react-native/src/components/SwitchListItem.d.ts +12 -0
- package/dist/react-native/src/components/SwitchListItem.js +44 -0
- package/dist/react-native/src/components/SwitchWrapper.d.ts +11 -0
- package/dist/react-native/src/components/SwitchWrapper.js +36 -0
- package/dist/react-native/src/components/Text.d.ts +6 -0
- package/dist/react-native/src/components/Text.js +77 -0
- package/dist/react-native/src/components/TouchableOpacity.d.ts +6 -0
- package/dist/react-native/src/components/TouchableOpacity.js +48 -0
- package/dist/react-native/src/components/TouchableWithoutFeedback.d.ts +5 -0
- package/dist/react-native/src/components/TouchableWithoutFeedback.js +48 -0
- package/dist/react-native/src/hooks/useExpandable.d.ts +13 -0
- package/dist/react-native/src/hooks/useExpandable.js +31 -0
- package/dist/react-native/src/hooks/usePressable.d.ts +16 -0
- package/dist/react-native/src/hooks/usePressable.js +44 -0
- package/dist/react-native/src/hooks/useSwitch.d.ts +10 -0
- package/dist/react-native/src/hooks/useSwitch.js +25 -0
- package/dist/react-native/src/index.d.ts +10 -0
- package/dist/react-native/src/index.js +25 -0
- package/package.json +82 -0
- package/src/components/Form.test.tsx +262 -0
- package/src/components/Form.tsx +138 -0
- package/src/components/FormField.test.tsx +54 -0
- package/src/components/FormField.tsx +45 -0
- package/src/components/FormSubmit.test.tsx +71 -0
- package/src/components/FormSubmit.tsx +43 -0
- package/src/components/FormSwitch.tsx +17 -0
- package/src/components/TextInput.test.tsx +540 -0
- package/src/components/TextInput.tsx +168 -0
- package/src/hooks/useFormField.test.tsx +183 -0
- package/src/hooks/useFormField.ts +133 -0
- package/src/hooks/useTextInput.ts +128 -0
- package/src/index.ts +39 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Rule = 'BOTTOM_SHEET_CLOSE_ACTION' | 'CONTRAST_FAILED' | 'CONTRAST_FAILED_AAA' | 'FLATLIST_NO_COUNT_IN_PLURAL_MESSAGE' | 'FLATLIST_NO_COUNT_IN_SINGULAR_MESSAGE' | 'MINIMUM_SIZE' | 'NO_ACCESSIBILITY_LABEL' | 'NO_ACCESSIBILITY_ROLE' | 'NO_FORM_ERROR' | 'NO_FORM_LABEL' | 'NO_KEYBOARD_TRAP' | 'NO_UNDEFINED' | 'NO_UPPERCASE_TEXT' | 'INCOMPATIBLE_ACCESSIBILITY_STATE' | 'INCOMPATIBLE_ACCESSIBILITY_ROLE' | 'NO_FORM_LABEL_ENDING_WITH_ASTERISK' | 'UPPERCASE_TEXT_NO_ACCESSIBILITY_LABEL';
|
|
2
|
+
export type RuleAction = 'SHOULD_NOT' | 'MUST_NOT' | 'MUST' | 'SHOULD' | 'PLEASE_FORGIVE_ME';
|
|
3
|
+
export declare const NON_OVERRIDABLE_RULES: string[] | undefined;
|
|
4
|
+
export declare const LOGGER_RULES: Record<Rule, RuleAction> | null;
|
|
5
|
+
export declare const CONTRAST_CHECKER_MAX_DEPTH = 5;
|
|
6
|
+
export declare const IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS = false;
|
|
7
|
+
export declare const RULES_HELP: Record<Rule, string> | null;
|
|
8
|
+
export declare const canRuleBeOverridden: ((rule: Rule) => boolean) | null;
|
|
9
|
+
export declare const SHELL_COLORS: {
|
|
10
|
+
RED: string;
|
|
11
|
+
YELLOW: string;
|
|
12
|
+
RESET: string;
|
|
13
|
+
BLUE: string;
|
|
14
|
+
BG_RED: string;
|
|
15
|
+
} | undefined;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SHELL_COLORS = exports.canRuleBeOverridden = exports.RULES_HELP = exports.IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS = exports.CONTRAST_CHECKER_MAX_DEPTH = exports.LOGGER_RULES = exports.NON_OVERRIDABLE_RULES = void 0;
|
|
4
|
+
exports.NON_OVERRIDABLE_RULES = __DEV__
|
|
5
|
+
? [
|
|
6
|
+
'NO_ACCESSIBILITY_ROLE',
|
|
7
|
+
'NO_ACCESSIBILITY_LABEL',
|
|
8
|
+
'NO_KEYBOARD_TRAP',
|
|
9
|
+
'NO_UNDEFINED',
|
|
10
|
+
'NO_FORM_LABEL',
|
|
11
|
+
'FLATLIST_NO_COUNT_IN_PLURAL_MESSAGE',
|
|
12
|
+
'BOTTOM_SHEET_CLOSE_ACTION',
|
|
13
|
+
'INCOMPATIBLE_ACCESSIBILITY_STATE',
|
|
14
|
+
'INCOMPATIBLE_ACCESSIBILITY_ROLE',
|
|
15
|
+
]
|
|
16
|
+
: undefined;
|
|
17
|
+
exports.LOGGER_RULES = __DEV__
|
|
18
|
+
? {
|
|
19
|
+
CONTRAST_FAILED: 'MUST',
|
|
20
|
+
CONTRAST_FAILED_AAA: 'SHOULD',
|
|
21
|
+
FLATLIST_NO_COUNT_IN_SINGULAR_MESSAGE: 'SHOULD',
|
|
22
|
+
FLATLIST_NO_COUNT_IN_PLURAL_MESSAGE: 'MUST',
|
|
23
|
+
MINIMUM_SIZE: 'MUST',
|
|
24
|
+
NO_ACCESSIBILITY_LABEL: 'MUST',
|
|
25
|
+
NO_ACCESSIBILITY_ROLE: 'MUST',
|
|
26
|
+
NO_FORM_LABEL: 'MUST',
|
|
27
|
+
NO_FORM_ERROR: 'MUST',
|
|
28
|
+
NO_KEYBOARD_TRAP: 'MUST_NOT',
|
|
29
|
+
NO_UNDEFINED: 'MUST_NOT',
|
|
30
|
+
UPPERCASE_TEXT_NO_ACCESSIBILITY_LABEL: 'MUST_NOT',
|
|
31
|
+
NO_UPPERCASE_TEXT: 'MUST_NOT',
|
|
32
|
+
BOTTOM_SHEET_CLOSE_ACTION: 'MUST',
|
|
33
|
+
INCOMPATIBLE_ACCESSIBILITY_STATE: 'MUST',
|
|
34
|
+
NO_FORM_LABEL_ENDING_WITH_ASTERISK: 'MUST_NOT',
|
|
35
|
+
INCOMPATIBLE_ACCESSIBILITY_ROLE: 'MUST_NOT',
|
|
36
|
+
}
|
|
37
|
+
: null;
|
|
38
|
+
exports.CONTRAST_CHECKER_MAX_DEPTH = 5;
|
|
39
|
+
exports.IGNORE_CONTRAST_FOR_DISABLED_ELEMENTS = false;
|
|
40
|
+
exports.RULES_HELP = __DEV__
|
|
41
|
+
? {
|
|
42
|
+
NO_UNDEFINED: '',
|
|
43
|
+
CONTRAST_FAILED: 'https://formidable.com/open-source/react-native-ama/guidelines/contrast',
|
|
44
|
+
CONTRAST_FAILED_AAA: 'https://formidable.com/open-source/react-native-ama/guidelines/contrast',
|
|
45
|
+
MINIMUM_SIZE: 'https://formidable.com/open-source/react-native-ama/guidelines/minimum-size',
|
|
46
|
+
UPPERCASE_TEXT_NO_ACCESSIBILITY_LABEL: 'https://formidable.com/open-source/react-native-ama/guidelines/text',
|
|
47
|
+
NO_UPPERCASE_TEXT: 'https://formidable.com/open-source/react-native-ama/guidelines/text',
|
|
48
|
+
NO_ACCESSIBILITY_LABEL: 'https://formidable.com/open-source/react-native-ama/guidelines/accessibility-labels',
|
|
49
|
+
NO_ACCESSIBILITY_ROLE: 'https://formidable.com/open-source/react-native-ama/guidelines/accessibility-role',
|
|
50
|
+
NO_KEYBOARD_TRAP: 'https://formidable.com/open-source/react-native-ama/guidelines/forms',
|
|
51
|
+
NO_FORM_LABEL: 'https://formidable.com/open-source/react-native-ama/guidelines/forms',
|
|
52
|
+
NO_FORM_ERROR: 'https://formidable.com/open-source/react-native-ama/guidelines/forms',
|
|
53
|
+
FLATLIST_NO_COUNT_IN_SINGULAR_MESSAGE: 'https://formidable.com/open-source/react-native-ama/guidelines/lists-grids#number-of-results',
|
|
54
|
+
FLATLIST_NO_COUNT_IN_PLURAL_MESSAGE: 'https://formidable.com/open-source/react-native-ama/guidelines/lists-grids#number-of-results',
|
|
55
|
+
BOTTOM_SHEET_CLOSE_ACTION: 'https://formidable.com/open-source/react-native-ama/guidelines/bottomsheet',
|
|
56
|
+
INCOMPATIBLE_ACCESSIBILITY_STATE: 'https://formidable.com/open-source/react-native-ama/guidelines/accessibility-role',
|
|
57
|
+
INCOMPATIBLE_ACCESSIBILITY_ROLE: 'https://formidable.com/open-source/react-native-ama/guidelines/accessibility-role',
|
|
58
|
+
NO_FORM_LABEL_ENDING_WITH_ASTERISK: 'https://formidable.com/open-source/react-native-ama/guidelines/forms#labels',
|
|
59
|
+
}
|
|
60
|
+
: null;
|
|
61
|
+
exports.canRuleBeOverridden = __DEV__
|
|
62
|
+
? (rule) => {
|
|
63
|
+
return !exports.NON_OVERRIDABLE_RULES.includes(rule);
|
|
64
|
+
}
|
|
65
|
+
: null;
|
|
66
|
+
exports.SHELL_COLORS = __DEV__
|
|
67
|
+
? {
|
|
68
|
+
RED: '\x1b[31m',
|
|
69
|
+
YELLOW: '\x1b[33m',
|
|
70
|
+
RESET: '\x1b[0m',
|
|
71
|
+
BLUE: '\x1b[36m',
|
|
72
|
+
BG_RED: '\x1b[41m',
|
|
73
|
+
}
|
|
74
|
+
: undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.maybeGenerateStringFromElement = void 0;
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const maybeGenerateStringFromElement = (element, alternativeString) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (alternativeString || element == null) {
|
|
31
|
+
return alternativeString || '';
|
|
32
|
+
}
|
|
33
|
+
const pieces = extractPieces(element);
|
|
34
|
+
if (pieces == null || (pieces === null || pieces === void 0 ? void 0 : pieces.length) === 0) {
|
|
35
|
+
console.error(`Cannot generate the string from ${element} prop. Please provide one!`);
|
|
36
|
+
}
|
|
37
|
+
return (_a = pieces === null || pieces === void 0 ? void 0 : pieces.join(' ')) === null || _a === void 0 ? void 0 : _a.replace(/\*$/, '');
|
|
38
|
+
};
|
|
39
|
+
exports.maybeGenerateStringFromElement = maybeGenerateStringFromElement;
|
|
40
|
+
const extractPieces = (component) => {
|
|
41
|
+
return React.Children.map(component, child => {
|
|
42
|
+
if (!React.isValidElement(child)) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
const children = child.props.children;
|
|
46
|
+
if (React.isValidElement(children) || Array.isArray(children)) {
|
|
47
|
+
return extractPieces(children);
|
|
48
|
+
}
|
|
49
|
+
return children;
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MINIMUM_TOUCHABLE_SIZE = exports.IOS_MINIMUM_TOUCHABLE_SIZE = exports.ANDROID_MINIMUM_TOUCHABLE_SIZE = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
exports.ANDROID_MINIMUM_TOUCHABLE_SIZE = 48;
|
|
6
|
+
exports.IOS_MINIMUM_TOUCHABLE_SIZE = 44;
|
|
7
|
+
exports.MINIMUM_TOUCHABLE_SIZE = react_native_1.Platform.OS === 'android'
|
|
8
|
+
? exports.ANDROID_MINIMUM_TOUCHABLE_SIZE
|
|
9
|
+
: exports.IOS_MINIMUM_TOUCHABLE_SIZE;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseExpandable } from '../hooks/useExpandable';
|
|
3
|
+
import { type PressableProps } from './Pressable';
|
|
4
|
+
type ExpandablePressableProps = React.PropsWithChildren<UseExpandable<PressableProps>>;
|
|
5
|
+
export declare const ExpandablePressable: React.MemoExoticComponent<({ children, ...rest }: ExpandablePressableProps) => React.JSX.Element>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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.ExpandablePressable = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const useExpandable_1 = require("../hooks/useExpandable");
|
|
20
|
+
const Pressable_1 = require("./Pressable");
|
|
21
|
+
const ExpandablePressableBase = (_a) => {
|
|
22
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
23
|
+
const expandableProps = (0, useExpandable_1.useExpandable)(rest);
|
|
24
|
+
return <Pressable_1.Pressable {...expandableProps}>{children}</Pressable_1.Pressable>;
|
|
25
|
+
};
|
|
26
|
+
exports.ExpandablePressable = react_1.default.memo(ExpandablePressableBase);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PressableProps as RNPressableProps } from 'react-native';
|
|
3
|
+
import type { UsePressable } from '../hooks/usePressable';
|
|
4
|
+
export type PressableProps = UsePressable<RNPressableProps>;
|
|
5
|
+
export declare const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<React.ForwardRefExoticComponent<RNPressableProps & React.RefAttributes<import("react-native").View>>>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
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.Pressable = void 0;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const usePressable_1 = require("../hooks/usePressable");
|
|
41
|
+
exports.Pressable = React.forwardRef((_a, ref) => {
|
|
42
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
43
|
+
const pressableProps = (0, usePressable_1.usePressable)(rest, children);
|
|
44
|
+
return (<react_native_1.Pressable
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
ref={ref} {...rest} {...pressableProps}>
|
|
47
|
+
{children}
|
|
48
|
+
</react_native_1.Pressable>);
|
|
49
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleProp, SwitchProps, ViewStyle } from 'react-native';
|
|
3
|
+
export type SwitchListItemProps = React.PropsWithChildren<Omit<SwitchProps, 'style' | 'value' | 'onValueChange'> & {
|
|
4
|
+
labelComponent: JSX.Element;
|
|
5
|
+
labelPosition?: 'left' | 'right';
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
switchStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
value: boolean;
|
|
9
|
+
onValueChange: () => void;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const SwitchListItemBase: ({ children, testID, labelComponent, labelPosition, style, switchStyle, value, onValueChange, ...rest }: SwitchListItemProps) => React.JSX.Element;
|
|
12
|
+
export declare const SwitchListItem: React.MemoExoticComponent<({ children, testID, labelComponent, labelPosition, style, switchStyle, value, onValueChange, ...rest }: SwitchListItemProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.SwitchListItem = exports.SwitchListItemBase = void 0;
|
|
18
|
+
const core_1 = require("@react-native-ama/core");
|
|
19
|
+
const internal_1 = require("@react-native-ama/internal");
|
|
20
|
+
const react_1 = __importDefault(require("react"));
|
|
21
|
+
const react_native_1 = require("react-native");
|
|
22
|
+
const SwitchWrapper_1 = require("./SwitchWrapper");
|
|
23
|
+
const SwitchListItemBase = (_a) => {
|
|
24
|
+
var { children, testID, labelComponent, labelPosition = 'left', style = {}, switchStyle = {}, value, onValueChange } = _a, rest = __rest(_a, ["children", "testID", "labelComponent", "labelPosition", "style", "switchStyle", "value", "onValueChange"]);
|
|
25
|
+
const isLabelPositionLeft = labelPosition === 'left';
|
|
26
|
+
const accessibilityLabel = react_1.default.useMemo(() => (0, internal_1.maybeGenerateStringFromElement)(labelComponent, rest.accessibilityLabel), [labelComponent, rest.accessibilityLabel]);
|
|
27
|
+
return (<SwitchWrapper_1.SwitchWrapper accessibilityLabel={accessibilityLabel} style={[allStyles.container, style]} onPress={onValueChange} checked={value} testID={testID}>
|
|
28
|
+
{isLabelPositionLeft ? labelComponent : null}
|
|
29
|
+
<core_1.HideChildrenFromAccessibilityTree>
|
|
30
|
+
{children ? (children) : (<react_native_1.Switch {...rest} style={switchStyle} value={value} onValueChange={onValueChange} testID={`${testID}-switch`}/>)}
|
|
31
|
+
</core_1.HideChildrenFromAccessibilityTree>
|
|
32
|
+
{isLabelPositionLeft ? null : labelComponent}
|
|
33
|
+
</SwitchWrapper_1.SwitchWrapper>);
|
|
34
|
+
};
|
|
35
|
+
exports.SwitchListItemBase = SwitchListItemBase;
|
|
36
|
+
exports.SwitchListItem = react_1.default.memo(exports.SwitchListItemBase);
|
|
37
|
+
const allStyles = react_native_1.StyleSheet.create({
|
|
38
|
+
container: {
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
width: '100%',
|
|
41
|
+
alignContent: 'center',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AMAAccessibilityState } from '@react-native-ama/internal';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AccessibilityState, GestureResponderEvent, ViewProps } from 'react-native';
|
|
4
|
+
type SwitchWrapperProps = React.PropsWithChildren<Omit<ViewProps, 'accessibilityRole' | 'accessibilityLabel'> & AMAAccessibilityState & {
|
|
5
|
+
accessibilityLabel: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
8
|
+
checked: Pick<AccessibilityState, 'checked'> | boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const SwitchWrapper: React.MemoExoticComponent<({ children, ...rest }: SwitchWrapperProps) => React.JSX.Element>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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>;
|
|
@@ -0,0 +1,48 @@
|
|
|
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);
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,48 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|