@helpdice/ui 2.5.8-beta.0 → 2.5.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 +549 -491
- package/dist/avatar/index.js +82 -45
- package/dist/badge/index.js +69 -27
- package/dist/breadcrumbs/index.js +107 -56
- package/dist/button/button.icon.d.ts +3 -15
- package/dist/button/button.small.d.ts +3 -15
- package/dist/button/index.js +143 -155
- package/dist/button-dropdown/index.js +96 -83
- package/dist/button-group/index.js +61 -21
- package/dist/capacity/index.js +61 -22
- package/dist/card/index.js +147 -123
- package/dist/carousal/index.js +349 -328
- package/dist/checkbox/index.js +72 -67
- package/dist/circular-progress/CircularProgress.d.ts +17 -0
- package/dist/circular-progress/index.d.ts +3 -4
- package/dist/circular-progress/index.js +713 -336
- package/dist/circular-progress/useCircularProgress.d.ts +12 -0
- package/dist/code/index.js +70 -26
- package/dist/col/index.js +61 -24
- package/dist/collapse/index.js +102 -52
- package/dist/container/index.js +187 -188
- package/dist/copy-to-clipboard/index.js +158 -208
- package/dist/description/index.js +64 -23
- package/dist/display/index.js +64 -23
- package/dist/divider/index.js +62 -22
- package/dist/dot/index.js +63 -23
- package/dist/drawer/index.js +74 -61
- package/dist/fieldset/index.js +127 -63
- package/dist/form/index.js +15 -40
- package/dist/grid/index.js +74 -29
- package/dist/html-renderer/index.js +3 -2
- package/dist/image/index.js +163 -104
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4173 -3745
- package/dist/input/index.js +466 -419
- package/dist/keyboard/index.js +73 -29
- package/dist/linear-progress/index.js +27 -24
- package/dist/link/index.js +78 -36
- package/dist/list/index.js +118 -63
- package/dist/loadable/index.js +76 -27
- package/dist/loading/index.js +70 -29
- package/dist/menu/index.js +53 -47
- package/dist/modal/index.js +225 -178
- package/dist/note/index.js +64 -23
- package/dist/notetip/index.js +54 -45
- package/dist/notetip/note-tip.d.ts +2 -0
- package/dist/page/index.js +102 -51
- package/dist/pagination/index.js +180 -123
- package/dist/placeholder/index.js +545 -534
- package/dist/popover/index.js +94 -81
- package/dist/progress/index.js +66 -27
- package/dist/radio/index.js +94 -48
- package/dist/rating/index.js +78 -38
- package/dist/row/index.js +62 -25
- package/dist/search-bar/index.js +172 -162
- package/dist/select/index.js +364 -327
- package/dist/slider/index.js +91 -47
- package/dist/snippet/index.js +39 -39
- package/dist/spacer/index.js +58 -19
- package/dist/spinner/index.js +69 -28
- package/dist/swipe/index.js +28 -13
- package/dist/table/index.js +2217 -1973
- package/dist/table/table-body.d.ts +4 -2
- package/dist/table/table-cell.d.ts +4 -2
- package/dist/table/table-types.d.ts +2 -0
- package/dist/table/table.d.ts +4 -1
- package/dist/tabs/index.js +61 -59
- package/dist/tag/index.js +16 -20
- package/dist/text/index.js +178 -180
- package/dist/textarea/index.js +220 -214
- package/dist/toggle/index.js +75 -33
- package/dist/tooltip/index.d.ts +1 -2
- package/dist/tooltip/index.js +59 -52
- package/dist/tooltip/tooltip-content.d.ts +1 -1
- package/dist/tooltip/tooltip.d.ts +2 -1
- package/dist/tree/index.js +176 -115
- package/dist/use-scale/index.js +50 -13
- package/dist/user/index.js +146 -96
- package/esm/button/button.icon.d.ts +3 -15
- package/esm/button/button.icon.js +22 -22
- package/esm/button/button.js +4 -4
- package/esm/button/button.small.d.ts +3 -15
- package/esm/button/button.small.js +20 -21
- package/esm/circular-progress/CircularProgress.d.ts +17 -0
- package/esm/circular-progress/CircularProgress.js +110 -0
- package/esm/circular-progress/index.d.ts +3 -4
- package/esm/circular-progress/index.js +3 -4
- package/esm/circular-progress/useCircularProgress.d.ts +12 -0
- package/esm/circular-progress/useCircularProgress.js +35 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/list/list-item.js +11 -11
- package/esm/notetip/note-tip.d.ts +2 -0
- package/esm/notetip/note-tip.js +8 -5
- package/esm/skeleton/index.js +9 -4
- package/esm/table/table-body.d.ts +4 -2
- package/esm/table/table-body.js +9 -4
- package/esm/table/table-cell.d.ts +4 -2
- package/esm/table/table-cell.js +19 -3
- package/esm/table/table-types.d.ts +2 -0
- package/esm/table/table.d.ts +4 -1
- package/esm/table/table.js +13 -6
- package/esm/tooltip/index.d.ts +1 -2
- package/esm/tooltip/tooltip-content.d.ts +1 -1
- package/esm/tooltip/tooltip-content.js +5 -5
- package/esm/tooltip/tooltip.d.ts +2 -1
- package/esm/tooltip/tooltip.js +6 -5
- package/package.json +3 -3
- package/dist/circular-progress/CircularProgressbar.d.ts +0 -10
- package/dist/circular-progress/CircularProgressbarWithChildren.d.ts +0 -7
- package/dist/circular-progress/Path.d.ts +0 -9
- package/dist/circular-progress/buildStyles.d.ts +0 -12
- package/dist/circular-progress/constants.d.ts +0 -5
- package/dist/circular-progress/types.d.ts +0 -50
- package/esm/circular-progress/CircularProgressbar.d.ts +0 -10
- package/esm/circular-progress/CircularProgressbar.js +0 -118
- package/esm/circular-progress/CircularProgressbarWithChildren.d.ts +0 -7
- package/esm/circular-progress/CircularProgressbarWithChildren.js +0 -32
- package/esm/circular-progress/Path.d.ts +0 -9
- package/esm/circular-progress/Path.js +0 -52
- package/esm/circular-progress/buildStyles.d.ts +0 -12
- package/esm/circular-progress/buildStyles.js +0 -45
- package/esm/circular-progress/constants.d.ts +0 -5
- package/esm/circular-progress/constants.js +0 -5
- package/esm/circular-progress/types.d.ts +0 -50
- package/esm/circular-progress/types.js +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
4
|
+
import React, { forwardRef, useId } from "react";
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
import { useCircularProgress } from "./useCircularProgress";
|
|
7
|
+
var statusColors = {
|
|
8
|
+
"default": "#3b82f6",
|
|
9
|
+
success: "#10b981",
|
|
10
|
+
warning: "#f59e0b",
|
|
11
|
+
error: "#ef4444"
|
|
12
|
+
};
|
|
13
|
+
var CircularProgress = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var _ref$size = _ref.size,
|
|
15
|
+
size = _ref$size === void 0 ? 140 : _ref$size,
|
|
16
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
17
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 12 : _ref$strokeWidth,
|
|
18
|
+
_ref$value = _ref.value,
|
|
19
|
+
value = _ref$value === void 0 ? 0 : _ref$value,
|
|
20
|
+
_ref$min = _ref.min,
|
|
21
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
22
|
+
_ref$max = _ref.max,
|
|
23
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
24
|
+
_ref$variant = _ref.variant,
|
|
25
|
+
variant = _ref$variant === void 0 ? "determinate" : _ref$variant,
|
|
26
|
+
_ref$status = _ref.status,
|
|
27
|
+
status = _ref$status === void 0 ? "default" : _ref$status,
|
|
28
|
+
_ref$gradient = _ref.gradient,
|
|
29
|
+
gradient = _ref$gradient === void 0 ? true : _ref$gradient,
|
|
30
|
+
_ref$showPercentage = _ref.showPercentage,
|
|
31
|
+
showPercentage = _ref$showPercentage === void 0 ? true : _ref$showPercentage,
|
|
32
|
+
label = _ref.label;
|
|
33
|
+
var _useCircularProgress = useCircularProgress({
|
|
34
|
+
value: value,
|
|
35
|
+
min: min,
|
|
36
|
+
max: max,
|
|
37
|
+
variant: variant
|
|
38
|
+
}),
|
|
39
|
+
percentage = _useCircularProgress.percentage,
|
|
40
|
+
displayValue = _useCircularProgress.displayValue;
|
|
41
|
+
var radius = (size - strokeWidth) / 2;
|
|
42
|
+
var circumference = 2 * Math.PI * radius;
|
|
43
|
+
var strokeDashoffset = circumference - percentage / 100 * circumference;
|
|
44
|
+
var baseColor = statusColors[status];
|
|
45
|
+
|
|
46
|
+
// SSR-SAFE ID
|
|
47
|
+
var gradientId = useId();
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
ref: ref,
|
|
50
|
+
role: "progressbar",
|
|
51
|
+
"aria-valuemin": min,
|
|
52
|
+
"aria-valuemax": max,
|
|
53
|
+
"aria-valuenow": variant === "determinate" ? value : undefined,
|
|
54
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]) + " " + "wrapper"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
56
|
+
width: size,
|
|
57
|
+
height: size,
|
|
58
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
59
|
+
}, gradient && /*#__PURE__*/React.createElement("defs", {
|
|
60
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
61
|
+
}, /*#__PURE__*/React.createElement("linearGradient", {
|
|
62
|
+
id: gradientId,
|
|
63
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
64
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
65
|
+
offset: "0%",
|
|
66
|
+
stopColor: baseColor,
|
|
67
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
68
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
69
|
+
offset: "100%",
|
|
70
|
+
stopColor: "#9333ea",
|
|
71
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
72
|
+
}))), /*#__PURE__*/React.createElement("circle", {
|
|
73
|
+
stroke: "#e5e7eb",
|
|
74
|
+
fill: "none",
|
|
75
|
+
strokeWidth: strokeWidth,
|
|
76
|
+
r: radius,
|
|
77
|
+
cx: size / 2,
|
|
78
|
+
cy: size / 2,
|
|
79
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
|
|
80
|
+
}), /*#__PURE__*/React.createElement(motion.circle, {
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke: gradient ? "url(#".concat(gradientId, ")") : baseColor,
|
|
83
|
+
strokeWidth: strokeWidth,
|
|
84
|
+
strokeLinecap: "round",
|
|
85
|
+
strokeDasharray: circumference,
|
|
86
|
+
r: radius,
|
|
87
|
+
cx: size / 2,
|
|
88
|
+
cy: size / 2,
|
|
89
|
+
initial: false,
|
|
90
|
+
animate: {
|
|
91
|
+
strokeDashoffset: variant === "determinate" ? strokeDashoffset : circumference * 0.4,
|
|
92
|
+
rotate: variant === "indeterminate" ? 360 : 0
|
|
93
|
+
},
|
|
94
|
+
transition: variant === "indeterminate" ? {
|
|
95
|
+
repeat: Infinity,
|
|
96
|
+
duration: 1.2,
|
|
97
|
+
ease: "linear"
|
|
98
|
+
} : {
|
|
99
|
+
duration: 0.6,
|
|
100
|
+
ease: "easeOut"
|
|
101
|
+
}
|
|
102
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]) + " " + "label"
|
|
104
|
+
}, label !== null && label !== void 0 ? label : showPercentage && variant === "determinate" ? "".concat(Math.round(displayValue), "%") : null), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
105
|
+
id: "4042284457",
|
|
106
|
+
dynamic: [size * 0.18]
|
|
107
|
+
}, ".wrapper.__jsx-style-dynamic-selector{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}svg.__jsx-style-dynamic-selector{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.label.__jsx-style-dynamic-selector{position:absolute;font-weight:700;font-size:".concat(size * 0.18, "px;}")));
|
|
108
|
+
});
|
|
109
|
+
CircularProgress.displayName = "CircularProgress";
|
|
110
|
+
export default CircularProgress;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { CircularProgressBar, CircularProgress, buildStyles };
|
|
1
|
+
import CircularProgress from "./CircularProgress";
|
|
2
|
+
export { useCircularProgress } from "./useCircularProgress";
|
|
3
|
+
export default CircularProgress;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { CircularProgressBar, CircularProgress, buildStyles };
|
|
1
|
+
import CircularProgress from "./CircularProgress";
|
|
2
|
+
export { useCircularProgress } from "./useCircularProgress";
|
|
3
|
+
export default CircularProgress;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ProgressVariant = "determinate" | "indeterminate";
|
|
2
|
+
interface UseCircularProgressProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
variant?: ProgressVariant;
|
|
7
|
+
}
|
|
8
|
+
export declare function useCircularProgress({ value, min, max, variant, }: UseCircularProgressProps): {
|
|
9
|
+
percentage: number;
|
|
10
|
+
displayValue: number;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
export function useCircularProgress(_ref) {
|
|
6
|
+
var _ref$value = _ref.value,
|
|
7
|
+
value = _ref$value === void 0 ? 0 : _ref$value,
|
|
8
|
+
_ref$min = _ref.min,
|
|
9
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
10
|
+
_ref$max = _ref.max,
|
|
11
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
12
|
+
_ref$variant = _ref.variant,
|
|
13
|
+
variant = _ref$variant === void 0 ? "determinate" : _ref$variant;
|
|
14
|
+
var normalizedValue = useMemo(function () {
|
|
15
|
+
if (variant !== "determinate") return 0;
|
|
16
|
+
return Math.min(Math.max(value, min), max);
|
|
17
|
+
}, [value, min, max, variant]);
|
|
18
|
+
var percentage = useMemo(function () {
|
|
19
|
+
if (variant !== "determinate") return 0;
|
|
20
|
+
return (normalizedValue - min) / (max - min) * 100;
|
|
21
|
+
}, [normalizedValue, min, max, variant]);
|
|
22
|
+
|
|
23
|
+
// SSR-safe animated number
|
|
24
|
+
var _useState = useState(normalizedValue),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
displayValue = _useState2[0],
|
|
27
|
+
setDisplayValue = _useState2[1];
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
setDisplayValue(normalizedValue);
|
|
30
|
+
}, [normalizedValue]);
|
|
31
|
+
return {
|
|
32
|
+
percentage: percentage,
|
|
33
|
+
displayValue: displayValue
|
|
34
|
+
};
|
|
35
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { default as Checkbox } from './checkbox';
|
|
|
20
20
|
export type { CheckboxProps, CheckboxGroupProps } from './checkbox';
|
|
21
21
|
export { default as Code } from './code';
|
|
22
22
|
export type { CodeProps } from './code';
|
|
23
|
-
export {
|
|
23
|
+
export { default as CircularProgress, useCircularProgress } from './circular-progress';
|
|
24
24
|
export { default as Collapse } from './collapse';
|
|
25
25
|
export type { CollapseProps, CollapseGroupProps } from './collapse';
|
|
26
26
|
export { default as Description } from './description';
|
|
@@ -80,6 +80,7 @@ export { default as Spinner } from './spinner';
|
|
|
80
80
|
export type { SpinnerProps } from './spinner';
|
|
81
81
|
export { default as Table } from './table';
|
|
82
82
|
export type { TableProps, TableColumnProps } from './table';
|
|
83
|
+
export type { RowErrorMap, FieldError } from './table/table-types';
|
|
83
84
|
export { default as Tabs } from './tabs';
|
|
84
85
|
export type { TabsProps } from './tabs';
|
|
85
86
|
export { default as Tag } from './tag';
|
package/esm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { default as Capacity } from './capacity';
|
|
|
12
12
|
export { default as Card } from './card';
|
|
13
13
|
export { default as Checkbox } from './checkbox';
|
|
14
14
|
export { default as Code } from './code';
|
|
15
|
-
export {
|
|
15
|
+
export { default as CircularProgress, useCircularProgress } from './circular-progress';
|
|
16
16
|
export { default as Collapse } from './collapse';
|
|
17
17
|
export { default as Description } from './description';
|
|
18
18
|
export { default as Display } from './display';
|
package/esm/list/list-item.js
CHANGED
|
@@ -59,23 +59,23 @@ var ListItemComponent = function ListItemComponent(_ref) {
|
|
|
59
59
|
},
|
|
60
60
|
onClick: clickHandler
|
|
61
61
|
}, props, {
|
|
62
|
-
className: _JSXStyle.dynamic([["
|
|
62
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + (props && props.className != null && props.className || classes || "")
|
|
63
63
|
}), children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: _JSXStyle.dynamic([["
|
|
65
|
-
}, /*#__PURE__*/React.createElement("
|
|
66
|
-
className: _JSXStyle.dynamic([["
|
|
64
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + "item-left"
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]])
|
|
67
67
|
}, leading), /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
className: _JSXStyle.dynamic([["
|
|
68
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + "item-description"
|
|
69
69
|
}, /*#__PURE__*/React.createElement("p", {
|
|
70
|
-
className: _JSXStyle.dynamic([["
|
|
70
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + "item-description-primary"
|
|
71
71
|
}, primary), secondary && /*#__PURE__*/React.createElement("small", {
|
|
72
|
-
className: _JSXStyle.dynamic([["
|
|
72
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + "item-description-secondary"
|
|
73
73
|
}, secondary))), /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
className: _JSXStyle.dynamic([["
|
|
74
|
+
className: _JSXStyle.dynamic([["2945599429", [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + "item-right"
|
|
75
75
|
}, trailing)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
76
|
-
id: "
|
|
77
|
-
dynamic: [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.
|
|
78
|
-
}, ".item.__jsx-style-dynamic-selector{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, ";box-sizing:border-box;-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";color:").concat(theme.palette.accents_5, ";-webkit-transition:color,background-color 150ms linear;transition:color,background-color 150ms linear;line-height:1.25em;font-size:").concat(SCALES.font(0.
|
|
76
|
+
id: "2945599429",
|
|
77
|
+
dynamic: [direction, justify, alignItems, theme.palette.accents_5, SCALES.font(0.775), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]
|
|
78
|
+
}, ".item.__jsx-style-dynamic-selector{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, ";box-sizing:border-box;gap:5px;-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";color:").concat(theme.palette.accents_5, ";-webkit-transition:color,background-color 150ms linear;transition:color,background-color 150ms linear;line-height:1.25em;font-size:").concat(SCALES.font(0.775), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0.75), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0.75), ";cursor:").concat(hasHandler ? 'pointer' : 'default', ";}.item-description.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.item-description-primary.__jsx-style-dynamic-selector{font-weight:500;margin:0;}.item-description-secondary.__jsx-style-dynamic-selector{margin:0;}.item-left.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:0.7rem;}.item.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}.item.line.__jsx-style-dynamic-selector{line-height:0;padding:0;background-color:").concat(theme.palette.border, ";height:").concat(SCALES.height(0.0625), ";margin:").concat(SCALES.mt(0.35), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0.35), " ").concat(SCALES.ml(0), ";width:").concat(SCALES.width(1, '100%'), ";}.item.title.__jsx-style-dynamic-selector{font-weight:500;font-size:").concat(SCALES.font(0.925), ";color:").concat(theme.palette.foreground, ";}"))), line && /*#__PURE__*/React.createElement(ListItem, {
|
|
79
79
|
line: true,
|
|
80
80
|
showTitle: false
|
|
81
81
|
}));
|
package/esm/notetip/note-tip.js
CHANGED
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _JSXStyle from "../styled-jsx.es.js";
|
|
3
3
|
import React, { useState, useRef, useEffect, useLayoutEffect } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
|
-
import { useTheme } from '@helpdice/theme';
|
|
5
|
+
import { useTheme, useClasses } from '@helpdice/theme';
|
|
6
6
|
var OFFSET = 8;
|
|
7
7
|
var Notetip = function Notetip(_ref) {
|
|
8
8
|
var children = _ref.children,
|
|
@@ -14,7 +14,10 @@ var Notetip = function Notetip(_ref) {
|
|
|
14
14
|
_ref$duration = _ref.duration,
|
|
15
15
|
duration = _ref$duration === void 0 ? 200 : _ref$duration,
|
|
16
16
|
_ref$animation = _ref.animation,
|
|
17
|
-
animation = _ref$animation === void 0 ? 'fade' : _ref$animation
|
|
17
|
+
animation = _ref$animation === void 0 ? 'fade' : _ref$animation,
|
|
18
|
+
_ref$disabled = _ref.disabled,
|
|
19
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
20
|
+
className = _ref.className;
|
|
18
21
|
var theme = useTheme();
|
|
19
22
|
var referenceRef = useRef(null);
|
|
20
23
|
var tooltipRef = useRef(null);
|
|
@@ -90,8 +93,8 @@ var Notetip = function Notetip(_ref) {
|
|
|
90
93
|
return setOpen(false);
|
|
91
94
|
}, 2000);
|
|
92
95
|
},
|
|
93
|
-
className: _JSXStyle.dynamic([["633836393", [theme.palette.accents_1, duration, duration, duration]]])
|
|
94
|
-
}, children), show && /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: _JSXStyle.dynamic([["633836393", [theme.palette.accents_1, duration, duration, duration]]]) + " " + (useClasses('', className) || "")
|
|
97
|
+
}, children), show && !disabled ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
|
|
95
98
|
ref: tooltipRef,
|
|
96
99
|
style: {
|
|
97
100
|
position: 'fixed',
|
|
@@ -100,7 +103,7 @@ var Notetip = function Notetip(_ref) {
|
|
|
100
103
|
transitionDuration: "".concat(duration, "ms")
|
|
101
104
|
},
|
|
102
105
|
className: _JSXStyle.dynamic([["633836393", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
|
|
103
|
-
}, text), document.body), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
106
|
+
}, text), document.body) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
104
107
|
id: "633836393",
|
|
105
108
|
dynamic: [theme.palette.accents_1, duration, duration, duration]
|
|
106
109
|
}, ".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);}}")));
|
package/esm/skeleton/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import _JSXStyle from "../styled-jsx.es.js";
|
|
4
4
|
/* "use client" */
|
|
5
5
|
|
|
6
|
+
import { useTheme } from '@helpdice/theme';
|
|
6
7
|
import React, { useState } from 'react';
|
|
7
8
|
var Skeleton = function Skeleton(_ref) {
|
|
8
9
|
var width = _ref.width,
|
|
@@ -13,6 +14,7 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
13
14
|
duration = _ref.duration,
|
|
14
15
|
children = _ref.children,
|
|
15
16
|
loaded = _ref.loaded;
|
|
17
|
+
var theme = useTheme();
|
|
16
18
|
var _useState = useState(false),
|
|
17
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
20
|
isHidden = _useState2[0],
|
|
@@ -36,13 +38,16 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
36
38
|
// }
|
|
37
39
|
// }
|
|
38
40
|
|
|
41
|
+
var lightGradient = "linear-gradient(90deg, rgba(211, 211, 211, 0) 0, rgba(211, 211, 211, 0.6) 70%, rgba(211, 211, 211, 0))";
|
|
42
|
+
var darkGradient = "linear-gradient(90deg, rgba(211, 211, 211, 0) 0, rgba(42, 40, 40, 0.6) 70%, rgba(211, 211, 211, 0))";
|
|
39
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: "
|
|
44
|
+
className: _JSXStyle.dynamic([["641831790", [theme.palette.background, theme.type == "dark" ? darkGradient : lightGradient]]])
|
|
41
45
|
}, loaded || isHidden ? children : /*#__PURE__*/React.createElement("div", {
|
|
42
46
|
style: skeletonStyle,
|
|
43
|
-
className: "
|
|
47
|
+
className: _JSXStyle.dynamic([["641831790", [theme.palette.background, theme.type == "dark" ? darkGradient : lightGradient]]]) + " " + "skeleton-box"
|
|
44
48
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
45
|
-
id: "
|
|
46
|
-
|
|
49
|
+
id: "641831790",
|
|
50
|
+
dynamic: [theme.palette.background, theme.type == "dark" ? darkGradient : lightGradient]
|
|
51
|
+
}, ".skeleton-box.__jsx-style-dynamic-selector{display:inline-block;position:relative;overflow:hidden;background-color:".concat(theme.palette.background, ";text-align:center;}.skeleton-box.__jsx-style-dynamic-selector::after{position:absolute;top:0;right:0;bottom:0;left:0;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);background-image:").concat(theme.type == "dark" ? darkGradient : lightGradient, ";-webkit-animation:shimmer-__jsx-style-dynamic-selector 1.5s infinite;animation:shimmer-__jsx-style-dynamic-selector 1.5s infinite;content:'';}@-webkit-keyframes shimmer-__jsx-style-dynamic-selector{100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}@keyframes shimmer-__jsx-style-dynamic-selector{100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}")));
|
|
47
52
|
};
|
|
48
53
|
export default Skeleton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TableDataItemBase, TableOnCellClick, TableOnRowClick, TableRowClassNameHandler } from './table-types';
|
|
2
|
+
import { RowErrorMap, TableDataItemBase, TableOnCellClick, TableOnRowClick, TableRowClassNameHandler } from './table-types';
|
|
3
3
|
interface Props<TableDataItem extends TableDataItemBase> {
|
|
4
4
|
hover: boolean;
|
|
5
5
|
emptyText: string;
|
|
@@ -7,15 +7,17 @@ interface Props<TableDataItem extends TableDataItemBase> {
|
|
|
7
7
|
onCell?: TableOnCellClick<TableDataItem>;
|
|
8
8
|
data: Array<TableDataItem>;
|
|
9
9
|
className?: string;
|
|
10
|
+
rowErrors: RowErrorMap;
|
|
10
11
|
rowClassName: TableRowClassNameHandler<TableDataItem>;
|
|
11
12
|
rowDraggable?: boolean;
|
|
12
13
|
readOnly?: boolean;
|
|
14
|
+
isLoading: boolean;
|
|
13
15
|
onSelected?: (selected: any[]) => void;
|
|
14
16
|
}
|
|
15
17
|
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props<any>>;
|
|
16
18
|
export type TableBodyProps<TableDataItem extends TableDataItemBase> = Props<TableDataItem> & NativeAttrs;
|
|
17
19
|
declare const TableBody: {
|
|
18
|
-
<TableDataItem extends TableDataItemBase>({ data, emptyText, onRow, onCell, rowClassName, rowDraggable, readOnly, onSelected }: TableBodyProps<TableDataItem>): React.JSX.Element;
|
|
20
|
+
<TableDataItem extends TableDataItemBase>({ data, emptyText, onRow, onCell, rowClassName, isLoading, rowErrors, rowDraggable, readOnly, onSelected }: TableBodyProps<TableDataItem>): React.JSX.Element;
|
|
19
21
|
displayName: string;
|
|
20
22
|
};
|
|
21
23
|
export default TableBody;
|
package/esm/table/table-body.js
CHANGED
|
@@ -14,6 +14,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
14
14
|
onRow = _ref.onRow,
|
|
15
15
|
onCell = _ref.onCell,
|
|
16
16
|
rowClassName = _ref.rowClassName,
|
|
17
|
+
isLoading = _ref.isLoading,
|
|
18
|
+
rowErrors = _ref.rowErrors,
|
|
17
19
|
_ref$rowDraggable = _ref.rowDraggable,
|
|
18
20
|
rowDraggable = _ref$rowDraggable === void 0 ? false : _ref$rowDraggable,
|
|
19
21
|
_ref$readOnly = _ref.readOnly,
|
|
@@ -83,6 +85,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
83
85
|
// console.log(frow);
|
|
84
86
|
var isRowSelected = selected.indexOf(row) !== -1;
|
|
85
87
|
var hoverColor = theme.palette.accents_1;
|
|
88
|
+
var rowError = rowErrors === null || rowErrors === void 0 ? void 0 : rowErrors.get(row.id);
|
|
86
89
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("tr", {
|
|
87
90
|
draggable: rowDraggable,
|
|
88
91
|
role: "checkbox",
|
|
@@ -103,17 +106,19 @@ var TableBody = function TableBody(_ref) {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
|
-
className: _JSXStyle.dynamic([["
|
|
109
|
+
className: _JSXStyle.dynamic([["2988536338", [theme.palette.accents_1, theme.palette.warningLighter, theme.palette.error, theme.palette.border, rowError ? theme.type == "dark" ? theme.palette.accents_1 : theme.palette.accents_8 : theme.palette.accents_6]]]) + " " + (useClasses("".concat(rowDraggable ? 'draggable' : 'hover', " ").concat(rowError ? 'row-error' : '', " ").concat(className)) || "")
|
|
107
110
|
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
108
111
|
columns: cols,
|
|
109
112
|
row: rw,
|
|
113
|
+
isLoading: isLoading,
|
|
114
|
+
errors: rowError,
|
|
110
115
|
rowIndex: index,
|
|
111
116
|
emptyText: emptyText,
|
|
112
117
|
onCellClick: onCell
|
|
113
118
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
114
|
-
id: "
|
|
115
|
-
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
116
|
-
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(2.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
119
|
+
id: "2988536338",
|
|
120
|
+
dynamic: [theme.palette.accents_1, theme.palette.warningLighter, theme.palette.error, theme.palette.border, rowError ? theme.type == "dark" ? theme.palette.accents_1 : theme.palette.accents_8 : theme.palette.accents_6]
|
|
121
|
+
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.row-error.__jsx-style-dynamic-selector{background:").concat(theme.palette.warningLighter, " !important;border:2px dashed ").concat(theme.palette.error, ";margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(rowError ? theme.type == "dark" ? theme.palette.accents_1 : theme.palette.accents_8 : theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(2.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
// if (data?.length === 0) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TableDataItemBase, TableAbstractColumn, TableOnCellClick } from './table-types';
|
|
2
|
+
import { TableDataItemBase, TableAbstractColumn, TableOnCellClick, FieldError } from './table-types';
|
|
3
3
|
interface Props<TableDataItem extends TableDataItemBase> {
|
|
4
4
|
columns: Array<TableAbstractColumn<TableDataItem>>;
|
|
5
5
|
row: TableDataItem;
|
|
6
6
|
rowIndex: number;
|
|
7
7
|
emptyText: string;
|
|
8
|
+
errors?: FieldError;
|
|
8
9
|
onCellClick?: TableOnCellClick<TableDataItem>;
|
|
10
|
+
isLoading: boolean;
|
|
9
11
|
}
|
|
10
12
|
export type TableCellData<TableDataItem> = {
|
|
11
13
|
row: number;
|
|
@@ -14,5 +16,5 @@ export type TableCellData<TableDataItem> = {
|
|
|
14
16
|
};
|
|
15
17
|
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props<any>>;
|
|
16
18
|
export type TableCellProps<TableDataItem extends TableDataItemBase> = Props<TableDataItem> & NativeAttrs;
|
|
17
|
-
declare const TableCell: <TableDataItem extends TableDataItemBase>({ columns, row, rowIndex, emptyText, onCellClick }: TableCellProps<TableDataItem>) => React.JSX.Element;
|
|
19
|
+
declare const TableCell: <TableDataItem extends TableDataItemBase>({ columns, row, errors, rowIndex, emptyText, onCellClick, isLoading }: TableCellProps<TableDataItem>) => React.JSX.Element;
|
|
18
20
|
export default TableCell;
|
package/esm/table/table-cell.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import Tooltip from '../tooltip';
|
|
4
|
+
import Skeleton from '../skeleton';
|
|
3
5
|
var TableCell = function TableCell(_ref) {
|
|
4
6
|
var columns = _ref.columns,
|
|
5
7
|
row = _ref.row,
|
|
8
|
+
_ref$errors = _ref.errors,
|
|
9
|
+
errors = _ref$errors === void 0 ? {} : _ref$errors,
|
|
6
10
|
rowIndex = _ref.rowIndex,
|
|
7
11
|
emptyText = _ref.emptyText,
|
|
8
|
-
onCellClick = _ref.onCellClick
|
|
12
|
+
onCellClick = _ref.onCellClick,
|
|
13
|
+
isLoading = _ref.isLoading;
|
|
9
14
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
10
15
|
return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
|
|
11
16
|
var _ref2, _currentRowValue$valu, _row$_id;
|
|
12
17
|
var currentRowValue = row[column.prop];
|
|
13
18
|
var cellValue = (_ref2 = (_currentRowValue$valu = currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.value) !== null && _currentRowValue$valu !== void 0 ? _currentRowValue$valu : currentRowValue) !== null && _ref2 !== void 0 ? _ref2 : emptyText;
|
|
14
19
|
var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
|
|
20
|
+
var hasError = errors[column.prop];
|
|
15
21
|
return /*#__PURE__*/React.createElement("td", {
|
|
16
22
|
style: _extends({
|
|
17
23
|
fontSize: "".concat(column === null || column === void 0 ? void 0 : column.fontSize),
|
|
@@ -20,6 +26,7 @@ var TableCell = function TableCell(_ref) {
|
|
|
20
26
|
paddingRight: '0.3rem',
|
|
21
27
|
color: "".concat(column === null || column === void 0 ? void 0 : column.color),
|
|
22
28
|
boxSizing: 'border-box',
|
|
29
|
+
border: "".concat(hasError ? '2px dashed red' : 'none'),
|
|
23
30
|
whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
|
|
24
31
|
}, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
|
|
25
32
|
"data-column": column.prop,
|
|
@@ -28,8 +35,17 @@ var TableCell = function TableCell(_ref) {
|
|
|
28
35
|
return onCellClick && onCellClick(currentRowValue, rowIndex, index);
|
|
29
36
|
},
|
|
30
37
|
className: column.className
|
|
31
|
-
}, /*#__PURE__*/React.createElement(
|
|
32
|
-
|
|
38
|
+
}, isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
39
|
+
borderRadius: "10px",
|
|
40
|
+
style: {
|
|
41
|
+
margin: '5px 0px 5px 5px'
|
|
42
|
+
},
|
|
43
|
+
width: "95%",
|
|
44
|
+
height: 20
|
|
45
|
+
}) : /*#__PURE__*/React.createElement(Tooltip.Small, {
|
|
46
|
+
className: "cell",
|
|
47
|
+
text: hasError,
|
|
48
|
+
disabled: hasError ? false : true
|
|
33
49
|
}, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
|
|
34
50
|
}));
|
|
35
51
|
/* eslint-enable */
|
|
@@ -21,3 +21,5 @@ export type TableOnRowClick<TableDataItem> = (rowData: TableDataItem, rowIndex:
|
|
|
21
21
|
export type TableOnCellClick<TableDataItem> = (cellValue: TableDataItem[keyof TableDataItem], rowIndex: number, colunmIndex: number) => void;
|
|
22
22
|
export type TableOnChange<TableDataItem> = (data: Array<TableDataItem>) => void;
|
|
23
23
|
export type TableRowClassNameHandler<TableDataItem> = (rowData: TableDataItem, rowIndex: number) => string;
|
|
24
|
+
export type FieldError = Record<string, string>;
|
|
25
|
+
export type RowErrorMap = Map<number | string, FieldError>;
|
package/esm/table/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TableDataItemBase, TableOnCellClick, TableOnChange, TableOnRowClick, TableRowClassNameHandler } from './table-types';
|
|
2
|
+
import { RowErrorMap, TableDataItemBase, TableOnCellClick, TableOnChange, TableOnRowClick, TableRowClassNameHandler } from './table-types';
|
|
3
3
|
import { ScaleProps } from '../use-scale';
|
|
4
4
|
interface Props<TableDataItem extends TableDataItemBase> {
|
|
5
5
|
data?: Array<TableDataItem>;
|
|
@@ -25,7 +25,10 @@ interface Props<TableDataItem extends TableDataItemBase> {
|
|
|
25
25
|
previousCursor?: string;
|
|
26
26
|
nextCursor?: string;
|
|
27
27
|
hasMore?: boolean;
|
|
28
|
+
rowErrors?: RowErrorMap;
|
|
28
29
|
containerStyle?: object;
|
|
30
|
+
loading?: string;
|
|
31
|
+
isLoading?: boolean;
|
|
29
32
|
onNextPage?: (next?: string) => void;
|
|
30
33
|
onPreviousPage?: (prev?: string) => void;
|
|
31
34
|
}
|
package/esm/table/table.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
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", "containerStyle", "rowClassName"];
|
|
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", "loading", "isLoading", "containerStyle", "rowErrors", "rowClassName"];
|
|
6
6
|
import _JSXStyle from "../styled-jsx.es.js";
|
|
7
7
|
/* "use client" */
|
|
8
8
|
|
|
@@ -20,6 +20,7 @@ import Button from '../button';
|
|
|
20
20
|
import Tooltip from '../tooltip';
|
|
21
21
|
import Placeholder from '../placeholder';
|
|
22
22
|
import { useTheme } from '@helpdice/theme';
|
|
23
|
+
import Loading from 'components/loading';
|
|
23
24
|
function TableComponent(tableProps) {
|
|
24
25
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
25
26
|
var _ref = tableProps,
|
|
@@ -59,7 +60,13 @@ function TableComponent(tableProps) {
|
|
|
59
60
|
viewLength = _ref.viewLength,
|
|
60
61
|
_ref$className = _ref.className,
|
|
61
62
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
63
|
+
_ref$loading = _ref.loading,
|
|
64
|
+
loading = _ref$loading === void 0 ? 'default' : _ref$loading,
|
|
65
|
+
_ref$isLoading = _ref.isLoading,
|
|
66
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
62
67
|
containerStyle = _ref.containerStyle,
|
|
68
|
+
_ref$rowErrors = _ref.rowErrors,
|
|
69
|
+
rowErrors = _ref$rowErrors === void 0 ? new Map() : _ref$rowErrors,
|
|
63
70
|
_ref$rowClassName = _ref.rowClassName,
|
|
64
71
|
rowClassName = _ref$rowClassName === void 0 ? function () {
|
|
65
72
|
return '';
|
|
@@ -144,19 +151,21 @@ function TableComponent(tableProps) {
|
|
|
144
151
|
showFilters: showFilters,
|
|
145
152
|
columns: columns,
|
|
146
153
|
width: width
|
|
147
|
-
}), /*#__PURE__*/React.createElement(TableBody, {
|
|
154
|
+
}), !isLoading && /*#__PURE__*/React.createElement(TableBody, {
|
|
148
155
|
data: data,
|
|
149
156
|
hover: hover,
|
|
150
157
|
emptyText: emptyText,
|
|
151
158
|
onRow: onRow,
|
|
152
|
-
onCell: onCell
|
|
159
|
+
onCell: onCell,
|
|
160
|
+
isLoading: loading === "skeleton" && isLoading,
|
|
161
|
+
rowErrors: rowErrors
|
|
153
162
|
// textPlaceholder={textPlaceholder}
|
|
154
163
|
,
|
|
155
164
|
rowClassName: rowClassName,
|
|
156
165
|
rowDraggable: rowDraggable,
|
|
157
166
|
readOnly: readOnly,
|
|
158
167
|
onSelected: onSelected
|
|
159
|
-
}), children), data.length == 0 && /*#__PURE__*/React.createElement(Placeholder, {
|
|
168
|
+
}), children), loading === "default" && isLoading ? /*#__PURE__*/React.createElement(Loading, null) : data.length == 0 && /*#__PURE__*/React.createElement(Placeholder, {
|
|
160
169
|
empty: true,
|
|
161
170
|
textOnly: textPlaceholder,
|
|
162
171
|
msg: "No Data to show"
|
|
@@ -171,7 +180,6 @@ function TableComponent(tableProps) {
|
|
|
171
180
|
className: _JSXStyle.dynamic([["1809040460", [SCALES.font(1), SCALES.width(1, '100%'), 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), theme.palette.background]]])
|
|
172
181
|
}, /*#__PURE__*/React.createElement(Tooltip.Small, {
|
|
173
182
|
text: "Previous",
|
|
174
|
-
placement: "bottom",
|
|
175
183
|
type: "dark"
|
|
176
184
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
177
185
|
disabled: !previousCursor,
|
|
@@ -184,7 +192,6 @@ function TableComponent(tableProps) {
|
|
|
184
192
|
iconRight: /*#__PURE__*/React.createElement(ChevronLeft, null)
|
|
185
193
|
})), /*#__PURE__*/React.createElement(Tooltip.Small, {
|
|
186
194
|
text: "Next",
|
|
187
|
-
placement: "bottom",
|
|
188
195
|
type: "dark"
|
|
189
196
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
190
197
|
disabled: !nextCursor,
|
package/esm/tooltip/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Tooltip from './tooltip';
|
|
2
2
|
export type { TooltipProps, TooltipOnVisibleChange, TooltipTypes, TooltipTriggers, TooltipPlacement, } from './tooltip';
|
|
3
|
-
import SmallTooltip from './tooltip-small';
|
|
4
3
|
export type TooltipComponentType = typeof Tooltip & {
|
|
5
|
-
Small: typeof
|
|
4
|
+
Small: typeof Tooltip;
|
|
6
5
|
};
|
|
7
6
|
declare const _default: TooltipComponentType;
|
|
8
7
|
export default _default;
|