grep-components 1.20.0-grepf-1803.1 → 1.20.0-grepf-1808.1

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.
@@ -5,6 +5,7 @@ export declare type UserMenuItem = {
5
5
  isAnchor?: boolean;
6
6
  href?: string;
7
7
  onClick?: (e: any) => void;
8
+ isDivider?: boolean;
8
9
  };
9
10
  export interface IAuthorizedPage {
10
11
  name: string;
@@ -36,7 +36,6 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
36
36
  onContextIdChanged?: (row: T) => void;
37
37
  onSortBy?: (col: TableColumn<T>) => any;
38
38
  caption?: React.ReactNode;
39
- menuButtonLabel?: string;
40
39
  /**
41
40
  * @deprecated No longer in use.
42
41
  */
@@ -65,6 +64,6 @@ export declare const useStyles: (params: StyleProps, styleOverrides?: {
65
64
  * @todo enhance page handling
66
65
  *
67
66
  */
68
- export declare const GrepTable: <T>({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick, menuButtonLabel, ...props }: GrepTableProps<T>) => JSX.Element;
67
+ export declare const GrepTable: <T>({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick, ...props }: GrepTableProps<T>) => JSX.Element;
69
68
  export { GrepTableRow };
70
69
  export default GrepTable;
package/dist/index.js CHANGED
@@ -3546,7 +3546,7 @@ var getElementIndex = function (el) {
3546
3546
  *
3547
3547
  */
3548
3548
  var GrepTable = function (_a) {
3549
- var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, menuButtonLabel = _a.menuButtonLabel, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "menuButtonLabel"]);
3549
+ var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick"]);
3550
3550
  var _c = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _c[0], setRowsPerPage = _c[1];
3551
3551
  var _d = __read(React__default.useState(null), 2), menuAnchor = _d[0], setMenuAnchor = _d[1];
3552
3552
  var _e = __read(React__default.useState(0), 2), currentPage = _e[0], _setCurrentPage = _e[1];
@@ -3625,7 +3625,7 @@ var GrepTable = function (_a) {
3625
3625
  e.preventDefault();
3626
3626
  break;
3627
3627
  }
3628
- }, tabIndex: 0, size: "large", "aria-label": menuButtonLabel !== null && menuButtonLabel !== void 0 ? menuButtonLabel : 'Åpne meny' },
3628
+ }, tabIndex: 0, size: "large" },
3629
3629
  React__default.createElement(MoreVert, null)))));
3630
3630
  };
3631
3631
  var _renderRow = function (row, index) {
@@ -20872,7 +20872,6 @@ var AppBar = function (_a) {
20872
20872
  var username = _a.username, currentPath = _a.currentPath, isProd = _a.isProd, appTitle = _a.appTitle, userMenuItems = _a.userMenuItems, menuItems = _a.menuItems, userRole = _a.userRole, colors = _a.colors;
20873
20873
  var _b = __read(React.useState(null), 2), userMenuAnchor = _b[0], setUserMenuAnchor = _b[1];
20874
20874
  var _handleIconButtonClick = function (event) {
20875
- event.preventDefault();
20876
20875
  setUserMenuAnchor(event.currentTarget);
20877
20876
  };
20878
20877
  var _handleCloseUserMenu = function () {
@@ -20884,6 +20883,24 @@ var AppBar = function (_a) {
20884
20883
  : currentPath.includes(page.redirectUrl || '');
20885
20884
  return (React.createElement(ToolbarMenuItem, { className: isActive ? 'active' : '', to: page.redirectUrl || '', key: page.name, tabIndex: 0 }, page === null || page === void 0 ? void 0 : page.translatedTextRef));
20886
20885
  };
20886
+ var renderMenuItems = function () {
20887
+ var newItemList = [];
20888
+ userMenuItems.forEach(function (item, index) {
20889
+ newItemList.push(item);
20890
+ if (userMenuItems.length > index + 1) {
20891
+ newItemList.push({ isDivider: true, id: '', label: '' });
20892
+ }
20893
+ });
20894
+ return newItemList.map(function (i, index) {
20895
+ return i.isDivider ? (React.createElement(Divider$1, { key: index })) : (React.createElement(MenuItem$1, { key: i.id, onClick: function () {
20896
+ setUserMenuAnchor(null);
20897
+ i.action && i.action();
20898
+ } }, i.isAnchor ? (React.createElement("a", { style: {
20899
+ textDecoration: 'inherit',
20900
+ color: 'inherit',
20901
+ }, tabIndex: -1, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)));
20902
+ });
20903
+ };
20887
20904
  return (React.createElement(Toolbar, null,
20888
20905
  React.createElement(ToolbarFixer, null,
20889
20906
  React.createElement(ToolbarInner, { colors: colors, role: "banner" },
@@ -20892,7 +20909,7 @@ var AppBar = function (_a) {
20892
20909
  appTitle,
20893
20910
  !isProd && (React.createElement(EnvironmentTitle, null, process.env.REACT_APP_HOST)))),
20894
20911
  React.createElement(ToolbarRight, null,
20895
- React.createElement(Button$1, { onClick: _handleIconButtonClick },
20912
+ React.createElement(Button$1, { "aria-controls": userMenuAnchor ? 'basic-menu' : undefined, "aria-haspopup": "true", "aria-expanded": userMenuAnchor ? 'true' : undefined, onClick: _handleIconButtonClick },
20896
20913
  React.createElement(AccountCircle, { color: "primary", fontSize: "large" }),
20897
20914
  React.createElement(UserContainer, null,
20898
20915
  React.createElement(AccountName, null, username),
@@ -20904,17 +20921,7 @@ var AppBar = function (_a) {
20904
20921
  }, transformOrigin: {
20905
20922
  vertical: 'top',
20906
20923
  horizontal: 'center',
20907
- } }, userMenuItems.map(function (i, index) {
20908
- return (React.createElement(Box, { key: i.id },
20909
- React.createElement(MenuItem$1, { key: i.id, onClick: function () {
20910
- setUserMenuAnchor(null);
20911
- i.action && i.action();
20912
- } }, i.isAnchor ? (React.createElement("a", { style: {
20913
- textDecoration: 'inherit',
20914
- color: 'inherit',
20915
- }, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)),
20916
- userMenuItems.length > index + 1 && React.createElement(Divider$1, null)));
20917
- })))),
20924
+ } }, renderMenuItems()))),
20918
20925
  React.createElement(ToolbarMenu, { role: "navigation" },
20919
20926
  React.createElement(ToolbarMenuInner, null, menuItems.map(function (page) { return _renderToolbarMenuItem(page); }))),
20920
20927
  React.createElement(MobileAppBar, { menuItems: menuItems, userMenuItems: userMenuItems, colors: colors }))));