@atlaskit/link-create 0.1.2 → 0.2.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/common/types.js +5 -0
- package/dist/cjs/controllers/form-context/index.js +18 -0
- package/dist/cjs/controllers/form-context/main.js +52 -0
- package/dist/cjs/index.js +29 -4
- package/dist/cjs/ui/create-form/async-select/index.js +12 -0
- package/dist/cjs/ui/create-form/async-select/main.js +49 -0
- package/dist/cjs/ui/create-form/async-select/types.js +5 -0
- package/dist/cjs/ui/create-form/index.js +26 -0
- package/dist/cjs/ui/create-form/main.js +83 -0
- package/dist/cjs/ui/create-form/textfield/index.js +12 -0
- package/dist/cjs/ui/create-form/textfield/main.js +49 -0
- package/dist/cjs/ui/create-form/textfield/types.js +5 -0
- package/dist/cjs/ui/create-form/types.js +5 -0
- package/dist/cjs/ui/create-form/utils/index.js +34 -0
- package/dist/cjs/ui/index.js +14 -7
- package/dist/cjs/ui/main.js +4 -54
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/types.js +1 -0
- package/dist/es2019/controllers/form-context/index.js +1 -0
- package/dist/es2019/controllers/form-context/main.js +31 -0
- package/dist/es2019/index.js +3 -2
- package/dist/es2019/ui/create-form/async-select/index.js +1 -0
- package/dist/es2019/ui/create-form/async-select/main.js +41 -0
- package/dist/es2019/ui/create-form/async-select/types.js +1 -0
- package/dist/es2019/ui/create-form/index.js +3 -0
- package/dist/es2019/ui/create-form/main.js +48 -0
- package/dist/es2019/ui/create-form/textfield/index.js +1 -0
- package/dist/es2019/ui/create-form/textfield/main.js +42 -0
- package/dist/es2019/ui/create-form/textfield/types.js +1 -0
- package/dist/es2019/ui/create-form/types.js +1 -0
- package/dist/es2019/ui/create-form/utils/index.js +28 -0
- package/dist/es2019/ui/index.js +4 -1
- package/dist/es2019/ui/main.js +3 -50
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/types.js +1 -0
- package/dist/esm/controllers/form-context/index.js +1 -0
- package/dist/esm/controllers/form-context/main.js +40 -0
- package/dist/esm/index.js +3 -2
- package/dist/esm/ui/create-form/async-select/index.js +1 -0
- package/dist/esm/ui/create-form/async-select/main.js +42 -0
- package/dist/esm/ui/create-form/async-select/types.js +1 -0
- package/dist/esm/ui/create-form/index.js +3 -0
- package/dist/esm/ui/create-form/main.js +73 -0
- package/dist/esm/ui/create-form/textfield/index.js +1 -0
- package/dist/esm/ui/create-form/textfield/main.js +41 -0
- package/dist/esm/ui/create-form/textfield/types.js +1 -0
- package/dist/esm/ui/create-form/types.js +1 -0
- package/dist/esm/ui/create-form/utils/index.js +28 -0
- package/dist/esm/ui/index.js +4 -1
- package/dist/esm/ui/main.js +3 -50
- package/dist/esm/version.json +1 -1
- package/dist/types/common/types.d.ts +8 -0
- package/dist/types/controllers/form-context/index.d.ts +1 -0
- package/dist/types/controllers/form-context/main.d.ts +10 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/ui/create-form/async-select/index.d.ts +1 -0
- package/dist/types/ui/create-form/async-select/main.d.ts +10 -0
- package/dist/types/ui/create-form/async-select/types.d.ts +18 -0
- package/dist/types/ui/create-form/index.d.ts +3 -0
- package/dist/types/ui/create-form/main.d.ts +8 -0
- package/dist/types/ui/create-form/textfield/index.d.ts +1 -0
- package/dist/types/ui/create-form/textfield/main.d.ts +9 -0
- package/dist/types/ui/create-form/textfield/types.d.ts +17 -0
- package/dist/types/ui/create-form/types.d.ts +6 -0
- package/dist/types/{utils.d.ts → ui/create-form/utils/index.d.ts} +3 -3
- package/dist/types/ui/index.d.ts +5 -1
- package/dist/types/ui/main.d.ts +2 -9
- package/dist/types/ui/types.d.ts +0 -36
- package/package.json +8 -8
- package/report.api.md +73 -20
- package/tmp/api-report-tmp.d.ts +63 -15
- package/dist/cjs/utils.js +0 -94
- package/dist/es2019/utils.js +0 -35
- package/dist/esm/utils.js +0 -87
package/dist/es2019/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { default, TextField,
|
|
2
|
-
export { useLinkCreateCallback } from './controllers/callback-context
|
|
1
|
+
export { default, TextField, CreateForm, AsyncSelect } from './ui/index';
|
|
2
|
+
export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
|
|
3
|
+
export { FormContextProvider, useFormContext } from './controllers/form-context';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AsyncSelect } from './main';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { Fragment, useEffect } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
6
|
+
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
7
|
+
import { useFormContext } from '../../../controllers/form-context';
|
|
8
|
+
/**
|
|
9
|
+
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
10
|
+
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
11
|
+
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
12
|
+
* of this text field are shown above the field.
|
|
13
|
+
*/
|
|
14
|
+
export function AsyncSelect({
|
|
15
|
+
label,
|
|
16
|
+
name,
|
|
17
|
+
validationHelpText,
|
|
18
|
+
isRequired,
|
|
19
|
+
testId,
|
|
20
|
+
validators,
|
|
21
|
+
...rest
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
assignValidator
|
|
25
|
+
} = useFormContext();
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (validators) {
|
|
28
|
+
assignValidator(name, validators);
|
|
29
|
+
}
|
|
30
|
+
}, [name, validators, assignValidator]);
|
|
31
|
+
return jsx("div", {
|
|
32
|
+
"data-testid": testId
|
|
33
|
+
}, jsx(Field, {
|
|
34
|
+
name: name,
|
|
35
|
+
label: label,
|
|
36
|
+
isRequired: isRequired
|
|
37
|
+
}, ({
|
|
38
|
+
fieldProps,
|
|
39
|
+
error
|
|
40
|
+
}) => jsx(Fragment, null, jsx(AkAsyncSelect, _extends({}, fieldProps, rest)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error))));
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
4
|
+
import Button from '@atlaskit/button/standard-button';
|
|
5
|
+
import Form, { FormFooter, FormSection } from '@atlaskit/form';
|
|
6
|
+
import { FormContextProvider, useFormContext } from '../../controllers/form-context';
|
|
7
|
+
import { validateFormData } from './utils';
|
|
8
|
+
const withFormContext = Component => props => /*#__PURE__*/React.createElement(FormContextProvider, null, /*#__PURE__*/React.createElement(Component, props));
|
|
9
|
+
const CreateFormWithoutContext = ({
|
|
10
|
+
children,
|
|
11
|
+
testId,
|
|
12
|
+
onCancel,
|
|
13
|
+
onSubmit
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
getValidators
|
|
17
|
+
} = useFormContext();
|
|
18
|
+
const handleSubmit = async data => {
|
|
19
|
+
const validators = getValidators();
|
|
20
|
+
const errors = validateFormData({
|
|
21
|
+
data,
|
|
22
|
+
validators
|
|
23
|
+
});
|
|
24
|
+
if (Object.keys(errors).length !== 0) {
|
|
25
|
+
return errors;
|
|
26
|
+
}
|
|
27
|
+
onSubmit(data);
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
30
|
+
onSubmit: handleSubmit
|
|
31
|
+
}, ({
|
|
32
|
+
submitting,
|
|
33
|
+
formProps
|
|
34
|
+
}) => /*#__PURE__*/React.createElement("form", _extends({}, formProps, {
|
|
35
|
+
name: "confluence-creation-form",
|
|
36
|
+
"data-testid": testId
|
|
37
|
+
}), /*#__PURE__*/React.createElement(FormSection, null, children), /*#__PURE__*/React.createElement(FormFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
38
|
+
appearance: "subtle",
|
|
39
|
+
onClick: onCancel,
|
|
40
|
+
testId: 'cancel-button'
|
|
41
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(LoadingButton, {
|
|
42
|
+
appearance: "primary",
|
|
43
|
+
type: "submit",
|
|
44
|
+
isLoading: submitting,
|
|
45
|
+
testId: 'create-button'
|
|
46
|
+
}, "Create"))));
|
|
47
|
+
};
|
|
48
|
+
export const CreateForm = withFormContext(CreateFormWithoutContext);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextField } from './main';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { Fragment, useEffect } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
6
|
+
import AkTextfield from '@atlaskit/textfield';
|
|
7
|
+
import { useFormContext } from '../../../controllers/form-context';
|
|
8
|
+
/**
|
|
9
|
+
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
10
|
+
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
11
|
+
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
12
|
+
* of this text field are shown above the field.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export function TextField({
|
|
16
|
+
label,
|
|
17
|
+
name,
|
|
18
|
+
validationHelpText,
|
|
19
|
+
isRequired,
|
|
20
|
+
testId,
|
|
21
|
+
validators
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
assignValidator
|
|
25
|
+
} = useFormContext();
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (validators) {
|
|
28
|
+
assignValidator(name, validators);
|
|
29
|
+
}
|
|
30
|
+
}, [name, validators, assignValidator]);
|
|
31
|
+
return jsx(Field, {
|
|
32
|
+
name: name,
|
|
33
|
+
label: label,
|
|
34
|
+
isRequired: isRequired,
|
|
35
|
+
defaultValue: ''
|
|
36
|
+
}, ({
|
|
37
|
+
fieldProps,
|
|
38
|
+
error
|
|
39
|
+
}) => jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, {
|
|
40
|
+
testId: testId
|
|
41
|
+
})), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error)));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Map of field names to errors for that field (or undefined if no error for that field) */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns an object where the keys are names of form fields, and values are a string if the field
|
|
5
|
+
* has an error, or undefined if the field is valid.
|
|
6
|
+
*/
|
|
7
|
+
export function validateFormData({
|
|
8
|
+
data,
|
|
9
|
+
validators
|
|
10
|
+
}) {
|
|
11
|
+
// Run each validator on the input
|
|
12
|
+
const map = {};
|
|
13
|
+
for (const fieldName of Object.keys(validators)) {
|
|
14
|
+
for (let i = 0; i < validators[fieldName].length; i++) {
|
|
15
|
+
const currentValidator = validators[fieldName][i];
|
|
16
|
+
|
|
17
|
+
// If we already have an error for this field, skip any new validations on this field
|
|
18
|
+
if (map[fieldName] !== undefined) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const maybeValue = data[fieldName];
|
|
22
|
+
if (!currentValidator.isValid(maybeValue)) {
|
|
23
|
+
map[fieldName] = currentValidator.errorMessage;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return map;
|
|
28
|
+
}
|
package/dist/es2019/ui/index.js
CHANGED
package/dist/es2019/ui/main.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
2
|
import { jsx } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
-
import Modal, { ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
7
|
-
import AkSelect from '@atlaskit/select';
|
|
8
|
-
import AkTextfield from '@atlaskit/textfield';
|
|
3
|
+
import Modal, { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
9
4
|
import { LinkCreateCallbackProvider } from '../controllers/callback-context';
|
|
10
5
|
export default function LinkCreate({
|
|
11
6
|
plugins,
|
|
@@ -24,51 +19,9 @@ export default function LinkCreate({
|
|
|
24
19
|
return jsx(ModalTransition, null, !!active && jsx(Modal, {
|
|
25
20
|
onClose: onCancel,
|
|
26
21
|
testId: testId
|
|
27
|
-
}, jsx(ModalHeader, null, jsx(ModalTitle, null, "Create New")), jsx(LinkCreateCallbackProvider, {
|
|
22
|
+
}, jsx(ModalHeader, null, jsx(ModalTitle, null, "Create New")), jsx(ModalBody, null, jsx(LinkCreateCallbackProvider, {
|
|
28
23
|
onCreate: onCreate,
|
|
29
24
|
onFailure: onFailure,
|
|
30
25
|
onCancel: onCancel
|
|
31
|
-
}, chosenOne.form)));
|
|
32
|
-
}
|
|
33
|
-
export function Select({
|
|
34
|
-
name,
|
|
35
|
-
title,
|
|
36
|
-
options,
|
|
37
|
-
defaultOption,
|
|
38
|
-
placeholder
|
|
39
|
-
}) {
|
|
40
|
-
return jsx(Field, {
|
|
41
|
-
name: name,
|
|
42
|
-
label: title,
|
|
43
|
-
isRequired: true
|
|
44
|
-
}, ({
|
|
45
|
-
fieldProps,
|
|
46
|
-
error
|
|
47
|
-
}) => jsx(Fragment, null, error && jsx(ErrorMessage, null, error), jsx(AkSelect, _extends({}, fieldProps, {
|
|
48
|
-
inputId: `${title}-input-id`,
|
|
49
|
-
options: options,
|
|
50
|
-
placeholder: placeholder,
|
|
51
|
-
defaultValue: defaultOption
|
|
52
|
-
}))));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
57
|
-
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
58
|
-
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
59
|
-
* of this text field are shown above the field.
|
|
60
|
-
*/
|
|
61
|
-
export function TextField({
|
|
62
|
-
label,
|
|
63
|
-
name,
|
|
64
|
-
validationHelpText
|
|
65
|
-
}) {
|
|
66
|
-
return jsx(Field, {
|
|
67
|
-
name: name,
|
|
68
|
-
label: label,
|
|
69
|
-
isRequired: true
|
|
70
|
-
}, ({
|
|
71
|
-
fieldProps,
|
|
72
|
-
error
|
|
73
|
-
}) => jsx(Fragment, null, jsx(AkTextfield, fieldProps), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error)));
|
|
26
|
+
}, chosenOne.form))));
|
|
74
27
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormContextProvider, useFormContext } from './main';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
6
|
+
export var FormContext = /*#__PURE__*/createContext({
|
|
7
|
+
assignValidator: function assignValidator() {},
|
|
8
|
+
getValidators: function getValidators() {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var FormContextProvider = function FormContextProvider(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
var _useState = useState({}),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
validators = _useState2[0],
|
|
17
|
+
setValidators = _useState2[1];
|
|
18
|
+
|
|
19
|
+
// Use useCallback to prevent infinite useEffect calls
|
|
20
|
+
var assignValidator = useCallback(function (name, fieldValidators) {
|
|
21
|
+
setValidators(function (prevValidators) {
|
|
22
|
+
return _objectSpread(_objectSpread({}, prevValidators), {}, _defineProperty({}, name, fieldValidators));
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
// Use useCallback to prevent infinite useEffect calls
|
|
27
|
+
var getValidators = useCallback(function () {
|
|
28
|
+
return validators;
|
|
29
|
+
}, [validators]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
31
|
+
value: {
|
|
32
|
+
assignValidator: assignValidator,
|
|
33
|
+
getValidators: getValidators
|
|
34
|
+
}
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
|
37
|
+
var useFormContext = function useFormContext() {
|
|
38
|
+
return useContext(FormContext);
|
|
39
|
+
};
|
|
40
|
+
export { FormContextProvider, useFormContext };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { default, TextField,
|
|
2
|
-
export { useLinkCreateCallback } from './controllers/callback-context
|
|
1
|
+
export { default, TextField, CreateForm, AsyncSelect } from './ui/index';
|
|
2
|
+
export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
|
|
3
|
+
export { FormContextProvider, useFormContext } from './controllers/form-context';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AsyncSelect } from './main';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators"];
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { Fragment, useEffect } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
8
|
+
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
9
|
+
import { useFormContext } from '../../../controllers/form-context';
|
|
10
|
+
/**
|
|
11
|
+
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
12
|
+
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
13
|
+
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
14
|
+
* of this text field are shown above the field.
|
|
15
|
+
*/
|
|
16
|
+
export function AsyncSelect(_ref) {
|
|
17
|
+
var label = _ref.label,
|
|
18
|
+
name = _ref.name,
|
|
19
|
+
validationHelpText = _ref.validationHelpText,
|
|
20
|
+
isRequired = _ref.isRequired,
|
|
21
|
+
testId = _ref.testId,
|
|
22
|
+
validators = _ref.validators,
|
|
23
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
var _useFormContext = useFormContext(),
|
|
25
|
+
assignValidator = _useFormContext.assignValidator;
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
if (validators) {
|
|
28
|
+
assignValidator(name, validators);
|
|
29
|
+
}
|
|
30
|
+
}, [name, validators, assignValidator]);
|
|
31
|
+
return jsx("div", {
|
|
32
|
+
"data-testid": testId
|
|
33
|
+
}, jsx(Field, {
|
|
34
|
+
name: name,
|
|
35
|
+
label: label,
|
|
36
|
+
isRequired: isRequired
|
|
37
|
+
}, function (_ref2) {
|
|
38
|
+
var fieldProps = _ref2.fieldProps,
|
|
39
|
+
error = _ref2.error;
|
|
40
|
+
return jsx(Fragment, null, jsx(AkAsyncSelect, _extends({}, fieldProps, rest)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
7
|
+
import Button from '@atlaskit/button/standard-button';
|
|
8
|
+
import Form, { FormFooter, FormSection } from '@atlaskit/form';
|
|
9
|
+
import { FormContextProvider, useFormContext } from '../../controllers/form-context';
|
|
10
|
+
import { validateFormData } from './utils';
|
|
11
|
+
var withFormContext = function withFormContext(Component) {
|
|
12
|
+
return function (props) {
|
|
13
|
+
return /*#__PURE__*/React.createElement(FormContextProvider, null, /*#__PURE__*/React.createElement(Component, props));
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var CreateFormWithoutContext = function CreateFormWithoutContext(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
testId = _ref.testId,
|
|
19
|
+
onCancel = _ref.onCancel,
|
|
20
|
+
onSubmit = _ref.onSubmit;
|
|
21
|
+
var _useFormContext = useFormContext(),
|
|
22
|
+
getValidators = _useFormContext.getValidators;
|
|
23
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
24
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
25
|
+
var validators, errors;
|
|
26
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
27
|
+
while (1) {
|
|
28
|
+
switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
validators = getValidators();
|
|
31
|
+
errors = validateFormData({
|
|
32
|
+
data: data,
|
|
33
|
+
validators: validators
|
|
34
|
+
});
|
|
35
|
+
if (!(Object.keys(errors).length !== 0)) {
|
|
36
|
+
_context.next = 4;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return _context.abrupt("return", errors);
|
|
40
|
+
case 4:
|
|
41
|
+
onSubmit(data);
|
|
42
|
+
case 5:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, _callee);
|
|
48
|
+
}));
|
|
49
|
+
return function handleSubmit(_x) {
|
|
50
|
+
return _ref2.apply(this, arguments);
|
|
51
|
+
};
|
|
52
|
+
}();
|
|
53
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
54
|
+
onSubmit: handleSubmit
|
|
55
|
+
}, function (_ref3) {
|
|
56
|
+
var submitting = _ref3.submitting,
|
|
57
|
+
formProps = _ref3.formProps;
|
|
58
|
+
return /*#__PURE__*/React.createElement("form", _extends({}, formProps, {
|
|
59
|
+
name: "confluence-creation-form",
|
|
60
|
+
"data-testid": testId
|
|
61
|
+
}), /*#__PURE__*/React.createElement(FormSection, null, children), /*#__PURE__*/React.createElement(FormFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
appearance: "subtle",
|
|
63
|
+
onClick: onCancel,
|
|
64
|
+
testId: 'cancel-button'
|
|
65
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(LoadingButton, {
|
|
66
|
+
appearance: "primary",
|
|
67
|
+
type: "submit",
|
|
68
|
+
isLoading: submitting,
|
|
69
|
+
testId: 'create-button'
|
|
70
|
+
}, "Create")));
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export var CreateForm = withFormContext(CreateFormWithoutContext);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextField } from './main';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { Fragment, useEffect } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
6
|
+
import AkTextfield from '@atlaskit/textfield';
|
|
7
|
+
import { useFormContext } from '../../../controllers/form-context';
|
|
8
|
+
/**
|
|
9
|
+
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
10
|
+
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
11
|
+
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
12
|
+
* of this text field are shown above the field.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export function TextField(_ref) {
|
|
16
|
+
var label = _ref.label,
|
|
17
|
+
name = _ref.name,
|
|
18
|
+
validationHelpText = _ref.validationHelpText,
|
|
19
|
+
isRequired = _ref.isRequired,
|
|
20
|
+
testId = _ref.testId,
|
|
21
|
+
validators = _ref.validators;
|
|
22
|
+
var _useFormContext = useFormContext(),
|
|
23
|
+
assignValidator = _useFormContext.assignValidator;
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (validators) {
|
|
26
|
+
assignValidator(name, validators);
|
|
27
|
+
}
|
|
28
|
+
}, [name, validators, assignValidator]);
|
|
29
|
+
return jsx(Field, {
|
|
30
|
+
name: name,
|
|
31
|
+
label: label,
|
|
32
|
+
isRequired: isRequired,
|
|
33
|
+
defaultValue: ''
|
|
34
|
+
}, function (_ref2) {
|
|
35
|
+
var fieldProps = _ref2.fieldProps,
|
|
36
|
+
error = _ref2.error;
|
|
37
|
+
return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, {
|
|
38
|
+
testId: testId
|
|
39
|
+
})), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Map of field names to errors for that field (or undefined if no error for that field) */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns an object where the keys are names of form fields, and values are a string if the field
|
|
5
|
+
* has an error, or undefined if the field is valid.
|
|
6
|
+
*/
|
|
7
|
+
export function validateFormData(_ref) {
|
|
8
|
+
var data = _ref.data,
|
|
9
|
+
validators = _ref.validators;
|
|
10
|
+
// Run each validator on the input
|
|
11
|
+
var map = {};
|
|
12
|
+
for (var _i = 0, _Object$keys = Object.keys(validators); _i < _Object$keys.length; _i++) {
|
|
13
|
+
var fieldName = _Object$keys[_i];
|
|
14
|
+
for (var i = 0; i < validators[fieldName].length; i++) {
|
|
15
|
+
var currentValidator = validators[fieldName][i];
|
|
16
|
+
|
|
17
|
+
// If we already have an error for this field, skip any new validations on this field
|
|
18
|
+
if (map[fieldName] !== undefined) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
var maybeValue = data[fieldName];
|
|
22
|
+
if (!currentValidator.isValid(maybeValue)) {
|
|
23
|
+
map[fieldName] = currentValidator.errorMessage;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return map;
|
|
28
|
+
}
|
package/dist/esm/ui/index.js
CHANGED
package/dist/esm/ui/main.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
2
|
import { jsx } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
-
import Modal, { ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
7
|
-
import AkSelect from '@atlaskit/select';
|
|
8
|
-
import AkTextfield from '@atlaskit/textfield';
|
|
3
|
+
import Modal, { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
9
4
|
import { LinkCreateCallbackProvider } from '../controllers/callback-context';
|
|
10
5
|
export default function LinkCreate(_ref) {
|
|
11
6
|
var plugins = _ref.plugins,
|
|
@@ -25,51 +20,9 @@ export default function LinkCreate(_ref) {
|
|
|
25
20
|
return jsx(ModalTransition, null, !!active && jsx(Modal, {
|
|
26
21
|
onClose: onCancel,
|
|
27
22
|
testId: testId
|
|
28
|
-
}, jsx(ModalHeader, null, jsx(ModalTitle, null, "Create New")), jsx(LinkCreateCallbackProvider, {
|
|
23
|
+
}, jsx(ModalHeader, null, jsx(ModalTitle, null, "Create New")), jsx(ModalBody, null, jsx(LinkCreateCallbackProvider, {
|
|
29
24
|
onCreate: onCreate,
|
|
30
25
|
onFailure: onFailure,
|
|
31
26
|
onCancel: onCancel
|
|
32
|
-
}, chosenOne.form)));
|
|
33
|
-
}
|
|
34
|
-
export function Select(_ref2) {
|
|
35
|
-
var name = _ref2.name,
|
|
36
|
-
title = _ref2.title,
|
|
37
|
-
options = _ref2.options,
|
|
38
|
-
defaultOption = _ref2.defaultOption,
|
|
39
|
-
placeholder = _ref2.placeholder;
|
|
40
|
-
return jsx(Field, {
|
|
41
|
-
name: name,
|
|
42
|
-
label: title,
|
|
43
|
-
isRequired: true
|
|
44
|
-
}, function (_ref3) {
|
|
45
|
-
var fieldProps = _ref3.fieldProps,
|
|
46
|
-
error = _ref3.error;
|
|
47
|
-
return jsx(Fragment, null, error && jsx(ErrorMessage, null, error), jsx(AkSelect, _extends({}, fieldProps, {
|
|
48
|
-
inputId: "".concat(title, "-input-id"),
|
|
49
|
-
options: options,
|
|
50
|
-
placeholder: placeholder,
|
|
51
|
-
defaultValue: defaultOption
|
|
52
|
-
})));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
58
|
-
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
59
|
-
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
60
|
-
* of this text field are shown above the field.
|
|
61
|
-
*/
|
|
62
|
-
export function TextField(_ref4) {
|
|
63
|
-
var label = _ref4.label,
|
|
64
|
-
name = _ref4.name,
|
|
65
|
-
validationHelpText = _ref4.validationHelpText;
|
|
66
|
-
return jsx(Field, {
|
|
67
|
-
name: name,
|
|
68
|
-
label: label,
|
|
69
|
-
isRequired: true
|
|
70
|
-
}, function (_ref5) {
|
|
71
|
-
var fieldProps = _ref5.fieldProps,
|
|
72
|
-
error = _ref5.error;
|
|
73
|
-
return jsx(Fragment, null, jsx(AkTextfield, fieldProps), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
|
|
74
|
-
});
|
|
27
|
+
}, chosenOne.form))));
|
|
75
28
|
}
|
package/dist/esm/version.json
CHANGED