@jobber/components 4.43.1 → 4.44.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/DataList/DataList.d.ts +5 -2
- package/dist/DataList/DataList.types.d.ts +16 -1
- package/dist/DataList/DataList.utils.d.ts +2 -1
- package/dist/DataList/components/DataListBulkActions/DataListBulkActions.const.d.ts +1 -0
- package/dist/DataList/components/DataListBulkActions/DataListBulkActions.d.ts +4 -0
- package/dist/DataList/components/DataListBulkActions/index.d.ts +1 -0
- package/dist/DataList/components/DataListOverflowFade/DataListOverflowFade.d.ts +6 -0
- package/dist/DataList/components/DataListOverflowFade/index.d.ts +2 -0
- package/dist/DataList/index.js +214 -158
- package/package.json +2 -2
- /package/dist/DataList/components/{DataListFilters/DataListFilter.const.d.ts → DataListOverflowFade/DataListOverflowFade.const.d.ts} +0 -0
|
@@ -6,7 +6,8 @@ import { DataListEmptyState } from "./components/DataListEmptyState";
|
|
|
6
6
|
import { DataListItemActions } from "./components/DataListItemActions";
|
|
7
7
|
import { DataListAction } from "./components/DataListAction";
|
|
8
8
|
import { DataListLayoutActions } from "./components/DataListLayoutActions";
|
|
9
|
-
import { DataListObject, DataListProps } from "./DataList.types";
|
|
9
|
+
import { DataListBulkActionProps, DataListObject, DataListProps } from "./DataList.types";
|
|
10
|
+
import { DataListBulkActions } from "./components/DataListBulkActions";
|
|
10
11
|
export declare function DataList<T extends DataListObject>({ sorting, ...props }: DataListProps<T>): JSX.Element;
|
|
11
12
|
export declare namespace DataList {
|
|
12
13
|
var Layout: typeof DataListLayout;
|
|
@@ -15,5 +16,7 @@ export declare namespace DataList {
|
|
|
15
16
|
var Filters: typeof DataListFilters;
|
|
16
17
|
var Search: typeof DataListSearch;
|
|
17
18
|
var ItemActions: typeof DataListItemActions;
|
|
18
|
-
var
|
|
19
|
+
var BulkActions: typeof DataListBulkActions;
|
|
20
|
+
var ItemAction: typeof DataListAction;
|
|
21
|
+
var BatchAction: (props: DataListBulkActionProps) => JSX.Element;
|
|
19
22
|
}
|
|
@@ -148,6 +148,7 @@ export interface DataListContextProps<T extends DataListObject> extends DataList
|
|
|
148
148
|
readonly emptyStateComponents?: ReactElement<DataListEmptyStateProps>[];
|
|
149
149
|
readonly layoutComponents?: ReactElement<DataListLayoutProps<T>>[];
|
|
150
150
|
readonly itemActionComponent?: ReactElement<DataListItemActionsProps<T>>;
|
|
151
|
+
readonly bulkActionsComponent?: ReactElement<DataListItemActionsProps<T>>;
|
|
151
152
|
}
|
|
152
153
|
export interface DataListLayoutContextProps {
|
|
153
154
|
readonly isInLayoutProvider: boolean;
|
|
@@ -174,6 +175,13 @@ interface BaseDataListItemActionsProps<T extends DataListObject> {
|
|
|
174
175
|
*/
|
|
175
176
|
readonly onClick?: (item: T) => void;
|
|
176
177
|
}
|
|
178
|
+
export interface DataListBulkActionsProps {
|
|
179
|
+
/**
|
|
180
|
+
* The actions to render on the top of the DataList to make actions to multiple items.
|
|
181
|
+
* This only accepts the DataList.BatchAction component.
|
|
182
|
+
*/
|
|
183
|
+
readonly children?: Fragment<ReactElement<DataListBulkActionProps>>;
|
|
184
|
+
}
|
|
177
185
|
interface DataListItemActionsPropsWithURL<T extends DataListObject> extends BaseDataListItemActionsProps<T> {
|
|
178
186
|
/**
|
|
179
187
|
* If a normal page navigation is needed, use this prop to change the element
|
|
@@ -207,6 +215,13 @@ export interface DataListActionProps<T extends DataListObject> {
|
|
|
207
215
|
*/
|
|
208
216
|
readonly onClick?: (data: T) => void;
|
|
209
217
|
}
|
|
218
|
+
export interface DataListBulkActionProps extends DataListActionProps<DataListObject> {
|
|
219
|
+
/**
|
|
220
|
+
* The callback function when the action is clicked.
|
|
221
|
+
*/
|
|
222
|
+
readonly onClick?: () => void;
|
|
223
|
+
}
|
|
210
224
|
export interface InternalDataListActionProps<T extends DataListObject> extends DataListActionProps<T> {
|
|
211
|
-
readonly item
|
|
225
|
+
readonly item?: T;
|
|
226
|
+
readonly onClick?: ((data: T) => void) | (() => void);
|
|
212
227
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import { DataListHeader, DataListItemType, DataListItemTypeFromHeader, DataListObject } from "./DataList.types";
|
|
3
3
|
import { Breakpoints } from "./DataList.const";
|
|
4
4
|
/**
|
|
@@ -18,3 +18,4 @@ export declare function generateListItemElement<T extends DataListObject>(item:
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<T, DataListHeader<T>> | undefined;
|
|
20
20
|
export declare function sortSizeProp(sizeProp: Breakpoints[]): ("xs" | "sm" | "md" | "lg" | "xl")[];
|
|
21
|
+
export declare function getExposedActions(childrenArray: ReactElement[], childCount?: number): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BULK_ACTIONS_CONTAINER_TEST_ID = "ATL-DataListBulkActions-Container";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataListBulkActions";
|
package/dist/DataList/index.js
CHANGED
|
@@ -21,17 +21,17 @@ var useFocusTrap = require('@jobber/hooks/useFocusTrap');
|
|
|
21
21
|
var useRefocusOnActivator = require('@jobber/hooks/useRefocusOnActivator');
|
|
22
22
|
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
23
23
|
var foundation = require('@jobber/design/foundation');
|
|
24
|
+
var isEmpty = require('lodash/isEmpty');
|
|
25
|
+
var InlineLabel = require('../InlineLabel-afd5fc6f.js');
|
|
24
26
|
var styles$f = require('@jobber/components/DataList/DataList.css');
|
|
25
27
|
require('uuid');
|
|
26
28
|
require('react-hook-form');
|
|
27
29
|
var Checkbox = require('../Checkbox-3bccf65c.js');
|
|
28
|
-
var isEmpty = require('lodash/isEmpty');
|
|
29
|
-
var InlineLabel = require('../InlineLabel-afd5fc6f.js');
|
|
30
30
|
var FormatDate = require('../FormatDate-70ea5b43.js');
|
|
31
31
|
var Heading = require('../Heading-a1191b15.js');
|
|
32
32
|
var AnimatedSwitcher = require('../AnimatedSwitcher-d1e1ddcf.js');
|
|
33
|
-
var Icon = require('../Icon-405a216c.js');
|
|
34
33
|
var useInView = require('@jobber/hooks/useInView');
|
|
34
|
+
var Icon = require('../Icon-405a216c.js');
|
|
35
35
|
var Popover = require('../Popover-bbfc6aa1.js');
|
|
36
36
|
var Content = require('../Content-2ca1ffe1.js');
|
|
37
37
|
var Chip = require('../Chip-4916a642.js');
|
|
@@ -52,12 +52,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
52
52
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
53
53
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
54
54
|
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
55
|
-
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles$f);
|
|
56
55
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
56
|
+
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles$f);
|
|
57
57
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
58
58
|
|
|
59
|
-
var css_248z$e = ".TkdrExYnvcY-,\n.TkdrExYnvcY- * {\n box-sizing: border-box;\n}\n\n.TkdrExYnvcY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n -ms-flex: 1;\n flex: 1;\n}\n\n/*\n * Header\n */\n\n.IcAlZHoB4LI- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 1;\n z-index: var(--elevation-base);\n margin-bottom: calc(16px / 2);\n margin-bottom: var(--space-small);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.TFO76ysivmg- {\n display: grid;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n gap: calc(16px / 2);\n grid-gap: calc(16px / 2);\n grid-gap: var(--space-small);\n gap: var(--space-small);\n grid-template-columns: auto -webkit-max-content;\n grid-template-columns: auto max-content;\n}\n\n.jGHZZYZm1ZY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: calc(16px * 3);\n min-height: var(--space-largest);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 8) solid rgb(225, 225, 225);\n border-bottom: var(--border-thick) solid var(--color-border);\n}\n\n.jMSVGIAr5tk- > p {\n font-weight: 500;\n}\n\n.jMSVGIAr5tk- {\n display: -ms-flexbox;\n display: flex;\n
|
|
60
|
-
var styles$e = {"wrapper":"TkdrExYnvcY-","titleContainer":"IcAlZHoB4LI-","headerFilters":"TFO76ysivmg-","headerTitles":"jGHZZYZm1ZY-","headerBatchSelect":"jMSVGIAr5tk-","listItem":"ise8kHCfhCY-","active":"Pc0JGX6jCD4-","listItemClickable":"Tq6e0BGwcSM-","selectable":"d-79rkMqufg-","selectAllCheckbox":"qm-SSuWTXkI-","visible":"VA9RnQp6nbI-","selected":"_4L7iXXzLr5k-","filtering":"Kkp-IYmwq-s-","filteringSpinner":"m-eCShL7TU4-"};
|
|
59
|
+
var css_248z$e = ".TkdrExYnvcY-,\n.TkdrExYnvcY- * {\n box-sizing: border-box;\n}\n\n.TkdrExYnvcY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n -ms-flex: 1;\n flex: 1;\n}\n\n/*\n * Header\n */\n\n.IcAlZHoB4LI- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 1;\n z-index: var(--elevation-base);\n margin-bottom: calc(16px / 2);\n margin-bottom: var(--space-small);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.TFO76ysivmg- {\n display: grid;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n gap: calc(16px / 2);\n grid-gap: calc(16px / 2);\n grid-gap: var(--space-small);\n gap: var(--space-small);\n grid-template-columns: auto -webkit-max-content;\n grid-template-columns: auto max-content;\n}\n\n.jGHZZYZm1ZY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: calc(16px * 3);\n min-height: var(--space-largest);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 8) solid rgb(225, 225, 225);\n border-bottom: var(--border-thick) solid var(--color-border);\n}\n\n.jMSVGIAr5tk- > p {\n font-weight: 500;\n white-space: nowrap;\n}\n\n.jMSVGIAr5tk- {\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n margin: calc((16px / 2) * -1) 0;\n margin: calc(calc(16px / 2) * -1) 0;\n margin: calc(var(--space-small) * -1) 0;\n -ms-flex-align: center;\n align-items: center;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n\n/*\n * List Item\n */\n\n.ise8kHCfhCY- {\n position: relative;\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n\n.ise8kHCfhCY-.Pc0JGX6jCD4-,\n.ise8kHCfhCY-:hover,\n.ise8kHCfhCY-:focus-within {\n --data-list-item-active-color: var(--color-surface--background);\n background-color: rgb(244, 244, 244);\n background-color: var(--data-list-item-active-color);\n}\n\n.Tq6e0BGwcSM- {\n display: block;\n margin: calc((16px / 2) * -1) 0;\n margin: calc(calc(16px / 2) * -1) 0;\n margin: calc(var(--space-small) * -1) 0;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n border: none;\n text-align: left;\n -webkit-text-decoration: none;\n text-decoration: none;\n background-color: transparent;\n cursor: pointer;\n}\n\n/**\n * Enable a better hover and focus experience when :has() is supported.\n * This is a workaround for Firefox where the :has() selector is not supported.\n */\n\n@supports selector(*:has(*)) {\n .ise8kHCfhCY-:hover,\n .ise8kHCfhCY-:focus-within {\n background-color: transparent;\n }\n\n .ise8kHCfhCY-:has(.Tq6e0BGwcSM-:hover, .Tq6e0BGwcSM-:focus) {\n background-color: var(--data-list-item-active-color);\n }\n}\n\n/*\n * List Item Selection\n */\n\n.d-79rkMqufg- {\n display: grid;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n@media (min-width: 768px) {\n\n.d-79rkMqufg- {\n -ms-flex-align: center;\n align-items: center;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n.d-79rkMqufg- {\n -ms-flex-align: center;\n align-items: center;\n}\n }\n\n.d-79rkMqufg-,\n.jGHZZYZm1ZY- .d-79rkMqufg- {\n grid-template-columns: -webkit-max-content minmax(0px, auto);\n grid-template-columns: max-content minmax(0px, auto);\n -webkit-column-gap: calc(16px / 2);\n -webkit-column-gap: var(--space-small);\n -moz-column-gap: calc(16px / 2);\n -moz-column-gap: var(--space-small);\n column-gap: calc(16px / 2);\n column-gap: var(--space-small);\n}\n\n.jGHZZYZm1ZY- .d-79rkMqufg- {\n display: grid;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.qm-SSuWTXkI- {\n display: -ms-flexbox;\n display: flex;\n visibility: hidden;\n\n /* To compensate the Checkbox's label margin that we are using for screen-readers */\n margin-right: calc((16px * 1) * -1);\n margin-right: calc(calc(16px * 1) * -1);\n margin-right: calc(var(--space-base) * -1);\n}\n\n.qm-SSuWTXkI-.VA9RnQp6nbI- {\n visibility: visible;\n}\n\n.ise8kHCfhCY- .d-79rkMqufg- > :first-child {\n -ms-flex-order: 2;\n order: 2;\n}\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n -ms-flex-order: 1;\n order: 1;\n padding-top: calc(16px / 4);\n padding-top: var(--space-smaller);\n opacity: 1;\n transition: opacity 100ms ease-in-out;\n transition: opacity var(--transition-properties);\n --transition-properties: var(--timing-quick) ease-in-out;\n}\n\n@media (min-width: 768px) {\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n padding-top: 0;\n opacity: 0;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n padding-top: 0;\n opacity: 0;\n}\n }\n\n.ise8kHCfhCY-:hover .d-79rkMqufg- > :last-child,\n.ise8kHCfhCY-:focus-within .d-79rkMqufg- > :last-child,\n.ise8kHCfhCY- .d-79rkMqufg-._4L7iXXzLr5k- > :last-child {\n opacity: 1;\n}\n\n/*\n * Filters\n */\n\n.Kkp-IYmwq-s- {\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.6);\n background-color: var(--color-overlay--dimmed);\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.m-eCShL7TU4- {\n position: sticky;\n top: 50vh;\n}\n\n.esUiRgWabYw- {\n position: absolute;\n top: auto;\n left: -10000px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n text-indent: -10000px;\n}\n";
|
|
60
|
+
var styles$e = {"wrapper":"TkdrExYnvcY-","titleContainer":"IcAlZHoB4LI-","headerFilters":"TFO76ysivmg-","headerTitles":"jGHZZYZm1ZY-","headerBatchSelect":"jMSVGIAr5tk-","listItem":"ise8kHCfhCY-","active":"Pc0JGX6jCD4-","listItemClickable":"Tq6e0BGwcSM-","selectable":"d-79rkMqufg-","selectAllCheckbox":"qm-SSuWTXkI-","visible":"VA9RnQp6nbI-","selected":"_4L7iXXzLr5k-","filtering":"Kkp-IYmwq-s-","filteringSpinner":"m-eCShL7TU4-","srOnly":"esUiRgWabYw-"};
|
|
61
61
|
styleInject_es.styleInject(css_248z$e);
|
|
62
62
|
|
|
63
63
|
var css_248z$d = ".F56prQsXm3A- {\n min-width: 80px;\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n";
|
|
@@ -122,10 +122,18 @@ _) {
|
|
|
122
122
|
}
|
|
123
123
|
function InternalDataListAction({ label, icon, destructive, onClick, item, }) {
|
|
124
124
|
const color = destructive ? "critical" : "blue";
|
|
125
|
-
return (React__default["default"].createElement("button", { className: styles$a.action, onClick:
|
|
125
|
+
return (React__default["default"].createElement("button", { className: styles$a.action, onClick: handleClick },
|
|
126
126
|
icon && React__default["default"].createElement(Icon.Icon, { name: icon, color: color }),
|
|
127
127
|
React__default["default"].createElement(Typography.Typography, { textColor: color },
|
|
128
128
|
React__default["default"].createElement("span", { className: styles$a.label }, label))));
|
|
129
|
+
function handleClick() {
|
|
130
|
+
if (item) {
|
|
131
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
var css_248z$9 = ".aokwZU8jbWU- {\n position: fixed;\n top: 0;\n top: var(--actions-menu-y, 0);\n left: 0;\n left: var(--actions-menu-x, 0);\n z-index: 6;\n z-index: var(--elevation-menu);\n min-width: 150px;\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 / 4);\n padding: var(--space-smaller);\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 2);\n border-radius: var(--radius-larger);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.XtVRP97TVSE- {\n position: fixed;\n top: 0;\n left: 0;\n z-index: calc(6 - 1);\n z-index: calc(var(--elevation-menu) - 1);\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n background-color: transparent;\n}\n";
|
|
@@ -192,7 +200,7 @@ function DataListItemActionsOverflow({ item, actions, }) {
|
|
|
192
200
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
193
201
|
React__default["default"].createElement(Tooltip.Tooltip, { message: "More actions" },
|
|
194
202
|
React__default["default"].createElement(Button.Button, { icon: "more", ariaLabel: "More actions", type: "secondary", variation: "subtle", onClick: handleMoreClick })),
|
|
195
|
-
|
|
203
|
+
actions && (React__default["default"].createElement(DataListActionsMenu, { visible: showMenu, position: menuPosition, onRequestClose: handleClose }, React.Children.map(actions, action => (React__default["default"].createElement(InternalDataListAction, Object.assign({}, action.props, { item: item }))))))));
|
|
196
204
|
function handleMoreClick(event) {
|
|
197
205
|
setShowMenu(true);
|
|
198
206
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
@@ -205,111 +213,6 @@ function DataListItemActionsOverflow({ item, actions, }) {
|
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
|
|
208
|
-
// This component is meant to capture the props of the DataList.ItemActions
|
|
209
|
-
function DataListItemActions(
|
|
210
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
211
|
-
_) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
const variants = {
|
|
215
|
-
hidden: { opacity: 0, y: 10 },
|
|
216
|
-
visible: { opacity: 1, y: 0 },
|
|
217
|
-
};
|
|
218
|
-
function InternalDataListItemActions({ item, }) {
|
|
219
|
-
const { itemActionComponent } = useDataListContext();
|
|
220
|
-
if (!itemActionComponent)
|
|
221
|
-
return null;
|
|
222
|
-
const { children } = itemActionComponent.props;
|
|
223
|
-
const childrenArray = React.Children.toArray(children).filter(React.isValidElement);
|
|
224
|
-
const exposedActions = getExposedActions(childrenArray);
|
|
225
|
-
childrenArray.splice(0, exposedActions.length);
|
|
226
|
-
return (React__default["default"].createElement(framerMotion.motion.div, { variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
|
|
227
|
-
duration: TRANSITION_DURATION_IN_SECONDS,
|
|
228
|
-
delay: TRANSITION_DELAY_IN_SECONDS,
|
|
229
|
-
}, className: styles$b.menu, onContextMenu: handleContextMenu },
|
|
230
|
-
exposedActions.map(({ props }) => {
|
|
231
|
-
if (!props.icon)
|
|
232
|
-
return null;
|
|
233
|
-
return (React__default["default"].createElement(Tooltip.Tooltip, { key: props.label, message: props.label },
|
|
234
|
-
React__default["default"].createElement(Button.Button, { icon: props.icon, ariaLabel: props.label, onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, item); }, type: "secondary", variation: "subtle" })));
|
|
235
|
-
}),
|
|
236
|
-
React__default["default"].createElement(DataListItemActionsOverflow, { actions: childrenArray, item: item })));
|
|
237
|
-
}
|
|
238
|
-
function handleContextMenu(event) {
|
|
239
|
-
event.stopPropagation();
|
|
240
|
-
}
|
|
241
|
-
function getExposedActions(childrenArray) {
|
|
242
|
-
const firstTwoChildren = childrenArray.slice(0, 2);
|
|
243
|
-
return firstTwoChildren.reduce((result, child, i) => {
|
|
244
|
-
const hasIcon = Boolean(child.props.icon);
|
|
245
|
-
const isFirstChild = i === 0;
|
|
246
|
-
if (isFirstChild && hasIcon) {
|
|
247
|
-
return [...result, child];
|
|
248
|
-
}
|
|
249
|
-
const isSecondChild = i === 1;
|
|
250
|
-
const hasFirstChild = result.length === 1;
|
|
251
|
-
if (isSecondChild && hasIcon && hasFirstChild) {
|
|
252
|
-
return [...result, child];
|
|
253
|
-
}
|
|
254
|
-
return result;
|
|
255
|
-
}, []);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const DataListLayoutActionsContext = React.createContext({ activeItem: undefined });
|
|
259
|
-
function useDataListLayoutActionsContext() {
|
|
260
|
-
return React.useContext(DataListLayoutActionsContext);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function DataListItemInternal({ children, item, }) {
|
|
264
|
-
const { selected, onSelect } = useDataListContext();
|
|
265
|
-
if (selected !== undefined && onSelect) {
|
|
266
|
-
return (React__default["default"].createElement("div", { className: classnames__default["default"](styles__default["default"].selectable, {
|
|
267
|
-
[styles__default["default"].selected]: selected === null || selected === void 0 ? void 0 : selected.length,
|
|
268
|
-
}) },
|
|
269
|
-
children,
|
|
270
|
-
React__default["default"].createElement(Checkbox.Checkbox, { checked: selected === null || selected === void 0 ? void 0 : selected.includes(item.id), onChange: handleChange })));
|
|
271
|
-
}
|
|
272
|
-
return children;
|
|
273
|
-
function handleChange() {
|
|
274
|
-
if (selected === null || selected === void 0 ? void 0 : selected.includes(item.id)) {
|
|
275
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected === null || selected === void 0 ? void 0 : selected.filter(id => id !== item.id));
|
|
276
|
-
}
|
|
277
|
-
else if (selected) {
|
|
278
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect([...selected, item.id]);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function DataListItemClickableInternal({ onClick, url, to, children, }) {
|
|
284
|
-
const { activeItem } = useDataListLayoutActionsContext();
|
|
285
|
-
if (!activeItem)
|
|
286
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
287
|
-
if (to) {
|
|
288
|
-
const computedTo = typeof to === "string" ? to : to(activeItem);
|
|
289
|
-
return (React__default["default"].createElement(reactRouterDom.Link, { className: styles__default["default"].listItemClickable, to: computedTo, onClick: handleClick }, children));
|
|
290
|
-
}
|
|
291
|
-
if (url) {
|
|
292
|
-
const href = typeof url === "string" ? url : url(activeItem);
|
|
293
|
-
return (React__default["default"].createElement("a", { className: styles__default["default"].listItemClickable, href: href, onClick: handleClick }, children));
|
|
294
|
-
}
|
|
295
|
-
if (onClick) {
|
|
296
|
-
return (React__default["default"].createElement("button", { className: styles__default["default"].listItemClickable, onClick: handleClick }, children));
|
|
297
|
-
}
|
|
298
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
299
|
-
function handleClick() {
|
|
300
|
-
activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function DataListItemClickable({ children }) {
|
|
305
|
-
const { itemActionComponent } = useDataListContext();
|
|
306
|
-
if (itemActionComponent) {
|
|
307
|
-
const props = itemActionComponent.props;
|
|
308
|
-
return (React__default["default"].createElement(DataListItemClickableInternal, Object.assign({}, props), children));
|
|
309
|
-
}
|
|
310
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
216
|
var css_248z$8 = ".WRV-UmQmPzo- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n overflow: hidden;\n gap: calc(16px / 2);\n gap: var(--space-small);\n}\n\n.liQeWCMenD0- {\n --overflow-bg: var(--data-list-item-active-color, var(--color-surface));\n\n display: -ms-flexbox;\n\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n height: 100%;\n padding-left: calc(16px * 1);\n padding-left: var(--space-base);\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n rgba(255, 255, 255, 1) calc(16px * 1),\n rgba(255, 255, 255, 1) 100%\n );\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n var(--overflow-bg) var(--space-base),\n var(--overflow-bg) 100%\n );\n -ms-flex-align: center;\n align-items: center;\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n";
|
|
314
217
|
var styles$8 = {"tags":"WRV-UmQmPzo-","tagCount":"liQeWCMenD0-"};
|
|
315
218
|
styleInject_es.styleInject(css_248z$8);
|
|
@@ -465,6 +368,109 @@ function generateHeaderElements(headers) {
|
|
|
465
368
|
function sortSizeProp(sizeProp) {
|
|
466
369
|
return sizeProp.sort((a, b) => BREAKPOINTS.indexOf(a) - BREAKPOINTS.indexOf(b));
|
|
467
370
|
}
|
|
371
|
+
function getExposedActions(childrenArray, childCount = 2) {
|
|
372
|
+
const firstNChildren = childrenArray.slice(0, childCount);
|
|
373
|
+
return firstNChildren.reduce((result, child, i) => {
|
|
374
|
+
const hasIcon = Boolean(child.props.icon);
|
|
375
|
+
if (!hasIcon)
|
|
376
|
+
return result; // If the child does not have an icon, continue.
|
|
377
|
+
const isLastChildAdded = result.length === i;
|
|
378
|
+
// If it's the first child or if the previous child was added, then add this child.
|
|
379
|
+
if (i === 0 || (i < childCount && isLastChildAdded)) {
|
|
380
|
+
return [...result, child];
|
|
381
|
+
}
|
|
382
|
+
return result;
|
|
383
|
+
}, []);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// This component is meant to capture the props of the DataList.ItemActions
|
|
387
|
+
function DataListItemActions(
|
|
388
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
389
|
+
_) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
const variants = {
|
|
393
|
+
hidden: { opacity: 0, y: 10 },
|
|
394
|
+
visible: { opacity: 1, y: 0 },
|
|
395
|
+
};
|
|
396
|
+
function InternalDataListItemActions({ item, }) {
|
|
397
|
+
const { itemActionComponent } = useDataListContext();
|
|
398
|
+
if (!itemActionComponent)
|
|
399
|
+
return null;
|
|
400
|
+
const { children } = itemActionComponent.props;
|
|
401
|
+
const childrenArray = React.Children.toArray(children).filter(React.isValidElement);
|
|
402
|
+
const exposedActions = getExposedActions(childrenArray);
|
|
403
|
+
childrenArray.splice(0, exposedActions.length);
|
|
404
|
+
return (React__default["default"].createElement(framerMotion.motion.div, { variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
|
|
405
|
+
duration: TRANSITION_DURATION_IN_SECONDS,
|
|
406
|
+
delay: TRANSITION_DELAY_IN_SECONDS,
|
|
407
|
+
}, className: styles$b.menu, onContextMenu: handleContextMenu },
|
|
408
|
+
exposedActions.map(({ props }) => {
|
|
409
|
+
if (!props.icon)
|
|
410
|
+
return null;
|
|
411
|
+
return (React__default["default"].createElement(Tooltip.Tooltip, { key: props.label, message: props.label },
|
|
412
|
+
React__default["default"].createElement(Button.Button, { icon: props.icon, ariaLabel: props.label, onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, item); }, type: "secondary", variation: "subtle" })));
|
|
413
|
+
}),
|
|
414
|
+
React__default["default"].createElement(DataListItemActionsOverflow, { actions: childrenArray, item: item })));
|
|
415
|
+
}
|
|
416
|
+
function handleContextMenu(event) {
|
|
417
|
+
event.stopPropagation();
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const DataListLayoutActionsContext = React.createContext({ activeItem: undefined });
|
|
421
|
+
function useDataListLayoutActionsContext() {
|
|
422
|
+
return React.useContext(DataListLayoutActionsContext);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function DataListItemInternal({ children, item, }) {
|
|
426
|
+
const { selected, onSelect } = useDataListContext();
|
|
427
|
+
if (selected !== undefined && onSelect) {
|
|
428
|
+
return (React__default["default"].createElement("div", { className: classnames__default["default"](styles__default["default"].selectable, {
|
|
429
|
+
[styles__default["default"].selected]: selected === null || selected === void 0 ? void 0 : selected.length,
|
|
430
|
+
}) },
|
|
431
|
+
children,
|
|
432
|
+
React__default["default"].createElement(Checkbox.Checkbox, { checked: selected === null || selected === void 0 ? void 0 : selected.includes(item.id), onChange: handleChange })));
|
|
433
|
+
}
|
|
434
|
+
return children;
|
|
435
|
+
function handleChange() {
|
|
436
|
+
if (selected === null || selected === void 0 ? void 0 : selected.includes(item.id)) {
|
|
437
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected === null || selected === void 0 ? void 0 : selected.filter(id => id !== item.id));
|
|
438
|
+
}
|
|
439
|
+
else if (selected) {
|
|
440
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect([...selected, item.id]);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function DataListItemClickableInternal({ onClick, url, to, children, }) {
|
|
446
|
+
const { activeItem } = useDataListLayoutActionsContext();
|
|
447
|
+
if (!activeItem)
|
|
448
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
449
|
+
if (to) {
|
|
450
|
+
const computedTo = typeof to === "string" ? to : to(activeItem);
|
|
451
|
+
return (React__default["default"].createElement(reactRouterDom.Link, { className: styles__default["default"].listItemClickable, to: computedTo, onClick: handleClick }, children));
|
|
452
|
+
}
|
|
453
|
+
if (url) {
|
|
454
|
+
const href = typeof url === "string" ? url : url(activeItem);
|
|
455
|
+
return (React__default["default"].createElement("a", { className: styles__default["default"].listItemClickable, href: href, onClick: handleClick }, children));
|
|
456
|
+
}
|
|
457
|
+
if (onClick) {
|
|
458
|
+
return (React__default["default"].createElement("button", { className: styles__default["default"].listItemClickable, onClick: handleClick }, children));
|
|
459
|
+
}
|
|
460
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
461
|
+
function handleClick() {
|
|
462
|
+
activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function DataListItemClickable({ children }) {
|
|
467
|
+
const { itemActionComponent } = useDataListContext();
|
|
468
|
+
if (itemActionComponent) {
|
|
469
|
+
const props = itemActionComponent.props;
|
|
470
|
+
return (React__default["default"].createElement(DataListItemClickableInternal, Object.assign({}, props), children));
|
|
471
|
+
}
|
|
472
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
473
|
+
}
|
|
468
474
|
|
|
469
475
|
function DataListItem({ item, layout, }) {
|
|
470
476
|
const { itemActionComponent } = useDataListContext();
|
|
@@ -544,21 +550,93 @@ function DataListItems({ layouts, mediaMatches, data, }) {
|
|
|
544
550
|
React__default["default"].createElement(DataListLayoutInternal, { layouts: layouts, mediaMatches: mediaMatches, renderLayout: layout => (React__default["default"].createElement(React__default["default"].Fragment, null, data.map((child, i) => (React__default["default"].createElement(DataListItem, { key: data[i].id, index: i, item: child, layout: layout }))))) })));
|
|
545
551
|
}
|
|
546
552
|
|
|
553
|
+
const CONTAINER_TEST_ID = "ATL-DataListFilters-Container";
|
|
554
|
+
|
|
555
|
+
var css_248z$5 = ".jbBRoxlZlNI- {\n -ms-flex-item-align: center;\n align-self: center;\n position: relative;\n min-width: 0;\n}\n\n.MnN8qbS4hw4- {\n display: grid;\n overflow-x: auto;\n grid-auto-flow: column;\n grid-auto-columns: -webkit-max-content;\n grid-auto-columns: max-content;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.MnN8qbS4hw4- > :nth-child(n + 3):not(:last-child) {\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n\n.b-5P7Z8eGO8- {\n visibility: hidden;\n}\n\n.xzaCS4slLpI-::before,\n.Jf227kC8Nu0-::after {\n content: \"\";\n position: absolute;\n top: 0;\n width: calc(16px * 1.5);\n width: var(--space-large);\n height: 100%;\n background-image: linear-gradient(\n to right,\n rgba(255, 255, 255, 1) 0%,\n rgba(255, 255, 255, 0) 100%\n );\n background-image: linear-gradient(\n var(--data-list-overflow-shadow-angle, to right),\n var(--color-surface) 0%,\n rgba(var(--color-white--rgb), 0) 100%\n );\n pointer-events: none;\n}\n\n.xzaCS4slLpI-::before {\n left: 0;\n}\n\n.Jf227kC8Nu0-::after {\n --data-list-overflow-shadow-angle: to left;\n right: 0;\n}\n";
|
|
556
|
+
var styles$5 = {"fadeContainer":"jbBRoxlZlNI-","overflowGrid":"MnN8qbS4hw4-","overflowTrigger":"b-5P7Z8eGO8-","overflowLeft":"xzaCS4slLpI-","overflowRight":"Jf227kC8Nu0-"};
|
|
557
|
+
styleInject_es.styleInject(css_248z$5);
|
|
558
|
+
|
|
559
|
+
function DataListOverflowFade({ children }) {
|
|
560
|
+
const [leftRef, isLeftVisible] = useInView.useInView();
|
|
561
|
+
const [rightRef, isRightVisible] = useInView.useInView();
|
|
562
|
+
return (React__default["default"].createElement("div", { "data-testid": CONTAINER_TEST_ID, className: classnames__default["default"](styles$5.fadeContainer, {
|
|
563
|
+
[styles$5.overflowLeft]: !isLeftVisible,
|
|
564
|
+
[styles$5.overflowRight]: !isRightVisible,
|
|
565
|
+
}) },
|
|
566
|
+
React__default["default"].createElement("div", { className: styles$5.overflowGrid },
|
|
567
|
+
React__default["default"].createElement("span", { ref: leftRef, className: styles$5.overflowTrigger }),
|
|
568
|
+
children,
|
|
569
|
+
React__default["default"].createElement("span", { ref: rightRef, className: styles$5.overflowTrigger }))));
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// This component is meant to capture the props of the DataList.BulkActions
|
|
573
|
+
function DataListBulkActions(
|
|
574
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
575
|
+
_) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
function InternalDataListBulkActions() {
|
|
579
|
+
const { bulkActionsComponent } = useDataListContext();
|
|
580
|
+
if (!bulkActionsComponent)
|
|
581
|
+
return null;
|
|
582
|
+
const { children } = bulkActionsComponent.props;
|
|
583
|
+
const childrenArray = React.Children.toArray(children).filter(React.isValidElement);
|
|
584
|
+
const exposedActions = getExposedActions(childrenArray, 3);
|
|
585
|
+
childrenArray.splice(0, exposedActions.length);
|
|
586
|
+
return (React__default["default"].createElement(DataListOverflowFade, null,
|
|
587
|
+
exposedActions.map(({ props }) => {
|
|
588
|
+
if (!props.icon)
|
|
589
|
+
return null;
|
|
590
|
+
return (React__default["default"].createElement(Tooltip.Tooltip, { key: props.label, message: props.label },
|
|
591
|
+
React__default["default"].createElement(Button.Button, { icon: props.icon, ariaLabel: props.label, onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, type: "secondary", variation: "subtle" })));
|
|
592
|
+
}),
|
|
593
|
+
React__default["default"].createElement(DataListItemActionsOverflow, { actions: childrenArray })));
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function useMediaQuery(CSSMediaQuery) {
|
|
597
|
+
const [matches, setMatches] = React.useState(window.matchMedia(CSSMediaQuery).matches);
|
|
598
|
+
React.useEffect(() => {
|
|
599
|
+
const media = window.matchMedia(CSSMediaQuery);
|
|
600
|
+
if (media.matches !== matches) {
|
|
601
|
+
setMatches(media.matches);
|
|
602
|
+
}
|
|
603
|
+
const listener = () => setMatches(media.matches);
|
|
604
|
+
media.addEventListener("change", listener);
|
|
605
|
+
return () => media.removeEventListener("change", listener);
|
|
606
|
+
}, [CSSMediaQuery]);
|
|
607
|
+
return matches;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function useResponsiveSizing() {
|
|
611
|
+
const xs = useMediaQuery(`(width > ${BREAKPOINT_SIZES.xs}px)`);
|
|
612
|
+
const sm = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.sm}px)`);
|
|
613
|
+
const md = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.md}px)`);
|
|
614
|
+
const lg = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.lg}px)`);
|
|
615
|
+
const xl = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.xl}px)`);
|
|
616
|
+
return { xs, sm, md, lg, xl };
|
|
617
|
+
}
|
|
618
|
+
|
|
547
619
|
function DataListHeaderCheckbox({ children }) {
|
|
548
620
|
const { data, totalCount, selected = [], onSelectAll, onSelect, } = useDataListContext();
|
|
549
621
|
if (!onSelectAll && !onSelect)
|
|
550
622
|
return children;
|
|
623
|
+
const { sm } = useResponsiveSizing();
|
|
624
|
+
// Show "Deselect All" if breakpoint is sm or higher
|
|
625
|
+
const deselectText = sm ? "Deselect All" : "Deselect";
|
|
626
|
+
const selectedLabel = selected.length ? `${selected.length} selected` : "";
|
|
551
627
|
return (React__default["default"].createElement("div", { className: classnames__default["default"](styles$e.selectable) },
|
|
552
628
|
React__default["default"].createElement("div", { className: classnames__default["default"](styles$e.selectAllCheckbox, {
|
|
553
629
|
[styles$e.visible]: Boolean(onSelectAll),
|
|
554
630
|
}) },
|
|
555
|
-
React__default["default"].createElement(Checkbox.Checkbox, { checked: isAllSelected(), indeterminate: selected.length > 0 && !isAllSelected(), onChange: onSelectAll }
|
|
631
|
+
React__default["default"].createElement(Checkbox.Checkbox, { checked: isAllSelected(), indeterminate: selected.length > 0 && !isAllSelected(), onChange: onSelectAll },
|
|
632
|
+
React__default["default"].createElement("div", { className: styles$e.srOnly }, selectedLabel))),
|
|
556
633
|
React__default["default"].createElement(AnimatedSwitcher.AnimatedSwitcher, { switched: Boolean(selected.length), initialChild: children, switchTo: React__default["default"].createElement("div", { className: styles$e.headerBatchSelect },
|
|
557
634
|
React__default["default"].createElement(Text.Text, null,
|
|
558
635
|
React__default["default"].createElement("b", null,
|
|
559
636
|
selected.length,
|
|
560
637
|
" selected")),
|
|
561
|
-
React__default["default"].createElement(Button.Button, { label:
|
|
638
|
+
React__default["default"].createElement(Button.Button, { label: deselectText, onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect([]), type: "tertiary" }),
|
|
639
|
+
React__default["default"].createElement(InternalDataListBulkActions, null)) })));
|
|
562
640
|
function isAllSelected() {
|
|
563
641
|
// If there's a totalCount, we can use that to accurately determine if the
|
|
564
642
|
// user have "selected all".
|
|
@@ -573,29 +651,6 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
573
651
|
}
|
|
574
652
|
}
|
|
575
653
|
|
|
576
|
-
function useMediaQuery(CSSMediaQuery) {
|
|
577
|
-
const [matches, setMatches] = React.useState(window.matchMedia(CSSMediaQuery).matches);
|
|
578
|
-
React.useEffect(() => {
|
|
579
|
-
const media = window.matchMedia(CSSMediaQuery);
|
|
580
|
-
if (media.matches !== matches) {
|
|
581
|
-
setMatches(media.matches);
|
|
582
|
-
}
|
|
583
|
-
const listener = () => setMatches(media.matches);
|
|
584
|
-
media.addEventListener("change", listener);
|
|
585
|
-
return () => media.removeEventListener("change", listener);
|
|
586
|
-
}, [CSSMediaQuery]);
|
|
587
|
-
return matches;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
function useResponsiveSizing() {
|
|
591
|
-
const xs = useMediaQuery(`(width > ${BREAKPOINT_SIZES.xs}px)`);
|
|
592
|
-
const sm = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.sm}px)`);
|
|
593
|
-
const md = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.md}px)`);
|
|
594
|
-
const lg = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.lg}px)`);
|
|
595
|
-
const xl = useMediaQuery(`(width >= ${BREAKPOINT_SIZES.xl}px)`);
|
|
596
|
-
return { xs, sm, md, lg, xl };
|
|
597
|
-
}
|
|
598
|
-
|
|
599
654
|
function useShowHeader() {
|
|
600
655
|
const { headerVisibility } = useDataListContext();
|
|
601
656
|
if (headerVisibility === undefined)
|
|
@@ -612,7 +667,9 @@ function useShowHeader() {
|
|
|
612
667
|
|
|
613
668
|
function DataListHeader({ layouts, mediaMatches, headerData, }) {
|
|
614
669
|
const showHeader = useShowHeader();
|
|
615
|
-
|
|
670
|
+
const { selected } = useDataListContext();
|
|
671
|
+
const noItemsSelected = (selected === null || selected === void 0 ? void 0 : selected.length) === 0;
|
|
672
|
+
if ((!showHeader && noItemsSelected) || !headerData)
|
|
616
673
|
return null;
|
|
617
674
|
return (React__default["default"].createElement(DataListLayoutInternal, { layouts: layouts, mediaMatches: mediaMatches, renderLayout: layout => (React__default["default"].createElement("div", { className: classnames__default["default"](styles$e.headerTitles) },
|
|
618
675
|
React__default["default"].createElement(DataListHeaderCheckbox, null, layout.props.children(headerData)))) }));
|
|
@@ -647,12 +704,6 @@ _) {
|
|
|
647
704
|
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
648
705
|
}
|
|
649
706
|
|
|
650
|
-
var css_248z$5 = ".E-mG3prPSN8- {\n -ms-flex-item-align: center;\n align-self: center;\n position: relative;\n min-width: 0;\n}\n\n._0LGNoZxtqSE- {\n display: grid;\n overflow-x: auto;\n grid-auto-flow: column;\n grid-auto-columns: -webkit-max-content;\n grid-auto-columns: max-content;\n -ms-flex-align: center;\n align-items: center;\n}\n\n._0LGNoZxtqSE- > :nth-child(n + 3):not(:last-child) {\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n\n.LA3-gtgehrE- {\n visibility: hidden;\n}\n\n.fSPvawYWzZ8-::before,\n.ChfEJMPPVTk-::after {\n content: \"\";\n position: absolute;\n top: 0;\n width: calc(16px * 1.5);\n width: var(--space-large);\n height: 100%;\n background-image: linear-gradient(\n to right,\n rgba(255, 255, 255, 1) 0%,\n rgba(255, 255, 255, 0) 100%\n );\n background-image: linear-gradient(\n var(--data-list-filters-overflow-shadow-angle, to right),\n var(--color-surface) 0%,\n rgba(var(--color-white--rgb), 0) 100%\n );\n pointer-events: none;\n}\n\n.fSPvawYWzZ8-::before {\n left: 0;\n}\n\n.ChfEJMPPVTk-::after {\n --data-list-filters-overflow-shadow-angle: to left;\n right: 0;\n}\n";
|
|
651
|
-
var styles$5 = {"filters":"E-mG3prPSN8-","filterActions":"_0LGNoZxtqSE-","overflowTrigger":"LA3-gtgehrE-","overflowLeft":"fSPvawYWzZ8-","overflowRight":"ChfEJMPPVTk-"};
|
|
652
|
-
styleInject_es.styleInject(css_248z$5);
|
|
653
|
-
|
|
654
|
-
const CONTAINER_TEST_ID = "ATL-DataListFilters-Container";
|
|
655
|
-
|
|
656
707
|
function DataListSort() {
|
|
657
708
|
const { sorting, headers } = useDataListContext();
|
|
658
709
|
const divRef = React.useRef(null);
|
|
@@ -719,20 +770,12 @@ function InternalDataListFilters() {
|
|
|
719
770
|
const showHeader = useShowHeader();
|
|
720
771
|
const showSortButton = !showHeader;
|
|
721
772
|
const component = getCompoundComponent(parentChildren, DataListFilters);
|
|
722
|
-
const [leftRef, isLeftVisible] = useInView.useInView();
|
|
723
|
-
const [rightRef, isRightVisible] = useInView.useInView();
|
|
724
773
|
if (!showSortButton && !component)
|
|
725
774
|
return null;
|
|
726
775
|
const children = component === null || component === void 0 ? void 0 : component.props.children;
|
|
727
|
-
return (React__default["default"].createElement(
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}) },
|
|
731
|
-
React__default["default"].createElement("div", { className: styles$5.filterActions },
|
|
732
|
-
React__default["default"].createElement("span", { ref: leftRef, className: styles$5.overflowTrigger }),
|
|
733
|
-
children && children,
|
|
734
|
-
showSortButton && React__default["default"].createElement(DataListSort, null),
|
|
735
|
-
React__default["default"].createElement("span", { ref: rightRef, className: styles$5.overflowTrigger }))));
|
|
776
|
+
return (React__default["default"].createElement(DataListOverflowFade, null,
|
|
777
|
+
children && children,
|
|
778
|
+
showSortButton && React__default["default"].createElement(DataListSort, null)));
|
|
736
779
|
}
|
|
737
780
|
|
|
738
781
|
var css_248z$4 = ".PGOHzrMh374- {\n --offset: 1px;\n --sticky-header-transition-properties: var(--timing-base) ease-in-out;\n\n position: sticky;\n top: calc(1px * -1);\n top: calc(var(--offset) * -1);\n z-index: 1;\n z-index: var(--elevation-base);\n padding-top: 1px;\n padding-top: var(--offset);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n/**\n * Draw a border that gets covered by the column headers border when it shows up.\n *\n * Mostly to prevent us from writing some complex JS to remove the border when\n * the column headers show up.\n */\n\n.PGOHzrMh374-::before {\n content: \"\";\n display: block;\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: -1;\n width: 0;\n height: 0;\n background-color: rgb(225, 225, 225);\n background-color: var(--color-border);\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%);\n transition: height var(--sticky-header-transition-properties)\n 100ms,\n width var(--sticky-header-transition-properties);\n transition: height var(--sticky-header-transition-properties)\n var(--timing-quick),\n width var(--sticky-header-transition-properties);\n}\n\n.PGjWc5ocjpI-::before {\n width: 100%;\n height: calc(16px / 8);\n height: var(--border-thick);\n transition: height var(--sticky-header-transition-properties),\n width var(--sticky-header-transition-properties) 100ms;\n transition: height var(--sticky-header-transition-properties),\n width var(--sticky-header-transition-properties) var(--timing-quick);\n}\n";
|
|
@@ -933,11 +976,13 @@ function DataList(_a) {
|
|
|
933
976
|
const layoutComponents = getCompoundComponents(props.children, DataListLayout);
|
|
934
977
|
const emptyStateComponents = getCompoundComponents(props.children, DataListEmptyState);
|
|
935
978
|
const itemActionComponent = getCompoundComponent(props.children, DataListItemActions);
|
|
979
|
+
const bulkActionsComponent = getCompoundComponent(props.children, DataListBulkActions);
|
|
936
980
|
return (React__default["default"].createElement(DataListContext.Provider, { value: Object.assign(Object.assign({ searchComponent,
|
|
937
981
|
filterComponent,
|
|
938
982
|
layoutComponents,
|
|
939
983
|
emptyStateComponents,
|
|
940
|
-
itemActionComponent
|
|
984
|
+
itemActionComponent,
|
|
985
|
+
bulkActionsComponent }, props), { selected: (_b = props.selected) !== null && _b !== void 0 ? _b : [],
|
|
941
986
|
// T !== DataListObject
|
|
942
987
|
sorting: sorting }) },
|
|
943
988
|
React__default["default"].createElement(InternalDataList, null)));
|
|
@@ -1006,10 +1051,21 @@ DataList.Search = DataListSearch;
|
|
|
1006
1051
|
* Defines the group actions you could do on a single DataList item.
|
|
1007
1052
|
*/
|
|
1008
1053
|
DataList.ItemActions = DataListItemActions;
|
|
1054
|
+
/**
|
|
1055
|
+
* Defines the group actions you could do on multiple DataList items.
|
|
1056
|
+
*/
|
|
1057
|
+
DataList.BulkActions = DataListBulkActions;
|
|
1009
1058
|
/**
|
|
1010
1059
|
* Defines the action in a DataList. This should be used inside the
|
|
1011
1060
|
* DataListItemActions component.
|
|
1012
1061
|
*/
|
|
1013
|
-
DataList.
|
|
1062
|
+
DataList.ItemAction = DataListAction;
|
|
1063
|
+
/**
|
|
1064
|
+
* Defines the batch action in a DataList. This should be used inside the
|
|
1065
|
+
* DataListBulkActions component.
|
|
1066
|
+
*/
|
|
1067
|
+
DataList.BatchAction = function DataListBatchAction(props) {
|
|
1068
|
+
return React__default["default"].createElement(DataListAction, Object.assign({}, props));
|
|
1069
|
+
};
|
|
1014
1070
|
|
|
1015
1071
|
exports.DataList = DataList;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.44.0",
|
|
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": "eeff010b874becc9cbf7ee1a7dc4cef2845251f7"
|
|
88
88
|
}
|