grep-components 1.20.0-grepf-1794.1 → 1.20.0-grepf-1778.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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SelectProps, InputBaseComponentProps } from '@mui/material';
2
+ import { SelectProps } from '@mui/material';
3
3
  export interface SelectItem {
4
4
  value: string | number;
5
5
  label?: string;
@@ -13,7 +13,6 @@ export interface GrepSelectProps extends SelectProps {
13
13
  selectItems: SelectItem[];
14
14
  unselectOption?: boolean;
15
15
  useCheckedSelect?: boolean;
16
- inputProps?: InputBaseComponentProps | undefined;
17
16
  }
18
17
  declare const _default: React.ComponentType<GrepSelectProps>;
19
18
  export default _default;
@@ -7,6 +7,7 @@ interface Properties<T> extends TableRowProps, Pick<TableCellProperties<T>, 'var
7
7
  columns: Array<TableColumn<T>>;
8
8
  clickable?: boolean;
9
9
  height?: number;
10
+ underlineOnFocus?: boolean;
10
11
  }
11
12
  declare type Component<T> = React.FunctionComponent<Properties<T>>;
12
13
  export declare const GrepTableRow: Component<any>;
@@ -41,6 +41,7 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
41
41
  */
42
42
  rowHeight?: number;
43
43
  disableSelectOnClick?: boolean;
44
+ underlineOnFocus?: boolean;
44
45
  }
45
46
  interface StyleProps {
46
47
  outlined?: boolean;
@@ -64,6 +65,6 @@ export declare const useStyles: (params: StyleProps, styleOverrides?: {
64
65
  * @todo enhance page handling
65
66
  *
66
67
  */
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;
68
+ export declare const GrepTable: <T>({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick, underlineOnFocus, ...props }: GrepTableProps<T>) => JSX.Element;
68
69
  export { GrepTableRow };
69
70
  export default GrepTable;
@@ -9,8 +9,6 @@ export interface SearchBarProps {
9
9
  onClear: () => void;
10
10
  onSearchAll?: () => void;
11
11
  onInputChange: (value: string) => void;
12
- id?: string;
13
- title?: string;
14
12
  }
15
13
  declare const _default: React.ComponentType<SearchBarProps>;
16
14
  export default _default;
package/dist/index.js CHANGED
@@ -39,7 +39,6 @@ export { ContentState } from 'draft-js';
39
39
  import ToggleButton from '@mui/material/ToggleButton';
40
40
  import FormatBold from '@mui/icons-material/FormatBold';
41
41
  import FormatItalic from '@mui/icons-material/FormatItalic';
42
- import Divider$1 from '@mui/material/Divider';
43
42
  import Menu$2 from '@mui/material/Menu';
44
43
  import MenuItem$1 from '@mui/material/MenuItem';
45
44
  import Button$1 from '@mui/material/Button';
@@ -3203,7 +3202,13 @@ var useFooterStyles = makeStyles()(function (theme) {
3203
3202
  _a),
3204
3203
  content: (_b = {
3205
3204
  display: 'flex',
3206
- width: '100%'
3205
+ width: '100%',
3206
+ a: {
3207
+ ':focus': {
3208
+ outlineColor: 'white',
3209
+ outlineOffset: '8px',
3210
+ },
3211
+ }
3207
3212
  },
3208
3213
  _b[theme.breakpoints.down('md')] = {
3209
3214
  flexDirection: 'column',
@@ -3256,6 +3261,11 @@ var useFooterStyles = makeStyles()(function (theme) {
3256
3261
  _e['&:last-child'] = {
3257
3262
  border: '0 !important',
3258
3263
  },
3264
+ _e[':focus'] = {
3265
+ background: 'inherit',
3266
+ boxShadow: '0px 0px 0px 1px white',
3267
+ borderRadius: '2px',
3268
+ },
3259
3269
  _e),
3260
3270
  itemText: {
3261
3271
  padding: 0,
@@ -3379,9 +3389,11 @@ var GrepTableRow$1 = function (_a) {
3379
3389
  };
3380
3390
 
3381
3391
  var GrepTableRow = function (_a) {
3382
- var row = _a.row, columns = _a.columns, selected = _a.selected, variant = _a.variant; _a.clickable; _a.height; var props = __rest$1(_a, ["row", "columns", "selected", "variant", "clickable", "height"]);
3392
+ var row = _a.row, columns = _a.columns, selected = _a.selected, variant = _a.variant; _a.clickable; _a.height; var underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["row", "columns", "selected", "variant", "clickable", "height", "underlineOnFocus"]);
3383
3393
  var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index }, { column: column, row: row, variant: variant, selected: selected }))); };
3384
- return React__default.createElement(TableRow, __assign({}, __assign({ selected: selected }, props)), columns.map(render));
3394
+ return (React__default.createElement(TableRow, __assign({ sx: {
3395
+ ':focus': { textDecoration: underlineOnFocus ? 'underline' : 'none' },
3396
+ } }, __assign({ selected: selected }, props)), columns.map(render)));
3385
3397
  };
3386
3398
 
3387
3399
  var usePaginationActionStyles = makeStyles()(function (_a) {
@@ -3500,9 +3512,6 @@ var PaginationActions = function (_a) {
3500
3512
  var GrepTablePagination = function (props) {
3501
3513
  var classes = usePaginationStyles().classes;
3502
3514
  return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions || [5, 10, 25, 50], SelectProps: {
3503
- inputProps: {
3504
- title: 'Velg antall elementer',
3505
- },
3506
3515
  style: {
3507
3516
  gridArea: 'left',
3508
3517
  justifySelf: 'start',
@@ -3549,7 +3558,7 @@ var getElementIndex = function (el) {
3549
3558
  *
3550
3559
  */
3551
3560
  var GrepTable = function (_a) {
3552
- 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"]);
3561
+ 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, underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "underlineOnFocus"]);
3553
3562
  var _c = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _c[0], setRowsPerPage = _c[1];
3554
3563
  var _d = __read(React__default.useState(null), 2), menuAnchor = _d[0], setMenuAnchor = _d[1];
3555
3564
  var _e = __read(React__default.useState(0), 2), currentPage = _e[0], _setCurrentPage = _e[1];
@@ -3647,7 +3656,7 @@ var GrepTable = function (_a) {
3647
3656
  }, columns: rowColumns, row: row, style: { cursor: clickableRows && !disabled ? 'pointer' : '' }, onFocus: function (_a) {
3648
3657
  var currentTarget = _a.currentTarget;
3649
3658
  return setSelectedElement(currentTarget);
3650
- } }));
3659
+ }, underlineOnFocus: underlineOnFocus }));
3651
3660
  };
3652
3661
  var onKey = function (e) {
3653
3662
  var maxIndex = data.length - 1;
@@ -3760,6 +3769,10 @@ var useStyles$b = makeStyles()({
3760
3769
  '&:hover': {
3761
3770
  textDecoration: 'underline',
3762
3771
  },
3772
+ '&:focus': {
3773
+ textDecoration: 'underline',
3774
+ outlineOffset: '2px',
3775
+ },
3763
3776
  },
3764
3777
  });
3765
3778
 
@@ -3835,13 +3848,7 @@ var SearchBar = function (props) {
3835
3848
  } },
3836
3849
  React.createElement(Box, { className: classes.icon },
3837
3850
  React.createElement(Search, null)),
3838
- React.createElement(TextField, { id: props.id, role: "search", className: classes.input, value: value, variant: "standard", inputRef: inputRef, onChange: _handleChange, autoFocus: props.autoFocus, placeholder: props.placeholder, InputProps: {
3839
- disableUnderline: true,
3840
- fullWidth: true,
3841
- inputProps: {
3842
- title: props.title,
3843
- },
3844
- } }),
3851
+ React.createElement(TextField, { role: "search", className: classes.input, value: value, variant: "standard", inputRef: inputRef, onChange: _handleChange, autoFocus: props.autoFocus, placeholder: props.placeholder, InputProps: { disableUnderline: true, fullWidth: true } }),
3845
3852
  React.createElement(Box, { className: classes.icon, style: { cursor: 'pointer' } }, !!value.length && (React.createElement(Close, { "data-testid": "searchBarClearBtn", tabIndex: 0, onClick: _handleClear, onKeyPress: keyboard.onActivation(_handleClear) })))),
3846
3853
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
3847
3854
  props.helpText && (React.createElement(Typography, { className: classes.helptext }, props.helpText)),
@@ -3964,7 +3971,7 @@ var GrepSelect = function (props) {
3964
3971
  React.useEffect(function () {
3965
3972
  setLabelWidth(inputLabel.current.offsetWidth);
3966
3973
  }, []);
3967
- var _b = props.unselectOption, unselectOption = _b === void 0 ? true : _b, errorMessage = props.errorMessage, selectItems = props.selectItems, helperText = props.helperText, fullWidth = props.fullWidth, outlined = props.outlined, disabled = props.disabled, required = props.required, label = props.label, inputProps = props.inputProps, value = props.value, size = props.size, id = props.id, useCheckedSelect = props.useCheckedSelect, rest = __rest$1(props, ["unselectOption", "errorMessage", "selectItems", "helperText", "fullWidth", "outlined", "disabled", "required", "label", "inputProps", "value", "size", "id", "useCheckedSelect"]);
3974
+ var _b = props.unselectOption, unselectOption = _b === void 0 ? true : _b, errorMessage = props.errorMessage, selectItems = props.selectItems, helperText = props.helperText, fullWidth = props.fullWidth, outlined = props.outlined, disabled = props.disabled, required = props.required, label = props.label, value = props.value, size = props.size, id = props.id, useCheckedSelect = props.useCheckedSelect, rest = __rest$1(props, ["unselectOption", "errorMessage", "selectItems", "helperText", "fullWidth", "outlined", "disabled", "required", "label", "value", "size", "id", "useCheckedSelect"]);
3968
3975
  var error = errorMessage ? errorMessage.length > 0 : false;
3969
3976
  var selected = value;
3970
3977
  return (React.createElement(FormControl, { variant: outlined ? 'outlined' : 'standard', className: props.className, fullWidth: fullWidth, required: required, style: props.style, error: error, size: size, disabled: disabled },
@@ -3972,7 +3979,7 @@ var GrepSelect = function (props) {
3972
3979
  minWidth: 'max-content',
3973
3980
  overflow: 'visible',
3974
3981
  } }, label),
3975
- React.createElement(Select, __assign({}, rest, { inputProps: __assign({ id: id }, inputProps), disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
3982
+ React.createElement(Select, __assign({}, rest, { inputProps: { id: id }, disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
3976
3983
  // @todo: make input respect label length
3977
3984
  input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: {
3978
3985
  anchorOrigin: {
@@ -20599,7 +20606,11 @@ var ToolbarTitle = styled(NavLink)(function () { return ({
20599
20606
  fontWeight: 500,
20600
20607
  textDecoration: 'none',
20601
20608
  ':hover': {
20602
- textDecoration: 'none',
20609
+ textDecoration: 'underline',
20610
+ },
20611
+ ':focus': {
20612
+ outline: 'none',
20613
+ textDecoration: 'underline',
20603
20614
  },
20604
20615
  }); });
20605
20616
  var EnvironmentTitle = styled('div')(function () { return ({
@@ -20810,12 +20821,21 @@ var ToolbarMenuItem = styled(NavLink)(function (_a) {
20810
20821
  },
20811
20822
  ':focus': {
20812
20823
  outline: 'none',
20824
+ color: menuItemHoverGreen,
20825
+ ':after': {
20826
+ bottom: '-4px',
20827
+ opacity: '1',
20828
+ },
20813
20829
  },
20814
20830
  ':hover': {
20815
20831
  textDecoration: 'none',
20816
20832
  color: menuItemHoverGreen,
20833
+ ':after': {
20834
+ bottom: '-4px',
20835
+ opacity: '1',
20836
+ },
20817
20837
  },
20818
- '.active:after, :hover:after, focus:after': {
20838
+ '.active:after': {
20819
20839
  bottom: '-4px',
20820
20840
  opacity: '1',
20821
20841
  },
@@ -20901,7 +20921,7 @@ var AppBar = function (_a) {
20901
20921
  appTitle,
20902
20922
  !isProd && (React.createElement(EnvironmentTitle, null, process.env.REACT_APP_HOST)))),
20903
20923
  React.createElement(ToolbarRight, null,
20904
- React.createElement(Button$1, { onClick: _handleIconButtonClick },
20924
+ React.createElement(Button$1, { "aria-controls": userMenuAnchor ? 'basic-menu' : undefined, "aria-haspopup": "true", "aria-expanded": userMenuAnchor ? 'true' : undefined, onClick: _handleIconButtonClick },
20905
20925
  React.createElement(AccountCircle, { color: "primary", fontSize: "large" }),
20906
20926
  React.createElement(UserContainer, null,
20907
20927
  React.createElement(AccountName, null, username),
@@ -20914,15 +20934,17 @@ var AppBar = function (_a) {
20914
20934
  vertical: 'top',
20915
20935
  horizontal: 'center',
20916
20936
  } }, userMenuItems.map(function (i, index) {
20917
- return (React.createElement(Box, { key: i.id },
20918
- React.createElement(MenuItem$1, { key: i.id, onClick: function () {
20919
- setUserMenuAnchor(null);
20920
- i.action && i.action();
20921
- } }, i.isAnchor ? (React.createElement("a", { style: {
20922
- textDecoration: 'inherit',
20923
- color: 'inherit',
20924
- }, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)),
20925
- userMenuItems.length > index + 1 && React.createElement(Divider$1, null)));
20937
+ return (React.createElement(MenuItem$1, { key: i.id, onClick: function () {
20938
+ setUserMenuAnchor(null);
20939
+ i.action && i.action();
20940
+ }, divider: userMenuItems.length > index + 1, sx: {
20941
+ ':focus': {
20942
+ textDecoration: 'underline',
20943
+ },
20944
+ } }, i.isAnchor ? (React.createElement("a", { style: {
20945
+ textDecoration: 'inherit',
20946
+ color: 'inherit',
20947
+ }, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)));
20926
20948
  })))),
20927
20949
  React.createElement(ToolbarMenu, { role: "navigation" },
20928
20950
  React.createElement(ToolbarMenuInner, null, menuItems.map(function (page) { return _renderToolbarMenuItem(page); }))),