@helpdice/ui 2.1.5 → 2.1.8
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.
- package/dist/auto-complete/index.js +12 -10
- package/dist/button/button.d.ts +1 -1
- package/dist/button/index.js +73 -16
- package/dist/button/styles.d.ts +1 -0
- package/dist/carousal/index.js +73 -16
- package/dist/copy-to-clipboard/clipboard.d.ts +2 -0
- package/dist/copy-to-clipboard/copy.d.ts +2 -0
- package/dist/copy-to-clipboard/index.d.ts +2 -0
- package/dist/copy-to-clipboard/index.js +1717 -0
- package/dist/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/dist/html-renderer/index.js +35 -12
- package/dist/index.d.ts +3 -2
- package/dist/index.js +539 -220
- package/dist/input/index.js +12 -10
- package/dist/input/input-props.d.ts +1 -0
- package/dist/modal/index.js +73 -16
- package/dist/notetip/index.js +690 -0
- package/dist/notetip/{index.d.ts → note-tip.d.ts} +2 -2
- package/dist/table/index.js +990 -930
- package/esm/button/button.d.ts +1 -1
- package/esm/button/button.js +51 -5
- package/esm/button/styles.d.ts +1 -0
- package/esm/button/styles.js +22 -11
- package/esm/copy-to-clipboard/clipboard.d.ts +2 -0
- package/esm/copy-to-clipboard/copy.d.ts +2 -0
- package/esm/copy-to-clipboard/copy.js +105 -0
- package/esm/copy-to-clipboard/index.d.ts +2 -0
- package/esm/copy-to-clipboard/index.js +2 -0
- package/esm/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/esm/copy-to-clipboard/toggle-selection.js +31 -0
- package/esm/index.d.ts +3 -2
- package/esm/index.js +3 -2
- package/esm/input/input-field.js +12 -10
- package/esm/input/input-props.d.ts +1 -0
- package/esm/notetip/index.js +2 -97
- package/esm/notetip/{index.d.ts → note-tip.d.ts} +2 -2
- package/esm/notetip/note-tip.js +97 -0
- package/esm/table/table-body.js +2 -2
- package/esm/table/table-cell.js +1 -1
- package/esm/table/table-head.js +4 -2
- package/esm/table/table.js +0 -1
- package/package.json +14 -7
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
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';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
7
|
+
var Notetip = function Notetip(_ref) {
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
text = _ref.text,
|
|
10
|
+
_ref$placement = _ref.placement,
|
|
11
|
+
placement = _ref$placement === void 0 ? 'top' : _ref$placement,
|
|
12
|
+
_ref$delay = _ref.delay,
|
|
13
|
+
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
|
14
|
+
_ref$duration = _ref.duration,
|
|
15
|
+
duration = _ref$duration === void 0 ? 200 : _ref$duration,
|
|
16
|
+
_ref$animation = _ref.animation,
|
|
17
|
+
animation = _ref$animation === void 0 ? 'fade' : _ref$animation;
|
|
18
|
+
var theme = useTheme();
|
|
19
|
+
var _useState = useState(false),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
open = _useState2[0],
|
|
22
|
+
setOpen = _useState2[1];
|
|
23
|
+
var _useState3 = useState(false),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
show = _useState4[0],
|
|
26
|
+
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
|
+
})]
|
|
35
|
+
}),
|
|
36
|
+
x = _useFloating.x,
|
|
37
|
+
y = _useFloating.y,
|
|
38
|
+
refs = _useFloating.refs,
|
|
39
|
+
strategy = _useFloating.strategy;
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var timer;
|
|
42
|
+
if (open) {
|
|
43
|
+
timer = setTimeout(function () {
|
|
44
|
+
return setShow(true);
|
|
45
|
+
}, delay);
|
|
46
|
+
} else {
|
|
47
|
+
setShow(false);
|
|
48
|
+
}
|
|
49
|
+
return function () {
|
|
50
|
+
return clearTimeout(timer);
|
|
51
|
+
};
|
|
52
|
+
}, [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]];
|
|
72
|
+
|
|
73
|
+
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,
|
|
81
|
+
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',
|
|
89
|
+
transitionDuration: "".concat(duration, "ms")
|
|
90
|
+
},
|
|
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",
|
|
94
|
+
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);}}")));
|
|
96
|
+
};
|
|
97
|
+
export default Notetip;
|
package/esm/table/table-body.js
CHANGED
|
@@ -73,7 +73,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
73
73
|
|
|
74
74
|
function renderRow(cols, row, index) {
|
|
75
75
|
var _row$style;
|
|
76
|
-
|
|
76
|
+
// const urid = _.uniqueId();
|
|
77
77
|
var className = rowClassName(row, index);
|
|
78
78
|
var rw = _extends({}, row);
|
|
79
79
|
var rowStyle = (_row$style = row === null || row === void 0 ? void 0 : row.style) !== null && _row$style !== void 0 ? _row$style : {};
|
|
@@ -94,7 +94,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
94
94
|
onDragStart: onDragStart,
|
|
95
95
|
"aria-checked": selected.indexOf(row) !== -1,
|
|
96
96
|
tabIndex: -1,
|
|
97
|
-
key:
|
|
97
|
+
key: "table-row-".concat(rw.id),
|
|
98
98
|
style: _extends({
|
|
99
99
|
cursor: 'pointer',
|
|
100
100
|
backgroundColor: isRowSelected ? hoverColor : ''
|
package/esm/table/table-cell.js
CHANGED
|
@@ -22,7 +22,7 @@ var TableCell = function TableCell(_ref) {
|
|
|
22
22
|
whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
|
|
23
23
|
}, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
|
|
24
24
|
"data-column": column.prop,
|
|
25
|
-
key: "row-td-".concat(
|
|
25
|
+
key: "row-td-".concat(currentRowValue.id, "-").concat(column.prop.toString()),
|
|
26
26
|
onClick: function onClick() {
|
|
27
27
|
return onCellClick && onCellClick(currentRowValue, rowIndex, index);
|
|
28
28
|
},
|
package/esm/table/table-head.js
CHANGED
|
@@ -5,10 +5,12 @@ import _JSXStyle from "../styled-jsx.es.js";
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
import { useTheme } from '@helpdice/theme';
|
|
7
7
|
import Input from '../input';
|
|
8
|
+
import { uniqueId } from 'lodash';
|
|
8
9
|
import Select from '../select';
|
|
9
10
|
// import Button from '../button'
|
|
10
11
|
|
|
11
12
|
var makeColgroup = function makeColgroup(width, columns) {
|
|
13
|
+
var colId = uniqueId('col');
|
|
12
14
|
var unsetWidthCount = columns.filter(function (c) {
|
|
13
15
|
return !c.width;
|
|
14
16
|
}).length;
|
|
@@ -17,9 +19,9 @@ var makeColgroup = function makeColgroup(width, columns) {
|
|
|
17
19
|
}, 0);
|
|
18
20
|
var averageWidth = (width - customWidthTotal) / unsetWidthCount;
|
|
19
21
|
if (averageWidth <= 0) return /*#__PURE__*/React.createElement("colgroup", null);
|
|
20
|
-
return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column
|
|
22
|
+
return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column) {
|
|
21
23
|
return /*#__PURE__*/React.createElement("col", {
|
|
22
|
-
key: "colgroup-".concat(
|
|
24
|
+
key: "colgroup-".concat(colId),
|
|
23
25
|
width: column.width || averageWidth
|
|
24
26
|
});
|
|
25
27
|
}));
|
package/esm/table/table.js
CHANGED
|
@@ -5,7 +5,6 @@ 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
|
-
|
|
9
8
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
9
|
import TableHead from './table-head';
|
|
11
10
|
import TableBody from './table-body';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helpdice/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"unpkg": "dist/index.min.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"build:types": "tsc -p ./scripts & tsc -p ./scripts --outDir ./esm",
|
|
27
27
|
"build:package": "yarn build:rollup && yarn build:babel && yarn build:types && yarn build:after",
|
|
28
28
|
"release": "yarn publish --access public --non-interactive",
|
|
29
|
-
"release:github": "
|
|
29
|
+
"release:github": "npm publish --registry=https://npm.pkg.github.com"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"description": "Modern React UI library.",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@babel/preset-typescript": "^7.14.5",
|
|
64
64
|
"@babel/standalone": "^7.28.3",
|
|
65
65
|
"@helpdice/icons": "^1.2.5",
|
|
66
|
-
"@helpdice/
|
|
67
|
-
"@helpdice/
|
|
66
|
+
"@helpdice/sdk": "^0.2.9",
|
|
67
|
+
"@helpdice/utils": "^0.1.4",
|
|
68
68
|
"@mapbox/rehype-prism": "^0.9.0",
|
|
69
69
|
"@mdx-js/loader": "^3.1.0",
|
|
70
70
|
"@mdx-js/react": "^3.1.0",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tslib": "^2.8.1"
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|
|
142
|
-
"@helpdice/theme": "^1.0.
|
|
142
|
+
"@helpdice/theme": "^1.0.9",
|
|
143
143
|
"react": "^19.2.0",
|
|
144
144
|
"react-dom": "^19.2.0"
|
|
145
145
|
},
|
|
@@ -215,6 +215,10 @@
|
|
|
215
215
|
"import": "./dist/collapse/index.js",
|
|
216
216
|
"types": "./dist/collapse/index.d.ts"
|
|
217
217
|
},
|
|
218
|
+
"./CopyToClipboard": {
|
|
219
|
+
"import": "./dist/copy-to-clipboard/index.js",
|
|
220
|
+
"types": "./dist/copy-to-clipboard/index.d.ts"
|
|
221
|
+
},
|
|
218
222
|
"./CurrencyInput": {
|
|
219
223
|
"import": "./dist/currency-input/index.js",
|
|
220
224
|
"types": "./dist/currency-input/index.d.ts"
|
|
@@ -427,7 +431,7 @@
|
|
|
427
431
|
"import": "./dist/use-toasts/index.js",
|
|
428
432
|
"types": "./dist/use-toasts/index.d.ts"
|
|
429
433
|
},
|
|
430
|
-
"./
|
|
434
|
+
"./user": {
|
|
431
435
|
"import": "./dist/user/index.js",
|
|
432
436
|
"types": "./dist/user/index.d.ts"
|
|
433
437
|
}
|
|
@@ -476,6 +480,9 @@
|
|
|
476
480
|
"Collapse": [
|
|
477
481
|
"dist/collapse/index.d.ts"
|
|
478
482
|
],
|
|
483
|
+
"CopyToClipboard": [
|
|
484
|
+
"dist/copy-to-clipboard/index.d.ts"
|
|
485
|
+
],
|
|
479
486
|
"CurrencyInput": [
|
|
480
487
|
"dist/currency-input/index.d.ts"
|
|
481
488
|
],
|
|
@@ -635,7 +642,7 @@
|
|
|
635
642
|
"useToasts": [
|
|
636
643
|
"dist/use-toasts/index.d.ts"
|
|
637
644
|
],
|
|
638
|
-
"
|
|
645
|
+
"user": [
|
|
639
646
|
"dist/user/index.d.ts"
|
|
640
647
|
]
|
|
641
648
|
}
|