@jobber/components 4.0.2 → 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 +10 -2
- package/dist/DatePicker/index.js +4 -5
- package/dist/{DatePicker-7c67e8d2.js → DatePicker-0696b0f0.js} +41 -38
- 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/InputGroup/index.js
CHANGED
|
@@ -15,18 +15,17 @@ var css = "._1UKIybTcnyfJQlTx901rF5 > *:not(:last-child) {\n margin-bottom: -1p
|
|
|
15
15
|
var styles = {"vertical":"_1UKIybTcnyfJQlTx901rF5","horizontal":"_26qQBed5Rzu9i2ZIDEaESr","inputGroup":"_3kywSyvvwSdmNSTOqX-AQA"};
|
|
16
16
|
styleInject_es.styleInject(css);
|
|
17
17
|
|
|
18
|
-
function InputGroup(
|
|
19
|
-
var children = _a.children, _b = _a.flowDirection, flowDirection = _b === void 0 ? "vertical" : _b;
|
|
18
|
+
function InputGroup({ children, flowDirection = "vertical", }) {
|
|
20
19
|
if (isInvalidGroupNesting(children))
|
|
21
20
|
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
22
|
-
|
|
21
|
+
const className = classnames__default["default"](styles.inputGroup, styles[flowDirection]);
|
|
23
22
|
return React__default["default"].createElement("div", { className: className }, children);
|
|
24
23
|
}
|
|
25
24
|
function isInvalidGroupNesting(childs) {
|
|
26
|
-
return React__default["default"].Children.toArray(childs).some(
|
|
25
|
+
return React__default["default"].Children.toArray(childs).some(child => {
|
|
27
26
|
if (child.type === InputGroup &&
|
|
28
27
|
child.props.flowDirection != "horizontal") {
|
|
29
|
-
console.error(
|
|
28
|
+
console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/components/input-group#nested-example`);
|
|
30
29
|
return true;
|
|
31
30
|
}
|
|
32
31
|
return false;
|
|
@@ -2,64 +2,64 @@
|
|
|
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
|
-
var FormField = require('../FormField-
|
|
6
|
+
var FormField = require('../FormField-79a0a375.js');
|
|
7
|
+
require('../tslib.es6-efe27175.js');
|
|
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
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
25
|
|
|
26
26
|
function InputNumberInternal(props, ref) {
|
|
27
|
-
|
|
28
|
-
React.useImperativeHandle(ref,
|
|
29
|
-
blur:
|
|
30
|
-
|
|
27
|
+
const inputRef = React.createRef();
|
|
28
|
+
React.useImperativeHandle(ref, () => ({
|
|
29
|
+
blur: () => {
|
|
30
|
+
const input = inputRef.current;
|
|
31
31
|
if (input) {
|
|
32
32
|
input.blur();
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
focus:
|
|
36
|
-
|
|
35
|
+
focus: () => {
|
|
36
|
+
const input = inputRef.current;
|
|
37
37
|
if (input) {
|
|
38
38
|
input.focus();
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
})
|
|
42
|
-
return (React__default["default"].createElement(FormField.FormField,
|
|
41
|
+
}));
|
|
42
|
+
return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: getOverLimitMessage }) })));
|
|
43
43
|
function handleChange(newValue) {
|
|
44
44
|
props.onChange && props.onChange(newValue);
|
|
45
45
|
}
|
|
46
46
|
function getOverLimitMessage(value) {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const isOverMax = props.max != undefined && value && value > props.max;
|
|
48
|
+
const isUnderMin = props.min != undefined && value && value < props.min;
|
|
49
49
|
if (isOverMax || isUnderMin || (value && value.toString() === "")) {
|
|
50
50
|
if (props.min != undefined && props.max === undefined) {
|
|
51
|
-
return
|
|
51
|
+
return `Enter a number that is greater than or equal to ${props.min}`;
|
|
52
52
|
}
|
|
53
53
|
else if (props.max != undefined && props.min === undefined) {
|
|
54
|
-
return
|
|
54
|
+
return `Enter a number that is less than or equal to ${props.max}`;
|
|
55
55
|
}
|
|
56
56
|
else if (props.min != undefined && props.max != undefined) {
|
|
57
|
-
return
|
|
57
|
+
return `Enter a number between ${props.min} and ${props.max}`;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
const InputNumber = React.forwardRef(InputNumberInternal);
|
|
64
64
|
|
|
65
65
|
exports.InputNumber = InputNumber;
|
|
@@ -2,35 +2,35 @@
|
|
|
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
|
-
var FormField = require('../FormField-
|
|
6
|
+
var FormField = require('../FormField-79a0a375.js');
|
|
7
|
+
require('../tslib.es6-efe27175.js');
|
|
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
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
25
|
|
|
26
26
|
function InputPassword(props) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (React__default["default"].createElement(FormField.FormField,
|
|
27
|
+
const { hasVisibility = false } = props;
|
|
28
|
+
const [visible, setVisibility] = React.useState(false);
|
|
29
|
+
return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, (hasVisibility && {
|
|
30
30
|
suffix: {
|
|
31
31
|
ariaLabel: visible ? "Hide password" : "Show password",
|
|
32
32
|
icon: visible ? "eye" : "eyeCrossed",
|
|
33
|
-
onClick:
|
|
33
|
+
onClick: () => setVisibility(!visible),
|
|
34
34
|
},
|
|
35
35
|
}), { type: visible ? "text" : "password", onChange: handleChange })));
|
|
36
36
|
function handleChange(newValue) {
|
|
@@ -25,5 +25,5 @@ interface MultilineProps extends BaseProps {
|
|
|
25
25
|
*/
|
|
26
26
|
readonly rows?: number | RowRange;
|
|
27
27
|
}
|
|
28
|
-
export declare const InputText: React.ForwardRefExoticComponent<(import("ts-xor/dist/types/Without.type").Without<BaseProps, MultilineProps> & MultilineProps
|
|
28
|
+
export declare const InputText: React.ForwardRefExoticComponent<((import("ts-xor/dist/types/Without.type").Without<BaseProps, MultilineProps> & MultilineProps) | (import("ts-xor/dist/types/Without.type").Without<MultilineProps, BaseProps> & BaseProps)) & React.RefAttributes<InputTextRef>>;
|
|
29
29
|
export {};
|
package/dist/InputText/index.js
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var InputText = require('../InputText-
|
|
6
|
-
require('../tslib.es6-5b50eb8e.js');
|
|
5
|
+
var InputText = require('../InputText-95ea24f9.js');
|
|
7
6
|
require('react');
|
|
8
|
-
require('../FormField-
|
|
7
|
+
require('../FormField-79a0a375.js');
|
|
8
|
+
require('../tslib.es6-efe27175.js');
|
|
9
9
|
require('uuid');
|
|
10
10
|
require('react-hook-form');
|
|
11
11
|
require('../style-inject.es-dcee06b6.js');
|
|
12
12
|
require('classnames');
|
|
13
|
-
require('../Button-
|
|
13
|
+
require('../Button-16e043ec.js');
|
|
14
14
|
require('react-router-dom');
|
|
15
|
-
require('../Icon-
|
|
15
|
+
require('../Icon-405a216c.js');
|
|
16
16
|
require('@jobber/design');
|
|
17
|
-
require('../Typography-
|
|
18
|
-
require('../Text-
|
|
19
|
-
require('../InputValidation-
|
|
17
|
+
require('../Typography-9262511f.js');
|
|
18
|
+
require('../Text-7ce00adb.js');
|
|
19
|
+
require('../InputValidation-97dd0dcf.js');
|
|
20
20
|
require('framer-motion');
|
|
21
|
-
require('../Spinner-
|
|
21
|
+
require('../Spinner-ae4c8a85.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
|
|
4
3
|
var React = require('react');
|
|
5
|
-
var FormField = require('./FormField-
|
|
4
|
+
var FormField = require('./FormField-79a0a375.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
10
|
function InputTextInternal(props, ref) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
React.useImperativeHandle(ref,
|
|
16
|
-
insert:
|
|
11
|
+
const inputRef = React.createRef();
|
|
12
|
+
const actionsRef = React.createRef();
|
|
13
|
+
const rowRange = getRowRange();
|
|
14
|
+
React.useImperativeHandle(ref, () => ({
|
|
15
|
+
insert: (text) => {
|
|
17
16
|
insertText(text);
|
|
18
17
|
},
|
|
19
|
-
blur:
|
|
20
|
-
|
|
18
|
+
blur: () => {
|
|
19
|
+
const input = inputRef.current;
|
|
21
20
|
if (input) {
|
|
22
21
|
input.blur();
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
|
-
focus:
|
|
26
|
-
|
|
24
|
+
focus: () => {
|
|
25
|
+
const input = inputRef.current;
|
|
27
26
|
if (input) {
|
|
28
27
|
input.focus();
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
|
-
})
|
|
32
|
-
return (React__default["default"].createElement(FormField.FormField,
|
|
30
|
+
}));
|
|
31
|
+
return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: props.multiline ? "textarea" : "text", inputRef: inputRef, actionsRef: actionsRef, onChange: handleChange, rows: rowRange.min })));
|
|
33
32
|
function handleChange(newValue) {
|
|
34
33
|
props.onChange && props.onChange(newValue);
|
|
35
34
|
if (inputRef && inputRef.current instanceof HTMLTextAreaElement) {
|
|
@@ -54,35 +53,35 @@ function InputTextInternal(props, ref) {
|
|
|
54
53
|
textArea.style.height = textAreaHeight(textArea) + "px";
|
|
55
54
|
}
|
|
56
55
|
function textAreaHeight(textArea) {
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const { lineHeight, borderBottomWidth, borderTopWidth, paddingBottom, paddingTop, } = window.getComputedStyle(textArea);
|
|
57
|
+
const maxHeight = rowRange.max * parseFloat(lineHeight) +
|
|
59
58
|
parseFloat(borderTopWidth) +
|
|
60
59
|
parseFloat(borderBottomWidth) +
|
|
61
60
|
parseFloat(paddingTop) +
|
|
62
61
|
parseFloat(paddingBottom);
|
|
63
|
-
|
|
62
|
+
const scrollHeight = textArea.scrollHeight +
|
|
64
63
|
parseFloat(borderTopWidth) +
|
|
65
64
|
parseFloat(borderBottomWidth);
|
|
66
65
|
return Math.min(scrollHeight, maxHeight);
|
|
67
66
|
}
|
|
68
67
|
function insertText(text) {
|
|
69
68
|
var _a;
|
|
70
|
-
|
|
69
|
+
const input = inputRef.current;
|
|
71
70
|
if (input) {
|
|
72
71
|
insertAtCursor(input, text);
|
|
73
|
-
|
|
72
|
+
const newValue = input.value;
|
|
74
73
|
(_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(newValue);
|
|
75
74
|
props.onChange && props.onChange(newValue);
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
const InputText = React.forwardRef(InputTextInternal);
|
|
80
79
|
function insertAtCursor(input, newText) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const start = input.selectionStart || 0;
|
|
81
|
+
const end = input.selectionEnd || 0;
|
|
82
|
+
const text = input.value;
|
|
83
|
+
const before = text.substring(0, start);
|
|
84
|
+
const after = text.substring(end, text.length);
|
|
86
85
|
input.value = before + newText + after;
|
|
87
86
|
input.selectionStart = input.selectionEnd = start + newText.length;
|
|
88
87
|
input.focus();
|
package/dist/InputTime/index.js
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
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 debounce = require('lodash/debounce');
|
|
8
8
|
var temporal = require('@std-proposal/temporal');
|
|
9
|
-
var FormField = require('../FormField-
|
|
9
|
+
var FormField = require('../FormField-79a0a375.js');
|
|
10
10
|
require('uuid');
|
|
11
11
|
require('react-hook-form');
|
|
12
12
|
require('../style-inject.es-dcee06b6.js');
|
|
13
13
|
require('classnames');
|
|
14
|
-
require('../Button-
|
|
14
|
+
require('../Button-16e043ec.js');
|
|
15
15
|
require('react-router-dom');
|
|
16
|
-
require('../Icon-
|
|
16
|
+
require('../Icon-405a216c.js');
|
|
17
17
|
require('@jobber/design');
|
|
18
|
-
require('../Typography-
|
|
19
|
-
require('../Text-
|
|
20
|
-
require('../InputValidation-
|
|
18
|
+
require('../Typography-9262511f.js');
|
|
19
|
+
require('../Text-7ce00adb.js');
|
|
20
|
+
require('../InputValidation-97dd0dcf.js');
|
|
21
21
|
require('framer-motion');
|
|
22
|
-
require('../Spinner-
|
|
22
|
+
require('../Spinner-ae4c8a85.js');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
25
|
|
|
@@ -884,7 +884,7 @@ function civilTimeToHTMLTime(civilTime) {
|
|
|
884
884
|
if (civilTime == undefined) {
|
|
885
885
|
return "";
|
|
886
886
|
}
|
|
887
|
-
|
|
887
|
+
const timeString = civilTime.toString();
|
|
888
888
|
return timeString.slice(0, 5);
|
|
889
889
|
}
|
|
890
890
|
function htmlTimeToCivilTime(timeString) {
|
|
@@ -897,13 +897,13 @@ function htmlTimeToCivilTime(timeString) {
|
|
|
897
897
|
}
|
|
898
898
|
|
|
899
899
|
function InputTimeSafari(_a) {
|
|
900
|
-
var
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
React.useLayoutEffect(
|
|
906
|
-
|
|
900
|
+
var { defaultValue, value, onChange } = _a, params = tslib_es6.__rest(_a, ["defaultValue", "value", "onChange"]);
|
|
901
|
+
const inputTime = React__default["default"].createRef();
|
|
902
|
+
const debouncedHandleChange = debounce__default["default"](handleChange, 1000);
|
|
903
|
+
const changeHandler = generateEventHandler(debouncedHandleChange);
|
|
904
|
+
const blurHandler = generateEventHandler(handleChange);
|
|
905
|
+
React.useLayoutEffect(() => {
|
|
906
|
+
const input = inputTime.current;
|
|
907
907
|
new TimePolyfill(input);
|
|
908
908
|
if (value) {
|
|
909
909
|
input.value = civilTimeToHTMLTime(value);
|
|
@@ -915,13 +915,13 @@ function InputTimeSafari(_a) {
|
|
|
915
915
|
}
|
|
916
916
|
input.addEventListener("change", changeHandler);
|
|
917
917
|
input.addEventListener("blur", blurHandler);
|
|
918
|
-
return
|
|
918
|
+
return () => {
|
|
919
919
|
window.removeEventListener("change", changeHandler);
|
|
920
920
|
window.removeEventListener("blur", blurHandler);
|
|
921
921
|
};
|
|
922
922
|
}, []);
|
|
923
|
-
React.useLayoutEffect(
|
|
924
|
-
|
|
923
|
+
React.useLayoutEffect(() => {
|
|
924
|
+
const input = inputTime.current;
|
|
925
925
|
if (value) {
|
|
926
926
|
input.value = civilTimeToHTMLTime(value);
|
|
927
927
|
input.polyfill.update();
|
|
@@ -931,13 +931,13 @@ function InputTimeSafari(_a) {
|
|
|
931
931
|
input.polyfill.update();
|
|
932
932
|
}
|
|
933
933
|
}, [value, defaultValue]);
|
|
934
|
-
return React__default["default"].createElement(FormField.FormField,
|
|
934
|
+
return React__default["default"].createElement(FormField.FormField, Object.assign({ inputRef: inputTime, type: "time" }, params));
|
|
935
935
|
function handleChange(newValue) {
|
|
936
936
|
onChange && onChange(htmlTimeToCivilTime(newValue));
|
|
937
937
|
}
|
|
938
938
|
function generateEventHandler(handler) {
|
|
939
|
-
return
|
|
940
|
-
|
|
939
|
+
return (event) => {
|
|
940
|
+
const newValue = event.currentTarget.dataset.value;
|
|
941
941
|
if (newValue != undefined) {
|
|
942
942
|
handler(newValue);
|
|
943
943
|
}
|
|
@@ -946,16 +946,16 @@ function InputTimeSafari(_a) {
|
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
function InputTime(_a) {
|
|
949
|
-
var
|
|
950
|
-
|
|
949
|
+
var { defaultValue, value, onChange } = _a, params = tslib_es6.__rest(_a, ["defaultValue", "value", "onChange"]);
|
|
950
|
+
const handleChange = (newValue) => {
|
|
951
951
|
onChange && onChange(htmlTimeToCivilTime(newValue));
|
|
952
952
|
};
|
|
953
953
|
if (supportsTime) {
|
|
954
|
-
|
|
955
|
-
return React__default["default"].createElement(FormField.FormField,
|
|
954
|
+
const fieldProps = Object.assign(Object.assign(Object.assign({ onChange: handleChange }, (defaultValue && { defaultValue: civilTimeToHTMLTime(defaultValue) })), (!defaultValue && { value: civilTimeToHTMLTime(value) })), params);
|
|
955
|
+
return React__default["default"].createElement(FormField.FormField, Object.assign({ type: "time" }, fieldProps));
|
|
956
956
|
}
|
|
957
957
|
else {
|
|
958
|
-
return (React__default["default"].createElement(InputTimeSafari,
|
|
958
|
+
return (React__default["default"].createElement(InputTimeSafari, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChange }, params)));
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var InputValidation = require('../InputValidation-
|
|
5
|
+
var InputValidation = require('../InputValidation-97dd0dcf.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('framer-motion');
|
|
8
8
|
require('../style-inject.es-dcee06b6.js');
|
|
9
|
-
require('../Text-
|
|
10
|
-
require('../Typography-
|
|
11
|
-
require('../tslib.es6-5b50eb8e.js');
|
|
9
|
+
require('../Text-7ce00adb.js');
|
|
10
|
+
require('../Typography-9262511f.js');
|
|
12
11
|
require('classnames');
|
|
13
|
-
require('../Icon-
|
|
12
|
+
require('../Icon-405a216c.js');
|
|
14
13
|
require('@jobber/design');
|
|
15
14
|
|
|
16
15
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var framerMotion = require('framer-motion');
|
|
5
5
|
var styleInject_es = require('./style-inject.es-dcee06b6.js');
|
|
6
|
-
var Text = require('./Text-
|
|
7
|
-
var Icon = require('./Icon-
|
|
6
|
+
var Text = require('./Text-7ce00adb.js');
|
|
7
|
+
var Icon = require('./Icon-405a216c.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
@@ -14,17 +14,16 @@ var css = "._9gFxrZogiKbS3gPLv_I79 {\n margin-top: var(--space-smaller);\n}\n\n
|
|
|
14
14
|
var styles = {"hasValidationMessage":"_9gFxrZogiKbS3gPLv_I79","message":"_3QUt88pIWZatkYLVYFlRuL"};
|
|
15
15
|
styleInject_es.styleInject(css);
|
|
16
16
|
|
|
17
|
-
function InputValidation(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var variants = {
|
|
17
|
+
function InputValidation({ message }) {
|
|
18
|
+
const messages = [message];
|
|
19
|
+
const variants = {
|
|
21
20
|
slideOut: { y: "5%", opacity: 0 },
|
|
22
21
|
slideIn: { y: 0, opacity: 1 },
|
|
23
22
|
};
|
|
24
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null, messages && messages.length > 0 && (React__default["default"].createElement(framerMotion.AnimatePresence, { exitBeforeEnter: true }, messages.map(
|
|
23
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, messages && messages.length > 0 && (React__default["default"].createElement(framerMotion.AnimatePresence, { exitBeforeEnter: true }, messages.map(msg => (React__default["default"].createElement(framerMotion.motion.div, { key: `validation-${msg}`, variants: variants, initial: "slideOut", animate: "slideIn", exit: "slideOut", transition: { duration: 0.2 } },
|
|
25
24
|
React__default["default"].createElement("div", { className: styles.message, "aria-live": "assertive", role: "alert", tabIndex: 0 },
|
|
26
25
|
React__default["default"].createElement(Icon.Icon, { name: "alert", size: "small", color: "critical" }),
|
|
27
|
-
React__default["default"].createElement(Text.Text, { size: "small", variation: "error" }, msg))))
|
|
26
|
+
React__default["default"].createElement(Text.Text, { size: "small", variation: "error" }, msg)))))))));
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
exports.InputValidation = InputValidation;
|
package/dist/LightBox/index.js
CHANGED
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var LightBox = require('../LightBox-
|
|
6
|
-
require('../tslib.es6-5b50eb8e.js');
|
|
5
|
+
var LightBox = require('../LightBox-dd1afa97.js');
|
|
7
6
|
require('react');
|
|
8
7
|
require('framer-motion');
|
|
9
8
|
require('react-dom');
|
|
10
9
|
require('lodash/debounce');
|
|
11
10
|
require('@jobber/hooks');
|
|
12
11
|
require('../style-inject.es-dcee06b6.js');
|
|
13
|
-
require('../ButtonDismiss-
|
|
14
|
-
require('../Button-
|
|
12
|
+
require('../ButtonDismiss-3fb1eaf9.js');
|
|
13
|
+
require('../Button-16e043ec.js');
|
|
15
14
|
require('classnames');
|
|
16
15
|
require('react-router-dom');
|
|
17
|
-
require('../Icon-
|
|
16
|
+
require('../Icon-405a216c.js');
|
|
18
17
|
require('@jobber/design');
|
|
19
|
-
require('../Typography-
|
|
18
|
+
require('../Typography-9262511f.js');
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
|
|
4
3
|
var React = require('react');
|
|
5
4
|
var framerMotion = require('framer-motion');
|
|
6
5
|
var ReactDOM = require('react-dom');
|
|
7
6
|
var debounce = require('lodash/debounce');
|
|
8
7
|
var jobberHooks = require('@jobber/hooks');
|
|
9
8
|
var styleInject_es = require('./style-inject.es-dcee06b6.js');
|
|
10
|
-
var ButtonDismiss = require('./ButtonDismiss-
|
|
11
|
-
var Button = require('./Button-
|
|
9
|
+
var ButtonDismiss = require('./ButtonDismiss-3fb1eaf9.js');
|
|
10
|
+
var Button = require('./Button-16e043ec.js');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
13
|
|
|
@@ -20,12 +19,13 @@ var css = "._2qgU3ylcPWUJGRthB18cb,\n._27gh3HPkx5J1Ru4Tqp_1tF {\n display: -ms-
|
|
|
20
19
|
var styles = {"next":"_2qgU3ylcPWUJGRthB18cb","prev":"_27gh3HPkx5J1Ru4Tqp_1tF","lightboxWrapper":"_3FuSx2b8rfxjzTQKeVn6MW","toolbar":"_2gGRj41uQJhcl0zcSNgsOA","title":"oyIA3-aR1Fvwn0lpp1Mgx","imagesWrapper":"_1PPDSsP7v3FAZG3DA--Oq3","overlay":"_23IH8HE3ZATpurQqLyWj-l","image":"_2UNyNw_u8HDWIzzxcSLUU6"};
|
|
21
20
|
styleInject_es.styleInject(css);
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/* eslint-disable max-statements */
|
|
23
|
+
const swipeConfidenceThreshold = 10000;
|
|
24
|
+
const swipePower = (offset, velocity) => {
|
|
25
25
|
return Math.abs(offset) * velocity;
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
enter:
|
|
27
|
+
const variants = {
|
|
28
|
+
enter: (direction) => {
|
|
29
29
|
return {
|
|
30
30
|
x: direction > 0 ? 1000 : -1000,
|
|
31
31
|
opacity: 0,
|
|
@@ -36,7 +36,7 @@ var variants = {
|
|
|
36
36
|
x: 0,
|
|
37
37
|
opacity: 1,
|
|
38
38
|
},
|
|
39
|
-
exit:
|
|
39
|
+
exit: (direction) => {
|
|
40
40
|
return {
|
|
41
41
|
zIndex: 0,
|
|
42
42
|
x: direction < 0 ? 1000 : -1000,
|
|
@@ -44,21 +44,20 @@ var variants = {
|
|
|
44
44
|
};
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const imageTransition = {
|
|
48
48
|
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
49
49
|
opacity: { duration: 0.2 },
|
|
50
50
|
};
|
|
51
51
|
// A little bit more than the transition's duration
|
|
52
52
|
// We're doing this to prevent a bug from framer-motion
|
|
53
53
|
// https://github.com/framer/motion/issues/1769
|
|
54
|
-
|
|
55
|
-
function LightBox(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var debouncedHandlePrevious = debounce__default["default"](handleMovePrevious, debounceDuration);
|
|
54
|
+
const debounceDuration = 250;
|
|
55
|
+
function LightBox({ open, images, imageIndex = 0, onRequestClose, }) {
|
|
56
|
+
const [currentImageIndex, setCurrentImageIndex] = React.useState(imageIndex);
|
|
57
|
+
const [direction, setDirection] = React.useState(0);
|
|
58
|
+
const lightboxRef = jobberHooks.useFocusTrap(open);
|
|
59
|
+
const debouncedHandleNext = debounce__default["default"](handleMoveNext, debounceDuration);
|
|
60
|
+
const debouncedHandlePrevious = debounce__default["default"](handleMovePrevious, debounceDuration);
|
|
62
61
|
jobberHooks.useRefocusOnActivator(open);
|
|
63
62
|
jobberHooks.useOnKeyDown(handleRequestClose, "Escape");
|
|
64
63
|
jobberHooks.useOnKeyDown(debouncedHandlePrevious, {
|
|
@@ -67,10 +66,10 @@ function LightBox(_a) {
|
|
|
67
66
|
jobberHooks.useOnKeyDown(debouncedHandleNext, {
|
|
68
67
|
key: "ArrowRight",
|
|
69
68
|
});
|
|
70
|
-
React.useEffect(
|
|
69
|
+
React.useEffect(() => {
|
|
71
70
|
setCurrentImageIndex(imageIndex);
|
|
72
71
|
}, [imageIndex, open]);
|
|
73
|
-
|
|
72
|
+
const template = (React__default["default"].createElement(React__default["default"].Fragment, null, open && (React__default["default"].createElement("div", { className: styles.lightboxWrapper, tabIndex: 0, "aria-label": "Lightbox", key: "Lightbox", ref: lightboxRef },
|
|
74
73
|
React__default["default"].createElement("div", { className: styles.toolbar },
|
|
75
74
|
React__default["default"].createElement("span", { className: styles.title }, images[currentImageIndex].title),
|
|
76
75
|
React__default["default"].createElement(ButtonDismiss.ButtonDismiss, { ariaLabel: "Close", onClick: handleRequestClose })),
|
|
@@ -94,9 +93,8 @@ function LightBox(_a) {
|
|
|
94
93
|
function handleRequestClose() {
|
|
95
94
|
onRequestClose({ lastPosition: currentImageIndex });
|
|
96
95
|
}
|
|
97
|
-
function handleOnDragEnd(event,
|
|
98
|
-
|
|
99
|
-
var swipe = swipePower(offset.x, velocity.x);
|
|
96
|
+
function handleOnDragEnd(event, { offset, velocity }) {
|
|
97
|
+
const swipe = swipePower(offset.x, velocity.x);
|
|
100
98
|
if (swipe < -swipeConfidenceThreshold) {
|
|
101
99
|
handleMoveNext();
|
|
102
100
|
}
|
|
@@ -105,13 +103,11 @@ function LightBox(_a) {
|
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
|
-
function PreviousButton(
|
|
109
|
-
var onClick = _a.onClick;
|
|
106
|
+
function PreviousButton({ onClick }) {
|
|
110
107
|
return (React__default["default"].createElement("div", { className: styles.prev },
|
|
111
108
|
React__default["default"].createElement(Button.Button, { size: "large", variation: "subtle", type: "secondary", icon: "arrowLeft", ariaLabel: "Previous image", onClick: onClick })));
|
|
112
109
|
}
|
|
113
|
-
function NextButton(
|
|
114
|
-
var onClick = _a.onClick;
|
|
110
|
+
function NextButton({ onClick }) {
|
|
115
111
|
return (React__default["default"].createElement("div", { className: styles.next },
|
|
116
112
|
React__default["default"].createElement(Button.Button, { size: "large", variation: "subtle", type: "secondary", icon: "arrowRight", ariaLabel: "Next image", onClick: onClick })));
|
|
117
113
|
}
|