grep-components 1.30.0-GREPF-2262.3 → 2.0.0

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,6 @@
1
1
  import React, { PropsWithChildren, FunctionComponent } from 'react';
2
2
  import { MenuItemProps } from '@mui/material';
3
+ import { TooltipPlacement } from '..';
3
4
  /**
4
5
  * TypeError: Failed to construct 'CustomEvent': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
5
6
  * hack to make React emulate event
@@ -18,6 +19,7 @@ export type ToggleState = 'collapse' | 'expand';
18
19
  export interface Properties extends Omit<MenuItemProps, 'button'> {
19
20
  items?: React.ReactNode;
20
21
  tooltipText?: string;
22
+ tooltipPlacement?: TooltipPlacement;
21
23
  onClose?: (event: CollapsableMenuStatusEvent) => void;
22
24
  level: number;
23
25
  }
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import { MenuItemProps, MenuProps } from '@mui/material';
3
3
  type BooleanFunction<T> = (context?: T) => boolean;
4
+ export type TooltipPlacement = 'bottom' | 'left' | 'right' | 'top' | 'bottom-end' | 'bottom-start' | 'left-end' | 'left-start' | 'right-end' | 'right-start' | 'top-end' | 'top-start' | undefined;
4
5
  export type DropdownMenuItem<T> = Omit<MenuItemProps, 'disabled'> & {
5
6
  label: string;
6
7
  tooltipText?: string;
8
+ tooltipPlacement?: TooltipPlacement;
7
9
  disabled?: BooleanFunction<T> | boolean;
8
10
  children?: Array<DropdownMenuItem<T>>;
9
11
  handleClick?: (context?: T) => void;
package/dist/index.js CHANGED
@@ -67,8 +67,6 @@ dayjs.extend(isBetweenPlugin);
67
67
  dayjs.extend(LocalizedFormatPlugin);
68
68
  dayjs.locale('nb');
69
69
  class DateRangeValue {
70
- from;
71
- to;
72
70
  constructor(from, to) {
73
71
  this.from = from;
74
72
  this.to = to;
@@ -1710,9 +1708,6 @@ const useStyles$g = makeStyles()(({ palette, transitions }, { open }) => ({
1710
1708
  * export class CollapsableMenuStatusEvent extends CustomEvent<React.Ref<any>> {}
1711
1709
  */
1712
1710
  class CollapsableMenuStatusEvent {
1713
- type;
1714
- currentTarget;
1715
- _defaultPrevented;
1716
1711
  get defaultPrevented() {
1717
1712
  return !!this._defaultPrevented;
1718
1713
  }
@@ -1724,7 +1719,7 @@ class CollapsableMenuStatusEvent {
1724
1719
  this._defaultPrevented = true;
1725
1720
  }
1726
1721
  }
1727
- const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tooltipText, disabled, ...props }) => {
1722
+ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tooltipText, tooltipPlacement, disabled, ...props }) => {
1728
1723
  const listItemRef = useRef(null);
1729
1724
  const [open, setOpen] = useState(false);
1730
1725
  const onStatusChange = useCallback$1((type) => new CollapsableMenuStatusEvent(type, listItemRef), [listItemRef]);
@@ -1773,7 +1768,7 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
1773
1768
  children,
1774
1769
  items && React__default.createElement(ExpandMore, { className: classes.expander })),
1775
1770
  items && (React__default.createElement(CollapsableMenu, { className: classes.subMenu, in: open, onMenuClose: collapse, onEntered: () => requestAnimationFrame(() => window.dispatchEvent(new Event('resize'))) }, items))));
1776
- return tooltipText ? (React__default.createElement(Tooltip, { title: tooltipText },
1771
+ return tooltipText ? (React__default.createElement(Tooltip, { title: tooltipText, placement: tooltipPlacement, arrow: true },
1777
1772
  React__default.createElement(MenuItem$1, { role: "menuitem", sx: disabled && !items
1778
1773
  ? { cursor: 'not-allowed', pointerEvents: 'inherit !important' }
1779
1774
  : { pointerEvents: 'inherit !important' }, className: classes.root, onMouseOver: (e) => e.currentTarget.focus(), selected: open, ref: listItemRef, onClick: handleClick, onKeyDown: handleKey }, renderInner()))) : (React__default.createElement(MenuItem$1, { sx: disabled && !items ? { cursor: 'not-allowed' } : {}, className: classes.root, onMouseOver: (e) => e.currentTarget.focus(), ref: listItemRef, selected: open, onClick: handleClick, onKeyDown: handleKey, ...props }, renderInner()));
@@ -1983,9 +1978,9 @@ const ContainedLinkList = (props) => {
1983
1978
  };
1984
1979
 
1985
1980
  class OverflowTooltip extends React.Component {
1986
- nodeRef = React.createRef();
1987
1981
  constructor(props) {
1988
1982
  super(props);
1983
+ this.nodeRef = React.createRef();
1989
1984
  this.state = { overflow: false };
1990
1985
  }
1991
1986
  componentDidMount() {
@@ -3648,8 +3643,6 @@ var rafSchd = function rafSchd(fn) {
3648
3643
  return wrapperFn;
3649
3644
  };
3650
3645
 
3651
- var rafSchd$1 = rafSchd;
3652
-
3653
3646
  var isProduction = process.env.NODE_ENV === 'production';
3654
3647
  var spacesAndTabs = /[ \t]{2,}/g;
3655
3648
  var lineStartWithSpaces = /^[ \t]*/gm;
@@ -6978,7 +6971,7 @@ function getScrollListener(_ref) {
6978
6971
  onWindowScroll(getWindowScroll());
6979
6972
  }
6980
6973
 
6981
- var scheduled = rafSchd$1(updateScroll);
6974
+ var scheduled = rafSchd(updateScroll);
6982
6975
  var binding = getWindowScrollBinding(scheduled);
6983
6976
  var unbind = noop;
6984
6977
 
@@ -8324,8 +8317,8 @@ var scroll$1 = (function (_ref) {
8324
8317
  var createFluidScroller = (function (_ref) {
8325
8318
  var scrollWindow = _ref.scrollWindow,
8326
8319
  scrollDroppable = _ref.scrollDroppable;
8327
- var scheduleWindowScroll = rafSchd$1(scrollWindow);
8328
- var scheduleDroppableScroll = rafSchd$1(scrollDroppable);
8320
+ var scheduleWindowScroll = rafSchd(scrollWindow);
8321
+ var scheduleDroppableScroll = rafSchd(scrollDroppable);
8329
8322
  var dragging = null;
8330
8323
 
8331
8324
  var tryScroll = function tryScroll(state) {
@@ -10289,7 +10282,7 @@ function tryStart(_ref3) {
10289
10282
  }
10290
10283
 
10291
10284
  function fluidLift(clientSelection) {
10292
- var move$1 = rafSchd$1(function (client) {
10285
+ var move$1 = rafSchd(function (client) {
10293
10286
  tryDispatchWhenDragging(function () {
10294
10287
  return move({
10295
10288
  client: client
@@ -10923,7 +10916,7 @@ function useDroppablePublisher(args) {
10923
10916
  memoizedUpdateScroll(scroll.x, scroll.y);
10924
10917
  }, [getClosestScroll, memoizedUpdateScroll]);
10925
10918
  var scheduleScrollUpdate = useMemo(function () {
10926
- return rafSchd$1(updateScroll);
10919
+ return rafSchd(updateScroll);
10927
10920
  }, [updateScroll]);
10928
10921
  var onClosestScroll = useCallback(function () {
10929
10922
  var dragging = whileDraggingRef.current;
@@ -12406,7 +12399,7 @@ function styleToCSS(styleDescr) {
12406
12399
  }).join('; ');
12407
12400
  }
12408
12401
 
12409
- var BLOCK_TYPE$1 = {
12402
+ var BLOCK_TYPE = {
12410
12403
  // This is used to represent a normal text block (paragraph).
12411
12404
  UNSTYLED: 'unstyled',
12412
12405
  HEADER_ONE: 'header-one',
@@ -12422,12 +12415,12 @@ var BLOCK_TYPE$1 = {
12422
12415
  CODE: 'code-block',
12423
12416
  ATOMIC: 'atomic'
12424
12417
  };
12425
- var ENTITY_TYPE$1 = {
12418
+ var ENTITY_TYPE = {
12426
12419
  LINK: 'LINK',
12427
12420
  IMAGE: 'IMAGE',
12428
12421
  EMBED: 'embed'
12429
12422
  };
12430
- var INLINE_STYLE$1 = {
12423
+ var INLINE_STYLE = {
12431
12424
  BOLD: 'BOLD',
12432
12425
  CODE: 'CODE',
12433
12426
  ITALIC: 'ITALIC',
@@ -17481,11 +17474,11 @@ function _defineProperties$1(target, props) { for (var i = 0; i < props.length;
17481
17474
  function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
17482
17475
 
17483
17476
  function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17484
- var BOLD = INLINE_STYLE$1.BOLD,
17485
- CODE = INLINE_STYLE$1.CODE,
17486
- ITALIC = INLINE_STYLE$1.ITALIC,
17487
- STRIKETHROUGH = INLINE_STYLE$1.STRIKETHROUGH,
17488
- UNDERLINE = INLINE_STYLE$1.UNDERLINE;
17477
+ var BOLD = INLINE_STYLE.BOLD,
17478
+ CODE = INLINE_STYLE.CODE,
17479
+ ITALIC = INLINE_STYLE.ITALIC,
17480
+ STRIKETHROUGH = INLINE_STYLE.STRIKETHROUGH,
17481
+ UNDERLINE = INLINE_STYLE.UNDERLINE;
17489
17482
  var INDENT = ' ';
17490
17483
  var BREAK = '<br>';
17491
17484
  var DATA_ATTRIBUTE$1 = /^data-([a-z0-9-]+)$/;
@@ -17504,14 +17497,14 @@ var DEFAULT_STYLE_MAP = (_DEFAULT_STYLE_MAP = {}, _defineProperty$1(_DEFAULT_STY
17504
17497
 
17505
17498
  var DEFAULT_STYLE_ORDER = [BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, CODE]; // Map entity data to element attributes.
17506
17499
 
17507
- var ENTITY_ATTR_MAP = (_ENTITY_ATTR_MAP = {}, _defineProperty$1(_ENTITY_ATTR_MAP, ENTITY_TYPE$1.LINK, {
17500
+ var ENTITY_ATTR_MAP = (_ENTITY_ATTR_MAP = {}, _defineProperty$1(_ENTITY_ATTR_MAP, ENTITY_TYPE.LINK, {
17508
17501
  url: 'href',
17509
17502
  href: 'href',
17510
17503
  rel: 'rel',
17511
17504
  target: 'target',
17512
17505
  title: 'title',
17513
17506
  className: 'class'
17514
- }), _defineProperty$1(_ENTITY_ATTR_MAP, ENTITY_TYPE$1.IMAGE, {
17507
+ }), _defineProperty$1(_ENTITY_ATTR_MAP, ENTITY_TYPE.IMAGE, {
17515
17508
  src: 'src',
17516
17509
  height: 'height',
17517
17510
  width: 'width',
@@ -17519,7 +17512,7 @@ var ENTITY_ATTR_MAP = (_ENTITY_ATTR_MAP = {}, _defineProperty$1(_ENTITY_ATTR_MAP
17519
17512
  className: 'class'
17520
17513
  }), _ENTITY_ATTR_MAP); // Map entity data to element attributes.
17521
17514
 
17522
- var DATA_TO_ATTR = (_DATA_TO_ATTR = {}, _defineProperty$1(_DATA_TO_ATTR, ENTITY_TYPE$1.LINK, function (entityType, entity) {
17515
+ var DATA_TO_ATTR = (_DATA_TO_ATTR = {}, _defineProperty$1(_DATA_TO_ATTR, ENTITY_TYPE.LINK, function (entityType, entity) {
17523
17516
  var attrMap = ENTITY_ATTR_MAP.hasOwnProperty(entityType) ? ENTITY_ATTR_MAP[entityType] : {};
17524
17517
  var data = entity.getData();
17525
17518
  var attrs = {};
@@ -17537,7 +17530,7 @@ var DATA_TO_ATTR = (_DATA_TO_ATTR = {}, _defineProperty$1(_DATA_TO_ATTR, ENTITY_
17537
17530
  }
17538
17531
 
17539
17532
  return attrs;
17540
- }), _defineProperty$1(_DATA_TO_ATTR, ENTITY_TYPE$1.IMAGE, function (entityType, entity) {
17533
+ }), _defineProperty$1(_DATA_TO_ATTR, ENTITY_TYPE.IMAGE, function (entityType, entity) {
17541
17534
  var attrMap = ENTITY_ATTR_MAP.hasOwnProperty(entityType) ? ENTITY_ATTR_MAP[entityType] : {};
17542
17535
  var data = entity.getData();
17543
17536
  var attrs = {};
@@ -17560,35 +17553,35 @@ var DATA_TO_ATTR = (_DATA_TO_ATTR = {}, _defineProperty$1(_DATA_TO_ATTR, ENTITY_
17560
17553
 
17561
17554
  function getTags(blockType, defaultBlockTag) {
17562
17555
  switch (blockType) {
17563
- case BLOCK_TYPE$1.HEADER_ONE:
17556
+ case BLOCK_TYPE.HEADER_ONE:
17564
17557
  return ['h1'];
17565
17558
 
17566
- case BLOCK_TYPE$1.HEADER_TWO:
17559
+ case BLOCK_TYPE.HEADER_TWO:
17567
17560
  return ['h2'];
17568
17561
 
17569
- case BLOCK_TYPE$1.HEADER_THREE:
17562
+ case BLOCK_TYPE.HEADER_THREE:
17570
17563
  return ['h3'];
17571
17564
 
17572
- case BLOCK_TYPE$1.HEADER_FOUR:
17565
+ case BLOCK_TYPE.HEADER_FOUR:
17573
17566
  return ['h4'];
17574
17567
 
17575
- case BLOCK_TYPE$1.HEADER_FIVE:
17568
+ case BLOCK_TYPE.HEADER_FIVE:
17576
17569
  return ['h5'];
17577
17570
 
17578
- case BLOCK_TYPE$1.HEADER_SIX:
17571
+ case BLOCK_TYPE.HEADER_SIX:
17579
17572
  return ['h6'];
17580
17573
 
17581
- case BLOCK_TYPE$1.UNORDERED_LIST_ITEM:
17582
- case BLOCK_TYPE$1.ORDERED_LIST_ITEM:
17574
+ case BLOCK_TYPE.UNORDERED_LIST_ITEM:
17575
+ case BLOCK_TYPE.ORDERED_LIST_ITEM:
17583
17576
  return ['li'];
17584
17577
 
17585
- case BLOCK_TYPE$1.BLOCKQUOTE:
17578
+ case BLOCK_TYPE.BLOCKQUOTE:
17586
17579
  return ['blockquote'];
17587
17580
 
17588
- case BLOCK_TYPE$1.CODE:
17581
+ case BLOCK_TYPE.CODE:
17589
17582
  return ['pre', 'code'];
17590
17583
 
17591
- case BLOCK_TYPE$1.ATOMIC:
17584
+ case BLOCK_TYPE.ATOMIC:
17592
17585
  return ['figure'];
17593
17586
 
17594
17587
  default:
@@ -17602,10 +17595,10 @@ function getTags(blockType, defaultBlockTag) {
17602
17595
 
17603
17596
  function getWrapperTag(blockType) {
17604
17597
  switch (blockType) {
17605
- case BLOCK_TYPE$1.UNORDERED_LIST_ITEM:
17598
+ case BLOCK_TYPE.UNORDERED_LIST_ITEM:
17606
17599
  return 'ul';
17607
17600
 
17608
- case BLOCK_TYPE$1.ORDERED_LIST_ITEM:
17601
+ case BLOCK_TYPE.ORDERED_LIST_ITEM:
17609
17602
  return 'ol';
17610
17603
 
17611
17604
  default:
@@ -17920,7 +17913,7 @@ function () {
17920
17913
  var _styleName = _step3.value;
17921
17914
 
17922
17915
  // If our block type is CODE then don't wrap inline code elements.
17923
- if (_styleName === CODE && blockType === BLOCK_TYPE$1.CODE) {
17916
+ if (_styleName === CODE && blockType === BLOCK_TYPE.CODE) {
17924
17917
  continue;
17925
17918
  }
17926
17919
 
@@ -17996,13 +17989,13 @@ function () {
17996
17989
 
17997
17990
  var attrString = stringifyAttrs(attributes);
17998
17991
  return "<".concat(element).concat(attrString, ">").concat(content, "</").concat(element, ">");
17999
- } else if (entityType != null && entityType === ENTITY_TYPE$1.LINK) {
17992
+ } else if (entityType != null && entityType === ENTITY_TYPE.LINK) {
18000
17993
  var attrs = DATA_TO_ATTR.hasOwnProperty(entityType) ? DATA_TO_ATTR[entityType](entityType, entity) : null;
18001
17994
 
18002
17995
  var _attrString = stringifyAttrs(attrs);
18003
17996
 
18004
17997
  return "<a".concat(_attrString, ">").concat(content, "</a>");
18005
- } else if (entityType != null && entityType === ENTITY_TYPE$1.IMAGE) {
17998
+ } else if (entityType != null && entityType === ENTITY_TYPE.IMAGE) {
18006
17999
  var _attrs = DATA_TO_ATTR.hasOwnProperty(entityType) ? DATA_TO_ATTR[entityType](entityType, entity) : null;
18007
18000
 
18008
18001
  var _attrString2 = stringifyAttrs(_attrs);
@@ -18056,8 +18049,8 @@ function stringifyAttrs(attrs) {
18056
18049
 
18057
18050
  function canHaveDepth$1(blockType) {
18058
18051
  switch (blockType) {
18059
- case BLOCK_TYPE$1.UNORDERED_LIST_ITEM:
18060
- case BLOCK_TYPE$1.ORDERED_LIST_ITEM:
18052
+ case BLOCK_TYPE.UNORDERED_LIST_ITEM:
18053
+ case BLOCK_TYPE.ORDERED_LIST_ITEM:
18061
18054
  return true;
18062
18055
 
18063
18056
  default:
@@ -18114,37 +18107,6 @@ function repeatSeq(seq, count) {
18114
18107
  return result;
18115
18108
  }
18116
18109
 
18117
- var BLOCK_TYPE = {
18118
- // This is used to represent a normal text block (paragraph).
18119
- UNSTYLED: 'unstyled',
18120
- HEADER_ONE: 'header-one',
18121
- HEADER_TWO: 'header-two',
18122
- HEADER_THREE: 'header-three',
18123
- HEADER_FOUR: 'header-four',
18124
- HEADER_FIVE: 'header-five',
18125
- HEADER_SIX: 'header-six',
18126
- UNORDERED_LIST_ITEM: 'unordered-list-item',
18127
- ORDERED_LIST_ITEM: 'ordered-list-item',
18128
- BLOCKQUOTE: 'blockquote',
18129
- PULLQUOTE: 'pullquote',
18130
- CODE: 'code-block',
18131
- ATOMIC: 'atomic'
18132
- };
18133
- var ENTITY_TYPE = {
18134
- LINK: 'LINK',
18135
- IMAGE: 'IMAGE',
18136
- EMBED: 'embed'
18137
- };
18138
- var INLINE_STYLE = {
18139
- BOLD: 'BOLD',
18140
- CODE: 'CODE',
18141
- ITALIC: 'ITALIC',
18142
- STRIKETHROUGH: 'STRIKETHROUGH',
18143
- UNDERLINE: 'UNDERLINE'
18144
- };
18145
-
18146
- new immutableExports.OrderedSet();
18147
-
18148
18110
  var NODE_TYPE_ELEMENT = 1;
18149
18111
  var NODE_TYPE_TEXT = 3;
18150
18112
 
@@ -18981,7 +18943,7 @@ const Provider = ({ html, decorators, children, }) => {
18981
18943
  } }, children));
18982
18944
  };
18983
18945
 
18984
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
18946
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
18985
18947
 
18986
18948
  const useButtonStyles = makeStyles()({
18987
18949
  btn: {