@jobber/components 4.58.5 → 4.59.1-st-spike-w.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/dist/AnimatedSwitcher/index.js +5 -13
- package/dist/{AnimatedSwitcher-d1e1ddcf.js → AnimatedSwitcher-6ffd5003.js} +9 -15
- package/dist/Autocomplete/index.js +57 -68
- package/dist/Avatar/index.js +7 -15
- package/dist/{Avatar-1aa30ee1.js → Avatar-b2e862de.js} +13 -21
- package/dist/Banner/index.js +29 -38
- package/dist/Button/index.js +8 -16
- package/dist/{Button-db6114a6.js → Button-319d8fa0.js} +15 -22
- package/dist/ButtonDismiss/index.js +9 -17
- package/dist/ButtonDismiss-85986110.js +8 -0
- package/dist/Card/index.js +15 -23
- package/dist/{Card-116af709.js → Card-c1970a7c.js} +27 -34
- package/dist/Checkbox/index.js +11 -19
- package/dist/{Checkbox-bc4bc968.js → Checkbox-e4733fb4.js} +30 -37
- package/dist/Chip/index.js +24 -33
- package/dist/{Chip-4f12eec8.js → Chip-12a64c38.js} +94 -106
- package/dist/{Chip-f8b8fd89.js → Chip-40f5214c.js} +29 -37
- package/dist/Chips/index.js +25 -34
- package/dist/Combobox/Combobox.d.ts +3 -8
- package/dist/Combobox/Combobox.types.d.ts +71 -44
- package/dist/Combobox/ComboboxProvider.d.ts +12 -4
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -4
- package/dist/Combobox/components/ComboboxOption/ComboboxOption.d.ts +6 -2
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +2 -6
- package/dist/Combobox/components/ComboboxTrigger/index.d.ts +0 -2
- package/dist/Combobox/hooks/useCombobox.d.ts +15 -0
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +1 -1
- package/dist/Combobox/hooks/useComboboxContent.d.ts +1 -6
- package/dist/Combobox/hooks/useComboboxValidation.d.ts +11 -9
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +7 -0
- package/dist/Combobox/index.js +219 -247
- package/dist/ConfirmationModal/index.js +22 -30
- package/dist/{ConfirmationModal-285c3cbe.js → ConfirmationModal-86b42ca0.js} +14 -20
- package/dist/Content/index.js +4 -12
- package/dist/{Content-2ca1ffe1.js → Content-3354c281.js} +8 -14
- package/dist/Countdown/index.js +8 -17
- package/dist/DataDump/index.js +24 -32
- package/dist/DataList/index.js +256 -268
- package/dist/DataTable/index.js +92 -123
- package/dist/DatePicker/index.js +12 -20
- package/dist/{DatePicker-49213434.js → DatePicker-9f1e19a5.js} +30 -39
- package/dist/DescriptionList/index.js +9 -17
- package/dist/Disclosure/index.js +21 -29
- package/dist/Divider/index.js +7 -16
- package/dist/Drawer/index.js +24 -34
- package/dist/Emphasis/index.js +5 -13
- package/dist/Emphasis-edd2af9b.js +13 -0
- package/dist/FeatureSwitch/index.js +39 -48
- package/dist/Flex/index.js +6 -15
- package/dist/Form/index.js +11 -19
- package/dist/FormField/index.js +16 -24
- package/dist/{FormField-fa9254dc.js → FormField-99918ed4.js} +58 -65
- package/dist/FormatDate/index.js +2 -11
- package/dist/{FormatDate-70ea5b43.js → FormatDate-720b39cf.js} +3 -10
- package/dist/FormatEmail/index.js +7 -16
- package/dist/FormatFile/index.js +27 -35
- package/dist/{FormatFile-6423c3b5.js → FormatFile-e1498cb9.js} +44 -52
- package/dist/FormatRelativeDateTime/index.js +7 -15
- package/dist/FormatTime/index.js +3 -11
- package/dist/Gallery/index.js +40 -49
- package/dist/Glimmer/index.js +6 -15
- package/dist/{Glimmer-cfa92a88.js → Glimmer-d3be9219.js} +25 -33
- package/dist/Grid/index.js +14 -24
- package/dist/Heading/index.js +5 -13
- package/dist/{Heading-4cde9989.js → Heading-04994667.js} +4 -10
- package/dist/Icon/index.js +3 -11
- package/dist/Icon-22723fe6.js +34 -0
- package/dist/InlineLabel/index.js +5 -13
- package/dist/{InlineLabel-a24706c4.js → InlineLabel-4df86867.js} +9 -16
- package/dist/InputAvatar/index.js +32 -40
- package/dist/InputDate/index.js +26 -35
- package/dist/InputEmail/index.js +18 -27
- package/dist/InputFile/index.js +14 -23
- package/dist/{InputFile-25c3369b.js → InputFile-3bbaa09e.js} +24 -33
- package/dist/InputGroup/index.js +4 -12
- package/dist/{InputGroup-3fdde16b.js → InputGroup-1b4abd36.js} +9 -16
- package/dist/InputNumber/index.js +17 -25
- package/dist/{InputNumber-ea9fcee1.js → InputNumber-fa8132f3.js} +7 -13
- package/dist/InputPassword/index.js +19 -27
- package/dist/InputPhoneNumber/index.js +28 -36
- package/dist/InputText/index.js +17 -25
- package/dist/{InputText-ab237501.js → InputText-6d262128.js} +9 -15
- package/dist/InputTime/index.js +29 -38
- package/dist/InputValidation/index.js +9 -17
- package/dist/InputValidation-b6adff05.js +23 -0
- package/dist/LightBox/index.js +16 -24
- package/dist/LightBox-8c8f30b1.js +109 -0
- package/dist/Link/index.js +3 -11
- package/dist/List/index.js +47 -59
- package/dist/Markdown/index.js +10 -18
- package/dist/Markdown-2ec28e51.js +55 -0
- package/dist/Menu/index.js +13 -21
- package/dist/{Menu-2e64307a.js → Menu-10681184.js} +40 -47
- package/dist/Modal/index.js +16 -24
- package/dist/{Modal-c17cc105.js → Modal-06dc9551.js} +33 -41
- package/dist/MultiSelect/index.js +38 -47
- package/dist/Option-7967170c.js +12 -0
- package/dist/Page/index.js +48 -57
- package/dist/Popover/index.js +12 -20
- package/dist/{Popover-7c966790.js → Popover-a93db92d.js} +15 -21
- package/dist/ProgressBar/index.js +4 -12
- package/dist/{ProgressBar-5dfc1885.js → ProgressBar-04ee007d.js} +8 -15
- package/dist/RadioGroup/index.js +7 -16
- package/dist/{RadioGroup-9bdd8a59.js → RadioGroup-2ccd0678.js} +16 -23
- package/dist/RecurringSelect/index.js +90 -98
- package/dist/Select/index.js +17 -26
- package/dist/Spinner/index.js +4 -12
- package/dist/{Spinner-9d8fc7ff.js → Spinner-5d8359b8.js} +7 -14
- package/dist/StatusLabel/index.js +12 -21
- package/dist/Switch/index.js +5 -13
- package/dist/{Switch-cc9b645c.js → Switch-8bee06df.js} +17 -24
- package/dist/Table/index.js +19 -35
- package/dist/Tabs/index.js +23 -33
- package/dist/Text/index.js +5 -13
- package/dist/{Text-54334431.js → Text-703e2c21.js} +4 -10
- package/dist/Toast/index.js +32 -40
- package/dist/Tooltip/index.js +7 -15
- package/dist/{Tooltip-6b12f1c2.js → Tooltip-c80b9fb7.js} +22 -30
- package/dist/Typography/index.js +4 -12
- package/dist/{Typography-83915c54.js → Typography-09952a2f.js} +15 -22
- package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-a0e1a0ba.js} +1 -3
- package/dist/{tslib.es6-5b8768b7.js → tslib.es6-5849cd88.js} +1 -4
- package/package.json +3 -3
- package/rollup.config.js +1 -1
- package/dist/ButtonDismiss-1ccb84ec.js +0 -14
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerButton/ComboboxTriggerButton.d.ts +0 -3
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerChip/ComboboxTriggerChip.d.ts +0 -3
- package/dist/Emphasis-e10dde65.js +0 -19
- package/dist/Icon-405a216c.js +0 -40
- package/dist/InputValidation-377d6c62.js +0 -29
- package/dist/LightBox-93ef99b9.js +0 -117
- package/dist/Markdown-d53b01bf.js +0 -62
- package/dist/Option-07a24acd.js +0 -19
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require('react');
|
|
7
|
-
require('framer-motion');
|
|
8
|
-
require('../Icon-405a216c.js');
|
|
9
|
-
require('@jobber/design');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.AnimatedSwitcher = AnimatedSwitcher.AnimatedSwitcher;
|
|
1
|
+
export { A as AnimatedSwitcher } from '../AnimatedSwitcher-6ffd5003.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'framer-motion';
|
|
4
|
+
import '../Icon-22723fe6.js';
|
|
5
|
+
import '@jobber/design';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var framerMotion = require('framer-motion');
|
|
5
|
-
var Icon = require('./Icon-405a216c.js');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
|
+
import { I as Icon } from './Icon-22723fe6.js';
|
|
10
4
|
|
|
11
5
|
const DURATION_SIMPLE = 0.1;
|
|
12
6
|
const DURATION_AVERAGE = 0.2;
|
|
@@ -48,11 +42,11 @@ const SPIN_CLOCK_WISE = {
|
|
|
48
42
|
};
|
|
49
43
|
|
|
50
44
|
function AnimatedSwitcher({ initialChild, switched, switchTo, type = "slideFromBottom", }) {
|
|
51
|
-
const [ref, setRef] =
|
|
52
|
-
const isSwitchingBetweenIcons = initialChild.type === Icon
|
|
45
|
+
const [ref, setRef] = useState(null);
|
|
46
|
+
const isSwitchingBetweenIcons = initialChild.type === Icon && switchTo.type === Icon;
|
|
53
47
|
const { key, transition, child, duration } = getChildData();
|
|
54
|
-
return (
|
|
55
|
-
|
|
48
|
+
return (React.createElement(AnimatePresence, { exitBeforeEnter: true, initial: false },
|
|
49
|
+
React.createElement(motion.div, { ref: setRef, key: key, variants: transition, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration }, style: { display: getDisplayValue() } }, child)));
|
|
56
50
|
function getDisplayValue() {
|
|
57
51
|
if (ref === null || ref === void 0 ? void 0 : ref.firstElementChild) {
|
|
58
52
|
return window.getComputedStyle(ref.firstElementChild).display;
|
|
@@ -90,7 +84,7 @@ function AnimatedSwitcher({ initialChild, switched, switchTo, type = "slideFromB
|
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
AnimatedSwitcher.Icon = function AnimatedSwitcherIcon({ switchToIcon, switched, initialIcon, }) {
|
|
93
|
-
return (
|
|
87
|
+
return (React.createElement(AnimatedSwitcher, { switched: switched, initialChild: React.createElement(Icon, { name: initialIcon }), switchTo: React.createElement(Icon, { name: switchToIcon }) }));
|
|
94
88
|
};
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
export { AnimatedSwitcher as A };
|
|
@@ -1,40 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
require('react-router-dom');
|
|
24
|
-
require('../InputValidation-377d6c62.js');
|
|
25
|
-
require('framer-motion');
|
|
26
|
-
require('../Spinner-9d8fc7ff.js');
|
|
27
|
-
|
|
28
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
29
|
-
|
|
30
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
|
-
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
32
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
33
|
-
var useEventListener__default = /*#__PURE__*/_interopDefaultLegacy(useEventListener);
|
|
1
|
+
import { _ as __rest, a as __awaiter } from '../tslib.es6-5849cd88.js';
|
|
2
|
+
import React, { useState, useEffect, useLayoutEffect, forwardRef, useRef } from 'react';
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
|
+
import { s as styleInject } from '../style-inject.es-a0e1a0ba.js';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import useEventListener from '@use-it/event-listener';
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
8
|
+
import { usePopper } from 'react-popper';
|
|
9
|
+
import { T as Text } from '../Text-703e2c21.js';
|
|
10
|
+
import { I as Icon } from '../Icon-22723fe6.js';
|
|
11
|
+
import { H as Heading } from '../Heading-04994667.js';
|
|
12
|
+
import { I as InputText } from '../InputText-6d262128.js';
|
|
13
|
+
import '../Typography-09952a2f.js';
|
|
14
|
+
import '@jobber/design';
|
|
15
|
+
import '../FormField-99918ed4.js';
|
|
16
|
+
import 'uuid';
|
|
17
|
+
import 'react-hook-form';
|
|
18
|
+
import '../Button-319d8fa0.js';
|
|
19
|
+
import 'react-router-dom';
|
|
20
|
+
import '../InputValidation-b6adff05.js';
|
|
21
|
+
import 'framer-motion';
|
|
22
|
+
import '../Spinner-5d8359b8.js';
|
|
34
23
|
|
|
35
24
|
var css_248z = ".v0Cys9vQ-NE- {\n position: relative;\n width: 100%;\n}\n\n.CX-N-e0e6og- {\n display: none;\n position: absolute;\n z-index: calc(6 + 1001);\n z-index: calc(var(--elevation-menu) + var(--elevation-modal));\n width: 100%;\n /* Unfortunately this is how we define our line item picker height in jobber online.\n This is a concession to maintain visual parity. */\n max-height: 300px;\n box-shadow: 0px calc(16px / 16) calc(16px / 4) 0px\n rgba(0, 0, 0, 0.1),\n 0px calc(16px / 4) 12px 0px rgba(0, 0, 0, 0.05);\n box-shadow: var(--shadow-base);\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: calc(16px / 16) solid var(--color-color-border);\n border: var(--border-base) solid var(--color-color-border);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n overflow: auto;\n scroll-behavior: smooth;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.CX-N-e0e6og- h5 {\n padding: calc(16px / 2) 0 calc(16px / 4) calc(16px / 2);\n padding: var(--space-small) 0 var(--space-smaller) var(--space-small);\n border-bottom: calc(16px / 16) solid rgb(1, 41, 57);\n border-bottom: var(--border-base) solid var(--color-border--section);\n}\n\n.CX-N-e0e6og-._4PlUaegVpkk- {\n display: block;\n}\n\n.CX-N-e0e6og-._4PlUaegVpkk-:empty {\n display: none;\n}\n\n.ucQtG0iwqbo- {\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -ms-flex-line-pack: stretch;\n align-content: stretch;\n -ms-flex-align: center;\n align-items: center;\n padding: calc(16px / 2);\n padding: var(--space-small);\n border: none;\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n text-align: left;\n list-style: none;\n background-color: transparent;\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n\n.ucQtG0iwqbo-:hover,\n.ucQtG0iwqbo-:focus,\n.ucQtG0iwqbo-.r8HS-ma79QE- {\n background-color: rgb(250, 246, 219);\n background-color: var(--color-surface--hover);\n outline-color: rgb(231, 213, 87);\n outline-color: var(--color-focus);\n}\n\n.ucQtG0iwqbo-.ydwLX44YFZc-:not(:last-child) {\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n}\n\n.CX-N-e0e6og-:hover .ucQtG0iwqbo-.r8HS-ma79QE-:not(:hover) {\n background-color: transparent;\n outline-color: transparent;\n}\n\n.v0Cys9vQ-NE- .PvUgNoAUG7A-:not(:first-child) {\n padding-top: calc(16px / 2);\n padding-top: var(--space-small);\n}\n\n.ucQtG0iwqbo- .DAOOFUZ1BRM- {\n -ms-flex: 0 1 auto;\n flex: 0 1 auto;\n -ms-flex-item-align: auto;\n align-self: auto;\n width: calc(16px * 1.5);\n width: var(--space-large);\n}\n\n.ucQtG0iwqbo- .cjKJFup6hGY- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n -ms-flex: 1 100%;\n flex: 1 100%;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n\n.ucQtG0iwqbo- .hG5zNBuI2wA- {\n -ms-flex: 2;\n flex: 2;\n}\n\n.ucQtG0iwqbo- ._3CwjFCbhqi4- {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-item-align: end;\n align-self: flex-end;\n text-align: right;\n}\n";
|
|
36
25
|
var styles = {"autocomplete":"v0Cys9vQ-NE-","options":"CX-N-e0e6og-","visible":"_4PlUaegVpkk-","option":"ucQtG0iwqbo-","active":"r8HS-ma79QE-","separator":"ydwLX44YFZc-","heading":"PvUgNoAUG7A-","icon":"DAOOFUZ1BRM-","text":"cjKJFup6hGY-","label":"hG5zNBuI2wA-","details":"_3CwjFCbhqi4-"};
|
|
37
|
-
|
|
26
|
+
styleInject(css_248z);
|
|
38
27
|
|
|
39
28
|
var IndexChange;
|
|
40
29
|
(function (IndexChange) {
|
|
@@ -42,35 +31,35 @@ var IndexChange;
|
|
|
42
31
|
IndexChange[IndexChange["Next"] = 1] = "Next";
|
|
43
32
|
})(IndexChange || (IndexChange = {}));
|
|
44
33
|
function Menu({ visible, options, selectedOption, onOptionSelect, attachTo, }) {
|
|
45
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
34
|
+
const [highlightedIndex, setHighlightedIndex] = useState(0);
|
|
46
35
|
const { menuRef, setMenuRef, styles: popperStyles, attributes, targetWidth, } = useRepositionMenu(attachTo, visible);
|
|
47
36
|
const detectSeparatorCondition = (option) => option.description || option.details;
|
|
48
37
|
const detectGroups = (option) => option.options;
|
|
49
38
|
const addSeparators = options.some(detectSeparatorCondition);
|
|
50
39
|
const initialHighlight = options.some(detectGroups) ? 1 : 0;
|
|
51
40
|
setupKeyListeners();
|
|
52
|
-
|
|
53
|
-
const menu = (
|
|
54
|
-
const optionClass =
|
|
41
|
+
useEffect(() => setHighlightedIndex(initialHighlight), [options]);
|
|
42
|
+
const menu = (React.createElement("div", Object.assign({ className: classnames(styles.options, { [styles.visible]: visible }), ref: setMenuRef, style: Object.assign(Object.assign({}, popperStyles.popper), { width: targetWidth }) }, attributes.popper), options.map((option, index) => {
|
|
43
|
+
const optionClass = classnames(styles.option, {
|
|
55
44
|
[styles.active]: index === highlightedIndex,
|
|
56
45
|
[styles.separator]: addSeparators,
|
|
57
46
|
});
|
|
58
47
|
if (isGroup(option)) {
|
|
59
|
-
return (
|
|
60
|
-
|
|
48
|
+
return (React.createElement("div", { key: option.label, className: styles.heading },
|
|
49
|
+
React.createElement(Heading, { level: 5 }, option.label)));
|
|
61
50
|
}
|
|
62
|
-
return (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
option.description !== undefined && (
|
|
68
|
-
option.details !== undefined && (
|
|
69
|
-
|
|
51
|
+
return (React.createElement("button", { className: optionClass, key: option.value, onMouseDown: onOptionSelect.bind(undefined, option) },
|
|
52
|
+
React.createElement("div", { className: styles.icon }, isOptionSelected(selectedOption, option) && (React.createElement(Icon, { name: "checkmark", size: "small" }))),
|
|
53
|
+
React.createElement("div", { className: styles.text },
|
|
54
|
+
React.createElement("div", { className: styles.label },
|
|
55
|
+
React.createElement(Text, null, option.label),
|
|
56
|
+
option.description !== undefined && (React.createElement(Text, { variation: "subdued" }, option.description))),
|
|
57
|
+
option.details !== undefined && (React.createElement("div", { className: styles.details },
|
|
58
|
+
React.createElement(Text, null, option.details))))));
|
|
70
59
|
})));
|
|
71
|
-
return
|
|
60
|
+
return createPortal(menu, document.body);
|
|
72
61
|
function setupKeyListeners() {
|
|
73
|
-
|
|
62
|
+
useEffect(() => {
|
|
74
63
|
var _a, _b;
|
|
75
64
|
(_b = (_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.children[highlightedIndex]) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
76
65
|
behavior: "smooth",
|
|
@@ -116,7 +105,7 @@ function isOptionSelected(selectedOption, option) {
|
|
|
116
105
|
function useOnKeyDown(keyName, handler) {
|
|
117
106
|
// Pending: https://github.com/donavon/use-event-listener/pull/12
|
|
118
107
|
// The types in useEventListener mistakenly require a SyntheticEvent for the passed generic.
|
|
119
|
-
|
|
108
|
+
useEventListener("keydown", event => {
|
|
120
109
|
const newEvent = event;
|
|
121
110
|
if (newEvent.key === keyName) {
|
|
122
111
|
handler(newEvent);
|
|
@@ -130,14 +119,14 @@ function isGroup(option) {
|
|
|
130
119
|
}
|
|
131
120
|
function useRepositionMenu(attachTo, visible = false) {
|
|
132
121
|
var _a;
|
|
133
|
-
const [menuRef, setMenuRef] =
|
|
134
|
-
const popper =
|
|
122
|
+
const [menuRef, setMenuRef] = useState();
|
|
123
|
+
const popper = usePopper(attachTo.current, menuRef, {
|
|
135
124
|
modifiers: [
|
|
136
125
|
{ name: "offset", options: { offset: [0, 8] } },
|
|
137
126
|
{ name: "flip", options: { fallbackPlacements: ["top"] } },
|
|
138
127
|
],
|
|
139
128
|
});
|
|
140
|
-
|
|
129
|
+
useLayoutEffect(() => {
|
|
141
130
|
var _a;
|
|
142
131
|
(_a = popper === null || popper === void 0 ? void 0 : popper.update) === null || _a === void 0 ? void 0 : _a.call(popper);
|
|
143
132
|
}, [visible]);
|
|
@@ -149,23 +138,23 @@ function useRepositionMenu(attachTo, visible = false) {
|
|
|
149
138
|
/* eslint max-statements: ["error", 14] */
|
|
150
139
|
function AutocompleteInternal(_a, ref) {
|
|
151
140
|
var _b;
|
|
152
|
-
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations } = _a, inputProps =
|
|
153
|
-
const [options, setOptions] =
|
|
154
|
-
const [menuVisible, setMenuVisible] =
|
|
155
|
-
const [inputText, setInputText] =
|
|
156
|
-
const autocompleteRef =
|
|
157
|
-
const delayedSearch =
|
|
158
|
-
|
|
141
|
+
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations } = _a, inputProps = __rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "validations"]);
|
|
142
|
+
const [options, setOptions] = useState(initialOptions);
|
|
143
|
+
const [menuVisible, setMenuVisible] = useState(false);
|
|
144
|
+
const [inputText, setInputText] = useState((_b = value === null || value === void 0 ? void 0 : value.label) !== null && _b !== void 0 ? _b : "");
|
|
145
|
+
const autocompleteRef = useRef(null);
|
|
146
|
+
const delayedSearch = debounce(updateSearch, debounceRate);
|
|
147
|
+
useEffect(() => {
|
|
159
148
|
delayedSearch();
|
|
160
149
|
return delayedSearch.cancel;
|
|
161
150
|
}, [inputText]);
|
|
162
|
-
|
|
151
|
+
useEffect(() => {
|
|
163
152
|
var _a;
|
|
164
153
|
updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
165
154
|
}, [value]);
|
|
166
|
-
return (
|
|
167
|
-
|
|
168
|
-
menuVisible && (
|
|
155
|
+
return (React.createElement("div", { className: styles.autocomplete, ref: autocompleteRef },
|
|
156
|
+
React.createElement(InputText, Object.assign({ ref: ref, autocomplete: false, size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, validations: validations }, inputProps)),
|
|
157
|
+
menuVisible && (React.createElement(Menu, { attachTo: autocompleteRef, visible: menuVisible && options.length > 0, options: options, selectedOption: value, onOptionSelect: handleMenuChange }))));
|
|
169
158
|
function updateInput(newText) {
|
|
170
159
|
setInputText(newText);
|
|
171
160
|
if (newText === "") {
|
|
@@ -173,7 +162,7 @@ function AutocompleteInternal(_a, ref) {
|
|
|
173
162
|
}
|
|
174
163
|
}
|
|
175
164
|
function updateSearch() {
|
|
176
|
-
return
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
166
|
const updatedOptions = yield getOptions(inputText);
|
|
178
167
|
const filteredOptions = updatedOptions.filter((option) => "options" in option && option.options ? option.options.length > 0 : true);
|
|
179
168
|
setOptions(mapToOptions(filteredOptions));
|
|
@@ -214,6 +203,6 @@ function mapToOptions(items) {
|
|
|
214
203
|
return result;
|
|
215
204
|
}, []);
|
|
216
205
|
}
|
|
217
|
-
const Autocomplete =
|
|
206
|
+
const Autocomplete = forwardRef(AutocompleteInternal);
|
|
218
207
|
|
|
219
|
-
|
|
208
|
+
export { Autocomplete };
|
package/dist/Avatar/index.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
-
require('color');
|
|
10
|
-
require('../Icon-405a216c.js');
|
|
11
|
-
require('@jobber/design');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.Avatar = Avatar.Avatar;
|
|
1
|
+
export { A as Avatar } from '../Avatar-b2e862de.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
5
|
+
import 'color';
|
|
6
|
+
import '../Icon-22723fe6.js';
|
|
7
|
+
import '@jobber/design';
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var Color = require('color');
|
|
7
|
-
var Icon = require('./Icon-405a216c.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
13
|
-
var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { s as styleInject } from './style-inject.es-a0e1a0ba.js';
|
|
4
|
+
import Color from 'color';
|
|
5
|
+
import { I as Icon } from './Icon-22723fe6.js';
|
|
14
6
|
|
|
15
7
|
var css_248z = ":root {\n --avatar-size: calc(var(--base-unit) * 2);\n --avatar-border-size: var(--border-base);\n}\n\n.WniTNadEyPk- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n width: calc(16px * 2);\n width: var(--avatar-size);\n height: calc(16px * 2);\n height: var(--avatar-size);\n min-width: calc(16px * 2);\n min-width: var(--avatar-size);\n min-height: calc(16px * 2);\n min-height: var(--avatar-size);\n border-radius: 100%;\n border-radius: var(--radius-circle);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n font-size: calc(16px * 2);\n font-size: var(--avatar-size);\n -webkit-font-smoothing: antialiased;\n background: no-repeat center center rgba(101, 120, 132, 1);\n background: no-repeat center center var(--color-greyBlue);\n background-size: cover;\n}\n\n.WniTNadEyPk-:focus {\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n outline: none;\n}\n\n._8Pqn2uZpaZg- {\n --avatar-size: calc(var(--base-unit) * 4.5);\n --avatar-border-size: var(--border-thick);\n}\n\n.S-edTXYA-7E- {\n --avatar-size: calc(var(--base-unit) * 1.5);\n}\n\n.S1iBGElfOUA- {\n color: rgba(255, 255, 255, 1);\n color: var(--color-text--reverse);\n}\n\n.ErPhpHHpiBQ- {\n font-size: calc((16px * 2) / 2);\n font-size: calc(calc(16px * 2) / 2);\n font-size: calc(var(--avatar-size) / 2);\n text-transform: uppercase;\n}\n\n.aC-d-mngrIc- {\n font-size: calc((16px * 2) / 2.25);\n font-size: calc(calc(16px * 2) / 2.25);\n font-size: calc(var(--avatar-size) / 2.25);\n}\n\n.nR0S-GzjDnQ- {\n width: calc((16px * 2) - (calc(16px / 16) * 2));\n width: calc(calc(16px * 2) - (calc(16px / 16) * 2));\n width: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n height: calc((16px * 2) - (calc(16px / 16) * 2));\n height: calc(calc(16px * 2) - (calc(16px / 16) * 2));\n height: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n box-shadow: 0 0 0 calc(16px / 8) rgba(255, 255, 255, 1) inset;\n box-shadow: 0 0 0 var(--border-thick) var(--color-white) inset;\n border-style: solid;\n border-width: calc(16px / 16);\n border-width: var(--avatar-border-size);\n}\n";
|
|
16
8
|
var styles = {"avatar":"WniTNadEyPk-","large":"_8Pqn2uZpaZg-","small":"S-edTXYA-7E-","isDark":"S1iBGElfOUA-","initials":"ErPhpHHpiBQ-","smallInitials":"aC-d-mngrIc-","hasBorder":"nR0S-GzjDnQ-"};
|
|
17
|
-
|
|
9
|
+
styleInject(css_248z);
|
|
18
10
|
|
|
19
11
|
function isDark(colorToCheck) {
|
|
20
12
|
if (colorToCheck == undefined) {
|
|
@@ -22,7 +14,7 @@ function isDark(colorToCheck) {
|
|
|
22
14
|
}
|
|
23
15
|
if (colorToCheck) {
|
|
24
16
|
try {
|
|
25
|
-
return
|
|
17
|
+
return Color(deconstructCssCustomProperty(colorToCheck)).isDark();
|
|
26
18
|
}
|
|
27
19
|
catch (err) {
|
|
28
20
|
console.log(err);
|
|
@@ -59,20 +51,20 @@ function Avatar({ imageUrl, name, initials, size = "base", color, }) {
|
|
|
59
51
|
style.backgroundImage = `url(${imageUrl})`;
|
|
60
52
|
}
|
|
61
53
|
const shouldBeDark = color == undefined || isDark(color);
|
|
62
|
-
const className =
|
|
54
|
+
const className = classnames(styles.avatar, size !== "base" && styles[size], {
|
|
63
55
|
[styles.hasBorder]: imageUrl && color,
|
|
64
56
|
[styles.isDark]: shouldBeDark,
|
|
65
57
|
});
|
|
66
|
-
return (
|
|
58
|
+
return (React.createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
|
|
67
59
|
}
|
|
68
60
|
function Initials({ initials, dark = false, iconSize = "base", }) {
|
|
69
61
|
if (!initials) {
|
|
70
|
-
return (
|
|
62
|
+
return (React.createElement(Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
|
|
71
63
|
}
|
|
72
|
-
const className =
|
|
64
|
+
const className = classnames(styles.initials, {
|
|
73
65
|
[styles.smallInitials]: initials.length > 2,
|
|
74
66
|
});
|
|
75
|
-
return
|
|
67
|
+
return React.createElement("span", { className: className }, initials.substr(0, 3));
|
|
76
68
|
}
|
|
77
69
|
|
|
78
|
-
|
|
70
|
+
export { Avatar as A };
|
package/dist/Banner/index.js
CHANGED
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var Button = require('../Button-db6114a6.js');
|
|
12
|
-
require('@jobber/design');
|
|
13
|
-
require('../Typography-83915c54.js');
|
|
14
|
-
require('react-router-dom');
|
|
15
|
-
|
|
16
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
-
|
|
18
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { useResizeObserver } from '@jobber/hooks/useResizeObserver';
|
|
4
|
+
import { s as styleInject } from '../style-inject.es-a0e1a0ba.js';
|
|
5
|
+
import { I as Icon } from '../Icon-22723fe6.js';
|
|
6
|
+
import { T as Text } from '../Text-703e2c21.js';
|
|
7
|
+
import { B as Button } from '../Button-319d8fa0.js';
|
|
8
|
+
import '@jobber/design';
|
|
9
|
+
import '../Typography-09952a2f.js';
|
|
10
|
+
import 'react-router-dom';
|
|
20
11
|
|
|
21
12
|
var css_248z$1 = ".meuT8gYQPJU- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n box-shadow: 0px calc(16px / 16) calc(16px / 4) 0px\n rgba(0, 0, 0, 0.1),\n 0px calc(16px / 4) 12px 0px rgba(0, 0, 0, 0.05);\n box-shadow: var(--shadow-base);\n padding: calc(16px * 1);\n padding: var(--space-base);\n color: rgb(66, 78, 86);\n color: var(--color-text);\n background-color: rgb(244, 244, 244);\n background-color: var(--color-surface--background);\n gap: calc(16px / 2);\n gap: var(--space-small);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.y4BapyZr-fo- > a {\n color: rgb(66, 78, 86);\n color: var(--color-text);\n}\n\n.y4BapyZr-fo- > a:hover {\n color: rgb(1, 41, 57);\n color: var(--color-blue);\n}\n\n._6v1woNSLEvc- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n gap: calc(16px / 2);\n gap: var(--space-small);\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n@media (max-width: 489.98px) {\n\n._6v1woNSLEvc- {\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n }\n\n@media (--small-screens-and-below) {\n\n._6v1woNSLEvc- {\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n }\n\n.y4BapyZr-fo- {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-item-align: center;\n align-self: center;\n}\n\n._6v1woNSLEvc- > *:last-child {\n margin-bottom: 0;\n}\n\n.bocgLmEhcTU- .y4BapyZr-fo- {\n -ms-flex: 1;\n flex: 1;\n}\n\n.rtNjEzmABX4- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n\n@media (max-width: 489.98px) {\n\n.rtNjEzmABX4- {\n width: 100%;\n margin-top: calc(16px / 2);\n margin-top: var(--space-small);\n}\n }\n\n@media (--small-screens-and-below) {\n\n.rtNjEzmABX4- {\n width: 100%;\n margin-top: calc(16px / 2);\n margin-top: var(--space-small);\n}\n }\n\n.lunQ5SOfyLg- {\n margin: calc((16px / 8) * -1) 0;\n margin: calc(calc(16px / 8) * -1) 0;\n margin: calc(var(--space-smallest) * -1) 0;\n padding: calc(16px / 8);\n padding: var(--space-smallest);\n border: none;\n background-color: transparent;\n cursor: pointer;\n -webkit-appearance: none;\n appearance: none;\n -ms-flex: 0;\n flex: 0;\n -ms-flex-item-align: start;\n align-self: flex-start;\n}\n\n.lunQ5SOfyLg-:hover {\n background: rgba(0, 0, 0, 0.025);\n}\n\n.lunQ5SOfyLg-:focus {\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n outline: none;\n background: rgba(0, 0, 0, 0.05);\n}\n";
|
|
22
13
|
var styles = {"banner":"meuT8gYQPJU-","bannerChildren":"y4BapyZr-fo-","bannerContent":"_6v1woNSLEvc-","medium":"bocgLmEhcTU-","bannerAction":"rtNjEzmABX4-","closeButton":"lunQ5SOfyLg-"};
|
|
23
|
-
|
|
14
|
+
styleInject(css_248z$1);
|
|
24
15
|
|
|
25
16
|
var css_248z = ".wWW-2T7rCV0- {\n background-color: rgb(226, 241, 250);\n background-color: var(--color-informative--surface);\n}\n\n/* Our Banner \"surface\" colors should be lighter than they are so we're leaving the following alone for now */\n\n._7h8FUHIkVjg- {\n background-color: rgb(203, 223, 159);\n background-color: var(--color-green--lighter);\n}\n\n.d5fXcE1L0lc- {\n background-color: rgb(241, 231, 159);\n background-color: var(--color-yellow--lighter);\n}\n\n.oYaw-T3c0IU- {\n background-color: rgb(255, 206, 194);\n background-color: var(--color-red--lighter);\n}\n";
|
|
26
17
|
var types = {"notice":"wWW-2T7rCV0-","success":"_7h8FUHIkVjg-","warning":"d5fXcE1L0lc-","error":"oYaw-T3c0IU-"};
|
|
27
|
-
|
|
18
|
+
styleInject(css_248z);
|
|
28
19
|
|
|
29
20
|
function BannerIcon({ icon }) {
|
|
30
|
-
return
|
|
21
|
+
return React.createElement(Icon, { name: icon, color: "greyBlueDark" });
|
|
31
22
|
}
|
|
32
23
|
|
|
33
24
|
function Banner({ children, type, primaryAction, dismissible = true, icon, onDismiss, }) {
|
|
34
|
-
const [showBanner, setShowBanner] =
|
|
25
|
+
const [showBanner, setShowBanner] = useState(true);
|
|
35
26
|
const bannerWidths = {
|
|
36
27
|
small: 320,
|
|
37
28
|
medium: 480,
|
|
38
29
|
};
|
|
39
|
-
const [bannerRef, { width: bannerWidth = bannerWidths.small }] =
|
|
30
|
+
const [bannerRef, { width: bannerWidth = bannerWidths.small }] = useResizeObserver({
|
|
40
31
|
widths: bannerWidths,
|
|
41
32
|
});
|
|
42
33
|
const iconColors = {
|
|
@@ -52,18 +43,18 @@ function Banner({ children, type, primaryAction, dismissible = true, icon, onDis
|
|
|
52
43
|
variation: type === "notice" ? "learning" : "work",
|
|
53
44
|
}, primaryAction);
|
|
54
45
|
}
|
|
55
|
-
const bannerClassNames =
|
|
46
|
+
const bannerClassNames = classnames(styles.banner, types[type], {
|
|
56
47
|
[styles.medium]: bannerWidth >= bannerWidths.medium,
|
|
57
48
|
});
|
|
58
|
-
return (
|
|
59
|
-
|
|
60
|
-
icon &&
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
primaryAction && (
|
|
64
|
-
|
|
65
|
-
dismissible && (
|
|
66
|
-
|
|
49
|
+
return (React.createElement(React.Fragment, null, showBanner && (React.createElement("div", { className: bannerClassNames, ref: bannerRef, role: type === "error" ? "alert" : "status" },
|
|
50
|
+
React.createElement("div", { className: styles.bannerContent },
|
|
51
|
+
icon && React.createElement(BannerIcon, { icon: icon }),
|
|
52
|
+
React.createElement("div", { className: styles.bannerChildren },
|
|
53
|
+
React.createElement(BannerChildren, null, children)),
|
|
54
|
+
primaryAction && (React.createElement("div", { className: styles.bannerAction },
|
|
55
|
+
React.createElement(Button, Object.assign({}, primaryAction))))),
|
|
56
|
+
dismissible && (React.createElement("button", { className: styles.closeButton, onClick: handleClose, "aria-label": "Close this notification" },
|
|
57
|
+
React.createElement(Icon, { name: "cross", color: iconColors[type] })))))));
|
|
67
58
|
function handleClose() {
|
|
68
59
|
setShowBanner(!showBanner);
|
|
69
60
|
onDismiss && onDismiss();
|
|
@@ -71,11 +62,11 @@ function Banner({ children, type, primaryAction, dismissible = true, icon, onDis
|
|
|
71
62
|
}
|
|
72
63
|
function BannerChildren({ children, }) {
|
|
73
64
|
if (!children)
|
|
74
|
-
return
|
|
65
|
+
return React.createElement(React.Fragment, null);
|
|
75
66
|
if (children && typeof children === "string") {
|
|
76
|
-
return
|
|
67
|
+
return React.createElement(Text, null, children);
|
|
77
68
|
}
|
|
78
|
-
return
|
|
69
|
+
return React.createElement(React.Fragment, null, children);
|
|
79
70
|
}
|
|
80
71
|
|
|
81
|
-
|
|
72
|
+
export { Banner };
|
package/dist/Button/index.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require('../style-inject.es-9d2f5f4e.js');
|
|
10
|
-
require('../Icon-405a216c.js');
|
|
11
|
-
require('@jobber/design');
|
|
12
|
-
require('../Typography-83915c54.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.Button = Button.Button;
|
|
1
|
+
export { B as Button } from '../Button-319d8fa0.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import 'react-router-dom';
|
|
5
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
6
|
+
import '../Icon-22723fe6.js';
|
|
7
|
+
import '@jobber/design';
|
|
8
|
+
import '../Typography-09952a2f.js';
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var Icon = require('./Icon-405a216c.js');
|
|
8
|
-
var Typography = require('./Typography-83915c54.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { s as styleInject } from './style-inject.es-a0e1a0ba.js';
|
|
5
|
+
import { I as Icon } from './Icon-22723fe6.js';
|
|
6
|
+
import { T as Typography } from './Typography-09952a2f.js';
|
|
14
7
|
|
|
15
8
|
var css_248z = ":root {\n --button--color-variation: var(--color-interactive);\n --button--color-variation--hover: var(--color-interactive--hover);\n --button--color-surface: var(--color-surface);\n --button--color-surface--hover: var(--color-surface--background);\n --button--color-primaryLabel: var(--color-white);\n\n --button--duration-loading: var(--timing-loading--extended);\n}\n\n.U9VsquOtk2I- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n min-height: calc(16px * 2.25);\n min-height: calc(var(--base-unit) * 2.25);\n box-sizing: border-box;\n margin: 0;\n border: calc(16px / 16) solid rgb(125, 176, 14);\n border: var(--border-base) solid var(--button--color-variation);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n color: rgb(125, 176, 14);\n color: var(--button--color-variation);\n -webkit-font-smoothing: antialiased;\n letter-spacing: calc(16px / 40);\n letter-spacing: var(--typography--letterSpacing-loose);\n text-align: center;\n -webkit-text-decoration: none;\n text-decoration: none;\n vertical-align: middle;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--button--color-surface);\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n -webkit-appearance: none;\n appearance: none;\n fill: rgb(125, 176, 14);\n fill: var(--button--color-variation);\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.U9VsquOtk2I- * {\n fill: inherit !important;\n}\n\n.U9VsquOtk2I- * {\n color: inherit;\n /* required to over-ride very specific fill from <Icon> */\n}\n\n.U9VsquOtk2I-:hover,\na.U9VsquOtk2I-:hover,\n.U9VsquOtk2I-:focus,\na.U9VsquOtk2I-:focus,\n.U9VsquOtk2I-:active,\na.U9VsquOtk2I-:active {\n border-color: rgb(81, 114, 9);\n border-color: var(--button--color-variation--hover);\n color: rgb(81, 114, 9);\n color: var(--button--color-variation--hover);\n fill: rgb(81, 114, 9);\n fill: var(--button--color-variation--hover);\n background-color: rgb(244, 244, 244);\n background-color: var(--button--color-surface--hover);\n}\n\n.U9VsquOtk2I-:focus,\na.U9VsquOtk2I-:focus,\n.U9VsquOtk2I-:active,\na.U9VsquOtk2I-:active {\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n outline: none;\n}\n\n/* Variation */\n\n.qkFQwI0PKfw- {\n --button--color-variation: var(--color-interactive);\n --button--color-variation--hover: var(--color-interactive--hover);\n}\n\n.jsKQEOBdJ0k- {\n --button--color-variation: var(--color-informative);\n --button--color-variation--hover: var(--color-informative--onSurface);\n}\n\n._4W8X0dxZDK4- {\n --button--color-variation: var(--color-destructive);\n --button--color-variation--hover: var(--color-destructive--hover);\n}\n\n/* Subtle is special because, by default, it's styled as a secondary button */\n\n.vDKO-cmh8vY- {\n --button--color-variation: var(--color-interactive--subtle);\n --button--color-variation--hover: var(--color-interactive--subtle--hover);\n}\n\n/* Type */\n\n.FXqN12jWtPo-:not(.vDKO-cmh8vY-):not(.bg-l22drjd0-),\n.FXqN12jWtPo-:not(.vDKO-cmh8vY-):not(.bg-l22drjd0-):hover,\n.FXqN12jWtPo-:not(.vDKO-cmh8vY-):not(.bg-l22drjd0-):focus {\n color: rgba(255, 255, 255, 1);\n color: var(--button--color-primaryLabel);\n background-color: rgb(125, 176, 14);\n background-color: var(--button--color-variation);\n fill: rgba(255, 255, 255, 1);\n fill: var(--button--color-primaryLabel);\n}\n\n.FXqN12jWtPo-:not(.vDKO-cmh8vY-):not(.bg-l22drjd0-):hover,\n.FXqN12jWtPo-:not(.vDKO-cmh8vY-):not(.bg-l22drjd0-):focus {\n background-color: rgb(81, 114, 9);\n background-color: var(--button--color-variation--hover);\n}\n\n.vDKO-cmh8vY-.FXqN12jWtPo- {\n color: rgb(125, 176, 14);\n color: var(--button--color-variation);\n fill: rgb(125, 176, 14);\n fill: var(--button--color-variation);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--button--color-surface);\n}\n\n.pf6G840lKdA-,\n.vDKO-cmh8vY-.FXqN12jWtPo- {\n border-color: rgb(125, 176, 14);\n border-color: var(--button--color-variation);\n}\n\n.vDKO-cmh8vY-.FXqN12jWtPo-:hover,\n.vDKO-cmh8vY-.FXqN12jWtPo-:focus {\n color: rgb(81, 114, 9);\n color: var(--button--color-variation--hover);\n background-color: rgb(244, 244, 244);\n background-color: var(--button--color-surface--hover);\n fill: rgb(81, 114, 9);\n fill: var(--button--color-variation--hover);\n}\n\n.vDKO-cmh8vY-.pf6G840lKdA- {\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--button--color-surface);\n}\n\n.m7DbwRZWcNk-,\n.vDKO-cmh8vY-.pf6G840lKdA- {\n border-color: transparent;\n}\n\n.vDKO-cmh8vY-.pf6G840lKdA-:hover,\n.vDKO-cmh8vY-.pf6G840lKdA-:focus {\n background-color: rgb(244, 244, 244);\n background-color: var(--button--color-surface--hover);\n}\n\n.m7DbwRZWcNk-:hover,\n.m7DbwRZWcNk-:focus,\na.m7DbwRZWcNk-:hover,\na.m7DbwRZWcNk-:focus,\n.vDKO-cmh8vY-.pf6G840lKdA-:hover,\n.vDKO-cmh8vY-.pf6G840lKdA-:focus,\na.vDKO-cmh8vY-.pf6G840lKdA-:hover,\na.vDKO-cmh8vY-.pf6G840lKdA-:focus {\n border-color: transparent;\n}\n\n.vDKO-cmh8vY-.m7DbwRZWcNk- {\n border-color: transparent;\n background-color: transparent;\n}\n\n.vDKO-cmh8vY-.m7DbwRZWcNk-:hover,\n.vDKO-cmh8vY-.m7DbwRZWcNk-:focus,\na.vDKO-cmh8vY-.m7DbwRZWcNk-:hover,\na.vDKO-cmh8vY-.m7DbwRZWcNk-:focus {\n border-color: transparent;\n color: rgb(66, 78, 86);\n color: var(--color-interactive--subtle--hover);\n fill: rgb(66, 78, 86);\n fill: var(--color-interactive--subtle--hover);\n}\n\n/* Disabled */\n\n.U9VsquOtk2I-.bg-l22drjd0-,\na.U9VsquOtk2I-.bg-l22drjd0-,\n.U9VsquOtk2I-.bg-l22drjd0-:hover,\na.U9VsquOtk2I-.bg-l22drjd0-:hover {\n border-color: rgb(225, 225, 225);\n border-color: var(--color-disabled--secondary);\n color: rgb(181, 181, 181);\n color: var(--color-disabled);\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-color: rgb(225, 225, 225);\n background-color: var(--color-disabled--secondary);\n fill: rgb(181, 181, 181);\n fill: var(--color-disabled);\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* Sizes */\n\n.STSDgSRREx4- {\n min-height: calc(16px * 1.5);\n min-height: calc(var(--base-unit) * 1.5);\n padding: 0 calc(16px / 2);\n padding: 0 var(--space-small);\n letter-spacing: 0;\n}\n\n.amIh7vPETfo- {\n min-height: calc(16px * 2.25);\n min-height: calc(var(--base-unit) * 2.25);\n padding: 0 calc((16px * 1) - 4px);\n padding: 0 calc(calc(16px * 1) - 4px);\n padding: 0 calc(var(--space-base) - 4px);\n}\n\n.ON6ezOojFVo- {\n min-height: calc(16px * 3);\n min-height: calc(var(--base-unit) * 3);\n padding: 0 calc(16px * 1);\n padding: 0 var(--space-base);\n}\n\n/* Icon */\n\n.Qq-idRLJTCk- {\n width: calc(16px * 2.25);\n width: calc(var(--base-unit) * 2.25);\n padding: 0;\n}\n\n.Qq-idRLJTCk-.STSDgSRREx4- {\n width: calc((16px / 2) * 3);\n width: calc(calc(16px / 2) * 3);\n width: calc(var(--space-small) * 3);\n}\n\n.Qq-idRLJTCk-.amIh7vPETfo- {\n width: calc((16px * 1) * 2.25);\n width: calc(calc(16px * 1) * 2.25);\n width: calc(var(--space-base) * 2.25);\n}\n\n.Qq-idRLJTCk-.ON6ezOojFVo- {\n width: calc((16px * 1.5) * 2);\n width: calc(calc(16px * 1.5) * 2);\n width: calc(var(--space-large) * 2);\n}\n\n.EWh1gvgPJQg- {\n width: auto;\n}\n\n.EWh1gvgPJQg- > * {\n text-align: left;\n}\n\n.EWh1gvgPJQg- > *:first-child {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n margin-right: calc(16px / 2);\n margin-right: var(--space-small);\n}\n\n.pfzTUMgNb3o- > *:first-child {\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n margin-right: 0;\n -ms-flex-order: 1;\n order: 1;\n}\n\n.ZCHqCEyLBw0- {\n width: 100%;\n}\n\n.VVFKEv1ksMA- {\n background-image: linear-gradient(\n 135deg,\n rgba(0, 0, 0, 0.1) 0%,\n rgba(0, 0, 0, 0.1) 25%,\n transparent 25%,\n transparent 50%,\n rgba(0, 0, 0, 0.1) 50%,\n rgba(0, 0, 0, 0.1) 75%,\n transparent 75%,\n transparent 100%\n );\n background-size: calc(16px * 2) calc(16px * 2);\n background-size: var(--space-larger) var(--space-larger);\n pointer-events: none;\n cursor: not-allowed;\n -webkit-animation-duration: 2000ms;\n -webkit-animation-duration: var(--button--duration-loading);\n animation-duration: 2000ms;\n animation-duration: var(--button--duration-loading);\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite;\n -webkit-animation-name: a8Q-0lnKH5M-;\n animation-name: a8Q-0lnKH5M-;\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n}\n\n.FXqN12jWtPo-.VVFKEv1ksMA-:not(.vDKO-cmh8vY-) {\n background-image: linear-gradient(\n 135deg,\n rgba(255, 255, 255, 0.25) 0%,\n rgba(255, 255, 255, 0.25) 25%,\n transparent 25%,\n transparent 50%,\n rgba(255, 255, 255, 0.25) 50%,\n rgba(255, 255, 255, 0.25) 75%,\n transparent 75%,\n transparent 100%\n );\n}\n\n@-webkit-keyframes a8Q-0lnKH5M- {\n 0% {\n background-position: 0 0;\n }\n\n 100% {\n background-position: calc(16px * 2) calc(16px * 2);\n background-position: var(--space-larger) var(--space-larger);\n }\n}\n\n@keyframes a8Q-0lnKH5M- {\n 0% {\n background-position: 0 0;\n }\n\n 100% {\n background-position: calc(16px * 2) calc(16px * 2);\n background-position: var(--space-larger) var(--space-larger);\n }\n}\n";
|
|
16
9
|
var styles = {"button":"U9VsquOtk2I-","work":"qkFQwI0PKfw-","learning":"jsKQEOBdJ0k-","destructive":"_4W8X0dxZDK4-","subtle":"vDKO-cmh8vY-","primary":"FXqN12jWtPo-","disabled":"bg-l22drjd0-","secondary":"pf6G840lKdA-","tertiary":"m7DbwRZWcNk-","small":"STSDgSRREx4-","base":"amIh7vPETfo-","large":"ON6ezOojFVo-","onlyIcon":"Qq-idRLJTCk-","hasIconAndLabel":"EWh1gvgPJQg-","iconOnRight":"pfzTUMgNb3o-","fullWidth":"ZCHqCEyLBw0-","loading":"VVFKEv1ksMA-","animateStripes":"a8Q-0lnKH5M-"};
|
|
17
|
-
|
|
10
|
+
styleInject(css_248z);
|
|
18
11
|
|
|
19
12
|
function Button(props) {
|
|
20
13
|
const { ariaControls, ariaHaspopup, ariaExpanded, ariaLabel, disabled = false, external, fullWidth, icon, label, iconOnRight, id, loading, onClick, onMouseDown, role, size = "base", type = "primary", url, to, variation = "work", submit, } = props;
|
|
21
|
-
const buttonClassNames =
|
|
14
|
+
const buttonClassNames = classnames(styles.button, styles[size], {
|
|
22
15
|
[styles.onlyIcon]: icon && !label,
|
|
23
16
|
[styles.hasIconAndLabel]: icon && label,
|
|
24
17
|
[styles.iconOnRight]: iconOnRight,
|
|
@@ -31,17 +24,17 @@ function Button(props) {
|
|
|
31
24
|
const buttonType = submit ? "submit" : "button";
|
|
32
25
|
const tagProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ className: buttonClassNames, disabled,
|
|
33
26
|
id }, (!disabled && { href: url })), (!disabled && { onClick: onClick })), (!disabled && { onMouseDown: onMouseDown })), (external && { target: "_blank" })), (url === undefined && to === undefined && { type: buttonType })), { "aria-controls": ariaControls, "aria-haspopup": ariaHaspopup, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, role: role });
|
|
34
|
-
const buttonInternals =
|
|
27
|
+
const buttonInternals = React.createElement(ButtonInternals, Object.assign({}, props));
|
|
35
28
|
if (to) {
|
|
36
|
-
return (
|
|
29
|
+
return (React.createElement(Link, Object.assign({}, tagProps, { to: to }), buttonInternals));
|
|
37
30
|
}
|
|
38
31
|
const Tag = url ? "a" : "button";
|
|
39
|
-
return
|
|
32
|
+
return React.createElement(Tag, Object.assign({}, tagProps), buttonInternals);
|
|
40
33
|
}
|
|
41
34
|
function ButtonInternals({ label, icon, size = "base" }) {
|
|
42
|
-
return (
|
|
43
|
-
icon &&
|
|
44
|
-
|
|
35
|
+
return (React.createElement(React.Fragment, null,
|
|
36
|
+
icon && React.createElement(Icon, { name: icon, size: size }),
|
|
37
|
+
React.createElement(Typography, { element: "span", fontWeight: "extraBold", fontFamily: "base", size: getTypeSizes(size) }, label)));
|
|
45
38
|
}
|
|
46
39
|
function getTypeSizes(size) {
|
|
47
40
|
switch (size) {
|
|
@@ -54,4 +47,4 @@ function getTypeSizes(size) {
|
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
export { Button as B };
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
require('../style-inject.es-9d2f5f4e.js');
|
|
11
|
-
require('../Icon-405a216c.js');
|
|
12
|
-
require('@jobber/design');
|
|
13
|
-
require('../Typography-83915c54.js');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.ButtonDismiss = ButtonDismiss.ButtonDismiss;
|
|
1
|
+
export { B as ButtonDismiss } from '../ButtonDismiss-85986110.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../Button-319d8fa0.js';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import 'react-router-dom';
|
|
6
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
7
|
+
import '../Icon-22723fe6.js';
|
|
8
|
+
import '@jobber/design';
|
|
9
|
+
import '../Typography-09952a2f.js';
|