@helpdice/ui 2.2.5 → 2.3.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.
@@ -888,6 +888,108 @@ var getPosition = function getPosition(placement, rect, offset) {
888
888
  };
889
889
  return positions[placement] || positions.top;
890
890
  };
891
+
892
+ // export const getPosition = (
893
+ // placement: Placement,
894
+ // rect: ParentDomRect,
895
+ // offset: number,
896
+ // ): TooltipPosition => {
897
+ // // console.log(rect);
898
+ // if (
899
+ // !rect ||
900
+ // rect.width <= 0 ||
901
+ // rect.height <= 0 ||
902
+ // Number.isNaN(rect.top) ||
903
+ // Number.isNaN(rect.left)
904
+ // ) {
905
+ // return {
906
+ // top: '0px',
907
+ // left: '0px',
908
+ // // move tooltip out of viewport safely until rect is valid
909
+ // transform: 'translate(-9999px, -9999px)',
910
+ // }
911
+ // }
912
+
913
+ // const viewportWidth = window.innerWidth
914
+ // const viewportHeight = window.innerHeight
915
+
916
+ // const clamp = (value: number, min: number, max: number) =>
917
+ // Math.min(Math.max(value, min), max)
918
+
919
+ // const centerX = rect.left + rect.width / 2
920
+ // const centerY = rect.top + rect.height / 2
921
+
922
+ // const safeTop = clamp(rect.top, 8, viewportHeight - 8)
923
+ // const safeBottom = clamp(rect.bottom, 8, viewportHeight - 8)
924
+ // const safeLeft = clamp(rect.left, 8, viewportWidth - 8)
925
+ // const safeRight = clamp(rect.right, 8, viewportWidth - 8)
926
+
927
+ // const positions: Record<Placement, TooltipPosition> = {
928
+ // top: {
929
+ // top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
930
+ // left: `${clamp(centerX, 8, viewportWidth - 8)}px`,
931
+ // transform: 'translate(-50%, -100%)',
932
+ // },
933
+ // topStart: {
934
+ // top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
935
+ // left: `${safeLeft}px`,
936
+ // transform: 'translate(0, -100%)',
937
+ // },
938
+ // topEnd: {
939
+ // top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
940
+ // left: `${safeRight}px`,
941
+ // transform: 'translate(-100%, -100%)',
942
+ // },
943
+ // bottom: {
944
+ // top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
945
+ // left: `${clamp(centerX, 8, viewportWidth - 8)}px`,
946
+ // transform: 'translate(-50%, 0)',
947
+ // },
948
+ // bottomStart: {
949
+ // top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
950
+ // left: `${safeLeft}px`,
951
+ // transform: 'translate(0, 0)',
952
+ // },
953
+ // bottomEnd: {
954
+ // top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
955
+ // left: `${safeRight}px`,
956
+ // transform: 'translate(-100%, 0)',
957
+ // },
958
+ // left: {
959
+ // top: `${clamp(centerY, 8, viewportHeight - 8)}px`,
960
+ // left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
961
+ // transform: 'translate(-100%, -50%)',
962
+ // },
963
+ // leftStart: {
964
+ // top: `${safeTop}px`,
965
+ // left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
966
+ // transform: 'translate(-100%, 0)',
967
+ // },
968
+ // leftEnd: {
969
+ // top: `${safeBottom}px`,
970
+ // left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
971
+ // transform: 'translate(-100%, -100%)',
972
+ // },
973
+ // right: {
974
+ // top: `${clamp(centerY, 8, viewportHeight - 8)}px`,
975
+ // left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
976
+ // transform: 'translate(0, -50%)',
977
+ // },
978
+ // rightStart: {
979
+ // top: `${safeTop}px`,
980
+ // left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
981
+ // transform: 'translate(0, 0)',
982
+ // },
983
+ // rightEnd: {
984
+ // top: `${safeBottom}px`,
985
+ // left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
986
+ // transform: 'translate(0, -100%)',
987
+ // },
988
+ // }
989
+
990
+ // return positions[placement] || positions.top
991
+ // }
992
+
891
993
  var getIconPosition = function getIconPosition(placement, offsetX, offsetY) {
892
994
  var offsetAbsolute = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '3px';
893
995
  var positions = {
@@ -1086,7 +1188,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
1086
1188
  return getAllScaleProps;
1087
1189
  };
1088
1190
 
1089
- var _excluded$1 = ["children"];
1191
+ var _excluded = ["children"];
1090
1192
  var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
1091
1193
  if (scale === 1) return scale;
1092
1194
  var diff = Math.abs((scale - 1) / 2);
@@ -1096,7 +1198,7 @@ var withScale = function withScale(Render) {
1096
1198
  var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1097
1199
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
1098
1200
  var children = _ref.children,
1099
- props = _objectWithoutProperties(_ref, _excluded$1);
1201
+ props = _objectWithoutProperties(_ref, _excluded);
1100
1202
  var _useTheme = theme.useTheme(),
1101
1203
  layout = _useTheme.layout;
1102
1204
  var paddingLeft = props.paddingLeft,
@@ -1200,6 +1302,24 @@ var getRect = function getRect(ref) {
1200
1302
  });
1201
1303
  };
1202
1304
 
1305
+ // export const getRect = (
1306
+ // ref: RefObject<HTMLElement | null>
1307
+ // ): ReactiveDomReact => {
1308
+ // console.log('Parent Current', ref?.current);
1309
+ // if (!ref?.current) return defaultRect
1310
+
1311
+ // const rect = ref.current.getBoundingClientRect()
1312
+
1313
+ // return {
1314
+ // top: rect.top,
1315
+ // left: rect.left,
1316
+ // right: rect.right,
1317
+ // bottom: rect.bottom,
1318
+ // width: rect.width,
1319
+ // height: rect.height,
1320
+ // }
1321
+ // }
1322
+
1203
1323
  var TooltipContent = function TooltipContent(_ref) {
1204
1324
  var children = _ref.children,
1205
1325
  parent = _ref.parent,
@@ -1224,6 +1344,9 @@ var TooltipContent = function TooltipContent(_ref) {
1224
1344
  }, [type, theme$1.palette]);
1225
1345
  var hasShadow = type === 'default';
1226
1346
  var classes = theme.useClasses('tooltip-content', className);
1347
+
1348
+ // console.log('Having Parent', parent);
1349
+
1227
1350
  if (!parent) return null;
1228
1351
  var updateRect = function updateRect() {
1229
1352
  var position = getPosition(placement, getRect(parent), offset);
@@ -1234,7 +1357,15 @@ var TooltipContent = function TooltipContent(_ref) {
1234
1357
  return updateRect();
1235
1358
  });
1236
1359
  React.useEffect(function () {
1237
- updateRect();
1360
+ window.addEventListener('scroll', updateRect, true);
1361
+ return function () {
1362
+ return window.removeEventListener('scroll', updateRect, true);
1363
+ };
1364
+ }, []);
1365
+ React.useEffect(function () {
1366
+ if (visible && parent !== null && parent !== void 0 && parent.current) {
1367
+ updateRect();
1368
+ }
1238
1369
  }, [visible]);
1239
1370
  var preventHandler = function preventHandler(event) {
1240
1371
  event.stopPropagation();
@@ -1278,7 +1409,6 @@ var useClickAway = function useClickAway(ref, handler) {
1278
1409
  }, [ref]);
1279
1410
  };
1280
1411
 
1281
- var _excluded = ["children", "initialVisible", "text", "offset", "placement", "portalClassName", "enterDelay", "leaveDelay", "trigger", "type", "className", "onVisibleChange", "hideArrow", "visible"];
1282
1412
  var TooltipComponent = function TooltipComponent(_ref) {
1283
1413
  var children = _ref.children,
1284
1414
  _ref$initialVisible = _ref.initialVisible,
@@ -1304,8 +1434,7 @@ var TooltipComponent = function TooltipComponent(_ref) {
1304
1434
  onVisibleChange = _ref$onVisibleChange === void 0 ? function () {} : _ref$onVisibleChange,
1305
1435
  _ref$hideArrow = _ref.hideArrow,
1306
1436
  hideArrow = _ref$hideArrow === void 0 ? false : _ref$hideArrow,
1307
- customVisible = _ref.visible,
1308
- props = _objectWithoutProperties(_ref, _excluded);
1437
+ customVisible = _ref.visible;
1309
1438
  var timer = React.useRef(undefined);
1310
1439
  var ref = React.useRef(null);
1311
1440
  var _useState = React.useState(initialVisible),
@@ -1368,7 +1497,7 @@ var TooltipComponent = function TooltipComponent(_ref) {
1368
1497
  if (customVisible === undefined) return;
1369
1498
  changeVisible(customVisible);
1370
1499
  }, [customVisible]);
1371
- return /*#__PURE__*/React.createElement("div", _extends({
1500
+ return /*#__PURE__*/React.createElement("div", {
1372
1501
  ref: ref,
1373
1502
  onClick: clickEventHandler,
1374
1503
  onMouseEnter: function onMouseEnter() {
@@ -1377,9 +1506,10 @@ var TooltipComponent = function TooltipComponent(_ref) {
1377
1506
  onMouseLeave: function onMouseLeave() {
1378
1507
  return mouseEventHandler(false);
1379
1508
  }
1380
- }, props, {
1381
- className: "jsx-418573366" + " " + (props && props.className != null && props.className || theme.useClasses('tooltip', className) || "")
1382
- }), children, /*#__PURE__*/React.createElement(TooltipContent, contentProps, text), /*#__PURE__*/React.createElement(_JSXStyle, {
1509
+ // {...props}
1510
+ ,
1511
+ className: "jsx-418573366" + " " + (theme.useClasses('tooltip', className) || "")
1512
+ }, children, /*#__PURE__*/React.createElement(TooltipContent, contentProps, text), /*#__PURE__*/React.createElement(_JSXStyle, {
1383
1513
  id: "418573366"
1384
1514
  }, ".tooltip.jsx-418573366{width:-webkit-max-content;width:-moz-max-content;width:max-content;display:inline-block;}"));
1385
1515
  };
@@ -1,7 +1,7 @@
1
- import React, { MutableRefObject } from 'react';
1
+ import React, { RefObject } from 'react';
2
2
  import { Placement, SnippetTypes } from '../utils/prop-types';
3
3
  interface Props {
4
- parent?: MutableRefObject<HTMLElement | null> | undefined;
4
+ parent?: RefObject<HTMLElement | null> | undefined;
5
5
  placement: Placement;
6
6
  type: SnippetTypes;
7
7
  visible: boolean;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  declare function Path({ className, counterClockwise, dashRatio, pathRadius, strokeWidth, style, }: {
3
2
  className?: string;
4
3
  counterClockwise: boolean;
@@ -6,5 +5,5 @@ declare function Path({ className, counterClockwise, dashRatio, pathRadius, stro
6
5
  pathRadius: number;
7
6
  strokeWidth: number;
8
7
  style?: object;
9
- }): React.JSX.Element;
8
+ }): import("node_modules/@types/react").JSX.Element;
10
9
  export default Path;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ // import * as React from 'react';
2
2
  import { VIEWBOX_CENTER_X, VIEWBOX_CENTER_Y } from './constants';
3
3
  function Path(_ref) {
4
4
  var className = _ref.className,
@@ -35,23 +35,31 @@ var Container = function Container(_ref) {
35
35
  }, [gap, unit]);
36
36
  var _styles$className = {
37
37
  styles: /*#__PURE__*/React.createElement(_JSXStyle, {
38
- id: "4110955330",
39
- dynamic: [gapUnit, direction, wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
40
- }, "div.__jsx-style-dynamic-selector{--gap-unit:".concat(gapUnit, ";--container-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";box-sizing:border-box;gap:var(--gap-unit);width:").concat(SCALES.width(1, 'var(--container-width)'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")),
41
- className: _JSXStyle.dynamic([["4110955330", [gapUnit, direction, wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]])
38
+ id: "2357140837",
39
+ dynamic: [gapUnit, direction, collapse ? 'wrap' : wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
40
+ }, "div.__jsx-style-dynamic-selector{--gap-unit:".concat(gapUnit, ";--container-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";-webkit-flex-wrap:").concat(collapse ? 'wrap' : wrap, ";-ms-flex-wrap:").concat(collapse ? 'wrap' : wrap, ";flex-wrap:").concat(collapse ? 'wrap' : wrap, ";-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";box-sizing:border-box;gap:var(--gap-unit);width:").concat(SCALES.width(1, 'var(--container-width)'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")),
41
+ className: _JSXStyle.dynamic([["2357140837", [gapUnit, direction, collapse ? 'wrap' : wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]])
42
42
  },
43
43
  resolveClassName = _styles$className.className,
44
44
  styles = _styles$className.styles;
45
45
  var classes = useClasses(resolveClassName, className);
46
46
  return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
47
47
  className: classes
48
- }, props), collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, expand ? children : (children === null || children === void 0 ? void 0 : children.toString().substring(0, collapse)) + '...', /*#__PURE__*/React.createElement(Button, {
48
+ }, props), collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
49
+ style: {
50
+ maxHeight: expand ? '100%' : "".concat(collapse, "px"),
51
+ overflow: 'hidden',
52
+ display: 'inline',
53
+ transition: "max-height 0.3s ease"
54
+ }
55
+ }, children), /*#__PURE__*/React.createElement(Button, {
49
56
  margin: 0,
50
57
  onClick: function onClick() {
51
58
  return setExpand(!expand);
52
59
  },
53
60
  style: {
54
- textTransform: 'lowercase'
61
+ textTransform: 'lowercase',
62
+ height: '25px'
55
63
  },
56
64
  effect: false,
57
65
  color: "abort",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Placement } from '@floating-ui/react-dom';
2
+ type Placement = 'top' | 'bottom' | 'left' | 'right';
3
3
  type AnimationVariant = 'fade' | 'scale' | 'slide';
4
4
  export type NotetipProps = {
5
5
  children: React.ReactNode;
@@ -1,9 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _JSXStyle from "../styled-jsx.es.js";
3
- import React, { useState, useRef, useEffect } from 'react';
4
- import { useFloating, offset, flip, shift, arrow } from '@floating-ui/react-dom';
5
- import { useTheme } from '@helpdice/theme';
3
+ import React, { useState, useRef, useEffect, useLayoutEffect } from 'react';
6
4
  import { createPortal } from 'react-dom';
5
+ import { useTheme } from '@helpdice/theme';
6
+ var OFFSET = 8;
7
7
  var Notetip = function Notetip(_ref) {
8
8
  var children = _ref.children,
9
9
  text = _ref.text,
@@ -16,6 +16,8 @@ var Notetip = function Notetip(_ref) {
16
16
  _ref$animation = _ref.animation,
17
17
  animation = _ref$animation === void 0 ? 'fade' : _ref$animation;
18
18
  var theme = useTheme();
19
+ var referenceRef = useRef(null);
20
+ var tooltipRef = useRef(null);
19
21
  var _useState = useState(false),
20
22
  _useState2 = _slicedToArray(_useState, 2),
21
23
  open = _useState2[0],
@@ -24,74 +26,83 @@ var Notetip = function Notetip(_ref) {
24
26
  _useState4 = _slicedToArray(_useState3, 2),
25
27
  show = _useState4[0],
26
28
  setShow = _useState4[1];
27
- var arrowRef = useRef(null);
28
- var _useFloating = useFloating({
29
- placement: placement,
30
- middleware: [offset(8), flip(), shift({
31
- padding: 5
32
- }), arrow({
33
- element: arrowRef
34
- })]
29
+ var _useState5 = useState({
30
+ top: 0,
31
+ left: 0
35
32
  }),
36
- x = _useFloating.x,
37
- y = _useFloating.y,
38
- refs = _useFloating.refs,
39
- strategy = _useFloating.strategy;
33
+ _useState6 = _slicedToArray(_useState5, 2),
34
+ coords = _useState6[0],
35
+ setCoords = _useState6[1];
40
36
  useEffect(function () {
41
37
  var timer;
42
- if (open) {
43
- timer = setTimeout(function () {
44
- return setShow(true);
45
- }, delay);
46
- } else {
47
- setShow(false);
48
- }
38
+ if (open) timer = setTimeout(function () {
39
+ return setShow(true);
40
+ }, delay);else setShow(false);
49
41
  return function () {
50
42
  return clearTimeout(timer);
51
43
  };
52
44
  }, [open, delay]);
53
- var handleMouseEnter = function handleMouseEnter() {
54
- return setOpen(true);
55
- };
56
- var handleMouseLeave = function handleMouseLeave() {
57
- return setOpen(false);
58
- };
59
- var handleTouchStart = function handleTouchStart() {
60
- setOpen(true);
61
- setTimeout(function () {
62
- return setOpen(false);
63
- }, 2000); // auto-hide
64
- };
65
-
66
- // const staticSide = {
67
- // top: 'bottom',
68
- // right: 'left',
69
- // bottom: 'top',
70
- // left: 'right',
71
- // }[finalPlacement.split('-')[0]];
45
+ useLayoutEffect(function () {
46
+ if (!show || !referenceRef.current || !tooltipRef.current) return;
47
+ var refRect = referenceRef.current.getBoundingClientRect();
48
+ var tipRect = tooltipRef.current.getBoundingClientRect();
49
+ var top = 0;
50
+ var left = 0;
51
+ switch (placement) {
52
+ case 'top':
53
+ top = refRect.top - tipRect.height - OFFSET;
54
+ left = refRect.left + refRect.width / 2 - tipRect.width / 2;
55
+ break;
56
+ case 'bottom':
57
+ top = refRect.bottom + OFFSET;
58
+ left = refRect.left + refRect.width / 2 - tipRect.width / 2;
59
+ break;
60
+ case 'left':
61
+ top = refRect.top + refRect.height / 2 - tipRect.height / 2;
62
+ left = refRect.left - tipRect.width - OFFSET;
63
+ break;
64
+ case 'right':
65
+ top = refRect.top + refRect.height / 2 - tipRect.height / 2;
66
+ left = refRect.right + OFFSET;
67
+ break;
68
+ }
72
69
 
70
+ // Viewport collision handling
71
+ var padding = 5;
72
+ top = Math.max(padding, Math.min(top, window.innerHeight - tipRect.height - padding));
73
+ left = Math.max(padding, Math.min(left, window.innerWidth - tipRect.width - padding));
74
+ setCoords({
75
+ top: top,
76
+ left: left
77
+ });
78
+ }, [show, placement]);
73
79
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
74
- ref: refs.setReference,
75
- onMouseEnter: handleMouseEnter,
76
- onMouseLeave: handleMouseLeave,
77
- onTouchStart: handleTouchStart,
78
- className: _JSXStyle.dynamic([["4210526695", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-reference"
79
- }, children), show && x != null && y != null && text != null ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
80
- ref: refs.setFloating,
80
+ ref: referenceRef,
81
+ onMouseEnter: function onMouseEnter() {
82
+ return setOpen(true);
83
+ },
84
+ onMouseLeave: function onMouseLeave() {
85
+ return setOpen(false);
86
+ },
87
+ onTouchStart: function onTouchStart() {
88
+ setOpen(true);
89
+ setTimeout(function () {
90
+ return setOpen(false);
91
+ }, 2000);
92
+ },
93
+ className: _JSXStyle.dynamic([["633836393", [theme.palette.accents_1, duration, duration, duration]]])
94
+ }, children), show && /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
95
+ ref: tooltipRef,
81
96
  style: {
82
- position: strategy,
83
- top: y !== null && y !== void 0 ? y : 0,
84
- left: x !== null && x !== void 0 ? x : 0,
85
- zIndex: 9999,
86
- // opacity: show ? 1 : 0,
87
- // visibility: x == null || y == null ? 'hidden' : 'visible',
88
- transitionProperty: 'opacity, transform',
97
+ position: 'fixed',
98
+ top: coords.top,
99
+ left: coords.left,
89
100
  transitionDuration: "".concat(duration, "ms")
90
101
  },
91
- className: _JSXStyle.dynamic([["4210526695", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
92
- }, text), document.body) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
93
- id: "4210526695",
102
+ className: _JSXStyle.dynamic([["633836393", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
103
+ }, text), document.body), /*#__PURE__*/React.createElement(_JSXStyle, {
104
+ id: "633836393",
94
105
  dynamic: [theme.palette.accents_1, duration, duration, duration]
95
- }, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_1, ";padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}@keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}.scale.__jsx-style-dynamic-selector{-webkit-animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}.slide.__jsx-style-dynamic-selector{-webkit-animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}@keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}")));
106
+ }, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_1, ";padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}.scale.__jsx-style-dynamic-selector{-webkit-animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}.slide.__jsx-style-dynamic-selector{-webkit-animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes fadeIn-__jsx-style-dynamic-selector{to{opacity:1;}}@keyframes fadeIn-__jsx-style-dynamic-selector{to{opacity:1;}}@-webkit-keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@-webkit-keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}@keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}")));
96
107
  };
97
108
  export default Notetip;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare function Empty(): React.JSX.Element;
2
+ declare const Empty: React.FC;
3
3
  export default Empty;
@@ -1,5 +1,7 @@
1
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
1
2
  import React from 'react';
2
- function Empty() {
3
+ var Empty = function Empty(_ref) {
4
+ _objectDestructuringEmpty(_ref);
3
5
  return /*#__PURE__*/React.createElement("svg", {
4
6
  xmlns: "http://www.w3.org/2000/svg",
5
7
  width: "10em",
@@ -298,5 +300,5 @@ function Empty() {
298
300
  opacity: "0.2",
299
301
  transform: "translate(-95.23 -55.03)"
300
302
  }));
301
- }
303
+ };
302
304
  export default Empty;
@@ -76,9 +76,9 @@ var PopoverComponent = function PopoverComponent(_ref) {
76
76
  visible: visible,
77
77
  onVisibleChange: onPopoverVisibleChange
78
78
  }, props), children, /*#__PURE__*/React.createElement(_JSXStyle, {
79
- id: "622655983",
80
- dynamic: [SCALES.pt(0.9), SCALES.pr(0), SCALES.pb(0.9), SCALES.pl(0)]
81
- }, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.9), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0.9), " ").concat(SCALES.pl(0), ";}"))));
79
+ id: "3577605772",
80
+ dynamic: [SCALES.pt(0.5), SCALES.pr(0), SCALES.pb(0.5), SCALES.pl(0)]
81
+ }, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0), ";}"))));
82
82
  };
83
83
  PopoverComponent.displayName = 'Popover';
84
84
  var Popover = withScale(PopoverComponent);
@@ -49,9 +49,7 @@ var TableBody = function TableBody(_ref) {
49
49
  newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
50
50
  }
51
51
  setSelected(newSelected);
52
- if (newSelected.length > 0 && onSelected) {
53
- onSelected(newSelected);
54
- }
52
+ onSelected && onSelected(newSelected);
55
53
  };
56
54
 
57
55
  // const handleSelectAllClick = (event: { target: { checked: any } }) => {
@@ -87,7 +85,7 @@ var TableBody = function TableBody(_ref) {
87
85
  // ) as unknown as TableDataItem
88
86
  // console.log(frow);
89
87
  var isRowSelected = selected.indexOf(row) !== -1;
90
- var hoverColor = theme.type == 'dark' ? theme.palette.accents_1 : theme.palette.background;
88
+ var hoverColor = theme.palette.accents_1;
91
89
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("tr", {
92
90
  draggable: rowDraggable,
93
91
  role: "checkbox",
@@ -138,19 +138,19 @@ var TableHead = function TableHead(props) {
138
138
  className: _JSXStyle.dynamic([["4089411751", [theme.palette.background, stickyHeader && "\n position: sticky;\n top: 0;\n z-index: 1;\n ", theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
139
139
  }, /*#__PURE__*/React.createElement("tr", {
140
140
  style: {
141
- backgroundColor: theme.palette.background
141
+ backgroundColor: theme.palette.accents_2
142
142
  },
143
143
  className: _JSXStyle.dynamic([["4089411751", [theme.palette.background, stickyHeader && "\n position: sticky;\n top: 0;\n z-index: 1;\n ", theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
144
144
  }, columns.map(function (column, _index) {
145
145
  var _String2;
146
- var dataName = (_String2 = String(column === null || column === void 0 ? void 0 : column.label)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
146
+ var dataName = (_String2 = String(column === null || column === void 0 ? void 0 : column.prop)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
147
147
  return /*#__PURE__*/React.createElement("th", {
148
148
  style: _extends({
149
149
  // textAlign: `${column?.align} !important`,
150
150
  // paddingLeft: '0.3rem',
151
151
  // paddingRight: '0.3rem',
152
- backgroundColor: theme.type == 'dark' ? theme.palette.accents_1 : theme.palette.background,
153
- color: "".concat(column !== null && column !== void 0 && column.color ? column === null || column === void 0 ? void 0 : column.color : '#333'),
152
+ backgroundColor: theme.palette.accents_2,
153
+ color: "".concat(column !== null && column !== void 0 && column.color ? column === null || column === void 0 ? void 0 : column.color : theme.palette.accents_6),
154
154
  whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
155
155
  }, column === null || column === void 0 ? void 0 : column.style),
156
156
  "data-column": dataName,
@@ -5,6 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  var _excluded = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "cursorPagination", "previousCursor", "nextCursor", "hasMore", "onNextPage", "onPreviousPage", "onRow", "onCell", "onChange", "onFilters", "onPageChange", "showFilters", "stickyHeader", "textPlaceholder", "onSelected", "dataLength", "viewLength", "className", "rowClassName"];
6
6
  import _JSXStyle from "../styled-jsx.es.js";
7
7
  /* "use client" */
8
+
8
9
  import React, { useEffect, useMemo, useRef, useState } from 'react';
9
10
  import TableHead from './table-head';
10
11
  import TableBody from './table-body';
@@ -1,4 +1,4 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  export interface ReactiveDomReact {
3
3
  top: number;
4
4
  bottom: number;
@@ -7,4 +7,4 @@ export interface ReactiveDomReact {
7
7
  width: number;
8
8
  height: number;
9
9
  }
10
- export declare const getRect: (ref: MutableRefObject<HTMLElement | null>) => ReactiveDomReact;
10
+ export declare const getRect: (ref: RefObject<HTMLElement | null>) => ReactiveDomReact;
@@ -18,4 +18,22 @@ export var getRect = function getRect(ref) {
18
18
  left: rect.left + document.documentElement.scrollLeft,
19
19
  right: rect.right + document.documentElement.scrollLeft
20
20
  });
21
- };
21
+ };
22
+
23
+ // export const getRect = (
24
+ // ref: RefObject<HTMLElement | null>
25
+ // ): ReactiveDomReact => {
26
+ // console.log('Parent Current', ref?.current);
27
+ // if (!ref?.current) return defaultRect
28
+
29
+ // const rect = ref.current.getBoundingClientRect()
30
+
31
+ // return {
32
+ // top: rect.top,
33
+ // left: rect.left,
34
+ // right: rect.right,
35
+ // bottom: rect.bottom,
36
+ // width: rect.width,
37
+ // height: rect.height,
38
+ // }
39
+ // }