@aemforms/af-react-native 1.0.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 (43) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +121 -0
  3. package/lib/components/Button.d.ts +22 -0
  4. package/lib/components/Button.js +32 -0
  5. package/lib/components/Checkbox.d.ts +22 -0
  6. package/lib/components/Checkbox.js +65 -0
  7. package/lib/components/CheckboxGroup.d.ts +22 -0
  8. package/lib/components/CheckboxGroup.js +78 -0
  9. package/lib/components/DatePicker.d.ts +22 -0
  10. package/lib/components/DatePicker.js +110 -0
  11. package/lib/components/DropDown.d.ts +22 -0
  12. package/lib/components/DropDown.js +64 -0
  13. package/lib/components/FileUpload.d.ts +22 -0
  14. package/lib/components/FileUpload.js +45 -0
  15. package/lib/components/Form.d.ts +24 -0
  16. package/lib/components/Form.js +56 -0
  17. package/lib/components/NumberField.d.ts +22 -0
  18. package/lib/components/NumberField.js +81 -0
  19. package/lib/components/Panel.d.ts +23 -0
  20. package/lib/components/Panel.js +68 -0
  21. package/lib/components/PlainText.d.ts +22 -0
  22. package/lib/components/PlainText.js +39 -0
  23. package/lib/components/RadioGroup.d.ts +22 -0
  24. package/lib/components/RadioGroup.js +64 -0
  25. package/lib/components/Repeater.d.ts +23 -0
  26. package/lib/components/Repeater.js +61 -0
  27. package/lib/components/TextField.d.ts +22 -0
  28. package/lib/components/TextField.js +84 -0
  29. package/lib/index.d.ts +35 -0
  30. package/lib/index.js +55 -0
  31. package/lib/shared/FileUpload.d.ts +23 -0
  32. package/lib/shared/FileUpload.js +110 -0
  33. package/lib/shared/withRuleEngine.d.ts +22 -0
  34. package/lib/shared/withRuleEngine.js +64 -0
  35. package/lib/utils/common.d.ts +24 -0
  36. package/lib/utils/common.js +112 -0
  37. package/lib/utils/mappings.d.ts +38 -0
  38. package/lib/utils/mappings.js +54 -0
  39. package/lib/utils/theme.d.ts +19657 -0
  40. package/lib/utils/theme.js +109 -0
  41. package/lib/utils/types.d.ts +91 -0
  42. package/lib/utils/types.js +21 -0
  43. package/package.json +76 -0
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const react_1 = __importDefault(require("react"));
26
+ const native_base_1 = require("native-base");
27
+ const af_core_1 = require("@aemforms/af-core");
28
+ const withRuleEngine_1 = __importDefault(require("../shared/withRuleEngine"));
29
+ const FileUpload_1 = __importDefault(require("../shared/FileUpload"));
30
+ const FileUploadComponent = function (props) {
31
+ const { isError, required, label, errorMessage, description, type, accept, value, maxFileSize, dispatchChange } = props;
32
+ const fileUploadProps = {
33
+ value: value && ((value instanceof Array) ? value : [value]),
34
+ onChange: dispatchChange,
35
+ accept: accept || [],
36
+ multiple: type === 'file[]' || type === 'string[]',
37
+ maxFileSizeInBytes: (0, af_core_1.getFileSizeInBytes)(maxFileSize) || 500000000
38
+ };
39
+ return (react_1.default.createElement(native_base_1.FormControl, { isInvalid: isError, isRequired: required },
40
+ (label === null || label === void 0 ? void 0 : label.visible) && react_1.default.createElement(native_base_1.FormControl.Label, null, label === null || label === void 0 ? void 0 : label.value),
41
+ react_1.default.createElement(FileUpload_1.default, Object.assign({}, fileUploadProps)),
42
+ errorMessage ? react_1.default.createElement(native_base_1.FormControl.ErrorMessage, { testID: `${props.id}-error` }, errorMessage) : null,
43
+ description && !errorMessage ? react_1.default.createElement(native_base_1.FormControl.HelperText, { testID: `${props.id}-description` }, description) : null));
44
+ };
45
+ exports.default = (0, withRuleEngine_1.default)(FileUploadComponent);
@@ -0,0 +1,24 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import { FieldsetJson } from '@aemforms/af-core';
21
+ import React from 'react';
22
+ import { State } from '@aemforms/af-core';
23
+ declare const Form: (fieldset: State<FieldsetJson>) => React.JSX.Element;
24
+ export default Form;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ const react_1 = __importStar(require("react"));
46
+ const af_react_renderer_1 = require("@aemforms/af-react-renderer");
47
+ const react_native_1 = require("react-native");
48
+ const Form = function (fieldset) {
49
+ var _a;
50
+ const context = (0, react_1.useContext)(af_react_renderer_1.FormContext);
51
+ const [props, handlers] = (0, af_react_renderer_1.useRuleEngine)(fieldset);
52
+ return (react_1.default.createElement(react_1.default.Fragment, null,
53
+ ((_a = props === null || props === void 0 ? void 0 : props.label) === null || _a === void 0 ? void 0 : _a.value) ? react_1.default.createElement(react_native_1.Text, null, props.label.value) : null,
54
+ (0, af_react_renderer_1.renderChildren)(props, context.mappings, context.modelId, handlers)));
55
+ };
56
+ exports.default = Form;
@@ -0,0 +1,22 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import React from 'react';
21
+ declare const _default: (fieldset: import("@aemforms/af-core").State<import("@aemforms/af-core").FieldJson>) => React.JSX.Element | null;
22
+ export default _default;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ const react_1 = __importStar(require("react"));
49
+ const native_base_1 = require("native-base");
50
+ const withRuleEngine_1 = __importDefault(require("../shared/withRuleEngine"));
51
+ const NumberComponent = function (props) {
52
+ const { isError, required, label, errorMessage, description } = props;
53
+ const changeHandler = (0, react_1.useCallback)((event) => {
54
+ props.dispatchChange(event);
55
+ }, [props.dispatchChange]);
56
+ const blurHandler = (0, react_1.useCallback)((event) => {
57
+ props.dispatchBlur(event);
58
+ }, [props.dispatchBlur]);
59
+ const focusHandler = (0, react_1.useCallback)((event) => {
60
+ props.dispatchFocus(event);
61
+ }, [props.dispatchFocus]);
62
+ const inputProps = {
63
+ placeholder: props.placeholder || '',
64
+ value: props.value == null ? '' : props.value,
65
+ onChangeText: changeHandler,
66
+ onBlur: blurHandler,
67
+ onFocus: focusHandler,
68
+ isReadOnly: props.readOnly === true,
69
+ isRequired: props.required === true,
70
+ isDisabled: props.enabled === false,
71
+ KeyboardTypeOptions: 'numeric',
72
+ maximum: props.maximum,
73
+ minimum: props.minimum
74
+ };
75
+ return (react_1.default.createElement(native_base_1.FormControl, { isInvalid: isError, isRequired: required },
76
+ (label === null || label === void 0 ? void 0 : label.visible) && react_1.default.createElement(native_base_1.FormControl.Label, null, label === null || label === void 0 ? void 0 : label.value),
77
+ react_1.default.createElement(native_base_1.Input, Object.assign({}, inputProps)),
78
+ errorMessage ? react_1.default.createElement(native_base_1.FormControl.ErrorMessage, { testID: `${props.id}-error` }, errorMessage) : null,
79
+ description && !errorMessage ? react_1.default.createElement(native_base_1.FormControl.HelperText, { testID: `${props.id}-description` }, description) : null));
80
+ };
81
+ exports.default = (0, withRuleEngine_1.default)(NumberComponent);
@@ -0,0 +1,23 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import { FieldsetJson, State } from '@aemforms/af-core';
21
+ import React from 'react';
22
+ declare const Panel: (fieldset: State<FieldsetJson>) => React.JSX.Element | null;
23
+ export default Panel;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ const af_core_1 = require("@aemforms/af-core");
46
+ const react_1 = __importStar(require("react"));
47
+ const af_react_renderer_1 = require("@aemforms/af-react-renderer");
48
+ const native_base_1 = require("native-base");
49
+ const Panel = function (fieldset) {
50
+ var _a, _b, _c;
51
+ const context = (0, react_1.useContext)(af_react_renderer_1.FormContext);
52
+ const [props, handlers] = (0, af_react_renderer_1.useRuleEngine)(fieldset);
53
+ const translationId = (0, af_core_1.getOrElse)(props, ['properties', 'afs:translationIds', 'label.value']);
54
+ const i18n = (0, af_react_renderer_1.useFormIntl)();
55
+ let localizedLabel = (_a = props === null || props === void 0 ? void 0 : props.label) === null || _a === void 0 ? void 0 : _a.value;
56
+ if (translationId) {
57
+ localizedLabel = i18n.formatMessage({ id: translationId, defaultMessage: (_b = props === null || props === void 0 ? void 0 : props.label) === null || _b === void 0 ? void 0 : _b.value });
58
+ }
59
+ if (props.visible) {
60
+ return (react_1.default.createElement(native_base_1.Box, null,
61
+ ((_c = props.label) === null || _c === void 0 ? void 0 : _c.visible) !== false ? react_1.default.createElement(native_base_1.Text, null, localizedLabel) : null,
62
+ (0, af_react_renderer_1.renderChildren)(props, context.mappings, context.modelId, handlers)));
63
+ }
64
+ else {
65
+ return null;
66
+ }
67
+ };
68
+ exports.default = Panel;
@@ -0,0 +1,22 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import React from 'react';
21
+ declare const _default: (fieldset: import("@aemforms/af-core").State<import("@aemforms/af-core").FieldJson>) => React.JSX.Element | null;
22
+ export default _default;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const react_1 = __importDefault(require("react"));
26
+ const react_native_1 = require("react-native");
27
+ const native_base_1 = require("native-base");
28
+ const react_native_render_html_1 = __importDefault(require("react-native-render-html"));
29
+ const withRuleEngine_1 = __importDefault(require("../shared/withRuleEngine"));
30
+ const PlainTextComponent = function (props) {
31
+ const { width } = (0, react_native_1.useWindowDimensions)();
32
+ if (props.richText) {
33
+ return (react_1.default.createElement(react_native_render_html_1.default, { contentWidth: width, source: { html: props === null || props === void 0 ? void 0 : props.value } }));
34
+ }
35
+ else {
36
+ return (react_1.default.createElement(native_base_1.Text, null, props.value || ''));
37
+ }
38
+ };
39
+ exports.default = (0, withRuleEngine_1.default)(PlainTextComponent);
@@ -0,0 +1,22 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import React from 'react';
21
+ declare const _default: (fieldset: import("@aemforms/af-core").State<import("@aemforms/af-core").FieldJson>) => React.JSX.Element | null;
22
+ export default _default;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ const react_1 = __importStar(require("react"));
49
+ const native_base_1 = require("native-base");
50
+ const withRuleEngine_1 = __importDefault(require("../shared/withRuleEngine"));
51
+ const RadioGroupComponent = function (props) {
52
+ const { isError, required, label, errorMessage, description, value, enumNames, name, dispatchChange } = props;
53
+ const enums = props.enum || [];
54
+ const options = (enumNames === null || enumNames === void 0 ? void 0 : enumNames.length) ? enumNames : enums;
55
+ const changeHandler = (0, react_1.useCallback)((val) => {
56
+ dispatchChange(val);
57
+ }, [dispatchChange]);
58
+ return (react_1.default.createElement(native_base_1.FormControl, { isInvalid: isError, isRequired: required },
59
+ (label === null || label === void 0 ? void 0 : label.visible) && react_1.default.createElement(native_base_1.FormControl.Label, null, label === null || label === void 0 ? void 0 : label.value),
60
+ react_1.default.createElement(native_base_1.Radio.Group, { onChange: changeHandler, value: value, name: name || 'radio' }, options === null || options === void 0 ? void 0 : options.map((text, index) => (react_1.default.createElement(native_base_1.Radio, { key: enums[index], value: enums[index], style: { marginTop: 3 } }, text)))),
61
+ errorMessage ? react_1.default.createElement(native_base_1.FormControl.ErrorMessage, { testID: `${props.id}-error` }, errorMessage) : null,
62
+ description && !errorMessage ? react_1.default.createElement(native_base_1.FormControl.HelperText, { testID: `${props.id}-description` }, description) : null));
63
+ };
64
+ exports.default = (0, withRuleEngine_1.default)(RadioGroupComponent);
@@ -0,0 +1,23 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import React from 'react';
21
+ import { REPEATER } from '../utils/types';
22
+ declare const Repeater: (props: REPEATER) => React.JSX.Element;
23
+ export default Repeater;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * ADOBE CONFIDENTIAL
4
+ * ___________________
5
+ *
6
+ * Copyright 2023 Adobe
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Adobe and its suppliers, if any. The intellectual
11
+ * and technical concepts contained herein are proprietary to Adobe
12
+ * and its suppliers and are protected by all applicable intellectual
13
+ * property laws, including trade secret and copyright laws.
14
+ * Dissemination of this information or reproduction of this material
15
+ * is strictly forbidden unless prior written permission is obtained
16
+ * from Adobe.
17
+
18
+ * Adobe permits you to use and modify this file solely in accordance with
19
+ * the terms of the Adobe license agreement accompanying it.
20
+ *************************************************************************/
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ const react_1 = __importStar(require("react"));
46
+ const native_base_1 = require("native-base");
47
+ const Repeater = (props) => {
48
+ const { add, remove, index, handlers } = props;
49
+ const addHandler = (0, react_1.useCallback)(() => {
50
+ handlers.dispatchAddItem(index + 1);
51
+ }, [index, handlers.dispatchAddItem]);
52
+ const removeHandler = (0, react_1.useCallback)(() => {
53
+ handlers.dispatchRemoveItem(index);
54
+ }, [index, handlers.dispatchRemoveItem]);
55
+ return (react_1.default.createElement(native_base_1.Button.Group, null,
56
+ add ? react_1.default.createElement(native_base_1.Button, { testID: 'add-button', onPress: addHandler, variant: 'primary' },
57
+ react_1.default.createElement(native_base_1.AddIcon, null)) : react_1.default.createElement(react_1.default.Fragment, null),
58
+ remove ? react_1.default.createElement(native_base_1.Button, { testID: 'remove-button', onPress: removeHandler, variant: 'primary' },
59
+ react_1.default.createElement(native_base_1.MinusIcon, null)) : react_1.default.createElement(react_1.default.Fragment, null)));
60
+ };
61
+ exports.default = Repeater;
@@ -0,0 +1,22 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2023 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+ import React from 'react';
21
+ declare const _default: (fieldset: import("@aemforms/af-core").State<import("@aemforms/af-core").FieldJson>) => React.JSX.Element | null;
22
+ export default _default;