@jobber/components 2.82.1 → 2.84.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/CHANGELOG.md +33 -0
- package/dist/InputFile/InputFile.d.ts +13 -1
- package/dist/InputFile/index.js +44 -20
- package/dist/Markdown/index.js +38 -34
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,39 @@ menu: Changelog
|
|
|
8
8
|
All notable changes to this project will be documented in this file.
|
|
9
9
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
10
10
|
|
|
11
|
+
# [2.84.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.83.1...@jobber/components@2.84.0) (2022-06-07)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **components:** JOB-40406 Allow PUT requests in InputFile component ([#895](https://github.com/GetJobber/atlantis/issues/895)) ([4101f44](https://github.com/GetJobber/atlantis/commit/4101f441327ecfebb55ce868dbd9bf7d3d9ec837))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [2.83.1](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.83.0...@jobber/components@2.83.1) (2022-06-03)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **deps:** update markdown to v6.0.3 ([#896](https://github.com/GetJobber/atlantis/issues/896)) ([93b36de](https://github.com/GetJobber/atlantis/commit/93b36de87bc8a5184eb794c7dce46d7e8f47dbfd))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [2.83.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.82.1...@jobber/components@2.83.0) (2022-05-04)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **components:** update icon colors [JOB-44183] ([#884](https://github.com/GetJobber/atlantis/issues/884)) ([9a8e850](https://github.com/GetJobber/atlantis/commit/9a8e8507d0f6cb594be9358f7d05bdb87f8181b9))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
11
44
|
## [2.82.1](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.82.0...@jobber/components@2.82.1) (2022-05-02)
|
|
12
45
|
|
|
13
46
|
**Note:** Version bump only for package @jobber/components
|
|
@@ -37,12 +37,24 @@ export interface UploadParams {
|
|
|
37
37
|
*/
|
|
38
38
|
readonly key?: string;
|
|
39
39
|
/**
|
|
40
|
-
* Any extra fields to send with the upload
|
|
40
|
+
* Any extra fields or headers to send with the upload.
|
|
41
41
|
* If unspecified only the file will be included.
|
|
42
42
|
*/
|
|
43
43
|
readonly fields?: {
|
|
44
44
|
[field: string]: string;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* The HTTP method which we wish to use for the upload
|
|
48
|
+
*
|
|
49
|
+
* When the HTTP method is `"PUT"`, the `fields` will
|
|
50
|
+
* be used as headers for the request
|
|
51
|
+
*
|
|
52
|
+
* When the HTTP method is `"POST"` the `fields` are
|
|
53
|
+
* form fields
|
|
54
|
+
*
|
|
55
|
+
* @default "POST"
|
|
56
|
+
*/
|
|
57
|
+
readonly httpMethod?: "POST" | "PUT";
|
|
46
58
|
}
|
|
47
59
|
interface InputFileProps {
|
|
48
60
|
/**
|
package/dist/InputFile/index.js
CHANGED
|
@@ -55,37 +55,61 @@ function InputFile(_a) {
|
|
|
55
55
|
}
|
|
56
56
|
function uploadFile(file) {
|
|
57
57
|
return __chunk_1.__awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var _a, url, _b, key, _c, fields, fileUpload,
|
|
59
|
-
return __chunk_1.__generator(this, function (
|
|
60
|
-
switch (
|
|
58
|
+
var _a, url, _b, key, _c, fields, _d, httpMethod, fileUpload, handleUploadProgress, handleUploadComplete, axiosConfig;
|
|
59
|
+
return __chunk_1.__generator(this, function (_e) {
|
|
60
|
+
switch (_e.label) {
|
|
61
61
|
case 0: return [4 /*yield*/, getUploadParams(file)];
|
|
62
62
|
case 1:
|
|
63
|
-
_a =
|
|
63
|
+
_a = _e.sent(), url = _a.url, _b = _a.key, key = _b === void 0 ? uuid.v1() : _b, _c = _a.fields, fields = _c === void 0 ? {} : _c, _d = _a.httpMethod, httpMethod = _d === void 0 ? "POST" : _d;
|
|
64
64
|
fileUpload = getFileUpload(file, key);
|
|
65
65
|
onUploadStart && onUploadStart(__chunk_1.__assign({}, fileUpload));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
})
|
|
80
|
-
.then(function () {
|
|
81
|
-
onUploadComplete && onUploadComplete(__chunk_1.__assign(__chunk_1.__assign({}, fileUpload), { progress: 1 }));
|
|
66
|
+
handleUploadProgress = function (progressEvent) {
|
|
67
|
+
onUploadProgress &&
|
|
68
|
+
onUploadProgress(__chunk_1.__assign(__chunk_1.__assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
|
|
69
|
+
};
|
|
70
|
+
handleUploadComplete = function () {
|
|
71
|
+
onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(__chunk_1.__assign(__chunk_1.__assign({}, fileUpload), { progress: 1 }));
|
|
72
|
+
};
|
|
73
|
+
axiosConfig = createAxiosConfig({
|
|
74
|
+
url: url,
|
|
75
|
+
httpMethod: httpMethod,
|
|
76
|
+
fields: fields,
|
|
77
|
+
file: file,
|
|
78
|
+
handleUploadProgress: handleUploadProgress,
|
|
82
79
|
});
|
|
80
|
+
axios.request(axiosConfig).then(handleUploadComplete);
|
|
83
81
|
return [2 /*return*/];
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
84
|
});
|
|
87
85
|
}
|
|
88
86
|
}
|
|
87
|
+
function createAxiosConfig(_a) {
|
|
88
|
+
var url = _a.url, _b = _a.httpMethod, httpMethod = _b === void 0 ? "POST" : _b, _c = _a.fields, fields = _c === void 0 ? {} : _c, file = _a.file, handleUploadProgress = _a.handleUploadProgress;
|
|
89
|
+
var data;
|
|
90
|
+
var headers;
|
|
91
|
+
if (httpMethod === "POST") {
|
|
92
|
+
var formData_1 = new FormData();
|
|
93
|
+
Object.entries(fields).forEach(function (_a) {
|
|
94
|
+
var _b = __chunk_1.__read(_a, 2), field = _b[0], value = _b[1];
|
|
95
|
+
return formData_1.append(field, value);
|
|
96
|
+
});
|
|
97
|
+
formData_1.append("file", file);
|
|
98
|
+
data = formData_1;
|
|
99
|
+
headers = { "X-Requested-With": "XMLHttpRequest" };
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
data = file;
|
|
103
|
+
headers = fields;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
method: httpMethod,
|
|
107
|
+
url: url,
|
|
108
|
+
headers: headers,
|
|
109
|
+
data: data,
|
|
110
|
+
onUploadProgress: handleUploadProgress,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
89
113
|
function getLabels(providedButtonLabel, multiple, allowedTypes) {
|
|
90
114
|
var buttonLabel = multiple ? "Upload Files" : "Upload File";
|
|
91
115
|
var hintText = multiple
|
package/dist/Markdown/index.js
CHANGED
|
@@ -19,49 +19,53 @@ var index$4 = require('../Emphasis/index.js');
|
|
|
19
19
|
function Markdown(_a) {
|
|
20
20
|
var content = _a.content, externalLink = _a.externalLink, basicUsage = _a.basicUsage;
|
|
21
21
|
var props = __chunk_1.__assign({}, (basicUsage && {
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
22
|
+
disallowedElements: [
|
|
23
|
+
"p",
|
|
24
|
+
"h1",
|
|
25
|
+
"h2",
|
|
26
|
+
"h3",
|
|
27
|
+
"h4",
|
|
28
|
+
"h5",
|
|
29
|
+
"h6",
|
|
25
30
|
"table",
|
|
26
|
-
"
|
|
31
|
+
"ul",
|
|
32
|
+
"li",
|
|
27
33
|
"code",
|
|
28
34
|
"image",
|
|
29
35
|
],
|
|
30
36
|
unwrapDisallowed: true,
|
|
31
37
|
}));
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
var Tag = basicUsage ? React__default.Fragment : index$2.Content;
|
|
39
|
+
return (React__default.createElement(Tag, null,
|
|
40
|
+
React__default.createElement(ReactMarkdown, __chunk_1.__assign({}, props, { linkTarget: externalLink ? "_blank" : undefined, components: {
|
|
41
|
+
p: renderParagraph,
|
|
42
|
+
strong: renderStrong,
|
|
43
|
+
em: renderEmphasis,
|
|
44
|
+
h1: renderHeading(1),
|
|
45
|
+
h2: renderHeading(2),
|
|
46
|
+
h3: renderHeading(3),
|
|
47
|
+
h4: renderHeading(4),
|
|
48
|
+
h5: renderHeading(5),
|
|
49
|
+
} }), content)));
|
|
50
|
+
}
|
|
51
|
+
function renderParagraph(_a) {
|
|
52
|
+
var children = _a.children;
|
|
53
|
+
return React__default.createElement(index$1.Text, null, children);
|
|
54
|
+
}
|
|
55
|
+
function renderStrong(_a) {
|
|
56
|
+
var children = _a.children;
|
|
57
|
+
return React__default.createElement(index$4.Emphasis, { variation: "bold" }, children);
|
|
58
|
+
}
|
|
59
|
+
function renderEmphasis(_a) {
|
|
60
|
+
var children = _a.children;
|
|
61
|
+
return React__default.createElement(index$4.Emphasis, { variation: "italic" }, children);
|
|
62
|
+
}
|
|
63
|
+
function renderHeading(level) {
|
|
64
|
+
function buildHeading(_a) {
|
|
40
65
|
var children = _a.children;
|
|
41
|
-
if (basicUsage) {
|
|
42
|
-
return React__default.createElement(React__default.Fragment, null, children);
|
|
43
|
-
}
|
|
44
|
-
return React__default.createElement(index$2.Content, null, children);
|
|
45
|
-
}
|
|
46
|
-
function renderParagraph(_a) {
|
|
47
|
-
var children = _a.children;
|
|
48
|
-
return React__default.createElement(index$1.Text, null, children);
|
|
49
|
-
}
|
|
50
|
-
function renderEmphasis(_a) {
|
|
51
|
-
var children = _a.children;
|
|
52
|
-
return React__default.createElement(index$4.Emphasis, { variation: "italic" }, children);
|
|
53
|
-
}
|
|
54
|
-
function renderStrong(_a) {
|
|
55
|
-
var children = _a.children;
|
|
56
|
-
return React__default.createElement(index$4.Emphasis, { variation: "bold" }, children);
|
|
57
|
-
}
|
|
58
|
-
function renderHeading(_a) {
|
|
59
|
-
var level = _a.level, children = _a.children;
|
|
60
|
-
if (level === 6) {
|
|
61
|
-
return React__default.createElement("h6", null, children);
|
|
62
|
-
}
|
|
63
66
|
return React__default.createElement(index$3.Heading, { level: level }, children);
|
|
64
67
|
}
|
|
68
|
+
return buildHeading;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
exports.Markdown = Markdown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.84.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dist/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@jobber/design": "^0.
|
|
20
|
+
"@jobber/design": "^0.25.0",
|
|
21
21
|
"@jobber/formatters": "^0.2.0",
|
|
22
22
|
"@jobber/hooks": "^1.11.0",
|
|
23
23
|
"@popperjs/core": "^2.0.6",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dropzone": "^11.0.2",
|
|
40
40
|
"react-hook-form": "^6.7.2",
|
|
41
41
|
"react-image-lightbox": "^5.1.1",
|
|
42
|
-
"react-markdown": "^
|
|
42
|
+
"react-markdown": "^6.0.3",
|
|
43
43
|
"react-popper": "^2.2.5",
|
|
44
44
|
"react-router-dom": "^5.2.0",
|
|
45
45
|
"time-input-polyfill": "^1.0.7",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"> 1%",
|
|
86
86
|
"IE 10"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "6fe2d488b07f4404331479c697cf67c955e6365f"
|
|
89
89
|
}
|