@jobber/components 4.77.2 → 4.77.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Combobox/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Combobox = require('../Combobox-
|
|
5
|
+
var Combobox = require('../Combobox-d85ce78c.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('react-dom');
|
|
@@ -27,6 +27,7 @@ require('color');
|
|
|
27
27
|
require('../Tooltip-27771182.js');
|
|
28
28
|
require('framer-motion');
|
|
29
29
|
require('lodash/debounce');
|
|
30
|
+
require('lodash/noop');
|
|
30
31
|
require('@jobber/hooks/useAssert');
|
|
31
32
|
|
|
32
33
|
|
|
@@ -16,6 +16,7 @@ var reactPopper = require('react-popper');
|
|
|
16
16
|
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
17
17
|
var Chip = require('./Chip-c91fd6c8.js');
|
|
18
18
|
var debounce = require('lodash/debounce');
|
|
19
|
+
var noop = require('lodash/noop');
|
|
19
20
|
require('@jobber/design');
|
|
20
21
|
var useAssert = require('@jobber/hooks/useAssert');
|
|
21
22
|
|
|
@@ -25,6 +26,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
26
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
26
27
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
27
28
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
29
|
+
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
28
30
|
|
|
29
31
|
var css_248z$6 = ".m1w5vdUZ6rQ- {\n z-index: 1002;\n z-index: var(--elevation-tooltip);\n width: calc((16px * 4) * 3.75);\n width: calc(calc(16px * 4) * 3.75);\n width: calc(var(--space-extravagant) * 3.75);\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 margin-top: calc(16px / 2);\n margin-top: var(--space-small);\n border: calc(16px / 16) solid rgb(217, 223, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 2);\n border-radius: var(--radius-larger);\n overflow: auto;\n background: rgba(255, 255, 255, 1);\n background: var(--color-surface);\n}\n\n.jobber-retheme .m1w5vdUZ6rQ- {\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n}\n\n/* CAUTION: Tests for content visibility assume this class' presence hides the content\n* so please be careful if you change this class name, or the css rules within.\n*/\n\n.m1w5vdUZ6rQ-.Zlkv2HA096A- {\n display: none;\n visibility: hidden;\n}\n\n.m1w5vdUZ6rQ-:focus,\n.m1w5vdUZ6rQ-:focus-visible {\n outline: none;\n}\n\n.m1w5vdUZ6rQ-:focus-visible {\n box-shadow: 0px 0px 0px calc(16px / 8) rgba(255, 255, 255, 1),\n 0px 0px 0px calc(16px / 4) rgb(147, 161, 169);\n box-shadow: var(--shadow-focus);\n}\n\n.YQry-Rd6zfQ- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: sticky;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n bottom: 0;\n width: 100%;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.TcpqL34s4lI- {\n padding-bottom: calc(16px / 2);\n padding-bottom: var(--space-small);\n}\n";
|
|
30
32
|
var styles$6 = {"content":"m1w5vdUZ6rQ-","hidden":"Zlkv2HA096A-","actions":"YQry-Rd6zfQ-","actionPadding":"TcpqL34s4lI-"};
|
|
@@ -373,15 +375,9 @@ function useCombobox(selected, onSelect, options, onClose, multiSelect, onSearch
|
|
|
373
375
|
const shouldScroll = React.useRef(false);
|
|
374
376
|
const [open, setOpen] = React.useState(false);
|
|
375
377
|
const [searchValue, setSearchValue] = React.useState("");
|
|
376
|
-
const
|
|
377
|
-
const searchCallback = React.useCallback(debounce__default["default"]((value) => onSearch && onSearch(value), debounceTime), []);
|
|
378
|
-
const debouncedFilterOptions = React.useCallback((value) => {
|
|
379
|
-
const filtered = options.filter(option => {
|
|
380
|
-
return option.label.toLowerCase().includes(value.toLowerCase());
|
|
381
|
-
});
|
|
382
|
-
setInternalFilteredOptions(filtered);
|
|
383
|
-
}, []);
|
|
378
|
+
const searchCallback = React.useCallback(debounce__default["default"]((value) => onSearch === null || onSearch === void 0 ? void 0 : onSearch(value), debounceTime), [onSearch, debounceTime]);
|
|
384
379
|
const { handleClose, handleSelection } = useMakeComboboxHandlers(setOpen, setSearchValue, selected, shouldScroll, onSelect, multiSelect, onClose);
|
|
380
|
+
const internalFilteredOptions = options.filter(option => option.label.toLowerCase().includes(searchValue.toLowerCase()));
|
|
385
381
|
return {
|
|
386
382
|
wrapperRef,
|
|
387
383
|
searchValue,
|
|
@@ -394,7 +390,7 @@ function useCombobox(selected, onSelect, options, onClose, multiSelect, onSearch
|
|
|
394
390
|
handleClose,
|
|
395
391
|
handleSelection,
|
|
396
392
|
internalFilteredOptions,
|
|
397
|
-
handleSearchChange: onSearch ? searchCallback :
|
|
393
|
+
handleSearchChange: onSearch ? searchCallback : noop__default["default"],
|
|
398
394
|
};
|
|
399
395
|
}
|
|
400
396
|
|
package/dist/DataList/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var ReactDOM = require('react-dom');
|
|
|
26
26
|
var Checkbox = require('../Checkbox-1cdd5cf6.js');
|
|
27
27
|
var reactRouterDom = require('react-router-dom');
|
|
28
28
|
var AnimatedSwitcher = require('../AnimatedSwitcher-d1e1ddcf.js');
|
|
29
|
-
var Combobox = require('../Combobox-
|
|
29
|
+
var Combobox = require('../Combobox-d85ce78c.js');
|
|
30
30
|
var Chip = require('../Chip-c91fd6c8.js');
|
|
31
31
|
var debounce = require('lodash/debounce');
|
|
32
32
|
var InputText = require('../InputText-9e61365c.js');
|
|
@@ -345,21 +345,22 @@ function DataListHeaderTile({ headers, headerKey, visible = false, }) {
|
|
|
345
345
|
React__default["default"].createElement(Text.Text, { maxLines: "single" }, headers[headerKey]),
|
|
346
346
|
isSortable && (sortableItem === null || sortableItem === void 0 ? void 0 : sortableItem.options) && isDropDownOpen && (React__default["default"].createElement(DataListSortingOptions, { options: sortableItem.options, selectedOption: (sorting === null || sorting === void 0 ? void 0 : sorting.state) || null, onSelectChange: handleSelectChange, onClose: () => setIsDropDownOpen(false), optionsListRef: optionsListRef, dataListHeaderTileRef: dataListHeaderTileRef })),
|
|
347
347
|
(sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) === headerKey ? (React__default["default"].createElement(DataListSortingArrows, { order: sortingState.order })) : (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) !== headerKey && isSortable ? (React__default["default"].createElement(DataListSortingArrows, { order: "none" })) : null));
|
|
348
|
-
function toggleSorting(
|
|
349
|
-
const isSameKey =
|
|
348
|
+
function toggleSorting(newSortingKey, newId, newLabel, newOrder) {
|
|
349
|
+
const isSameKey = newSortingKey === (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key);
|
|
350
350
|
const isDescending = (sortingState === null || sortingState === void 0 ? void 0 : sortingState.order) === "desc";
|
|
351
|
-
if (isSameKey && isDescending &&
|
|
352
|
-
if (order === "desc")
|
|
353
|
-
return;
|
|
351
|
+
if (isSameKey && isDescending && newOrder === undefined) {
|
|
354
352
|
sorting === null || sorting === void 0 ? void 0 : sorting.onSort(undefined);
|
|
355
353
|
return;
|
|
356
354
|
}
|
|
357
|
-
const sortingOrder =
|
|
355
|
+
const sortingOrder = newOrder || (isSameKey && !isDescending ? "desc" : "asc");
|
|
356
|
+
setSorting(newSortingKey, newId, newLabel, sortingOrder);
|
|
357
|
+
}
|
|
358
|
+
function setSorting(newSortingKey, newId, newLabel, newOrder) {
|
|
358
359
|
sorting === null || sorting === void 0 ? void 0 : sorting.onSort({
|
|
359
|
-
key:
|
|
360
|
-
id,
|
|
361
|
-
label,
|
|
362
|
-
order:
|
|
360
|
+
key: newSortingKey,
|
|
361
|
+
id: newId,
|
|
362
|
+
label: newLabel,
|
|
363
|
+
order: newOrder,
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
366
|
function handleOnClick() {
|
|
@@ -379,7 +380,7 @@ function DataListHeaderTile({ headers, headerKey, visible = false, }) {
|
|
|
379
380
|
}
|
|
380
381
|
function handleSelectChange(newSortOption) {
|
|
381
382
|
if (sortableItem) {
|
|
382
|
-
|
|
383
|
+
setSorting(sortableItem.key, newSortOption.id, newSortOption.label, newSortOption.order);
|
|
383
384
|
}
|
|
384
385
|
setIsDropDownOpen(true);
|
|
385
386
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.77.
|
|
3
|
+
"version": "4.77.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"> 1%",
|
|
85
85
|
"IE 10"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "c9d875673aae72b4ba26698297d7c1f78af10db0"
|
|
88
88
|
}
|