@jobber/components 6.81.0 → 6.82.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.
@@ -1,6 +1,7 @@
1
1
  import { ColumnDef, Row } from "@tanstack/react-table";
2
2
  import React, { ReactNode } from "react";
3
3
  import { PaginationType, SortingType } from "./types";
4
+ import { DataTableActions, DataTableBody, DataTableContainer, DataTableFooter, DataTableHeader, DataTableHeaderCell, DataTablePagination, DataTablePaginationButton, DataTableRowActions, DataTableSortableHeader, DataTableTable } from "./components";
4
5
  export interface DataTableProps<T> {
5
6
  /**
6
7
  * The actual data that will be used for the table.
@@ -55,3 +56,18 @@ export interface DataTableProps<T> {
55
56
  readonly loading?: boolean;
56
57
  }
57
58
  export declare function DataTable<T extends object>({ data, columns, pagination, sorting, height, stickyHeader, pinFirstColumn, onRowClick, emptyState, loading, }: DataTableProps<T>): React.JSX.Element;
59
+ export declare namespace DataTable {
60
+ var Table: typeof DataTableTable;
61
+ var Header: typeof DataTableHeader;
62
+ var HeaderCell: typeof DataTableHeaderCell;
63
+ var Row: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
64
+ var Cell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
65
+ var RowActions: typeof DataTableRowActions;
66
+ var Actions: typeof DataTableActions;
67
+ var Body: typeof DataTableBody;
68
+ var Container: typeof DataTableContainer;
69
+ var SortableHeader: typeof DataTableSortableHeader;
70
+ var Footer: typeof DataTableFooter;
71
+ var Pagination: typeof DataTablePagination;
72
+ var PaginationButton: typeof DataTablePaginationButton;
73
+ }
@@ -0,0 +1,2 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableActions(props: PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableBody(props: PropsWithChildren<React.HTMLAttributes<HTMLTableSectionElement>>): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const DataTableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
@@ -0,0 +1,2 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableContainer(props: PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface DataTableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {
3
+ readonly children: React.ReactNode;
4
+ /**
5
+ * Number of columns to span across. This should match the number of columns in your table.
6
+ */
7
+ readonly colSpan: number;
8
+ }
9
+ export declare function DataTableFooter({ children, className, colSpan, ...props }: DataTableFooterProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableHeader(props: PropsWithChildren<React.HTMLAttributes<HTMLTableSectionElement>>): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare function DataTableHeaderCell(props: React.ThHTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
3
+ export declare namespace DataTableHeaderCell {
4
+ var displayName: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export interface DataTablePaginationProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ readonly children: React.ReactNode;
4
+ }
5
+ export declare function DataTablePagination({ children, className, ...props }: DataTablePaginationProps): React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ export interface DataTablePaginationButtonProps {
3
+ /**
4
+ * The direction of the pagination button
5
+ */
6
+ readonly direction: "previous" | "next";
7
+ /**
8
+ * Callback function when the pagination button is clicked
9
+ */
10
+ readonly onClick?: () => void;
11
+ /**
12
+ * Whether the pagination button is disabled
13
+ */
14
+ readonly disabled?: boolean;
15
+ /**
16
+ * Function that returns the aria-label for the button. Required for accessibility.
17
+ * Should return translated strings based on the direction parameter.
18
+ */
19
+ readonly ariaLabel: (direction: "previous" | "next") => string;
20
+ }
21
+ export declare function DataTablePaginationButton({ direction, onClick, disabled, ariaLabel, }: DataTablePaginationButtonProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const DataTableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
@@ -0,0 +1,4 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableRowActions(props: PropsWithChildren<{
3
+ readonly className?: string;
4
+ }>): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { SortDirection } from "../SortIcon";
3
+ export interface DataTableSortableHeaderProps {
4
+ /**
5
+ * The header content to display (text, icons, etc.)
6
+ */
7
+ readonly children: React.ReactNode;
8
+ /**
9
+ * The current sort direction for this column. When undefined, the header renders as non-interactive.
10
+ */
11
+ readonly direction?: SortDirection;
12
+ /**
13
+ * Callback function triggered when the sortable header is clicked.
14
+ * When undefined, the header renders as non-interactive.
15
+ */
16
+ readonly onSort?: () => void;
17
+ }
18
+ export declare function DataTableSortableHeader(props: DataTableSortableHeaderProps & React.HTMLAttributes<HTMLTableCellElement>): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React, { type PropsWithChildren } from "react";
2
+ export declare function DataTableTable(props: PropsWithChildren<React.HTMLAttributes<HTMLTableElement>>): React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var DataTableTable = require('../../DataTableTable-cjs.js');
4
+ require('react');
5
+ require('classnames');
6
+ require('../../tslib.es6-cjs.js');
7
+ require('../../Button-cjs.js');
8
+ require('react-router-dom');
9
+ require('../../Icon-cjs.js');
10
+ require('@jobber/design');
11
+ require('../../Typography-cjs.js');
12
+
13
+
14
+
15
+ exports.DataTableActions = DataTableTable.DataTableActions;
16
+ exports.DataTableBody = DataTableTable.DataTableBody;
17
+ exports.DataTableCell = DataTableTable.DataTableCell;
18
+ exports.DataTableContainer = DataTableTable.DataTableContainer;
19
+ exports.DataTableFooter = DataTableTable.DataTableFooter;
20
+ exports.DataTableHeader = DataTableTable.DataTableHeader;
21
+ exports.DataTableHeaderCell = DataTableTable.DataTableHeaderCell;
22
+ exports.DataTablePagination = DataTableTable.DataTablePagination;
23
+ exports.DataTablePaginationButton = DataTableTable.DataTablePaginationButton;
24
+ exports.DataTableRow = DataTableTable.DataTableRow;
25
+ exports.DataTableRowActions = DataTableTable.DataTableRowActions;
26
+ exports.DataTableSortableHeader = DataTableTable.DataTableSortableHeader;
27
+ exports.DataTableTable = DataTableTable.DataTableTable;
@@ -0,0 +1,13 @@
1
+ export { DataTableActions } from "./DataTableActions";
2
+ export { DataTableBody } from "./DataTableBody";
3
+ export { DataTableCell } from "./DataTableCell";
4
+ export { DataTableContainer } from "./DataTableContainer";
5
+ export { DataTableFooter } from "./DataTableFooter";
6
+ export { DataTableHeader } from "./DataTableHeader";
7
+ export { DataTableHeaderCell } from "./DataTableHeaderCell";
8
+ export { DataTablePagination } from "./DataTablePagination";
9
+ export { DataTablePaginationButton } from "./DataTablePaginationButton";
10
+ export { DataTableRow } from "./DataTableRow";
11
+ export { DataTableRowActions } from "./DataTableRowActions";
12
+ export { DataTableSortableHeader } from "./DataTableSortableHeader";
13
+ export { DataTableTable } from "./DataTableTable";
@@ -0,0 +1,9 @@
1
+ export { D as DataTableActions, b as DataTableBody, c as DataTableCell, d as DataTableContainer, e as DataTableFooter, f as DataTableHeader, g as DataTableHeaderCell, h as DataTablePagination, i as DataTablePaginationButton, j as DataTableRow, k as DataTableRowActions, l as DataTableSortableHeader, m as DataTableTable } from '../../DataTableTable-es.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import '../../tslib.es6-es.js';
5
+ import '../../Button-es.js';
6
+ import 'react-router-dom';
7
+ import '../../Icon-es.js';
8
+ import '@jobber/design';
9
+ import '../../Typography-es.js';
@@ -2,6 +2,7 @@
2
2
 
3
3
  var DataTable = require('../DataTable-cjs.js');
4
4
  var helpers = require('../helpers-cjs.js');
5
+ var DataTableTable = require('../DataTableTable-cjs.js');
5
6
  var reactTable = require('@tanstack/react-table');
6
7
  require('classnames');
7
8
  require('react');
@@ -41,6 +42,11 @@ require('react-hook-form');
41
42
 
42
43
  exports.DataTable = DataTable.DataTable;
43
44
  exports.mockContainerWidth = helpers.mockContainerWidth;
45
+ Object.defineProperty(exports, "SortDirection", {
46
+ enumerable: true,
47
+ get: function () { return DataTableTable.SortDirection; }
48
+ });
49
+ exports.SortIcon = DataTableTable.SortIcon;
44
50
  Object.defineProperty(exports, "createColumnHelper", {
45
51
  enumerable: true,
46
52
  get: function () { return reactTable.createColumnHelper; }
@@ -1,4 +1,5 @@
1
1
  export { DataTable } from "./DataTable";
2
2
  export * from "./types";
3
3
  export * from "./test-utilities/helpers";
4
+ export { SortIcon, SortDirection } from "./SortIcon";
4
5
  export { Row, ColumnDef, createColumnHelper, PaginationState, SortingState, } from "@tanstack/react-table";
@@ -1,5 +1,6 @@
1
1
  export { D as DataTable } from '../DataTable-es.js';
2
2
  export { m as mockContainerWidth } from '../helpers-es.js';
3
+ export { a as SortDirection, S as SortIcon } from '../DataTableTable-es.js';
3
4
  export { createColumnHelper } from '@tanstack/react-table';
4
5
  import 'classnames';
5
6
  import 'react';
@@ -9,8 +9,9 @@ var tslib_es6 = require('./tslib.es6-cjs.js');
9
9
  var Select_index = require('./Select/index.cjs');
10
10
  var Button = require('./Button-cjs.js');
11
11
  var Text = require('./Text-cjs.js');
12
+ var DataTableTable = require('./DataTableTable-cjs.js');
12
13
 
13
- var styles$3 = {"dataTableContainer":"_3IHK46TSBOI-","tableContainer":"_8CMtSx4qamA-","table":"bNYpzdn5rPc-","pinFirstColumn":"lKXqbcsnCFs-","emptyStateCell":"i-x8vss2hcI-","stickyHeader":"eWffzdKfJH0-","pinFirstHeaderSortable":"aGF6t8l8iUk-","sortableColumn":"W0kYDUxPkqI-","clickableRow":"vWFyXrAaFtQ-","emptyState":"_8L7icG7E530-","spinning":"O1cxELzWgmM-"};
14
+ var styles$2 = {"dataTableContainer":"_3IHK46TSBOI-","tableContainer":"_8CMtSx4qamA-","table":"bNYpzdn5rPc-","pinFirstColumn":"lKXqbcsnCFs-","emptyStateCell":"i-x8vss2hcI-","stickyHeader":"eWffzdKfJH0-","pinFirstHeaderSortable":"aGF6t8l8iUk-","sortableColumn":"W0kYDUxPkqI-","clickableRow":"vWFyXrAaFtQ-","emptyState":"_8L7icG7E530-","spinning":"O1cxELzWgmM-"};
14
15
 
15
16
  function BodyLoading({ table }) {
16
17
  const loaderRows = table.getState().pagination.pageSize;
@@ -20,7 +21,7 @@ function BodyLoading({ table }) {
20
21
  }
21
22
 
22
23
  function Body({ table, onRowClick, emptyState, loading, }) {
23
- const bodyRowClasses = classnames({ [styles$3.clickableRow]: !!onRowClick });
24
+ const bodyRowClasses = classnames({ [styles$2.clickableRow]: !!onRowClick });
24
25
  const handleRowClick = React.useCallback((row) => () => {
25
26
  if (onRowClick == undefined)
26
27
  return;
@@ -39,8 +40,8 @@ function Body({ table, onRowClick, emptyState, loading, }) {
39
40
  })));
40
41
  }))) : (React.createElement("tbody", null,
41
42
  React.createElement("tr", { className: bodyRowClasses },
42
- React.createElement("td", { colSpan: table.getAllColumns().length, className: styles$3.emptyStateCell },
43
- React.createElement("div", { className: styles$3.emptyState }, emptyState)))))));
43
+ React.createElement("td", { colSpan: table.getAllColumns().length, className: styles$2.emptyStateCell },
44
+ React.createElement("div", { className: styles$2.emptyState }, emptyState)))))));
44
45
  }
45
46
 
46
47
  function createTableSettings(data, columns, options) {
@@ -96,7 +97,7 @@ function getSortingSettings(sorting) {
96
97
  return sortingSettings;
97
98
  }
98
99
 
99
- var styles$2 = {"pagination":"_5TLZRabskzI-","paginationInfo":"k8VFFgHUPZ4-","paginationNav":"SfaHBP7KC3Y-","paginationSelect":"E4zFf5oEm-Y-","paginationSelectLabel":"N4LhT5occ94-","paginationButtons":"HQPsyRjssL0-","spinning":"YHT2Mg0618I-"};
100
+ var styles$1 = {"pagination":"_5TLZRabskzI-","paginationInfo":"k8VFFgHUPZ4-","paginationNav":"SfaHBP7KC3Y-","paginationSelect":"E4zFf5oEm-Y-","paginationSelectLabel":"N4LhT5occ94-","paginationButtons":"HQPsyRjssL0-","spinning":"YHT2Mg0618I-"};
100
101
 
101
102
  const defaultItemsPerPageOptions = ["10", "20", "30", "40", "50"];
102
103
  function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, }) {
@@ -105,16 +106,16 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
105
106
  const firstPosition = pageIndex * pageSize + 1;
106
107
  const secondPosition = Math.min(totalRows, pageSize * (pageIndex + 1));
107
108
  const itemsPerPageOptions = React.useMemo(() => { var _a; return (_a = itemsPerPage === null || itemsPerPage === void 0 ? void 0 : itemsPerPage.map(item => String(item))) !== null && _a !== void 0 ? _a : defaultItemsPerPageOptions; }, [itemsPerPage]);
108
- return secondPosition <= 0 ? (React.createElement("div", { className: styles$2.pagination },
109
- React.createElement("div", { className: styles$2.paginationInfo }, !loading ? React.createElement(Text.Text, null, "No items") : React.createElement(Glimmer.Glimmer, { width: 200 })))) : (React.createElement("div", { className: styles$2.pagination },
110
- React.createElement("div", { className: styles$2.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
111
- React.createElement("div", { className: styles$2.paginationNav },
112
- React.createElement("div", { className: styles$2.paginationSelect },
109
+ return secondPosition <= 0 ? (React.createElement("div", { className: styles$1.pagination },
110
+ React.createElement("div", { className: styles$1.paginationInfo }, !loading ? React.createElement(Text.Text, null, "No items") : React.createElement(Glimmer.Glimmer, { width: 200 })))) : (React.createElement("div", { className: styles$1.pagination },
111
+ React.createElement("div", { className: styles$1.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
112
+ React.createElement("div", { className: styles$1.paginationNav },
113
+ React.createElement("div", { className: styles$1.paginationSelect },
113
114
  React.createElement(Select_index.Select, { value: table.getState().pagination.pageSize, onChange: value => {
114
115
  table.setPageSize(Number(value));
115
116
  }, size: "small" }, itemsPerPageOptions.map(numOfPages => (React.createElement(Select_index.Option, { key: numOfPages, value: numOfPages }, numOfPages)))),
116
- React.createElement("span", { className: styles$2.paginationSelectLabel }, "per page")),
117
- React.createElement("div", { className: styles$2.paginationButtons },
117
+ React.createElement("span", { className: styles$1.paginationSelectLabel }, "per page")),
118
+ React.createElement("div", { className: styles$1.paginationButtons },
118
119
  React.createElement(Button.Button, { type: "secondary", variation: "subtle", icon: "arrowLeft", ariaLabel: "arrowLeft", onClick: () => {
119
120
  table.previousPage();
120
121
  onPageChange();
@@ -125,18 +126,18 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
125
126
  }, disabled: !table.getCanNextPage() })))));
126
127
  }
127
128
 
128
- var styles$1 = {"mobileFooterContainer":"wMM6V80Rt-w-","mobileFooterRow":"HAoSIniVNvI-","mobileFooterRowData":"mNGvTIKaQIA-","spinning":"u7HdA4nq7qM-"};
129
+ var styles = {"mobileFooterContainer":"wMM6V80Rt-w-","mobileFooterRow":"HAoSIniVNvI-","mobileFooterRowData":"mNGvTIKaQIA-","spinning":"u7HdA4nq7qM-"};
129
130
 
130
131
  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: {
131
132
  width: header.getSize(),
132
133
  minWidth: header.column.columnDef.minSize,
133
134
  maxWidth: header.column.columnDef.maxSize,
134
135
  } }, reactTable.flexRender(header.column.columnDef.footer, header.getContext())))))))));
135
- 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
136
+ const HandheldView = ({ table }) => (React.createElement("div", { className: styles.mobileFooterContainer, "data-testid": "data-table-handheld-footer" }, table.getFooterGroups().map(footerGroup => (React.createElement("div", { key: footerGroup.id }, footerGroup.headers
136
137
  .filter(header => header.column.columnDef.footer)
137
- .map((header, index) => (React.createElement(React.Fragment, null, index === 0 ? (React.createElement("div", { className: styles$1.mobileFooterRow }, reactTable.flexRender(header.column.columnDef.footer, header.getContext()))) : (React.createElement("div", { className: styles$1.mobileFooterRow, key: footerGroup.id },
138
+ .map((header, index) => (React.createElement(React.Fragment, null, index === 0 ? (React.createElement("div", { className: styles.mobileFooterRow }, reactTable.flexRender(header.column.columnDef.footer, header.getContext()))) : (React.createElement("div", { className: styles.mobileFooterRow, key: footerGroup.id },
138
139
  reactTable.flexRender(header.column.columnDef.header, header.getContext()),
139
- React.createElement("div", { className: styles$1.mobileFooterRowData }, reactTable.flexRender(header.column.columnDef.footer, header.getContext()))))))))))));
140
+ React.createElement("div", { className: styles.mobileFooterRowData }, reactTable.flexRender(header.column.columnDef.footer, header.getContext()))))))))))));
140
141
  const Footer = ({ table, viewType = "handheld", }) => {
141
142
  const hasFooter = table
142
143
  .getAllColumns()
@@ -147,42 +148,8 @@ const Footer = ({ table, viewType = "handheld", }) => {
147
148
  return null;
148
149
  };
149
150
 
150
- var styles = {"sortIcon":"NrRExUGE6GY-","inactive":"e3aVa36Y7W8-","active":"lDKd982Sr-w-","spinning":"D9cW6RdlpZ0-"};
151
-
152
- var SortDirection;
153
- (function (SortDirection) {
154
- SortDirection[SortDirection["ascending"] = 0] = "ascending";
155
- SortDirection[SortDirection["descending"] = 1] = "descending";
156
- SortDirection[SortDirection["equilibrium"] = 2] = "equilibrium";
157
- })(SortDirection || (SortDirection = {}));
158
- const sortStyleIndex = [
159
- {
160
- option: SortDirection.equilibrium,
161
- upArrowStyle: undefined,
162
- downArrowStyle: undefined,
163
- },
164
- {
165
- option: SortDirection.ascending,
166
- upArrowStyle: classnames(styles.active),
167
- downArrowStyle: classnames(styles.inactive),
168
- },
169
- {
170
- option: SortDirection.descending,
171
- upArrowStyle: classnames(styles.inactive),
172
- downArrowStyle: classnames(styles.active),
173
- },
174
- ];
175
- function SortIcon({ direction }) {
176
- const foundStyle = sortStyleIndex.find(style => style.option === direction);
177
- const finalStyle = foundStyle === undefined ? sortStyleIndex[0] : foundStyle;
178
- return (React.createElement("div", { className: classnames(styles.sortIcon) },
179
- React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
180
- 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" }),
181
- 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" }))));
182
- }
183
-
184
151
  function Header({ table, stickyHeader, sorting, onRowClick, }) {
185
- const stickyClass = classnames({ [styles$3.stickyHeader]: stickyHeader });
152
+ const stickyClass = classnames({ [styles$2.stickyHeader]: stickyHeader });
186
153
  return (React.createElement("thead", { className: stickyClass }, table.getHeaderGroups().map(headerGroup => (React.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map(header => {
187
154
  const isSorting = sorting && header.column.getCanSort();
188
155
  const headingCellInlineStyle = {
@@ -194,17 +161,17 @@ function Header({ table, stickyHeader, sorting, onRowClick, }) {
194
161
  headingCellInlineStyle.paddingRight = 0;
195
162
  }
196
163
  return (React.createElement("th", { key: header.id, colSpan: header.colSpan, className: isSorting
197
- ? classnames(styles$3.sortableColumn, {
198
- [styles$3.pinFirstHeaderSortable]: !!onRowClick,
164
+ ? classnames(styles$2.sortableColumn, {
165
+ [styles$2.pinFirstHeaderSortable]: !!onRowClick,
199
166
  })
200
167
  : "", onClick: sorting ? header.column.getToggleSortingHandler() : undefined, style: headingCellInlineStyle }, header.isPlaceholder ? null : (React.createElement("div", null,
201
168
  reactTable.flexRender(header.column.columnDef.header, header.getContext()),
202
169
  header.column.getCanSort() &&
203
170
  sorting &&
204
- !header.column.getIsSorted() && (React.createElement(SortIcon, { direction: SortDirection.equilibrium })),
171
+ !header.column.getIsSorted() && (React.createElement(DataTableTable.SortIcon, { direction: DataTableTable.SortDirection.equilibrium })),
205
172
  {
206
- asc: React.createElement(SortIcon, { direction: SortDirection.ascending }),
207
- desc: React.createElement(SortIcon, { direction: SortDirection.descending }),
173
+ asc: React.createElement(DataTableTable.SortIcon, { direction: DataTableTable.SortDirection.ascending }),
174
+ desc: React.createElement(DataTableTable.SortIcon, { direction: DataTableTable.SortDirection.descending }),
208
175
  }[header.column.getIsSorted()]))));
209
176
  }))))));
210
177
  }
@@ -215,12 +182,12 @@ function DataTable({ data, columns, pagination, sorting, height, stickyHeader, p
215
182
  pagination,
216
183
  sorting,
217
184
  });
218
- const tableClasses = classnames(styles$3.table, {
219
- [styles$3.pinFirstColumn]: pinFirstColumn,
185
+ const tableClasses = classnames(styles$2.table, {
186
+ [styles$2.pinFirstColumn]: pinFirstColumn,
220
187
  });
221
188
  const table = reactTable.useReactTable(tableSettings);
222
- return (React.createElement("div", { className: styles$3.dataTableContainer },
223
- React.createElement("div", { "data-testid": "ATL-DataTable-Container", className: styles$3.tableContainer, style: { height }, ref: ref },
189
+ return (React.createElement("div", { className: styles$2.dataTableContainer },
190
+ React.createElement("div", { "data-testid": "ATL-DataTable-Container", className: styles$2.tableContainer, style: { height }, ref: ref },
224
191
  React.createElement("table", { className: tableClasses },
225
192
  React.createElement(Header, { table: table, sorting: sorting, onRowClick: onRowClick, stickyHeader: stickyHeader }),
226
193
  React.createElement(Body, { table: table, onRowClick: onRowClick, emptyState: emptyState, loading: loading }),
@@ -234,5 +201,18 @@ function DataTable({ data, columns, pagination, sorting, height, stickyHeader, p
234
201
  ? pagination.totalItems
235
202
  : table.getCoreRowModel().rows.length, loading: loading, onPageChange: () => { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0); } }))));
236
203
  }
204
+ DataTable.Table = DataTableTable.DataTableTable;
205
+ DataTable.Header = DataTableTable.DataTableHeader;
206
+ DataTable.HeaderCell = DataTableTable.DataTableHeaderCell;
207
+ DataTable.Row = DataTableTable.DataTableRow;
208
+ DataTable.Cell = DataTableTable.DataTableCell;
209
+ DataTable.RowActions = DataTableTable.DataTableRowActions;
210
+ DataTable.Actions = DataTableTable.DataTableActions;
211
+ DataTable.Body = DataTableTable.DataTableBody;
212
+ DataTable.Container = DataTableTable.DataTableContainer;
213
+ DataTable.SortableHeader = DataTableTable.DataTableSortableHeader;
214
+ DataTable.Footer = DataTableTable.DataTableFooter;
215
+ DataTable.Pagination = DataTableTable.DataTablePagination;
216
+ DataTable.PaginationButton = DataTableTable.DataTablePaginationButton;
237
217
 
238
218
  exports.DataTable = DataTable;
@@ -7,8 +7,9 @@ import { _ as __rest } from './tslib.es6-es.js';
7
7
  import { Select, Option as SelectOption } from './Select/index.mjs';
8
8
  import { B as Button } from './Button-es.js';
9
9
  import { T as Text } from './Text-es.js';
10
+ import { S as SortIcon, a as SortDirection, m as DataTableTable, f as DataTableHeader, g as DataTableHeaderCell, j as DataTableRow, c as DataTableCell, k as DataTableRowActions, D as DataTableActions, b as DataTableBody, d as DataTableContainer, l as DataTableSortableHeader, e as DataTableFooter, h as DataTablePagination, i as DataTablePaginationButton } from './DataTableTable-es.js';
10
11
 
11
- var styles$3 = {"dataTableContainer":"_3IHK46TSBOI-","tableContainer":"_8CMtSx4qamA-","table":"bNYpzdn5rPc-","pinFirstColumn":"lKXqbcsnCFs-","emptyStateCell":"i-x8vss2hcI-","stickyHeader":"eWffzdKfJH0-","pinFirstHeaderSortable":"aGF6t8l8iUk-","sortableColumn":"W0kYDUxPkqI-","clickableRow":"vWFyXrAaFtQ-","emptyState":"_8L7icG7E530-","spinning":"O1cxELzWgmM-"};
12
+ var styles$2 = {"dataTableContainer":"_3IHK46TSBOI-","tableContainer":"_8CMtSx4qamA-","table":"bNYpzdn5rPc-","pinFirstColumn":"lKXqbcsnCFs-","emptyStateCell":"i-x8vss2hcI-","stickyHeader":"eWffzdKfJH0-","pinFirstHeaderSortable":"aGF6t8l8iUk-","sortableColumn":"W0kYDUxPkqI-","clickableRow":"vWFyXrAaFtQ-","emptyState":"_8L7icG7E530-","spinning":"O1cxELzWgmM-"};
12
13
 
13
14
  function BodyLoading({ table }) {
14
15
  const loaderRows = table.getState().pagination.pageSize;
@@ -18,7 +19,7 @@ function BodyLoading({ table }) {
18
19
  }
19
20
 
20
21
  function Body({ table, onRowClick, emptyState, loading, }) {
21
- const bodyRowClasses = classnames({ [styles$3.clickableRow]: !!onRowClick });
22
+ const bodyRowClasses = classnames({ [styles$2.clickableRow]: !!onRowClick });
22
23
  const handleRowClick = useCallback((row) => () => {
23
24
  if (onRowClick == undefined)
24
25
  return;
@@ -37,8 +38,8 @@ function Body({ table, onRowClick, emptyState, loading, }) {
37
38
  })));
38
39
  }))) : (React__default.createElement("tbody", null,
39
40
  React__default.createElement("tr", { className: bodyRowClasses },
40
- React__default.createElement("td", { colSpan: table.getAllColumns().length, className: styles$3.emptyStateCell },
41
- React__default.createElement("div", { className: styles$3.emptyState }, emptyState)))))));
41
+ React__default.createElement("td", { colSpan: table.getAllColumns().length, className: styles$2.emptyStateCell },
42
+ React__default.createElement("div", { className: styles$2.emptyState }, emptyState)))))));
42
43
  }
43
44
 
44
45
  function createTableSettings(data, columns, options) {
@@ -94,7 +95,7 @@ function getSortingSettings(sorting) {
94
95
  return sortingSettings;
95
96
  }
96
97
 
97
- var styles$2 = {"pagination":"_5TLZRabskzI-","paginationInfo":"k8VFFgHUPZ4-","paginationNav":"SfaHBP7KC3Y-","paginationSelect":"E4zFf5oEm-Y-","paginationSelectLabel":"N4LhT5occ94-","paginationButtons":"HQPsyRjssL0-","spinning":"YHT2Mg0618I-"};
98
+ var styles$1 = {"pagination":"_5TLZRabskzI-","paginationInfo":"k8VFFgHUPZ4-","paginationNav":"SfaHBP7KC3Y-","paginationSelect":"E4zFf5oEm-Y-","paginationSelectLabel":"N4LhT5occ94-","paginationButtons":"HQPsyRjssL0-","spinning":"YHT2Mg0618I-"};
98
99
 
99
100
  const defaultItemsPerPageOptions = ["10", "20", "30", "40", "50"];
100
101
  function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, }) {
@@ -103,16 +104,16 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
103
104
  const firstPosition = pageIndex * pageSize + 1;
104
105
  const secondPosition = Math.min(totalRows, pageSize * (pageIndex + 1));
105
106
  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]);
106
- return secondPosition <= 0 ? (React__default.createElement("div", { className: styles$2.pagination },
107
- React__default.createElement("div", { className: styles$2.paginationInfo }, !loading ? React__default.createElement(Text, null, "No items") : React__default.createElement(Glimmer, { width: 200 })))) : (React__default.createElement("div", { className: styles$2.pagination },
108
- React__default.createElement("div", { className: styles$2.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
109
- React__default.createElement("div", { className: styles$2.paginationNav },
110
- React__default.createElement("div", { className: styles$2.paginationSelect },
107
+ return secondPosition <= 0 ? (React__default.createElement("div", { className: styles$1.pagination },
108
+ React__default.createElement("div", { className: styles$1.paginationInfo }, !loading ? React__default.createElement(Text, null, "No items") : React__default.createElement(Glimmer, { width: 200 })))) : (React__default.createElement("div", { className: styles$1.pagination },
109
+ React__default.createElement("div", { className: styles$1.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
110
+ React__default.createElement("div", { className: styles$1.paginationNav },
111
+ React__default.createElement("div", { className: styles$1.paginationSelect },
111
112
  React__default.createElement(Select, { value: table.getState().pagination.pageSize, onChange: value => {
112
113
  table.setPageSize(Number(value));
113
114
  }, size: "small" }, itemsPerPageOptions.map(numOfPages => (React__default.createElement(SelectOption, { key: numOfPages, value: numOfPages }, numOfPages)))),
114
- React__default.createElement("span", { className: styles$2.paginationSelectLabel }, "per page")),
115
- React__default.createElement("div", { className: styles$2.paginationButtons },
115
+ React__default.createElement("span", { className: styles$1.paginationSelectLabel }, "per page")),
116
+ React__default.createElement("div", { className: styles$1.paginationButtons },
116
117
  React__default.createElement(Button, { type: "secondary", variation: "subtle", icon: "arrowLeft", ariaLabel: "arrowLeft", onClick: () => {
117
118
  table.previousPage();
118
119
  onPageChange();
@@ -123,18 +124,18 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
123
124
  }, disabled: !table.getCanNextPage() })))));
124
125
  }
125
126
 
126
- var styles$1 = {"mobileFooterContainer":"wMM6V80Rt-w-","mobileFooterRow":"HAoSIniVNvI-","mobileFooterRowData":"mNGvTIKaQIA-","spinning":"u7HdA4nq7qM-"};
127
+ var styles = {"mobileFooterContainer":"wMM6V80Rt-w-","mobileFooterRow":"HAoSIniVNvI-","mobileFooterRowData":"mNGvTIKaQIA-","spinning":"u7HdA4nq7qM-"};
127
128
 
128
129
  const DesktopView = ({ table }) => (React__default.createElement("tfoot", { "data-testid": "data-table-desktop-footer" }, table.getFooterGroups().map(footerGroup => (React__default.createElement("tr", { key: footerGroup.id }, footerGroup.headers.map(header => (React__default.createElement("th", { key: header.id, style: {
129
130
  width: header.getSize(),
130
131
  minWidth: header.column.columnDef.minSize,
131
132
  maxWidth: header.column.columnDef.maxSize,
132
133
  } }, flexRender(header.column.columnDef.footer, header.getContext())))))))));
133
- const HandheldView = ({ table }) => (React__default.createElement("div", { className: styles$1.mobileFooterContainer, "data-testid": "data-table-handheld-footer" }, table.getFooterGroups().map(footerGroup => (React__default.createElement("div", { key: footerGroup.id }, footerGroup.headers
134
+ const HandheldView = ({ table }) => (React__default.createElement("div", { className: styles.mobileFooterContainer, "data-testid": "data-table-handheld-footer" }, table.getFooterGroups().map(footerGroup => (React__default.createElement("div", { key: footerGroup.id }, footerGroup.headers
134
135
  .filter(header => header.column.columnDef.footer)
135
- .map((header, index) => (React__default.createElement(React__default.Fragment, null, index === 0 ? (React__default.createElement("div", { className: styles$1.mobileFooterRow }, flexRender(header.column.columnDef.footer, header.getContext()))) : (React__default.createElement("div", { className: styles$1.mobileFooterRow, key: footerGroup.id },
136
+ .map((header, index) => (React__default.createElement(React__default.Fragment, null, index === 0 ? (React__default.createElement("div", { className: styles.mobileFooterRow }, flexRender(header.column.columnDef.footer, header.getContext()))) : (React__default.createElement("div", { className: styles.mobileFooterRow, key: footerGroup.id },
136
137
  flexRender(header.column.columnDef.header, header.getContext()),
137
- React__default.createElement("div", { className: styles$1.mobileFooterRowData }, flexRender(header.column.columnDef.footer, header.getContext()))))))))))));
138
+ React__default.createElement("div", { className: styles.mobileFooterRowData }, flexRender(header.column.columnDef.footer, header.getContext()))))))))))));
138
139
  const Footer = ({ table, viewType = "handheld", }) => {
139
140
  const hasFooter = table
140
141
  .getAllColumns()
@@ -145,42 +146,8 @@ const Footer = ({ table, viewType = "handheld", }) => {
145
146
  return null;
146
147
  };
147
148
 
148
- var styles = {"sortIcon":"NrRExUGE6GY-","inactive":"e3aVa36Y7W8-","active":"lDKd982Sr-w-","spinning":"D9cW6RdlpZ0-"};
149
-
150
- var SortDirection;
151
- (function (SortDirection) {
152
- SortDirection[SortDirection["ascending"] = 0] = "ascending";
153
- SortDirection[SortDirection["descending"] = 1] = "descending";
154
- SortDirection[SortDirection["equilibrium"] = 2] = "equilibrium";
155
- })(SortDirection || (SortDirection = {}));
156
- const sortStyleIndex = [
157
- {
158
- option: SortDirection.equilibrium,
159
- upArrowStyle: undefined,
160
- downArrowStyle: undefined,
161
- },
162
- {
163
- option: SortDirection.ascending,
164
- upArrowStyle: classnames(styles.active),
165
- downArrowStyle: classnames(styles.inactive),
166
- },
167
- {
168
- option: SortDirection.descending,
169
- upArrowStyle: classnames(styles.inactive),
170
- downArrowStyle: classnames(styles.active),
171
- },
172
- ];
173
- function SortIcon({ direction }) {
174
- const foundStyle = sortStyleIndex.find(style => style.option === direction);
175
- const finalStyle = foundStyle === undefined ? sortStyleIndex[0] : foundStyle;
176
- return (React__default.createElement("div", { className: classnames(styles.sortIcon) },
177
- React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
178
- React__default.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" }),
179
- React__default.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" }))));
180
- }
181
-
182
149
  function Header({ table, stickyHeader, sorting, onRowClick, }) {
183
- const stickyClass = classnames({ [styles$3.stickyHeader]: stickyHeader });
150
+ const stickyClass = classnames({ [styles$2.stickyHeader]: stickyHeader });
184
151
  return (React__default.createElement("thead", { className: stickyClass }, table.getHeaderGroups().map(headerGroup => (React__default.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map(header => {
185
152
  const isSorting = sorting && header.column.getCanSort();
186
153
  const headingCellInlineStyle = {
@@ -192,8 +159,8 @@ function Header({ table, stickyHeader, sorting, onRowClick, }) {
192
159
  headingCellInlineStyle.paddingRight = 0;
193
160
  }
194
161
  return (React__default.createElement("th", { key: header.id, colSpan: header.colSpan, className: isSorting
195
- ? classnames(styles$3.sortableColumn, {
196
- [styles$3.pinFirstHeaderSortable]: !!onRowClick,
162
+ ? classnames(styles$2.sortableColumn, {
163
+ [styles$2.pinFirstHeaderSortable]: !!onRowClick,
197
164
  })
198
165
  : "", onClick: sorting ? header.column.getToggleSortingHandler() : undefined, style: headingCellInlineStyle }, header.isPlaceholder ? null : (React__default.createElement("div", null,
199
166
  flexRender(header.column.columnDef.header, header.getContext()),
@@ -213,12 +180,12 @@ function DataTable({ data, columns, pagination, sorting, height, stickyHeader, p
213
180
  pagination,
214
181
  sorting,
215
182
  });
216
- const tableClasses = classnames(styles$3.table, {
217
- [styles$3.pinFirstColumn]: pinFirstColumn,
183
+ const tableClasses = classnames(styles$2.table, {
184
+ [styles$2.pinFirstColumn]: pinFirstColumn,
218
185
  });
219
186
  const table = useReactTable(tableSettings);
220
- return (React__default.createElement("div", { className: styles$3.dataTableContainer },
221
- React__default.createElement("div", { "data-testid": "ATL-DataTable-Container", className: styles$3.tableContainer, style: { height }, ref: ref },
187
+ return (React__default.createElement("div", { className: styles$2.dataTableContainer },
188
+ React__default.createElement("div", { "data-testid": "ATL-DataTable-Container", className: styles$2.tableContainer, style: { height }, ref: ref },
222
189
  React__default.createElement("table", { className: tableClasses },
223
190
  React__default.createElement(Header, { table: table, sorting: sorting, onRowClick: onRowClick, stickyHeader: stickyHeader }),
224
191
  React__default.createElement(Body, { table: table, onRowClick: onRowClick, emptyState: emptyState, loading: loading }),
@@ -232,5 +199,18 @@ function DataTable({ data, columns, pagination, sorting, height, stickyHeader, p
232
199
  ? pagination.totalItems
233
200
  : table.getCoreRowModel().rows.length, loading: loading, onPageChange: () => { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0); } }))));
234
201
  }
202
+ DataTable.Table = DataTableTable;
203
+ DataTable.Header = DataTableHeader;
204
+ DataTable.HeaderCell = DataTableHeaderCell;
205
+ DataTable.Row = DataTableRow;
206
+ DataTable.Cell = DataTableCell;
207
+ DataTable.RowActions = DataTableRowActions;
208
+ DataTable.Actions = DataTableActions;
209
+ DataTable.Body = DataTableBody;
210
+ DataTable.Container = DataTableContainer;
211
+ DataTable.SortableHeader = DataTableSortableHeader;
212
+ DataTable.Footer = DataTableFooter;
213
+ DataTable.Pagination = DataTablePagination;
214
+ DataTable.PaginationButton = DataTablePaginationButton;
235
215
 
236
216
  export { DataTable as D };
@@ -0,0 +1,127 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var classnames = require('classnames');
5
+ var tslib_es6 = require('./tslib.es6-cjs.js');
6
+ var Button = require('./Button-cjs.js');
7
+
8
+ var styles$1 = {"sortIcon":"NrRExUGE6GY-","inactive":"e3aVa36Y7W8-","active":"lDKd982Sr-w-","spinning":"D9cW6RdlpZ0-"};
9
+
10
+ exports.SortDirection = void 0;
11
+ (function (SortDirection) {
12
+ SortDirection[SortDirection["ascending"] = 0] = "ascending";
13
+ SortDirection[SortDirection["descending"] = 1] = "descending";
14
+ SortDirection[SortDirection["equilibrium"] = 2] = "equilibrium";
15
+ })(exports.SortDirection || (exports.SortDirection = {}));
16
+ const sortStyleIndex = [
17
+ {
18
+ option: exports.SortDirection.equilibrium,
19
+ upArrowStyle: undefined,
20
+ downArrowStyle: undefined,
21
+ },
22
+ {
23
+ option: exports.SortDirection.ascending,
24
+ upArrowStyle: classnames(styles$1.active),
25
+ downArrowStyle: classnames(styles$1.inactive),
26
+ },
27
+ {
28
+ option: exports.SortDirection.descending,
29
+ upArrowStyle: classnames(styles$1.inactive),
30
+ downArrowStyle: classnames(styles$1.active),
31
+ },
32
+ ];
33
+ function SortIcon({ direction }) {
34
+ const foundStyle = sortStyleIndex.find(style => style.option === direction);
35
+ const finalStyle = foundStyle === undefined ? sortStyleIndex[0] : foundStyle;
36
+ return (React.createElement("div", { className: classnames(styles$1.sortIcon) },
37
+ React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
38
+ 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" }),
39
+ 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" }))));
40
+ }
41
+
42
+ var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","row":"sJQbtw-NEHU-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
43
+
44
+ function DataTableActions(props) {
45
+ return (React.createElement("div", Object.assign({ className: classnames(styles.actions, props.className) }, props), props.children));
46
+ }
47
+
48
+ function DataTableBody(props) {
49
+ return (React.createElement("tbody", Object.assign({ className: classnames(props.className) }, props), props.children));
50
+ }
51
+
52
+ const DataTableCell = React.forwardRef((props, ref) => {
53
+ return (React.createElement("td", Object.assign({}, props, { className: classnames(styles.cell, props.className), ref: ref }), props.children));
54
+ });
55
+ DataTableCell.displayName = "DataTableCell";
56
+
57
+ function DataTableContainer(props) {
58
+ return (React.createElement("div", Object.assign({ className: classnames(styles.container, props.className) }, props), props.children));
59
+ }
60
+
61
+ function DataTableFooter(_a) {
62
+ var { children, className, colSpan } = _a, props = tslib_es6.__rest(_a, ["children", "className", "colSpan"]);
63
+ return (React.createElement("tfoot", Object.assign({ className: classnames(styles.footer, className) }, props),
64
+ React.createElement("tr", null,
65
+ React.createElement("td", { colSpan: colSpan }, children))));
66
+ }
67
+
68
+ function DataTableHeader(props) {
69
+ return (React.createElement("thead", Object.assign({ className: classnames(styles.header, props.className) }, props),
70
+ React.createElement("tr", null, props.children)));
71
+ }
72
+
73
+ function DataTableHeaderCell(props) {
74
+ return (React.createElement("th", Object.assign({}, props, { className: classnames(styles.headerCell, props.className) }), props.children));
75
+ }
76
+ DataTableHeaderCell.displayName = "DataTableHeaderCell";
77
+
78
+ function DataTablePagination(_a) {
79
+ var { children, className } = _a, props = tslib_es6.__rest(_a, ["children", "className"]);
80
+ return (React.createElement("div", Object.assign({ className: classnames(styles.pagination, className) }, props), children));
81
+ }
82
+
83
+ function DataTablePaginationButton({ direction, onClick, disabled = false, ariaLabel, }) {
84
+ const isNext = direction === "next";
85
+ return (React.createElement(Button.Button, { label: "", onClick: onClick, icon: isNext ? "arrowRight" : "arrowLeft", type: "secondary", variation: "learning", disabled: disabled, ariaLabel: ariaLabel(direction) }));
86
+ }
87
+
88
+ const DataTableRow = React.forwardRef((props, ref) => {
89
+ return (React.createElement("tr", Object.assign({ className: classnames(styles.row, props.className), ref: ref }, props), props.children));
90
+ });
91
+ DataTableRow.displayName = "DataTableRow";
92
+
93
+ function DataTableRowActions(props) {
94
+ return (React.createElement("div", { className: classnames(styles.rowActions, props.className) }, props.children));
95
+ }
96
+
97
+ function DataTableSortableHeader(props) {
98
+ const { children, direction, onSort } = props;
99
+ const isSortable = direction !== undefined && onSort !== undefined;
100
+ if (!isSortable) {
101
+ return React.createElement(DataTableHeaderCell, Object.assign({}, props), children);
102
+ }
103
+ return (React.createElement(DataTableHeaderCell, Object.assign({}, props),
104
+ React.createElement("button", { type: "button", onClick: onSort, className: styles.sortableButton },
105
+ React.createElement("span", { className: styles.focusArea },
106
+ children,
107
+ React.createElement(SortIcon, { direction: direction })))));
108
+ }
109
+
110
+ function DataTableTable(props) {
111
+ return (React.createElement("table", Object.assign({ className: classnames(styles.tableElement, props.className) }, props), props.children));
112
+ }
113
+
114
+ exports.DataTableActions = DataTableActions;
115
+ exports.DataTableBody = DataTableBody;
116
+ exports.DataTableCell = DataTableCell;
117
+ exports.DataTableContainer = DataTableContainer;
118
+ exports.DataTableFooter = DataTableFooter;
119
+ exports.DataTableHeader = DataTableHeader;
120
+ exports.DataTableHeaderCell = DataTableHeaderCell;
121
+ exports.DataTablePagination = DataTablePagination;
122
+ exports.DataTablePaginationButton = DataTablePaginationButton;
123
+ exports.DataTableRow = DataTableRow;
124
+ exports.DataTableRowActions = DataTableRowActions;
125
+ exports.DataTableSortableHeader = DataTableSortableHeader;
126
+ exports.DataTableTable = DataTableTable;
127
+ exports.SortIcon = SortIcon;
@@ -0,0 +1,112 @@
1
+ import React__default, { forwardRef } from 'react';
2
+ import classnames from 'classnames';
3
+ import { _ as __rest } from './tslib.es6-es.js';
4
+ import { B as Button } from './Button-es.js';
5
+
6
+ var styles$1 = {"sortIcon":"NrRExUGE6GY-","inactive":"e3aVa36Y7W8-","active":"lDKd982Sr-w-","spinning":"D9cW6RdlpZ0-"};
7
+
8
+ var SortDirection;
9
+ (function (SortDirection) {
10
+ SortDirection[SortDirection["ascending"] = 0] = "ascending";
11
+ SortDirection[SortDirection["descending"] = 1] = "descending";
12
+ SortDirection[SortDirection["equilibrium"] = 2] = "equilibrium";
13
+ })(SortDirection || (SortDirection = {}));
14
+ const sortStyleIndex = [
15
+ {
16
+ option: SortDirection.equilibrium,
17
+ upArrowStyle: undefined,
18
+ downArrowStyle: undefined,
19
+ },
20
+ {
21
+ option: SortDirection.ascending,
22
+ upArrowStyle: classnames(styles$1.active),
23
+ downArrowStyle: classnames(styles$1.inactive),
24
+ },
25
+ {
26
+ option: SortDirection.descending,
27
+ upArrowStyle: classnames(styles$1.inactive),
28
+ downArrowStyle: classnames(styles$1.active),
29
+ },
30
+ ];
31
+ function SortIcon({ direction }) {
32
+ const foundStyle = sortStyleIndex.find(style => style.option === direction);
33
+ const finalStyle = foundStyle === undefined ? sortStyleIndex[0] : foundStyle;
34
+ return (React__default.createElement("div", { className: classnames(styles$1.sortIcon) },
35
+ React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
36
+ React__default.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" }),
37
+ React__default.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" }))));
38
+ }
39
+
40
+ var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","row":"sJQbtw-NEHU-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
41
+
42
+ function DataTableActions(props) {
43
+ return (React__default.createElement("div", Object.assign({ className: classnames(styles.actions, props.className) }, props), props.children));
44
+ }
45
+
46
+ function DataTableBody(props) {
47
+ return (React__default.createElement("tbody", Object.assign({ className: classnames(props.className) }, props), props.children));
48
+ }
49
+
50
+ const DataTableCell = forwardRef((props, ref) => {
51
+ return (React__default.createElement("td", Object.assign({}, props, { className: classnames(styles.cell, props.className), ref: ref }), props.children));
52
+ });
53
+ DataTableCell.displayName = "DataTableCell";
54
+
55
+ function DataTableContainer(props) {
56
+ return (React__default.createElement("div", Object.assign({ className: classnames(styles.container, props.className) }, props), props.children));
57
+ }
58
+
59
+ function DataTableFooter(_a) {
60
+ var { children, className, colSpan } = _a, props = __rest(_a, ["children", "className", "colSpan"]);
61
+ return (React__default.createElement("tfoot", Object.assign({ className: classnames(styles.footer, className) }, props),
62
+ React__default.createElement("tr", null,
63
+ React__default.createElement("td", { colSpan: colSpan }, children))));
64
+ }
65
+
66
+ function DataTableHeader(props) {
67
+ return (React__default.createElement("thead", Object.assign({ className: classnames(styles.header, props.className) }, props),
68
+ React__default.createElement("tr", null, props.children)));
69
+ }
70
+
71
+ function DataTableHeaderCell(props) {
72
+ return (React__default.createElement("th", Object.assign({}, props, { className: classnames(styles.headerCell, props.className) }), props.children));
73
+ }
74
+ DataTableHeaderCell.displayName = "DataTableHeaderCell";
75
+
76
+ function DataTablePagination(_a) {
77
+ var { children, className } = _a, props = __rest(_a, ["children", "className"]);
78
+ return (React__default.createElement("div", Object.assign({ className: classnames(styles.pagination, className) }, props), children));
79
+ }
80
+
81
+ function DataTablePaginationButton({ direction, onClick, disabled = false, ariaLabel, }) {
82
+ const isNext = direction === "next";
83
+ return (React__default.createElement(Button, { label: "", onClick: onClick, icon: isNext ? "arrowRight" : "arrowLeft", type: "secondary", variation: "learning", disabled: disabled, ariaLabel: ariaLabel(direction) }));
84
+ }
85
+
86
+ const DataTableRow = forwardRef((props, ref) => {
87
+ return (React__default.createElement("tr", Object.assign({ className: classnames(styles.row, props.className), ref: ref }, props), props.children));
88
+ });
89
+ DataTableRow.displayName = "DataTableRow";
90
+
91
+ function DataTableRowActions(props) {
92
+ return (React__default.createElement("div", { className: classnames(styles.rowActions, props.className) }, props.children));
93
+ }
94
+
95
+ function DataTableSortableHeader(props) {
96
+ const { children, direction, onSort } = props;
97
+ const isSortable = direction !== undefined && onSort !== undefined;
98
+ if (!isSortable) {
99
+ return React__default.createElement(DataTableHeaderCell, Object.assign({}, props), children);
100
+ }
101
+ return (React__default.createElement(DataTableHeaderCell, Object.assign({}, props),
102
+ React__default.createElement("button", { type: "button", onClick: onSort, className: styles.sortableButton },
103
+ React__default.createElement("span", { className: styles.focusArea },
104
+ children,
105
+ React__default.createElement(SortIcon, { direction: direction })))));
106
+ }
107
+
108
+ function DataTableTable(props) {
109
+ return (React__default.createElement("table", Object.assign({ className: classnames(styles.tableElement, props.className) }, props), props.children));
110
+ }
111
+
112
+ export { DataTableActions as D, SortIcon as S, SortDirection as a, DataTableBody as b, DataTableCell as c, DataTableContainer as d, DataTableFooter as e, DataTableHeader as f, DataTableHeaderCell as g, DataTablePagination as h, DataTablePaginationButton as i, DataTableRow as j, DataTableRowActions as k, DataTableSortableHeader as l, DataTableTable as m };
package/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ var DataDump = require('./DataDump-cjs.js');
37
37
  var DataList = require('./DataList-cjs.js');
38
38
  var DataTable = require('./DataTable-cjs.js');
39
39
  require('./useResizeObserver-cjs.js');
40
+ require('./DataTableTable-cjs.js');
40
41
  var reactTable = require('@tanstack/react-table');
41
42
  var DatePicker = require('./DatePicker-cjs.js');
42
43
  var DescriptionList = require('./DescriptionList-cjs.js');
package/dist/index.mjs CHANGED
@@ -35,6 +35,7 @@ export { D as DataDump } from './DataDump-es.js';
35
35
  export { D as DataList } from './DataList-es.js';
36
36
  export { D as DataTable } from './DataTable-es.js';
37
37
  import './useResizeObserver-es.js';
38
+ import './DataTableTable-es.js';
38
39
  export { createColumnHelper } from '@tanstack/react-table';
39
40
  export { D as DatePicker } from './DatePicker-es.js';
40
41
  export { D as DescriptionList } from './DescriptionList-es.js';
package/dist/styles.css CHANGED
@@ -6052,6 +6052,10 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
6052
6052
  }
6053
6053
 
6054
6054
  .NrRExUGE6GY- {
6055
+ display: -ms-flexbox;
6056
+ display: flex;
6057
+ -ms-flex-align: center;
6058
+ align-items: center;
6055
6059
  padding-right: 8px;
6056
6060
  padding-right: var(--space-small);
6057
6061
  }
@@ -6073,6 +6077,136 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
6073
6077
  opacity: 0.6;
6074
6078
  }
6075
6079
 
6080
+ ._1-DPmbxOkZ8- {
6081
+ box-shadow: var(--shadow-small);
6082
+ border: 1px solid hsl(200, 13%, 87%);
6083
+ border: var(--border-base) solid var(--color-border);
6084
+ border-radius: 8px;
6085
+ border-radius: var(--radius-base);
6086
+ overflow: hidden;
6087
+ }
6088
+
6089
+ .kJeYcsgg700- {
6090
+ width: 100%;
6091
+ table-layout: auto;
6092
+ border-collapse: collapse;
6093
+ }
6094
+
6095
+ .kJeYcsgg700- tbody tr {
6096
+ border-bottom: 1px solid hsl(200, 13%, 87%);
6097
+ border-bottom: var(--border-base) solid var(--color-border);
6098
+ }
6099
+
6100
+ .kJeYcsgg700- tbody tr:last-child {
6101
+ border-bottom: none;
6102
+ }
6103
+
6104
+ ._5d2OcsTVgzU- {
6105
+ border-bottom: 2px solid hsl(200, 13%, 87%);
6106
+ border-bottom: var(--border-thick) solid var(--color-border);
6107
+ }
6108
+
6109
+ .LTx0tCU3F2I- {
6110
+ padding: 12px 16px;
6111
+ padding: var(--space-slim) var(--space-base);
6112
+ text-align: left;
6113
+ }
6114
+
6115
+ .WTQCrd2d8nw- {
6116
+ display: -ms-flexbox;
6117
+ display: flex;
6118
+ -ms-flex-align: center;
6119
+ align-items: center;
6120
+ gap: 8px;
6121
+ gap: var(--space-small);
6122
+ width: 100%;
6123
+ min-height: 24px;
6124
+ padding: 0;
6125
+ border: none;
6126
+ outline: transparent;
6127
+ color: inherit;
6128
+ font: inherit;
6129
+ background: none;
6130
+ cursor: pointer;
6131
+ }
6132
+
6133
+ .RipbH3rRU-E- {
6134
+ display: -ms-flexbox;
6135
+ display: flex;
6136
+ -ms-flex-align: center;
6137
+ align-items: center;
6138
+ gap: 8px;
6139
+ gap: var(--space-small);
6140
+ padding: 2px;
6141
+ padding: var(--space-smallest);
6142
+ border-radius: 8px;
6143
+ border-radius: var(--radius-base);
6144
+ }
6145
+
6146
+ .WTQCrd2d8nw-:focus-visible .RipbH3rRU-E- {
6147
+ box-shadow: 0px 0px 0px 2px rgba(255, 255, 255, 1), 0px 0px 0px 4px hsl(198, 12%, 57%);
6148
+ box-shadow: var(--shadow-focus);
6149
+ }
6150
+
6151
+ .sJQbtw-NEHU- {
6152
+ position: relative;
6153
+ }
6154
+
6155
+ .sJQbtw-NEHU-:hover {
6156
+ background-color: hsl(53, 21%, 93%);
6157
+ background-color: var(--color-surface--hover);
6158
+ }
6159
+
6160
+ ._1UpLYTK64uY- {
6161
+ padding: 12px 16px;
6162
+ padding: var(--space-slim) var(--space-base);
6163
+ text-align: left;
6164
+ }
6165
+
6166
+ .qe-6UrAFLTo- {
6167
+ border-top: 1px solid hsl(200, 13%, 87%);
6168
+ border-top: var(--border-base) solid var(--color-border);
6169
+ }
6170
+
6171
+ ._2fZsLSaNPnI- {
6172
+ display: -ms-flexbox;
6173
+ display: flex;
6174
+ gap: 12px;
6175
+ gap: var(--space-slim);
6176
+ padding-bottom: 16px;
6177
+ padding-bottom: var(--space-base);
6178
+ }
6179
+
6180
+ .pElxuwpGmCI- {
6181
+ display: -ms-flexbox;
6182
+ display: flex;
6183
+ position: absolute;
6184
+ top: 50%;
6185
+ right: 16px;
6186
+ right: var(--space-base);
6187
+ z-index: 6;
6188
+ z-index: var(--elevation-menu);
6189
+ box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
6190
+ box-shadow: var(--shadow-base);
6191
+ padding: 2px;
6192
+ padding: var(--space-smallest);
6193
+ border: 1px solid hsl(200, 13%, 87%);
6194
+ border: var(--border-base) solid var(--color-border);
6195
+ border-radius: 8px;
6196
+ border-radius: var(--radius-base);
6197
+ background-color: rgba(255, 255, 255, 1);
6198
+ background-color: var(--color-surface);
6199
+ -webkit-transform: translateY(-50%);
6200
+ transform: translateY(-50%);
6201
+ gap: 2px;
6202
+ gap: var(--space-smallest);
6203
+ }
6204
+
6205
+ .thJ-CSoe0ps- {
6206
+ padding: 8px 16px;
6207
+ padding: var(--space-small) var(--space-base);
6208
+ }
6209
+
6076
6210
  @charset "UTF-8";
6077
6211
  /* stylelint-disable */
6078
6212
  .react-datepicker__year-read-view--down-arrow, .react-datepicker__month-read-view--down-arrow, .react-datepicker__month-year-read-view--down-arrow, .react-datepicker__navigation-icon::before {
@@ -62,6 +62,19 @@
62
62
  "DataList.Search",
63
63
  "DataList.StatusBar",
64
64
  "DataTable",
65
+ "DataTable.Actions",
66
+ "DataTable.Body",
67
+ "DataTable.Cell",
68
+ "DataTable.Container",
69
+ "DataTable.Footer",
70
+ "DataTable.Header",
71
+ "DataTable.HeaderCell",
72
+ "DataTable.Pagination",
73
+ "DataTable.PaginationButton",
74
+ "DataTable.Row",
75
+ "DataTable.RowActions",
76
+ "DataTable.SortableHeader",
77
+ "DataTable.Table",
65
78
  "DatePicker",
66
79
  "DescriptionList",
67
80
  "Disclosure",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.81.0",
3
+ "version": "6.82.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -542,5 +542,5 @@
542
542
  "> 1%",
543
543
  "IE 10"
544
544
  ],
545
- "gitHead": "0a0c72d9d554c30657ac0c9d0a88f8261770ac2e"
545
+ "gitHead": "451563dc96da61d6558b15f27e4c9cb9d7508259"
546
546
  }