@jobber/components 4.78.0 → 4.78.2-JOB-87981.8
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
|
@@ -66,7 +66,7 @@ var css_248z$4 = ".SgMzjOcdE-E- {\n position: relative;\n padding: calc(16px /
|
|
|
66
66
|
var styles$4 = {"container":"SgMzjOcdE-E-","optionsList":"TwoTCjgcssc-","filterMessage":"_8T5M7MGwCRE-","emptyStateMessage":"_4y5NXkNeIQM-","scrollTop":"T6E3VwBGoQM-","scrollNone":"_6HQzxMQkXnE-","scrollBottom":"_5YsJZyMDkbA-","loadingContainer":"A6z4OI58xoE-"};
|
|
67
67
|
styleInject_es.styleInject(css_248z$4);
|
|
68
68
|
|
|
69
|
-
var css_248z$3 = "._5QdRGmaNHvc- {\n display: -ms-flexbox;\n display: flex;\n min-height: calc((calc(16px * 3) - calc(16px / 4)));\n min-height: calc((var(--space-largest) - var(--space-smaller)));\n box-sizing: border-box;\n margin: 0 calc(16px / 2);\n margin: 0 var(--space-small);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-radius: calc(16px / 4);\n border-radius: var(--radius-large);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n font-weight: 500;\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.jobber-retheme ._5QdRGmaNHvc- {\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n}\n\n._5QdRGmaNHvc-:hover,\n._5QdRGmaNHvc-:focus-visible {\n background-color: rgb(244, 246, 250);\n background-color: var(--color-surface--hover);\n}\n\n._5QdRGmaNHvc-:focus,\n._5QdRGmaNHvc-:focus-visible {\n outline: none;\n}\n\n._5QdRGmaNHvc-: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";
|
|
69
|
+
var css_248z$3 = "._5QdRGmaNHvc- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n min-height: calc((calc(16px * 3) - calc(16px / 4)));\n min-height: calc((var(--space-largest) - var(--space-smaller)));\n box-sizing: border-box;\n margin: 0 calc(16px / 2);\n margin: 0 var(--space-small);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-radius: calc(16px / 4);\n border-radius: var(--radius-large);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n font-weight: 500;\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.jobber-retheme ._5QdRGmaNHvc- {\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n}\n\n._5QdRGmaNHvc-:hover,\n._5QdRGmaNHvc-:focus-visible {\n background-color: rgb(244, 246, 250);\n background-color: var(--color-surface--hover);\n}\n\n._5QdRGmaNHvc-:focus,\n._5QdRGmaNHvc-:focus-visible {\n outline: none;\n}\n\n._5QdRGmaNHvc-: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";
|
|
70
70
|
var styles$3 = {"option":"_5QdRGmaNHvc-"};
|
|
71
71
|
styleInject_es.styleInject(css_248z$3);
|
|
72
72
|
|
|
@@ -82,7 +82,7 @@ function ComboboxOption(props) {
|
|
|
82
82
|
return (React__default["default"].createElement("li", { key: props.id, tabIndex: -1, "data-selected": isSelected, role: "option", "aria-selected": isSelected, onClick: () => selectionHandler &&
|
|
83
83
|
selectionHandler({ id: props.id, label: props.label }), className: classnames__default["default"](styles$3.option) },
|
|
84
84
|
props.label,
|
|
85
|
-
isSelected && React__default["default"].createElement(Icon.Icon, { name: "checkmark", color: "blue" })));
|
|
85
|
+
React__default["default"].createElement("div", null, isSelected && React__default["default"].createElement(Icon.Icon, { name: "checkmark", color: "blue" }))));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function ComboboxContentList(props) {
|
|
@@ -123,7 +123,7 @@ function useScrollState(optionsListRef, options) {
|
|
|
123
123
|
else if (scrollTop === 0) {
|
|
124
124
|
setlistScrollState("scrollTop");
|
|
125
125
|
}
|
|
126
|
-
else if (scrollTop + clientHeight
|
|
126
|
+
else if (scrollTop + clientHeight >= scrollHeight) {
|
|
127
127
|
setlistScrollState("scrollBottom");
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
@@ -39,6 +39,10 @@ export interface SortableOptions {
|
|
|
39
39
|
readonly label: string;
|
|
40
40
|
readonly order: "asc" | "desc";
|
|
41
41
|
}
|
|
42
|
+
export interface DataListSortable {
|
|
43
|
+
readonly key: string;
|
|
44
|
+
readonly options?: SortableOptions[];
|
|
45
|
+
}
|
|
42
46
|
export interface DataListProps<T extends DataListObject> {
|
|
43
47
|
/**
|
|
44
48
|
* The data to render in the DataList.
|
|
@@ -92,10 +96,7 @@ export interface DataListProps<T extends DataListObject> {
|
|
|
92
96
|
* `onSort`: The callback function when the user sorting a column.
|
|
93
97
|
*/
|
|
94
98
|
readonly sorting?: {
|
|
95
|
-
readonly sortable:
|
|
96
|
-
key: string;
|
|
97
|
-
options?: SortableOptions[];
|
|
98
|
-
}[];
|
|
99
|
+
readonly sortable: DataListSortable[];
|
|
99
100
|
readonly state: DataListSorting | undefined;
|
|
100
101
|
readonly onSort: (sorting?: DataListSorting) => void;
|
|
101
102
|
};
|
package/dist/DataList/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./DataList";
|
|
2
|
-
export { DataListItemType, DataListSorting, DataListSelectedType, DataListSelectedAllType, } from "./DataList.types";
|
|
2
|
+
export { DataListItemType, DataListSorting, DataListSortable, DataListSelectedType, DataListSelectedAllType, } from "./DataList.types";
|
package/dist/DataList/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var ReactDOM = require('react-dom');
|
|
|
26
26
|
var Checkbox = require('../Checkbox-99f6297f.js');
|
|
27
27
|
var reactRouterDom = require('react-router-dom');
|
|
28
28
|
var AnimatedSwitcher = require('../AnimatedSwitcher-3d45ec5d.js');
|
|
29
|
-
var Combobox = require('../Combobox-
|
|
29
|
+
var Combobox = require('../Combobox-1c91da1f.js');
|
|
30
30
|
var Chip = require('../Chip-c91fd6c8.js');
|
|
31
31
|
var debounce = require('lodash/debounce');
|
|
32
32
|
var InputText = require('../InputText-6e356985.js');
|
|
@@ -304,13 +304,13 @@ styleInject_es.styleInject(css_248z$8);
|
|
|
304
304
|
function DataListSortingOptions({ options, selectedOption, onSelectChange, onClose, optionsListRef, dataListHeaderTileRef, }) {
|
|
305
305
|
useRefocusOnActivator.useRefocusOnActivator(!optionsListRef.current);
|
|
306
306
|
useOnKeyDown.useOnKeyDown(() => onClose(), "Escape");
|
|
307
|
-
|
|
307
|
+
React.useEffect(() => {
|
|
308
308
|
document.addEventListener("mousedown", handleClickOutside);
|
|
309
309
|
return () => {
|
|
310
310
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
311
311
|
};
|
|
312
312
|
}, [optionsListRef, dataListHeaderTileRef, onClose]);
|
|
313
|
-
return (React__default["default"].createElement("ul", { className: styles$8.optionsList, ref: optionsListRef }, options.map(
|
|
313
|
+
return (React__default["default"].createElement("ul", { className: styles$8.optionsList, ref: optionsListRef }, options.map(option => (React__default["default"].createElement("li", { className: styles$8.option, key: option.id, onClick: () => onSelectChange(option), onKeyDown: event => handleKeyDown(event, option), tabIndex: 0, "data-value": option.id },
|
|
314
314
|
option.label,
|
|
315
315
|
option.label === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) && (React__default["default"].createElement(Icon.Icon, { name: "checkmark", color: "blue" })))))));
|
|
316
316
|
function handleKeyDown(event, option) {
|
|
@@ -320,9 +320,9 @@ function DataListSortingOptions({ options, selectedOption, onSelectChange, onClo
|
|
|
320
320
|
}
|
|
321
321
|
function handleClickOutside(event) {
|
|
322
322
|
var _a, _b;
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
if (!
|
|
323
|
+
const isClickInside = ((_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||
|
|
324
|
+
((_b = dataListHeaderTileRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target));
|
|
325
|
+
if (!isClickInside) {
|
|
326
326
|
onClose();
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -332,9 +332,9 @@ function DataListSortingOptions({ options, selectedOption, onSelectChange, onClo
|
|
|
332
332
|
function DataListHeaderTile({ headers, headerKey, visible = false, }) {
|
|
333
333
|
useRefocusOnActivator.useRefocusOnActivator(visible);
|
|
334
334
|
const { sorting } = useDataListContext();
|
|
335
|
-
const [isDropDownOpen, setIsDropDownOpen] =
|
|
335
|
+
const [isDropDownOpen, setIsDropDownOpen] = React.useState(false);
|
|
336
336
|
const optionsListRef = useFocusTrap.useFocusTrap(isDropDownOpen);
|
|
337
|
-
const dataListHeaderTileRef =
|
|
337
|
+
const dataListHeaderTileRef = React.useRef(null);
|
|
338
338
|
const sortableItem = sorting === null || sorting === void 0 ? void 0 : sorting.sortable.find(item => item.key === headerKey);
|
|
339
339
|
const isSortable = Boolean(sortableItem);
|
|
340
340
|
const sortingState = sorting === null || sorting === void 0 ? void 0 : sorting.state;
|
|
@@ -344,15 +344,15 @@ function DataListHeaderTile({ headers, headerKey, visible = false, }) {
|
|
|
344
344
|
}), onClick: handleOnClick, ref: dataListHeaderTileRef },
|
|
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
|
-
|
|
348
|
-
function toggleSorting(newSortingKey, newId, newLabel
|
|
347
|
+
isSortable && (React__default["default"].createElement(DataListSortingArrows, { order: (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) === headerKey ? sortingState.order : "none" }))));
|
|
348
|
+
function toggleSorting(newSortingKey, newId, newLabel) {
|
|
349
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
|
|
351
|
+
if (isSameKey && isDescending) {
|
|
352
352
|
sorting === null || sorting === void 0 ? void 0 : sorting.onSort(undefined);
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
const sortingOrder =
|
|
355
|
+
const sortingOrder = isSameKey ? "desc" : "asc";
|
|
356
356
|
setSorting(newSortingKey, newId, newLabel, sortingOrder);
|
|
357
357
|
}
|
|
358
358
|
function setSorting(newSortingKey, newId, newLabel, newOrder) {
|
|
@@ -371,11 +371,8 @@ function DataListHeaderTile({ headers, headerKey, visible = false, }) {
|
|
|
371
371
|
setIsDropDownOpen(!isDropDownOpen);
|
|
372
372
|
}
|
|
373
373
|
else {
|
|
374
|
-
const headerValue = headers[headerKey];
|
|
375
374
|
const id = ((_b = (_a = sortableItem === null || sortableItem === void 0 ? void 0 : sortableItem.options) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id) || headerKey;
|
|
376
|
-
|
|
377
|
-
toggleSorting(id, headerKey, headerValue);
|
|
378
|
-
}
|
|
375
|
+
toggleSorting(id, headerKey, headers[headerKey]);
|
|
379
376
|
}
|
|
380
377
|
}
|
|
381
378
|
function handleSelectChange(newSortOption) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.78.
|
|
3
|
+
"version": "4.78.2-JOB-87981.8+f4a2d66d",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@jobber/design": "^0.53.0",
|
|
23
|
-
"@jobber/formatters": "
|
|
24
|
-
"@jobber/hooks": "^2.8.
|
|
23
|
+
"@jobber/formatters": "^0.2.2",
|
|
24
|
+
"@jobber/hooks": "^2.8.2-JOB-87981.36+f4a2d66d",
|
|
25
25
|
"@popperjs/core": "^2.0.6",
|
|
26
26
|
"@std-proposal/temporal": "0.0.1",
|
|
27
27
|
"@tanstack/react-table": "8.5.13",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"> 1%",
|
|
85
85
|
"IE 10"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "f4a2d66d2549815555e05aec6c5fb09feb09f2c8"
|
|
88
88
|
}
|