@jobber/components 4.59.0 → 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/index.js +94 -105
- 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/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
package/dist/DataTable/index.js
CHANGED
|
@@ -1,89 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
require('react-router-dom');
|
|
25
|
-
require('../Typography-83915c54.js');
|
|
26
|
-
|
|
27
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
|
-
|
|
29
|
-
function _interopNamespace(e) {
|
|
30
|
-
if (e && e.__esModule) return e;
|
|
31
|
-
var n = Object.create(null);
|
|
32
|
-
if (e) {
|
|
33
|
-
Object.keys(e).forEach(function (k) {
|
|
34
|
-
if (k !== 'default') {
|
|
35
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
36
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () { return e[k]; }
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
n["default"] = e;
|
|
44
|
-
return Object.freeze(n);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
48
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
49
|
-
var jobberHooks__namespace = /*#__PURE__*/_interopNamespace(jobberHooks);
|
|
1
|
+
import { flexRender, getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
|
2
|
+
export { createColumnHelper } from '@tanstack/react-table';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import * as jobberHooks from '@jobber/hooks/useResizeObserver';
|
|
6
|
+
import { useResizeObserver, Breakpoints } from '@jobber/hooks/useResizeObserver';
|
|
7
|
+
import { s as styleInject } from '../style-inject.es-a0e1a0ba.js';
|
|
8
|
+
import { G as Glimmer } from '../Glimmer-d3be9219.js';
|
|
9
|
+
import { _ as __rest } from '../tslib.es6-5849cd88.js';
|
|
10
|
+
import { S as Select, a as SelectOption } from '../Option-7967170c.js';
|
|
11
|
+
import { B as Button } from '../Button-319d8fa0.js';
|
|
12
|
+
import { T as Text } from '../Text-703e2c21.js';
|
|
13
|
+
import '../Content-3354c281.js';
|
|
14
|
+
import '../FormField-99918ed4.js';
|
|
15
|
+
import 'uuid';
|
|
16
|
+
import 'react-hook-form';
|
|
17
|
+
import '../Icon-22723fe6.js';
|
|
18
|
+
import '@jobber/design';
|
|
19
|
+
import '../InputValidation-b6adff05.js';
|
|
20
|
+
import 'framer-motion';
|
|
21
|
+
import '../Spinner-5d8359b8.js';
|
|
22
|
+
import 'react-router-dom';
|
|
23
|
+
import '../Typography-09952a2f.js';
|
|
50
24
|
|
|
51
25
|
var css_248z$3 = ".m5A5oeRFaMs- {\n position: relative;\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n}\n\n.cY-5BrIIUg8- {\n overflow: auto;\n}\n\n.y8xnHe7fwrI- {\n width: 100%;\n border-collapse: collapse;\n text-align: left;\n}\n\n.y8xnHe7fwrI- thead tr th {\n padding: calc(16px * 1);\n padding: var(--space-base);\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n white-space: nowrap;\n}\n\n.y8xnHe7fwrI- thead tr th :first-child {\n display: -ms-flexbox;\n display: flex;\n}\n\n.y8xnHe7fwrI- tbody tr {\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n}\n\n.y8xnHe7fwrI- tbody tr:last-child {\n border-bottom: none;\n}\n\n.y8xnHe7fwrI- tbody tr td {\n padding: calc(16px * 1);\n padding: var(--space-base);\n}\n\n.y8xnHe7fwrI- tfoot {\n position: sticky;\n z-index: 1;\n width: 100%;\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 border-top: calc(16px / 8) solid rgb(225, 225, 225);\n border-top: var(--border-thick) solid var(--color-border);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n bottom: 0;\n}\n\n.y8xnHe7fwrI- tfoot tr th {\n padding: calc(16px * 1);\n padding: var(--space-base);\n}\n\n.t8QYvdtkQXQ- thead tr th:first-child,\n.t8QYvdtkQXQ- tbody tr td:first-child {\n position: sticky;\n left: 0;\n z-index: 1;\n height: calc((16px * 3) + (16px / 4));\n height: calc(calc(16px * 3) + calc(16px / 4));\n height: calc(var(--space-largest) + var(--space-smaller));\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.t8QYvdtkQXQ- th:first-child::after,\n.t8QYvdtkQXQ- td:first-child::after {\n content: \"\";\n display: block;\n position: absolute;\n top: 0;\n right: calc(-1 * (16px / 2));\n right: calc(-1 * calc(16px / 2));\n right: calc(-1 * var(--space-small));\n width: calc(16px / 2);\n width: var(--space-small);\n height: 100%;\n background: linear-gradient(\n 90deg,\n rgba(0, 0, 0, 0.1) 0%,\n rgba(0, 0, 0, 0) 80%\n );\n background: linear-gradient(\n 90deg,\n rgba(var(--color-black--rgb), 0.1) 0%,\n rgba(var(--color-black--rgb), 0) 80%\n );\n}\n\n.Y21JuHX6fhk- {\n position: sticky;\n top: 0;\n right: 0;\n left: 0;\n z-index: 2;\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 background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.PJEX8dlqCMA-:first-child:hover {\n background: rgb(250, 246, 219);\n background: var(--color-surface--hover);\n cursor: pointer;\n}\n\n._9ps4aWGs8W0-:hover {\n background: rgb(250, 246, 219);\n background: var(--color-surface--hover);\n cursor: pointer;\n}\n\n._59XEEB8l5pI-:hover,\n._59XEEB8l5pI-:hover :first-child {\n background: rgb(244, 244, 244);\n background: var(--color-surface--background);\n cursor: pointer;\n}\n\n.a2BGGBkY5J8- {\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n -ms-flex-direction: column;\n flex-direction: column;\n top: calc(16px * 3);\n top: var(--space-largest);\n right: 0;\n bottom: calc(16px * 3);\n bottom: var(--space-largest);\n left: 0;\n width: 100%;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-align: center;\n align-items: center;\n}\n";
|
|
52
26
|
var styles$3 = {"dataTableContainer":"m5A5oeRFaMs-","tableContainer":"cY-5BrIIUg8-","table":"y8xnHe7fwrI-","pinFirstColumn":"t8QYvdtkQXQ-","stickyHeader":"Y21JuHX6fhk-","pinFirstHeaderSortable":"PJEX8dlqCMA-","sortableColumn":"_9ps4aWGs8W0-","clickableRow":"_59XEEB8l5pI-","emptyState":"a2BGGBkY5J8-"};
|
|
53
|
-
|
|
27
|
+
styleInject(css_248z$3);
|
|
54
28
|
|
|
55
29
|
function BodyLoading({ table }) {
|
|
56
30
|
const loaderRows = table.getState().pagination.pageSize;
|
|
57
31
|
const loaderColumns = table.getAllColumns().length;
|
|
58
|
-
return (
|
|
59
|
-
|
|
32
|
+
return (React.createElement("tbody", null, Array.from(Array(loaderRows).keys()).map(row => (React.createElement("tr", { key: row }, Array.from(Array(loaderColumns).keys()).map(arr => (React.createElement("td", { key: arr },
|
|
33
|
+
React.createElement(Glimmer, null)))))))));
|
|
60
34
|
}
|
|
61
35
|
|
|
62
36
|
function Body({ table, onRowClick, emptyState, loading, }) {
|
|
63
|
-
const bodyRowClasses =
|
|
64
|
-
const handleRowClick =
|
|
37
|
+
const bodyRowClasses = classnames({ [styles$3.clickableRow]: !!onRowClick });
|
|
38
|
+
const handleRowClick = useCallback((row) => () => {
|
|
65
39
|
if (onRowClick == undefined)
|
|
66
40
|
return;
|
|
67
41
|
onRowClick(row);
|
|
68
42
|
}, [onRowClick]);
|
|
69
43
|
if (loading) {
|
|
70
|
-
return
|
|
44
|
+
return React.createElement(BodyLoading, { table: table });
|
|
71
45
|
}
|
|
72
|
-
return (
|
|
73
|
-
return (
|
|
74
|
-
return (
|
|
46
|
+
return (React.createElement(React.Fragment, null, table.getRowModel().rows.length ? (React.createElement("tbody", null, table.getRowModel().rows.map(row => {
|
|
47
|
+
return (React.createElement("tr", { key: row.id, onClick: handleRowClick(row), className: bodyRowClasses }, row.getVisibleCells().map(cell => {
|
|
48
|
+
return (React.createElement("td", { key: cell.id, style: {
|
|
75
49
|
width: cell.column.getSize(),
|
|
76
50
|
minWidth: cell.column.columnDef.minSize,
|
|
77
51
|
maxWidth: cell.column.columnDef.maxSize,
|
|
78
|
-
} },
|
|
52
|
+
} }, flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
79
53
|
})));
|
|
80
|
-
}))) : (
|
|
54
|
+
}))) : (React.createElement("div", { className: classnames(styles$3.emptyState) }, emptyState))));
|
|
81
55
|
}
|
|
82
56
|
|
|
83
57
|
function createTableSettings(data, columns, options) {
|
|
84
58
|
var _a;
|
|
85
|
-
const _b = getPaginationSettings(options === null || options === void 0 ? void 0 : options.pagination), { state: paginationState } = _b, restPaginationSettings =
|
|
86
|
-
const _c = getSortingSettings(options === null || options === void 0 ? void 0 : options.sorting), { state: sortingState } = _c, restSortingSettings =
|
|
59
|
+
const _b = getPaginationSettings(options === null || options === void 0 ? void 0 : options.pagination), { state: paginationState } = _b, restPaginationSettings = __rest(_b, ["state"]);
|
|
60
|
+
const _c = getSortingSettings(options === null || options === void 0 ? void 0 : options.sorting), { state: sortingState } = _c, restSortingSettings = __rest(_c, ["state"]);
|
|
87
61
|
let initialPatinationState;
|
|
88
62
|
if ((_a = options === null || options === void 0 ? void 0 : options.pagination) === null || _a === void 0 ? void 0 : _a.itemsPerPage) {
|
|
89
63
|
initialPatinationState = {
|
|
@@ -92,7 +66,7 @@ function createTableSettings(data, columns, options) {
|
|
|
92
66
|
};
|
|
93
67
|
}
|
|
94
68
|
const tableSettings = Object.assign(Object.assign(Object.assign({ data,
|
|
95
|
-
columns, state: Object.assign(Object.assign({}, paginationState), sortingState), getCoreRowModel:
|
|
69
|
+
columns, state: Object.assign(Object.assign({}, paginationState), sortingState), getCoreRowModel: getCoreRowModel() }, restPaginationSettings), restSortingSettings), { initialState: {
|
|
96
70
|
pagination: initialPatinationState,
|
|
97
71
|
} });
|
|
98
72
|
return tableSettings;
|
|
@@ -111,7 +85,7 @@ function getPaginationSettings(pagination) {
|
|
|
111
85
|
paginationSettings.onPaginationChange = onPaginationChange;
|
|
112
86
|
}
|
|
113
87
|
else {
|
|
114
|
-
paginationSettings.getPaginationRowModel =
|
|
88
|
+
paginationSettings.getPaginationRowModel = getPaginationRowModel();
|
|
115
89
|
}
|
|
116
90
|
return paginationSettings;
|
|
117
91
|
}
|
|
@@ -128,14 +102,14 @@ function getSortingSettings(sorting) {
|
|
|
128
102
|
sortingSettings.enableSortingRemoval = enableSortingRemoval !== null && enableSortingRemoval !== void 0 ? enableSortingRemoval : true;
|
|
129
103
|
}
|
|
130
104
|
else {
|
|
131
|
-
sortingSettings.getSortedRowModel =
|
|
105
|
+
sortingSettings.getSortedRowModel = getSortedRowModel();
|
|
132
106
|
}
|
|
133
107
|
return sortingSettings;
|
|
134
108
|
}
|
|
135
109
|
|
|
136
110
|
var css_248z$2 = ".zn0VRVhObt0- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: justify;\n justify-content: space-between;\n min-height: calc((16px / 4) + (16px * 3));\n min-height: calc(calc(16px / 4) + calc(16px * 3));\n min-height: calc(var(--space-smaller) + var(--space-largest));\n padding: calc(16px / 2) calc(16px * 1);\n padding: var(--space-small) var(--space-base);\n border-top: calc(16px / 16) solid rgb(225, 225, 225);\n border-top: var(--border-base) solid var(--color-border);\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n gap: calc(16px / 2);\n gap: var(--space-small);\n}\n\n._1d4uh90gfSI- {\n -ms-flex: 9999;\n flex: 9999;\n white-space: nowrap;\n}\n\n._5Hh01rJlUDs- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: justify;\n justify-content: space-between;\n gap: calc(16px * 1);\n gap: var(--space-base);\n -ms-flex: 1;\n flex: 1;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n min-width: -webkit-fit-content;\n min-width: -moz-fit-content;\n min-width: fit-content;\n}\n\n.N5rXFBBzPxk- {\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 gap: calc(16px / 2);\n gap: var(--space-small);\n min-width: calc(3 * (16px * 3) + (16px / 2));\n min-width: calc(3 * calc(16px * 3) + calc(16px / 2));\n min-width: calc(3 * var(--space-largest) + var(--space-small));\n}\n\n.Uq2TUaf9ang- {\n min-width: calc((16px * 4) + (16px / 4));\n min-width: calc(calc(16px * 4) + calc(16px / 4));\n min-width: calc(var(--space-extravagant) + var(--space-smaller));\n}\n\n.PeLwUZ2wWPI- {\n display: -ms-flexbox;\n display: flex;\n gap: calc(16px * 1.5);\n gap: var(--space-large);\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n@media (max-width: 489.98px) {\n\n.PeLwUZ2wWPI- {\n gap: calc(16px * 1);\n gap: var(--space-base);\n}\n }\n\n@media (--small-screens-and-below) {\n\n.PeLwUZ2wWPI- {\n gap: calc(16px * 1);\n gap: var(--space-base);\n}\n }\n";
|
|
137
111
|
var styles$2 = {"pagination":"zn0VRVhObt0-","paginationInfo":"_1d4uh90gfSI-","paginationNav":"_5Hh01rJlUDs-","paginationSelect":"N5rXFBBzPxk-","paginationSelectLabel":"Uq2TUaf9ang-","paginationButtons":"PeLwUZ2wWPI-"};
|
|
138
|
-
|
|
112
|
+
styleInject(css_248z$2);
|
|
139
113
|
|
|
140
114
|
const defaultItemsPerPageOptions = ["10", "20", "30", "40", "50"];
|
|
141
115
|
function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, }) {
|
|
@@ -143,22 +117,22 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
|
|
|
143
117
|
const totalRows = totalItems;
|
|
144
118
|
const firstPosition = pageIndex * pageSize + 1;
|
|
145
119
|
const secondPosition = Math.min(totalRows, pageSize * (pageIndex + 1));
|
|
146
|
-
const itemsPerPageOptions =
|
|
147
|
-
return secondPosition <= 0 ? (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
120
|
+
const itemsPerPageOptions = useMemo(() => { var _a; return (_a = itemsPerPage === null || itemsPerPage === void 0 ? void 0 : itemsPerPage.map(item => String(item))) !== null && _a !== void 0 ? _a : defaultItemsPerPageOptions; }, [itemsPerPage]);
|
|
121
|
+
return secondPosition <= 0 ? (React.createElement("div", { className: styles$2.pagination },
|
|
122
|
+
React.createElement("div", { className: styles$2.paginationInfo }, !loading ? React.createElement(Text, null, "No items") : React.createElement(Glimmer, { width: 200 })))) : (React.createElement("div", { className: styles$2.pagination },
|
|
123
|
+
React.createElement("div", { className: styles$2.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
|
|
124
|
+
React.createElement("div", { className: styles$2.paginationNav },
|
|
125
|
+
React.createElement("div", { className: styles$2.paginationSelect },
|
|
126
|
+
React.createElement(Select, { value: table.getState().pagination.pageSize, onChange: value => {
|
|
153
127
|
table.setPageSize(Number(value));
|
|
154
|
-
}, size: "small" }, itemsPerPageOptions.map(numOfPages => (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
}, size: "small" }, itemsPerPageOptions.map(numOfPages => (React.createElement(SelectOption, { key: numOfPages, value: numOfPages }, numOfPages)))),
|
|
129
|
+
React.createElement("span", { className: styles$2.paginationSelectLabel }, "per page")),
|
|
130
|
+
React.createElement("div", { className: styles$2.paginationButtons },
|
|
131
|
+
React.createElement(Button, { type: "secondary", variation: "subtle", icon: "arrowLeft", ariaLabel: "arrowLeft", onClick: () => {
|
|
158
132
|
table.previousPage();
|
|
159
133
|
onPageChange();
|
|
160
134
|
}, disabled: !table.getCanPreviousPage() }),
|
|
161
|
-
|
|
135
|
+
React.createElement(Button, { type: "secondary", variation: "subtle", icon: "arrowRight", ariaLabel: "arrowRight", onClick: () => {
|
|
162
136
|
table.nextPage();
|
|
163
137
|
onPageChange();
|
|
164
138
|
}, disabled: !table.getCanNextPage() })))));
|
|
@@ -166,31 +140,31 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
|
|
|
166
140
|
|
|
167
141
|
var css_248z$1 = "._0FexNr-lIgA- {\n padding: calc(16px * 1);\n padding: var(--space-base);\n border-top: calc(16px / 8) solid rgb(225, 225, 225);\n border-top: var(--border-thick) solid var(--color-border);\n}\n\n.PKlqQjoQ6DY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-pack: justify;\n justify-content: space-between;\n font-weight: bold;\n}\n\n.PKlqQjoQ6DY- * {\n text-align: left;\n}\n\n.ItTcVYUbVNM-,\n.ItTcVYUbVNM- * {\n font-weight: normal;\n text-align: right;\n}\n\n.PKlqQjoQ6DY-:not(:last-child) {\n padding-bottom: calc(16px / 2);\n padding-bottom: var(--space-small);\n}\n";
|
|
168
142
|
var styles$1 = {"mobileFooterContainer":"_0FexNr-lIgA-","mobileFooterRow":"PKlqQjoQ6DY-","mobileFooterRowData":"ItTcVYUbVNM-"};
|
|
169
|
-
|
|
143
|
+
styleInject(css_248z$1);
|
|
170
144
|
|
|
171
|
-
const DesktopView = ({ table }) => (
|
|
145
|
+
const DesktopView = ({ table }) => (React.createElement("tfoot", { "data-testid": "data-table-desktop-footer" }, table.getFooterGroups().map(footerGroup => (React.createElement("tr", { key: footerGroup.id }, footerGroup.headers.map(header => (React.createElement("th", { key: header.id, style: {
|
|
172
146
|
width: header.getSize(),
|
|
173
147
|
minWidth: header.column.columnDef.minSize,
|
|
174
148
|
maxWidth: header.column.columnDef.maxSize,
|
|
175
|
-
} },
|
|
176
|
-
const HandheldView = ({ table }) => (
|
|
149
|
+
} }, flexRender(header.column.columnDef.footer, header.getContext())))))))));
|
|
150
|
+
const HandheldView = ({ table }) => (React.createElement("div", { className: styles$1.mobileFooterContainer, "data-testid": "data-table-handheld-footer" }, table.getFooterGroups().map(footerGroup => (React.createElement("div", { key: footerGroup.id }, footerGroup.headers
|
|
177
151
|
.filter(header => header.column.columnDef.footer)
|
|
178
|
-
.map((header, index) => (
|
|
179
|
-
|
|
180
|
-
|
|
152
|
+
.map((header, index) => (React.createElement(React.Fragment, null, index === 0 ? (React.createElement("div", { className: styles$1.mobileFooterRow }, flexRender(header.column.columnDef.footer, header.getContext()))) : (React.createElement("div", { className: styles$1.mobileFooterRow, key: footerGroup.id },
|
|
153
|
+
flexRender(header.column.columnDef.header, header.getContext()),
|
|
154
|
+
React.createElement("div", { className: styles$1.mobileFooterRowData }, flexRender(header.column.columnDef.footer, header.getContext()))))))))))));
|
|
181
155
|
const Footer = ({ table, viewType = "handheld", }) => {
|
|
182
156
|
const hasFooter = table
|
|
183
157
|
.getAllColumns()
|
|
184
158
|
.find(column => column.columnDef.footer);
|
|
185
159
|
if (hasFooter) {
|
|
186
|
-
return viewType === "handheld" ? (
|
|
160
|
+
return viewType === "handheld" ? (React.createElement(HandheldView, { table: table })) : (React.createElement(DesktopView, { table: table }));
|
|
187
161
|
}
|
|
188
162
|
return null;
|
|
189
163
|
};
|
|
190
164
|
|
|
191
165
|
var css_248z = ".wtb8keLFxgc- {\n padding-right: calc(16px / 2);\n padding-right: var(--space-small);\n}\n.wtb8keLFxgc- path {\n fill: rgba(101, 120, 132, 1);\n fill: var(--color-greyBlue);\n}\n.wtb8keLFxgc- path.TUkZiGiR6hc- {\n fill: rgb(1, 41, 57);\n fill: var(--color-blue);\n}\n.wtb8keLFxgc- path.HkPlMeyz3rM- {\n fill: rgb(193, 201, 206);\n fill: var(--color-greyBlue--lighter);\n}\n";
|
|
192
166
|
var styles = {"sortIcon":"wtb8keLFxgc-","active":"TUkZiGiR6hc-","inactive":"HkPlMeyz3rM-"};
|
|
193
|
-
|
|
167
|
+
styleInject(css_248z);
|
|
194
168
|
|
|
195
169
|
var SortDirection;
|
|
196
170
|
(function (SortDirection) {
|
|
@@ -206,30 +180,30 @@ const sortStyleIndex = [
|
|
|
206
180
|
},
|
|
207
181
|
{
|
|
208
182
|
option: SortDirection.ascending,
|
|
209
|
-
upArrowStyle:
|
|
210
|
-
downArrowStyle:
|
|
183
|
+
upArrowStyle: classnames(styles.active),
|
|
184
|
+
downArrowStyle: classnames(styles.inactive),
|
|
211
185
|
},
|
|
212
186
|
{
|
|
213
187
|
option: SortDirection.descending,
|
|
214
|
-
upArrowStyle:
|
|
215
|
-
downArrowStyle:
|
|
188
|
+
upArrowStyle: classnames(styles.inactive),
|
|
189
|
+
downArrowStyle: classnames(styles.active),
|
|
216
190
|
},
|
|
217
191
|
];
|
|
218
192
|
function SortIcon({ direction }) {
|
|
219
193
|
const foundStyle = sortStyleIndex.find(style => style.option === direction);
|
|
220
194
|
const finalStyle = foundStyle === undefined ? sortStyleIndex[0] : foundStyle;
|
|
221
|
-
return (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
195
|
+
return (React.createElement("div", { className: classnames(styles.sortIcon) },
|
|
196
|
+
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
197
|
+
React.createElement("path", { className: finalStyle.upArrowStyle, d: "M16.2929 10.6661C15.9024 11.0566 15.2692 11.0566 14.8787 10.6661L12.2891 8.14263L9.70711 10.6661C9.31658 11.0566 8.68342 11.0566 8.29289 10.6661C7.90237 10.2756 7.90237 9.64239 8.29289 9.25186L11.5858 5.95897C11.9763 5.56845 12.6095 5.56845 13 5.95897L16.2929 9.25186C16.6834 9.64239 16.6834 10.2756 16.2929 10.6661Z" }),
|
|
198
|
+
React.createElement("path", { className: finalStyle.downArrowStyle, d: "M8.29292 13.3339C8.68345 12.9434 9.31661 12.9434 9.70714 13.3339L12.2968 15.8573L14.8787 13.3339C15.2692 12.9434 15.9024 12.9434 16.2929 13.3339C16.6834 13.7244 16.6834 14.3576 16.2929 14.7481L13 18.041C12.6095 18.4315 11.9763 18.4315 11.5858 18.041L8.29292 14.7481C7.9024 14.3576 7.9024 13.7244 8.29292 13.3339Z" }))));
|
|
225
199
|
}
|
|
226
200
|
|
|
227
201
|
function Header({ table, stickyHeader, sorting, onRowClick, }) {
|
|
228
|
-
const stickyClass =
|
|
229
|
-
return (
|
|
202
|
+
const stickyClass = classnames({ [styles$3.stickyHeader]: stickyHeader });
|
|
203
|
+
return (React.createElement("thead", { className: stickyClass }, table.getHeaderGroups().map(headerGroup => (React.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map(header => {
|
|
230
204
|
const isSorting = sorting && header.column.getCanSort();
|
|
231
|
-
return (
|
|
232
|
-
?
|
|
205
|
+
return (React.createElement("th", { key: header.id, colSpan: header.colSpan, className: isSorting
|
|
206
|
+
? classnames(styles$3.sortableColumn, {
|
|
233
207
|
[styles$3.pinFirstHeaderSortable]: !!onRowClick,
|
|
234
208
|
})
|
|
235
209
|
: "", onClick: sorting ? header.column.getToggleSortingHandler() : undefined, style: {
|
|
@@ -237,47 +211,47 @@ function Header({ table, stickyHeader, sorting, onRowClick, }) {
|
|
|
237
211
|
minWidth: header.column.columnDef.minSize,
|
|
238
212
|
maxWidth: header.column.columnDef.maxSize,
|
|
239
213
|
paddingRight: isSorting ? 0 : "inherit",
|
|
240
|
-
} }, header.isPlaceholder ? null : (
|
|
241
|
-
|
|
242
|
-
|
|
214
|
+
} }, header.isPlaceholder ? null : (React.createElement("div", null,
|
|
215
|
+
React.createElement(React.Fragment, null,
|
|
216
|
+
flexRender(header.column.columnDef.header, header.getContext()),
|
|
243
217
|
header.column.getCanSort() &&
|
|
244
218
|
sorting &&
|
|
245
|
-
!header.column.getIsSorted() && (
|
|
219
|
+
!header.column.getIsSorted() && (React.createElement(SortIcon, { direction: SortDirection.equilibrium }))),
|
|
246
220
|
{
|
|
247
|
-
asc:
|
|
248
|
-
desc:
|
|
221
|
+
asc: React.createElement(SortIcon, { direction: SortDirection.ascending }),
|
|
222
|
+
desc: React.createElement(SortIcon, { direction: SortDirection.descending }),
|
|
249
223
|
}[header.column.getIsSorted()]))));
|
|
250
224
|
}))))));
|
|
251
225
|
}
|
|
252
226
|
|
|
253
227
|
function DataTable({ data, columns, pagination, sorting, height, stickyHeader, pinFirstColumn, onRowClick, emptyState, loading = false, }) {
|
|
254
|
-
const [ref, { exactWidth }] =
|
|
228
|
+
const [ref, { exactWidth }] = useResizeObserver();
|
|
255
229
|
const tableSettings = createTableSettings(data, columns, {
|
|
256
230
|
pagination,
|
|
257
231
|
sorting,
|
|
258
232
|
});
|
|
259
|
-
const tableClasses =
|
|
233
|
+
const tableClasses = classnames(styles$3.table, {
|
|
260
234
|
[styles$3.pinFirstColumn]: pinFirstColumn,
|
|
261
235
|
});
|
|
262
|
-
const table =
|
|
263
|
-
return (
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
236
|
+
const table = useReactTable(tableSettings);
|
|
237
|
+
return (React.createElement("div", { className: styles$3.dataTableContainer },
|
|
238
|
+
React.createElement("div", { "data-testid": "ATL-DataTable-Container", className: styles$3.tableContainer, style: { height }, ref: ref },
|
|
239
|
+
React.createElement("table", { className: tableClasses },
|
|
240
|
+
React.createElement(Header, { table: table, sorting: sorting, onRowClick: onRowClick, stickyHeader: stickyHeader }),
|
|
241
|
+
React.createElement(Body, { table: table, onRowClick: onRowClick, emptyState: emptyState, loading: loading }),
|
|
268
242
|
table.getRowModel().rows.length &&
|
|
269
243
|
exactWidth &&
|
|
270
|
-
exactWidth >
|
|
244
|
+
exactWidth > Breakpoints.small ? (React.createElement(Footer, { table: table, viewType: "desktop" })) : null)),
|
|
271
245
|
table.getRowModel().rows.length &&
|
|
272
246
|
exactWidth &&
|
|
273
|
-
exactWidth <=
|
|
274
|
-
pagination && (
|
|
247
|
+
exactWidth <= Breakpoints.small ? (React.createElement(Footer, { table: table })) : null,
|
|
248
|
+
pagination && (React.createElement(Pagination, { table: table, itemsPerPage: pagination.itemsPerPage, totalItems: pagination.manualPagination
|
|
275
249
|
? pagination.totalItems
|
|
276
250
|
: table.getCoreRowModel().rows.length, loading: loading, onPageChange: () => { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0); } }))));
|
|
277
251
|
}
|
|
278
252
|
|
|
279
253
|
const mockContainerWidth = (exactWidth) => {
|
|
280
|
-
jest.spyOn(
|
|
254
|
+
jest.spyOn(jobberHooks, "useResizeObserver").mockReturnValue([
|
|
281
255
|
{ current: null },
|
|
282
256
|
{
|
|
283
257
|
width: 1200,
|
|
@@ -288,9 +262,4 @@ const mockContainerWidth = (exactWidth) => {
|
|
|
288
262
|
]);
|
|
289
263
|
};
|
|
290
264
|
|
|
291
|
-
|
|
292
|
-
enumerable: true,
|
|
293
|
-
get: function () { return reactTable.createColumnHelper; }
|
|
294
|
-
});
|
|
295
|
-
exports.DataTable = DataTable;
|
|
296
|
-
exports.mockContainerWidth = mockContainerWidth;
|
|
265
|
+
export { DataTable, mockContainerWidth };
|
package/dist/DatePicker/index.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
require('react-router-dom');
|
|
14
|
-
require('../Icon-405a216c.js');
|
|
15
|
-
require('@jobber/design');
|
|
16
|
-
require('lodash/omit');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
exports.DatePicker = DatePicker.DatePicker;
|
|
1
|
+
export { D as DatePicker } from '../DatePicker-9f1e19a5.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import 'react-datepicker';
|
|
5
|
+
import '@jobber/hooks/useRefocusOnActivator';
|
|
6
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
7
|
+
import '../Typography-09952a2f.js';
|
|
8
|
+
import '../Button-319d8fa0.js';
|
|
9
|
+
import 'react-router-dom';
|
|
10
|
+
import '../Icon-22723fe6.js';
|
|
11
|
+
import '@jobber/design';
|
|
12
|
+
import 'lodash/omit';
|