@jobber/components 4.1.0 → 4.1.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/dist/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/Autocomplete/Option.d.ts +2 -2
- package/dist/Autocomplete/index.js +51 -67
- package/dist/Avatar/Avatar.d.ts +2 -2
- package/dist/Avatar/index.js +2 -2
- package/dist/{Avatar-cfd04e86.js → Avatar-89cfd0a6.js} +14 -18
- package/dist/Banner/Banner.d.ts +1 -1
- package/dist/Banner/index.js +15 -19
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/index.js +3 -4
- package/dist/{Button-cd30df0f.js → Button-16e043ec.js} +21 -24
- package/dist/ButtonDismiss/index.js +4 -5
- package/dist/{ButtonDismiss-a9590195.js → ButtonDismiss-3fb1eaf9.js} +2 -3
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/index.js +6 -7
- package/dist/Card/types.d.ts +1 -1
- package/dist/{Card-b9f8d6f3.js → Card-edab9c3c.js} +18 -22
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/Checkbox/index.js +4 -5
- package/dist/{Checkbox-5103d2b9.js → Checkbox-c1efc2f6.js} +10 -12
- package/dist/Chips/ChipsTypes.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +3 -3
- package/dist/Chips/InternalChipMultiSelect.d.ts +1 -1
- package/dist/Chips/InternalChipSingleSelect.d.ts +1 -1
- package/dist/Chips/index.js +165 -185
- package/dist/ConfirmationModal/ConfirmationModal.d.ts +1 -1
- package/dist/ConfirmationModal/index.js +11 -12
- package/dist/{ConfirmationModal-e95f46d7.js → ConfirmationModal-6a7beee2.js} +28 -31
- package/dist/Content/index.js +1 -1
- package/dist/{Content-18de5fbb.js → Content-05df8f7f.js} +2 -3
- package/dist/Countdown/Countdown.d.ts +1 -1
- package/dist/Countdown/computeTimeUnit.d.ts +1 -1
- package/dist/Countdown/index.js +15 -18
- package/dist/DataDump/index.js +9 -11
- package/dist/DataTable/Footer.d.ts +1 -1
- package/dist/DataTable/createTableSettings.d.ts +2 -2
- package/dist/DataTable/index.js +74 -106
- package/dist/DataTable/test-utilities/helpers.d.ts +1 -1
- package/dist/DataTable/types.d.ts +2 -2
- package/dist/DatePicker/DatePicker.d.ts +1 -1
- package/dist/DatePicker/index.js +4 -5
- package/dist/{DatePicker-cf813028.js → DatePicker-0696b0f0.js} +31 -36
- package/dist/DescriptionList/index.js +5 -10
- package/dist/Disclosure/index.js +8 -10
- package/dist/Divider/index.js +8 -10
- package/dist/Drawer/index.js +10 -14
- package/dist/Emphasis/index.js +2 -3
- package/dist/{Emphasis-75a3f411.js → Emphasis-23dc2a0a.js} +4 -6
- package/dist/FeatureSwitch/index.js +15 -17
- package/dist/Form/index.js +23 -33
- package/dist/FormField/FormFieldTypes.d.ts +2 -2
- package/dist/FormField/index.js +8 -8
- package/dist/{FormField-ac310b6f.js → FormField-79a0a375.js} +68 -76
- package/dist/FormatDate/index.js +2 -3
- package/dist/FormatEmail/index.js +2 -3
- package/dist/FormatFile/index.js +13 -14
- package/dist/{FormatFile-18e8a54a.js → FormatFile-3512f838.js} +33 -40
- package/dist/FormatRelativeDateTime/index.js +5 -6
- package/dist/FormatTime/index.js +6 -7
- package/dist/Gallery/GalleryTypes.d.ts +2 -2
- package/dist/Gallery/index.js +31 -33
- package/dist/Heading/index.js +2 -3
- package/dist/{Heading-a9a66964.js → Heading-7b203f7f.js} +4 -6
- package/dist/Icon/index.js +1 -1
- package/dist/{Icon-d5ad1a6d.js → Icon-405a216c.js} +7 -8
- package/dist/InlineLabel/InlineLabel.d.ts +1 -1
- package/dist/InlineLabel/index.js +4 -6
- package/dist/InputAvatar/index.js +15 -20
- package/dist/InputDate/index.js +15 -15
- package/dist/InputEmail/InputEmail.d.ts +1 -1
- package/dist/InputEmail/index.js +12 -12
- package/dist/InputFile/index.js +6 -6
- package/dist/{InputFile-e108a7f8.js → InputFile-5e0ed2b5.js} +48 -62
- package/dist/InputGroup/index.js +4 -5
- package/dist/InputNumber/index.js +22 -22
- package/dist/InputPassword/index.js +12 -12
- package/dist/InputText/InputText.d.ts +1 -1
- package/dist/InputText/index.js +9 -9
- package/dist/{InputText-70f7d947.js → InputText-95ea24f9.js} +23 -24
- package/dist/InputTime/index.js +27 -27
- package/dist/InputValidation/index.js +4 -5
- package/dist/{InputValidation-06a8a7ba.js → InputValidation-97dd0dcf.js} +7 -8
- package/dist/LightBox/index.js +5 -6
- package/dist/{LightBox-1ad62669.js → LightBox-dd1afa97.js} +22 -26
- package/dist/List/index.js +26 -32
- package/dist/Markdown/index.js +6 -7
- package/dist/{Markdown-b53e0308.js → Markdown-be2dcd0c.js} +12 -18
- package/dist/Menu/index.js +4 -5
- package/dist/{Menu-826cfb89.js → Menu-d6a7d17b.js} +31 -36
- package/dist/Modal/index.js +6 -7
- package/dist/{Modal-cc3bd7bf.js → Modal-757e83fd.js} +13 -17
- package/dist/MultiSelect/index.js +53 -60
- package/dist/MultiSelect/types.d.ts +1 -1
- package/dist/{Option-7d5de76b.js → Option-4b665afd.js} +3 -5
- package/dist/Page/Page.d.ts +1 -1
- package/dist/Page/index.js +21 -24
- package/dist/Popover/index.js +11 -13
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-e9a49129.js → ProgressBar-f028b159.js} +3 -4
- package/dist/RadioGroup/RadioOption.d.ts +2 -2
- package/dist/RadioGroup/index.js +9 -13
- package/dist/RecurringSelect/types.d.ts +2 -2
- package/dist/Select/Select.d.ts +1 -1
- package/dist/Select/index.js +9 -9
- package/dist/Spinner/index.js +1 -1
- package/dist/{Spinner-e4e9c8eb.js → Spinner-ae4c8a85.js} +5 -7
- package/dist/StatusLabel/StatusLabel.d.ts +1 -1
- package/dist/StatusLabel/index.js +6 -9
- package/dist/Switch/index.js +2 -3
- package/dist/{Switch-f03b70fc.js → Switch-7ac32f7b.js} +12 -16
- package/dist/Table/index.js +9 -17
- package/dist/Tabs/index.js +28 -34
- package/dist/Text/index.js +2 -3
- package/dist/{Text-e012fb46.js → Text-7ce00adb.js} +4 -5
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/index.js +31 -32
- package/dist/Tooltip/index.js +3 -4
- package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
- package/dist/{Tooltip-041feb00.js → Tooltip-1090a43d.js} +25 -28
- package/dist/Typography/Typography.d.ts +1 -1
- package/dist/Typography/index.js +1 -2
- package/dist/{Typography-fbe0ed6e.js → Typography-9262511f.js} +5 -7
- package/dist/tslib.es6-efe27175.js +38 -0
- package/package.json +3 -3
- package/dist/tslib.es6-5b50eb8e.js +0 -103
package/dist/Drawer/index.js
CHANGED
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
var styleInject_es = require('../style-inject.es-dcee06b6.js');
|
|
8
|
-
var Heading = require('../Heading-
|
|
9
|
-
var ButtonDismiss = require('../ButtonDismiss-
|
|
10
|
-
require('../
|
|
11
|
-
require('../
|
|
12
|
-
require('../Button-cd30df0f.js');
|
|
8
|
+
var Heading = require('../Heading-7b203f7f.js');
|
|
9
|
+
var ButtonDismiss = require('../ButtonDismiss-3fb1eaf9.js');
|
|
10
|
+
require('../Typography-9262511f.js');
|
|
11
|
+
require('../Button-16e043ec.js');
|
|
13
12
|
require('react-router-dom');
|
|
14
|
-
require('../Icon-
|
|
13
|
+
require('../Icon-405a216c.js');
|
|
15
14
|
require('@jobber/design');
|
|
16
15
|
|
|
17
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -23,9 +22,8 @@ var css$1 = ":root {\n --drawer-width: calc(var(--space-base) * 17.5);\n --dra
|
|
|
23
22
|
var styles$1 = {"container":"_3XszLcqw8Bk5bbTId3P8ZV","drawer":"_2nsJzlCbORiq2Zp1r2Zfjq","open":"BVcThJJ-WMJCtzGk9CfUq","header":"_1ql7AVWGaU-1bl2yZegFqH","contentScroll":"axZAc8S3vSa8nFC4yMJaW","content":"_3MACAQEV8zhNH4_KtJ0DiM"};
|
|
24
23
|
styleInject_es.styleInject(css$1);
|
|
25
24
|
|
|
26
|
-
function Drawer(
|
|
27
|
-
|
|
28
|
-
var drawerClassNames = classnames__default["default"](styles$1.container, open && styles$1.open);
|
|
25
|
+
function Drawer({ title, children, open = true, onRequestClose, id, }) {
|
|
26
|
+
const drawerClassNames = classnames__default["default"](styles$1.container, open && styles$1.open);
|
|
29
27
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
30
28
|
React__default["default"].createElement("aside", { className: drawerClassNames, "data-testid": "drawer-container", "aria-label": title, "aria-hidden": !open, id: id },
|
|
31
29
|
React__default["default"].createElement("div", { className: styles$1.drawer },
|
|
@@ -33,19 +31,17 @@ function Drawer(_a) {
|
|
|
33
31
|
React__default["default"].createElement("div", { className: styles$1.contentScroll },
|
|
34
32
|
React__default["default"].createElement("div", { className: styles$1.content }, children))))));
|
|
35
33
|
}
|
|
36
|
-
function Header(
|
|
37
|
-
var title = _a.title, onRequestClose = _a.onRequestClose;
|
|
34
|
+
function Header({ title, onRequestClose }) {
|
|
38
35
|
return (React__default["default"].createElement("div", { className: styles$1.header, "data-testid": "drawer-header" },
|
|
39
36
|
React__default["default"].createElement(Heading.Heading, { level: 3 }, title),
|
|
40
|
-
React__default["default"].createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel:
|
|
37
|
+
React__default["default"].createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: `Close ${title || "drawer"}` })));
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
var css = ".Sc90BtF67zpsMHXh3g9kq {\n display: grid;\n width: 100%;\n height: 100%;\n overflow: hidden;\n grid-template-columns: minmax(0, 1fr) minmax(-webkit-min-content, -webkit-max-content);\n grid-template-columns: minmax(0, 1fr) minmax(min-content, max-content);\n grid-template-rows: 1fr;\n}\n";
|
|
44
41
|
var styles = {"drawerGrid":"Sc90BtF67zpsMHXh3g9kq"};
|
|
45
42
|
styleInject_es.styleInject(css);
|
|
46
43
|
|
|
47
|
-
function DrawerGrid(
|
|
48
|
-
var children = _a.children;
|
|
44
|
+
function DrawerGrid({ children }) {
|
|
49
45
|
return React__default["default"].createElement("div", { className: styles.drawerGrid }, children);
|
|
50
46
|
}
|
|
51
47
|
|
package/dist/Emphasis/index.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Emphasis = require('../Emphasis-
|
|
6
|
-
require('../tslib.es6-5b50eb8e.js');
|
|
5
|
+
var Emphasis = require('../Emphasis-23dc2a0a.js');
|
|
7
6
|
require('react');
|
|
8
|
-
require('../Typography-
|
|
7
|
+
require('../Typography-9262511f.js');
|
|
9
8
|
require('classnames');
|
|
10
9
|
require('../style-inject.es-dcee06b6.js');
|
|
11
10
|
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
|
|
4
3
|
var React = require('react');
|
|
5
|
-
var Typography = require('./Typography-
|
|
4
|
+
var Typography = require('./Typography-9262511f.js');
|
|
6
5
|
|
|
7
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
7
|
|
|
9
8
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
|
|
11
|
-
function Emphasis(
|
|
12
|
-
|
|
13
|
-
var variationMap = {
|
|
10
|
+
function Emphasis({ variation, children }) {
|
|
11
|
+
const variationMap = {
|
|
14
12
|
bold: { element: "b", fontWeight: "bold" },
|
|
15
13
|
italic: { element: "em", emphasisType: "italic" },
|
|
16
14
|
highlight: { element: "strong", emphasisType: "highlight" },
|
|
17
15
|
};
|
|
18
|
-
return React__default["default"].createElement(Typography.Typography,
|
|
16
|
+
return React__default["default"].createElement(Typography.Typography, Object.assign({}, variationMap[variation]), children);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
exports.Emphasis = Emphasis;
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var framerMotion = require('framer-motion');
|
|
8
7
|
var classnames = require('classnames');
|
|
9
8
|
var styleInject_es = require('../style-inject.es-dcee06b6.js');
|
|
10
|
-
var Heading = require('../Heading-
|
|
11
|
-
var Text = require('../Text-
|
|
12
|
-
var Content = require('../Content-
|
|
13
|
-
var Switch = require('../Switch-
|
|
14
|
-
var Button = require('../Button-
|
|
15
|
-
var Emphasis = require('../Emphasis-
|
|
16
|
-
var Markdown = require('../Markdown-
|
|
17
|
-
require('../Typography-
|
|
9
|
+
var Heading = require('../Heading-7b203f7f.js');
|
|
10
|
+
var Text = require('../Text-7ce00adb.js');
|
|
11
|
+
var Content = require('../Content-05df8f7f.js');
|
|
12
|
+
var Switch = require('../Switch-7ac32f7b.js');
|
|
13
|
+
var Button = require('../Button-16e043ec.js');
|
|
14
|
+
var Emphasis = require('../Emphasis-23dc2a0a.js');
|
|
15
|
+
var Markdown = require('../Markdown-be2dcd0c.js');
|
|
16
|
+
require('../Typography-9262511f.js');
|
|
18
17
|
require('react-router-dom');
|
|
19
|
-
require('../Icon-
|
|
18
|
+
require('../Icon-405a216c.js');
|
|
20
19
|
require('@jobber/design');
|
|
21
20
|
require('react-markdown');
|
|
22
21
|
|
|
@@ -29,10 +28,9 @@ var css = "._2wLd_KRTNAGUWLuHUk3oW {\n display: -ms-flexbox;\n display: flex;\
|
|
|
29
28
|
var styles = {"container":"_2wLd_KRTNAGUWLuHUk3oW","content":"_3S4AEFcAzye_0NKuyb26Pt","action":"_3fTQ2YTOZjh3z63IpmHOEX","savedIndicator":"vVv_rOT7pURJPkU4rvJPE","featureContent":"f8zTHuP6EgBAklxGjSv1O","enabled":"NweVtD0555WFOwkVpskgX"};
|
|
30
29
|
styleInject_es.styleInject(css);
|
|
31
30
|
|
|
32
|
-
function FeatureSwitch(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var featureContentClassnames = classnames__default["default"](styles.featureContent, styles.content, enabled && styles.enabled);
|
|
31
|
+
function FeatureSwitch({ children, description, disabled = false, enabled, externalLink = false, onEdit, onSwitch, hasSaveIndicator = false, title, }) {
|
|
32
|
+
const [savedIndicator, setSavedIndicator] = React.useState(false);
|
|
33
|
+
const featureContentClassnames = classnames__default["default"](styles.featureContent, styles.content, enabled && styles.enabled);
|
|
36
34
|
shouldShowSavedIndicator();
|
|
37
35
|
return (React__default["default"].createElement(Content.Content, null,
|
|
38
36
|
React__default["default"].createElement("div", { className: styles.container },
|
|
@@ -57,9 +55,9 @@ function FeatureSwitch(_a) {
|
|
|
57
55
|
React__default["default"].createElement(Button.Button, { label: "Edit", type: "tertiary", onClick: onEdit })))))));
|
|
58
56
|
function shouldShowSavedIndicator() {
|
|
59
57
|
// Check if the component is mounted
|
|
60
|
-
|
|
61
|
-
React.useEffect(
|
|
62
|
-
React.useEffect(
|
|
58
|
+
const [didMount, setDidMount] = React.useState(false);
|
|
59
|
+
React.useEffect(() => setDidMount(true), []);
|
|
60
|
+
React.useEffect(() => {
|
|
63
61
|
didMount && hasSaveIndicator && setSavedIndicator(true);
|
|
64
62
|
}, [enabled]);
|
|
65
63
|
}
|
package/dist/Form/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../tslib.es6-
|
|
5
|
+
var tslib_es6 = require('../tslib.es6-efe27175.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactHookForm = require('react-hook-form');
|
|
8
8
|
|
|
@@ -10,55 +10,45 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
React.useEffect(function () { return onStateChange && onStateChange({ isDirty: isDirty, isValid: isValid }); }, [isDirty, isValid]);
|
|
19
|
-
React.useImperativeHandle(ref, function () { return ({
|
|
13
|
+
const Form = React.forwardRef(function InternalForm({ onSubmit, children, onStateChange }, ref) {
|
|
14
|
+
const methods = reactHookForm.useForm({ mode: "onTouched" });
|
|
15
|
+
const { errors, trigger, handleSubmit, formState: { isDirty, isValid }, } = methods;
|
|
16
|
+
React.useEffect(() => onStateChange && onStateChange({ isDirty, isValid }), [isDirty, isValid]);
|
|
17
|
+
React.useImperativeHandle(ref, () => ({
|
|
20
18
|
/**
|
|
21
19
|
* The `trigger()` method can also accept an array
|
|
22
20
|
* of fields to validate. We may at some point want
|
|
23
21
|
* to consider adding a `validate()` method to the
|
|
24
22
|
* `Form` component.
|
|
25
23
|
*/
|
|
26
|
-
submit:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
trigger();
|
|
38
|
-
errorHandler(errors);
|
|
39
|
-
}
|
|
40
|
-
return [2 /*return*/];
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}); },
|
|
44
|
-
}); });
|
|
24
|
+
submit: () => tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const valid = yield trigger();
|
|
26
|
+
if (valid) {
|
|
27
|
+
submitHandler();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
trigger();
|
|
31
|
+
errorHandler(errors);
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
}));
|
|
45
35
|
/**
|
|
46
36
|
* If an onSubmit is not passed into a form, it will only be used
|
|
47
37
|
* for validation. For that, we do not need to wrap it in a <form>
|
|
48
38
|
* tag. This allows the <Form> component to be used in legacy code.
|
|
49
39
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const Wrapper = onSubmit ? "form" : "div";
|
|
41
|
+
const formProps = {
|
|
52
42
|
onSubmit: onSubmit && handleSubmit(submitHandler, errorHandler),
|
|
53
43
|
};
|
|
54
|
-
return (React__default["default"].createElement(reactHookForm.FormProvider,
|
|
55
|
-
React__default["default"].createElement(Wrapper,
|
|
44
|
+
return (React__default["default"].createElement(reactHookForm.FormProvider, Object.assign({}, methods),
|
|
45
|
+
React__default["default"].createElement(Wrapper, Object.assign({}, formProps, { "data-testid": "atlantis-form" }), children)));
|
|
56
46
|
function submitHandler() {
|
|
57
47
|
onSubmit && onSubmit();
|
|
58
48
|
}
|
|
59
49
|
function errorHandler(errs) {
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
const firstErrName = Object.keys(errs)[0];
|
|
51
|
+
const element = document.querySelector(`[name="${firstErrName}"]`);
|
|
62
52
|
if (typeof element != undefined) {
|
|
63
53
|
element === null || element === void 0 ? void 0 : element.focus();
|
|
64
54
|
}
|
|
@@ -2,8 +2,8 @@ import { ChangeEvent, ReactNode, RefObject } from "react";
|
|
|
2
2
|
import { RegisterOptions } from "react-hook-form";
|
|
3
3
|
import { XOR } from "ts-xor";
|
|
4
4
|
import { IconNames } from "../Icon";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type FormFieldTypes = "text" | "password" | "number" | "time" | "textarea" | "select" | "email";
|
|
6
|
+
export type AutocompleteTypes = "one-time-code" | "address-line1" | "address-line2";
|
|
7
7
|
export interface FieldActionsRef {
|
|
8
8
|
setValue(value: string | number): void;
|
|
9
9
|
}
|
package/dist/FormField/index.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var FormField = require('../FormField-
|
|
6
|
-
require('../tslib.es6-
|
|
5
|
+
var FormField = require('../FormField-79a0a375.js');
|
|
6
|
+
require('../tslib.es6-efe27175.js');
|
|
7
7
|
require('react');
|
|
8
8
|
require('uuid');
|
|
9
9
|
require('react-hook-form');
|
|
10
10
|
require('../style-inject.es-dcee06b6.js');
|
|
11
11
|
require('classnames');
|
|
12
|
-
require('../Button-
|
|
12
|
+
require('../Button-16e043ec.js');
|
|
13
13
|
require('react-router-dom');
|
|
14
|
-
require('../Icon-
|
|
14
|
+
require('../Icon-405a216c.js');
|
|
15
15
|
require('@jobber/design');
|
|
16
|
-
require('../Typography-
|
|
17
|
-
require('../Text-
|
|
18
|
-
require('../InputValidation-
|
|
16
|
+
require('../Typography-9262511f.js');
|
|
17
|
+
require('../Text-7ce00adb.js');
|
|
18
|
+
require('../InputValidation-97dd0dcf.js');
|
|
19
19
|
require('framer-motion');
|
|
20
|
-
require('../Spinner-
|
|
20
|
+
require('../Spinner-ae4c8a85.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('./tslib.es6-
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-efe27175.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var uuid = require('uuid');
|
|
6
6
|
var reactHookForm = require('react-hook-form');
|
|
7
7
|
var styleInject_es = require('./style-inject.es-dcee06b6.js');
|
|
8
8
|
var classnames = require('classnames');
|
|
9
|
-
var Button = require('./Button-
|
|
10
|
-
var Icon = require('./Icon-
|
|
11
|
-
var Text = require('./Text-
|
|
12
|
-
var InputValidation = require('./InputValidation-
|
|
13
|
-
var Spinner = require('./Spinner-
|
|
9
|
+
var Button = require('./Button-16e043ec.js');
|
|
10
|
+
var Icon = require('./Icon-405a216c.js');
|
|
11
|
+
var Text = require('./Text-7ce00adb.js');
|
|
12
|
+
var InputValidation = require('./InputValidation-97dd0dcf.js');
|
|
13
|
+
var Spinner = require('./Spinner-ae4c8a85.js');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
16
|
|
|
@@ -21,22 +21,18 @@ var css = ":root {\n /**\n * These `--public-field` properties are used in ot
|
|
|
21
21
|
var styles = {"wrapper":"_2bOj_Hpd2VvA3mi9t4RcZO","miniLabel":"IVFKQabHAwX8Kn2aNj8gM","textarea":"_1hfSn_RRn6Enf7teCHrbV8","invalid":"_3H2M7GlXG4Qh417lRbpzS7","disabled":"_2xkImc45YUzsUp6bZ3Ik_4","small":"_2N7Ipv_CbNRzrdEGCrptrV","large":"_2RtHPlAJG3Hp2QD9Q9cfD_","inline-left":"_3AHR56Sam4H_gp9JyzxRLl","inline-right":"_3AHR56Sam4H_gp9JyzxRLl","inline":"_3AHR56Sam4H_gp9JyzxRLl","center":"_19KcCv1flBCB9mHUlTLkQL","right":"_1wVbgkkxLyHZUFsS-xEPlc","maxLength":"_1tABQjw4-IkgUE3cbBzs7r","inputWrapper":"_1WnxEaBZY0zLsD8oKwh20b","input":"_3koQsrzZZXPVxXmmESjSG_","select":"Ntcl388Qhhu4uLJc2d1Ll","label":"ktPFw5_r1v4MB-Ts5rPTG","postfix":"_1yJbSG5N0hfPjPkrih4Q99","affixIcon":"_1EBMzQ2qM74AhLWsJH_VD7","suffix":"_2k-tb4HuwDpSggx3JEm4Rp","hasAction":"_1Pm2Qo4Aw45IfKYq1qX4CW","affixLabel":"_2PE8Igv1VLxZ4mpQc6iiR4","description":"_1iN0xB6nTG687YOOopowf"};
|
|
22
22
|
styleInject_es.styleInject(css);
|
|
23
23
|
|
|
24
|
-
function AffixLabel(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_b[styles.suffix] = variation === "suffix",
|
|
29
|
-
_b));
|
|
24
|
+
function AffixLabel({ label, variation = "prefix", labelRef, }) {
|
|
25
|
+
const affixLabelClass = classnames__default["default"](styles.affixLabel, {
|
|
26
|
+
[styles.suffix]: variation === "suffix",
|
|
27
|
+
});
|
|
30
28
|
return (React__default["default"].createElement("div", { ref: labelRef, className: affixLabelClass }, label));
|
|
31
29
|
}
|
|
32
|
-
function AffixIcon(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_b));
|
|
39
|
-
var iconSize = size === "small" ? "small" : "base";
|
|
30
|
+
function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
31
|
+
const affixIconClass = classnames__default["default"](styles.affixIcon, {
|
|
32
|
+
[styles.suffix]: variation === "suffix",
|
|
33
|
+
[styles.hasAction]: onClick,
|
|
34
|
+
});
|
|
35
|
+
const iconSize = size === "small" ? "small" : "base";
|
|
40
36
|
if (!icon)
|
|
41
37
|
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
42
38
|
return (React__default["default"].createElement("div", { className: affixIconClass }, onClick ? (React__default["default"].createElement(Button.Button
|
|
@@ -52,123 +48,119 @@ function AffixIcon(_a) {
|
|
|
52
48
|
ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React__default["default"].createElement(Icon.Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
function FormFieldDescription(
|
|
56
|
-
var id = _a.id, description = _a.description;
|
|
51
|
+
function FormFieldDescription({ id, description, }) {
|
|
57
52
|
return (React__default["default"].createElement("div", { id: id, className: styles.description },
|
|
58
53
|
React__default["default"].createElement(Text.Text, { size: "small", variation: "subdued" }, description)));
|
|
59
54
|
}
|
|
60
55
|
|
|
61
|
-
function FormFieldWrapper(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var wrapperClasses = classnames__default["default"](styles.wrapper, size && styles[size], align && styles[align], (_b = {},
|
|
65
|
-
_b[styles.miniLabel] = (placeholder && value !== "") ||
|
|
56
|
+
function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, }) {
|
|
57
|
+
const wrapperClasses = classnames__default["default"](styles.wrapper, size && styles[size], align && styles[align], {
|
|
58
|
+
[styles.miniLabel]: (placeholder && value !== "") ||
|
|
66
59
|
(placeholder && type === "select") ||
|
|
67
60
|
(placeholder && type === "time"),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
[styles.textarea]: type === "textarea",
|
|
62
|
+
[styles.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
|
|
63
|
+
[styles.disabled]: disabled,
|
|
64
|
+
[styles.inline]: inline,
|
|
65
|
+
[styles.maxLength]: maxLength,
|
|
66
|
+
[styles.select]: type === "select",
|
|
67
|
+
});
|
|
68
|
+
const wrapperInlineStyle = {
|
|
69
|
+
["--formField-maxLength"]: maxLength || max,
|
|
70
|
+
};
|
|
71
|
+
const prefixRef = React.useRef();
|
|
72
|
+
const suffixRef = React.useRef();
|
|
73
|
+
const [labelStyle, setLabelStyle] = React.useState({
|
|
81
74
|
paddingLeft: undefined,
|
|
82
75
|
paddingRight: undefined,
|
|
83
|
-
})
|
|
84
|
-
React.useEffect(
|
|
76
|
+
});
|
|
77
|
+
React.useEffect(() => {
|
|
85
78
|
setLabelStyle(getAffixPaddding);
|
|
86
79
|
}, [value]);
|
|
87
80
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
88
81
|
React__default["default"].createElement("div", { className: wrapperClasses, style: wrapperInlineStyle },
|
|
89
|
-
(prefix === null || prefix === void 0 ? void 0 : prefix.icon) && React__default["default"].createElement(AffixIcon,
|
|
82
|
+
(prefix === null || prefix === void 0 ? void 0 : prefix.icon) && React__default["default"].createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
|
|
90
83
|
React__default["default"].createElement("div", { className: styles.inputWrapper },
|
|
91
84
|
React__default["default"].createElement("label", { className: styles.label, htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) ? labelStyle : undefined }, placeholder),
|
|
92
|
-
(prefix === null || prefix === void 0 ? void 0 : prefix.label) && React__default["default"].createElement(AffixLabel,
|
|
85
|
+
(prefix === null || prefix === void 0 ? void 0 : prefix.label) && React__default["default"].createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
|
|
93
86
|
children,
|
|
94
|
-
(suffix === null || suffix === void 0 ? void 0 : suffix.label) && (React__default["default"].createElement(AffixLabel,
|
|
95
|
-
(suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React__default["default"].createElement(AffixIcon,
|
|
87
|
+
(suffix === null || suffix === void 0 ? void 0 : suffix.label) && (React__default["default"].createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" })))),
|
|
88
|
+
(suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React__default["default"].createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size })))),
|
|
96
89
|
description && !inline && (React__default["default"].createElement(FormFieldDescription, { id: descriptionIdentifier, description: description })),
|
|
97
90
|
error && !inline && React__default["default"].createElement(InputValidation.InputValidation, { message: error })));
|
|
98
91
|
function getAffixPaddding() {
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
const hasValue = value !== "";
|
|
93
|
+
const newPadding = {
|
|
101
94
|
paddingLeft: undefined,
|
|
102
95
|
paddingRight: undefined,
|
|
103
96
|
};
|
|
104
97
|
if ((prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) && !hasValue) {
|
|
105
|
-
|
|
98
|
+
const { offsetWidth } = prefixRef.current;
|
|
106
99
|
newPadding.paddingLeft = offset(offsetWidth);
|
|
107
100
|
}
|
|
108
101
|
if ((suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) && !hasValue) {
|
|
109
|
-
|
|
102
|
+
const { offsetWidth } = suffixRef.current;
|
|
110
103
|
newPadding.paddingRight = offset(offsetWidth);
|
|
111
104
|
}
|
|
112
105
|
function offset(width) {
|
|
113
|
-
return
|
|
106
|
+
return `calc(${width}px + var(--space-smallest)`;
|
|
114
107
|
}
|
|
115
108
|
return newPadding;
|
|
116
109
|
}
|
|
117
110
|
}
|
|
118
111
|
|
|
119
|
-
function FormFieldPostFix(
|
|
120
|
-
var variation = _a.variation;
|
|
112
|
+
function FormFieldPostFix({ variation }) {
|
|
121
113
|
return (React__default["default"].createElement("span", { className: styles.postfix }, variation === "select" ? (React__default["default"].createElement(Icon.Icon, { name: "arrowDown" })) : (React__default["default"].createElement(Spinner.Spinner, { size: "small" }))));
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
function FormField(props) {
|
|
125
117
|
var _a;
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, inputRef, inline, keyboard, max, maxLength, min, name, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, } = props;
|
|
119
|
+
const { control, errors, setValue, watch } = reactHookForm.useFormContext() != undefined
|
|
128
120
|
? reactHookForm.useFormContext()
|
|
129
|
-
: reactHookForm.useForm({ mode: "onTouched" })
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
: reactHookForm.useForm({ mode: "onTouched" });
|
|
122
|
+
const [identifier] = React.useState(uuid.v1());
|
|
123
|
+
const [descriptionIdentifier] = React.useState(`descriptionUUID--${uuid.v1()}`);
|
|
132
124
|
/**
|
|
133
125
|
* Generate a name if one is not supplied, this is the name
|
|
134
126
|
* that will be used for react-hook-form and not neccessarily
|
|
135
127
|
* attached to the DOM
|
|
136
128
|
*/
|
|
137
|
-
|
|
138
|
-
React.useEffect(
|
|
129
|
+
const [controlledName] = React.useState(name ? name : `generatedName--${identifier}`);
|
|
130
|
+
React.useEffect(() => {
|
|
139
131
|
if (value != undefined) {
|
|
140
132
|
setValue(controlledName, value);
|
|
141
133
|
}
|
|
142
134
|
}, [value, watch(controlledName)]);
|
|
143
|
-
React.useImperativeHandle(actionsRef,
|
|
144
|
-
setValue:
|
|
135
|
+
React.useImperativeHandle(actionsRef, () => ({
|
|
136
|
+
setValue: newValue => {
|
|
145
137
|
setValue(controlledName, newValue);
|
|
146
138
|
},
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
React.useEffect(
|
|
150
|
-
return (React__default["default"].createElement(reactHookForm.Controller, { control: control, name: controlledName, rules:
|
|
151
|
-
var
|
|
152
|
-
|
|
139
|
+
}));
|
|
140
|
+
const error = errors[controlledName] && errors[controlledName].message;
|
|
141
|
+
React.useEffect(() => handleValidation(), [error]);
|
|
142
|
+
return (React__default["default"].createElement(reactHookForm.Controller, { control: control, name: controlledName, rules: Object.assign({}, validations), defaultValue: (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : "", render: (_a) => {
|
|
143
|
+
var { onChange: onControllerChange, onBlur: onControllerBlur, name: controllerName } = _a, rest = tslib_es6.__rest(_a, ["onChange", "onBlur", "name"]);
|
|
144
|
+
const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id: identifier, className: styles.input, name: (validations || name) && controllerName, disabled: disabled, readOnly: readonly, inputMode: keyboard, onChange: handleChange }), (description &&
|
|
153
145
|
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
154
|
-
|
|
155
|
-
return (React__default["default"].createElement(FormFieldWrapper,
|
|
146
|
+
const textFieldProps = Object.assign(Object.assign({}, fieldProps), { onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown });
|
|
147
|
+
return (React__default["default"].createElement(FormFieldWrapper, Object.assign({}, props, { value: rest.value, error: error, identifier: identifier, descriptionIdentifier: descriptionIdentifier }), renderField()));
|
|
156
148
|
function renderField() {
|
|
157
149
|
switch (type) {
|
|
158
150
|
case "select":
|
|
159
151
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
160
|
-
React__default["default"].createElement("select",
|
|
152
|
+
React__default["default"].createElement("select", Object.assign({}, fieldProps), children),
|
|
161
153
|
React__default["default"].createElement(FormFieldPostFix, { variation: "select" })));
|
|
162
154
|
case "textarea":
|
|
163
|
-
return (React__default["default"].createElement("textarea",
|
|
155
|
+
return (React__default["default"].createElement("textarea", Object.assign({}, textFieldProps, { rows: rows, ref: inputRef })));
|
|
164
156
|
default:
|
|
165
157
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
166
|
-
React__default["default"].createElement("input",
|
|
158
|
+
React__default["default"].createElement("input", Object.assign({}, textFieldProps, { autoComplete: setAutocomplete(autocomplete), type: type, maxLength: maxLength, max: max, min: min, ref: inputRef })),
|
|
167
159
|
loading && React__default["default"].createElement(FormFieldPostFix, { variation: "spinner" })));
|
|
168
160
|
}
|
|
169
161
|
}
|
|
170
162
|
function handleChange(event) {
|
|
171
|
-
|
|
163
|
+
let newValue;
|
|
172
164
|
newValue = event.currentTarget.value;
|
|
173
165
|
if (type === "number" && newValue.length > 0) {
|
|
174
166
|
newValue = parseFloat(newValue);
|
|
@@ -187,8 +179,8 @@ function FormField(props) {
|
|
|
187
179
|
onEnter && onEnter(event);
|
|
188
180
|
}
|
|
189
181
|
function handleFocus(event) {
|
|
190
|
-
|
|
191
|
-
setTimeout(
|
|
182
|
+
const target = event.currentTarget;
|
|
183
|
+
setTimeout(() => readonly && target.select());
|
|
192
184
|
onFocus && onFocus();
|
|
193
185
|
}
|
|
194
186
|
function handleBlur() {
|
package/dist/FormatDate/index.js
CHANGED
|
@@ -8,9 +8,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
function FormatDate(
|
|
12
|
-
|
|
13
|
-
var dateObject;
|
|
11
|
+
function FormatDate({ date: inputDate }) {
|
|
12
|
+
let dateObject;
|
|
14
13
|
if (inputDate instanceof Date) {
|
|
15
14
|
dateObject = inputDate;
|
|
16
15
|
}
|
|
@@ -15,9 +15,8 @@ var css = "._2WQ6E_TFQTKhlZCeQv65zh {\n font-style: normal;\n}\n";
|
|
|
15
15
|
var styles = {"email":"_2WQ6E_TFQTKhlZCeQv65zh"};
|
|
16
16
|
styleInject_es.styleInject(css);
|
|
17
17
|
|
|
18
|
-
function FormatEmail(
|
|
19
|
-
|
|
20
|
-
var className = classnames__default["default"](styles.email);
|
|
18
|
+
function FormatEmail({ email }) {
|
|
19
|
+
const className = classnames__default["default"](styles.email);
|
|
21
20
|
return React__default["default"].createElement("address", { className: className }, email);
|
|
22
21
|
}
|
|
23
22
|
|
package/dist/FormatFile/index.js
CHANGED
|
@@ -2,30 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var FormatFile = require('../FormatFile-
|
|
5
|
+
var FormatFile = require('../FormatFile-3512f838.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('filesize');
|
|
9
9
|
require('../style-inject.es-dcee06b6.js');
|
|
10
|
-
require('../
|
|
11
|
-
require('../Button-cd30df0f.js');
|
|
10
|
+
require('../Button-16e043ec.js');
|
|
12
11
|
require('react-router-dom');
|
|
13
|
-
require('../Icon-
|
|
12
|
+
require('../Icon-405a216c.js');
|
|
14
13
|
require('@jobber/design');
|
|
15
|
-
require('../Typography-
|
|
16
|
-
require('../ConfirmationModal-
|
|
14
|
+
require('../Typography-9262511f.js');
|
|
15
|
+
require('../ConfirmationModal-6a7beee2.js');
|
|
17
16
|
require('@jobber/hooks');
|
|
18
|
-
require('../Modal-
|
|
17
|
+
require('../Modal-757e83fd.js');
|
|
19
18
|
require('react-dom');
|
|
20
19
|
require('framer-motion');
|
|
21
|
-
require('../Heading-
|
|
22
|
-
require('../ButtonDismiss-
|
|
23
|
-
require('../Content-
|
|
24
|
-
require('../Markdown-
|
|
20
|
+
require('../Heading-7b203f7f.js');
|
|
21
|
+
require('../ButtonDismiss-3fb1eaf9.js');
|
|
22
|
+
require('../Content-05df8f7f.js');
|
|
23
|
+
require('../Markdown-be2dcd0c.js');
|
|
25
24
|
require('react-markdown');
|
|
26
|
-
require('../Text-
|
|
27
|
-
require('../Emphasis-
|
|
28
|
-
require('../ProgressBar-
|
|
25
|
+
require('../Text-7ce00adb.js');
|
|
26
|
+
require('../Emphasis-23dc2a0a.js');
|
|
27
|
+
require('../ProgressBar-f028b159.js');
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
|