@indico-data/design-system 3.0.1 → 3.0.3

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.
Files changed (31) hide show
  1. package/lib/components/forms/checkbox/Checkbox.d.ts +1 -0
  2. package/lib/components/tanstackTable/TankstackTable.types.d.ts +1 -0
  3. package/lib/components/tanstackTable/TanstackTable.d.ts +1 -1
  4. package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +1 -3
  5. package/lib/components/tanstackTable/components/TableLoading/TableLoading.d.ts +6 -0
  6. package/lib/index.css +71 -77
  7. package/lib/index.d.ts +3 -1
  8. package/lib/index.esm.css +71 -77
  9. package/lib/index.esm.js +31 -27
  10. package/lib/index.esm.js.map +1 -1
  11. package/lib/index.js +31 -27
  12. package/lib/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/components/floatUI/styles/FloatUI.scss +1 -0
  15. package/src/components/forms/checkbox/Checkbox.tsx +7 -2
  16. package/src/components/pagination/Pagination.tsx +1 -1
  17. package/src/components/pagination/__tests__/Pagination.test.tsx +5 -0
  18. package/src/components/pill/styles/Pill.scss +33 -33
  19. package/src/components/tanstackTable/TankstackTable.types.ts +1 -0
  20. package/src/components/tanstackTable/TanstackTable.stories.tsx +10 -0
  21. package/src/components/tanstackTable/TanstackTable.tsx +6 -3
  22. package/src/components/tanstackTable/components/NoResults/NoResults.scss +2 -2
  23. package/src/components/tanstackTable/components/TableBody/TableBody.tsx +1 -25
  24. package/src/components/tanstackTable/components/TableLoading/TableLoading.tsx +18 -0
  25. package/src/components/tanstackTable/mock-data/table-configuration.tsx +6 -7
  26. package/src/components/tanstackTable/styles/table.scss +0 -25
  27. package/src/components/tooltip/Tooltip.tsx +0 -1
  28. package/src/styles/globals.scss +1 -1
  29. package/src/styles/variables/themes/dark.scss +17 -2
  30. package/src/styles/variables/themes/light.scss +17 -2
  31. package/src/components/tanstackTable/styles/test.scss +0 -19
package/lib/index.js CHANGED
@@ -5542,7 +5542,7 @@ const Pagination = (_a) => {
5542
5542
  const hasError = Number(inputValue) > totalPages || Number(inputValue) < 1;
5543
5543
  return (jsxRuntime.jsx("div", Object.assign({ className: classes }, rest, { children: jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs(Row, { gutterWidth: 12, align: "center", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("div", { className: "pagination__previous", children: jsxRuntime.jsx(Button$1, { "data-testid": "pagination-previous-button", ariaLabel: "Previous Page", variant: "link", onClick: handlePreviousPage, iconLeft: "chevron-left", isDisabled: isPreviousButtonDisabled }) }) }), jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("div", { className: "pagination__current-page", children: jsxRuntime.jsx(LabeledInput, { "data-testid": "pagination-current-page-input", className: classNames('pagination__current-page-input', {
5544
5544
  'has-error': hasError,
5545
- }), value: inputValue, name: "currentPage", label: "Current Page", hasHiddenLabel: true, onKeyDown: (e) => {
5545
+ }), value: totalPages === 0 ? '0' : inputValue, name: "currentPage", label: "Current Page", hasHiddenLabel: true, onKeyDown: (e) => {
5546
5546
  if (e.key === 'Enter') {
5547
5547
  validateAndUpdatePage(e.currentTarget.value);
5548
5548
  }
@@ -5804,8 +5804,8 @@ const Radio = React__namespace.default.forwardRef((_a, ref) => {
5804
5804
  });
5805
5805
 
5806
5806
  const Checkbox = React__namespace.default.forwardRef((_a, ref) => {
5807
- var { id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
5808
- return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "checkbox-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id, name: name, value: value, checked: isChecked, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsxRuntime.jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
5807
+ var { id, label, name, value, onChange, isDisabled, isChecked = false, className } = _a, rest = __rest(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked", "className"]);
5808
+ return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "checkbox-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: classNames('checkbox-input', className), type: "checkbox", id: id, name: name, value: value, checked: isChecked, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsxRuntime.jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
5809
5809
  });
5810
5810
 
5811
5811
  const Toggle = React__namespace.default.forwardRef((_a, ref) => {
@@ -41478,35 +41478,37 @@ const TableHeader = React.forwardRef(({ table }, ref) => {
41478
41478
  }) }, headerGroup.id))) }));
41479
41479
  });
41480
41480
 
41481
+ const TableBody = ({ table, onRowClick, activeRows }) => {
41482
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getRowModel().rows.map((row) => (jsxRuntime.jsx("tr", { className: classNames('tanstack-table__tbody__tr', {
41483
+ 'is-selected': row.getIsSelected(),
41484
+ 'show-hover': !!onRowClick,
41485
+ 'is-clicked': activeRows.includes(row.id), // Checkbox Is clicked
41486
+ }), children: row.getVisibleCells().map((cell) => {
41487
+ var _a, _b, _c, _d, _e, _f, _g, _h;
41488
+ const { columnDef } = cell.column;
41489
+ return (jsxRuntime.jsx("td", { className: classNames('tanstack-table__tbody__td', {
41490
+ 'pa-0': !!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.hasNoPadding),
41491
+ }), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())), onClick: () => {
41492
+ var _a, _b, _c;
41493
+ // if the cell is not preventRowSelection, then we can click the row
41494
+ if (!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.preventRowSelection)) {
41495
+ onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
41496
+ }
41497
+ }, children: flexRender(columnDef.cell, cell.getContext()) }, cell.id));
41498
+ }) }, row.id))) }));
41499
+ };
41500
+
41481
41501
  function CirclePulse(_a) {
41482
41502
  var { size = 'md', className } = _a, rest = __rest(_a, ["size", "className"]);
41483
41503
  return (jsxRuntime.jsx("div", Object.assign({ className: `circle-pulse circle-pulse-${size} ${className}`, "aria-hidden": true }, rest)));
41484
41504
  }
41485
41505
 
41486
- const TableBody = ({ table, onRowClick, isLoading, columnsLength, activeRows, }) => {
41487
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [table.getRowModel().rows.map((row) => (jsxRuntime.jsx("tr", { className: classNames('tanstack-table__tbody__tr', {
41488
- 'is-selected': row.getIsSelected(),
41489
- 'show-hover': !!onRowClick,
41490
- 'is-clicked': activeRows.includes(row.id), // Checkbox Is clicked
41491
- }), children: row.getVisibleCells().map((cell) => {
41492
- var _a, _b, _c, _d, _e, _f, _g, _h;
41493
- const { columnDef } = cell.column;
41494
- return (jsxRuntime.jsx("td", { className: classNames('tanstack-table__tbody__td', {
41495
- 'pa-0': !!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.hasNoPadding),
41496
- }), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())), onClick: () => {
41497
- var _a, _b, _c;
41498
- // if the cell is not preventRowSelection, then we can click the row
41499
- if (!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.preventRowSelection)) {
41500
- onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
41501
- }
41502
- }, children: flexRender(columnDef.cell, cell.getContext()) }, cell.id));
41503
- }) }, row.id))), isLoading && (jsxRuntime.jsx("tr", { className: "tanstack-table__tbody__tr", children: jsxRuntime.jsxs("td", { className: classNames('tanstack-table__centered-row', {
41504
- 'is-loading': isLoading,
41505
- }), colSpan: columnsLength, children: [jsxRuntime.jsx("h2", { className: "mb-12", children: "Table is loading..." }), jsxRuntime.jsx(CirclePulse, { "data-testid": "loading-indicator" })] }) }))] }));
41506
+ const TableLoading = ({ columns, message }) => {
41507
+ return (jsxRuntime.jsx("tr", { className: "tanstack-table__tbody__tr ", children: jsxRuntime.jsxs("td", { className: "tanstack-table__centered-row pa-6", colSpan: columns.length, children: [jsxRuntime.jsx("h2", { className: "my-12", children: message }), jsxRuntime.jsx(CirclePulse, { "data-testid": "loading-indicator", className: "mb-14" })] }) }));
41506
41508
  };
41507
41509
 
41508
41510
  function TanstackTable(_a) {
41509
- var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName, defaultSorting } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName", "defaultSorting"]);
41511
+ var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, isLoadingMessage = 'Table is loading...', defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName, defaultSorting } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "isLoadingMessage", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName", "defaultSorting"]);
41510
41512
  const { columns, defaultData, windowWidth, rowSelection, // This refers to the checkboxes.
41511
41513
  setRowSelection, formattedColumns, setFormattedColumns, } = useTanstackTable({
41512
41514
  defaultColumns,
@@ -41549,10 +41551,12 @@ function TanstackTable(_a) {
41549
41551
  ? (_a = error === null || error === void 0 ? void 0 : error.errorMessage) !== null && _a !== void 0 ? _a : 'There was an error isLoading the data.'
41550
41552
  : 'No results found.' }) }) }));
41551
41553
  }
41552
- return (jsxRuntime.jsx(TableBody, { table: table, onRowClick: onRowClick, isLoading: isLoading, columnsLength: columns.length, activeRows: activeRows }));
41554
+ if (isLoading) {
41555
+ return jsxRuntime.jsx(TableLoading, { columns: columns, message: isLoadingMessage });
41556
+ }
41557
+ return (jsxRuntime.jsx(TableBody, { table: table, onRowClick: onRowClick, activeRows: activeRows }));
41553
41558
  };
41554
41559
  return (jsxRuntime.jsxs("div", { className: "tanstack-table__outer-container", children: [jsxRuntime.jsxs("div", { className: "tanstack-table__container", children: [jsxRuntime.jsxs("table", { className: classNames('tanstack-table', className, {
41555
- 'is-Loading': isLoading,
41556
41560
  'is-striped': isStriped,
41557
41561
  }), children: [jsxRuntime.jsx("thead", { className: "tanstack-table__thead", children: jsxRuntime.jsx(TableHeader, { table: table, ref: thRefs }) }), jsxRuntime.jsx("tbody", { className: "tanstack-table__tbody", children: renderBody() })] }), hasSelectedRows && (jsxRuntime.jsx(ActionBar, { table: table, TableActions: TableActions, className: actionBarClassName }))] }), shouldRenderPagination ? (jsxRuntime.jsx(TablePagination, { currentPage: currentPage, rowCount: rowCount, onChangePage: onChangePage, rowsPerPage: rowsPerPage, totalEntriesText: totalEntriesText !== null && totalEntriesText !== void 0 ? totalEntriesText : `${totalRowsOnPage} of ${rowCount} entries` })) : null] }));
41558
41562
  }
@@ -43060,7 +43064,7 @@ const h="react-tooltip-core-styles",w="react-tooltip-base-styles",b={core:!1,bas
43060
43064
 
43061
43065
  const Tooltip = (_a) => {
43062
43066
  var { id, clickToShow, delayShow, delayHide, children, zIndex = 1000, place = 'top' } = _a, rest = __rest(_a, ["id", "clickToShow", "delayShow", "delayHide", "children", "zIndex", "place"]);
43063
- return (jsxRuntime.jsx(M, Object.assign({ border: "solid var(--pf-border-thin)var(--pf-border-color)", style: {
43067
+ return (jsxRuntime.jsx(M, Object.assign({ style: {
43064
43068
  backgroundColor: 'var(--pf-tooltip-background-color)',
43065
43069
  color: 'var(--pf-tooltip-font-color)',
43066
43070
  zIndex,