grep-components 1.24.0-GREPF-2060.3 → 1.24.0-GREPF-2082.2

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,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React from 'react';
2
2
  import { ConfirmationOptions } from './components/dialog';
3
- export declare const ConfirmationServiceProvider: React.FC<{
4
- children: ReactNode;
5
- }>;
3
+ export declare const ConfirmationServiceProvider: React.FC;
6
4
  export declare const useConfirmation: () => (options: ConfirmationOptions) => Promise<void>;
@@ -1,6 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React from 'react';
2
2
  import { GrepDialogOptions } from './dialog';
3
- export declare const GrepDialogServiceProvider: React.FC<{
4
- children: ReactNode;
5
- }>;
3
+ export declare const GrepDialogServiceProvider: React.FC;
6
4
  export declare const useGrepDialog: () => (options: GrepDialogOptions) => void;
@@ -6,6 +6,7 @@ export interface Properties<T> extends TableCellProps {
6
6
  column: TableColumn<T>;
7
7
  lines?: number;
8
8
  selected?: boolean;
9
+ expanded?: boolean;
9
10
  }
10
11
  declare type ComponentProperties<T> = PropsWithChildren<Properties<T>>;
11
12
  export declare type Component<T> = FunctionComponent<ComponentProperties<T>>;
@@ -8,6 +8,7 @@ interface Properties<T> extends TableRowProps, Pick<TableCellProperties<T>, 'var
8
8
  clickable?: boolean;
9
9
  height?: number;
10
10
  underlineOnFocus?: boolean;
11
+ expanded?: boolean;
11
12
  }
12
13
  declare type Component<T> = React.FunctionComponent<Properties<T>>;
13
14
  export declare const GrepTableRow: Component<any>;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface GreyCoverProps {
3
3
  elevation?: boolean;
4
- children?: React.ReactNode;
5
4
  }
6
5
  declare const _default: React.ComponentType<GreyCoverProps>;
7
6
  export default _default;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import LocalizedFormatPlugin from 'dayjs/plugin/localizedFormat';
4
4
  import isBetweenPlugin from 'dayjs/plugin/isBetween';
5
5
  import { red, pink, purple, deepPurple, indigo, blue, lightBlue, cyan, teal, green, lightGreen, lime, yellow, amber, orange, deepOrange, brown, grey, blueGrey } from '@mui/material/colors';
6
6
  import * as React from 'react';
7
- import React__default, { useRef, useContext, forwardRef, createContext, useMemo as useMemo$1, createElement, useState, useCallback as useCallback$1, useEffect, useLayoutEffect } from 'react';
7
+ import React__default, { useRef, useContext, createContext, createElement, Fragment, forwardRef, useMemo as useMemo$1, useState, useCallback as useCallback$1, useEffect, useLayoutEffect } from 'react';
8
8
  import AccountCircle from '@mui/icons-material/AccountCircle';
9
9
  import ArrowDropdown from '@mui/icons-material/ArrowDropDown';
10
10
  import { Button, Box, Typography, IconButton, Menu, MenuItem, Tabs, Tab, Collapse, MenuList, Tooltip, Container, List, ListItem, ListItemText, ListItemIcon, Divider, ListItemButton, styled, TableCell, TableRow, TableSortLabel, TableHead, TablePagination, TableContainer, Table, TableBody, TableFooter, CircularProgress, Link, TextField, FormControl, InputLabel, Select, OutlinedInput, Input, Checkbox, FormHelperText, Grid, ToggleButtonGroup, AppBar as AppBar$1, Toolbar as Toolbar$1, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions } from '@mui/material';
@@ -552,7 +552,6 @@ function murmur2(str) {
552
552
 
553
553
  var unitlessKeys = {
554
554
  animationIterationCount: 1,
555
- aspectRatio: 1,
556
555
  borderImageOutset: 1,
557
556
  borderImageSlice: 1,
558
557
  borderImageWidth: 1,
@@ -651,7 +650,7 @@ var processStyleValue$1 = function processStyleValue(key, value) {
651
650
  };
652
651
 
653
652
  if (process.env.NODE_ENV !== 'production') {
654
- var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
653
+ var contentValuePattern = /(var|attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
655
654
  var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
656
655
  var oldProcessStyleValue = processStyleValue$1;
657
656
  var msPattern = /^-ms-/;
@@ -1311,7 +1310,6 @@ var RULESET = 'rule';
1311
1310
  var DECLARATION = 'decl';
1312
1311
  var IMPORT = '@import';
1313
1312
  var KEYFRAMES = '@keyframes';
1314
- var LAYER = '@layer';
1315
1313
 
1316
1314
  /**
1317
1315
  * @param {number}
@@ -1726,7 +1724,7 @@ function parse$1 (value, root, parent, rule, rules, rulesets, pseudo, points, de
1726
1724
  // \0 }
1727
1725
  case 0: case 125: scanning = 0;
1728
1726
  // ;
1729
- case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '');
1727
+ case 59 + offset:
1730
1728
  if (property > 0 && (strlen(characters) - length))
1731
1729
  append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
1732
1730
  break
@@ -1741,8 +1739,8 @@ function parse$1 (value, root, parent, rule, rules, rulesets, pseudo, points, de
1741
1739
  parse$1(characters, root, reference, reference, props, rulesets, length, points, children);
1742
1740
  else
1743
1741
  switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
1744
- // d l m s
1745
- case 100: case 108: case 109: case 115:
1742
+ // d m s
1743
+ case 100: case 109: case 115:
1746
1744
  parse$1(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
1747
1745
  break
1748
1746
  default:
@@ -1861,7 +1859,6 @@ function serialize (children, callback) {
1861
1859
  */
1862
1860
  function stringify (element, index, children, callback) {
1863
1861
  switch (element.type) {
1864
- case LAYER: if (element.children.length) break
1865
1862
  case IMPORT: case DECLARATION: return element.return = element.return || element.value
1866
1863
  case COMMENT: return ''
1867
1864
  case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
@@ -2572,19 +2569,10 @@ function _extends() {
2572
2569
  return _extends.apply(this, arguments);
2573
2570
  }
2574
2571
 
2575
- var isBrowser$1 = typeof document !== 'undefined';
2576
-
2577
- var syncFallback = function syncFallback(create) {
2578
- return create();
2579
- };
2580
-
2581
- var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
2582
- var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : useInsertionEffect || syncFallback;
2583
-
2584
2572
  var isBrowser = typeof document !== 'undefined';
2585
2573
  var hasOwnProperty = {}.hasOwnProperty;
2586
2574
 
2587
- var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
2575
+ var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
2588
2576
  // because this module is primarily intended for the browser and node
2589
2577
  // but it's also required in react native and similar environments sometimes
2590
2578
  // and we could have a special build just for that
@@ -2626,7 +2614,7 @@ if (!isBrowser) {
2626
2614
  cache = createCache({
2627
2615
  key: 'css'
2628
2616
  });
2629
- return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
2617
+ return /*#__PURE__*/createElement(EmotionCacheContext.Provider, {
2630
2618
  value: cache
2631
2619
  }, func(props, cache));
2632
2620
  } else {
@@ -2636,12 +2624,24 @@ if (!isBrowser) {
2636
2624
  };
2637
2625
  }
2638
2626
 
2639
- var ThemeContext = /* #__PURE__ */React.createContext({});
2627
+ var ThemeContext = /* #__PURE__ */createContext({});
2640
2628
 
2641
2629
  if (process.env.NODE_ENV !== 'production') {
2642
2630
  ThemeContext.displayName = 'EmotionThemeContext';
2643
2631
  }
2644
2632
 
2633
+ var isBrowser$1 = typeof document !== 'undefined';
2634
+ var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
2635
+ create();
2636
+ };
2637
+ function useInsertionEffectMaybe(create) {
2638
+ if (!isBrowser$1) {
2639
+ return create();
2640
+ }
2641
+
2642
+ useInsertionEffect(create);
2643
+ }
2644
+
2645
2645
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2646
2646
  var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
2647
2647
 
@@ -2650,7 +2650,7 @@ var Insertion = function Insertion(_ref) {
2650
2650
  serialized = _ref.serialized,
2651
2651
  isStringTag = _ref.isStringTag;
2652
2652
  registerStyles(cache, serialized, isStringTag);
2653
- var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
2653
+ var rules = useInsertionEffectMaybe(function () {
2654
2654
  return insertStyles(cache, serialized, isStringTag);
2655
2655
  });
2656
2656
 
@@ -2665,7 +2665,7 @@ var Insertion = function Insertion(_ref) {
2665
2665
  next = next.next;
2666
2666
  }
2667
2667
 
2668
- return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
2668
+ return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
2669
2669
  __html: rules
2670
2670
  }, _ref2.nonce = cache.sheet.nonce, _ref2));
2671
2671
  }
@@ -2692,7 +2692,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2692
2692
  className = props.className + " ";
2693
2693
  }
2694
2694
 
2695
- var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
2695
+ var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext));
2696
2696
 
2697
2697
  if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
2698
2698
  var labelFromStack = props[labelPropName];
@@ -2713,11 +2713,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2713
2713
 
2714
2714
  newProps.ref = ref;
2715
2715
  newProps.className = className;
2716
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
2716
+ return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
2717
2717
  cache: cache,
2718
2718
  serialized: serialized,
2719
2719
  isStringTag: typeof WrappedComponent === 'string'
2720
- }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
2720
+ }), /*#__PURE__*/createElement(WrappedComponent, newProps));
2721
2721
  });
2722
2722
 
2723
2723
  if (process.env.NODE_ENV !== 'production') {
@@ -3478,8 +3478,8 @@ var CellValue = styled('span')({
3478
3478
  WebkitBoxOrient: 'vertical',
3479
3479
  });
3480
3480
  var GrepTableRow$1 = function (_a) {
3481
- var row = _a.row, column = _a.column, selected = _a.selected, props = __rest$1(_a, ["row", "column", "selected"]);
3482
- var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, lang = column.lang, _b = column.lines, lines = _b === void 0 ? function () { return (selected ? undefined : 1); } : _b;
3481
+ var row = _a.row, column = _a.column, expanded = _a.expanded, props = __rest$1(_a, ["row", "column", "expanded"]);
3482
+ var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, lang = column.lang, _b = column.lines, lines = _b === void 0 ? function () { return (expanded ? undefined : 1); } : _b;
3483
3483
  var padding = column.padding;
3484
3484
  var value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) }, lang: typeof lang === 'string' ? lang : lang ? lang(row) : '' }, getCell(row)));
3485
3485
  if (forceTooltip || getTooltip) {
@@ -3490,8 +3490,8 @@ var GrepTableRow$1 = function (_a) {
3490
3490
  };
3491
3491
 
3492
3492
  var GrepTableRow = function (_a) {
3493
- 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"]);
3494
- var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index }, { column: column, row: row, variant: variant, selected: selected }))); };
3493
+ var row = _a.row, columns = _a.columns, selected = _a.selected, expanded = _a.expanded, variant = _a.variant; _a.clickable; _a.height; var underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["row", "columns", "selected", "expanded", "variant", "clickable", "height", "underlineOnFocus"]);
3494
+ var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index, expanded: expanded }, { column: column, row: row, variant: variant, selected: selected }))); };
3495
3495
  return (React__default.createElement(TableRow, __assign({ sx: {
3496
3496
  ':focus': { textDecoration: underlineOnFocus ? 'underline' : 'none' },
3497
3497
  }, tabIndex: props.tabIndex }, __assign({ selected: selected }, props)), columns.map(render)));
@@ -3667,23 +3667,35 @@ var GrepTable = function (_a) {
3667
3667
  var _d = __read(React__default.useState(null), 2), menuAnchor = _d[0], setMenuAnchor = _d[1];
3668
3668
  var _e = __read(React__default.useState(0), 2), currentPage = _e[0], _setCurrentPage = _e[1];
3669
3669
  var _f = __read(React__default.useState(), 2), selectedRowIndex = _f[0], _setSelectedRowIndex = _f[1];
3670
- var _g = __read(React__default.useState(), 2), dropdownContext = _g[0], setDropdownContext = _g[1];
3670
+ var _g = __read(React__default.useState(), 2), expandedRowIndex = _g[0], _setExpandedRowIndex = _g[1];
3671
+ var _h = __read(React__default.useState(), 2), dropdownContext = _h[0], setDropdownContext = _h[1];
3671
3672
  var selectedRow = data[selectedRowIndex] || null;
3672
- var setCurrentPage = useCallback$1(function (index, rowIndex) {
3673
+ var setCurrentPage = useCallback$1(function (index, rowIndex, shouldExpand) {
3673
3674
  index = pagination && index >= 0 ? index : 0;
3674
3675
  _setCurrentPage(index);
3675
3676
  _setSelectedRowIndex(rowIndex);
3676
- }, [_setCurrentPage, _setSelectedRowIndex, rowsPerPage, pagination]);
3677
- var setSelectedRowIndex = function (index) {
3677
+ if (shouldExpand) {
3678
+ _setExpandedRowIndex(rowIndex);
3679
+ }
3680
+ }, [
3681
+ _setCurrentPage,
3682
+ _setSelectedRowIndex,
3683
+ _setExpandedRowIndex,
3684
+ rowsPerPage,
3685
+ pagination,
3686
+ ]);
3687
+ var setSelectedRowIndex = function (index, shouldExpand) {
3688
+ if (shouldExpand === void 0) { shouldExpand = true; }
3678
3689
  var hasIndexChanged = index === selectedRowIndex;
3679
3690
  var pageIndex = Math.floor(index / rowsPerPage);
3680
- setCurrentPage(pageIndex, index);
3691
+ setCurrentPage(pageIndex, index, shouldExpand);
3681
3692
  if (hasIndexChanged && onSelectedRowChange) {
3682
3693
  onSelectedRowChange(data[index]);
3683
3694
  }
3684
3695
  };
3685
- var setSelectedElement = function (el) {
3686
- return setSelectedRowIndex(getElementIndex(el));
3696
+ var setSelectedElement = function (el, shouldExpand) {
3697
+ if (shouldExpand === void 0) { shouldExpand = true; }
3698
+ setSelectedRowIndex(getElementIndex(el), shouldExpand);
3687
3699
  };
3688
3700
  var tableRef = React__default.useRef(null);
3689
3701
  // focus selected row first tabable item
@@ -3751,15 +3763,22 @@ var GrepTable = function (_a) {
3751
3763
  var clickableRows = !!onRowClick;
3752
3764
  var disabled = isRowDisabled && isRowDisabled(row);
3753
3765
  var rowIndex = index + currentPage * rowsPerPage;
3754
- return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex !== null && rowTabIndex !== void 0 ? rowTabIndex : 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, clickable: clickableRows, onMouseDown: function (_a) {
3755
- var currentTarget = _a.currentTarget;
3756
- setSelectedElement(currentTarget);
3757
- if (!disableSelectOnClick) {
3758
- _handleRowClick(row);
3766
+ return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex !== null && rowTabIndex !== void 0 ? rowTabIndex : 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, expanded: rowIndex === expandedRowIndex, clickable: clickableRows, onMouseDown: function (e) {
3767
+ if (e.target.type === 'checkbox') {
3768
+ e.preventDefault();
3769
+ e.stopPropagation();
3770
+ setSelectedElement(e.currentTarget, false);
3771
+ }
3772
+ else {
3773
+ setSelectedElement(e.currentTarget);
3774
+ if (!disableSelectOnClick) {
3775
+ _handleRowClick(row);
3776
+ }
3777
+ }
3778
+ }, columns: rowColumns, row: row, style: { cursor: clickableRows && !disabled ? 'pointer' : '' }, onFocus: function (e) {
3779
+ if (selectedRowIndex !== rowIndex) {
3780
+ setSelectedElement(e.currentTarget);
3759
3781
  }
3760
- }, columns: rowColumns, row: row, style: { cursor: clickableRows && !disabled ? 'pointer' : '' }, onFocus: function (_a) {
3761
- var currentTarget = _a.currentTarget;
3762
- return setSelectedElement(currentTarget);
3763
3782
  }, underlineOnFocus: underlineOnFocus }));
3764
3783
  };
3765
3784
  var onKey = function (e) {
@@ -4059,14 +4078,13 @@ var useStyles$7 = makeStyles()(function (theme) {
4059
4078
  });
4060
4079
  });
4061
4080
 
4062
- var GDPR = function (_a) {
4063
- var children = _a.children;
4081
+ var GDPR = function (props) {
4064
4082
  var classes = useStyles$7().classes;
4065
4083
  return (React.createElement(Box, { className: classes.container },
4066
4084
  React.createElement(Info, { className: classes.icon }),
4067
4085
  React.createElement(Box, { className: classes.content },
4068
4086
  React.createElement(Typography, { className: classes.title }, "Personlig informasjon og personvern"),
4069
- React.createElement(Typography, { className: classes.body }, children))));
4087
+ React.createElement(Typography, { className: classes.body }, props.children))));
4070
4088
  };
4071
4089
 
4072
4090
  var GrepInput = function (_a) {
@@ -4839,7 +4857,7 @@ function invariant$1(condition, message) {
4839
4857
  throw new Error(prefix$2);
4840
4858
  }
4841
4859
  var provided = typeof message === 'function' ? message() : message;
4842
- var value = provided ? "".concat(prefix$2, ": ").concat(provided) : prefix$2;
4860
+ var value = provided ? prefix$2 + ": " + provided : prefix$2;
4843
4861
  throw new Error(value);
4844
4862
  }
4845
4863
 
@@ -10505,8 +10523,8 @@ function useHiddenTextElement(_ref2) {
10505
10523
  var AppContext = React__default.createContext(null);
10506
10524
 
10507
10525
  var peerDependencies = {
10508
- react: "^16.8.5 || ^17.0.0 || ^18.0.0",
10509
- "react-dom": "^16.8.5 || ^17.0.0 || ^18.0.0"
10526
+ react: "^16.8.5 || ^17.0.0",
10527
+ "react-dom": "^16.8.5 || ^17.0.0"
10510
10528
  };
10511
10529
 
10512
10530
  var semver = /(\d+)\.(\d+)\.(\d+)/;