@jobber/components 4.60.5 → 4.60.6
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/index.js +7 -19
- package/package.json +3 -4
- package/rollup.config.js +0 -1
|
@@ -7,9 +7,9 @@ var React = require('react');
|
|
|
7
7
|
var debounce = require('lodash/debounce');
|
|
8
8
|
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
9
9
|
var classnames = require('classnames');
|
|
10
|
-
var useEventListener = require('@use-it/event-listener');
|
|
11
10
|
var ReactDOM = require('react-dom');
|
|
12
11
|
var reactPopper = require('react-popper');
|
|
12
|
+
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
13
13
|
var Text = require('../Text-54334431.js');
|
|
14
14
|
var Icon = require('../Icon-405a216c.js');
|
|
15
15
|
var Heading = require('../Heading-4cde9989.js');
|
|
@@ -30,7 +30,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
30
30
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
31
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
32
32
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
33
|
-
var useEventListener__default = /*#__PURE__*/_interopDefaultLegacy(useEventListener);
|
|
34
33
|
|
|
35
34
|
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
35
|
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-"};
|
|
@@ -78,26 +77,26 @@ function Menu({ visible, options, selectedOption, onOptionSelect, attachTo, }) {
|
|
|
78
77
|
inline: "start",
|
|
79
78
|
});
|
|
80
79
|
}, [highlightedIndex]);
|
|
81
|
-
useOnKeyDown(
|
|
80
|
+
useOnKeyDown.useOnKeyDown((event) => {
|
|
82
81
|
const indexChange = arrowKeyPress(event, IndexChange.Next);
|
|
83
82
|
if (indexChange) {
|
|
84
83
|
setHighlightedIndex(Math.min(options.length - 1, highlightedIndex + indexChange));
|
|
85
84
|
}
|
|
86
|
-
});
|
|
87
|
-
useOnKeyDown(
|
|
85
|
+
}, "ArrowDown");
|
|
86
|
+
useOnKeyDown.useOnKeyDown((event) => {
|
|
88
87
|
const indexChange = arrowKeyPress(event, IndexChange.Previous);
|
|
89
88
|
if (indexChange) {
|
|
90
89
|
setHighlightedIndex(Math.max(0, highlightedIndex + indexChange));
|
|
91
90
|
}
|
|
92
|
-
});
|
|
93
|
-
useOnKeyDown(
|
|
91
|
+
}, "ArrowUp");
|
|
92
|
+
useOnKeyDown.useOnKeyDown((event) => {
|
|
94
93
|
if (!visible)
|
|
95
94
|
return;
|
|
96
95
|
if (isGroup(options[highlightedIndex]))
|
|
97
96
|
return;
|
|
98
97
|
event.preventDefault();
|
|
99
98
|
onOptionSelect(options[highlightedIndex]);
|
|
100
|
-
});
|
|
99
|
+
}, "Enter");
|
|
101
100
|
}
|
|
102
101
|
function arrowKeyPress(event, direction) {
|
|
103
102
|
if (!visible)
|
|
@@ -112,17 +111,6 @@ function Menu({ visible, options, selectedOption, onOptionSelect, attachTo, }) {
|
|
|
112
111
|
function isOptionSelected(selectedOption, option) {
|
|
113
112
|
return selectedOption && selectedOption.value === option.value;
|
|
114
113
|
}
|
|
115
|
-
// Split this out into a hooks package.
|
|
116
|
-
function useOnKeyDown(keyName, handler) {
|
|
117
|
-
// Pending: https://github.com/donavon/use-event-listener/pull/12
|
|
118
|
-
// The types in useEventListener mistakenly require a SyntheticEvent for the passed generic.
|
|
119
|
-
useEventListener__default["default"]("keydown", event => {
|
|
120
|
-
const newEvent = event;
|
|
121
|
-
if (newEvent.key === keyName) {
|
|
122
|
-
handler(newEvent);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
114
|
function isGroup(option) {
|
|
127
115
|
if (option.options)
|
|
128
116
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@jobber/design": "^0.47.0",
|
|
23
23
|
"@jobber/formatters": "*",
|
|
24
|
-
"@jobber/hooks": "^2.7.
|
|
24
|
+
"@jobber/hooks": "^2.7.1",
|
|
25
25
|
"@popperjs/core": "^2.0.6",
|
|
26
26
|
"@std-proposal/temporal": "0.0.1",
|
|
27
27
|
"@tanstack/react-table": "8.5.13",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"@types/react-router": "5.1.7",
|
|
32
32
|
"@types/react-router-dom": "^5.3.3",
|
|
33
33
|
"@types/uuid": "^8.3.3",
|
|
34
|
-
"@use-it/event-listener": "^0.1.3",
|
|
35
34
|
"axios": "^0.21.2",
|
|
36
35
|
"classnames": "^2.3.2",
|
|
37
36
|
"color": "^3.1.2",
|
|
@@ -84,5 +83,5 @@
|
|
|
84
83
|
"> 1%",
|
|
85
84
|
"IE 10"
|
|
86
85
|
],
|
|
87
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "b514c578d69d01182bb0b88080d1b39ea4f94235"
|
|
88
87
|
}
|