@jobber/components 4.4.2 → 4.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Button/Button.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface ButtonFoundationProps {
|
|
|
11
11
|
readonly ariaHaspopup?: boolean;
|
|
12
12
|
readonly ariaExpanded?: boolean;
|
|
13
13
|
readonly disabled?: boolean;
|
|
14
|
+
readonly external?: boolean;
|
|
14
15
|
readonly fullWidth?: boolean;
|
|
15
16
|
readonly icon?: IconNames;
|
|
16
17
|
readonly iconOnRight?: boolean;
|
|
@@ -18,48 +19,46 @@ interface ButtonFoundationProps {
|
|
|
18
19
|
readonly label?: string;
|
|
19
20
|
readonly loading?: boolean;
|
|
20
21
|
readonly size?: "small" | "base" | "large";
|
|
22
|
+
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
21
23
|
onMouseDown?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
22
24
|
}
|
|
23
|
-
interface ButtonIconProps {
|
|
25
|
+
interface ButtonIconProps extends ButtonFoundationProps {
|
|
24
26
|
readonly icon: IconNames;
|
|
25
27
|
readonly ariaLabel: string;
|
|
26
28
|
}
|
|
27
29
|
interface ButtonLabelProps extends ButtonFoundationProps {
|
|
28
30
|
readonly label: string;
|
|
29
31
|
}
|
|
30
|
-
interface
|
|
31
|
-
readonly variation?: "work" | "learning" | "subtle" | "destructive";
|
|
32
|
-
readonly type?: "primary" | "secondary" | "tertiary";
|
|
33
|
-
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
34
|
-
}
|
|
35
|
-
interface ButtonAnchorProps extends BaseActionProps {
|
|
32
|
+
interface ButtonAnchorProps extends ButtonFoundationProps {
|
|
36
33
|
/**
|
|
37
34
|
* Used to create an 'href' on an anchor tag.
|
|
38
35
|
*/
|
|
39
36
|
readonly url?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Used to open a new tab instead of change the location of the current tab
|
|
42
|
-
*/
|
|
43
|
-
readonly external?: boolean;
|
|
44
37
|
}
|
|
45
|
-
interface ButtonLinkProps extends
|
|
38
|
+
interface ButtonLinkProps extends ButtonFoundationProps {
|
|
46
39
|
/**
|
|
47
40
|
* Used for client side routing. Only use when inside a routed component.
|
|
48
41
|
*/
|
|
49
42
|
readonly to?: string;
|
|
50
43
|
}
|
|
51
|
-
interface
|
|
44
|
+
interface BaseActionProps extends ButtonFoundationProps {
|
|
45
|
+
readonly variation?: "work" | "learning" | "subtle" | "destructive";
|
|
46
|
+
readonly type?: "primary" | "secondary" | "tertiary";
|
|
47
|
+
}
|
|
48
|
+
interface DestructiveActionProps extends ButtonFoundationProps {
|
|
49
|
+
readonly variation: "destructive";
|
|
50
|
+
readonly type?: "primary" | "secondary" | "tertiary";
|
|
51
|
+
}
|
|
52
|
+
interface SubmitActionProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
53
|
+
readonly type?: "primary";
|
|
54
|
+
readonly submit: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface SubmitButtonProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
52
57
|
/**
|
|
53
58
|
* Allows the button to submit a form
|
|
54
59
|
*/
|
|
55
|
-
submit:
|
|
56
|
-
readonly type?: "primary";
|
|
57
|
-
readonly variation?: Extract<BaseActionProps["variation"], "work" | "destructive">;
|
|
60
|
+
submit: boolean;
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
type ButtonFunctionality = XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>>;
|
|
61
|
-
/**This type ensures the button is identifiable to users*/
|
|
62
|
-
type ButtonIdentification = XOR<ButtonIconProps, ButtonLabelProps>;
|
|
63
|
-
export type ButtonProps = ButtonFoundationProps & ButtonFunctionality & ButtonIdentification;
|
|
62
|
+
export type ButtonProps = XOR<BaseActionProps, XOR<DestructiveActionProps, SubmitActionProps>> & XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>> & XOR<ButtonIconProps, ButtonLabelProps>;
|
|
64
63
|
export declare function Button(props: ButtonProps): JSX.Element;
|
|
65
64
|
export {};
|
|
@@ -6,7 +6,7 @@ var tslib_es6 = require('../tslib.es6-5b8768b7.js');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
8
8
|
var Avatar = require('../Avatar-98b59e17.js');
|
|
9
|
-
var InputFile = require('../InputFile-
|
|
9
|
+
var InputFile = require('../InputFile-33d7d2fb.js');
|
|
10
10
|
var ProgressBar = require('../ProgressBar-8438dd4c.js');
|
|
11
11
|
var Button = require('../Button-e2452625.js');
|
|
12
12
|
require('classnames');
|
package/dist/InputFile/index.js
CHANGED
|
@@ -52,7 +52,7 @@ function InputFile({ variation = "dropzone", size = "base", buttonLabel: provide
|
|
|
52
52
|
function uploadFile(file) {
|
|
53
53
|
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
const { url, key = uuid.v1(), fields = {}, httpMethod = "POST", } = yield getUploadParams(file);
|
|
55
|
-
const fileUpload =
|
|
55
|
+
const fileUpload = getFileUpload(file, key, url);
|
|
56
56
|
onUploadStart && onUploadStart(Object.assign({}, fileUpload));
|
|
57
57
|
const handleUploadProgress = (progressEvent) => {
|
|
58
58
|
onUploadProgress &&
|
|
@@ -109,7 +109,7 @@ function getLabels(providedButtonLabel, multiple, allowedTypes) {
|
|
|
109
109
|
buttonLabel = providedButtonLabel;
|
|
110
110
|
return { buttonLabel, hintText };
|
|
111
111
|
}
|
|
112
|
-
function getFileUpload(file, key) {
|
|
112
|
+
function getFileUpload(file, key, uploadUrl) {
|
|
113
113
|
return {
|
|
114
114
|
key: key,
|
|
115
115
|
name: file.name,
|
|
@@ -117,6 +117,7 @@ function getFileUpload(file, key) {
|
|
|
117
117
|
size: file.size,
|
|
118
118
|
progress: 0,
|
|
119
119
|
src: getSrc,
|
|
120
|
+
uploadUrl,
|
|
120
121
|
};
|
|
121
122
|
function getSrc() {
|
|
122
123
|
const promise = new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"> 1%",
|
|
82
82
|
"IE 10"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "20acbaa4df15d6dcf541c9dab3211b4f91072d08"
|
|
85
85
|
}
|