@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/esm/utils.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
/** Map of field names to errors for that field (or undefined if no error for that field) */
|
|
4
|
-
|
|
5
|
-
function isOption(maybeOption) {
|
|
6
|
-
return maybeOption !== undefined && maybeOption !== null && maybeOption.value !== undefined && typeof maybeOption.value === 'string';
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Returns an object where the keys are names of form fields, and values are a string if the field
|
|
10
|
-
* has an error, or undefined if the field is valid.
|
|
11
|
-
*/
|
|
12
|
-
export function validateFormData(_x) {
|
|
13
|
-
return _validateFormData.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
function _validateFormData() {
|
|
16
|
-
_validateFormData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
17
|
-
var data, validators, map, i, v, fieldName, maybeValue;
|
|
18
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
-
while (1) {
|
|
20
|
-
switch (_context.prev = _context.next) {
|
|
21
|
-
case 0:
|
|
22
|
-
data = _ref.data, validators = _ref.validators;
|
|
23
|
-
// Run each validator on the input.
|
|
24
|
-
map = {};
|
|
25
|
-
i = 0;
|
|
26
|
-
case 3:
|
|
27
|
-
if (!(i < validators.length)) {
|
|
28
|
-
_context.next = 26;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
v = validators[i];
|
|
32
|
-
fieldName = v.fieldName;
|
|
33
|
-
maybeValue = data[fieldName]; // If maybeValue is undefined, the fieldname of the current validator doesn't exist
|
|
34
|
-
// in our form.
|
|
35
|
-
// Value should always be in form, but if not, check if it's undefined here
|
|
36
|
-
if (!(maybeValue === undefined || maybeValue === null)) {
|
|
37
|
-
_context.next = 9;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
return _context.abrupt("continue", 23);
|
|
41
|
-
case 9:
|
|
42
|
-
_context.t0 = typeof maybeValue === 'string';
|
|
43
|
-
if (!_context.t0) {
|
|
44
|
-
_context.next = 14;
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
_context.next = 13;
|
|
48
|
-
return v.isInvalid(maybeValue);
|
|
49
|
-
case 13:
|
|
50
|
-
_context.t0 = _context.sent;
|
|
51
|
-
case 14:
|
|
52
|
-
if (!_context.t0) {
|
|
53
|
-
_context.next = 16;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
map[v.fieldName] = v.errorMessage;
|
|
57
|
-
case 16:
|
|
58
|
-
_context.t1 = isOption(maybeValue);
|
|
59
|
-
if (!_context.t1) {
|
|
60
|
-
_context.next = 21;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
_context.next = 20;
|
|
64
|
-
return v.isInvalid(maybeValue.value);
|
|
65
|
-
case 20:
|
|
66
|
-
_context.t1 = _context.sent;
|
|
67
|
-
case 21:
|
|
68
|
-
if (!_context.t1) {
|
|
69
|
-
_context.next = 23;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
map[v.fieldName] = v.errorMessage;
|
|
73
|
-
case 23:
|
|
74
|
-
i++;
|
|
75
|
-
_context.next = 3;
|
|
76
|
-
break;
|
|
77
|
-
case 26:
|
|
78
|
-
return _context.abrupt("return", map);
|
|
79
|
-
case 27:
|
|
80
|
-
case "end":
|
|
81
|
-
return _context.stop();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}, _callee);
|
|
85
|
-
}));
|
|
86
|
-
return _validateFormData.apply(this, arguments);
|
|
87
|
-
}
|