grep-components 1.20.0-grepf-1816.1 → 1.20.0-grepf-1794.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 } from '@mui/material';
2
+ import { SelectProps, InputBaseComponentProps } from '@mui/material';
3
3
  export interface SelectItem {
4
4
  value: string | number;
5
5
  label?: string;
@@ -13,6 +13,7 @@ export interface GrepSelectProps extends SelectProps {
13
13
  selectItems: SelectItem[];
14
14
  unselectOption?: boolean;
15
15
  useCheckedSelect?: boolean;
16
+ inputProps?: InputBaseComponentProps | undefined;
16
17
  }
17
18
  declare const _default: React.ComponentType<GrepSelectProps>;
18
19
  export default _default;
@@ -4,7 +4,6 @@ import { TableColumn } from '..';
4
4
  interface Properties<T> extends TableSortLabelProps {
5
5
  column: TableColumn<T>;
6
6
  onSortBy?: (row: T) => void;
7
- empty?: boolean;
8
7
  }
9
8
  declare type Component<T> = React.FunctionComponent<Properties<T>>;
10
9
  export declare const TableHeaderCell: Component<any>;
@@ -9,6 +9,8 @@ export interface SearchBarProps {
9
9
  onClear: () => void;
10
10
  onSearchAll?: () => void;
11
11
  onInputChange: (value: string) => void;
12
+ id?: string;
13
+ title?: string;
12
14
  }
13
15
  declare const _default: React.ComponentType<SearchBarProps>;
14
16
  export default _default;
package/dist/index.js CHANGED
@@ -3438,14 +3438,14 @@ var useTableHeaderStyles = makeStyles()(function (_theme, _a) {
3438
3438
  });
3439
3439
 
3440
3440
  var TableHeaderCell = function (_a) {
3441
- var column = _a.column, onSortBy = _a.onSortBy, direction = _a.direction, active = _a.active, children = _a.children, _b = _a.empty, empty = _b === void 0 ? false : _b, props = __rest$1(_a, ["column", "onSortBy", "direction", "active", "children", "empty"]);
3441
+ var column = _a.column, onSortBy = _a.onSortBy, direction = _a.direction, active = _a.active, children = _a.children, props = __rest$1(_a, ["column", "onSortBy", "direction", "active", "children"]);
3442
3442
  var classes = useTableHeaderStyles({ column: column }).classes;
3443
3443
  var sortable = !!(onSortBy && column.sortable);
3444
- if (sortable && !empty) {
3445
- return (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props),
3444
+ if (sortable) {
3445
+ return (React__default.createElement(TableCell, __assign({ variant: "head", className: classes.th }, props),
3446
3446
  React__default.createElement(TableSortLabel, { active: active, direction: direction }, children)));
3447
3447
  }
3448
- return empty ? (React__default.createElement("td", { className: classes.th }, children)) : (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props), children));
3448
+ return (React__default.createElement(TableCell, __assign({ variant: "head", className: classes.th }, props), children));
3449
3449
  };
3450
3450
 
3451
3451
  var TableHeader = function (_a) {
@@ -3457,7 +3457,7 @@ var TableHeader = function (_a) {
3457
3457
  React__default.createElement(TableRow, null, headerColumns.map(function (column, index) {
3458
3458
  var sortable = !!(onSortBy && column.sortable);
3459
3459
  var label = column.label, colDef = column.colDef;
3460
- return (React__default.createElement(TableHeaderCell, { key: index, empty: !label, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: function () { return sortable && onSortBy(column); }, onKeyDown: onActivation(function (e) {
3460
+ return (React__default.createElement(TableHeaderCell, { key: index, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: function () { return sortable && onSortBy(column); }, onKeyDown: onActivation(function (e) {
3461
3461
  if (sortable) {
3462
3462
  e.preventDefault();
3463
3463
  onSortBy(column);
@@ -3500,6 +3500,9 @@ var PaginationActions = function (_a) {
3500
3500
  var GrepTablePagination = function (props) {
3501
3501
  var classes = usePaginationStyles().classes;
3502
3502
  return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions || [5, 10, 25, 50], SelectProps: {
3503
+ inputProps: {
3504
+ title: 'Velg antall elementer',
3505
+ },
3503
3506
  style: {
3504
3507
  gridArea: 'left',
3505
3508
  justifySelf: 'start',
@@ -3832,7 +3835,13 @@ var SearchBar = function (props) {
3832
3835
  } },
3833
3836
  React.createElement(Box, { className: classes.icon },
3834
3837
  React.createElement(Search, null)),
3835
- 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 } }),
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
+ } }),
3836
3845
  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) })))),
3837
3846
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
3838
3847
  props.helpText && (React.createElement(Typography, { className: classes.helptext }, props.helpText)),
@@ -3955,7 +3964,7 @@ var GrepSelect = function (props) {
3955
3964
  React.useEffect(function () {
3956
3965
  setLabelWidth(inputLabel.current.offsetWidth);
3957
3966
  }, []);
3958
- 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"]);
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"]);
3959
3968
  var error = errorMessage ? errorMessage.length > 0 : false;
3960
3969
  var selected = value;
3961
3970
  return (React.createElement(FormControl, { variant: outlined ? 'outlined' : 'standard', className: props.className, fullWidth: fullWidth, required: required, style: props.style, error: error, size: size, disabled: disabled },
@@ -3963,7 +3972,7 @@ var GrepSelect = function (props) {
3963
3972
  minWidth: 'max-content',
3964
3973
  overflow: 'visible',
3965
3974
  } }, label),
3966
- React.createElement(Select, __assign({}, rest, { inputProps: { id: id }, disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
3975
+ React.createElement(Select, __assign({}, rest, { inputProps: __assign({ id: id }, inputProps), disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
3967
3976
  // @todo: make input respect label length
3968
3977
  input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: {
3969
3978
  anchorOrigin: {